From 889d5dd29a2221a788a7118afd698047f607c5fd Mon Sep 17 00:00:00 2001 From: Daniele Cinti Date: Tue, 15 Mar 2016 18:56:28 +0100 Subject: [PATCH] Built motion from commit 4253e76.|0.0.66 --- public/assets/plugins/jscripty/js/Actions.js | 635 +- public/assets/plugins/jscripty/js/Dialogs.js | 1153 ++- public/assets/plugins/jscripty/js/Editor.js | 889 +- public/assets/plugins/jscripty/js/EditorUi.js | 1326 ++- public/assets/plugins/jscripty/js/Graph.js | 749 +- public/assets/plugins/jscripty/js/Menus.js | 717 +- public/assets/plugins/jscripty/js/Shapes.js | 1235 ++- public/assets/plugins/jscripty/js/Sidebar.js | 783 +- public/assets/plugins/jscripty/js/Toolbar.js | 408 +- public/assets/plugins/jscripty/js/custom.js | 284 +- public/assets/plugins/mxgraph/js/mxClient.js |18738 +++++++++++++++++++- public/assets/plugins/square/js/Actions.js | 635 +- public/assets/plugins/square/js/Dialogs.js | 1049 ++- public/assets/plugins/square/js/Editor.js | 889 +- public/assets/plugins/square/js/EditorUi.js | 1485 ++- public/assets/plugins/square/js/Graph.js | 749 +- public/assets/plugins/square/js/Menus.js | 717 +- public/assets/plugins/square/js/Shapes.js | 1235 ++- public/assets/plugins/square/js/Sidebar.js | 905 +- public/assets/plugins/square/js/Toolbar.js | 408 +- public/assets/plugins/square/js/custom.js | 284 +- server/api/action/action.controller.js | 114 +- server/api/action/action.socket.js | 25 +- server/api/action/index.js | 20 +- server/api/agent/agent.controller.js | 153 +- server/api/agent/agent.socket.js | 34 +- server/api/agent/index.js | 18 +- server/api/ami/ami.ami.js | 38 +- server/api/ami/ami.controller.js | 102 +- server/api/ami/ami.socket.js | 25 +- server/api/ami/ami.spec.js | 21 +- server/api/ami/index.js | 17 +- server/api/automation/automation.controller.js | 201 +- server/api/automation/automation.socket.js | 25 +- server/api/automation/automation.spec.js | 21 +- server/api/automation/index.js | 18 +- .../api/canned_answer/canned_answer.controller.js | 129 +- server/api/canned_answer/canned_answer.socket.js | 25 +- server/api/canned_answer/index.js | 19 +- server/api/chanspy/chanspy.controller.js | 108 +- server/api/chanspy/chanspy.socket.js | 25 +- server/api/chanspy/index.js | 18 +- .../chat_application.controller.js | 106 +- .../chat_application/chat_application.socket.js | 25 +- .../api/chat_application/chat_application.spec.js | 21 +- server/api/chat_application/index.js | 16 +- server/api/chat_enquiry/enquiry.controller.js | 107 +- server/api/chat_enquiry/enquiry.socket.js | 25 +- server/api/chat_enquiry/index.js | 16 +- server/api/chat_message/chat_message.controller.js | 268 +- server/api/chat_message/chat_message.socket.js | 60 +- server/api/chat_message/chat_message.spec.js | 21 +- server/api/chat_message/index.js | 16 +- .../chat_proactive_action.controller.js | 113 +- .../chat_proactive_action.socket.js | 25 +- server/api/chat_proactive_action/index.js | 17 +- server/api/chat_proactive_action/index.spec.js | 98 +- server/api/chat_queue/chat_queue.controller.js | 201 +- server/api/chat_queue/chat_queue.socket.js | 25 +- server/api/chat_queue/index.js | 22 +- server/api/chat_room/chat_room.controller.js | 500 +- server/api/chat_room/chat_room.socket.js | 31 +- server/api/chat_room/index.js | 23 +- server/api/chat_visitor/chat_visitor.controller.js | 105 +- server/api/chat_visitor/chat_visitor.socket.js | 28 +- server/api/chat_visitor/index.js | 16 +- server/api/chat_website/chat_website.controller.js | 384 +- server/api/chat_website/chat_website.socket.js | 25 +- server/api/chat_website/index.js | 30 +- .../chat_websites_field.controller.js | 113 +- .../chat_websites_field.socket.js | 25 +- server/api/chat_websites_field/index.js | 17 +- server/api/chat_websites_field/index.spec.js | 98 +- server/api/company/company.controller.js | 157 +- server/api/company/company.socket.js | 25 +- server/api/company/company.spec.js | 21 +- server/api/company/index.js | 19 +- .../contact_manager/contact_manager.controller.js | 430 +- .../api/contact_manager/contact_manager.socket.js | 25 +- server/api/contact_manager/contact_manager.spec.js | 21 +- server/api/contact_manager/index.js | 20 +- .../api/custom_report/custom_report.controller.js | 327 +- server/api/custom_report/custom_report.socket.js | 25 +- server/api/custom_report/custom_report.spec.js | 21 +- server/api/custom_report/index.js | 22 +- server/api/dashboard/dashboard.controller.js | 148 +- server/api/dashboard/dashboard.socket.js | 28 +- server/api/dashboard/dashboard.spec.js | 21 +- server/api/dashboard/index.js | 20 +- .../default_report/default_report.controller.js | 235 +- server/api/default_report/default_report.socket.js | 25 +- server/api/default_report/default_report.spec.js | 21 +- server/api/default_report/index.js | 20 +- server/api/desk_account/desk_account.controller.js | 257 +- server/api/desk_account/desk_account.socket.js | 25 +- server/api/desk_account/desk_account.spec.js | 21 +- server/api/desk_account/index.js | 20 +- .../desk_configuration.controller.js | 146 +- .../desk_configuration.socket.js | 25 +- server/api/desk_configuration/index.js | 20 +- server/api/desk_configuration/index.spec.js | 98 +- server/api/desk_field/desk_field.controller.js | 105 +- server/api/desk_field/desk_field.socket.js | 25 +- server/api/desk_field/index.js | 19 +- server/api/desk_field/index.spec.js | 98 +- .../extracted_report.controller.js | 198 +- .../extracted_report/extracted_report.socket.js | 25 +- .../api/extracted_report/extracted_report.spec.js | 21 +- server/api/extracted_report/index.js | 19 +- server/api/fax_account/fax_account.controller.js | 375 +- server/api/fax_account/fax_account.socket.js | 25 +- server/api/fax_account/fax_account.spec.js | 21 +- server/api/fax_account/index.js | 18 +- .../fax_application/fax_application.controller.js | 95 +- .../api/fax_application/fax_application.socket.js | 25 +- server/api/fax_application/fax_application.spec.js | 21 +- server/api/fax_application/index.js | 16 +- server/api/fax_message/fax_message.ami.js | 65 +- server/api/fax_message/fax_message.controller.js | 423 +- server/api/fax_message/fax_message.socket.js | 86 +- server/api/fax_message/fax_message.spec.js | 21 +- server/api/fax_message/index.js | 17 +- server/api/fax_queue/fax_queue.controller.js | 186 +- server/api/fax_queue/fax_queue.socket.js | 25 +- server/api/fax_queue/fax_queue.spec.js | 21 +- server/api/fax_queue/index.js | 21 +- server/api/fax_room/fax_room.controller.js | 152 +- server/api/fax_room/fax_room.kue.js | 65 +- server/api/fax_room/fax_room.socket.js | 25 +- server/api/fax_room/fax_room.spec.js | 21 +- server/api/fax_room/index.js | 18 +- .../freshdesk_account.controller.js | 240 +- .../freshdesk_account/freshdesk_account.socket.js | 25 +- server/api/freshdesk_account/index.js | 22 +- server/api/freshdesk_account/index.spec.js | 98 +- .../freshdesk_configuration.controller.js | 147 +- .../freshdesk_configuration.socket.js | 25 +- server/api/freshdesk_configuration/index.js | 20 +- server/api/freshdesk_configuration/index.spec.js | 98 +- .../freshdesk_field/freshdesk_field.controller.js | 105 +- .../api/freshdesk_field/freshdesk_field.socket.js | 25 +- server/api/freshdesk_field/index.js | 19 +- server/api/freshdesk_field/index.spec.js | 98 +- server/api/integration/index.js | 16 +- server/api/integration/integration.controller.js | 179 +- server/api/integration/integration.socket.js | 28 +- server/api/integration/integration.spec.js | 21 +- server/api/interval/index.js | 17 +- server/api/interval/interval.controller.js | 168 +- server/api/interval/interval.socket.js | 32 +- server/api/interval/interval.spec.js | 21 +- server/api/jscripty_project/index.js | 34 +- server/api/jscripty_project/index.spec.js | 98 +- .../jscripty_project.controller.js | 390 +- .../jscripty_project/jscripty_project.socket.js | 25 +- server/api/license/index.js | 20 +- server/api/license/license.controller.js | 162 +- server/api/license/license.socket.js | 25 +- server/api/mail_account/index.js | 24 +- server/api/mail_account/mail_account.controller.js | 243 +- server/api/mail_account/mail_account.socket.js | 28 +- server/api/mail_application/index.js | 16 +- .../mail_application.controller.js | 112 +- .../mail_application/mail_application.socket.js | 25 +- .../api/mail_application/mail_application.spec.js | 21 +- server/api/mail_attachment/index.js | 16 +- .../mail_attachment/mail_attachment.controller.js | 101 +- .../api/mail_attachment/mail_attachment.socket.js | 25 +- server/api/mail_message/index.js | 20 +- server/api/mail_message/mail_message.controller.js | 180 +- server/api/mail_message/mail_message.socket.js | 32 +- server/api/mail_queue/index.js | 21 +- server/api/mail_queue/mail_queue.controller.js | 213 +- server/api/mail_queue/mail_queue.socket.js | 25 +- server/api/mail_room/index.js | 23 +- server/api/mail_room/mail_room.controller.js | 232 +- server/api/mail_room/mail_room.socket.js | 44 +- server/api/mail_server_in/index.js | 16 +- .../mail_server_in/mail_server_in.controller.js | 97 +- server/api/mail_server_in/mail_server_in.socket.js | 28 +- server/api/mail_server_out/index.js | 20 +- .../mail_server_out/mail_server_out.controller.js | 163 +- .../api/mail_server_out/mail_server_out.socket.js | 27 +- server/api/mail_template/index.js | 16 +- .../api/mail_template/mail_template.controller.js | 93 +- server/api/mail_template/mail_template.socket.js | 25 +- server/api/metric/index.js | 20 +- server/api/metric/metric.controller.js | 181 +- server/api/metric/metric.socket.js | 42 +- server/api/metric/metric.spec.js | 21 +- server/api/module/index.js | 16 +- server/api/module/module.controller.js | 93 +- server/api/module/module.socket.js | 25 +- server/api/module/module.spec.js | 21 +- server/api/module/setting/index.js | 16 +- server/api/module/setting/setting.controller.js | 111 +- server/api/module/setting/setting.socket.js | 25 +- server/api/module/setting/setting.spec.js | 21 +- server/api/motionbar/index.js | 12 +- server/api/motionbar/motionbar.controller.js | 33 +- server/api/motionbar/motionbar.socket.js | 28 +- server/api/motionbar/motionbar.spec.js | 21 +- server/api/pause/index.js | 18 +- server/api/pause/pause.controller.js | 151 +- server/api/pause/pause.socket.js | 25 +- server/api/report_agent/index.js | 17 +- server/api/report_agent/report_agent.controller.js | 107 +- server/api/report_agent/report_agent.socket.js | 31 +- server/api/report_chat/index.js | 18 +- server/api/report_chat/report_chat.controller.js | 157 +- server/api/report_chat/report_chat.socket.js | 36 +- server/api/report_chat_session/index.js | 17 +- .../report_chat_session.controller.js | 108 +- .../report_chat_session.socket.js | 28 +- server/api/report_integration/index.js | 17 +- .../report_integration.controller.js | 107 +- .../report_integration.socket.js | 24 +- server/api/report_mail/index.js | 18 +- server/api/report_mail/report_mail.controller.js | 141 +- server/api/report_mail/report_mail.socket.js | 36 +- server/api/report_mail_session/index.js | 17 +- .../report_mail_session.controller.js | 105 +- .../report_mail_session.socket.js | 28 +- server/api/report_queue/index.js | 17 +- server/api/report_queue/report_queue.controller.js | 104 +- server/api/report_queue/report_queue.socket.js | 30 +- server/api/report_tree/index.js | 13 +- server/api/report_tree/report_tree.controller.js | 47 +- server/api/report_tree/report_tree.socket.js | 28 +- server/api/report_tree/report_tree.spec.js | 21 +- server/api/salesforce_account/index.js | 22 +- server/api/salesforce_account/index.spec.js | 98 +- .../salesforce_account.controller.js | 254 +- .../salesforce_account.socket.js | 25 +- server/api/salesforce_configuration/index.js | 19 +- server/api/salesforce_configuration/index.spec.js | 98 +- .../salesforce_configuration.controller.js | 148 +- .../salesforce_configuration.socket.js | 25 +- server/api/salesforce_field/index.js | 19 +- server/api/salesforce_field/index.spec.js | 98 +- .../salesforce_field.controller.js | 105 +- .../salesforce_field/salesforce_field.socket.js | 25 +- server/api/service/index.js | 25 +- server/api/service/service.controller.js | 380 +- server/api/service/service.socket.js | 34 +- server/api/service/service.spec.js | 21 +- server/api/setting/index.js | 20 +- server/api/setting/setting.controller.js | 173 +- server/api/setting/setting.socket.js | 25 +- server/api/sound/index.js | 19 +- server/api/sound/sound.controller.js | 267 +- server/api/sound/sound.socket.js | 25 +- server/api/sound/sound.spec.js | 21 +- server/api/square_odbc/index.js | 19 +- server/api/square_odbc/square_odbc.controller.js | 136 +- server/api/square_odbc/square_odbc.socket.js | 25 +- server/api/square_odbc/square_odbc.spec.js | 21 +- server/api/square_project/index.js | 19 +- .../square_project/square_project.controller.js | 133 +- server/api/square_project/square_project.socket.js | 28 +- server/api/sugarcrm_account/index.js | 22 +- server/api/sugarcrm_account/index.spec.js | 98 +- .../sugarcrm_account.controller.js | 201 +- .../sugarcrm_account/sugarcrm_account.socket.js | 25 +- server/api/sugarcrm_configuration/index.js | 19 +- server/api/sugarcrm_configuration/index.spec.js | 98 +- .../sugarcrm_configuration.controller.js | 146 +- .../sugarcrm_configuration.socket.js | 25 +- server/api/sugarcrm_field/index.js | 19 +- server/api/sugarcrm_field/index.spec.js | 98 +- .../sugarcrm_field/sugarcrm_field.controller.js | 105 +- server/api/sugarcrm_field/sugarcrm_field.socket.js | 25 +- server/api/tag/index.js | 18 +- server/api/tag/tag.controller.js | 117 +- server/api/tag/tag.socket.js | 25 +- server/api/tag/tag.spec.js | 21 +- server/api/team/index.js | 21 +- server/api/team/team.controller.js | 171 +- server/api/team/team.socket.js | 28 +- server/api/team/team.spec.js | 21 +- server/api/telephone/index.js | 21 +- server/api/telephone/telephone.controller.js | 175 +- server/api/telephone/telephone.socket.js | 25 +- server/api/trigger/index.js | 18 +- server/api/trigger/trigger.controller.js | 200 +- server/api/trigger/trigger.socket.js | 25 +- server/api/trigger/trigger.spec.js | 21 +- server/api/trunk/index.js | 19 +- server/api/trunk/trunk.controller.js | 161 +- server/api/trunk/trunk.socket.js | 31 +- server/api/update/index.js | 13 +- server/api/update/update.controller.js | 51 +- server/api/user/index.js | 27 +- server/api/user/user.controller.js | 370 +- server/api/user/user.socket.js | 32 +- server/api/user_has_chat_queue/index.js | 16 +- .../user_has_chat_queue.controller.js | 104 +- .../user_has_chat_queue.socket.js | 25 +- .../user_has_chat_queue.spec.js | 21 +- server/api/user_has_chat_room/index.js | 17 +- .../user_has_chat_room.controller.js | 97 +- .../user_has_chat_room.socket.js | 67 +- .../user_has_chat_room/user_has_chat_room.spec.js | 21 +- server/api/user_has_fax_queue/index.js | 16 +- .../user_has_fax_queue.controller.js | 104 +- .../user_has_fax_queue.socket.js | 31 +- .../user_has_fax_queue/user_has_fax_queue.spec.js | 21 +- server/api/user_has_mail_queue/index.js | 16 +- .../user_has_mail_queue.controller.js | 96 +- .../user_has_mail_queue.socket.js | 25 +- server/api/user_has_service/index.js | 16 +- .../user_has_service.controller.js | 99 +- .../user_has_service/user_has_service.socket.js | 28 +- .../api/user_has_service/user_has_service.spec.js | 21 +- server/api/user_has_team/index.js | 16 +- .../api/user_has_team/user_has_team.controller.js | 97 +- server/api/user_has_team/user_has_team.model.js | 14 +- server/api/user_has_team/user_has_team.socket.js | 25 +- server/api/user_has_team/user_has_team.spec.js | 21 +- server/api/user_has_voice_queue/index.js | 16 +- .../user_has_voice_queue.controller.js | 99 +- .../user_has_voice_queue.socket.js | 43 +- .../user_has_voice_queue.spec.js | 21 +- server/api/variable/index.js | 18 +- server/api/variable/variable.controller.js | 118 +- server/api/variable/variable.socket.js | 25 +- server/api/voice_context/index.js | 17 +- .../api/voice_context/voice_context.controller.js | 228 +- server/api/voice_context/voice_context.socket.js | 25 +- server/api/voice_context/voice_context.spec.js | 21 +- server/api/voice_extension/index.js | 17 +- .../voice_extension/voice_extension.controller.js | 147 +- .../api/voice_extension/voice_extension.socket.js | 35 +- server/api/voice_extension/voice_extension.spec.js | 21 +- server/api/voice_musiconhold/index.js | 22 +- .../voice_musiconhold.controller.js | 284 +- .../voice_musiconhold/voice_musiconhold.socket.js | 25 +- .../voice_musiconhold/voice_musiconhold.spec.js | 21 +- server/api/voice_queue/index.js | 20 +- server/api/voice_queue/voice_queue.controller.js | 212 +- server/api/voice_queue/voice_queue.socket.js | 25 +- server/api/voice_recording/index.js | 19 +- .../voice_recording/voice_recording.controller.js | 173 +- .../api/voice_recording/voice_recording.socket.js | 25 +- server/api/voice_voicemail/index.js | 19 +- .../voice_voicemail/voice_voicemail.controller.js | 191 +- .../api/voice_voicemail/voice_voicemail.socket.js | 40 +- server/api/voice_voicemail/voice_voicemail.spec.js | 21 +- server/api/voice_voicemail_messages/index.js | 16 +- .../voice_voicemail_messages.controller.js | 107 +- .../voice_voicemail_messages.socket.js | 25 +- server/api/widget/index.js | 20 +- server/api/widget/widget.controller.js | 103 +- server/api/widget/widget.spec.js | 21 +- server/api/xchatty/index.js | 34 +- server/api/xchatty/xchatty.controller.js | 830 +- server/api/xchatty/xchatty.socket.js | 25 +- server/api/zendesk_account/index.js | 33 +- .../zendesk_account/zendesk_account.controller.js | 317 +- .../api/zendesk_account/zendesk_account.socket.js | 25 +- server/api/zendesk_account/zendesk_account.spec.js | 21 +- server/api/zendesk_configuration/index.js | 18 +- .../zendesk_configuration.controller.js | 182 +- .../zendesk_configuration.socket.js | 25 +- .../zendesk_configuration.spec.js | 21 +- server/api/zendesk_field/index.js | 16 +- .../api/zendesk_field/zendesk_field.controller.js | 94 +- server/api/zendesk_field/zendesk_field.socket.js | 25 +- server/api/zendesk_field/zendesk_field.spec.js | 21 +- server/app.js | 113 +- server/app.json | 3 +- server/auth/auth.service.js | 96 +- server/auth/facebook/index.js | 22 +- server/auth/facebook/passport.js | 38 +- server/auth/google/index.js | 25 +- server/auth/google/passport.js | 34 +- server/auth/index.js | 23 +- server/auth/local/index.js | 64 +- server/auth/local/local.ami.js | 52 +- server/auth/local/passport.js | 94 +- server/auth/twitter/index.js | 21 +- server/auth/twitter/passport.js | 36 +- server/config/agi.js | 1217 ++- server/config/ami/action.js | 575 +- server/config/ami/acw.js | 153 +- server/config/ami/agent.js | 95 +- server/config/ami/call.js | 27 +- server/config/ami/index.js | 218 +- server/config/ami/member.js | 112 +- server/config/ami/queue_caller.js | 70 +- server/config/ami/queue_member.js | 55 +- server/config/ami/recording.js | 23 +- server/config/ami/socket.js | 20 +- server/config/ami/transfer.js | 44 +- server/config/ami/trunk.js | 125 +- server/config/ami/user.js | 34 +- server/config/ami/voice_context.js | 93 +- server/config/analytics.js | 1 - server/config/autodialer/index.js | 126 +- server/config/autodialer/process.js | 27 +- server/config/automations/fax.js | 156 +- server/config/automations/mail.js | 155 +- server/config/express.js | 75 +- server/config/fax.js | 241 +- server/config/history.js | 329 +- server/config/imap/imap.js | 220 +- server/config/imap/index.js | 23 +- server/config/integration.js | 25 +- server/config/integrations/index.js | 121 +- server/config/integrations/zendesk.js | 531 +- server/config/license/index.js | 62 +- server/config/license/license.service.js | 362 +- server/config/local.env.sample.js | 24 +- server/config/logger.js | 121 +- server/config/routing/chat/index.js | 236 +- server/config/routing/chat/session.js | 281 +- server/config/routing/mail/index.js | 217 +- server/config/routing/mail/session.js | 259 +- server/config/seed.js | 1237 ++- server/config/seedp.js | 551 +- server/config/smtp/index.js | 22 +- server/config/smtp/smtp.js | 241 +- server/config/socketio.js | 202 +- server/config/tools/chanspy.js | 115 +- server/config/tools/chatRoom.js | 28 +- server/config/tools/index.js | 15 +- server/config/tools/interval.js | 75 +- server/config/tools/user.js | 194 +- server/config/triggers/chat.js | 77 +- server/config/triggers/cm.js | 26 +- server/config/triggers/index.js | 104 +- server/config/triggers/mail.js | 50 +- server/config/triggers/util.js | 81 +- server/config/triggers/voice.js | 8 +- server/config/util/error.js | 25 +- server/config/util/index.js | 152 +- server/migrations/20160315183016-motion.js | 34 +- server/models/action.js | 33 +- server/models/asterisk_manager.js | 20 +- server/models/asterisk_manager_interface.js | 25 +- server/models/autodialer_contact.js | 16 +- server/models/autodialer_process.js | 54 +- server/models/automation.js | 65 +- server/models/canned_answer.js | 12 +- server/models/channel.js | 47 +- server/models/chanspy.js | 36 +- server/models/chat_application.js | 31 +- server/models/chat_enquiry.js | 23 +- server/models/chat_message.js | 26 +- server/models/chat_proactive_action.js | 19 +- server/models/chat_queue.js | 43 +- server/models/chat_room.js | 39 +- server/models/chat_visitor.js | 56 +- server/models/chat_website.js | 127 +- server/models/chat_websites_field.js | 45 +- server/models/company.js | 31 +- server/models/contact.js | 48 +- server/models/contact_email.js | 23 +- server/models/contact_has_custom_field.js | 17 +- server/models/contact_phone.js | 33 +- server/models/custom_field.js | 29 +- server/models/custom_report.js | 33 +- server/models/dashboard.js | 62 +- server/models/default_report.js | 24 +- server/models/desk_account.js | 46 +- server/models/desk_configuration.js | 28 +- server/models/desk_field.js | 27 +- server/models/event.js | 46 +- server/models/extracted_report.js | 28 +- server/models/fax_account.js | 41 +- server/models/fax_application.js | 34 +- server/models/fax_message.js | 64 +- server/models/fax_queue.js | 37 +- server/models/fax_room.js | 26 +- server/models/freshdesk_account.js | 34 +- server/models/freshdesk_configuration.js | 28 +- server/models/freshdesk_field.js | 27 +- server/models/history/report_agent_history.js | 75 +- server/models/history/report_call_history.js | 61 +- .../models/history/report_integration_history.js | 87 +- .../models/history/report_mail_session_history.js | 39 +- server/models/history/report_member_history.js | 33 +- server/models/history/report_queue_history.js | 50 +- server/models/index.js | 87 +- server/models/integration.js | 66 +- server/models/interval.js | 54 +- server/models/jscripty_project.js | 31 +- server/models/mail_account.js | 67 +- server/models/mail_application.js | 37 +- server/models/mail_attachment.js | 22 +- server/models/mail_automation.js | 24 +- server/models/mail_message.js | 89 +- server/models/mail_queue.js | 38 +- server/models/mail_room.js | 64 +- server/models/mail_room_status.js | 15 +- server/models/mail_server_in.js | 45 +- server/models/mail_server_out.js | 33 +- server/models/mail_template.js | 22 +- server/models/mail_trigger.js | 24 +- server/models/metric.js | 38 +- server/models/module.js | 28 +- server/models/motionbar.js | 33 +- server/models/pause.js | 26 +- server/models/report_agent.js | 72 +- server/models/report_call.js | 61 +- server/models/report_chat.js | 46 +- server/models/report_chat_session.js | 36 +- server/models/report_field.js | 23 +- server/models/report_integration.js | 87 +- server/models/report_jscripty_input.js | 13 +- server/models/report_jscripty_question.js | 35 +- server/models/report_jscripty_session.js | 52 +- server/models/report_mail.js | 44 +- server/models/report_mail_session.js | 38 +- server/models/report_member.js | 34 +- server/models/report_queue.js | 64 +- server/models/report_square.js | 90 +- server/models/report_square_detail.js | 26 +- server/models/report_tranfer.js | 26 +- server/models/report_tree.js | 13 +- server/models/salesforce_account.js | 34 +- server/models/salesforce_configuration.js | 28 +- server/models/salesforce_field.js | 23 +- server/models/service.js | 43 +- server/models/settings.js | 33 +- server/models/sound.js | 37 +- server/models/square_odbc.js | 25 +- server/models/square_project.js | 30 +- server/models/sugarcrm_account.js | 30 +- server/models/sugarcrm_configuration.js | 28 +- server/models/sugarcrm_field.js | 23 +- server/models/tag.js | 36 +- server/models/team.js | 43 +- server/models/telephone.js | 508 +- server/models/tools_action.js | 33 +- server/models/tools_condition.js | 19 +- server/models/trigger.js | 61 +- server/models/trunk.js | 459 +- server/models/user.js | 847 +- server/models/user_has_chat_queue.js | 23 +- server/models/user_has_chat_room.js | 20 +- server/models/user_has_fax_queue.js | 23 +- server/models/user_has_mail_queue.js | 23 +- server/models/user_has_service.js | 22 +- server/models/user_has_team.js | 15 +- server/models/user_has_voice_queue.js | 118 +- server/models/variable.js | 34 +- server/models/voice_context.js | 33 +- server/models/voice_extension.js | 113 +- server/models/voice_musiconhold.js | 72 +- server/models/voice_queue.js | 306 +- server/models/voice_recording.js | 76 +- server/models/voice_voicemail.js | 145 +- server/models/voice_voicemail_messages.js | 84 +- server/models/zendesk_account.js | 43 +- server/models/zendesk_configuration.js | 45 +- server/models/zendesk_field.js | 33 +- server/routes.js | 150 +- server/utils/report_build.js | 88 +- server/utils/report_extraction.js | 198 +- server/utils/voice_extension.js | 215 +- 561 files changed, 76857 insertions(+), 561 deletions(-) diff --git a/public/assets/plugins/jscripty/js/Actions.js b/public/assets/plugins/jscripty/js/Actions.js index dbf8254..aeaa420 100644 --- a/public/assets/plugins/jscripty/js/Actions.js +++ b/public/assets/plugins/jscripty/js/Actions.js @@ -1 +1,634 @@ -var _0x48db=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x64\x69\x74\x6F\x72\x55\x69","\x61\x63\x74\x69\x6F\x6E\x73","\x69\x6E\x69\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x65\x64\x69\x74\x6F\x72","\x67\x72\x61\x70\x68","\x6E\x65\x77","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x68\x6F\x77\x44\x69\x61\x6C\x6F\x67","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E","\x6F\x70\x65\x6E","\x73\x61\x76\x65","\x73\x61\x76\x65\x46\x69\x6C\x65","\x43\x74\x72\x6C\x2B\x53","\x73\x61\x76\x65\x41\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2D\x53","\x70\x75\x62\x6C\x69\x73\x68","\x70\x75\x62\x6C\x69\x73\x68\x46\x69\x6C\x65","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x50","\x76\x61\x72\x69\x61\x62\x6C\x65","\x69\x6D\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74","\x43\x74\x72\x6C\x2B\x45","\x65\x64\x69\x74\x46\x69\x6C\x65","\x65\x64\x69\x74","\x67\x65\x74","\x62\x69\x6E\x64","\x70\x75\x74","\x72\x65\x6E\x61\x6D\x65","\x70\x72\x69\x6E\x74","\x70\x72\x69\x6E\x74\x53\x63\x72\x65\x65\x6E","\x73\x70\x72\x69\x74\x65\x2D\x70\x72\x69\x6E\x74","\x43\x74\x72\x6C\x2B\x50","\x70\x72\x65\x76\x69\x65\x77","\x73\x68\x6F\x77","\x75\x6E\x64\x6F","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x73\x70\x72\x69\x74\x65\x2D\x75\x6E\x64\x6F","\x43\x74\x72\x6C\x2B\x5A","\x72\x65\x64\x6F","\x73\x70\x72\x69\x74\x65\x2D\x72\x65\x64\x6F","\x43\x74\x72\x6C\x2B\x59","\x63\x75\x74","\x73\x70\x72\x69\x74\x65\x2D\x63\x75\x74","\x43\x74\x72\x6C\x2B\x58","\x63\x6F\x70\x79","\x73\x70\x72\x69\x74\x65\x2D\x63\x6F\x70\x79","\x43\x74\x72\x6C\x2B\x43","\x70\x61\x73\x74\x65","\x73\x70\x72\x69\x74\x65\x2D\x70\x61\x73\x74\x65","\x43\x74\x72\x6C\x2B\x56","\x64\x65\x6C\x65\x74\x65","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x44\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x67\x72\x69\x64\x53\x69\x7A\x65","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x44","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x56","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x45","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x43\x74\x72\x6C\x2B\x41","\x68\x6F\x6D\x65","\x48\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x50\x61\x67\x65\x20\x55\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x50\x61\x67\x65\x20\x44\x6F\x77\x6E","\x65\x78\x70\x61\x6E\x64","\x66\x6F\x6C\x64\x43\x65\x6C\x6C\x73","\x45\x6E\x74\x65\x72","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x42\x61\x63\x6B\x73\x70\x61\x63\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x6F\x72\x64\x65\x72\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x46","\x74\x6F\x42\x61\x63\x6B","\x43\x74\x72\x6C\x2B\x42","\x67\x72\x6F\x75\x70","\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x43\x74\x72\x6C\x2B\x47","\x75\x6E\x67\x72\x6F\x75\x70","\x75\x6E\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x55","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x65\x64\x69\x74\x4C\x69\x6E\x6B","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","","\x65\x6E\x74\x65\x72\x56\x61\x6C\x75\x65","\x70\x72\x6F\x6D\x70\x74","\x73\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x61\x75\x74\x6F\x73\x69\x7A\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x6C\x65\x6E\x67\x74\x68","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x75\x70\x64\x61\x74\x65\x47\x72\x6F\x75\x70\x42\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x43\x65\x6C\x6C\x53\x69\x7A\x65","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x77\x6F\x72\x64\x57\x72\x61\x70","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x77\x72\x61\x70","\x53\x54\x59\x4C\x45\x5F\x57\x48\x49\x54\x45\x5F\x53\x50\x41\x43\x45","\x73\x74\x79\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x30","\x53\x54\x59\x4C\x45\x5F\x52\x4F\x54\x41\x54\x49\x4F\x4E","\x20\x28","\x20\x30\x2D\x33\x36\x30\x29","\x74\x69\x6C\x74","\x69\x73\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x43\x65\x6C\x6C\x47\x65\x6F\x6D\x65\x74\x72\x79","\x63\x6C\x6F\x6E\x65","\x78","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x79","\x73\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x76\x69\x65\x77","\x53\x54\x59\x4C\x45\x5F\x44\x49\x52\x45\x43\x54\x49\x4F\x4E","\x65\x61\x73\x74","\x73\x6F\x75\x74\x68","\x77\x65\x73\x74","\x6E\x6F\x72\x74\x68","\x43\x74\x72\x6C\x2B\x52","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x7A\x6F\x6F\x6D\x54\x6F","\x7A\x6F\x6F\x6D\x49\x6E","\x41\x64\x64","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x53\x75\x62\x74\x72\x61\x63\x74","\x66\x69\x74\x57\x69\x6E\x64\x6F\x77","\x66\x69\x74","\x66\x69\x74\x50\x61\x67\x65","\x70\x61\x67\x65\x56\x69\x73\x69\x62\x6C\x65","\x66\x75\x6E\x63\x74","\x70\x61\x67\x65\x56\x69\x65\x77","\x70\x61\x67\x65\x46\x6F\x72\x6D\x61\x74","\x70\x61\x67\x65\x53\x63\x61\x6C\x65","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x63\x6C\x69\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x6D\x69\x6E","\x66\x6C\x6F\x6F\x72","\x73\x63\x72\x6F\x6C\x6C\x4C\x65\x66\x74","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65","\x6D\x61\x78","\x72\x6F\x75\x6E\x64","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x66\x69\x74\x50\x61\x67\x65\x57\x69\x64\x74\x68","\x63\x75\x73\x74\x6F\x6D\x5A\x6F\x6F\x6D","\x63\x75\x73\x74\x6F\x6D","\x20\x28\x25\x29","\x67\x65\x74\x53\x63\x61\x6C\x65","\x67\x72\x69\x64","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x75\x70\x64\x61\x74\x65\x47\x72\x61\x70\x68\x43\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x47","\x73\x65\x74\x54\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x65\x64\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x67\x75\x69\x64\x65\x73","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x74\x6F\x6F\x6C\x74\x69\x70\x73","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x72\x65\x76\x61\x6C\x69\x64\x61\x74\x65","\x73\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x73\x63\x61\x6C\x65","\x73\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x73\x69\x7A\x65\x44\x69\x64\x43\x68\x61\x6E\x67\x65","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x61\x75\x74\x6F","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x73\x56\x69\x73\x69\x62\x6C\x65","\x70\x72\x65\x66\x65\x72\x50\x61\x67\x65\x53\x69\x7A\x65","\x76\x61\x6C\x69\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6F\x75\x74\x6C\x69\x6E\x65","\x68\x61\x73\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x63\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x43\x74\x72\x6C\x2B\x51","\x63\x6F\x70\x79\x43\x6F\x6E\x6E\x65\x63\x74","\x69\x73\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x68\x65\x6C\x70","\x6C\x61\x6E\x67\x75\x61\x67\x65","\x69\x73\x4C\x61\x6E\x67\x75\x61\x67\x65\x53\x75\x70\x70\x6F\x72\x74\x65\x64","\x5F","\x2F\x68\x65\x6C\x70","\x2E\x68\x74\x6D\x6C","\x61\x62\x6F\x75\x74","\x20\x43\x61\x6C\x6C\x79\x20\x53\x71\x75\x61\x72\x65","\x46\x31","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x46\x6C\x61\x67\x73","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x73\x68\x61\x64\x6F\x77","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x64\x61\x73\x68\x65\x64","\x72\x6F\x75\x6E\x64\x65\x64","\x63\x75\x72\x76\x65\x64","\x29","\x67\x65\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x61\x64\x64\x57\x61\x79\x70\x6F\x69\x6E\x74","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x73\x74\x61\x74\x65","\x74\x72\x69\x67\x67\x65\x72\x58","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x74\x72\x69\x67\x67\x65\x72\x59","\x61\x64\x64\x50\x6F\x69\x6E\x74\x41\x74","\x72\x65\x6D\x6F\x76\x65\x57\x61\x79\x70\x6F\x69\x6E\x74","\x68\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x64\x65\x78","\x72\x65\x6D\x6F\x76\x65\x50\x6F\x69\x6E\x74","\x69\x6D\x61\x67\x65","\x67\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x69\x6E\x73\x65\x72\x74\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x67\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x49\x4D\x41\x47\x45","\x75\x72\x6C","\x6F\x6E\x6C\x6F\x61\x64","\x6F\x6E\x65\x72\x72\x6F\x72","\x66\x69\x6C\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64","\x61\x6C\x65\x72\x74","\x73\x72\x63","\x63\x61\x6C\x6C","\x6C\x61\x62\x65\x6C","\x65\x6E\x61\x62\x6C\x65\x64","\x69\x63\x6F\x6E\x43\x6C\x73","\x73\x68\x6F\x72\x74\x63\x75\x74","\x65\x78\x74\x65\x6E\x64","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x74\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x65\x64\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x69\x73\x53\x65\x6C\x65\x63\x74\x65\x64"];_0x48db[0];function Actions(_0x8e79x2){this[_0x48db[1]]=_0x8e79x2;this[_0x48db[2]]= new Object();this[_0x48db[3]]()}Actions[_0x48db[4]][_0x48db[3]]=function(){var _0x8e79x3=this[_0x48db[1]];var _0x8e79x4=_0x8e79x3[_0x48db[5]];var _0x8e79x5=_0x8e79x4[_0x48db[6]];this[_0x48db[10]](_0x48db[7],function(){_0x8e79x3[_0x48db[9]]( new NewDialog(_0x8e79x3)[_0x48db[8]],300,180,true,true)});this[_0x48db[10]](_0x48db[11],function(){_0x8e79x3[_0x48db[9]]( new OpenDialog(_0x8e79x3)[_0x48db[8]],300,180,true,true)});this[_0x48db[10]](_0x48db[12],function(){_0x8e79x3[_0x48db[13]](false)},null,null,_0x48db[14]);this[_0x48db[10]](_0x48db[15],function(){_0x8e79x3[_0x48db[13]](true)},null,null,_0x48db[16]);this[_0x48db[10]](_0x48db[17],function(){_0x8e79x3[_0x48db[18]](false)},null,null,_0x48db[19]);this[_0x48db[10]](_0x48db[20],function(){_0x8e79x3[_0x48db[9]]( new VariableDialog(_0x8e79x3)[_0x48db[8]],300,180,true,true)});this[_0x48db[10]](_0x48db[21],function(){_0x8e79x3[_0x48db[9]]( new ImportDialog(_0x8e79x3)[_0x48db[8]],300,200,true,true)});this[_0x48db[10]](_0x48db[22],function(){_0x8e79x3[_0x48db[9]]( new ExportDialog(_0x8e79x3)[_0x48db[8]],300,200,true,true)},null,null,_0x48db[23]);this[_0x48db[28]](_0x48db[24], new Action(mxResources[_0x48db[26]](_0x48db[25]),mxUtils[_0x48db[27]](this,function(){this[_0x48db[1]][_0x48db[9]]( new EditFileDialog(_0x8e79x3)[_0x48db[8]],620,420,true,true)})));this[_0x48db[10]](_0x48db[29],function(){_0x8e79x3[_0x48db[9]]( new RenameDialog(_0x8e79x3)[_0x48db[8]],300,180,true,true)});this[_0x48db[10]](_0x48db[30],function(){mxUtils[_0x48db[31]](_0x8e79x5)},null,_0x48db[32],_0x48db[33]);this[_0x48db[10]](_0x48db[34],function(){mxUtils[_0x48db[35]](_0x8e79x5,null,10,10)});this[_0x48db[10]](_0x48db[36],function(){_0x8e79x4[_0x48db[37]][_0x48db[36]]()},null,_0x48db[38],_0x48db[39]);this[_0x48db[10]](_0x48db[40],function(){_0x8e79x4[_0x48db[37]][_0x48db[40]]()},null,_0x48db[41],_0x48db[42]);this[_0x48db[10]](_0x48db[43],function(){mxClipboard[_0x48db[43]](_0x8e79x5)},null,_0x48db[44],_0x48db[45]);this[_0x48db[10]](_0x48db[46],function(){mxClipboard[_0x48db[46]](_0x8e79x5)},null,_0x48db[47],_0x48db[48]);this[_0x48db[10]](_0x48db[49],function(){mxClipboard[_0x48db[49]](_0x8e79x5)},false,_0x48db[50],_0x48db[51]);this[_0x48db[10]](_0x48db[52],function(){_0x8e79x5[_0x48db[53]]()},null,null,_0x48db[54]);this[_0x48db[10]](_0x48db[55],function(){var _0x8e79x6=_0x8e79x5[_0x48db[56]];_0x8e79x5[_0x48db[59]](_0x8e79x5[_0x48db[58]](_0x8e79x5[_0x48db[57]](),_0x8e79x6,_0x8e79x6,true))},null,null,_0x48db[60]);this[_0x48db[10]](_0x48db[61],function(){_0x8e79x5[_0x48db[61]]()},null,null,_0x48db[62]);this[_0x48db[10]](_0x48db[63],function(){_0x8e79x5[_0x48db[63]]()},null,null,_0x48db[64]);this[_0x48db[10]](_0x48db[65],function(){_0x8e79x5[_0x48db[65]]()},null,null,_0x48db[66]);this[_0x48db[10]](_0x48db[67],function(){_0x8e79x5[_0x48db[67]]()},null,null,_0x48db[68]);this[_0x48db[10]](_0x48db[69],function(){_0x8e79x5[_0x48db[69]]()},null,null,_0x48db[70]);this[_0x48db[10]](_0x48db[71],function(){_0x8e79x5[_0x48db[71]]()},null,null,_0x48db[72]);this[_0x48db[10]](_0x48db[73],function(){_0x8e79x5[_0x48db[74]](false)},null,null,_0x48db[75]);this[_0x48db[10]](_0x48db[76],function(){_0x8e79x5[_0x48db[74]](true)},null,null,_0x48db[77]);this[_0x48db[10]](_0x48db[78],function(){_0x8e79x5[_0x48db[79]](false)},null,null,_0x48db[80]);this[_0x48db[10]](_0x48db[81],function(){_0x8e79x5[_0x48db[79]](true)},null,null,_0x48db[82]);this[_0x48db[10]](_0x48db[83],function(){_0x8e79x5[_0x48db[85]](_0x8e79x5[_0x48db[84]](null,0))},null,null,_0x48db[86]);this[_0x48db[10]](_0x48db[87],function(){_0x8e79x5[_0x48db[59]](_0x8e79x5[_0x48db[88]]())},null,null,_0x48db[89]);this[_0x48db[10]](_0x48db[90],function(){_0x8e79x5[_0x48db[91]]()});this[_0x48db[10]](_0x48db[92],function(){var _0x8e79x7=_0x8e79x5[_0x48db[93]]();var _0x8e79x8=_0x8e79x5[_0x48db[94]](_0x8e79x7);if(_0x8e79x8==null){_0x8e79x8=_0x48db[95]};_0x8e79x8=mxUtils[_0x48db[97]](mxResources[_0x48db[26]](_0x48db[96]),_0x8e79x8);if(_0x8e79x8!=null){_0x8e79x5[_0x48db[98]](_0x8e79x7,_0x8e79x8)}});this[_0x48db[10]](_0x48db[99],function(){var _0x8e79x7=_0x8e79x5[_0x48db[93]]();var _0x8e79x8=_0x8e79x5[_0x48db[94]](_0x8e79x7);if(_0x8e79x8!=null){window[_0x48db[11]](_0x8e79x8)}});this[_0x48db[10]](_0x48db[100],function(){var _0x8e79x9=_0x8e79x5[_0x48db[57]]();if(_0x8e79x9!=null){_0x8e79x5[_0x48db[102]]()[_0x48db[101]]();try{for(var _0x8e79xa=0;_0x8e79xa<_0x8e79x9[_0x48db[103]];_0x8e79xa++){var _0x8e79x7=_0x8e79x9[_0x8e79xa];if(_0x8e79x5[_0x48db[102]]()[_0x48db[104]](_0x8e79x7)){_0x8e79x5[_0x48db[105]]([_0x8e79x7],20)}else {_0x8e79x5[_0x48db[106]](_0x8e79x7)}}}finally{_0x8e79x5[_0x48db[102]]()[_0x48db[107]]()}}});this[_0x48db[10]](_0x48db[108],function(){var _0x8e79xb=_0x8e79x5[_0x48db[110]]()[_0x48db[109]](_0x8e79x5[_0x48db[93]]());var _0x8e79xc=_0x48db[111];if(_0x8e79xb!=null&&_0x8e79xb[_0x48db[113]][mxConstants[_0x48db[112]]]==_0x48db[111]){_0x8e79xc=null};_0x8e79x5[_0x48db[114]](mxConstants.STYLE_WHITE_SPACE,_0x8e79xc)});this[_0x48db[10]](_0x48db[115],function(){var _0x8e79xc=_0x48db[116];var _0x8e79xb=_0x8e79x5[_0x48db[110]]()[_0x48db[109]](_0x8e79x5[_0x48db[93]]());if(_0x8e79xb!=null){_0x8e79xc=_0x8e79xb[_0x48db[113]][mxConstants[_0x48db[117]]]||_0x8e79xc};_0x8e79xc=mxUtils[_0x48db[97]](mxResources[_0x48db[26]](_0x48db[96])+_0x48db[118]+mxResources[_0x48db[26]](_0x48db[115])+_0x48db[119],_0x8e79xc);if(_0x8e79xc!=null){_0x8e79x5[_0x48db[114]](mxConstants.STYLE_ROTATION,_0x8e79xc)}});this[_0x48db[10]](_0x48db[120],function(){var _0x8e79x9=_0x8e79x5[_0x48db[57]]();if(_0x8e79x9!=null){_0x8e79x5[_0x48db[102]]()[_0x48db[101]]();try{for(var _0x8e79xa=0;_0x8e79xa<_0x8e79x9[_0x48db[103]];_0x8e79xa++){var _0x8e79x7=_0x8e79x9[_0x8e79xa];if(_0x8e79x5[_0x48db[102]]()[_0x48db[121]](_0x8e79x7)&&_0x8e79x5[_0x48db[102]]()[_0x48db[104]](_0x8e79x7)==0){var _0x8e79xd=_0x8e79x5[_0x48db[122]](_0x8e79x7);if(_0x8e79xd!=null){_0x8e79xd=_0x8e79xd[_0x48db[123]]();_0x8e79xd[_0x48db[124]]+=_0x8e79xd[_0x48db[125]]/2-_0x8e79xd[_0x48db[126]]/2;_0x8e79xd[_0x48db[127]]+=_0x8e79xd[_0x48db[126]]/2-_0x8e79xd[_0x48db[125]]/2;var _0x8e79xe=_0x8e79xd[_0x48db[125]];_0x8e79xd[_0x48db[125]]=_0x8e79xd[_0x48db[126]];_0x8e79xd[_0x48db[126]]=_0x8e79xe;_0x8e79x5[_0x48db[102]]()[_0x48db[128]](_0x8e79x7,_0x8e79xd);var _0x8e79xb=_0x8e79x5[_0x48db[129]][_0x48db[109]](_0x8e79x7);if(_0x8e79xb!=null){var _0x8e79xf=_0x8e79xb[_0x48db[113]][mxConstants[_0x48db[130]]]||_0x48db[131];if(_0x8e79xf==_0x48db[131]){_0x8e79xf=_0x48db[132]}else {if(_0x8e79xf==_0x48db[132]){_0x8e79xf=_0x48db[133]}else {if(_0x8e79xf==_0x48db[133]){_0x8e79xf=_0x48db[134]}else {if(_0x8e79xf==_0x48db[134]){_0x8e79xf=_0x48db[131]}}}};_0x8e79x5[_0x48db[114]](mxConstants.STYLE_DIRECTION,_0x8e79xf,[_0x8e79x7])}}}}}finally{_0x8e79x5[_0x48db[102]]()[_0x48db[107]]()}}},null,null,_0x48db[135]);this[_0x48db[10]](_0x48db[136],function(){_0x8e79x5[_0x48db[137]](1)});this[_0x48db[10]](_0x48db[138],function(){_0x8e79x5[_0x48db[138]]()},null,null,_0x48db[139]);this[_0x48db[10]](_0x48db[140],function(){_0x8e79x5[_0x48db[140]]()},null,null,_0x48db[141]);this[_0x48db[10]](_0x48db[142],function(){_0x8e79x5[_0x48db[143]]()});this[_0x48db[10]](_0x48db[144],mxUtils[_0x48db[27]](this,function(){if(!_0x8e79x5[_0x48db[145]]){this[_0x48db[26]](_0x48db[147])[_0x48db[146]]()};var _0x8e79x10=_0x8e79x5[_0x48db[148]];var _0x8e79x11=_0x8e79x5[_0x48db[149]];var _0x8e79x12=_0x8e79x5[_0x48db[8]][_0x48db[150]]-20;var _0x8e79x13=_0x8e79x5[_0x48db[8]][_0x48db[151]]-20;var _0x8e79x14=Math[_0x48db[153]](100*Math[_0x48db[152]](_0x8e79x12/_0x8e79x10[_0x48db[125]]/_0x8e79x11,_0x8e79x13/_0x8e79x10[_0x48db[126]]/_0x8e79x11))/100;_0x8e79x5[_0x48db[137]](_0x8e79x14);_0x8e79x5[_0x48db[8]][_0x48db[154]]=Math[_0x48db[157]](_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[124]]*_0x8e79x14-Math[_0x48db[156]](10,(_0x8e79x5[_0x48db[8]][_0x48db[150]]-_0x8e79x10[_0x48db[125]]*_0x8e79x11*_0x8e79x14)/2));_0x8e79x5[_0x48db[8]][_0x48db[158]]=Math[_0x48db[157]](_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[127]]*_0x8e79x14-Math[_0x48db[156]](10,(_0x8e79x5[_0x48db[8]][_0x48db[151]]-_0x8e79x10[_0x48db[126]]*_0x8e79x11*_0x8e79x14)/2))}));this[_0x48db[10]](_0x48db[159],mxUtils[_0x48db[27]](this,function(){if(!_0x8e79x5[_0x48db[145]]){this[_0x48db[26]](_0x48db[147])[_0x48db[146]]()};var _0x8e79x10=_0x8e79x5[_0x48db[148]];var _0x8e79x11=_0x8e79x5[_0x48db[149]];var _0x8e79x12=_0x8e79x5[_0x48db[8]][_0x48db[150]]-20;var _0x8e79x14=Math[_0x48db[153]](100*_0x8e79x12/_0x8e79x10[_0x48db[125]]/_0x8e79x11)/100;_0x8e79x5[_0x48db[137]](_0x8e79x14);_0x8e79x5[_0x48db[8]][_0x48db[154]]=Math[_0x48db[157]](_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[124]]*_0x8e79x14-Math[_0x48db[156]](10,(_0x8e79x5[_0x48db[8]][_0x48db[150]]-_0x8e79x10[_0x48db[125]]*_0x8e79x11*_0x8e79x14)/2));_0x8e79x5[_0x48db[8]][_0x48db[158]]=Math[_0x48db[157]](_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[127]]*_0x8e79x14-Math[_0x48db[156]](10,(_0x8e79x5[_0x48db[8]][_0x48db[151]]-_0x8e79x10[_0x48db[126]]*_0x8e79x11*_0x8e79x14)/2))}));this[_0x48db[28]](_0x48db[160], new Action(mxResources[_0x48db[26]](_0x48db[161]),function(){var _0x8e79xc=mxUtils[_0x48db[97]](mxResources[_0x48db[26]](_0x48db[96])+_0x48db[162],parseInt(_0x8e79x5[_0x48db[110]]()[_0x48db[163]]()*100));if(_0x8e79xc!=null&&_0x8e79xc[_0x48db[103]]>0&&!isNaN(parseInt(_0x8e79xc))){_0x8e79x5[_0x48db[137]](parseInt(_0x8e79xc)/100)}}));var _0x8e79x15=null;_0x8e79x15=this[_0x48db[10]](_0x48db[164],function(){_0x8e79x5[_0x48db[166]](!_0x8e79x5[_0x48db[165]]());_0x8e79x4[_0x48db[167]]()},null,null,_0x48db[168]);_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[165]]()});_0x8e79x15=this[_0x48db[10]](_0x48db[171],function(){_0x8e79x5[_0x48db[173]][_0x48db[172]]=!_0x8e79x5[_0x48db[173]][_0x48db[172]]});_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[173]][_0x48db[172]]});_0x8e79x15=this[_0x48db[10]](_0x48db[174],function(){_0x8e79x5[_0x48db[176]][_0x48db[177]](!_0x8e79x5[_0x48db[176]][_0x48db[175]]())});_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[176]][_0x48db[175]]()});_0x8e79x15=this[_0x48db[10]](_0x48db[178],function(){_0x8e79x5[_0x48db[179]]=!_0x8e79x5[_0x48db[179]];_0x8e79x5[_0x48db[129]][_0x48db[180]]()});_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[179]]});_0x8e79x15=this[_0x48db[10]](_0x48db[181],function(){_0x8e79x5[_0x48db[181]]=!_0x8e79x5[_0x48db[181]];_0x8e79x4[_0x48db[167]]();if(!_0x8e79x5[_0x48db[181]]){var _0x8e79x16=_0x8e79x5[_0x48db[129]][_0x48db[155]];_0x8e79x5[_0x48db[129]][_0x48db[183]](_0x8e79x16[_0x48db[124]]-_0x8e79x5[_0x48db[8]][_0x48db[154]]/_0x8e79x5[_0x48db[129]][_0x48db[182]],_0x8e79x16[_0x48db[127]]-_0x8e79x5[_0x48db[8]][_0x48db[158]]/_0x8e79x5[_0x48db[129]][_0x48db[182]]);_0x8e79x5[_0x48db[8]][_0x48db[154]]=0;_0x8e79x5[_0x48db[8]][_0x48db[158]]=0;_0x8e79x5[_0x48db[184]]()}else {var _0x8e79x17=_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[124]];var _0x8e79x18=_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[127]];_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[124]]=0;_0x8e79x5[_0x48db[129]][_0x48db[155]][_0x48db[127]]=0;_0x8e79x5[_0x48db[184]]();_0x8e79x5[_0x48db[8]][_0x48db[154]]-=Math[_0x48db[157]](_0x8e79x17*_0x8e79x5[_0x48db[129]][_0x48db[182]]);_0x8e79x5[_0x48db[8]][_0x48db[158]]-=Math[_0x48db[157]](_0x8e79x18*_0x8e79x5[_0x48db[129]][_0x48db[182]])}},!mxClient.IS_TOUCH);_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[8]][_0x48db[113]][_0x48db[185]]==_0x48db[186]});_0x8e79x15=this[_0x48db[10]](_0x48db[147],mxUtils[_0x48db[27]](this,function(){_0x8e79x5[_0x48db[145]]=!_0x8e79x5[_0x48db[145]];_0x8e79x5[_0x48db[187]]=_0x8e79x5[_0x48db[145]];_0x8e79x5[_0x48db[188]]=_0x8e79x5[_0x48db[187]];_0x8e79x5[_0x48db[129]][_0x48db[189]]();_0x8e79x5[_0x48db[184]]();_0x8e79x4[_0x48db[167]]();_0x8e79x4[_0x48db[191]][_0x48db[190]]();if(mxUtils[_0x48db[192]](_0x8e79x5[_0x48db[8]])){if(_0x8e79x5[_0x48db[145]]){_0x8e79x5[_0x48db[8]][_0x48db[154]]-=20;_0x8e79x5[_0x48db[8]][_0x48db[158]]-=20}else {_0x8e79x5[_0x48db[8]][_0x48db[154]]+=20;_0x8e79x5[_0x48db[8]][_0x48db[158]]+=20}}}));_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[145]]});_0x8e79x15=this[_0x48db[10]](_0x48db[193],function(){_0x8e79x5[_0x48db[195]](!_0x8e79x5[_0x48db[194]][_0x48db[175]]())},null,null,_0x48db[196]);_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[194]][_0x48db[175]]()});_0x8e79x15=this[_0x48db[10]](_0x48db[197],function(){_0x8e79x5[_0x48db[194]][_0x48db[199]](!_0x8e79x5[_0x48db[194]][_0x48db[198]]())});_0x8e79x15[_0x48db[169]](true);_0x8e79x15[_0x48db[170]](function(){return _0x8e79x5[_0x48db[194]][_0x48db[198]]()});this[_0x48db[10]](_0x48db[200],function(){var _0x8e79x19=_0x48db[95];if(mxResources[_0x48db[202]](mxClient[_0x48db[201]])){_0x8e79x19=_0x48db[203]+mxClient[_0x48db[201]]};window[_0x48db[11]](RESOURCES_PATH+_0x48db[204]+_0x8e79x19+_0x48db[205])});this[_0x48db[28]](_0x48db[206], new Action(mxResources[_0x48db[26]](_0x48db[206])+_0x48db[207],function(){_0x8e79x3[_0x48db[9]]( new AboutDialog(_0x8e79x3)[_0x48db[8]],320,280,true,true)},null,null,_0x48db[208]));var _0x8e79x1a=mxUtils[_0x48db[27]](this,function(_0x8e79x1b,_0x8e79x1c){this[_0x48db[10]](_0x8e79x1b,function(){_0x8e79x5[_0x48db[209]](mxConstants.STYLE_FONTSTYLE,_0x8e79x1c)})});_0x8e79x1a(_0x48db[210],mxConstants.FONT_BOLD);_0x8e79x1a(_0x48db[211],mxConstants.FONT_ITALIC);_0x8e79x1a(_0x48db[212],mxConstants.FONT_UNDERLINE);this[_0x48db[10]](_0x48db[213],function(){_0x8e79x5[_0x48db[214]](mxConstants.STYLE_SHADOW)});this[_0x48db[10]](_0x48db[215],function(){_0x8e79x5[_0x48db[214]](mxConstants.STYLE_DASHED)});this[_0x48db[10]](_0x48db[216],function(){_0x8e79x5[_0x48db[214]](mxConstants.STYLE_ROUNDED)});this[_0x48db[10]](_0x48db[217],function(){_0x8e79x5[_0x48db[214]](mxConstants.STYLE_CURVED)});this[_0x48db[10]](_0x48db[113],function(){var _0x8e79x9=_0x8e79x5[_0x48db[57]]();if(_0x8e79x9!=null&&_0x8e79x9[_0x48db[103]]>0){var _0x8e79x1d=_0x8e79x5[_0x48db[102]]();var _0x8e79x1c=mxUtils[_0x48db[97]](mxResources[_0x48db[26]](_0x48db[96])+_0x48db[118]+mxResources[_0x48db[26]](_0x48db[113])+_0x48db[218],_0x8e79x1d[_0x48db[219]](_0x8e79x9[0])||_0x48db[95]);if(_0x8e79x1c!=null){_0x8e79x5[_0x48db[220]](_0x8e79x1c,_0x8e79x9)}}});this[_0x48db[10]](_0x48db[221],function(){_0x8e79x5[_0x48db[222]](_0x8e79x5[_0x48db[93]]())});this[_0x48db[10]](_0x48db[223],function(){var _0x8e79x7=_0x8e79x5[_0x48db[93]]();if(_0x8e79x7!=null&&_0x8e79x5[_0x48db[102]]()[_0x48db[224]](_0x8e79x7)){var _0x8e79x1e=_0x8e79x4[_0x48db[6]][_0x48db[226]][_0x48db[225]](_0x8e79x7);if(_0x8e79x1e instanceof mxEdgeHandler){var _0x8e79x16=_0x8e79x5[_0x48db[129]][_0x48db[155]];var _0x8e79x6=_0x8e79x5[_0x48db[129]][_0x48db[182]];var _0x8e79x17=_0x8e79x16[_0x48db[124]];var _0x8e79x18=_0x8e79x16[_0x48db[127]];var _0x8e79x1f=_0x8e79x5[_0x48db[102]]()[_0x48db[227]](_0x8e79x7);var _0x8e79x20=_0x8e79x5[_0x48db[122]](_0x8e79x1f);if(_0x8e79x5[_0x48db[102]]()[_0x48db[121]](_0x8e79x1f)&&_0x8e79x20!=null){_0x8e79x17+=_0x8e79x20[_0x48db[124]];_0x8e79x18+=_0x8e79x20[_0x48db[127]]};_0x8e79x1e[_0x48db[232]](_0x8e79x1e[_0x48db[228]],_0x8e79x5[_0x48db[230]][_0x48db[229]]/_0x8e79x6-_0x8e79x17,_0x8e79x5[_0x48db[230]][_0x48db[231]]/_0x8e79x6-_0x8e79x18)}}});this[_0x48db[10]](_0x48db[233],function(){var _0x8e79x21=_0x8e79x3[_0x48db[2]][_0x48db[26]](_0x48db[233]);if(_0x8e79x21[_0x48db[234]]!=null){_0x8e79x21[_0x48db[234]][_0x48db[236]](_0x8e79x21[_0x48db[234]][_0x48db[228]],_0x8e79x21[_0x48db[235]])}});this[_0x48db[10]](_0x48db[237],function(){function _0x8e79x22(_0x8e79xc,_0x8e79x23,_0x8e79x24){var _0x8e79x25=null;var _0x8e79x9=_0x8e79x5[_0x48db[57]]();_0x8e79x5[_0x48db[102]]()[_0x48db[101]]();try{if(_0x8e79x9[_0x48db[103]]==0){var _0x8e79x26=_0x8e79x5[_0x48db[238]]();_0x8e79x9=[_0x8e79x5[_0x48db[240]](_0x8e79x5[_0x48db[239]](),null,_0x48db[95],_0x8e79x26,_0x8e79x26,_0x8e79x23,_0x8e79x24)];_0x8e79x25=_0x8e79x9};_0x8e79x5[_0x48db[114]](mxConstants.STYLE_IMAGE,_0x8e79xc,_0x8e79x9);_0x8e79x5[_0x48db[114]](mxConstants.STYLE_SHAPE,_0x48db[237],_0x8e79x9);if(_0x8e79x5[_0x48db[241]]()==1){if(_0x8e79x23!=null&&_0x8e79x24!=null){var _0x8e79x7=_0x8e79x9[0];var _0x8e79xd=_0x8e79x5[_0x48db[102]]()[_0x48db[242]](_0x8e79x7);if(_0x8e79xd!=null){_0x8e79xd=_0x8e79xd[_0x48db[123]]();_0x8e79xd[_0x48db[125]]=_0x8e79x23;_0x8e79xd[_0x48db[126]]=_0x8e79x24;_0x8e79x5[_0x48db[102]]()[_0x48db[128]](_0x8e79x7,_0x8e79xd)}}}}finally{_0x8e79x5[_0x48db[102]]()[_0x48db[107]]()};if(_0x8e79x25!=null){_0x8e79x5[_0x48db[59]](_0x8e79x25);_0x8e79x5[_0x48db[243]](_0x8e79x25[0])}}var _0x8e79xc=_0x48db[95];var _0x8e79xb=_0x8e79x5[_0x48db[110]]()[_0x48db[109]](_0x8e79x5[_0x48db[93]]());if(_0x8e79xb!=null){_0x8e79xc=_0x8e79xb[_0x48db[113]][mxConstants[_0x48db[244]]]||_0x8e79xc};_0x8e79xc=mxUtils[_0x48db[97]](mxResources[_0x48db[26]](_0x48db[96])+_0x48db[118]+mxResources[_0x48db[26]](_0x48db[245])+_0x48db[218],_0x8e79xc);if(_0x8e79xc!=null){if(_0x8e79xc[_0x48db[103]]>0){var _0x8e79x27= new Image();_0x8e79x27[_0x48db[246]]=function(){_0x8e79x22(_0x8e79xc,_0x8e79x27[_0x48db[125]],_0x8e79x27[_0x48db[126]])};_0x8e79x27[_0x48db[247]]=function(){mxUtils[_0x48db[249]](mxResources[_0x48db[26]](_0x48db[248]))};_0x8e79x27[_0x48db[250]]=_0x8e79xc}}})};Actions[_0x48db[4]][_0x48db[10]]=function(_0x8e79x1b,_0x8e79x28,_0x8e79x29,_0x8e79x2a,_0x8e79x2b){return this[_0x48db[28]](_0x8e79x1b, new Action(mxResources[_0x48db[26]](_0x8e79x1b),_0x8e79x28,_0x8e79x29,_0x8e79x2a,_0x8e79x2b))};Actions[_0x48db[4]][_0x48db[28]]=function(_0x8e79x2c,_0x8e79x15){this[_0x48db[2]][_0x8e79x2c]=_0x8e79x15;return _0x8e79x15};Actions[_0x48db[4]][_0x48db[26]]=function(_0x8e79x2c){return this[_0x48db[2]][_0x8e79x2c]};function Action(_0x8e79x2e,_0x8e79x28,_0x8e79x29,_0x8e79x2a,_0x8e79x2b){mxEventSource[_0x48db[251]](this);this[_0x48db[252]]=_0x8e79x2e;this[_0x48db[146]]=_0x8e79x28;this[_0x48db[253]]=(_0x8e79x29!=null)?_0x8e79x29:true;this[_0x48db[254]]=_0x8e79x2a;this[_0x48db[255]]=_0x8e79x2b}mxUtils[_0x48db[256]](Action,mxEventSource);Action[_0x48db[4]][_0x48db[177]]=function(_0x8e79xc){if(this[_0x48db[253]]!=_0x8e79xc){this[_0x48db[253]]=_0x8e79xc;this[_0x48db[258]]( new mxEventObject(_0x48db[257]))}};Action[_0x48db[4]][_0x48db[169]]=function(_0x8e79xc){this[_0x48db[259]]=_0x8e79xc};Action[_0x48db[4]][_0x48db[170]]=function(_0x8e79x28){this[_0x48db[260]]=_0x8e79x28};Action[_0x48db[4]][_0x48db[261]]=function(){return this[_0x48db[260]]()} \ No newline at end of file +'use strict'; +/** + * $Id: Actions.js,v 1.7 2013-02-14 07:48:01 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs the actions object for the given UI. + */ +function Actions(editorUi) { + this.editorUi = editorUi; + this.actions = new Object(); + this.init(); +}; + +/** + * Adds the default actions. + */ +Actions.prototype.init = function() { + var ui = this.editorUi; + var editor = ui.editor; + var graph = editor.graph; + + // File actions + this.addAction('new', function() { + ui.showDialog(new NewDialog(ui).container, 300, 180, true, true); + }); + this.addAction('open', function() { + ui.showDialog(new OpenDialog(ui).container, 300, 180, true, true); + }); + this.addAction('save', function() { + ui.saveFile(false); + }, null, null, 'Ctrl+S'); + this.addAction('saveAs', function() { + ui.saveFile(true); + }, null, null, 'Ctrl+Shift-S'); + this.addAction('publish', function() { + ui.publishFile(false); + }, null, null, 'Ctrl+Shift+P'); + this.addAction('variable', function() { + ui.showDialog(new VariableDialog(ui).container, 300, 180, true, true); + }); + this.addAction('import', function() { + ui.showDialog(new ImportDialog(ui).container, 300, 200, true, true); + }); + this.addAction('export', function() { + ui.showDialog(new ExportDialog(ui).container, 300, 200, true, true); + }, null, null, 'Ctrl+E'); + this.put('editFile', new Action(mxResources.get('edit'), mxUtils.bind(this, + function() { + this.editorUi.showDialog(new EditFileDialog(ui).container, 620, 420, + true, true); + }))); + this.addAction('rename', function() { + ui.showDialog(new RenameDialog(ui).container, 300, 180, true, true); + }); + this.addAction('print', function() { + mxUtils.printScreen(graph); + }, null, 'sprite-print', 'Ctrl+P'); + this.addAction('preview', function() { + mxUtils.show(graph, null, 10, 10); + }); + + // Edit actions + this.addAction('undo', function() { + editor.undoManager.undo(); + }, null, 'sprite-undo', 'Ctrl+Z'); + this.addAction('redo', function() { + editor.undoManager.redo(); + }, null, 'sprite-redo', 'Ctrl+Y'); + this.addAction('cut', function() { + mxClipboard.cut(graph); + }, null, 'sprite-cut', 'Ctrl+X'); + this.addAction('copy', function() { + mxClipboard.copy(graph); + }, null, 'sprite-copy', 'Ctrl+C'); + this.addAction('paste', function() { + mxClipboard.paste(graph); + }, false, 'sprite-paste', 'Ctrl+V'); + this.addAction('delete', function() { + graph.removeCells(); + }, null, null, 'Delete'); + this.addAction('duplicate', function() { + var s = graph.gridSize; + graph.setSelectionCells(graph.moveCells(graph.getSelectionCells(), s, s, + true)); + }, null, null, 'Ctrl+D'); + this.addAction('selectVertices', function() { + graph.selectVertices(); + }, null, null, 'Ctrl+Shift+V'); + this.addAction('selectEdges', function() { + graph.selectEdges(); + }, null, null, 'Ctrl+Shift+E'); + this.addAction('selectAll', function() { + graph.selectAll(); + }, null, null, 'Ctrl+A'); + + // Navigation actions + this.addAction('home', function() { + graph.home(); + }, null, null, 'Home'); + this.addAction('exitGroup', function() { + graph.exitGroup(); + }, null, null, 'Page Up'); + this.addAction('enterGroup', function() { + graph.enterGroup(); + }, null, null, 'Page Down'); + this.addAction('expand', function() { + graph.foldCells(false); + }, null, null, 'Enter'); + this.addAction('collapse', function() { + graph.foldCells(true); + }, null, null, 'Backspace'); + + // Arrange actions + this.addAction('toFront', function() { + graph.orderCells(false); + }, null, null, 'Ctrl+F'); + this.addAction('toBack', function() { + graph.orderCells(true); + }, null, null, 'Ctrl+B'); + this.addAction('group', function() { + graph.setSelectionCell(graph.groupCells(null, 0)); + }, null, null, 'Ctrl+G'); + this.addAction('ungroup', function() { + graph.setSelectionCells(graph.ungroupCells()); + }, null, null, 'Ctrl+U'); + this.addAction('removeFromGroup', function() { + graph.removeCellsFromParent(); + }); + this.addAction('editLink', function() { + var cell = graph.getSelectionCell(); + var link = graph.getLinkForCell(cell); + + if (link == null) { + link = ''; + } + + link = mxUtils.prompt(mxResources.get('enterValue'), link); + + if (link != null) { + graph.setLinkForCell(cell, link); + } + }); + this.addAction('openLink', function() { + var cell = graph.getSelectionCell(); + var link = graph.getLinkForCell(cell); + + if (link != null) { + window.open(link); + } + }); + this.addAction('autosize', function() { + var cells = graph.getSelectionCells(); + + if (cells != null) { + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().getChildCount(cell)) { + graph.updateGroupBounds([cell], 20); + } else { + graph.updateCellSize(cell); + } + } + } finally { + graph.getModel().endUpdate(); + } + } + }); + this.addAction('wordWrap', function() { + var state = graph.getView().getState(graph.getSelectionCell()); + var value = 'wrap'; + + if (state != null && state.style[mxConstants.STYLE_WHITE_SPACE] == 'wrap') { + value = null; + } + + graph.setCellStyles(mxConstants.STYLE_WHITE_SPACE, value); + }); + this.addAction('rotation', function() { + var value = '0'; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[mxConstants.STYLE_ROTATION] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ' (' + + mxResources.get('rotation') + ' 0-360)', value); + + if (value != null) { + graph.setCellStyles(mxConstants.STYLE_ROTATION, value); + } + }); + this.addAction('tilt', function() { + var cells = graph.getSelectionCells(); + + if (cells != null) { + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().isVertex(cell) && graph.getModel().getChildCount( + cell) == 0) { + var geo = graph.getCellGeometry(cell); + + if (geo != null) { + // Rotates the size and position in the geometry + geo = geo.clone(); + geo.x += geo.width / 2 - geo.height / 2; + geo.y += geo.height / 2 - geo.width / 2; + var tmp = geo.width; + geo.width = geo.height; + geo.height = tmp; + graph.getModel().setGeometry(cell, geo); + + // Reads the current direction and advances by 90 degrees + var state = graph.view.getState(cell); + + if (state != null) { + var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east' /*default*/ ; + + if (dir == 'east') { + dir = 'south'; + } else if (dir == 'south') { + dir = 'west'; + } else if (dir == 'west') { + dir = 'north'; + } else if (dir == 'north') { + dir = 'east'; + } + + graph.setCellStyles(mxConstants.STYLE_DIRECTION, dir, [cell]); + } + } + } + } + } finally { + graph.getModel().endUpdate(); + } + } + }, null, null, 'Ctrl+R'); + + // View actions + this.addAction('actualSize', function() { + graph.zoomTo(1); + }); + this.addAction('zoomIn', function() { + graph.zoomIn(); + }, null, null, 'Add'); + this.addAction('zoomOut', function() { + graph.zoomOut(); + }, null, null, 'Subtract'); + this.addAction('fitWindow', function() { + graph.fit(); + }); + + this.addAction('fitPage', mxUtils.bind(this, function() { + if (!graph.pageVisible) { + this.get('pageView').funct(); + } + + var fmt = graph.pageFormat; + var ps = graph.pageScale; + var cw = graph.container.clientWidth - 20; + var ch = graph.container.clientHeight - 20; + + var scale = Math.floor(100 * Math.min(cw / fmt.width / ps, ch / fmt.height / + ps)) / 100; + graph.zoomTo(scale); + + graph.container.scrollLeft = Math.round(graph.view.translate.x * scale - + Math.max(10, (graph.container.clientWidth - fmt.width * ps * scale) / 2) + ); + graph.container.scrollTop = Math.round(graph.view.translate.y * scale - + Math.max(10, (graph.container.clientHeight - fmt.height * ps * scale) / + 2)); + })); + this.addAction('fitPageWidth', mxUtils.bind(this, function() { + if (!graph.pageVisible) { + this.get('pageView').funct(); + } + + var fmt = graph.pageFormat; + var ps = graph.pageScale; + var cw = graph.container.clientWidth - 20; + + var scale = Math.floor(100 * cw / fmt.width / ps) / 100; + graph.zoomTo(scale); + + graph.container.scrollLeft = Math.round(graph.view.translate.x * scale - + Math.max(10, (graph.container.clientWidth - fmt.width * ps * scale) / 2) + ); + graph.container.scrollTop = Math.round(graph.view.translate.y * scale - + Math.max(10, (graph.container.clientHeight - fmt.height * ps * scale) / + 2)); + })); + this.put('customZoom', new Action(mxResources.get('custom'), function() { + var value = mxUtils.prompt(mxResources.get('enterValue') + ' (%)', + parseInt(graph.getView().getScale() * 100)); + + if (value != null && value.length > 0 && !isNaN(parseInt(value))) { + graph.zoomTo(parseInt(value) / 100); + } + })); + + // Option actions + var action = null; + action = this.addAction('grid', function() { + graph.setGridEnabled(!graph.isGridEnabled()); + editor.updateGraphComponents(); + }, null, null, 'Ctrl+Shift+G'); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.isGridEnabled(); + }); + action = this.addAction('guides', function() { + graph.graphHandler.guidesEnabled = !graph.graphHandler.guidesEnabled; + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.graphHandler.guidesEnabled; + }); + action = this.addAction('tooltips', function() { + graph.tooltipHandler.setEnabled(!graph.tooltipHandler.isEnabled()); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.tooltipHandler.isEnabled(); + }); + action = this.addAction('navigation', function() { + graph.foldingEnabled = !graph.foldingEnabled; + graph.view.revalidate(); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.foldingEnabled; + }); + action = this.addAction('scrollbars', function() { + graph.scrollbars = !graph.scrollbars; + editor.updateGraphComponents(); + + if (!graph.scrollbars) { + var t = graph.view.translate; + graph.view.setTranslate(t.x - graph.container.scrollLeft / graph.view.scale, + t.y - graph.container.scrollTop / graph.view.scale); + graph.container.scrollLeft = 0; + graph.container.scrollTop = 0; + graph.sizeDidChange(); + } else { + var dx = graph.view.translate.x; + var dy = graph.view.translate.y; + + graph.view.translate.x = 0; + graph.view.translate.y = 0; + graph.sizeDidChange(); + graph.container.scrollLeft -= Math.round(dx * graph.view.scale); + graph.container.scrollTop -= Math.round(dy * graph.view.scale); + } + }, !mxClient.IS_TOUCH); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.container.style.overflow == 'auto'; + }); + action = this.addAction('pageView', mxUtils.bind(this, function() { + graph.pageVisible = !graph.pageVisible; + graph.pageBreaksVisible = graph.pageVisible; + graph.preferPageSize = graph.pageBreaksVisible; + graph.view.validate(); + graph.sizeDidChange(); + + editor.updateGraphComponents(); + editor.outline.update(); + + if (mxUtils.hasScrollbars(graph.container)) { + if (graph.pageVisible) { + graph.container.scrollLeft -= 20; + graph.container.scrollTop -= 20; + } else { + graph.container.scrollLeft += 20; + graph.container.scrollTop += 20; + } + } + })); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.pageVisible; + }); + action = this.addAction('connect', function() { + graph.setConnectable(!graph.connectionHandler.isEnabled()); + }, null, null, 'Ctrl+Q'); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.connectionHandler.isEnabled(); + }); + action = this.addAction('copyConnect', function() { + graph.connectionHandler.setCreateTarget(!graph.connectionHandler.isCreateTarget()); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.connectionHandler.isCreateTarget(); + }); + + // Help actions + this.addAction('help', function() { + var ext = ''; + + if (mxResources.isLanguageSupported(mxClient.language)) { + ext = '_' + mxClient.language; + } + + window.open(RESOURCES_PATH + '/help' + ext + '.html'); + }); + this.put('about', new Action(mxResources.get('about') + ' Cally Square', + function() { + ui.showDialog(new AboutDialog(ui).container, 320, 280, true, true); + }, null, null, 'F1')); + + // Font style actions + var toggleFontStyle = mxUtils.bind(this, function(key, style) { + this.addAction(key, function() { + graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, style); + }); + }); + + toggleFontStyle('bold', mxConstants.FONT_BOLD); + toggleFontStyle('italic', mxConstants.FONT_ITALIC); + toggleFontStyle('underline', mxConstants.FONT_UNDERLINE); + + // Format actions + this.addAction('shadow', function() { + graph.toggleCellStyles(mxConstants.STYLE_SHADOW); + }); + this.addAction('dashed', function() { + graph.toggleCellStyles(mxConstants.STYLE_DASHED); + }); + this.addAction('rounded', function() { + graph.toggleCellStyles(mxConstants.STYLE_ROUNDED); + }); + this.addAction('curved', function() { + graph.toggleCellStyles(mxConstants.STYLE_CURVED); + }); + this.addAction('style', function() { + var cells = graph.getSelectionCells(); + + if (cells != null && cells.length > 0) { + var model = graph.getModel(); + var style = mxUtils.prompt(mxResources.get('enterValue') + ' (' + + mxResources.get('style') + ')', + model.getStyle(cells[0]) || ''); + + if (style != null) { + graph.setCellStyle(style, cells); + } + } + }); + this.addAction('setAsDefaultEdge', function() { + graph.setDefaultEdge(graph.getSelectionCell()); + }); + this.addAction('addWaypoint', function() { + var cell = graph.getSelectionCell(); + + if (cell != null && graph.getModel().isEdge(cell)) { + var handler = editor.graph.selectionCellsHandler.getHandler(cell); + + if (handler instanceof mxEdgeHandler) { + var t = graph.view.translate; + var s = graph.view.scale; + var dx = t.x; + var dy = t.y; + + var parent = graph.getModel().getParent(cell); + var pgeo = graph.getCellGeometry(parent); + + if (graph.getModel().isVertex(parent) && pgeo != null) { + dx += pgeo.x; + dy += pgeo.y; + } + + handler.addPointAt(handler.state, graph.panningHandler.triggerX / s - dx, + graph.panningHandler.triggerY / s - dy); + } + } + }); + this.addAction('removeWaypoint', function() { + // TODO: Action should run with "this" set to action + var rmWaypointAction = ui.actions.get('removeWaypoint'); + + if (rmWaypointAction.handler != null) { + // NOTE: Popupevent handled and action updated in Menus.createPopupMenu + rmWaypointAction.handler.removePoint(rmWaypointAction.handler.state, + rmWaypointAction.index); + } + }); + this.addAction('image', function() { + function updateImage(value, w, h) { + var select = null; + var cells = graph.getSelectionCells(); + + graph.getModel().beginUpdate(); + try { + // Inserts new cell if no cell is selected + if (cells.length == 0) { + var gs = graph.getGridSize(); + cells = [graph.insertVertex(graph.getDefaultParent(), null, '', gs, gs, + w, h)]; + select = cells; + } + + graph.setCellStyles(mxConstants.STYLE_IMAGE, value, cells); + graph.setCellStyles(mxConstants.STYLE_SHAPE, 'image', cells); + + if (graph.getSelectionCount() == 1) { + if (w != null && h != null) { + var cell = cells[0]; + var geo = graph.getModel().getGeometry(cell); + + if (geo != null) { + geo = geo.clone(); + geo.width = w; + geo.height = h; + graph.getModel().setGeometry(cell, geo); + } + } + } + } finally { + graph.getModel().endUpdate(); + } + + if (select != null) { + graph.setSelectionCells(select); + graph.scrollCellToVisible(select[0]); + } + }; + + var value = ''; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[mxConstants.STYLE_IMAGE] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ' (' + mxResources.get( + 'url') + ')', value); + + if (value != null) { + if (value.length > 0) { + var img = new Image(); + + img.onload = function() { + updateImage(value, img.width, img.height); + }; + img.onerror = function() { + mxUtils.alert(mxResources.get('fileNotFound')); + }; + + img.src = value; + } + } + }); +}; + +/** + * Registers the given action under the given name. + */ +Actions.prototype.addAction = function(key, funct, enabled, iconCls, shortcut) { + return this.put(key, new Action(mxResources.get(key), funct, enabled, iconCls, + shortcut)); +}; + +/** + * Registers the given action under the given name. + */ +Actions.prototype.put = function(name, action) { + this.actions[name] = action; + + return action; +}; + +/** + * Returns the action for the given name or null if no such action exists. + */ +Actions.prototype.get = function(name) { + return this.actions[name]; +}; + +/** + * Constructs a new action for the given parameters. + */ +function Action(label, funct, enabled, iconCls, shortcut) { + mxEventSource.call(this); + this.label = label; + this.funct = funct; + this.enabled = (enabled != null) ? enabled : true; + this.iconCls = iconCls; + this.shortcut = shortcut; +}; + +// Action inherits from mxEventSource +mxUtils.extend(Action, mxEventSource); + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setEnabled = function(value) { + if (this.enabled != value) { + this.enabled = value; + this.fireEvent(new mxEventObject('stateChanged')); + } +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setToggleAction = function(value) { + this.toggleAction = value; +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setSelectedCallback = function(funct) { + this.selectedCallback = funct; +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.isSelected = function() { + return this.selectedCallback(); +}; diff --git a/public/assets/plugins/jscripty/js/Dialogs.js b/public/assets/plugins/jscripty/js/Dialogs.js index f68ae35..11d6772 100644 --- a/public/assets/plugins/jscripty/js/Dialogs.js +++ b/public/assets/plugins/jscripty/js/Dialogs.js @@ -1 +1,1152 @@ -var _0x58ae=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x69\x6E\x70\x75\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x63\x68\x65\x63\x6B\x62\x6F\x78","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x68\x65\x63\x6B\x65\x64","\x47\x45\x54","\x6F\x70\x65\x6E","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x65\x61\x72\x65\x72\x20","\x74\x6F\x6B\x65\x6E","\x64\x61\x74\x61","\x65\x64\x69\x74\x6F\x72","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x70\x61\x72\x73\x65","\x73\x65\x6C\x65\x63\x74","\x6F\x70\x74\x69\x6F\x6E","\x74\x65\x78\x74","\x2D\x2D\x20\x4E\x6F\x6E\x65\x20\x2D\x2D","\x76\x61\x6C\x75\x65","\x30","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x72\x6F\x77\x73","\x73\x65\x6C\x65\x63\x74\x65\x64","\x66\x6F\x72\x45\x61\x63\x68","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x66\x6F\x72\x6D\x2D\x63\x6F\x6E\x74\x72\x6F\x6C\x20\x73\x65\x6C\x65\x63\x74\x32","\x66\x69\x6C\x74\x65\x72","\x73\x65\x6C\x65\x63\x74\x2D\x67\x72\x6F\x75\x70\x2D\x66\x61\x74\x68\x65\x72","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x73\x65\x6C\x65\x63\x74\x2D\x67\x72\x6F\x75\x70\x2D\x73\x6F\x6E","\x2D","\x63\x61\x70\x69\x74\x61\x6C\x69\x7A\x65","","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x73\x63\x72\x6F\x6C\x6C\x57\x69\x64\x74\x68","\x62\x6F\x64\x79","\x72\x6F\x75\x6E\x64","\x6D\x61\x78","\x73\x63\x72\x6F\x6C\x6C\x48\x65\x69\x67\x68\x74","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x44\x69\x61\x6C\x6F\x67","\x63\x72\x65\x61\x74\x65\x44\x69\x76","\x6D\x6F\x64\x61\x6C\x20\x66\x61\x64\x65\x20\x69\x6E\x20\x63\x65\x6E\x74\x65\x72","\x64\x69\x73\x70\x6C\x61\x79","\x73\x74\x79\x6C\x65","\x62\x6C\x6F\x63\x6B","\x70\x61\x64\x64\x69\x6E\x67\x52\x69\x67\x68\x74","\x31\x32\x70\x78","\x67\x65\x4D\x6F\x64\x61\x6C\x44\x69\x61\x6C\x6F\x67","\x6D\x6F\x64\x61\x6C\x2D\x64\x69\x61\x6C\x6F\x67","\x62\x67","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x6D\x6F\x64\x61\x6C\x2D\x62\x61\x63\x6B\x64\x72\x6F\x70\x20\x66\x61\x64\x65\x20\x69\x6E","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x6F\x6E\x44\x69\x61\x6C\x6F\x67\x43\x6C\x6F\x73\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x6C\x6F\x73\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x6D\x6F\x64\x61\x6C\x2D\x63\x6F\x6E\x74\x65\x6E\x74","\x6D\x6F\x64\x61\x6C\x2D\x68\x65\x61\x64\x65\x72","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79","\x6D\x6F\x64\x61\x6C\x2D\x66\x6F\x6F\x74\x65\x72","\x68\x34","\x63\x72\x65\x61\x74\x65\x48\x65\x61\x64\x65\x72","\x69\x6D\x70\x6F\x72\x74","\x67\x65\x74","\x20\x58\x4D\x4C","\x77\x72\x69\x74\x65","\x68\x69\x64\x65\x44\x69\x61\x6C\x6F\x67","\x62\x75\x74\x74\x6F\x6E","\x72\x6F\x77","\x63\x6F\x6C\x2D\x6D\x64\x2D\x31\x32","\x74\x65\x78\x74\x61\x72\x65\x61","\x77\x69\x64\x74\x68","\x31\x30\x30\x25","\x68\x65\x69\x67\x68\x74","\x33\x37\x34\x70\x78","\x66\x69\x6C\x65","\x61\x63\x63\x65\x70\x74","\x74\x65\x78\x74\x2F\x78\x6D\x6C","\x63\x68\x61\x6E\x67\x65","\x66\x69\x6C\x65\x73","\x74\x61\x72\x67\x65\x74","\x6C\x6F\x67","\x6F\x6E\x6C\x6F\x61\x64","\x72\x65\x73\x75\x6C\x74","\x72\x65\x61\x64\x41\x73\x54\x65\x78\x74","\x46\x61\x69\x6C\x65\x64\x20\x74\x6F\x20\x6C\x6F\x61\x64\x20\x66\x6F\x72\x6D\x61\x74\x20\x66\x69\x6C\x65","\x46\x61\x69\x6C\x65\x64\x20\x74\x6F\x20\x6C\x6F\x61\x64\x20\x66\x69\x6C\x65","\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x72\x73\x65\x58\x6D\x6C","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x62\x69\x6E\x64","\x62\x74\x6E\x20\x62\x6C\x75\x65","\x63\x61\x6E\x63\x65\x6C","\x62\x74\x6E\x20\x64\x65\x66\x61\x75\x6C\x74","\x61\x62\x6F\x75\x74","\x20\x43\x61\x6C\x6C\x79\x20\x53\x71\x75\x61\x72\x65","\x69\x6D\x67","\x62\x6F\x72\x64\x65\x72","\x30\x70\x78","\x31\x37\x36","\x31\x35\x31","\x73\x72\x63","\x2F\x6C\x6F\x67\x6F\x2E\x70\x6E\x67","\x62\x72","\x50\x6F\x77\x65\x72\x65\x64\x20\x62\x79\x20\x58\x65\x6E\x69\x61\x6C\x61\x62\x20","\x56\x45\x52\x53\x49\x4F\x4E","\x61","\x68\x72\x65\x66","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65\x2E\x63\x6F\x6D\x2F","\x5F\x62\x6C\x61\x6E\x6B","\x77\x77\x77\x2E\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65\x2E\x63\x6F\x6D","\x73\x61\x76\x65\x41\x73","\x6E\x61\x6D\x65","\x5F","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x63\x6F\x6C\x2D\x6D\x64\x2D\x34","\x63\x6F\x6C\x2D\x6D\x64\x2D\x38","\x6C\x61\x62\x65\x6C","\x63\x6F\x6E\x74\x72\x6F\x6C\x2D\x6C\x61\x62\x65\x6C\x20\x70\x75\x6C\x6C\x2D\x72\x69\x67\x68\x74","\x5F\x63\x6F\x70\x79","\x69\x64","\x66\x6F\x72\x6D\x2D\x63\x6F\x6E\x74\x72\x6F\x6C","\x73\x61\x76\x65","\x6E\x65\x77","\x5F\x6E\x65\x77","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x20\x6E\x61\x6D\x65","\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x2F","\x72\x65\x6E\x61\x6D\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x50\x55\x54","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x78\x2D\x77\x77\x77\x2D\x66\x6F\x72\x6D\x2D\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x6E\x61\x6D\x65\x3D","\x50\x72\x6F\x6A\x65\x63\x74\x20\x73\x75\x63\x63\x65\x73\x73\x66\x75\x6C\x6C\x79\x20\x72\x65\x6E\x61\x6D\x65\x64","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x6D\x65\x73\x73\x61\x67\x65","\x65\x72\x72\x6F\x72\x73","\x6F\x6E\x65\x72\x72\x6F\x72","\x73\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x61\x6C\x65\x72\x74","\x65\x64\x69\x74","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x67\x65\x74\x50\x72\x65\x74\x74\x79\x58\x6D\x6C","\x73\x74\x6F\x70\x50\x72\x6F\x70\x61\x67\x61\x74\x69\x6F\x6E","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x64\x61\x74\x61\x54\x72\x61\x6E\x73\x66\x65\x72","\x64\x72\x61\x67\x6F\x76\x65\x72","\x64\x72\x6F\x70","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x20\x66\x6F\x72\x6D","\x65\x78\x70\x6F\x72\x74","\x66\x6F\x72\x6D\x2D\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x20\x66\x6F\x72\x6D\x2D\x72\x6F\x77\x2D\x73\x65\x70\x65\x72\x61\x74\x65\x64","\x66\x6F\x72\x6D\x2D\x67\x72\x6F\x75\x70\x20\x6C\x61\x73\x74","\x63\x6F\x6C\x2D\x73\x6D\x2D\x34\x20\x63\x6F\x6E\x74\x72\x6F\x6C\x2D\x6C\x61\x62\x65\x6C","\x63\x6F\x6C\x2D\x73\x6D\x2D\x38","\x67\x65\x74\x58\x6D\x6C","\x73\x69\x6D\x75\x6C\x61\x74\x65","\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D","\x67\x72\x61\x70\x68","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x20\x66\x6F\x72\x6D\x20\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x2D\x73\x63\x72\x6F\x6C\x6C","\x20","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x69\x6E\x70\x75\x74\x47\x72\x6F\x75\x70","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x6F\x72\x6D\x2D\x67\x72\x6F\x75\x70","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x54\x65\x78\x74","\x42\x6F\x64\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x49\x6E\x73\x65\x72\x74\x20\x6C\x61\x62\x65\x6C\x20\x66\x6F\x72\x20\x22\x4F\x74\x68\x65\x72\x22\x20\x61\x6E\x73\x77\x65\x72\x20\x6F\x70\x74\x69\x6F\x6E","\x6F\x74\x68\x65\x72","\x2B","\x62\x74\x6E\x20\x67\x72\x65\x65\x6E","\x61\x64\x64","\x68\x65\x6C\x70\x5F","\x70","\x68\x65\x6C\x70\x2D\x62\x6C\x6F\x63\x6B","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x6D\x6F\x64\x65\x6C","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x72\x65\x66\x72\x65\x73\x68","\x63\x6F\x6C\x2D\x6D\x64\x2D\x35","\x63\x6F\x6C\x2D\x6D\x64\x2D\x32","\x49\x6E\x73\x65\x72\x74\x20\x6C\x61\x62\x65\x6C","\x6E\x75\x6D\x62\x65\x72","\x78","\x70\x61\x72\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x62\x74\x6E\x20\x72\x65\x64"];_0x58ae[0];function createCheckbox(_0xcfe0x2){var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[3],_0x58ae[4]);if(_0xcfe0x2){_0xcfe0x3[_0x58ae[5]](_0x58ae[6],true)};return _0xcfe0x3}function createDropdownFromApi(_0xcfe0x5,_0xcfe0x2,_0xcfe0x6,_0xcfe0x7,_0xcfe0x8,_0xcfe0x9){var _0xcfe0xa= new XMLHttpRequest();_0xcfe0xa[_0x58ae[8]](_0x58ae[7],_0xcfe0x5,false);_0xcfe0xa[_0x58ae[14]](_0x58ae[9],_0x58ae[10]+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[11]]);_0xcfe0xa[_0x58ae[15]](null);var _0xcfe0xb=[];if(_0xcfe0xa[_0x58ae[16]]===200){_0xcfe0xb=JSON[_0x58ae[18]](_0xcfe0xa[_0x58ae[17]])};var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[19]);var _0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0x58ae[22];_0xcfe0xc[_0x58ae[23]]=_0x58ae[24];_0xcfe0x3[_0x58ae[25]](_0xcfe0xc);var _0xcfe0xd=_0xcfe0x9?_0xcfe0xb[_0x58ae[26]]:_0xcfe0xb;_0xcfe0xd[_0x58ae[28]](function(_0xcfe0xe){_0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0xcfe0xe[_0xcfe0x6];_0xcfe0xc[_0x58ae[23]]=_0xcfe0xe[_0xcfe0x7];_0xcfe0xc[_0x58ae[27]]=(_0xcfe0xe[_0xcfe0x7]==_0xcfe0x2);_0xcfe0x3[_0x58ae[25]](_0xcfe0xc)});_0xcfe0x3[_0x58ae[29]]=_0x58ae[30];return _0xcfe0x3}function createGroupedDropdownFromApi(_0xcfe0x5,_0xcfe0x2,_0xcfe0x6,_0xcfe0x7,_0xcfe0x8,_0xcfe0x9,_0xcfe0x10){var _0xcfe0xa= new XMLHttpRequest();_0xcfe0xa[_0x58ae[8]](_0x58ae[7],_0xcfe0x5,false);_0xcfe0xa[_0x58ae[14]](_0x58ae[9],_0x58ae[10]+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[11]]);_0xcfe0xa[_0x58ae[15]](null);var _0xcfe0xb=[];if(_0xcfe0xa[_0x58ae[16]]===200){_0xcfe0xb=JSON[_0x58ae[18]](_0xcfe0xa[_0x58ae[17]])};var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[19]);var _0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0x58ae[22];_0xcfe0xc[_0x58ae[23]]=_0x58ae[24];_0xcfe0x3[_0x58ae[25]](_0xcfe0xc);var _0xcfe0xd=_0xcfe0x9?_0xcfe0xb[_0x58ae[26]]:_0xcfe0xb;var _0xcfe0x11={};var _0xcfe0x12={};_0xcfe0x11[_0xcfe0x10]=null;var _0xcfe0x13=_[_0x58ae[31]](_0xcfe0xd,_0xcfe0x11);var _0xcfe0x14={};_0xcfe0x13[_0x58ae[28]](function(_0xcfe0xe){_0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[29]]=_0x58ae[32];_0xcfe0xc[_0x58ae[21]]=_0xcfe0xe[_0xcfe0x6][_0x58ae[33]]();_0xcfe0xc[_0x58ae[23]]=_0xcfe0xe[_0xcfe0x7];_0xcfe0xc[_0x58ae[27]]=(_0xcfe0xe[_0xcfe0x7]==_0xcfe0x2);_0xcfe0x3[_0x58ae[25]](_0xcfe0xc);_0xcfe0x12[_0xcfe0x10]=_0xcfe0xe[_0xcfe0x7];_0xcfe0x14=_[_0x58ae[31]](_0xcfe0xd,_0xcfe0x12);_0xcfe0x14[_0x58ae[28]](function(_0xcfe0xe){_0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[29]]=_0x58ae[34];_0xcfe0xc[_0x58ae[21]]=_0x58ae[35]+_[_0x58ae[36]](_0xcfe0xe[_0xcfe0x6]);_0xcfe0xc[_0x58ae[23]]=_0xcfe0xe[_0xcfe0x7];_0xcfe0xc[_0x58ae[27]]=(_0xcfe0xe[_0xcfe0x7]==_0xcfe0x2);_0xcfe0x3[_0x58ae[25]](_0xcfe0xc)})});_0xcfe0x3[_0x58ae[29]]=_0x58ae[30];return _0xcfe0x3}function createDropdownFromArray(_0xcfe0x16,_0xcfe0x2){var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[19]);for(var _0xcfe0x17 in _0xcfe0x16){var _0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0xcfe0x16[_0xcfe0x17];_0xcfe0xc[_0x58ae[23]]=_0xcfe0x17;if(_0xcfe0x2>0||_0xcfe0x2!=_0x58ae[37]){_0xcfe0xc[_0x58ae[27]]=(_0xcfe0x2===_0xcfe0x17)?true:false};_0xcfe0x3[_0x58ae[25]](_0xcfe0xc)};_0xcfe0x3[_0x58ae[29]]=_0x58ae[30];return _0xcfe0x3}function Dialog(_0xcfe0x8,_0xcfe0x19,_0xcfe0x1a,_0xcfe0x1b,_0xcfe0x1c,_0xcfe0x1d,_0xcfe0x1e){var _0xcfe0x1f=0;if(mxClient[_0x58ae[38]]&&document[_0x58ae[39]]!=9){_0xcfe0x1f=60};_0xcfe0x1a+=_0xcfe0x1f;_0xcfe0x1b+=_0xcfe0x1f;var _0xcfe0x20=Math[_0x58ae[43]](0,Math[_0x58ae[42]]((document[_0x58ae[41]][_0x58ae[40]]-_0xcfe0x1a)/2));var _0xcfe0x21=Math[_0x58ae[43]](0,Math[_0x58ae[42]]((Math[_0x58ae[43]](document[_0x58ae[41]][_0x58ae[44]],document[_0x58ae[45]][_0x58ae[44]])-_0xcfe0x1b)/3));var _0xcfe0x22=_0xcfe0x8[_0x58ae[47]](_0x58ae[46]);_0xcfe0x22[_0x58ae[29]]=_0x58ae[48];_0xcfe0x22[_0x58ae[50]][_0x58ae[49]]=_0x58ae[51];_0xcfe0x22[_0x58ae[50]][_0x58ae[52]]=_0x58ae[53];var _0xcfe0x23=_0xcfe0x8[_0x58ae[47]](_0x58ae[54]);_0xcfe0x23[_0x58ae[29]]=_0x58ae[55];_0xcfe0x23[_0x58ae[25]](_0xcfe0x19);_0xcfe0x22[_0x58ae[25]](_0xcfe0x23);if(this[_0x58ae[56]]==null){this[_0x58ae[56]]=_0xcfe0x8[_0x58ae[47]](_0x58ae[57]);this[_0x58ae[56]][_0x58ae[29]]=_0x58ae[58];if(mxClient[_0x58ae[59]]){ new mxDivResizer(this[_0x58ae[56]])}};if(_0xcfe0x1c){document[_0x58ae[41]][_0x58ae[25]](this[_0x58ae[56]])};document[_0x58ae[41]][_0x58ae[25]](_0xcfe0x22);this[_0x58ae[60]]=_0xcfe0x1e;this[_0x58ae[61]]=_0xcfe0x22}Dialog[_0x58ae[63]][_0x58ae[62]]=function(){if(this[_0x58ae[60]]!=null){this[_0x58ae[60]]();this[_0x58ae[60]]=null};this[_0x58ae[61]][_0x58ae[65]][_0x58ae[64]](this[_0x58ae[61]]);this[_0x58ae[56]][_0x58ae[65]][_0x58ae[64]](this[_0x58ae[56]])};function ImportDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[72])+_0x58ae[74]);var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[79]);var _0xcfe0x2d=document[_0x58ae[2]](_0x58ae[80]);_0xcfe0x2d[_0x58ae[50]][_0x58ae[81]]=_0x58ae[82];_0xcfe0x2d[_0x58ae[50]][_0x58ae[83]]=_0x58ae[84];var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[3]]=_0x58ae[85];_0xcfe0x3[_0x58ae[5]](_0x58ae[86],_0x58ae[87]);_0xcfe0x3[_0x58ae[97]](_0x58ae[88],function _0xcfe0x2e(_0xcfe0x2f){var _0xcfe0x30=_0xcfe0x2f[_0x58ae[90]][_0x58ae[89]][0];console[_0x58ae[91]](_0xcfe0x30);if(_0xcfe0x30){if(_0xcfe0x30[_0x58ae[3]]===_0x58ae[87]){var _0xcfe0x31= new FileReader();_0xcfe0x31[_0x58ae[92]]=function(_0xcfe0x32){var _0xcfe0x33=_0xcfe0x32[_0x58ae[90]][_0x58ae[93]];mxUtils[_0x58ae[75]](_0xcfe0x2d,_0xcfe0x33)};_0xcfe0x31[_0x58ae[94]](_0xcfe0x30)}else {alert(_0x58ae[95])}}else {alert(_0x58ae[96])}},false);_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3);_0xcfe0x2c[_0x58ae[25]](_0xcfe0x2d);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[72]),mxUtils[_0x58ae[100]](this,function(_0xcfe0x35){var _0xcfe0x36=mxUtils[_0x58ae[98]](_0xcfe0x2d[_0x58ae[23]]);_0xcfe0x8[_0x58ae[13]][_0x58ae[99]](_0xcfe0x36[_0x58ae[45]]);_0xcfe0x8[_0x58ae[76]]()}));_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function AboutDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[104])+_0x58ae[105]);var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x39=document[_0x58ae[2]](_0x58ae[106]);_0xcfe0x39[_0x58ae[50]][_0x58ae[107]]=_0x58ae[108];_0xcfe0x39[_0x58ae[5]](_0x58ae[81],_0x58ae[109]);_0xcfe0x39[_0x58ae[5]](_0x58ae[81],_0x58ae[110]);_0xcfe0x39[_0x58ae[5]](_0x58ae[111],IMAGE_PATH+_0x58ae[112]);_0xcfe0x27[_0x58ae[25]](_0xcfe0x39);mxUtils[_0x58ae[113]](_0xcfe0x27);mxUtils[_0x58ae[75]](_0xcfe0x27,_0x58ae[114]+mxClient[_0x58ae[115]]);mxUtils[_0x58ae[113]](_0xcfe0x27);var _0xcfe0x3a=document[_0x58ae[2]](_0x58ae[116]);_0xcfe0x3a[_0x58ae[5]](_0x58ae[117],_0x58ae[118]);_0xcfe0x3a[_0x58ae[5]](_0x58ae[90],_0x58ae[119]);mxUtils[_0x58ae[75]](_0xcfe0x3a,_0x58ae[120]);_0xcfe0x27[_0x58ae[25]](_0xcfe0x3a);mxUtils[_0x58ae[113]](_0xcfe0x27);mxUtils[_0x58ae[113]](_0xcfe0x27);var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[62]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function SaveDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[121]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x3c=_0x58ae[122];var _0xcfe0x3d=_0x58ae[123]+_0xcfe0x3c;var _0xcfe0x2=_0xcfe0x8[_0x58ae[13]][_0x58ae[124]]();var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[125]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[126]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[128];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0xcfe0x3c));_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0x40=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x40[_0x58ae[5]](_0x58ae[23],_0xcfe0x2+_0x58ae[129]);_0xcfe0x40[_0x58ae[5]](_0x58ae[130],_0xcfe0x3d);_0xcfe0x40[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x40);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[132]),function(){_0xcfe0x8[_0x58ae[121]](_0xcfe0x40[_0x58ae[23]]);_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function NewDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[133]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x3c=_0x58ae[122];var _0xcfe0x3d=_0x58ae[123]+_0xcfe0x3c;var _0xcfe0x2=_0xcfe0x8[_0x58ae[13]][_0x58ae[124]]();var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[125]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[126]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[128];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0xcfe0x3c));_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0x40=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x40[_0x58ae[5]](_0x58ae[23],_0xcfe0x2+_0x58ae[134]);_0xcfe0x40[_0x58ae[5]](_0x58ae[130],_0xcfe0x3d);_0xcfe0x40[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x40);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[133]),function(){_0xcfe0x8[_0x58ae[133]](_0xcfe0x40[_0x58ae[23]]);_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function VariableDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[135]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x3c=_0x58ae[122];var _0xcfe0x3d=_0x58ae[123]+_0xcfe0x3c;var _0xcfe0x2=_0xcfe0x8[_0x58ae[13]][_0x58ae[124]]();var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[125]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[126]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[128];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0xcfe0x3c));_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0x40=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x40[_0x58ae[5]](_0x58ae[23],_0x58ae[136]);_0xcfe0x40[_0x58ae[5]](_0x58ae[130],_0xcfe0x3d);_0xcfe0x40[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x40);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[133]),function(){_0xcfe0x8[_0x58ae[135]](_0xcfe0x40[_0x58ae[23]]);_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function OpenDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[8]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[125]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[126]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[128];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0x58ae[122]));_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0xa= new XMLHttpRequest();_0xcfe0xa[_0x58ae[8]](_0x58ae[7],_0x58ae[137],false);_0xcfe0xa[_0x58ae[14]](_0x58ae[9],_0x58ae[10]+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[11]]);_0xcfe0xa[_0x58ae[15]](null);var _0xcfe0xb=[];if(_0xcfe0xa[_0x58ae[16]]===200){_0xcfe0xb=JSON[_0x58ae[18]](_0xcfe0xa[_0x58ae[17]])};var _0xcfe0x40=document[_0x58ae[2]](_0x58ae[19]);for(var _0xcfe0x44=0;_0xcfe0x44<_0xcfe0xb[_0x58ae[138]];_0xcfe0x44++){var _0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0xcfe0xb[_0xcfe0x44][_0x58ae[122]];_0xcfe0xc[_0x58ae[23]]=_0xcfe0xb[_0xcfe0x44][_0x58ae[130]];_0xcfe0x40[_0x58ae[25]](_0xcfe0xc)};_0xcfe0x40[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x40);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[8]),function(){console[_0x58ae[91]](_0xcfe0x40);console[_0x58ae[91]](_0xcfe0x40[_0x58ae[23]]);window[_0x58ae[8]](_0x58ae[139]+_0xcfe0x40[_0x58ae[23]],_0x58ae[119]);_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function RenameDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[140]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[125]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[126]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[128];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0x58ae[122]));_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0x3c=_0xcfe0x8[_0x58ae[13]][_0x58ae[141]];var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[23],_0xcfe0x3c);_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x3);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[132]),function(){var _0xcfe0xa= new XMLHttpRequest();_0xcfe0xa[_0x58ae[8]](_0x58ae[142],SAVE_URL+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[130]],true);_0xcfe0xa[_0x58ae[14]](_0x58ae[143],_0x58ae[144]);_0xcfe0xa[_0x58ae[14]](_0x58ae[9],_0x58ae[10]+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[11]]);_0xcfe0xa[_0x58ae[15]](_0x58ae[145]+_0xcfe0x3[_0x58ae[23]]);_0xcfe0xa[_0x58ae[92]]=function(_0xcfe0x32){if(_0xcfe0xa[_0x58ae[16]]===200){_0xcfe0x8[_0x58ae[13]][_0x58ae[147]](_0x58ae[146]);_0xcfe0x8[_0x58ae[13]][_0x58ae[141]]=_0xcfe0x3[_0x58ae[23]]}else {_0xcfe0x8[_0x58ae[13]][_0x58ae[147]](JSON[_0x58ae[18]](_0xcfe0xa[_0x58ae[17]])[_0x58ae[149]][0][_0x58ae[148]])}};_0xcfe0xa[_0x58ae[150]]=function(_0xcfe0x32){mxUtils[_0x58ae[152]](_0xcfe0xa[_0x58ae[151]])};_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function EditFileDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[68]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[153]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x2b=_0xcfe0x8[_0x58ae[47]](_0x58ae[78]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[79]);var _0xcfe0x2d=document[_0x58ae[2]](_0x58ae[80]);_0xcfe0x2d[_0x58ae[50]][_0x58ae[81]]=_0x58ae[82];_0xcfe0x2d[_0x58ae[50]][_0x58ae[83]]=_0x58ae[84];_0xcfe0x2d[_0x58ae[23]]=mxUtils[_0x58ae[155]](_0xcfe0x8[_0x58ae[13]][_0x58ae[154]]());if(fileSupport){function _0xcfe0x47(_0xcfe0x2f){_0xcfe0x2f[_0x58ae[156]]();_0xcfe0x2f[_0x58ae[157]]();if(_0xcfe0x2f[_0x58ae[158]][_0x58ae[89]][_0x58ae[138]]>0){var _0xcfe0x48=_0xcfe0x2f[_0x58ae[158]][_0x58ae[89]][0];var _0xcfe0x49= new FileReader();_0xcfe0x49[_0x58ae[92]]=function(_0xcfe0x32){_0xcfe0x2d[_0x58ae[23]]=_0xcfe0x32[_0x58ae[90]][_0x58ae[93]]};_0xcfe0x49[_0x58ae[94]](_0xcfe0x48)}}function _0xcfe0x4a(_0xcfe0x2f){_0xcfe0x2f[_0x58ae[156]]();_0xcfe0x2f[_0x58ae[157]]()}_0xcfe0x2d[_0x58ae[97]](_0x58ae[159],_0xcfe0x4a,false);_0xcfe0x2d[_0x58ae[97]](_0x58ae[160],_0xcfe0x47,false)};_0xcfe0x2c[_0x58ae[25]](_0xcfe0x2d);_0xcfe0x2b[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x27[_0x58ae[25]](_0xcfe0x2b);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[132]),function(){var _0xcfe0x36=mxUtils[_0x58ae[98]](_0xcfe0x2d[_0x58ae[23]]);_0xcfe0x8[_0x58ae[13]][_0x58ae[99]](_0xcfe0x36[_0x58ae[45]]);_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function ExportDialog(_0xcfe0x8){var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[161]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[162])+_0x58ae[74]);var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x4c=_0xcfe0x8[_0x58ae[47]](_0x58ae[163]);var _0xcfe0x4d=_0xcfe0x8[_0x58ae[47]](_0x58ae[164]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[165];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0x58ae[141]));var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[23],_0xcfe0x8[_0x58ae[13]][_0x58ae[124]]());_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];var _0xcfe0x22=_0xcfe0x8[_0x58ae[47]](_0x58ae[166]);_0xcfe0x22[_0x58ae[25]](_0xcfe0x3);_0xcfe0x4d[_0x58ae[25]](_0xcfe0x3f);_0xcfe0x4d[_0x58ae[25]](_0xcfe0x22);_0xcfe0x4c[_0x58ae[25]](_0xcfe0x4d);_0xcfe0x27[_0x58ae[25]](_0xcfe0x4c);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[162]),mxUtils[_0x58ae[100]](this,function(_0xcfe0x35){_0xcfe0x8[_0x58ae[132]](false);var _0xcfe0x4e=encodeURIComponent(mxUtils[_0x58ae[167]](_0xcfe0x8[_0x58ae[13]][_0x58ae[154]]())); new mxXmlRequest(SAVE_URL+_0xcfe0x8[_0x58ae[13]][_0x58ae[12]][_0x58ae[130]]+_0x58ae[169],_0x58ae[170]+_0xcfe0x3[_0x58ae[23]],_0x58ae[7])[_0x58ae[168]](document,_0x58ae[119]);_0xcfe0x8[_0x58ae[76]]()}));_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function GeneralDialog(_0xcfe0x8,_0xcfe0x50){var _0xcfe0x51=_0xcfe0x8[_0x58ae[13]][_0x58ae[171]];var _0xcfe0x25=_0xcfe0x8[_0x58ae[47]](_0x58ae[66]);var _0xcfe0x26=_0xcfe0x8[_0x58ae[47]](_0x58ae[67]);var _0xcfe0x27=_0xcfe0x8[_0x58ae[47]](_0x58ae[172]);var _0xcfe0x28=_0xcfe0x8[_0x58ae[47]](_0x58ae[69]);var _0xcfe0x29=_0xcfe0x8[_0x58ae[71]](_0x58ae[70]);mxUtils[_0x58ae[75]](_0xcfe0x29,mxResources[_0x58ae[73]](_0x58ae[153])+_0x58ae[173]+mxResources[_0x58ae[73]](_0xcfe0x50[_0x58ae[23]][_0x58ae[174]]));var _0xcfe0x2a=mxUtils[_0x58ae[77]](_0x58ae[37],function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x2a[_0x58ae[29]]=_0x58ae[62];_0xcfe0x26[_0x58ae[25]](_0xcfe0x2a);_0xcfe0x26[_0x58ae[25]](_0xcfe0x29);var _0xcfe0x52=_0xcfe0x8[_0x58ae[47]](_0x58ae[163]);_0xcfe0x52[_0x58ae[5]](_0x58ae[130],_0x58ae[175]);var _0xcfe0x53=_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0x58ae[138]];var _0xcfe0x4c=_0xcfe0x8[_0x58ae[47]](_0x58ae[163]);for(var _0xcfe0x54=0;_0xcfe0x54<_0xcfe0x53;_0xcfe0x54++){var _0xcfe0x3c=_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0xcfe0x54][_0x58ae[122]];var _0xcfe0x3d=_0x58ae[123]+_0xcfe0x3c;var _0xcfe0x2=_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0xcfe0x54][_0x58ae[23]];var _0xcfe0x4d=_0xcfe0x8[_0x58ae[47]]((_0xcfe0x54==_0xcfe0x53-1)?_0x58ae[164]:_0x58ae[177]);var _0xcfe0x3f=document[_0x58ae[2]](_0x58ae[127]);_0xcfe0x3f[_0x58ae[29]]=_0x58ae[165];mxUtils[_0x58ae[75]](_0xcfe0x3f,mxResources[_0x58ae[73]](_0xcfe0x3c));_0xcfe0x4d[_0x58ae[25]](_0xcfe0x3f);var _0xcfe0x3;switch(_0xcfe0x3c){case _0x58ae[179]:_0xcfe0x3=document[_0x58ae[2]](_0x58ae[80]);_0xcfe0x3[_0x58ae[178]]=_0xcfe0x2;_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];break;case _0x58ae[180]:_0xcfe0x3=document[_0x58ae[2]](_0x58ae[80]);_0xcfe0x3[_0x58ae[178]]=_0xcfe0x2;_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];break;case _0x58ae[181]:_0xcfe0x3=document[_0x58ae[2]](_0x58ae[80]);_0xcfe0x3[_0x58ae[178]]=_0xcfe0x2;_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];break;case _0x58ae[184]:_0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[23],_0xcfe0x2);_0xcfe0x3[_0x58ae[5]](_0x58ae[182],_0x58ae[183]);_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];break;case _0x58ae[187]:var _0xcfe0x3=mxUtils[_0x58ae[77]](_0x58ae[185],function(){var _0xcfe0x55=createDynamicInput(null,null,_0xcfe0x8);_0xcfe0x52[_0x58ae[25]](_0xcfe0x55);_0xcfe0x27[_0x58ae[25]](_0xcfe0x52)});_0xcfe0x3[_0x58ae[29]]=_0x58ae[186];break;default:_0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[23],_0xcfe0x2);_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];break};_0xcfe0x3[_0x58ae[5]](_0x58ae[130],_0xcfe0x3d);var _0xcfe0x22=_0xcfe0x8[_0x58ae[47]](_0x58ae[166]);_0xcfe0x22[_0x58ae[25]](_0xcfe0x3);if(mxResources[_0x58ae[73]](_0x58ae[188]+_0xcfe0x3c)){var _0xcfe0x56=_0xcfe0x8[_0x58ae[47]](_0x58ae[189]);_0xcfe0x56[_0x58ae[29]]=_0x58ae[190];mxUtils[_0x58ae[75]](_0xcfe0x56,mxResources[_0x58ae[73]](_0x58ae[188]+_0xcfe0x3c));_0xcfe0x22[_0x58ae[25]](_0xcfe0x56)};_0xcfe0x4d[_0x58ae[25]](_0xcfe0x22);_0xcfe0x4c[_0x58ae[25]](_0xcfe0x4d)};_0xcfe0x27[_0x58ae[25]](_0xcfe0x4c);if(_0xcfe0x50[_0x58ae[23]][_0x58ae[174]]==_0x58ae[1]){if(_0xcfe0x50[_0x58ae[191]]){for(var _0xcfe0x44=0;_0xcfe0x44<_0xcfe0x50[_0x58ae[191]][_0x58ae[138]];_0xcfe0x44++){var _0xcfe0x57=_0x58ae[37];var _0xcfe0x58=_0x58ae[37];_[_0x58ae[28]](_0xcfe0x50[_0x58ae[191]][_0xcfe0x44][_0x58ae[23]][_0x58ae[176]],function(_0xcfe0x59){if(_0xcfe0x59[_0x58ae[122]]==_0x58ae[3]){_0xcfe0x57=_0xcfe0x59[_0x58ae[23]]}else {if(_0xcfe0x59[_0x58ae[122]]==_0x58ae[127]){_0xcfe0x58=_0xcfe0x59[_0x58ae[23]]}}});var _0xcfe0x55=createDynamicInput(_0xcfe0x57,_0xcfe0x58,_0xcfe0x8);_0xcfe0x52[_0x58ae[25]](_0xcfe0x55)}}};_0xcfe0x27[_0x58ae[25]](_0xcfe0x52);var _0xcfe0x34=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[132]),mxUtils[_0x58ae[100]](this,function(_0xcfe0x35){for(var _0xcfe0x54=0;_0xcfe0x54<_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0x58ae[138]];_0xcfe0x54++){var _0xcfe0x3d=_0x58ae[123]+_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0xcfe0x54][_0x58ae[122]];var _0xcfe0x3c=_0xcfe0x50[_0x58ae[23]][_0x58ae[176]][_0xcfe0x54][_0x58ae[122]];console[_0x58ae[91]](_0xcfe0x3c);_0xcfe0x50[_0x58ae[5]](_0xcfe0x3c,document[_0x58ae[192]](_0xcfe0x3d)[_0x58ae[23]]);console[_0x58ae[91]](document[_0x58ae[192]](_0xcfe0x3d)[_0x58ae[23]])};if(_0xcfe0x50[_0x58ae[23]][_0x58ae[174]]==_0x58ae[1]){if(_0xcfe0x51[_0x58ae[194]][_0x58ae[193]](_0xcfe0x50)){_0xcfe0x50[_0x58ae[191]]=[]};if(document[_0x58ae[192]](_0x58ae[175])){var _0xcfe0x52=document[_0x58ae[192]](_0x58ae[175])[_0x58ae[191]];for(var _0xcfe0x44=0;_0xcfe0x44<_0xcfe0x52[_0x58ae[138]];_0xcfe0x44++){var _0xcfe0x5a=_0xcfe0x52[_0xcfe0x44][_0x58ae[191]][1];var _0xcfe0x5b=_0xcfe0x52[_0xcfe0x44][_0x58ae[191]][0];var _0xcfe0x36=mxUtils[_0x58ae[195]]();var _0xcfe0x5c=_0xcfe0x36[_0x58ae[2]](_0x58ae[175]);_0xcfe0x5c[_0x58ae[5]](_0x58ae[3],_0xcfe0x52[_0xcfe0x44][_0x58ae[196]](_0x58ae[19])[0][_0x58ae[23]]);_0xcfe0x5c[_0x58ae[5]](_0x58ae[127],_0xcfe0x52[_0xcfe0x44][_0x58ae[196]](_0x58ae[1])[0][_0x58ae[23]]);var _0xcfe0x5d= new mxCell(_0xcfe0x5c);_0xcfe0x51[_0x58ae[194]][_0x58ae[187]](_0xcfe0x50,_0xcfe0x5d)}}};_0xcfe0x51[_0x58ae[197]](_0xcfe0x50);_0xcfe0x8[_0x58ae[76]]()}));_0xcfe0x34[_0x58ae[29]]=_0x58ae[101];var _0xcfe0x37=mxUtils[_0x58ae[77]](mxResources[_0x58ae[73]](_0x58ae[102]),function(){_0xcfe0x8[_0x58ae[76]]()});_0xcfe0x37[_0x58ae[29]]=_0x58ae[103];_0xcfe0x28[_0x58ae[25]](_0xcfe0x34);_0xcfe0x28[_0x58ae[25]](_0xcfe0x37);_0xcfe0x25[_0x58ae[25]](_0xcfe0x26);_0xcfe0x25[_0x58ae[25]](_0xcfe0x27);_0xcfe0x25[_0x58ae[25]](_0xcfe0x28);this[_0x58ae[61]]=_0xcfe0x25}function createDynamicInput(_0xcfe0x57,_0xcfe0x58,_0xcfe0x8){var _0xcfe0x55=_0xcfe0x8[_0x58ae[47]](_0x58ae[177]);var _0xcfe0x2c=_0xcfe0x8[_0x58ae[47]](_0x58ae[198]);var _0xcfe0x3e=_0xcfe0x8[_0x58ae[47]](_0x58ae[198]);var _0xcfe0x5f=_0xcfe0x8[_0x58ae[47]](_0x58ae[199]);var _0xcfe0x3=document[_0x58ae[2]](_0x58ae[1]);_0xcfe0x3[_0x58ae[5]](_0x58ae[182],_0x58ae[200]);_0xcfe0x3[_0x58ae[23]]=_0xcfe0x58;_0xcfe0x3[_0x58ae[29]]=_0x58ae[131];_0xcfe0x2c[_0x58ae[25]](_0xcfe0x3);var _0xcfe0x40=document[_0x58ae[2]](_0x58ae[19]);var _0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0x58ae[22];_0xcfe0xc[_0x58ae[23]]=_0x58ae[37];_0xcfe0x40[_0x58ae[25]](_0xcfe0xc);var _0xcfe0xd=[_0x58ae[21],_0x58ae[201],_0x58ae[80],_0x58ae[4]];_0xcfe0xd[_0x58ae[28]](function(_0xcfe0xe){_0xcfe0xc=document[_0x58ae[2]](_0x58ae[20]);_0xcfe0xc[_0x58ae[21]]=_0xcfe0xe;_0xcfe0xc[_0x58ae[23]]=_0xcfe0xe;_0xcfe0xc[_0x58ae[27]]=(_0xcfe0xe==_0xcfe0x57);_0xcfe0x40[_0x58ae[25]](_0xcfe0xc)});_0xcfe0x40[_0x58ae[29]]=_0x58ae[131];_0xcfe0x3e[_0x58ae[25]](_0xcfe0x40);var _0xcfe0x60=mxUtils[_0x58ae[77]](_0x58ae[202],function(){var _0xcfe0x61=_0xcfe0x60[_0x58ae[203]];var _0xcfe0x62=_0xcfe0x61[_0x58ae[203]];document[_0x58ae[192]](_0x58ae[175])[_0x58ae[64]](_0xcfe0x62)});_0xcfe0x60[_0x58ae[29]]=_0x58ae[204];_0xcfe0x5f[_0x58ae[25]](_0xcfe0x60);_0xcfe0x55[_0x58ae[25]](_0xcfe0x2c);_0xcfe0x55[_0x58ae[25]](_0xcfe0x3e);_0xcfe0x55[_0x58ae[25]](_0xcfe0x5f);return _0xcfe0x55} \ No newline at end of file +'use strict'; +/** + * $Id: Dialogs.js,v 1.5 2013-01-29 17:23:31 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new dialog. + */ + +function createCheckbox(value) { + var input = document.createElement('input'); + input.setAttribute('type', 'checkbox'); + if (value) { + input.setAttribute('checked', true); + } + return input; +} + +function createDropdownFromApi(path, value, option_name, option_value, editorUi, paginated) { + var req = new XMLHttpRequest(); + req.open('GET', path, false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + var input = document.createElement('select'); + var option = document.createElement('option'); + option.text = '-- None --'; + option.value = '0'; + input.appendChild(option); + var selectValues = paginated ? res.rows : res; + selectValues.forEach(function(elem) { + option = document.createElement('option'); + option.text = elem[option_name]; + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + input.appendChild(option); + }); + input.className = 'form-control select2'; + + return input; +} + +function createGroupedDropdownFromApi(path, value, option_name, option_value, editorUi, paginated, associationField) { + var req = new XMLHttpRequest(); + req.open('GET', path, false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + var input = document.createElement('select'); + var option = document.createElement('option'); + option.text = '-- None --'; + option.value = '0'; + input.appendChild(option); + var selectValues = paginated ? res.rows : res; + var mainFilter = {}; + var groupFilter = {}; + mainFilter[associationField] = null; + var mainValues = _.filter(selectValues, mainFilter); + var groupValues = {}; + mainValues.forEach(function(elem) { + option = document.createElement('option'); + option.className = 'select-group-father'; + option.text = elem[option_name].toUpperCase(); + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + input.appendChild(option); + groupFilter[associationField] = elem[option_value]; + groupValues = _.filter(selectValues, groupFilter); + groupValues.forEach(function(elem) { + option = document.createElement('option'); + option.className = 'select-group-son'; + option.text = '-' + _.capitalize(elem[option_name]); + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + input.appendChild(option); + }); + }) + input.className = 'form-control select2'; + + return input; +} + +function createDropdownFromArray(array, value) { + var input = document.createElement('select'); + + for (var item in array) { + var option = document.createElement('option'); + option.text = array[item]; + option.value = item; + if (value > 0 || value != '') + option.selected = (value === item) ? true : false; + + input.appendChild(option); + } + + input.className = 'form-control select2'; + + return input; +} + +function Dialog(editorUi, elt, w, h, modal, closable, onClose) { + var dx = 0; + + if (mxClient.IS_IE && document.documentMode != 9) { + dx = 60; + } + + w += dx; + h += dx; + + var left = Math.max(0, Math.round((document.body.scrollWidth - w) / 2)); + var top = Math.max(0, Math.round((Math.max(document.body.scrollHeight, + document.documentElement.scrollHeight) - h) / 3)); + + var div = editorUi.createDiv('geDialog'); + div.className = 'modal fade in center'; + div.style.display = 'block'; + div.style.paddingRight = '12px'; + // div.style.width = w + 'px'; + // div.style.height = h + 'px'; + // div.style.left = left + 'px'; + // div.style.top = top + 'px'; + + var divModalDialog = editorUi.createDiv('geModalDialog'); + divModalDialog.className = 'modal-dialog'; + divModalDialog.appendChild(elt); + div.appendChild(divModalDialog); + + if (this.bg == null) { + this.bg = editorUi.createDiv('background'); + this.bg.className = 'modal-backdrop fade in'; + + if (mxClient.IS_QUIRKS) { + new mxDivResizer(this.bg); + } + } + + if (modal) { + document.body.appendChild(this.bg); + } + + document.body.appendChild(div); + + this.onDialogClose = onClose; + this.container = div; +}; + +/** + * Removes the dialog from the DOM. + */ +Dialog.prototype.close = function() { + if (this.onDialogClose != null) { + this.onDialogClose(); + this.onDialogClose = null; + } + + this.container.parentNode.removeChild(this.container); + this.bg.parentNode.removeChild(this.bg); +}; + +/** + * Constructs a new open dialog. + */ +function ImportDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('import') + ' XML'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-12'); + + var textarea = document.createElement('textarea'); + textarea.style.width = '100%'; + textarea.style.height = '374px'; + + var input = document.createElement('input'); + input.type = 'file'; + input.setAttribute('accept', 'text/xml'); + + input.addEventListener('change', function readSingleFile(evt) { + //Retrieve the first (and only!) File from the FileList object + var f = evt.target.files[0]; + console.log(f); + if (f) { + if (f.type === 'text/xml') { + var r = new FileReader(); + r.onload = function(e) { + var contents = e.target.result; + mxUtils.write(textarea, contents); + }; + r.readAsText(f); + } else { + alert('Failed to load format file'); + } + } else { + alert('Failed to load file'); + } + }, false); + + col1.appendChild(input); + col1.appendChild(textarea); + + row.appendChild(col1); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('import'), mxUtils.bind(this, + function(data) { + var doc = mxUtils.parseXml(textarea.value); + editorUi.editor.setGraphXml(doc.documentElement); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + +}; + +/** + * Constructs a new about dialog. + */ +function AboutDialog(editorUi) { + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('about') + ' Cally Square'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var img = document.createElement('img'); + img.style.border = '0px'; + img.setAttribute('width', '176'); + img.setAttribute('width', '151'); + img.setAttribute('src', IMAGE_PATH + '/logo.png'); + body.appendChild(img); + mxUtils.br(body); + mxUtils.write(body, 'Powered by Xenialab ' + mxClient.VERSION); + mxUtils.br(body); + var link = document.createElement('a'); + link.setAttribute('href', 'http://www.callysquare.com/'); + link.setAttribute('target', '_blank'); + mxUtils.write(link, 'www.callysquare.com'); + body.appendChild(link); + mxUtils.br(body); + mxUtils.br(body); + //--- END BODY + + var close = mxUtils.button(mxResources.get('close'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Constructs a new save dialog. + */ +function SaveDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('saveAs')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', value + '_copy'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + editorUi.saveAs(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function NewDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('new')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', value + '_new'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('new'), function() { + editorUi.new(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function VariableDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('variable')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', 'variable name'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('new'), function() { + editorUi.variable(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function OpenDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('open')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get('name')); + col1.appendChild(label); + + var req = new XMLHttpRequest(); + req.open('GET', '/api/jscripty/projects', false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + + var select = document.createElement('select'); + + for (var j = 0; j < res.length; j++) { + var option = document.createElement('option'); + option.text = res[j].name; + option.value = res[j].id; + select.appendChild(option); + } + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('open'), function() { + console.log(select); + console.log(select.value); + window.open('jscripty/project/' + select.value, '_blank'); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new rename dialog. + */ +function RenameDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('rename')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get('name')); + col1.appendChild(label); + var name = editorUi.editor.filename; + var input = document.createElement('input'); + input.setAttribute('value', name); + input.className = 'form-control'; + + col2.appendChild(input); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + var req = new XMLHttpRequest(); + + req.open("PUT", SAVE_URL + editorUi.editor.data.id, true); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send('name=' + input.value); + + req.onload = function(e) { + if (req.status === 200) { + editorUi.editor.setStatus('Project successfully renamed'); + editorUi.editor.filename = input.value; + + } else { + editorUi.editor.setStatus(JSON.parse(req.response).errors[0].message) + } + } + req.onerror = function(e) { + mxUtils.alert(req.statusText); + }; + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; +/** + * Constructs a new edit file dialog. + */ +function EditFileDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('edit')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-12'); + + var textarea = document.createElement('textarea'); + textarea.style.width = '100%'; + textarea.style.height = '374px'; + textarea.value = mxUtils.getPrettyXml(editorUi.editor.getGraphXml()); + + // Enables dropping files + if (fileSupport) { + function handleDrop(evt) { + evt.stopPropagation(); + evt.preventDefault(); + + if (evt.dataTransfer.files.length > 0) { + var file = evt.dataTransfer.files[0]; + + var reader = new FileReader(); + reader.onload = function(e) { + textarea.value = e.target.result; + }; + reader.readAsText(file); + } + }; + + function handleDragOver(evt) { + evt.stopPropagation(); + evt.preventDefault(); + }; + + // Setup the dnd listeners. + textarea.addEventListener('dragover', handleDragOver, false); + textarea.addEventListener('drop', handleDrop, false); + } + col1.appendChild(textarea); + + row.appendChild(col1); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + var doc = mxUtils.parseXml(textarea.value); + editorUi.editor.setGraphXml(doc.documentElement); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Constructs a new export dialog. + */ +function ExportDialog(editorUi) { + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body form'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('export') + ' XML'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var form = editorUi.createDiv('form-horizontal form-row-seperated'); + var group = editorUi.createDiv('form-group last'); + + var label = document.createElement('label'); + label.className = 'col-sm-4 control-label'; + mxUtils.write(label, mxResources.get('filename')); + + var input = document.createElement('input'); + input.setAttribute('value', editorUi.editor.getOrCreateFilename()); + input.className = 'form-control'; + + var div = editorUi.createDiv('col-sm-8'); + div.appendChild(input); + + group.appendChild(label); + group.appendChild(div); + form.appendChild(group); + + body.appendChild(form); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('export'), mxUtils.bind(this, + function(data) { + editorUi.save(false); + + var xml = encodeURIComponent(mxUtils.getXml(editorUi.editor.getGraphXml())); + new mxXmlRequest(SAVE_URL + editorUi.editor.data.id + '/download', + 'filename=' + input.value, 'GET').simulate(document, "_blank"); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Giuseppe Careri + * Constructs a new general dialog. + */ + +function GeneralDialog(editorUi, cell) { + var graph = editorUi.editor.graph; + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body form modal-body-scroll'); + var footer = editorUi.createDiv('modal-footer'); + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('edit') + ' ' + mxResources.get(cell.value + .nodeName)); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var inputGroup = editorUi.createDiv('form-horizontal form-row-seperated'); + inputGroup.setAttribute('id', 'inputGroup'); + var length = cell.value.attributes.length; + var form = editorUi.createDiv('form-horizontal form-row-seperated'); + + for (var i = 0; i < length; i++) { + var name = cell.value.attributes[i].name; + var id = '_' + name; + var value = cell.value.attributes[i].value; + + var group = editorUi.createDiv((i == length - 1) ? 'form-group last' : + 'form-group'); + + var label = document.createElement('label'); + label.className = 'col-sm-4 control-label'; + mxUtils.write(label, mxResources.get(name)); + group.appendChild(label); + + var input; + + switch (name) { + + case 'Text': + input = document.createElement('textarea'); + input.innerHTML = value; + input.className = 'form-control'; + break; + case 'Body': + input = document.createElement('textarea'); + input.innerHTML = value; + input.className = 'form-control'; + break; + case 'question': + input = document.createElement('textarea'); + input.innerHTML = value; + input.className = 'form-control'; + + break; + case 'other': + input = document.createElement('input'); + input.setAttribute('value', value); + input.setAttribute('placeholder', 'Insert label for "Other" answer option'); + input.className = 'form-control'; + break; + // case 'addtext': + // var input = document.createElement('input'); + // input.setAttribute('type', 'checkbox'); + // console.log('value', value); + // if (value == 'true') { + // input.setAttribute('checked', true); + // + // } else { + // input.removeAttribute("checked"); + // + // } + // // input.value = input.checked; + // + // input.onclick = function() { + // this.value = this.checked; + // + // console.log(input); + // if (this.checked) { + // console.log(this.checked); + // var rowdiv = editorUi.createDiv('form-group'); + // rowdiv.setAttribute('id', 'rowdiv'); + // var col1 = editorUi.createDiv('col-md-4'); + // var col2 = editorUi.createDiv('col-md-8'); + // var label = document.createElement('label'); + // // input.setAttribute('placeholder', 'Insert label'); + // label.className = 'pull-right control-label'; + // mxUtils.write(label, 'Texarea Label'); + // col1.appendChild(label); + // var input = document.createElement('input'); + // // input.setAttribute('placeholder', 'Insert label'); + // // input.value = inputValue; + // input.className = 'form-control'; + // col2.appendChild(input); + // rowdiv.appendChild(col1); + // rowdiv.appendChild(col2); + // inputGroup.appendChild(rowdiv); + // body.appendChild(inputGroup); + // } else { + // console.log(this.checked); + // document.getElementById('inputGroup').removeChild(document.getElementById('rowdiv')); + // } + // }; + // + // + // input.className = 'btn green'; + // break; + case 'add': + var input = mxUtils.button('+', function() { + var rowdiv = createDynamicInput(null, null, editorUi); + inputGroup.appendChild(rowdiv); + body.appendChild(inputGroup); + }) + + input.className = 'btn green'; + break; + default: + input = document.createElement('input'); + input.setAttribute('value', value); + input.className = 'form-control'; + break; + } + + input.setAttribute('id', id) + var div = editorUi.createDiv('col-sm-8'); + div.appendChild(input); + // Help + if (mxResources.get('help_' + name)) { + var help = editorUi.createDiv('p'); + help.className = 'help-block'; + mxUtils.write(help, mxResources.get('help_' + name)); + div.appendChild(help); + } + + group.appendChild(div); + form.appendChild(group); + } + body.appendChild(form); + // console.log(cell); + if (cell.value.nodeName == 'input') { + + if (cell.children) { + for (var j = 0; j < cell.children.length; j++) { + var selectValue = ''; + var inputValue = ''; + _.forEach(cell.children[j].value.attributes, function(element) { + // console.log(element); + if (element.name == 'type') { + selectValue = element.value; + + } else if (element.name == 'label') { + inputValue = element.value; + + } + }) + var rowdiv = createDynamicInput(selectValue, inputValue, editorUi); + inputGroup.appendChild(rowdiv); + + } + } + + } + body.appendChild(inputGroup); + + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), mxUtils.bind(this, + function(data) { + for (var i = 0; i < cell.value.attributes.length; i++) { + var id = '_' + cell.value.attributes[i].name; + var name = cell.value.attributes[i].name; + console.log(name); + + cell.setAttribute(name, document.getElementById(id).value); + console.log(document.getElementById(id).value); + + + }; + + if (cell.value.nodeName == 'input') { + if (graph.model.getChildCount(cell)) { + cell.children = []; + } + if (document.getElementById('inputGroup')) { + var inputGroup = document.getElementById('inputGroup').children; + for (var j = 0; j < inputGroup.length; j++) { + + var divSelect = inputGroup[j].children[1]; + var divInput = inputGroup[j].children[0]; + var doc = mxUtils.createXmlDocument(); + var node = doc.createElement('inputGroup'); + node.setAttribute('type', inputGroup[j].getElementsByTagName('select')[0].value); + node.setAttribute('label', inputGroup[j].getElementsByTagName('input')[0].value); + var cells = new mxCell(node); + graph.model.add(cell, cells); + } + } + } + + graph.refresh(cell); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + + + +function createDynamicInput(selectValue, inputValue, editorUi) { + + var rowdiv = editorUi.createDiv('form-group'); + var col1 = editorUi.createDiv('col-md-5'); + var col2 = editorUi.createDiv('col-md-5'); + var col3 = editorUi.createDiv('col-md-2'); + + var input = document.createElement('input'); + input.setAttribute('placeholder', 'Insert label'); + input.value = inputValue; + input.className = 'form-control'; + col1.appendChild(input); + + var select = document.createElement('select'); + var option = document.createElement('option'); + option.text = '-- None --'; + option.value = ''; + select.appendChild(option); + + var selectValues = ['text', 'number', 'textarea', 'checkbox']; + selectValues.forEach(function(elem) { + option = document.createElement('option'); + option.text = elem; + option.value = elem; + option.selected = (elem == selectValue); + select.appendChild(option); + }) + select.className = 'form-control'; + col2.appendChild(select); + var button = mxUtils.button('x', function() { + var buttonParent = button.parentElement; + var divParent = buttonParent.parentElement; + document.getElementById('inputGroup').removeChild(divParent); + }) + + button.className = 'btn red'; + col3.appendChild(button); + rowdiv.appendChild(col1); + rowdiv.appendChild(col2); + rowdiv.appendChild(col3); + return rowdiv; + + +} diff --git a/public/assets/plugins/jscripty/js/Editor.js b/public/assets/plugins/jscripty/js/Editor.js index d69ea21..9858989 100644 --- a/public/assets/plugins/jscripty/js/Editor.js +++ b/public/assets/plugins/jscripty/js/Editor.js @@ -1 +1,888 @@ -var _0xa55e=["\x49\x53\x5F\x54\x4F\x55\x43\x48","\x73\x74\x6F\x72\x61\x67\x65","\x6C\x6F\x63\x61\x6C","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x46\x69\x6C\x65","\x46\x69\x6C\x65\x52\x65\x61\x64\x65\x72","\x46\x69\x6C\x65\x4C\x69\x73\x74","\x74\x6F\x75\x63\x68","\x31","\x6F\x70\x65\x6E\x65\x72","\x63\x6F\x75\x6E\x74\x65\x72","\x63\x61\x6C\x6C","\x69\x6E\x69\x74","\x69\x6E\x69\x74\x53\x74\x65\x6E\x63\x69\x6C\x52\x65\x67\x69\x73\x74\x72\x79","\x67\x72\x61\x70\x68","\x6F\x75\x74\x6C\x69\x6E\x65","\x75\x70\x64\x61\x74\x65\x4F\x6E\x50\x61\x6E","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x63\x72\x65\x61\x74\x65\x55\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x73\x74\x61\x74\x75\x73","","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x64\x72\x61\x77\x69\x6E\x67","\x67\x65\x74","\x2E\x78\x6D\x6C","\x67\x65\x74\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x6D\x6F\x64\x69\x66\x69\x65\x64","\x67\x72\x61\x70\x68\x43\x68\x61\x6E\x67\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x61\x70\x70\x6C\x79","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x6F\x6E\x62\x65\x66\x6F\x72\x65\x75\x6E\x6C\x6F\x61\x64","\x61\x6C\x6C\x43\x68\x61\x6E\x67\x65\x73\x4C\x6F\x73\x74","\x72\x65\x73\x65\x74\x56\x69\x65\x77\x4F\x6E\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x73\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x65\x78\x74\x65\x6E\x64","\x67\x72\x69\x64\x49\x6D\x61\x67\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x2F\x67\x72\x69\x64\x2E\x67\x69\x66","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x49\x6D\x61\x67\x65","\x2F\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x2E\x67\x69\x66","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x6D\x78\x47\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C","\x73\x63\x61\x6C\x65","\x76\x69\x65\x77","\x67\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x69\x64","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x30","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x67\x75\x69\x64\x65\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x63\x6F\x6E\x6E\x65\x63\x74","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x66\x6F\x6C\x64","\x73\x63\x72\x6F\x6C\x6C\x4C\x65\x66\x74","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x78","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65","\x64\x78","\x79","\x64\x79","\x70\x61\x67\x65\x56\x69\x73\x69\x62\x6C\x65","\x70\x61\x67\x65","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x73\x56\x69\x73\x69\x62\x6C\x65","\x70\x72\x65\x66\x65\x72\x50\x61\x67\x65\x53\x69\x7A\x65","\x70\x61\x67\x65\x53\x63\x61\x6C\x65","\x70\x61\x67\x65\x57\x69\x64\x74\x68","\x70\x61\x67\x65\x48\x65\x69\x67\x68\x74","\x70\x61\x67\x65\x46\x6F\x72\x6D\x61\x74","\x6C\x65\x6E\x67\x74\x68","\x64\x65\x63\x6F\x64\x65","\x75\x70\x64\x61\x74\x65\x47\x72\x61\x70\x68\x43\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x65\x6E\x63\x6F\x64\x65","\x72\x6F\x75\x6E\x64","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x6E\x6F\x6E\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x73\x74\x79\x6C\x65","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x66\x69\x6C\x6C","\x72\x65\x63\x6F\x6E\x66\x69\x67\x75\x72\x65","\x23\x65\x62\x65\x62\x65\x62","\x62\x6F\x72\x64\x65\x72\x53\x74\x79\x6C\x65","\x73\x6F\x6C\x69\x64","\x62\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x23\x65\x35\x65\x35\x65\x35","\x62\x6F\x72\x64\x65\x72\x54\x6F\x70\x57\x69\x64\x74\x68","\x31\x70\x78","\x62\x6F\x72\x64\x65\x72\x4C\x65\x66\x74\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72\x52\x69\x67\x68\x74\x57\x69\x64\x74\x68","\x30\x70\x78","\x62\x6F\x72\x64\x65\x72\x42\x6F\x74\x74\x6F\x6D\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72","\x76\x61\x6C\x69\x64\x61\x74\x65","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x68\x69\x64\x64\x65\x6E","\x61\x75\x74\x6F","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x75\x72\x6C\x28","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x6E\x6F\x64\x65","\x49\x53\x5F\x49\x45\x36","\x73\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x2F\x67\x72\x61\x70\x68\x65\x64\x69\x74\x6F\x72\x2D\x69\x65\x36\x2E\x63\x73\x73","\x6C\x69\x6E\x6B","\x6C\x6F\x61\x64\x44\x65\x66\x61\x75\x6C\x74\x42\x75\x6E\x64\x6C\x65","\x61\x64\x64","\x44\x45\x46\x41\x55\x4C\x54\x5F\x48\x4F\x54\x53\x50\x4F\x54","\x63\x72\x65\x61\x74\x65\x4D\x61\x72\x6B\x65\x72","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x73","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6E\x67","\x53\x48\x41\x44\x4F\x57\x43\x4F\x4C\x4F\x52","\x23\x64\x30\x64\x30\x64\x30","\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x23\x39\x39\x63\x63\x66\x66","\x48\x41\x4E\x44\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x43\x4F\x4C\x4F\x52","\x23\x30\x30\x38\x38\x63\x66","\x56\x45\x52\x54\x45\x58\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x23\x30\x30\x61\x38\x66\x66","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x43\x4F\x4C\x4F\x52","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x43\x4F\x4C\x4F\x52","\x43\x4F\x4E\x4E\x45\x43\x54\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x23\x63\x65\x65\x37\x66\x66","\x45\x44\x47\x45\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x44\x45\x46\x41\x55\x4C\x54\x5F\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x47\x55\x49\x44\x45\x5F\x43\x4F\x4C\x4F\x52","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x43\x6F\x6C\x6F\x72","\x23\x63\x30\x63\x30\x63\x30","\x64\x65\x66\x61\x75\x6C\x74\x4F\x70\x61\x63\x69\x74\x79","\x63\x72\x65\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x77\x68\x69\x74\x65","\x23\x63\x61\x63\x61\x63\x61","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x6D\x69\x6E","\x66\x6C\x6F\x6F\x72","\x6D\x61\x78","\x63\x65\x69\x6C","\x70\x61\x6E\x47\x72\x61\x70\x68","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x75\x73\x65\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x68\x61\x73\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x6D\x61\x72\x67\x69\x6E\x4C\x65\x66\x74","\x70\x78","\x6D\x61\x72\x67\x69\x6E\x54\x6F\x70","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x69\x6D\x61\x67\x65","\x73\x72\x63","\x64\x65\x73\x74\x72\x6F\x79","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x6E\x65","\x72\x65\x64\x72\x61\x77","\x72\x65\x64\x72\x61\x77\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x69\x73\x53\x68\x61\x64\x6F\x77","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x54\x52\x49\x43\x54\x48\x54\x4D\x4C","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x69\x6E\x73\x65\x72\x74\x42\x65\x66\x6F\x72\x65","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x2D\x31\x70\x78\x20\x2D\x31\x70\x78","\x64\x62\x6C\x63\x6C\x69\x63\x6B","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x69\x73\x48\x69\x64\x65\x4F\x6E\x48\x6F\x76\x65\x72","\x68\x69\x64\x65","\x69\x73\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x62\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x6D\x69\x6E\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x69\x73\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x70\x6F\x69\x6E\x74\x73","\x69\x73\x44\x61\x73\x68\x65\x64","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x61\x73\x68\x65\x64","\x61\x64\x64\x50\x69\x70\x65","\x73\x70\x6C\x69\x63\x65","\x76\x65\x72\x74\x69\x63\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x73\x6E\x61\x70\x54\x6F\x54\x65\x72\x6D\x69\x6E\x61\x6C\x73","\x73\x68\x6F\x75\x6C\x64\x52\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x69\x73\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x43\x65\x6C\x6C\x47\x65\x6F\x6D\x65\x74\x72\x79","\x72\x65\x6C\x61\x74\x69\x76\x65","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x41\x6C\x74\x44\x6F\x77\x6E","\x61\x64\x64\x49\x74\x65\x6D","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x63\x6F\x6E\x73\x75\x6D\x65","\x67\x65\x74\x49\x6E\x69\x74\x69\x61\x6C\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x69\x73\x44\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x44\x65\x6C\x61\x79\x65\x64","\x67\x65\x74\x43\x65\x6C\x6C","\x63\x65\x6C\x6C","\x67\x65\x74\x45\x76\x65\x6E\x74","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x43\x65\x6C\x6C\x46\x6F\x72\x50\x6F\x70\x75\x70\x45\x76\x65\x6E\x74","\x65\x64\x69\x74","\x67\x65\x74\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x6E\x64\x6F\x61\x62\x6C\x65\x45\x64\x69\x74\x48\x61\x70\x70\x65\x6E\x65\x64","\x67\x65\x74\x56\x69\x65\x77","\x63\x68\x61\x6E\x67\x65\x73","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65\x73","\x67\x65\x74\x53\x74\x61\x74\x65","\x70\x75\x73\x68","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x2F\x67\x65\x6E\x65\x72\x61\x6C\x2E\x78\x6D\x6C","\x6C\x6F\x61\x64\x53\x74\x65\x6E\x63\x69\x6C\x53\x65\x74","\x6C\x69\x62\x72\x61\x72\x69\x65\x73","\x70\x61\x63\x6B\x61\x67\x65\x73","\x67\x65\x74\x53\x74\x65\x6E\x63\x69\x6C","\x73\x74\x65\x6E\x63\x69\x6C\x73","\x67\x65\x74\x42\x61\x73\x65\x6E\x61\x6D\x65\x46\x6F\x72\x53\x74\x65\x6E\x63\x69\x6C","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x2E\x6A\x73","\x6C\x6F\x61\x64","\x67\x65\x74\x54\x65\x78\x74","\x2F","\x2E","\x73\x70\x6C\x69\x74","\x6D\x78\x67\x72\x61\x70\x68","\x67\x65\x74\x58\x6D\x6C","\x70\x61\x72\x73\x65\x53\x74\x65\x6E\x63\x69\x6C\x53\x65\x74","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x6E\x61\x6D\x65","\x6E\x6F\x64\x65\x54\x79\x70\x65","\x4E\x4F\x44\x45\x54\x59\x50\x45\x5F\x45\x4C\x45\x4D\x45\x4E\x54","\x5F","\x72\x65\x70\x6C\x61\x63\x65","\x61\x64\x64\x53\x74\x65\x6E\x63\x69\x6C","\x77","\x68","\x6E\x65\x78\x74\x53\x69\x62\x6C\x69\x6E\x67","\x70\x72\x6F\x64\x75\x63\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65\x72","\x64\x6F\x6E\x65","\x73\x65\x74\x43\x6F\x6E\x73\x75\x6D\x65\x72","\x65\x78\x65\x63\x75\x74\x65","\x73\x65\x74\x44\x61\x74\x61","\x64\x61\x74\x61","\x65\x72\x72\x6F\x72","\x63\x61\x6E\x63\x65\x6C","\x61\x6C\x65\x72\x74"];var useLocalStorage=(mxClient[_0xa55e[0]]||urlParams[_0xa55e[1]]==_0xa55e[2])&& typeof (localStorage)!=_0xa55e[3];var fileSupport=window[_0xa55e[4]]!=null&&window[_0xa55e[5]]!=null&&window[_0xa55e[6]]!=null;var touchStyle=mxClient[_0xa55e[0]]||urlParams[_0xa55e[7]]==_0xa55e[8];var counter=0;try{var op=window;while(op[_0xa55e[9]]!=null&&!isNaN(op[_0xa55e[9]][_0xa55e[10]])){op=op[_0xa55e[9]]};if(op!=null){op[_0xa55e[10]]++;counter=op[_0xa55e[10]]}}catch(e){};Editor=function(){mxEventSource[_0xa55e[11]](this);this[_0xa55e[12]]();this[_0xa55e[13]]();this[_0xa55e[14]]= new Graph();this[_0xa55e[15]]= new mxOutline(this[_0xa55e[14]]);this[_0xa55e[15]][_0xa55e[16]]=true;this[_0xa55e[17]]=this[_0xa55e[18]]();this[_0xa55e[19]]=_0xa55e[20];this[_0xa55e[21]]=null;this[_0xa55e[22]]=function(){return this[_0xa55e[21]]||mxResources[_0xa55e[24]](_0xa55e[23],[counter])+_0xa55e[25]};this[_0xa55e[26]]=function(){return this[_0xa55e[21]]};this[_0xa55e[27]]=function(_0x3b7cx6){this[_0xa55e[19]]=_0x3b7cx6;this[_0xa55e[29]]( new mxEventObject(_0xa55e[28]))};this[_0xa55e[30]]=function(){return this[_0xa55e[19]]};this[_0xa55e[31]]=false;this[_0xa55e[32]]=function(){this[_0xa55e[31]]=true};this[_0xa55e[14]][_0xa55e[36]]()[_0xa55e[35]](mxEvent.CHANGE,mxUtils[_0xa55e[34]](this,function(){this[_0xa55e[32]][_0xa55e[33]](this,arguments)}));window[_0xa55e[37]]=mxUtils[_0xa55e[34]](this,function(){if(this[_0xa55e[31]]){return mxResources[_0xa55e[24]](_0xa55e[38])}});this[_0xa55e[14]][_0xa55e[39]]=false;this[_0xa55e[14]][_0xa55e[40]]=true;this[_0xa55e[14]][_0xa55e[41]]=null};mxUtils[_0xa55e[42]](Editor,mxEventSource);Editor[_0xa55e[44]][_0xa55e[43]]=IMAGE_PATH+_0xa55e[45];Editor[_0xa55e[44]][_0xa55e[46]]=IMAGE_PATH+_0xa55e[47];Editor[_0xa55e[44]][_0xa55e[48]]=function(_0x3b7cx7){var _0x3b7cx8= new mxCodec(_0x3b7cx7[_0xa55e[49]]);if(_0x3b7cx7[_0xa55e[50]]==_0xa55e[51]){this[_0xa55e[14]][_0xa55e[53]][_0xa55e[52]]=1;this[_0xa55e[14]][_0xa55e[54]]=_0x3b7cx7[_0xa55e[56]](_0xa55e[55])!=_0xa55e[57];this[_0xa55e[14]][_0xa55e[59]][_0xa55e[58]]=_0x3b7cx7[_0xa55e[56]](_0xa55e[60])!=_0xa55e[57];this[_0xa55e[14]][_0xa55e[62]](_0x3b7cx7[_0xa55e[56]](_0xa55e[61])!=_0xa55e[57]);this[_0xa55e[14]][_0xa55e[64]](_0x3b7cx7[_0xa55e[56]](_0xa55e[63])!=_0xa55e[57]);this[_0xa55e[14]][_0xa55e[65]]=_0x3b7cx7[_0xa55e[56]](_0xa55e[66])!=_0xa55e[57];this[_0xa55e[14]][_0xa55e[40]]=_0x3b7cx7[_0xa55e[56]](_0xa55e[40])!=_0xa55e[57];if(!this[_0xa55e[14]][_0xa55e[40]]){this[_0xa55e[14]][_0xa55e[68]][_0xa55e[67]]=0;this[_0xa55e[14]][_0xa55e[68]][_0xa55e[69]]=0;this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[70]]=Number(_0x3b7cx7[_0xa55e[56]](_0xa55e[72])||0);this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[73]]=Number(_0x3b7cx7[_0xa55e[56]](_0xa55e[74])||0)};this[_0xa55e[14]][_0xa55e[75]]=_0x3b7cx7[_0xa55e[56]](_0xa55e[76])==_0xa55e[8];this[_0xa55e[14]][_0xa55e[77]]=this[_0xa55e[14]][_0xa55e[75]];this[_0xa55e[14]][_0xa55e[78]]=this[_0xa55e[14]][_0xa55e[77]];var _0x3b7cx9=_0x3b7cx7[_0xa55e[56]](_0xa55e[79]);if(_0x3b7cx9!=null){this[_0xa55e[14]][_0xa55e[79]]=_0x3b7cx9}else {this[_0xa55e[14]][_0xa55e[79]]=1.5};var _0x3b7cxa=_0x3b7cx7[_0xa55e[56]](_0xa55e[80]);var _0x3b7cxb=_0x3b7cx7[_0xa55e[56]](_0xa55e[81]);if(_0x3b7cxa!=null&&_0x3b7cxb!=null){this[_0xa55e[14]][_0xa55e[82]]= new mxRectangle(0,0,parseFloat(_0x3b7cxa),parseFloat(_0x3b7cxb));this[_0xa55e[15]][_0xa55e[15]][_0xa55e[82]]=this[_0xa55e[14]][_0xa55e[82]]};var _0x3b7cxc=_0x3b7cx7[_0xa55e[56]](_0xa55e[41]);if(_0x3b7cxc!=null&&_0x3b7cxc[_0xa55e[83]]>0){this[_0xa55e[14]][_0xa55e[41]]=_0x3b7cxc};_0x3b7cx8[_0xa55e[84]](_0x3b7cx7,this[_0xa55e[14]][_0xa55e[36]]());this[_0xa55e[85]]()}};Editor[_0xa55e[44]][_0xa55e[86]]=function(){var _0x3b7cxd= new mxCodec(mxUtils[_0xa55e[87]]());var _0x3b7cx7=_0x3b7cxd[_0xa55e[88]](this[_0xa55e[14]][_0xa55e[36]]());if(this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[70]]!=0||this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[73]]!=0){_0x3b7cx7[_0xa55e[90]](_0xa55e[72],Math[_0xa55e[89]](this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[70]]*100)/100);_0x3b7cx7[_0xa55e[90]](_0xa55e[74],Math[_0xa55e[89]](this[_0xa55e[14]][_0xa55e[53]][_0xa55e[71]][_0xa55e[73]]*100)/100)};_0x3b7cx7[_0xa55e[90]](_0xa55e[55],(this[_0xa55e[14]][_0xa55e[91]]())?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[60],(this[_0xa55e[14]][_0xa55e[59]][_0xa55e[58]])?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[60],(this[_0xa55e[14]][_0xa55e[59]][_0xa55e[58]])?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[61],(this[_0xa55e[14]][_0xa55e[93]][_0xa55e[92]]())?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[63],(this[_0xa55e[14]][_0xa55e[94]][_0xa55e[92]]())?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[66],(this[_0xa55e[14]][_0xa55e[65]])?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[76],(this[_0xa55e[14]][_0xa55e[75]])?_0xa55e[8]:_0xa55e[57]);_0x3b7cx7[_0xa55e[90]](_0xa55e[79],this[_0xa55e[14]][_0xa55e[79]]);_0x3b7cx7[_0xa55e[90]](_0xa55e[80],this[_0xa55e[14]][_0xa55e[82]][_0xa55e[95]]);_0x3b7cx7[_0xa55e[90]](_0xa55e[81],this[_0xa55e[14]][_0xa55e[82]][_0xa55e[96]]);if(!this[_0xa55e[14]][_0xa55e[40]]){_0x3b7cx7[_0xa55e[90]](_0xa55e[40],_0xa55e[57])};if(this[_0xa55e[14]][_0xa55e[41]]!=null){_0x3b7cx7[_0xa55e[90]](_0xa55e[41],this[_0xa55e[14]][_0xa55e[41]])};return _0x3b7cx7};Editor[_0xa55e[44]][_0xa55e[85]]=function(){var _0x3b7cxe=this[_0xa55e[14]];var _0x3b7cxf=this[_0xa55e[15]];if(_0x3b7cxe[_0xa55e[68]]!=null&&_0x3b7cxf[_0xa55e[15]][_0xa55e[68]]!=null){if(_0x3b7cxe[_0xa55e[41]]!=null){if(_0x3b7cxe[_0xa55e[41]]==_0xa55e[97]){_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[98]]=_0xa55e[100]}else {if(_0x3b7cxe[_0xa55e[53]][_0xa55e[101]]!=null){_0x3b7cxe[_0xa55e[53]][_0xa55e[101]][_0xa55e[102]]=_0x3b7cxe[_0xa55e[41]];_0x3b7cxe[_0xa55e[53]][_0xa55e[101]][_0xa55e[103]]()};_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[98]]=_0x3b7cxe[_0xa55e[41]]}}else {_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[98]]=_0xa55e[20]};if(_0x3b7cxe[_0xa55e[75]]){_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[98]]=_0xa55e[104];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[105]]=_0xa55e[106];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[107]]=_0xa55e[108];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[109]]=_0xa55e[110];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[111]]=_0xa55e[110];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[112]]=_0xa55e[113];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[114]]=_0xa55e[113]}else {_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[115]]=_0xa55e[20]};_0x3b7cxf[_0xa55e[15]][_0xa55e[68]][_0xa55e[99]][_0xa55e[98]]=_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[98]];if(_0x3b7cxf[_0xa55e[15]][_0xa55e[75]]!=_0x3b7cxe[_0xa55e[75]]||_0x3b7cxf[_0xa55e[15]][_0xa55e[79]]!=_0x3b7cxe[_0xa55e[79]]){_0x3b7cxf[_0xa55e[15]][_0xa55e[79]]=_0x3b7cxe[_0xa55e[79]];_0x3b7cxf[_0xa55e[15]][_0xa55e[75]]=_0x3b7cxe[_0xa55e[75]];_0x3b7cxf[_0xa55e[15]][_0xa55e[53]][_0xa55e[116]]()};if(_0x3b7cxe[_0xa55e[40]]&&_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[117]]==_0xa55e[118]&& !touchStyle){_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[117]]=_0xa55e[119]}else {if(!_0x3b7cxe[_0xa55e[40]]||touchStyle){_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[117]]=_0xa55e[118]}};var _0x3b7cx10=(mxClient[_0xa55e[120]]&&document[_0xa55e[121]]>=9)?_0xa55e[122]+this[_0xa55e[46]]+_0xa55e[123]:_0xa55e[97];_0x3b7cxe[_0xa55e[68]][_0xa55e[99]][_0xa55e[124]]=(!_0x3b7cxe[_0xa55e[75]]&&_0x3b7cxe[_0xa55e[91]]())?_0xa55e[122]+this[_0xa55e[43]]+_0xa55e[123]:_0x3b7cx10;if(_0x3b7cxe[_0xa55e[53]][_0xa55e[101]]!=null){_0x3b7cxe[_0xa55e[53]][_0xa55e[101]][_0xa55e[125]][_0xa55e[99]][_0xa55e[124]]=(this[_0xa55e[14]][_0xa55e[91]]())?_0xa55e[122]+this[_0xa55e[43]]+_0xa55e[123]:_0xa55e[97]}}};Editor[_0xa55e[44]][_0xa55e[12]]=function(){if(mxClient[_0xa55e[126]]){mxClient[_0xa55e[129]](_0xa55e[127],CSS_PATH+_0xa55e[128])};mxResources[_0xa55e[130]]=false;mxResources[_0xa55e[131]](RESOURCE_BASE);mxConstants[_0xa55e[132]]=0.3;var _0x3b7cx11=mxConnectionHandler[_0xa55e[44]][_0xa55e[133]];mxConnectionHandler[_0xa55e[44]][_0xa55e[133]]=function(){var _0x3b7cx12=_0x3b7cx11[_0xa55e[33]](this,arguments);_0x3b7cx12[_0xa55e[134]]=mxUtils[_0xa55e[34]](this,function(_0x3b7cx13,_0x3b7cx14){if(this[_0xa55e[135]]()){return true};return mxCellMarker[_0xa55e[44]][_0xa55e[134]][_0xa55e[33]](_0x3b7cx12,arguments)});return _0x3b7cx12};mxConstants[_0xa55e[136]]=_0xa55e[137];mxConstants[_0xa55e[138]]=_0xa55e[139];mxConstants[_0xa55e[140]]=_0xa55e[141];mxConstants[_0xa55e[142]]=_0xa55e[143];mxConstants[_0xa55e[144]]=_0xa55e[143];mxConstants[_0xa55e[145]]=_0xa55e[139];mxConstants[_0xa55e[146]]=_0xa55e[143];mxConstants[_0xa55e[147]]=_0xa55e[148];mxConstants[_0xa55e[149]]=_0xa55e[143];mxConstants[_0xa55e[150]]=_0xa55e[143];mxConstants[_0xa55e[151]]=_0xa55e[148];mxConstants[_0xa55e[152]]=_0xa55e[141];mxGraph[_0xa55e[44]][_0xa55e[153]]=_0xa55e[154];mxGraph[_0xa55e[44]][_0xa55e[79]]=1;mxRubberband[_0xa55e[44]][_0xa55e[155]]=30;mxGraphView[_0xa55e[44]][_0xa55e[156]]=function(_0x3b7cx15){return new mxRectangleShape(_0x3b7cx15,this[_0xa55e[14]][_0xa55e[41]]||_0xa55e[157],_0xa55e[158])};mxGraphView[_0xa55e[44]][_0xa55e[159]]=function(){var _0x3b7cx16=this[_0xa55e[160]]();var _0x3b7cx17=(_0x3b7cx16[_0xa55e[95]]>0)?_0x3b7cx16[_0xa55e[70]]/this[_0xa55e[52]]-this[_0xa55e[71]][_0xa55e[70]]:0;var _0x3b7cx18=(_0x3b7cx16[_0xa55e[96]]>0)?_0x3b7cx16[_0xa55e[73]]/this[_0xa55e[52]]-this[_0xa55e[71]][_0xa55e[73]]:0;var _0x3b7cx19=_0x3b7cx16[_0xa55e[95]]/this[_0xa55e[52]];var _0x3b7cx1a=_0x3b7cx16[_0xa55e[96]]/this[_0xa55e[52]];var _0x3b7cx1b=this[_0xa55e[14]][_0xa55e[82]];var _0x3b7cx9=this[_0xa55e[14]][_0xa55e[79]];var _0x3b7cxa=_0x3b7cx1b[_0xa55e[95]]*_0x3b7cx9;var _0x3b7cxb=_0x3b7cx1b[_0xa55e[96]]*_0x3b7cx9;var _0x3b7cx1c=Math[_0xa55e[162]](Math[_0xa55e[161]](0,_0x3b7cx17)/_0x3b7cxa);var _0x3b7cx1d=Math[_0xa55e[162]](Math[_0xa55e[161]](0,_0x3b7cx18)/_0x3b7cxb);var _0x3b7cx1e=Math[_0xa55e[164]](Math[_0xa55e[163]](1,_0x3b7cx17+_0x3b7cx19)/_0x3b7cxa);var _0x3b7cx1f=Math[_0xa55e[164]](Math[_0xa55e[163]](1,_0x3b7cx18+_0x3b7cx1a)/_0x3b7cxb);var _0x3b7cx20=_0x3b7cx1e-_0x3b7cx1c;var _0x3b7cx21=_0x3b7cx1f-_0x3b7cx1d;var _0x3b7cx15= new mxRectangle(this[_0xa55e[52]]*(this[_0xa55e[71]][_0xa55e[70]]+_0x3b7cx1c*_0x3b7cxa),this[_0xa55e[52]]*(this[_0xa55e[71]][_0xa55e[73]]+_0x3b7cx1d*_0x3b7cxb),this[_0xa55e[52]]*_0x3b7cx20*_0x3b7cxa,this[_0xa55e[52]]*_0x3b7cx21*_0x3b7cxb);return _0x3b7cx15};var _0x3b7cx22=mxGraph[_0xa55e[44]][_0xa55e[165]];mxGraph[_0xa55e[44]][_0xa55e[165]]=function(_0x3b7cx23,_0x3b7cx24){_0x3b7cx22[_0xa55e[33]](this,arguments);if((this[_0xa55e[166]]!=mxConstants[_0xa55e[167]]&&this[_0xa55e[53]][_0xa55e[101]]!=null)&&(!this[_0xa55e[168]]||!mxUtils[_0xa55e[169]](this[_0xa55e[68]]))){this[_0xa55e[53]][_0xa55e[101]][_0xa55e[125]][_0xa55e[99]][_0xa55e[170]]=_0x3b7cx23+_0xa55e[171];this[_0xa55e[53]][_0xa55e[101]][_0xa55e[125]][_0xa55e[99]][_0xa55e[172]]=_0x3b7cx24+_0xa55e[171]}};var _0x3b7cx25=this;mxGraphView[_0xa55e[44]][_0xa55e[173]]=function(){var _0x3b7cxc=this[_0xa55e[14]][_0xa55e[174]]();if(_0x3b7cxc!=null){if(this[_0xa55e[124]]==null||this[_0xa55e[124]][_0xa55e[175]]!=_0x3b7cxc[_0xa55e[176]]){if(this[_0xa55e[124]]!=null){this[_0xa55e[124]][_0xa55e[177]]()};var _0x3b7cx15= new mxRectangle(0,0,1,1);this[_0xa55e[124]]= new mxImageShape(_0x3b7cx15,_0x3b7cxc[_0xa55e[176]]);this[_0xa55e[124]][_0xa55e[166]]=this[_0xa55e[14]][_0xa55e[166]];this[_0xa55e[124]][_0xa55e[12]](this[_0xa55e[178]]);this[_0xa55e[124]][_0xa55e[179]]()};this[_0xa55e[180]](this[_0xa55e[124]],_0x3b7cxc)}else {if(this[_0xa55e[124]]!=null){this[_0xa55e[124]][_0xa55e[177]]();this[_0xa55e[124]]=null}};if(this[_0xa55e[14]][_0xa55e[75]]){var _0x3b7cx15=this[_0xa55e[159]]();if(this[_0xa55e[101]]==null){this[_0xa55e[101]]=this[_0xa55e[156]](_0x3b7cx15);this[_0xa55e[101]][_0xa55e[52]]=1;this[_0xa55e[101]][_0xa55e[181]]=true;this[_0xa55e[101]][_0xa55e[166]]=mxConstants[_0xa55e[182]];this[_0xa55e[101]][_0xa55e[12]](this[_0xa55e[14]][_0xa55e[68]]);this[_0xa55e[14]][_0xa55e[68]][_0xa55e[184]][_0xa55e[99]][_0xa55e[183]]=_0xa55e[185];this[_0xa55e[14]][_0xa55e[68]][_0xa55e[186]](this[_0xa55e[101]][_0xa55e[125]],this[_0xa55e[14]][_0xa55e[68]][_0xa55e[184]]);this[_0xa55e[101]][_0xa55e[179]]();this[_0xa55e[101]][_0xa55e[125]][_0xa55e[187]]=_0xa55e[188];this[_0xa55e[101]][_0xa55e[125]][_0xa55e[99]][_0xa55e[189]]=_0xa55e[190];mxEvent[_0xa55e[35]](this[_0xa55e[101]][_0xa55e[125]],_0xa55e[191],mxUtils[_0xa55e[34]](this,function(_0x3b7cx14){this[_0xa55e[14]][_0xa55e[192]](_0x3b7cx14)}));mxEvent[_0xa55e[198]](this[_0xa55e[101]][_0xa55e[125]],mxUtils[_0xa55e[34]](this,function(_0x3b7cx14){this[_0xa55e[14]][_0xa55e[193]](mxEvent.MOUSE_DOWN, new mxMouseEvent(_0x3b7cx14))}),mxUtils[_0xa55e[34]](this,function(_0x3b7cx14){if(this[_0xa55e[14]][_0xa55e[93]]!=null&&this[_0xa55e[14]][_0xa55e[93]][_0xa55e[194]]()){this[_0xa55e[14]][_0xa55e[93]][_0xa55e[195]]()};if(this[_0xa55e[14]][_0xa55e[196]]&&!mxEvent[_0xa55e[197]](_0x3b7cx14)){this[_0xa55e[14]][_0xa55e[193]](mxEvent.MOUSE_MOVE, new mxMouseEvent(_0x3b7cx14))}}),mxUtils[_0xa55e[34]](this,function(_0x3b7cx14){this[_0xa55e[14]][_0xa55e[193]](mxEvent.MOUSE_UP, new mxMouseEvent(_0x3b7cx14))}))}else {this[_0xa55e[101]][_0xa55e[52]]=1;this[_0xa55e[101]][_0xa55e[199]]=_0x3b7cx15;this[_0xa55e[101]][_0xa55e[179]]()};this[_0xa55e[101]][_0xa55e[125]][_0xa55e[99]][_0xa55e[124]]=(this[_0xa55e[14]][_0xa55e[91]]())?_0xa55e[122]+_0x3b7cx25[_0xa55e[43]]+_0xa55e[123]:_0xa55e[97]}else {if(this[_0xa55e[101]]!=null){this[_0xa55e[101]][_0xa55e[177]]();this[_0xa55e[101]]=null}}};mxGraph[_0xa55e[44]][_0xa55e[200]]=function(_0x3b7cx26,_0x3b7cx27,_0x3b7cx28){var _0x3b7cx29=this[_0xa55e[53]][_0xa55e[52]];var _0x3b7cx2a=this[_0xa55e[53]][_0xa55e[71]];var _0x3b7cx1b=this[_0xa55e[82]];var _0x3b7cx9=_0x3b7cx29*this[_0xa55e[79]];var _0x3b7cx2b=this[_0xa55e[53]][_0xa55e[159]]();_0x3b7cx27=_0x3b7cx2b[_0xa55e[95]];_0x3b7cx28=_0x3b7cx2b[_0xa55e[96]];var _0x3b7cx15= new mxRectangle(_0x3b7cx29*_0x3b7cx2a[_0xa55e[70]],_0x3b7cx29*_0x3b7cx2a[_0xa55e[73]],_0x3b7cx1b[_0xa55e[95]]*_0x3b7cx9,_0x3b7cx1b[_0xa55e[96]]*_0x3b7cx9);_0x3b7cx26=_0x3b7cx26&&Math[_0xa55e[161]](_0x3b7cx15[_0xa55e[95]],_0x3b7cx15[_0xa55e[96]])>this[_0xa55e[201]];var _0x3b7cx2c=(_0x3b7cx26)?Math[_0xa55e[164]](_0x3b7cx27/_0x3b7cx15[_0xa55e[95]])-1:0;var _0x3b7cx2d=(_0x3b7cx26)?Math[_0xa55e[164]](_0x3b7cx28/_0x3b7cx15[_0xa55e[96]])-1:0;var _0x3b7cx2e=_0x3b7cx2b[_0xa55e[70]]+_0x3b7cx27;var _0x3b7cx2f=_0x3b7cx2b[_0xa55e[73]]+_0x3b7cx28;if(this[_0xa55e[202]]==null&&_0x3b7cx2c>0){this[_0xa55e[202]]=[]};if(this[_0xa55e[202]]!=null){for(var _0x3b7cx30=0;_0x3b7cx30<=_0x3b7cx2c;_0x3b7cx30++){var _0x3b7cx31=[ new mxPoint(_0x3b7cx2b[_0xa55e[70]]+(_0x3b7cx30+1)*_0x3b7cx15[_0xa55e[95]],_0x3b7cx2b[_0xa55e[73]]), new mxPoint(_0x3b7cx2b[_0xa55e[70]]+(_0x3b7cx30+1)*_0x3b7cx15[_0xa55e[95]],_0x3b7cx2f)];if(this[_0xa55e[202]][_0x3b7cx30]!=null){this[_0xa55e[202]][_0x3b7cx30][_0xa55e[52]]=1;this[_0xa55e[202]][_0x3b7cx30][_0xa55e[203]]=_0x3b7cx31;this[_0xa55e[202]][_0x3b7cx30][_0xa55e[179]]()}else {var _0x3b7cx32= new mxPolyline(_0x3b7cx31,this[_0xa55e[153]],this[_0xa55e[52]]);_0x3b7cx32[_0xa55e[166]]=this[_0xa55e[166]];_0x3b7cx32[_0xa55e[204]]=this[_0xa55e[205]];_0x3b7cx32[_0xa55e[206]]=false;_0x3b7cx32[_0xa55e[52]]=_0x3b7cx29;_0x3b7cx32[_0xa55e[12]](this[_0xa55e[53]][_0xa55e[178]]);_0x3b7cx32[_0xa55e[179]]();this[_0xa55e[202]][_0x3b7cx30]=_0x3b7cx32}};for(var _0x3b7cx30=_0x3b7cx2c;_0x3b7cx300){this[_0xa55e[208]]=[]};if(this[_0xa55e[208]]!=null){for(var _0x3b7cx30=0;_0x3b7cx30<=_0x3b7cx2d;_0x3b7cx30++){var _0x3b7cx31=[ new mxPoint(_0x3b7cx2b[_0xa55e[70]],_0x3b7cx2b[_0xa55e[73]]+(_0x3b7cx30+1)*_0x3b7cx15[_0xa55e[96]]), new mxPoint(_0x3b7cx2e,_0x3b7cx2b[_0xa55e[73]]+(_0x3b7cx30+1)*_0x3b7cx15[_0xa55e[96]])];if(this[_0xa55e[208]][_0x3b7cx30]!=null){this[_0xa55e[208]][_0x3b7cx30][_0xa55e[52]]=1;this[_0xa55e[208]][_0x3b7cx30][_0xa55e[203]]=_0x3b7cx31;this[_0xa55e[208]][_0x3b7cx30][_0xa55e[179]]()}else {var _0x3b7cx32= new mxPolyline(_0x3b7cx31,this[_0xa55e[153]],_0x3b7cx29);_0x3b7cx32[_0xa55e[166]]=this[_0xa55e[166]];_0x3b7cx32[_0xa55e[204]]=this[_0xa55e[205]];_0x3b7cx32[_0xa55e[206]]=false;_0x3b7cx32[_0xa55e[52]]=_0x3b7cx29;_0x3b7cx32[_0xa55e[12]](this[_0xa55e[53]][_0xa55e[178]]);_0x3b7cx32[_0xa55e[179]]();this[_0xa55e[208]][_0x3b7cx30]=_0x3b7cx32}};for(var _0x3b7cx30=_0x3b7cx2d;_0x3b7cx300&&_0x3b7cx4d[0]==_0xa55e[255]){_0x3b7cx4e=_0x3b7cx4d[1];for(var _0x3b7cx30=2;_0x3b7cx30<_0x3b7cx4d[_0xa55e[83]]-1;_0x3b7cx30++){_0x3b7cx4e+=_0xa55e[252]+_0x3b7cx4d[_0x3b7cx30]}};return _0x3b7cx4e};mxStencilRegistry[_0xa55e[241]]=function(_0x3b7cx4f,_0x3b7cx50,_0x3b7cx51){_0x3b7cx51=(_0x3b7cx51!=null)?_0x3b7cx51:false;var _0x3b7cx52=mxStencilRegistry[_0xa55e[243]][_0x3b7cx4f];if(_0x3b7cx51||_0x3b7cx52==null){var _0x3b7cx53=false;if(_0x3b7cx52==null){var _0x3b7cx4c=mxUtils[_0xa55e[250]](_0x3b7cx4f);_0x3b7cx52=_0x3b7cx4c[_0xa55e[256]]();mxStencilRegistry[_0xa55e[243]][_0x3b7cx4f]=_0x3b7cx52;_0x3b7cx53=true};mxStencilRegistry[_0xa55e[257]](_0x3b7cx52,_0x3b7cx50,_0x3b7cx53)}};mxStencilRegistry[_0xa55e[257]]=function(_0x3b7cx54,_0x3b7cx50,_0x3b7cx53){_0x3b7cx53=(_0x3b7cx53!=null)?_0x3b7cx53:true;var _0x3b7cx55=_0x3b7cx54[_0xa55e[258]];var _0x3b7cx56=_0x3b7cx55[_0xa55e[184]];var _0x3b7cx57=_0xa55e[20];var _0x3b7cx48=_0x3b7cx55[_0xa55e[56]](_0xa55e[259]);if(_0x3b7cx48!=null){_0x3b7cx57=_0x3b7cx48+_0xa55e[253]};while(_0x3b7cx56!=null){if(_0x3b7cx56[_0xa55e[260]]==mxConstants[_0xa55e[261]]){_0x3b7cx48=_0x3b7cx56[_0xa55e[56]](_0xa55e[259]);if(_0x3b7cx48!=null){_0x3b7cx57=_0x3b7cx57[_0xa55e[248]]();var _0x3b7cx58=_0x3b7cx48[_0xa55e[263]](/ /g,_0xa55e[262]);if(_0x3b7cx53){mxStencilRegistry[_0xa55e[264]](_0x3b7cx57+_0x3b7cx58[_0xa55e[248]](), new mxStencil(_0x3b7cx56))};if(_0x3b7cx50!=null){var _0x3b7cx19=_0x3b7cx56[_0xa55e[56]](_0xa55e[265]);var _0x3b7cx1a=_0x3b7cx56[_0xa55e[56]](_0xa55e[266]);_0x3b7cx19=(_0x3b7cx19==null)?80:parseInt(_0x3b7cx19,10);_0x3b7cx1a=(_0x3b7cx1a==null)?80:parseInt(_0x3b7cx1a,10);_0x3b7cx50(_0x3b7cx57,_0x3b7cx58,_0x3b7cx48,_0x3b7cx19,_0x3b7cx1a)}}};_0x3b7cx56=_0x3b7cx56[_0xa55e[267]]}}})();OpenFile=function(_0x3b7cx59){this[_0xa55e[268]]=null;this[_0xa55e[269]]=null;this[_0xa55e[270]]=_0x3b7cx59};OpenFile[_0xa55e[44]][_0xa55e[271]]=function(_0x3b7cx6){this[_0xa55e[269]]=_0x3b7cx6;this[_0xa55e[272]]()};OpenFile[_0xa55e[44]][_0xa55e[273]]=function(_0x3b7cx6,_0x3b7cx5a){this[_0xa55e[274]]=_0x3b7cx6;this[_0xa55e[21]]=_0x3b7cx5a;this[_0xa55e[272]]()};OpenFile[_0xa55e[44]][_0xa55e[275]]=function(_0x3b7cx5b){this[_0xa55e[276]]();mxUtils[_0xa55e[277]](_0x3b7cx5b)};OpenFile[_0xa55e[44]][_0xa55e[272]]=function(){if(this[_0xa55e[269]]!=null&&this[_0xa55e[274]]!=null){this[_0xa55e[269]](this[_0xa55e[274]],this[_0xa55e[21]]);this[_0xa55e[276]]()}};OpenFile[_0xa55e[44]][_0xa55e[276]]=function(){if(this[_0xa55e[270]]!=null){this[_0xa55e[270]]()}} \ No newline at end of file +/** + * $Id: Editor.js,v 1.14 2013/03/06 17:57:10 boris Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +// Specifies if local storage should be used (eg. on the iPad which has no filesystem) +var useLocalStorage = (mxClient.IS_TOUCH || urlParams['storage'] == 'local') && typeof(localStorage) != 'undefined'; +var fileSupport = window.File != null && window.FileReader != null && window.FileList != null; + +// Specifies if connector should be shown on selected cells +var touchStyle = mxClient.IS_TOUCH || urlParams['touch'] == '1'; + +// Counts open editor tabs (must be global for cross-window access) +var counter = 0; + +// Cross-domain window access is not allowed in FF, so if we +// were opened from another domain then this will fail. +try { + var op = window; + + while (op.opener != null && !isNaN(op.opener.counter)) { + op = op.opener; + } + + // Increments the counter in the first opener in the chain + if (op != null) { + op.counter++; + counter = op.counter; + } +} catch (e) { + // ignore +} + +/** + * Editor constructor executed on page load. + */ +Editor = function() { + mxEventSource.call(this); + this.init(); + this.initStencilRegistry(); + this.graph = new Graph(); + this.outline = new mxOutline(this.graph); + this.outline.updateOnPan = true; + this.undoManager = this.createUndoManager(); + this.status = ''; + + // Contains the name which was used for the last save. Default value is null. + this.filename = null; + + this.getOrCreateFilename = function() { + return this.filename || mxResources.get('drawing', [counter]) + '.xml'; + }; + + this.getFilename = function() { + return this.filename; + }; + + // Sets the status and fires a statusChanged event + this.setStatus = function(value) { + this.status = value; + this.fireEvent(new mxEventObject('statusChanged')); + }; + + // Returns the current status + this.getStatus = function() { + return this.status; + }; + + // Contains the current modified state of the diagram. This is false for + // new diagrams and after the diagram was saved. + this.modified = false; + + // Updates modified state if graph changes + this.graphChangeListener = function() { + this.modified = true; + }; + this.graph.getModel().addListener(mxEvent.CHANGE, mxUtils.bind(this, function() { + this.graphChangeListener.apply(this, arguments); + })); + + // Installs dialog if browser window is closed without saving + // This must be disabled during save and image export + window.onbeforeunload = mxUtils.bind(this, function() { + if (this.modified) { + return mxResources.get('allChangesLost'); + } + }); + + // Sets persistent graph state defaults + this.graph.resetViewOnRootChange = false; + this.graph.scrollbars = true; + this.graph.background = null; +}; + +// Editor inherits from mxEventSource +mxUtils.extend(Editor, mxEventSource); + +/** + * Specifies the image URL to be used for the grid. + */ +Editor.prototype.gridImage = IMAGE_PATH + '/grid.gif'; + +/** + * Specifies the image URL to be used for the transparent background. + */ +Editor.prototype.transparentImage = IMAGE_PATH + '/transparent.gif'; + +/** + * Sets the XML node for the current diagram. + */ +Editor.prototype.setGraphXml = function(node) { + var dec = new mxCodec(node.ownerDocument); + + if (node.nodeName == 'mxGraphModel') { + this.graph.view.scale = 1; + this.graph.gridEnabled = node.getAttribute('grid') != '0'; + this.graph.graphHandler.guidesEnabled = node.getAttribute('guides') != '0'; + this.graph.setTooltips(node.getAttribute('tooltips') != '0'); + this.graph.setConnectable(node.getAttribute('connect') != '0'); + this.graph.foldingEnabled = node.getAttribute('fold') != '0'; + this.graph.scrollbars = node.getAttribute('scrollbars') != '0'; + + if (!this.graph.scrollbars) { + this.graph.container.scrollLeft = 0; + this.graph.container.scrollTop = 0; + this.graph.view.translate.x = Number(node.getAttribute('dx') || 0); + this.graph.view.translate.y = Number(node.getAttribute('dy') || 0); + } + + this.graph.pageVisible = node.getAttribute('page') == '1'; + this.graph.pageBreaksVisible = this.graph.pageVisible; + this.graph.preferPageSize = this.graph.pageBreaksVisible; + + // Loads the persistent state settings + var ps = node.getAttribute('pageScale'); + + if (ps != null) { + this.graph.pageScale = ps; + } else { + this.graph.pageScale = 1.5; + } + + var pw = node.getAttribute('pageWidth'); + var ph = node.getAttribute('pageHeight'); + + if (pw != null && ph != null) { + this.graph.pageFormat = new mxRectangle(0, 0, parseFloat(pw), parseFloat(ph)); + this.outline.outline.pageFormat = this.graph.pageFormat; + } + + // Loads the persistent state settings + var bg = node.getAttribute('background'); + + if (bg != null && bg.length > 0) { + this.graph.background = bg; + } + + dec.decode(node, this.graph.getModel()); + this.updateGraphComponents(); + } +}; + +/** + * Returns the XML node that represents the current diagram. + */ +Editor.prototype.getGraphXml = function() { + var enc = new mxCodec(mxUtils.createXmlDocument()); + var node = enc.encode(this.graph.getModel()); + + if (this.graph.view.translate.x != 0 || this.graph.view.translate.y != 0) { + node.setAttribute('dx', Math.round(this.graph.view.translate.x * 100) / 100); + node.setAttribute('dy', Math.round(this.graph.view.translate.y * 100) / 100); + } + + node.setAttribute('grid', (this.graph.isGridEnabled()) ? '1' : '0'); + node.setAttribute('guides', (this.graph.graphHandler.guidesEnabled) ? '1' : '0'); + node.setAttribute('guides', (this.graph.graphHandler.guidesEnabled) ? '1' : '0'); + node.setAttribute('tooltips', (this.graph.tooltipHandler.isEnabled()) ? '1' : '0'); + node.setAttribute('connect', (this.graph.connectionHandler.isEnabled()) ? '1' : '0'); + node.setAttribute('fold', (this.graph.foldingEnabled) ? '1' : '0'); + node.setAttribute('page', (this.graph.pageVisible) ? '1' : '0'); + node.setAttribute('pageScale', this.graph.pageScale); + node.setAttribute('pageWidth', this.graph.pageFormat.width); + node.setAttribute('pageHeight', this.graph.pageFormat.height); + + if (!this.graph.scrollbars) { + node.setAttribute('scrollbars', '0'); + } + + if (this.graph.background != null) { + node.setAttribute('background', this.graph.background); + } + + return node; +}; + +/** + * Keeps the graph container in sync with the persistent graph state + */ +Editor.prototype.updateGraphComponents = function() { + var graph = this.graph; + var outline = this.outline; + + if (graph.container != null && outline.outline.container != null) { + if (graph.background != null) { + if (graph.background == 'none') { + graph.container.style.backgroundColor = 'transparent'; + } else { + if (graph.view.backgroundPageShape != null) { + graph.view.backgroundPageShape.fill = graph.background; + graph.view.backgroundPageShape.reconfigure(); + } + + graph.container.style.backgroundColor = graph.background; + } + } else { + graph.container.style.backgroundColor = ''; + } + + if (graph.pageVisible) { + graph.container.style.backgroundColor = '#ebebeb'; + graph.container.style.borderStyle = 'solid'; + graph.container.style.borderColor = '#e5e5e5'; + graph.container.style.borderTopWidth = '1px'; + graph.container.style.borderLeftWidth = '1px'; + graph.container.style.borderRightWidth = '0px'; + graph.container.style.borderBottomWidth = '0px'; + } else { + graph.container.style.border = ''; + } + + outline.outline.container.style.backgroundColor = graph.container.style.backgroundColor; + + if (outline.outline.pageVisible != graph.pageVisible || + outline.outline.pageScale != graph.pageScale) { + outline.outline.pageScale = graph.pageScale; + outline.outline.pageVisible = graph.pageVisible; + outline.outline.view.validate(); + } + + if (graph.scrollbars && graph.container.style.overflow == 'hidden' && !touchStyle) { + graph.container.style.overflow = 'auto'; + } else if (!graph.scrollbars || touchStyle) { + graph.container.style.overflow = 'hidden'; + } + + // Transparent.gif is a workaround for focus repaint problems in IE + var noBackground = (mxClient.IS_IE && document.documentMode >= 9) ? 'url(' + this.transparentImage + ')' : 'none'; + graph.container.style.backgroundImage = (!graph.pageVisible && graph.isGridEnabled()) ? 'url(' + this.gridImage + ')' : noBackground; + + if (graph.view.backgroundPageShape != null) { + graph.view.backgroundPageShape.node.style.backgroundImage = (this.graph.isGridEnabled()) ? 'url(' + this.gridImage + ')' : 'none'; + } + } +}; + +/** + * Initializes the environment. + */ +Editor.prototype.init = function() { + // Adds stylesheet for IE6 + if (mxClient.IS_IE6) { + mxClient.link('stylesheet', CSS_PATH + '/grapheditor-ie6.css'); + } + + // Adds required resources (disables loading of fallback properties, this can only + // be used if we know that all keys are defined in the language specific file) + mxResources.loadDefaultBundle = false; + mxResources.add(RESOURCE_BASE); + + // Makes the connection hotspot smaller + mxConstants.DEFAULT_HOTSPOT = 0.3; + + var mxConnectionHandlerCreateMarker = mxConnectionHandler.prototype.createMarker; + mxConnectionHandler.prototype.createMarker = function() { + var marker = mxConnectionHandlerCreateMarker.apply(this, arguments); + + // Overrides to ignore hotspot only for target terminal + marker.intersects = mxUtils.bind(this, function(state, evt) { + if (this.isConnecting()) { + return true; + } + + return mxCellMarker.prototype.intersects.apply(marker, arguments); + }); + + return marker; + }; + + // Makes the shadow brighter + mxConstants.SHADOWCOLOR = '#d0d0d0'; + + // Changes some default colors + 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; + + // Increases default rubberband opacity (default is 20) + mxRubberband.prototype.defaultOpacity = 30; + + // Changes border color of background page shape + mxGraphView.prototype.createBackgroundPageShape = function(bounds) { + return new mxRectangleShape(bounds, this.graph.background || 'white', '#cacaca'); + }; + + // Fits the number of background pages to the graph + mxGraphView.prototype.getBackgroundPageBounds = function() { + var gb = this.getGraphBounds(); + + // Computes unscaled, untranslated graph bounds + var x = (gb.width > 0) ? gb.x / this.scale - this.translate.x : 0; + var y = (gb.height > 0) ? gb.y / this.scale - this.translate.y : 0; + var w = gb.width / this.scale; + var h = gb.height / this.scale; + + var fmt = this.graph.pageFormat; + var ps = this.graph.pageScale; + + var pw = fmt.width * ps; + var ph = fmt.height * ps; + + var x0 = Math.floor(Math.min(0, x) / pw); + var y0 = Math.floor(Math.min(0, y) / ph); + var xe = Math.ceil(Math.max(1, x + w) / pw); + var ye = Math.ceil(Math.max(1, y + h) / ph); + + var rows = xe - x0; + var cols = ye - y0; + + var bounds = new mxRectangle(this.scale * (this.translate.x + x0 * pw), this.scale * + (this.translate.y + y0 * ph), this.scale * rows * pw, this.scale * cols * ph); + + return bounds; + }; + + // Add panning for background page in VML + var graphPanGraph = mxGraph.prototype.panGraph; + mxGraph.prototype.panGraph = function(dx, dy) { + graphPanGraph.apply(this, arguments); + + if ((this.dialect != mxConstants.DIALECT_SVG && this.view.backgroundPageShape != null) && + (!this.useScrollbarsForPanning || !mxUtils.hasScrollbars(this.container))) { + this.view.backgroundPageShape.node.style.marginLeft = dx + 'px'; + this.view.backgroundPageShape.node.style.marginTop = dy + 'px'; + } + }; + + var editor = this; + + // Uses HTML for background pages (to support grid background image) + mxGraphView.prototype.validateBackground = function() { + var bg = this.graph.getBackgroundImage(); + + if (bg != null) { + if (this.backgroundImage == null || this.backgroundImage.image != bg.src) { + if (this.backgroundImage != null) { + this.backgroundImage.destroy(); + } + + var bounds = new mxRectangle(0, 0, 1, 1); + + this.backgroundImage = new mxImageShape(bounds, bg.src); + this.backgroundImage.dialect = this.graph.dialect; + this.backgroundImage.init(this.backgroundPane); + this.backgroundImage.redraw(); + } + + this.redrawBackgroundImage(this.backgroundImage, bg); + } else if (this.backgroundImage != null) { + this.backgroundImage.destroy(); + this.backgroundImage = null; + } + + if (this.graph.pageVisible) { + var bounds = this.getBackgroundPageBounds(); + + if (this.backgroundPageShape == null) { + this.backgroundPageShape = this.createBackgroundPageShape(bounds); + this.backgroundPageShape.scale = 1; + this.backgroundPageShape.isShadow = true; + this.backgroundPageShape.dialect = mxConstants.DIALECT_STRICTHTML; + this.backgroundPageShape.init(this.graph.container); + // Required for the browser to render the background page in correct order + 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'; + + // Adds listener for double click handling on background + mxEvent.addListener(this.backgroundPageShape.node, 'dblclick', + mxUtils.bind(this, function(evt) { + this.graph.dblClick(evt); + }) + ); + + // Adds basic listeners for graph event dispatching outside of the + // container and finishing the handling of a single gesture + mxEvent.addGestureListeners(this.backgroundPageShape.node, + mxUtils.bind(this, function(evt) { + this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(evt)); + }), + mxUtils.bind(this, function(evt) { + // Hides the tooltip if mouse is outside container + if (this.graph.tooltipHandler != null && + this.graph.tooltipHandler.isHideOnHover()) { + this.graph.tooltipHandler.hide(); + } + + if (this.graph.isMouseDown && + !mxEvent.isConsumed(evt)) { + this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE, + new mxMouseEvent(evt)); + } + }), + mxUtils.bind(this, function(evt) { + this.graph.fireMouseEvent(mxEvent.MOUSE_UP, + new mxMouseEvent(evt)); + })); + } else { + this.backgroundPageShape.scale = 1; + this.backgroundPageShape.bounds = bounds; + this.backgroundPageShape.redraw(); + } + + this.backgroundPageShape.node.style.backgroundImage = (this.graph.isGridEnabled()) ? + 'url(' + editor.gridImage + ')' : 'none'; + } else if (this.backgroundPageShape != null) { + this.backgroundPageShape.destroy(); + this.backgroundPageShape = null; + } + }; + + // Draws page breaks only within the page + mxGraph.prototype.updatePageBreaks = function(visible, width, height) { + var scale = this.view.scale; + var tr = this.view.translate; + var fmt = this.pageFormat; + var ps = scale * this.pageScale; + + var bounds2 = this.view.getBackgroundPageBounds(); + + width = bounds2.width; + height = bounds2.height; + var bounds = new mxRectangle(scale * tr.x, scale * tr.y, + fmt.width * ps, fmt.height * ps); + + // Does not show page breaks if the scale is too small + visible = visible && Math.min(bounds.width, bounds.height) > this.minPageBreakDist; + + var horizontalCount = (visible) ? Math.ceil(width / bounds.width) - 1 : 0; + var verticalCount = (visible) ? Math.ceil(height / bounds.height) - 1 : 0; + var right = bounds2.x + width; + var bottom = bounds2.y + height; + + if (this.horizontalPageBreaks == null && horizontalCount > 0) { + this.horizontalPageBreaks = []; + } + + if (this.horizontalPageBreaks != null) { + for (var i = 0; i <= horizontalCount; i++) { + var pts = [new mxPoint(bounds2.x + (i + 1) * bounds.width, bounds2.y), + new mxPoint(bounds2.x + (i + 1) * bounds.width, bottom) + ]; + + if (this.horizontalPageBreaks[i] != null) { + this.horizontalPageBreaks[i].scale = 1; + this.horizontalPageBreaks[i].points = pts; + this.horizontalPageBreaks[i].redraw(); + } else { + var pageBreak = new mxPolyline(pts, this.pageBreakColor, this.scale); + pageBreak.dialect = this.dialect; + pageBreak.isDashed = this.pageBreakDashed; + pageBreak.addPipe = false; + pageBreak.scale = scale; + pageBreak.init(this.view.backgroundPane); + pageBreak.redraw(); + + this.horizontalPageBreaks[i] = pageBreak; + } + } + + for (var i = horizontalCount; i < this.horizontalPageBreaks.length; i++) { + this.horizontalPageBreaks[i].destroy(); + } + + this.horizontalPageBreaks.splice(horizontalCount, this.horizontalPageBreaks.length - horizontalCount); + } + + if (this.verticalPageBreaks == null && verticalCount > 0) { + this.verticalPageBreaks = []; + } + + if (this.verticalPageBreaks != null) { + for (var i = 0; i <= verticalCount; i++) { + var pts = [new mxPoint(bounds2.x, bounds2.y + (i + 1) * bounds.height), + new mxPoint(right, bounds2.y + (i + 1) * bounds.height) + ]; + + if (this.verticalPageBreaks[i] != null) { + this.verticalPageBreaks[i].scale = 1; //scale; + this.verticalPageBreaks[i].points = pts; + this.verticalPageBreaks[i].redraw(); + } else { + var pageBreak = new mxPolyline(pts, this.pageBreakColor, scale); + pageBreak.dialect = this.dialect; + pageBreak.isDashed = this.pageBreakDashed; + pageBreak.addPipe = false; + pageBreak.scale = scale; + pageBreak.init(this.view.backgroundPane); + pageBreak.redraw(); + + this.verticalPageBreaks[i] = pageBreak; + } + } + + for (var i = verticalCount; i < this.verticalPageBreaks.length; i++) { + this.verticalPageBreaks[i].destroy(); + } + + this.verticalPageBreaks.splice(verticalCount, this.verticalPageBreaks.length - verticalCount); + } + }; + + // Enables snapping to off-grid terminals for edge waypoints + mxEdgeHandler.prototype.snapToTerminals = true; + + // Enables guides + mxGraphHandler.prototype.guidesEnabled = true; + + // Disables removing relative children from parents + var mxGraphHandlerShouldRemoveCellsFromParent = mxGraphHandler.prototype.shouldRemoveCellsFromParent; + mxGraphHandler.prototype.shouldRemoveCellsFromParent = function(parent, cells, evt) { + for (var i = 0; i < cells.length; i++) { + if (this.graph.getModel().isVertex(cells[i])) { + var geo = this.graph.getCellGeometry(cells[i]); + + if (geo != null && geo.relative) { + return false; + } + } + } + + return mxGraphHandlerShouldRemoveCellsFromParent.apply(this, arguments); + }; + + // Alt-move disables guides + mxGuide.prototype.isEnabledForEvent = function(evt) { + return !mxEvent.isAltDown(evt); + }; + + // Consumes click events for disabled menu items + mxPopupMenuAddItem = mxPopupMenu.prototype.addItem; + mxPopupMenu.prototype.addItem = function(title, image, funct, parent, iconCls, enabled) { + var result = mxPopupMenuAddItem.apply(this, arguments); + + if (enabled != null && !enabled) { + mxEvent.addListener(result, 'mousedown', function(evt) { + mxEvent.consume(evt); + }); + } + + return result; + }; + + // Selects descendants before children selection mode + var graphHandlerGetInitialCellForEvent = mxGraphHandler.prototype.getInitialCellForEvent; + mxGraphHandler.prototype.getInitialCellForEvent = function(me) { + var model = this.graph.getModel(); + var psel = model.getParent(this.graph.getSelectionCell()); + var cell = graphHandlerGetInitialCellForEvent.apply(this, arguments); + var parent = model.getParent(cell); + + if (psel == null || (psel != cell && psel != parent)) { + while (!this.graph.isCellSelected(cell) && !this.graph.isCellSelected(parent) && + model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + cell = parent; + parent = this.graph.getModel().getParent(cell); + } + } + + return cell; + }; + + // Selection is delayed to mouseup if child selected + var graphHandlerIsDelayedSelection = mxGraphHandler.prototype.isDelayedSelection; + mxGraphHandler.prototype.isDelayedSelection = function(cell) { + var result = graphHandlerIsDelayedSelection.apply(this, arguments); + var model = this.graph.getModel(); + var psel = model.getParent(this.graph.getSelectionCell()); + var parent = model.getParent(cell); + + if (psel == null || (psel != cell && psel != parent)) { + if (!this.graph.isCellSelected(cell) && model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + result = true; + } + } + + return result; + }; + + // Delayed selection of parent group + mxGraphHandler.prototype.selectDelayed = function(me) { + var cell = me.getCell(); + + if (cell == null) { + cell = this.cell; + } + + var model = this.graph.getModel(); + var parent = model.getParent(cell); + + while (this.graph.isCellSelected(cell) && model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + cell = parent; + parent = model.getParent(cell); + } + + this.graph.selectCellForEvent(cell, me.getEvent()); + }; + + // Returns last selected ancestor + mxPanningHandler.prototype.getCellForPopupEvent = function(me) { + var cell = me.getCell(); + var model = this.graph.getModel(); + var parent = model.getParent(cell); + + while (model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + if (this.graph.isCellSelected(parent)) { + cell = parent; + } + + parent = model.getParent(parent); + } + + return cell; + }; +}; + +/** + * Creates and returns a new undo manager. + */ +Editor.prototype.createUndoManager = function() { + var graph = this.graph; + var undoMgr = new mxUndoManager(); + + // Installs the command history + var listener = function(sender, evt) { + undoMgr.undoableEditHappened(evt.getProperty('edit')); + }; + + graph.getModel().addListener(mxEvent.UNDO, listener); + graph.getView().addListener(mxEvent.UNDO, listener); + + // Keeps the selection in sync with the history + var undoHandler = function(sender, evt) { + var cand = graph.getSelectionCellsForChanges(evt.getProperty('edit').changes); + var cells = []; + + for (var i = 1; i < cand.length; i++) { + if (graph.view.getState(cand[i]) != null) { + cells.push(cand[i]); + } + } + + graph.setSelectionCells(cells); + }; + + undoMgr.addListener(mxEvent.UNDO, undoHandler); + undoMgr.addListener(mxEvent.REDO, undoHandler); + + return undoMgr; +}; + +/** + * Adds basic stencil set (no namespace). + */ +Editor.prototype.initStencilRegistry = function() { + // Loads default stencils + mxStencilRegistry.loadStencilSet(STENCIL_PATH + '/general.xml'); +}; + +/** + * Overrides stencil registry for dynamic loading of stencils. + */ +(function() { + /** + * Maps from library names to an array of Javascript filenames, + * which are synchronously loaded. Currently only stencil files + * (.xml) and JS files (.js) are supported. + * IMPORTANT: For embedded diagrams to work entries must also + * be added in EmbedServlet.java. + */ + mxStencilRegistry.libraries = {}; + + /** + * Stores all package names that have been dynamically loaded. + * Each package is only loaded once. + */ + mxStencilRegistry.packages = []; + + // Extends the default stencil registry to add dynamic loading + mxStencilRegistry.getStencil = function(name) { + var result = mxStencilRegistry.stencils[name]; + + if (result == null) { + var basename = mxStencilRegistry.getBasenameForStencil(name); + + // Loads stencil files and tries again + if (basename != null) { + var libs = mxStencilRegistry.libraries[basename]; + + if (libs != null) { + if (mxStencilRegistry.packages[basename] == null) { + mxStencilRegistry.packages[basename] = 1; + + for (var i = 0; i < libs.length; i++) { + var fname = libs[i]; + + if (fname.toLowerCase().substring(fname.length - 4, fname.length) == '.xml') { + mxStencilRegistry.loadStencilSet(fname, null); + } else if (fname.toLowerCase().substring(fname.length - 3, fname.length) == '.js') { + var req = mxUtils.load(fname); + + if (req != null) { + eval.call(window, req.getText()); + } + } else { + // FIXME: This does not yet work as the loading is triggered after + // the shape was used in the graph, at which point the keys have + // typically been translated in the calling method. + //mxResources.add(fname); + } + } + } + } else { + mxStencilRegistry.loadStencilSet(STENCIL_PATH + '/' + basename + '.xml', null); + } + + result = mxStencilRegistry.stencils[name]; + } + } + + return result; + }; + + // Returns the basename for the given stencil or null if no file must be + // loaded to render the given stencil. + mxStencilRegistry.getBasenameForStencil = function(name) { + var parts = name.split('.'); + var tmp = null; + + if (parts.length > 0 && parts[0] == 'mxgraph') { + tmp = parts[1]; + + for (var i = 2; i < parts.length - 1; i++) { + tmp += '/' + parts[i]; + } + } + + return tmp; + }; + + // Loads the given stencil set + mxStencilRegistry.loadStencilSet = function(stencilFile, postStencilLoad, force) { + force = (force != null) ? force : false; + + // Uses additional cache for detecting previous load attempts + var xmlDoc = mxStencilRegistry.packages[stencilFile]; + + if (force || xmlDoc == null) { + var install = false; + + if (xmlDoc == null) { + var req = mxUtils.load(stencilFile); + xmlDoc = req.getXml(); + mxStencilRegistry.packages[stencilFile] = xmlDoc; + install = true; + } + + mxStencilRegistry.parseStencilSet(xmlDoc, postStencilLoad, install); + } + }; + + // Parses the given stencil set + mxStencilRegistry.parseStencilSet = function(xmlDocument, postStencilLoad, install) { + install = (install != null) ? install : true; + var root = xmlDocument.documentElement; + var shape = root.firstChild; + var packageName = ''; + var name = root.getAttribute('name'); + + if (name != null) { + packageName = name + '.'; + } + + while (shape != null) { + if (shape.nodeType == mxConstants.NODETYPE_ELEMENT) { + name = shape.getAttribute('name'); + + if (name != null) { + packageName = packageName.toLowerCase(); + var stencilName = name.replace(/ /g, "_"); + + if (install) { + mxStencilRegistry.addStencil(packageName + stencilName.toLowerCase(), new mxStencil(shape)); + } + + if (postStencilLoad != null) { + var w = shape.getAttribute('w'); + var h = shape.getAttribute('h'); + + w = (w == null) ? 80 : parseInt(w, 10); + h = (h == null) ? 80 : parseInt(h, 10); + + postStencilLoad(packageName, stencilName, name, w, h); + } + } + } + + shape = shape.nextSibling; + } + }; +})(); + +/** + * Class for asynchronously opening a new window and loading a file at the same + * time. This acts as a bridge between the open dialog and the new editor. + */ +OpenFile = function(done) { + this.producer = null; + this.consumer = null; + this.done = done; +}; + +/** + * Registers the editor from the new window. + */ +OpenFile.prototype.setConsumer = function(value) { + this.consumer = value; + this.execute(); +}; + +/** + * Sets the data from the loaded file. + */ +OpenFile.prototype.setData = function(value, filename) { + this.data = value; + this.filename = filename; + this.execute(); +}; + +/** + * Displays an error message. + */ +OpenFile.prototype.error = function(msg) { + this.cancel(); + mxUtils.alert(msg); +}; + +/** + * Consumes the data. + */ +OpenFile.prototype.execute = function() { + if (this.consumer != null && this.data != null) { + this.consumer(this.data, this.filename); + this.cancel(); + } +}; + +/** + * Cancels the operation. + */ +OpenFile.prototype.cancel = function() { + if (this.done != null) { + this.done(); + } +}; diff --git a/public/assets/plugins/jscripty/js/EditorUi.js b/public/assets/plugins/jscripty/js/EditorUi.js index 2162a2b..b81caf5 100644 --- a/public/assets/plugins/jscripty/js/EditorUi.js +++ b/public/assets/plugins/jscripty/js/EditorUi.js @@ -1 +1,1325 @@ -var _0xc098=["\x65\x64\x69\x74\x6F\x72","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x45\x64\x69\x74\x6F\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x67\x72\x61\x70\x68","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x73\x74\x79\x6C\x65","\x68\x69\x64\x64\x65\x6E","\x73\x72\x63","\x73\x75\x62\x6D\x65\x6E\x75\x49\x6D\x61\x67\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x61\x63\x74\x69\x6F\x6E\x73","\x6D\x65\x6E\x75\x73","\x63\x72\x65\x61\x74\x65\x44\x69\x76\x73","\x72\x65\x66\x72\x65\x73\x68","\x63\x72\x65\x61\x74\x65\x55\x69","\x65\x76\x65\x6E\x74","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x41\x6C\x6C\x6F\x77\x65\x64","\x69\x73\x45\x64\x69\x74\x69\x6E\x67","\x62\x69\x6E\x64","\x62\x6F\x64\x79","\x6F\x6E\x73\x65\x6C\x65\x63\x74\x73\x74\x61\x72\x74","\x6D\x65\x6E\x75\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6F\x6E\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x74\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x64\x69\x61\x67\x72\x61\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x69\x64\x65\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x66\x6F\x6F\x74\x65\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x6F\x6E\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x69\x6E\x69\x74","\x74\x61\x62\x69\x6E\x64\x65\x78","\x30","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x75\x72\x73\x6F\x72","\x64\x65\x66\x61\x75\x6C\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x67\x72\x69\x64\x49\x6D\x61\x67\x65","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x2D\x31\x70\x78\x20\x2D\x31\x70\x78","\x66\x6F\x63\x75\x73","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x4D\x4F\x55\x53\x45\x5F\x44\x4F\x57\x4E","\x61\x70\x70\x6C\x79","\x6D\x75\x6C\x74\x69\x70\x6C\x69\x63\x69\x74\x69\x65\x73","\x73\x74\x61\x72\x74","\x65\x6E\x64","\x69\x6E\x70\x75\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x65\x6D\x61\x69\x6C","\x6E","\x63\x72\x65\x61\x74\x65\x4D\x75\x6C\x74\x69\x70\x6C\x69\x63\x69\x74\x69\x65\x73","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x63\x65\x6C\x6C","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x74\x61\x67\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x73\x6F\x75\x72\x63\x65","\x69\x6E\x64\x65\x78\x4F\x66","\x73\x74\x61\x72\x74\x45\x64\x69\x74\x69\x6E\x67\x41\x74\x43\x65\x6C\x6C","\x69\x73\x56\x65\x72\x74\x65\x78","\x6C\x6F\x67","\x73\x68\x6F\x77\x44\x69\x61\x6C\x6F\x67","\x63\x6F\x6E\x73\x75\x6D\x65","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x66\x61\x63\x74\x6F\x72\x79\x4D\x65\x74\x68\x6F\x64","\x63\x72\x65\x61\x74\x65\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x6F\x75\x74\x6C\x69\x6E\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6F\x75\x74\x6C\x69\x6E\x65","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x67\x65\x73\x74\x75\x72\x65\x63\x68\x61\x6E\x67\x65","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x73\x63\x61\x6C\x65\x28","\x73\x63\x61\x6C\x65","\x67\x65\x74\x44\x72\x61\x77\x50\x61\x6E\x65","\x76\x69\x65\x77","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x67\x65\x73\x74\x75\x72\x65\x65\x6E\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x7A\x6F\x6F\x6D\x54\x6F\x43\x65\x6E\x74\x65\x72","\x7A\x6F\x6F\x6D","\x76\x69\x73\x69\x62\x6C\x65","\x63\x72\x65\x61\x74\x65\x4B\x65\x79\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x4B\x65\x79\x48\x61\x6E\x64\x6C\x65\x72","\x72\x65\x73\x69\x7A\x65","\x73\x69\x7A\x65\x44\x69\x64\x43\x68\x61\x6E\x67\x65","\x75\x70\x64\x61\x74\x65","\x6F\x70\x65\x6E","\x73\x70\x6C\x69\x74\x53\x69\x7A\x65","\x6D\x65\x6E\x75\x62\x61\x72\x48\x65\x69\x67\x68\x74","\x74\x6F\x6F\x6C\x62\x61\x72\x48\x65\x69\x67\x68\x74","\x66\x6F\x6F\x74\x65\x72\x48\x65\x69\x67\x68\x74","\x68\x73\x70\x6C\x69\x74\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x76\x73\x70\x6C\x69\x74\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x64\x64\x55\x6E\x64\x6F\x4C\x69\x73\x74\x65\x6E\x65\x72","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x73\x74\x65","\x67\x65\x74","\x69\x73\x45\x6D\x70\x74\x79","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x75\x74","\x63\x6F\x70\x79","\x6F\x70\x65\x6E\x65\x72","\x6F\x70\x65\x6E\x46\x69\x6C\x65","\x70\x61\x72\x73\x65\x58\x6D\x6C","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x6D\x6F\x64\x69\x66\x69\x65\x64","\x63\x6C\x65\x61\x72","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x69\x6E\x76\x61\x6C\x69\x64\x4F\x72\x4D\x69\x73\x73\x69\x6E\x67\x46\x69\x6C\x65","\x3A\x20","\x6D\x65\x73\x73\x61\x67\x65","\x61\x6C\x65\x72\x74","\x73\x65\x74\x43\x6F\x6E\x73\x75\x6D\x65\x72","\x6F\x70\x65\x6E\x53\x74\x72\x69\x6E\x67","\x64\x61\x74\x61","\x6E\x65\x77","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x67\x65\x74\x50\x72\x65\x74\x74\x79\x58\x6D\x6C","\x67\x65\x74\x49\x74\x65\x6D","\x72\x65\x70\x6C\x61\x63\x65","\x63\x6F\x6E\x66\x69\x72\x6D","\x73\x65\x74\x49\x74\x65\x6D","\x73\x61\x76\x65\x64","\x20","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x6C\x65\x6E\x67\x74\x68","\x50\x4F\x53\x54","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x78\x2D\x77\x77\x77\x2D\x66\x6F\x72\x6D\x2D\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x65\x61\x72\x65\x72\x20","\x74\x6F\x6B\x65\x6E","\x6F\x6E\x6C\x6F\x61\x64","\x72\x65\x61\x64\x79\x53\x74\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x50\x72\x6F\x6A\x65\x63\x74\x20","\x6E\x61\x6D\x65","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x70\x61\x72\x73\x65","\x20\x69\x73\x20\x6F\x70\x65\x6E\x69\x6E\x67\x20\x69\x6E\x20\x6E\x65\x77\x20\x77\x69\x6E\x64\x6F\x77\x21","\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x2F","\x69\x64","\x5F\x62\x6C\x61\x6E\x6B","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x65\x72\x72\x6F\x72\x73","\x6F\x6E\x65\x72\x72\x6F\x72","\x73\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x3D\x70\x72\x6F\x6A\x65\x63\x74\x5F\x6E\x65\x77\x26\x6E\x61\x6D\x65\x3D","\x73\x65\x6E\x64","\x64\x72\x61\x77\x69\x6E\x67\x54\x6F\x6F\x4C\x61\x72\x67\x65","\x70\x6F\x70\x75\x70","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74","\x73\x61\x76\x65","\x50\x55\x54","\x55\x70\x64\x61\x74\x65\x64\x20\x61\x74\x20","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x20\x28","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x64\x72\x61\x66\x74\x3D","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x66\x69\x6C\x65","\x73\x61\x76\x65\x41\x73","\x45\x72\x72\x6F\x72\x20\x63\x6C\x6F\x6E\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x3D\x70\x72\x6F\x6A\x65\x63\x74\x5F\x63\x6C\x6F\x6E\x65\x64\x26\x6E\x61\x6D\x65\x3D","\x26\x64\x72\x61\x66\x74\x3D","\x26\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E\x3D","\x76\x61\x6C\x69\x64\x61\x74\x65","\x67\x65\x74\x52\x6F\x6F\x74","\x6D\x6F\x64\x65\x6C","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x67\x65\x74\x43\x68\x69\x6C\x64\x41\x74","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x3C\x62\x72\x3E","\x73\x65\x74\x43\x65\x6C\x6C\x57\x61\x72\x6E\x69\x6E\x67","","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x51\x75\x65\x73\x74\x69\x6F\x6E\x20\x63\x61\x6E\x20\x6E\x6F\x74\x20\x62\x65\x20\x65\x6D\x70\x74\x79","\x0A","\x6C\x61\x62\x65\x6C","\x4C\x61\x62\x65\x6C\x20\x63\x61\x6E\x20\x6E\x6F\x74\x20\x62\x65\x20\x65\x6D\x70\x74\x79","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x6C\x6F\x63\x6B","\x4F\x6E\x6C\x79\x20\x6F\x6E\x65\x20\x53\x74\x61\x72\x74\x20\x62\x6C\x6F\x63\x6B\x20\x69\x73\x20\x61\x6C\x6C\x6F\x77\x65\x64","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x67\x65\x74\x49\x64","\x67\x65\x74\x43\x65\x6C\x6C","\x67\x65\x74\x56\x61\x6C\x75\x65","\x6E\x75\x6C\x6C","\x56\x61\x6C\x75\x65\x20\x63\x61\x6E\x20\x6E\x6F\x74\x20\x62\x65\x20\x65\x6D\x70\x74\x79","\x2C","\x73\x70\x6C\x69\x74","\x74\x72\x69\x6D","\x56\x61\x6C\x75\x65","\x20\x63\x61\x6E\x20\x6E\x6F\x74\x20\x62\x65\x20\x65\x6D\x70\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x63\x6F\x6E\x74\x61\x69\x6E\x73\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72\x73\x52\x65\x73\x6F\x75\x72\x63\x65","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x67\x65\x74\x45\x64\x67\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x67\x65\x74\x43\x65\x6C\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x76\x61\x6C\x69\x64\x61\x74\x65\x43\x65\x6C\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x70\x75\x62\x6C\x69\x73\x68","\x50\x75\x62\x6C\x69\x73\x68\x65\x64\x20\x61\x74\x20","\x45\x72\x72\x6F\x72\x20\x70\x75\x62\x6C\x69\x73\x68\x69\x6E\x67\x20\x66\x69\x6C\x65","\x45\x72\x72\x6F\x72\x20\x70\x75\x62\x6C\x69\x73\x68\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x76\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x69\x61\x62\x6C\x65\x20\x63\x72\x65\x61\x74\x65\x64\x20\x61\x74\x20","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x6E\x61\x6D\x65\x3D","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65","\x67\x65\x74\x55\x72\x6C","\x70\x61\x74\x68\x6E\x61\x6D\x65","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x3F","\x26","\x3D","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x61\x6E\x55\x6E\x64\x6F","\x63\x61\x6E\x52\x65\x64\x6F","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x74\x6F\x42\x61\x63\x6B","\x64\x61\x73\x68\x65\x64","\x72\x6F\x75\x6E\x64\x65\x64","\x73\x68\x61\x64\x6F\x77","\x74\x69\x6C\x74","\x61\x75\x74\x6F\x73\x69\x7A\x65","\x63\x75\x72\x76\x65\x64","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x77\x6F\x72\x64\x57\x72\x61\x70","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x67\x72\x6F\x75\x70","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x75\x6E\x67\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x61\x6C\x69\x67\x6E\x6D\x65\x6E\x74","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x74\x65\x78\x74","\x66\x6F\x72\x6D\x61\x74","\x61\x72\x72\x61\x6E\x67\x65","\x6C\x69\x6E\x65\x77\x69\x64\x74\x68","\x73\x70\x61\x63\x69\x6E\x67","\x6C\x69\x6E\x65","\x6C\x69\x6E\x65\x65\x6E\x64","\x6C\x69\x6E\x65\x73\x74\x61\x72\x74","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x61\x6C\x69\x67\x6E","\x67\x65\x74\x53\x74\x61\x74\x65","\x69\x73\x4C\x6F\x6F\x70","\x64\x69\x72\x65\x63\x74\x69\x6F\x6E","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x63\x75\x72\x72\x65\x6E\x74\x52\x6F\x6F\x74","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x68\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x65\x78\x70\x61\x6E\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x65\x64\x69\x74\x4C\x69\x6E\x6B","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x63\x6C\x69\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x6D\x69\x6E","\x6D\x61\x78","\x68\x65\x69\x67\x68\x74","\x70\x78","\x74\x6F\x70","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x77\x69\x64\x74\x68","\x62\x6F\x74\x74\x6F\x6D","\x6C\x65\x66\x74","\x64\x69\x73\x70\x6C\x61\x79","\x6E\x6F\x6E\x65","\x68\x73\x70\x6C\x69\x74","\x76\x73\x70\x6C\x69\x74","\x67\x65\x4D\x65\x6E\x75\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x72\x65\x61\x74\x65\x44\x69\x76","\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x53\x69\x64\x65\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x4F\x75\x74\x6C\x69\x6E\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x44\x69\x61\x67\x72\x61\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x46\x6F\x6F\x74\x65\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x48\x73\x70\x6C\x69\x74","\x67\x65\x56\x73\x70\x6C\x69\x74","\x30\x70\x78","\x72\x69\x67\x68\x74","\x6D\x65\x6E\x75\x62\x61\x72","\x67\x65\x4D\x65\x6E\x75\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x4D\x65\x6E\x75\x62\x61\x72","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x74\x6F\x6F\x6C\x62\x61\x72","\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x54\x6F\x6F\x6C\x62\x61\x72","\x73\x69\x64\x65\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x53\x69\x64\x65\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x46\x6F\x6F\x74\x65\x72","\x73\x74\x61\x74\x75\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x72\x65\x61\x74\x65\x53\x74\x61\x74\x75\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x74\x61\x74\x75\x73\x43\x68\x61\x6E\x67\x65\x64","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x65\x74\x53\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x61\x64\x64\x53\x70\x6C\x69\x74\x48\x61\x6E\x64\x6C\x65\x72","\x61","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x49\x74\x65\x6D\x20\x67\x65\x53\x74\x61\x74\x75\x73","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x67\x65\x46\x6F\x6F\x74\x65\x72","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x48\x65\x61\x64\x65\x72","\x63\x72\x65\x61\x74\x65\x46\x6F\x72\x6D","\x66\x6F\x72\x6D","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x78","\x79","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x74\x6F\x75\x63\x68\x6D\x6F\x76\x65","\x6D\x6F\x75\x73\x65\x75\x70","\x74\x6F\x75\x63\x68\x65\x6E\x64","\x68\x69\x64\x65\x44\x69\x61\x6C\x6F\x67","\x64\x69\x61\x6C\x6F\x67","\x49\x53\x5F\x56\x4D\x4C","\x63\x6C\x6F\x73\x65","\x73\x61\x76\x65\x46\x69\x6C\x65","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x70\x75\x62\x6C\x69\x73\x68\x46\x69\x6C\x65","\x65\x78\x65\x63\x75\x74\x65\x4C\x61\x79\x6F\x75\x74","\x61\x6E\x69\x6D\x61\x74\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x65\x78\x65\x63\x75\x74\x65","\x43\x61\x6D\x69\x6E\x6F","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x72\x74\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x69\x73\x43\x6F\x6E\x74\x72\x6F\x6C\x44\x6F\x77\x6E","\x49\x53\x5F\x4D\x41\x43","\x6D\x65\x74\x61\x4B\x65\x79","\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x65\x6E\x61\x62\x6C\x65\x64","\x66\x75\x6E\x63\x74","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x53\x68\x69\x66\x74\x4B\x65\x79","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x4B\x65\x79","\x62\x69\x6E\x64\x53\x68\x69\x66\x74\x4B\x65\x79","\x62\x69\x6E\x64\x4B\x65\x79","\x65\x73\x63\x61\x70\x65","\x65\x6E\x74\x65\x72","\x66\x6F\x6C\x64\x43\x65\x6C\x6C\x73","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x65\x78\x70\x6F\x72\x74","\x63\x6F\x6E\x6E\x65\x63\x74","\x67\x72\x69\x64","\x61\x62\x6F\x75\x74","\x20\x6D\x75\x73\x74\x20\x68\x61\x76\x65\x20","\x20\x6F\x75\x74\x67\x6F\x69\x6E\x67\x20\x65\x64\x67\x65\x2E","\x70\x75\x73\x68","\x20\x69\x6E\x63\x6F\x6D\x69\x6E\x67\x20\x65\x64\x67\x65\x2E"];EditorUi=function(_0xc6abx1,_0xc6abx2){this[_0xc098[0]]=_0xc6abx1|| new Editor();this[_0xc098[1]]=_0xc6abx2||document[_0xc098[3]](_0xc098[2]);var _0xc6abx3=_0xc6abx1[_0xc098[4]];var _0xc6abx4=this;this[_0xc098[1]][_0xc098[6]][_0xc098[5]]=_0xc098[7]; new Image()[_0xc098[8]]=mxPopupMenu[_0xc098[10]][_0xc098[9]];if(mxConnectionHandler[_0xc098[10]][_0xc098[11]]!=null){ new Image()[_0xc098[8]]=mxConnectionHandler[_0xc098[10]][_0xc098[11]][_0xc098[8]]};this[_0xc098[12]]= new Actions(this);this[_0xc098[13]]= new Menus(this);this[_0xc098[14]]();this[_0xc098[15]]();this[_0xc098[16]]();var _0xc6abx5=mxUtils[_0xc098[20]](this,function(_0xc6abx6){if(_0xc6abx6==null){_0xc6abx6=window[_0xc098[17]]};if(this[_0xc098[18]](_0xc6abx6)){return true};return _0xc6abx3[_0xc098[19]]()});if(this[_0xc098[1]]==document[_0xc098[21]]){this[_0xc098[23]][_0xc098[22]]=_0xc6abx5;this[_0xc098[23]][_0xc098[24]]=_0xc6abx5;this[_0xc098[25]][_0xc098[22]]=_0xc6abx5;this[_0xc098[25]][_0xc098[24]]=_0xc6abx5;this[_0xc098[26]][_0xc098[22]]=_0xc6abx5;this[_0xc098[26]][_0xc098[24]]=_0xc6abx5;this[_0xc098[27]][_0xc098[22]]=_0xc6abx5;this[_0xc098[27]][_0xc098[24]]=_0xc6abx5;this[_0xc098[28]][_0xc098[22]]=_0xc6abx5;this[_0xc098[28]][_0xc098[24]]=_0xc6abx5};if(mxClient[_0xc098[29]]&&( typeof (document[_0xc098[30]])===_0xc098[31]||document[_0xc098[30]]<9)){mxEvent[_0xc098[33]](this[_0xc098[26]],_0xc098[32],_0xc6abx5);mxEvent[_0xc098[33]](this[_0xc098[27]],_0xc098[32],_0xc6abx5)}else {this[_0xc098[26]][_0xc098[34]]=_0xc6abx5;this[_0xc098[27]][_0xc098[34]]=_0xc6abx5};_0xc6abx3[_0xc098[35]](this[_0xc098[26]]);_0xc6abx3[_0xc098[15]]();_0xc6abx3[_0xc098[1]][_0xc098[38]](_0xc098[36],_0xc098[37]);_0xc6abx3[_0xc098[1]][_0xc098[6]][_0xc098[39]]=_0xc098[40];_0xc6abx3[_0xc098[1]][_0xc098[6]][_0xc098[41]]=_0xc098[42]+_0xc6abx1[_0xc098[43]]+_0xc098[44];_0xc6abx3[_0xc098[1]][_0xc098[6]][_0xc098[45]]=_0xc098[46];_0xc6abx3[_0xc098[1]][_0xc098[47]]();var _0xc6abx7=_0xc6abx3[_0xc098[48]];_0xc6abx3[_0xc098[48]]=function(_0xc6abx8,_0xc6abx9,_0xc6abxa){if(_0xc6abx8==mxEvent[_0xc098[49]]){this[_0xc098[1]][_0xc098[47]]()};_0xc6abx7[_0xc098[50]](this,arguments)};this[_0xc098[58]](_0xc6abx3[_0xc098[51]],[_0xc098[52],_0xc098[53],_0xc098[54],_0xc098[55],_0xc098[56]],[[1,1],[0,0],[1,1],[1,_0xc098[57]],[1,_0xc098[57]]],[[0,0],[1,_0xc098[57]],[1,_0xc098[57]],[1,_0xc098[57]],[1,_0xc098[57]]]);_0xc6abx3[_0xc098[59]]=function(_0xc6abx6,_0xc6abxb){var _0xc6abxc=[_0xc098[55]];var _0xc6abxd= new mxEventObject(mxEvent.DOUBLE_CLICK,_0xc098[17],_0xc6abx6,_0xc098[60],_0xc6abxb);this[_0xc098[61]](_0xc6abxd);if(this[_0xc098[62]]()&&!mxEvent[_0xc098[63]](_0xc6abx6)&&!_0xc6abxd[_0xc098[63]]()){if(this[_0xc098[65]]()[_0xc098[64]](_0xc6abxb)){if(_0xc6abxc[_0xc098[69]](_0xc6abxb[_0xc098[68]][_0xc098[67]][_0xc098[66]])>=0){this[_0xc098[70]](_0xc6abxb)}}else {if(this[_0xc098[65]]()[_0xc098[71]](_0xc6abxb)){console[_0xc098[72]](_0xc6abx4);console[_0xc098[72]](_0xc6abxb);_0xc6abx4[_0xc098[73]]( new GeneralDialog(_0xc6abx4,_0xc6abxb)[_0xc098[1]],320,280,true,true)}};_0xc6abxd[_0xc098[74]]()}};_0xc6abx3[_0xc098[76]][_0xc098[75]]=true;_0xc6abx3[_0xc098[76]][_0xc098[77]]=mxUtils[_0xc098[20]](this,function(_0xc6abxe,_0xc6abxb,_0xc6abx6){this[_0xc098[13]][_0xc098[78]](_0xc6abxe,_0xc6abxb,_0xc6abx6)});_0xc6abx1[_0xc098[80]][_0xc098[35]](this[_0xc098[79]]);mxEvent[_0xc098[82]](document,mxUtils[_0xc098[20]](this,function(_0xc6abx6){_0xc6abx3[_0xc098[76]][_0xc098[81]]()}));if(mxClient[_0xc098[83]]){mxEvent[_0xc098[33]](_0xc6abx3[_0xc098[1]],_0xc098[84],mxUtils[_0xc098[20]](this,function(_0xc6abx6){_0xc6abx3[_0xc098[89]][_0xc098[88]]()[_0xc098[38]](_0xc098[85],_0xc098[86]+_0xc6abx6[_0xc098[87]]+_0xc098[44]);_0xc6abx3[_0xc098[89]][_0xc098[91]]()[_0xc098[6]][_0xc098[90]]=_0xc098[7]}));mxEvent[_0xc098[33]](_0xc6abx3[_0xc098[1]],_0xc098[92],mxUtils[_0xc098[20]](this,function(_0xc6abx6){_0xc6abx3[_0xc098[89]][_0xc098[88]]()[_0xc098[93]](_0xc098[85]);_0xc6abx3[_0xc098[94]]=true;_0xc6abx3[_0xc098[95]](_0xc6abx6[_0xc098[87]]);_0xc6abx3[_0xc098[89]][_0xc098[91]]()[_0xc098[6]][_0xc098[90]]=_0xc098[96]}))};var _0xc6abxf=this[_0xc098[97]](_0xc6abx1);this[_0xc098[98]]=function(){return _0xc6abxf};mxEvent[_0xc098[33]](window,_0xc098[99],mxUtils[_0xc098[20]](this,function(){this[_0xc098[15]]();_0xc6abx3[_0xc098[100]]();this[_0xc098[0]][_0xc098[80]][_0xc098[101]](false);this[_0xc098[0]][_0xc098[80]][_0xc098[80]][_0xc098[100]]()}));this[_0xc098[35]]();this[_0xc098[102]]()};EditorUi[_0xc098[10]][_0xc098[103]]=(mxClient[_0xc098[83]])?16:8;EditorUi[_0xc098[10]][_0xc098[104]]=33;EditorUi[_0xc098[10]][_0xc098[105]]=36;EditorUi[_0xc098[10]][_0xc098[106]]=28;EditorUi[_0xc098[10]][_0xc098[107]]=204;EditorUi[_0xc098[10]][_0xc098[108]]=190;EditorUi[_0xc098[10]][_0xc098[35]]=function(){this[_0xc098[109]]();this[_0xc098[110]]();var _0xc6abx10=this[_0xc098[12]][_0xc098[112]](_0xc098[111]);var _0xc6abx11=function(){_0xc6abx10[_0xc098[114]](!mxClipboard[_0xc098[113]]())};var _0xc6abx12=mxClipboard[_0xc098[115]];mxClipboard[_0xc098[115]]=function(){_0xc6abx12[_0xc098[50]](this,arguments);_0xc6abx11()};var _0xc6abx13=mxClipboard[_0xc098[116]];mxClipboard[_0xc098[116]]=function(){_0xc6abx13[_0xc098[50]](this,arguments);_0xc6abx11()}};EditorUi[_0xc098[10]][_0xc098[18]]=function(_0xc6abx6){return false};EditorUi[_0xc098[10]][_0xc098[102]]=function(){try{if(window[_0xc098[117]]!=null&&window[_0xc098[117]][_0xc098[118]]!=null){window[_0xc098[117]][_0xc098[118]][_0xc098[130]](mxUtils[_0xc098[20]](this,function(_0xc6abx14,_0xc6abx15){try{var _0xc6abx16=mxUtils[_0xc098[119]](_0xc6abx14);this[_0xc098[0]][_0xc098[121]](_0xc6abx16[_0xc098[120]]);this[_0xc098[0]][_0xc098[122]]=false;this[_0xc098[0]][_0xc098[124]][_0xc098[123]]();if(_0xc6abx15!=null){this[_0xc098[0]][_0xc098[125]]=_0xc6abx15}}catch(e){mxUtils[_0xc098[129]](mxResources[_0xc098[112]](_0xc098[126])+_0xc098[127]+e[_0xc098[128]])}}))}}catch(e){}};EditorUi[_0xc098[10]][_0xc098[131]]=function(_0xc6abx14,_0xc6abx15,_0xc6abx17){try{var _0xc6abx16=mxUtils[_0xc098[119]](_0xc6abx14);this[_0xc098[0]][_0xc098[121]](_0xc6abx16[_0xc098[120]]);this[_0xc098[0]][_0xc098[122]]=false;this[_0xc098[0]][_0xc098[124]][_0xc098[123]]();if(_0xc6abx15!=null){this[_0xc098[0]][_0xc098[125]]=_0xc6abx15};if(_0xc6abx17!=null){this[_0xc098[0]][_0xc098[132]]=_0xc6abx17}}catch(e){mxUtils[_0xc098[129]](mxResources[_0xc098[112]](_0xc098[126])+_0xc098[127]+e[_0xc098[128]])}};EditorUi[_0xc098[10]][_0xc098[133]]=function(_0xc6abx18){var _0xc6abx1=this[_0xc098[0]];if(_0xc6abx18!=null){var _0xc6abx14=mxUtils[_0xc098[135]](this[_0xc098[0]][_0xc098[134]]());try{if(useLocalStorage){if(localStorage[_0xc098[136]](_0xc6abx18)!=null&&!mxUtils[_0xc098[138]](mxResources[_0xc098[112]](_0xc098[137],[_0xc6abx18]))){return};localStorage[_0xc098[139]](_0xc6abx18,_0xc6abx14);this[_0xc098[0]][_0xc098[142]](mxResources[_0xc098[112]](_0xc098[140])+_0xc098[141]+ new Date())}else {console[_0xc098[72]](_0xc6abx14[_0xc098[143]]);console[_0xc098[72]](MAX_REQUEST_SIZE);if(_0xc6abx14[_0xc098[143]]1?false:true};EditorUi[_0xc098[10]][_0xc098[221]]=function(_0xc6abx18){var _0xc6abx1=this[_0xc098[0]];if(_0xc6abx18!=null){var _0xc6abx2a=this[_0xc098[184]]();if(_0xc6abx2a===null){var _0xc6abx14=mxUtils[_0xc098[135]](this[_0xc098[0]][_0xc098[134]]());try{if(useLocalStorage){if(localStorage[_0xc098[136]](_0xc6abx18)!=null&&!mxUtils[_0xc098[138]](mxResources[_0xc098[112]](_0xc098[137],[_0xc6abx18]))){return};localStorage[_0xc098[139]](_0xc6abx18,_0xc6abx14);this[_0xc098[0]][_0xc098[142]](mxResources[_0xc098[112]](_0xc098[140])+_0xc098[141]+ new Date())}else {console[_0xc098[72]](_0xc6abx14[_0xc098[143]]);console[_0xc098[72]](MAX_REQUEST_SIZE);if(_0xc6abx14[_0xc098[143]]0)?1:0;for(var _0xc6abx25 in urlParams){if(_0xc6abx2d==0){_0xc6abx2c+=_0xc098[233]}else {_0xc6abx2c+=_0xc098[234]};_0xc6abx2c+=_0xc6abx25+_0xc098[235]+urlParams[_0xc6abx25];_0xc6abx2d++};return _0xc6abx2c};EditorUi[_0xc098[10]][_0xc098[109]]=function(){var _0xc6abx2e=this[_0xc098[12]][_0xc098[112]](_0xc098[236]);var _0xc6abx2f=this[_0xc098[12]][_0xc098[112]](_0xc098[237]);var _0xc6abx30=this[_0xc098[0]][_0xc098[124]];var _0xc6abx31=function(){_0xc6abx2e[_0xc098[114]](_0xc6abx30[_0xc098[238]]());_0xc6abx2f[_0xc098[114]](_0xc6abx30[_0xc098[239]]())};_0xc6abx30[_0xc098[33]](mxEvent.ADD,_0xc6abx31);_0xc6abx30[_0xc098[33]](mxEvent.UNDO,_0xc6abx31);_0xc6abx30[_0xc098[33]](mxEvent.REDO,_0xc6abx31);_0xc6abx30[_0xc098[33]](mxEvent.CLEAR,_0xc6abx31);_0xc6abx31()};EditorUi[_0xc098[10]][_0xc098[110]]=function(){var _0xc6abx32=mxUtils[_0xc098[20]](this,function(){var _0xc6abx3=this[_0xc098[0]][_0xc098[4]];var _0xc6abx33=!_0xc6abx3[_0xc098[240]]();var _0xc6abx34=false;var _0xc6abx35=false;var _0xc6abx36=_0xc6abx3[_0xc098[241]]();if(_0xc6abx36!=null){for(var _0xc6abx37=0;_0xc6abx37<_0xc6abx36[_0xc098[143]];_0xc6abx37++){var _0xc6abxb=_0xc6abx36[_0xc6abx37];if(_0xc6abx3[_0xc098[65]]()[_0xc098[64]](_0xc6abxb)){_0xc6abx35=true};if(_0xc6abx3[_0xc098[65]]()[_0xc098[71]](_0xc6abxb)){_0xc6abx34=true};if(_0xc6abx35&&_0xc6abx34){break}}};var _0xc6abx38=[_0xc098[115],_0xc098[116],_0xc098[242],_0xc098[243],_0xc098[244],_0xc098[245],_0xc098[6],_0xc098[246],_0xc098[247],_0xc098[248],_0xc098[249],_0xc098[250],_0xc098[251],_0xc098[252],_0xc098[253]];for(var _0xc6abx37=0;_0xc6abx37<_0xc6abx38[_0xc098[143]];_0xc6abx37++){this[_0xc098[12]][_0xc098[112]](_0xc6abx38[_0xc6abx37])[_0xc098[114]](_0xc6abx33)};this[_0xc098[12]][_0xc098[112]](_0xc098[254])[_0xc098[114]](_0xc6abx35);this[_0xc098[12]][_0xc098[112]](_0xc098[255])[_0xc098[114]](_0xc6abx34);this[_0xc098[12]][_0xc098[112]](_0xc098[256])[_0xc098[114]](_0xc6abx34);this[_0xc098[12]][_0xc098[112]](_0xc098[258])[_0xc098[114]](_0xc6abx3[_0xc098[257]]()>1);this[_0xc098[12]][_0xc098[112]](_0xc098[260])[_0xc098[114]](_0xc6abx3[_0xc098[257]]()==1&&_0xc6abx3[_0xc098[65]]()[_0xc098[187]](_0xc6abx3[_0xc098[259]]())>0);var _0xc6abx39=_0xc6abx34&&_0xc6abx3[_0xc098[257]]()==1;this[_0xc098[12]][_0xc098[112]](_0xc098[261])[_0xc098[114]](_0xc6abx39&&_0xc6abx3[_0xc098[65]]()[_0xc098[71]](_0xc6abx3[_0xc098[65]]()[_0xc098[218]](_0xc6abx3[_0xc098[259]]())));var _0xc6abx3a=[_0xc098[262],_0xc098[263],_0xc098[264],_0xc098[265],_0xc098[266],_0xc098[267],_0xc098[268],_0xc098[269],_0xc098[270]];for(var _0xc6abx37=0;_0xc6abx37<_0xc6abx3a[_0xc098[143]];_0xc6abx37++){this[_0xc098[13]][_0xc098[112]](_0xc6abx3a[_0xc6abx37])[_0xc098[114]](_0xc6abx33)};_0xc6abx3a=[_0xc098[271],_0xc098[272],_0xc098[273]];for(var _0xc6abx37=0;_0xc6abx37<_0xc6abx3a[_0xc098[143]];_0xc6abx37++){this[_0xc098[13]][_0xc098[112]](_0xc6abx3a[_0xc6abx37])[_0xc098[114]](_0xc6abx35)};this[_0xc098[12]][_0xc098[112]](_0xc098[274])[_0xc098[114]](_0xc6abx35);this[_0xc098[13]][_0xc098[112]](_0xc098[275])[_0xc098[114]](_0xc6abx3[_0xc098[257]]()>1);this[_0xc098[13]][_0xc098[112]](_0xc098[278])[_0xc098[114]](_0xc6abx34||(_0xc6abx35&&_0xc6abx3[_0xc098[277]](_0xc6abx3[_0xc098[89]][_0xc098[276]](_0xc6abx3[_0xc098[259]]()))));this[_0xc098[13]][_0xc098[112]](_0xc098[281])[_0xc098[114]](_0xc6abx3[_0xc098[279]]&&((_0xc6abx3[_0xc098[89]][_0xc098[280]]!=null)||(_0xc6abx3[_0xc098[257]]()==1&&_0xc6abx3[_0xc098[189]](_0xc6abx3[_0xc098[259]]()))));this[_0xc098[12]][_0xc098[112]](_0xc098[282])[_0xc098[114]](_0xc6abx3[_0xc098[89]][_0xc098[280]]!=null);this[_0xc098[12]][_0xc098[112]](_0xc098[283])[_0xc098[114]](_0xc6abx3[_0xc098[89]][_0xc098[280]]!=null);var _0xc6abx3b=_0xc6abx3[_0xc098[257]]()==1&&_0xc6abx3[_0xc098[189]](_0xc6abx3[_0xc098[259]]());this[_0xc098[12]][_0xc098[112]](_0xc098[284])[_0xc098[114]](_0xc6abx3b);this[_0xc098[12]][_0xc098[112]](_0xc098[285])[_0xc098[114]](_0xc6abx3b);this[_0xc098[12]][_0xc098[112]](_0xc098[286])[_0xc098[114]](_0xc6abx3b);this[_0xc098[12]][_0xc098[112]](_0xc098[287])[_0xc098[114]](_0xc6abx3[_0xc098[257]]()==1);this[_0xc098[12]][_0xc098[112]](_0xc098[289])[_0xc098[114]](_0xc6abx3[_0xc098[257]]()==1&&_0xc6abx3[_0xc098[288]](_0xc6abx3[_0xc098[259]]())!=null)});this[_0xc098[0]][_0xc098[4]][_0xc098[290]]()[_0xc098[33]](mxEvent.CHANGE,_0xc6abx32);_0xc6abx32()};EditorUi[_0xc098[10]][_0xc098[15]]=function(){var _0xc6abx3c=mxClient[_0xc098[29]]&&(document[_0xc098[30]]==null||document[_0xc098[30]]==5);var _0xc6abx3d=this[_0xc098[1]][_0xc098[291]];var _0xc6abx3e=this[_0xc098[1]][_0xc098[292]];if(this[_0xc098[1]]==document[_0xc098[21]]){_0xc6abx3d=document[_0xc098[21]][_0xc098[291]]||document[_0xc098[120]][_0xc098[291]];_0xc6abx3e=(_0xc6abx3c)?document[_0xc098[21]][_0xc098[292]]||document[_0xc098[120]][_0xc098[292]]:document[_0xc098[120]][_0xc098[292]]};var _0xc6abx3f=Math[_0xc098[294]](0,Math[_0xc098[293]](this[_0xc098[107]],_0xc6abx3d-this[_0xc098[103]]-20));var _0xc6abx40=Math[_0xc098[294]](0,Math[_0xc098[293]](this[_0xc098[108]],_0xc6abx3e-this[_0xc098[104]]-this[_0xc098[105]]-this[_0xc098[106]]-this[_0xc098[103]]-1));this[_0xc098[23]][_0xc098[6]][_0xc098[295]]=this[_0xc098[104]]+_0xc098[296];this[_0xc098[25]][_0xc098[6]][_0xc098[297]]=this[_0xc098[104]]+_0xc098[296];this[_0xc098[25]][_0xc098[6]][_0xc098[295]]=this[_0xc098[105]]+_0xc098[296];var _0xc6abx41=this[_0xc098[104]]+this[_0xc098[105]];if(!mxClient[_0xc098[298]]){_0xc6abx41+=1};this[_0xc098[27]][_0xc098[6]][_0xc098[297]]=_0xc6abx41+_0xc098[296];this[_0xc098[27]][_0xc098[6]][_0xc098[299]]=_0xc6abx3f+_0xc098[296];this[_0xc098[79]][_0xc098[6]][_0xc098[299]]=_0xc6abx3f+_0xc098[296];this[_0xc098[79]][_0xc098[6]][_0xc098[295]]=_0xc6abx40+_0xc098[296];this[_0xc098[79]][_0xc098[6]][_0xc098[300]]=this[_0xc098[106]]+_0xc098[296];this[_0xc098[26]][_0xc098[6]][_0xc098[301]]=(_0xc6abx3f+this[_0xc098[103]])+_0xc098[296];this[_0xc098[26]][_0xc098[6]][_0xc098[297]]=this[_0xc098[27]][_0xc098[6]][_0xc098[297]];this[_0xc098[28]][_0xc098[6]][_0xc098[295]]=this[_0xc098[106]]+_0xc098[296];this[_0xc098[28]][_0xc098[6]][_0xc098[302]]=_0xc098[303];this[_0xc098[304]][_0xc098[6]][_0xc098[297]]=this[_0xc098[27]][_0xc098[6]][_0xc098[297]];this[_0xc098[304]][_0xc098[6]][_0xc098[300]]=this[_0xc098[79]][_0xc098[6]][_0xc098[300]];this[_0xc098[304]][_0xc098[6]][_0xc098[301]]=_0xc6abx3f+_0xc098[296];this[_0xc098[305]][_0xc098[6]][_0xc098[299]]=this[_0xc098[27]][_0xc098[6]][_0xc098[299]];this[_0xc098[305]][_0xc098[6]][_0xc098[300]]=(_0xc6abx40+this[_0xc098[106]])+_0xc098[296];if(_0xc6abx3c){this[_0xc098[23]][_0xc098[6]][_0xc098[299]]=_0xc6abx3d+_0xc098[296];this[_0xc098[25]][_0xc098[6]][_0xc098[299]]=this[_0xc098[23]][_0xc098[6]][_0xc098[299]];var _0xc6abx42=(_0xc6abx3e-_0xc6abx40-this[_0xc098[103]]-this[_0xc098[106]]-this[_0xc098[104]]-this[_0xc098[105]]);this[_0xc098[27]][_0xc098[6]][_0xc098[295]]=_0xc6abx42+_0xc098[296];this[_0xc098[26]][_0xc098[6]][_0xc098[299]]=(_0xc6abx3d-_0xc6abx3f-this[_0xc098[103]])+_0xc098[296];var _0xc6abx43=(_0xc6abx3e-this[_0xc098[106]]-this[_0xc098[104]]-this[_0xc098[105]]);this[_0xc098[26]][_0xc098[6]][_0xc098[295]]=_0xc6abx43+_0xc098[296];this[_0xc098[28]][_0xc098[6]][_0xc098[299]]=this[_0xc098[23]][_0xc098[6]][_0xc098[299]];this[_0xc098[304]][_0xc098[6]][_0xc098[295]]=_0xc6abx43+_0xc098[296]}else {this[_0xc098[27]][_0xc098[6]][_0xc098[300]]=(_0xc6abx40+this[_0xc098[103]]+this[_0xc098[106]])+_0xc098[296];this[_0xc098[26]][_0xc098[6]][_0xc098[300]]=this[_0xc098[79]][_0xc098[6]][_0xc098[300]]}};EditorUi[_0xc098[10]][_0xc098[14]]=function(){this[_0xc098[23]]=this[_0xc098[307]](_0xc098[306]);this[_0xc098[25]]=this[_0xc098[307]](_0xc098[308]);this[_0xc098[27]]=this[_0xc098[307]](_0xc098[309]);this[_0xc098[79]]=this[_0xc098[307]](_0xc098[310]);this[_0xc098[26]]=this[_0xc098[307]](_0xc098[311]);this[_0xc098[28]]=this[_0xc098[307]](_0xc098[312]);this[_0xc098[304]]=this[_0xc098[307]](_0xc098[313]);this[_0xc098[305]]=this[_0xc098[307]](_0xc098[314]);this[_0xc098[23]][_0xc098[6]][_0xc098[297]]=_0xc098[315];this[_0xc098[23]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[23]][_0xc098[6]][_0xc098[316]]=_0xc098[315];this[_0xc098[25]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[25]][_0xc098[6]][_0xc098[316]]=_0xc098[315];this[_0xc098[27]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[79]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[26]][_0xc098[6]][_0xc098[316]]=_0xc098[315];this[_0xc098[28]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[28]][_0xc098[6]][_0xc098[316]]=_0xc098[315];this[_0xc098[28]][_0xc098[6]][_0xc098[300]]=_0xc098[315];this[_0xc098[305]][_0xc098[6]][_0xc098[301]]=_0xc098[315];this[_0xc098[305]][_0xc098[6]][_0xc098[295]]=this[_0xc098[103]]+_0xc098[296];this[_0xc098[304]][_0xc098[6]][_0xc098[299]]=this[_0xc098[103]]+_0xc098[296]};EditorUi[_0xc098[10]][_0xc098[16]]=function(){this[_0xc098[317]]=this[_0xc098[13]][_0xc098[319]](this[_0xc098[307]](_0xc098[318]));this[_0xc098[23]][_0xc098[320]](this[_0xc098[317]][_0xc098[1]]);this[_0xc098[321]]=this[_0xc098[323]](this[_0xc098[307]](_0xc098[322]));this[_0xc098[25]][_0xc098[320]](this[_0xc098[321]][_0xc098[1]]);this[_0xc098[324]]=this[_0xc098[325]](this[_0xc098[27]]);this[_0xc098[28]][_0xc098[320]](this[_0xc098[326]]());this[_0xc098[327]]=this[_0xc098[328]]();this[_0xc098[0]][_0xc098[33]](_0xc098[329],mxUtils[_0xc098[20]](this,function(){this[_0xc098[331]](this[_0xc098[0]][_0xc098[330]]())}));this[_0xc098[331]](this[_0xc098[0]][_0xc098[330]]());this[_0xc098[317]][_0xc098[1]][_0xc098[320]](this[_0xc098[327]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[23]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[25]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[27]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[79]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[26]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[28]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[304]]);this[_0xc098[1]][_0xc098[320]](this[_0xc098[305]]);this[_0xc098[332]](this[_0xc098[304]],true,0,mxUtils[_0xc098[20]](this,function(_0xc6abx44){this[_0xc098[107]]=_0xc6abx44;this[_0xc098[15]]();this[_0xc098[0]][_0xc098[4]][_0xc098[100]]();this[_0xc098[0]][_0xc098[80]][_0xc098[101]](false);this[_0xc098[0]][_0xc098[80]][_0xc098[80]][_0xc098[100]]()}));this[_0xc098[332]](this[_0xc098[305]],false,this[_0xc098[106]],mxUtils[_0xc098[20]](this,function(_0xc6abx44){this[_0xc098[108]]=_0xc6abx44;this[_0xc098[15]]();this[_0xc098[0]][_0xc098[80]][_0xc098[101]](false);this[_0xc098[0]][_0xc098[80]][_0xc098[80]][_0xc098[100]]()}))};EditorUi[_0xc098[10]][_0xc098[328]]=function(){var _0xc6abx2=document[_0xc098[334]](_0xc098[333]);_0xc6abx2[_0xc098[335]]=_0xc098[336];return _0xc6abx2};EditorUi[_0xc098[10]][_0xc098[328]]=function(){var _0xc6abx2=document[_0xc098[334]](_0xc098[333]);_0xc6abx2[_0xc098[335]]=_0xc098[336];return _0xc6abx2};EditorUi[_0xc098[10]][_0xc098[331]]=function(_0xc6abx44){this[_0xc098[327]][_0xc098[337]]=_0xc6abx44};EditorUi[_0xc098[10]][_0xc098[323]]=function(_0xc6abx2){return new Toolbar(this,_0xc6abx2)};EditorUi[_0xc098[10]][_0xc098[325]]=function(_0xc6abx2){return new Sidebar(this,_0xc6abx2)};EditorUi[_0xc098[10]][_0xc098[326]]=function(){return this[_0xc098[307]](_0xc098[338])};EditorUi[_0xc098[10]][_0xc098[307]]=function(_0xc6abx45){var _0xc6abx46=document[_0xc098[334]](_0xc098[339]);_0xc6abx46[_0xc098[335]]=_0xc6abx45;return _0xc6abx46};EditorUi[_0xc098[10]][_0xc098[340]]=function(_0xc6abx45){var _0xc6abx46=document[_0xc098[334]](_0xc6abx45);return _0xc6abx46};EditorUi[_0xc098[10]][_0xc098[341]]=function(_0xc6abx45){var _0xc6abx46=document[_0xc098[334]](_0xc098[342]);_0xc6abx46[_0xc098[335]]=_0xc6abx45;return _0xc6abx46};EditorUi[_0xc098[10]][_0xc098[332]]=function(_0xc6abx46,_0xc6abx47,_0xc6abx48,_0xc6abx49){var _0xc6abx4a=null;var _0xc6abx4b=null;function _0xc6abx4c(){return parseInt(((_0xc6abx47)?_0xc6abx46[_0xc098[6]][_0xc098[301]]:_0xc6abx46[_0xc098[6]][_0xc098[300]]))}function _0xc6abx4d(_0xc6abx6){if(_0xc6abx4a!=null){var _0xc6abx4e= new mxPoint(mxEvent[_0xc098[343]](_0xc6abx6),mxEvent[_0xc098[344]](_0xc6abx6));_0xc6abx49(Math[_0xc098[294]](0,_0xc6abx4b+((_0xc6abx47)?(_0xc6abx4e[_0xc098[345]]-_0xc6abx4a[_0xc098[345]]):(_0xc6abx4a[_0xc098[346]]-_0xc6abx4e[_0xc098[346]]))-_0xc6abx48));mxEvent[_0xc098[74]](_0xc6abx6)}}function _0xc6abx4f(_0xc6abx6){_0xc6abx4d(_0xc6abx6);_0xc6abx4a=null;_0xc6abx4b=null}mxEvent[_0xc098[82]](_0xc6abx46,function(_0xc6abx6){_0xc6abx4a= new mxPoint(mxEvent[_0xc098[343]](_0xc6abx6),mxEvent[_0xc098[344]](_0xc6abx6));_0xc6abx4b=_0xc6abx4c();mxEvent[_0xc098[74]](_0xc6abx6)});mxEvent[_0xc098[33]](document,_0xc098[347],_0xc6abx4d);mxEvent[_0xc098[33]](document,_0xc098[348],_0xc6abx4d);mxEvent[_0xc098[33]](document,_0xc098[349],_0xc6abx4f);mxEvent[_0xc098[33]](document,_0xc098[350],_0xc6abx4f)};EditorUi[_0xc098[10]][_0xc098[73]]=function(_0xc6abx46,_0xc6abx3d,_0xc6abx3e,_0xc6abx50,_0xc6abx51,_0xc6abx52){this[_0xc098[351]]();this[_0xc098[352]]= new Dialog(this,_0xc6abx46,_0xc6abx3d,(mxClient[_0xc098[353]])?_0xc6abx3e-12:_0xc6abx3e,_0xc6abx50,_0xc6abx51,_0xc6abx52)};EditorUi[_0xc098[10]][_0xc098[351]]=function(){if(this[_0xc098[352]]!=null){this[_0xc098[352]][_0xc098[354]]();this[_0xc098[352]]=null;this[_0xc098[0]][_0xc098[4]][_0xc098[1]][_0xc098[47]]()}};EditorUi[_0xc098[10]][_0xc098[355]]=function(_0xc6abx53){if(!_0xc6abx53&&this[_0xc098[0]][_0xc098[125]]!=null){this[_0xc098[171]](this[_0xc098[0]][_0xc098[356]]())}else {this[_0xc098[73]]( new SaveDialog(this)[_0xc098[1]],300,100,true,true)}};EditorUi[_0xc098[10]][_0xc098[357]]=function(_0xc6abx53){if(!_0xc6abx53&&this[_0xc098[0]][_0xc098[125]]!=null){this[_0xc098[221]](this[_0xc098[0]][_0xc098[356]]())}else {}};EditorUi[_0xc098[10]][_0xc098[358]]=function(_0xc6abx54,_0xc6abx55,_0xc6abx56){var _0xc6abx3=this[_0xc098[0]][_0xc098[4]];var _0xc6abxb=_0xc6abx3[_0xc098[259]]();_0xc6abx55=this[_0xc098[359]]!=null?this[_0xc098[359]]:_0xc6abx55;_0xc6abx3[_0xc098[65]]()[_0xc098[360]]();try{_0xc6abx54[_0xc098[361]](_0xc6abx3[_0xc098[219]](),_0xc6abxb)}catch(e){throw e}finally{if(_0xc6abx55&&navigator[_0xc098[363]][_0xc098[69]](_0xc098[362])<0){var _0xc6abx57= new mxMorphing(_0xc6abx3);_0xc6abx57[_0xc098[33]](mxEvent.DONE,mxUtils[_0xc098[20]](this,function(){_0xc6abx3[_0xc098[65]]()[_0xc098[364]]()}));_0xc6abx57[_0xc098[365]]()}else {_0xc6abx3[_0xc098[65]]()[_0xc098[364]]()}}};EditorUi[_0xc098[10]][_0xc098[97]]=function(_0xc6abx1){var _0xc6abx3=this[_0xc098[0]][_0xc098[4]];var _0xc6abxf= new mxKeyHandler(_0xc6abx3);_0xc6abxf[_0xc098[366]]=function(_0xc6abx6){return mxEvent[_0xc098[366]](_0xc6abx6)||(mxClient[_0xc098[367]]&&_0xc6abx6[_0xc098[368]])};function _0xc6abx58(_0xc6abx59){if(!_0xc6abx3[_0xc098[240]]()){var _0xc6abx48=0;var _0xc6abx5a=0;if(_0xc6abx59==37){_0xc6abx48= -1}else {if(_0xc6abx59==38){_0xc6abx5a= -1}else {if(_0xc6abx59==39){_0xc6abx48=1}else {if(_0xc6abx59==40){_0xc6abx5a=1}}}};_0xc6abx3[_0xc098[369]](_0xc6abx3[_0xc098[241]](),_0xc6abx48,_0xc6abx5a);_0xc6abx3[_0xc098[370]](_0xc6abx3[_0xc098[259]]())}}var _0xc6abx5b=mxUtils[_0xc098[20]](this,function(_0xc6abx5c,_0xc6abx5d,_0xc6abx25,_0xc6abx5e){var _0xc6abx5f=this[_0xc098[12]][_0xc098[112]](_0xc6abx25);if(_0xc6abx5f!=null){var _0xc6abx1f=function(){if(_0xc6abx5f[_0xc098[371]]){_0xc6abx5f[_0xc098[372]]()}};if(_0xc6abx5d){if(_0xc6abx5e){_0xc6abxf[_0xc098[373]](_0xc6abx5c,_0xc6abx1f)}else {_0xc6abxf[_0xc098[374]](_0xc6abx5c,_0xc6abx1f)}}else {if(_0xc6abx5e){_0xc6abxf[_0xc098[375]](_0xc6abx5c,_0xc6abx1f)}else {_0xc6abxf[_0xc098[376]](_0xc6abx5c,_0xc6abx1f)}}}});var _0xc6abx60=this;var _0xc6abx61=_0xc6abxf[_0xc098[377]];_0xc6abxf[_0xc098[377]]=function(_0xc6abx6){_0xc6abx60[_0xc098[351]]();_0xc6abx61[_0xc098[50]](this,arguments)};_0xc6abxf[_0xc098[378]]=function(){};_0xc6abxf[_0xc098[376]](8,function(){_0xc6abx3[_0xc098[379]](true)});_0xc6abxf[_0xc098[376]](13,function(){_0xc6abx3[_0xc098[379]](false)});_0xc6abxf[_0xc098[376]](33,function(){_0xc6abx3[_0xc098[283]]()});_0xc6abxf[_0xc098[376]](34,function(){_0xc6abx3[_0xc098[284]]()});_0xc6abxf[_0xc098[376]](36,function(){_0xc6abx3[_0xc098[282]]()});_0xc6abxf[_0xc098[376]](35,function(){_0xc6abx3[_0xc098[15]]()});_0xc6abxf[_0xc098[376]](37,function(){_0xc6abx58(37)});_0xc6abxf[_0xc098[376]](38,function(){_0xc6abx58(38)});_0xc6abxf[_0xc098[376]](39,function(){_0xc6abx58(39)});_0xc6abxf[_0xc098[376]](40,function(){_0xc6abx58(40)});_0xc6abxf[_0xc098[376]](113,function(){_0xc6abx3[_0xc098[70]]()});_0xc6abx5b(46,false,_0xc098[242]);_0xc6abx5b(82,true,_0xc098[252]);_0xc6abx5b(83,true,_0xc098[171]);_0xc6abx5b(83,true,_0xc098[179],true);_0xc6abx5b(107,false,_0xc098[380]);_0xc6abx5b(109,false,_0xc098[381]);_0xc6abx5b(65,true,_0xc098[382]);_0xc6abx5b(86,true,_0xc098[383],true);_0xc6abx5b(69,true,_0xc098[384],true);_0xc6abx5b(69,true,_0xc098[385]);_0xc6abx5b(66,true,_0xc098[248]);_0xc6abx5b(70,true,_0xc098[247]);_0xc6abx5b(68,true,_0xc098[243]);_0xc6abx5b(90,true,_0xc098[236]);_0xc6abx5b(89,true,_0xc098[237]);_0xc6abx5b(88,true,_0xc098[115]);_0xc6abx5b(67,true,_0xc098[116]);_0xc6abx5b(81,true,_0xc098[386]);_0xc6abx5b(86,true,_0xc098[111]);_0xc6abx5b(71,true,_0xc098[258]);_0xc6abx5b(71,true,_0xc098[387],true);_0xc6abx5b(85,true,_0xc098[260]);_0xc6abx5b(112,false,_0xc098[388]);_0xc6abx5b(80,true,_0xc098[221],true);return _0xc6abxf};EditorUi[_0xc098[10]][_0xc098[58]]=function(_0xc6abx3,_0xc6abx36,_0xc6abx62,_0xc6abx63){for(var _0xc6abx37=0;_0xc6abx37<_0xc6abx36[_0xc098[143]];_0xc6abx37++){_0xc6abx3[_0xc098[391]]( new mxMultiplicity(true,_0xc6abx36[_0xc6abx37],null,null,_0xc6abx62[_0xc6abx37][0],_0xc6abx62[_0xc6abx37][1],null,mxResources[_0xc098[112]](_0xc6abx36[_0xc6abx37])+_0xc098[389]+_0xc6abx62[_0xc6abx37][0]+_0xc098[390],null));_0xc6abx3[_0xc098[391]]( new mxMultiplicity(false,_0xc6abx36[_0xc6abx37],null,null,_0xc6abx63[_0xc6abx37][0],_0xc6abx63[_0xc6abx37][1],null,mxResources[_0xc098[112]](_0xc6abx36[_0xc6abx37])+_0xc098[389]+_0xc6abx63[_0xc6abx37][0]+_0xc098[392],null))}} \ No newline at end of file +/** + * $Id: EditorUi.js,v 1.21 2013/03/14 20:46:36 david Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph editor + */ +EditorUi = function(editor, container) { + this.editor = editor || new Editor(); + this.container = container || document.getElementById('geEditor'); + var graph = editor.graph; + var self = this; + + // Disables scrollbars + this.container.style.overflow = 'hidden'; + + // Pre-fetches submenu image + new Image().src = mxPopupMenu.prototype.submenuImage; + + // Pre-fetches connect image + if (mxConnectionHandler.prototype.connectImage != null) { + new Image().src = mxConnectionHandler.prototype.connectImage.src; + } + + // Creates the user interface + this.actions = new Actions(this); + this.menus = new Menus(this); + this.createDivs(); + this.refresh(); + this.createUi(); + + // Disables HTML and text selection + var textEditing = mxUtils.bind(this, function(evt) { + if (evt == null) { + evt = window.event; + } + + if (this.isSelectionAllowed(evt)) { + return true; + } + + return graph.isEditing(); + }); + + // Disables text selection while not editing and no dialog visible + if (this.container == document.body) { + this.menubarContainer.onselectstart = textEditing; + this.menubarContainer.onmousedown = textEditing; + this.toolbarContainer.onselectstart = textEditing; + this.toolbarContainer.onmousedown = textEditing; + this.diagramContainer.onselectstart = textEditing; + this.diagramContainer.onmousedown = textEditing; + this.sidebarContainer.onselectstart = textEditing; + this.sidebarContainer.onmousedown = textEditing; + this.footerContainer.onselectstart = textEditing; + this.footerContainer.onmousedown = textEditing; + } + + // And uses built-in context menu while editing + if (mxClient.IS_IE && (typeof(document.documentMode) === 'undefined' || + document.documentMode < 9)) { + mxEvent.addListener(this.diagramContainer, 'contextmenu', textEditing); + mxEvent.addListener(this.sidebarContainer, 'contextmenu', textEditing); + } else { + // Allows browser context menu outside of diagram and sidebar + this.diagramContainer.oncontextmenu = textEditing; + this.sidebarContainer.oncontextmenu = textEditing; + } + + // Contains the main graph instance inside the given panel + graph.init(this.diagramContainer); + graph.refresh(); + + // Enables scrollbars and sets cursor style for the container + graph.container.setAttribute('tabindex', '0'); + // graph.container.style.overflow = (touchStyle) ? 'hidden' : 'auto'; + graph.container.style.cursor = 'default'; + graph.container.style.backgroundImage = 'url(' + editor.gridImage + ')'; + graph.container.style.backgroundPosition = '-1px -1px'; + graph.container.focus(); + + // Keeps graph container focused on mouse down + var graphFireMouseEvent = graph.fireMouseEvent; + graph.fireMouseEvent = function(evtName, me, sender) { + if (evtName == mxEvent.MOUSE_DOWN) { + this.container.focus(); + } + + graphFireMouseEvent.apply(this, arguments); + }; + + // Giuseppe Careri + // Defines invalid connections along with the error messages that they produce. + + this.createMultiplicities(graph.multiplicities, ['start', 'end', 'input', + 'question', 'email' + ], [ + [1, 1], + [0, 0], + [1, 1], + [1, 'n'], + [1, 'n'] + ], [ + [0, 0], + [1, 'n'], + [1, 'n'], + [1, 'n'], + [1, 'n'] + + ]); + + + // Giuseppe Careri + // Processes a doubleclick on an optional cell and fires a event. + // The event is fired initially. + // If the graph is enabled and the event has not been consumed, then is called with the given cell. + // The event is ignored if no cell was specified. + graph.dblClick = function(evt, cell) { + var edges = ['question']; + var mxe = new mxEventObject(mxEvent.DOUBLE_CLICK, 'event', evt, 'cell', + cell); + this.fireEvent(mxe); + + if (this.isEnabled() && !mxEvent.isConsumed(evt) && !mxe.isConsumed()) { + // Override dblClick Vertices and Edges + if (this.getModel().isEdge(cell)) { + if (edges.indexOf(cell.source.value.tagName) >= 0) + this.startEditingAtCell(cell); + } else if (this.getModel().isVertex(cell)) { + console.log(self); + console.log(cell); + self.showDialog(new GeneralDialog(self, cell).container, 320, 280, true, + true); + } + mxe.consume(); + } + } + + // Configures automatic expand on mouseover + graph.panningHandler.autoExpand = true; + + // Installs context menu + graph.panningHandler.factoryMethod = mxUtils.bind(this, function(menu, cell, + evt) { + this.menus.createPopupMenu(menu, cell, evt); + }); + + // Initializes the outline + editor.outline.init(this.outlineContainer); + + // Hides context menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) { + graph.panningHandler.hideMenu(); + })); + + // Adds gesture handling (pinch to zoom) + if (mxClient.IS_TOUCH) { + mxEvent.addListener(graph.container, 'gesturechange', + mxUtils.bind(this, function(evt) { + graph.view.getDrawPane().setAttribute('transform', 'scale(' + evt.scale + + ')'); + graph.view.getOverlayPane().style.visibility = 'hidden'; + }) + ); + + mxEvent.addListener(graph.container, 'gestureend', + mxUtils.bind(this, function(evt) { + graph.view.getDrawPane().removeAttribute('transform'); + graph.zoomToCenter = true; + graph.zoom(evt.scale); + graph.view.getOverlayPane().style.visibility = 'visible'; + }) + ); + } + + // Create handler for key events + var keyHandler = this.createKeyHandler(editor); + + // Getter for key handler + this.getKeyHandler = function() { + return keyHandler; + }; + + // Updates the editor UI after the window has been resized + mxEvent.addListener(window, 'resize', mxUtils.bind(this, function() { + this.refresh(); + graph.sizeDidChange(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); + + // Updates action and menu states + this.init(); + this.open(); +}; + +/** + * Specifies the size of the split bar. + */ +EditorUi.prototype.splitSize = (mxClient.IS_TOUCH) ? 16 : 8; + +/** + * Specifies the height of the menubar. Default is 34. + */ +EditorUi.prototype.menubarHeight = 33; + +/** + * Specifies the height of the toolbar. Default is 36. + */ +EditorUi.prototype.toolbarHeight = 36; + +/** + * Specifies the height of the footer. Default is 28. + */ +EditorUi.prototype.footerHeight = 28; + +/** + * Specifies the position of the horizontal split bar. Default is 212. + */ +EditorUi.prototype.hsplitPosition = 204; + +/** + * Specifies the position of the vertical split bar. Default is 190. + */ +EditorUi.prototype.vsplitPosition = 190; + +/** + * Installs the listeners to update the action states. + */ +EditorUi.prototype.init = function() { + // Updates action states + this.addUndoListener(); + this.addSelectionListener(); + + // Overrides clipboard to update paste action state + var paste = this.actions.get('paste'); + + var updatePaste = function() { + paste.setEnabled(!mxClipboard.isEmpty()); + }; + + var mxClipboardCut = mxClipboard.cut; + mxClipboard.cut = function() { + mxClipboardCut.apply(this, arguments); + updatePaste(); + }; + + var mxClipboardCopy = mxClipboard.copy; + mxClipboard.copy = function() { + mxClipboardCopy.apply(this, arguments); + updatePaste(); + }; +}; + +/** + * Hook for allowing selection and context menu for certain events. + */ +EditorUi.prototype.isSelectionAllowed = function(evt) { + return false; +}; + +/** + * Opens the current diagram via the window.opener if one exists. + */ +EditorUi.prototype.open = function() { + // Cross-domain window access is not allowed in FF, so if we + // were opened from another domain then this will fail. + try { + if (window.opener != null && window.opener.openFile != null) { + window.opener.openFile.setConsumer(mxUtils.bind(this, function(xml, + filename) { + try { + var doc = mxUtils.parseXml(xml); + this.editor.setGraphXml(doc.documentElement); + this.editor.modified = false; + this.editor.undoManager.clear(); + + if (filename != null) { + this.editor.filename = filename; + } + } catch (e) { + mxUtils.alert(mxResources.get('invalidOrMissingFile') + ': ' + e.message); + } + })); + } + } catch (e) { + // ignore + } +}; + +/** + * Giuseppe Careri + * Opens the current diagram via string. + */ +EditorUi.prototype.openString = function(xml, filename, data) { + try { + var doc = mxUtils.parseXml(xml); + this.editor.setGraphXml(doc.documentElement); + this.editor.modified = false; + this.editor.undoManager.clear(); + + if (filename != null) { + this.editor.filename = filename; + } + + if (data != null) { + this.editor.data = data; + } + } catch (e) { + mxUtils.alert(mxResources.get('invalidOrMissingFile') + ': ' + e.message); + } +}; + +/** + * Saves As the current graph under the given project name. + */ +EditorUi.prototype.new = function(name) { + var editor = this.editor; + + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + name = encodeURIComponent(name); + + var xhr = new XMLHttpRequest(); + xhr.open("POST", SAVE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Project ' + JSON.parse(xhr.response).name + + ' is opening in new window!'); + setTimeout(function() { + window.open('jscripty/project/' + JSON.parse(xhr.response).id, + '_blank'); + }, 1500); + } else { + editor.setStatus('Error creating project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('description=project_new&name=' + name); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error creating project'); + } + } else { + this.editor.setStatus('Error creating project'); + } +}; + + +/** + * Saves the current graph under the given project name. + */ +EditorUi.prototype.save = function(name) { + var editor = this.editor; + + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + + var xhr = new XMLHttpRequest(); + xhr.open("PUT", SAVE_URL + this.editor.data.id, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + editor.setStatus('Updated at ' + JSON.parse(xhr.response).updatedAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error saving project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('draft=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error saving file'); + } + } else { + this.editor.setStatus('Error saving file'); + } +}; + +/** + * Saves As the current graph under the given project name. + */ +EditorUi.prototype.saveAs = function(name) { + var editor = this.editor; + console.log(name); + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + name = encodeURIComponent(name); + + var xhr = new XMLHttpRequest(); + xhr.open("POST", SAVE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Project ' + JSON.parse(xhr.response).name + + ' is opening in new window!'); + setTimeout(function() { + window.open('jscripty/project/' + JSON.parse(xhr.response).id, + '_blank'); + }, 1500); + } else { + editor.setStatus('Error cloning project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('description=project_cloned&name=' + name + + '&draft=' + xml + '&production=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error saving file'); + } + } else { + this.editor.setStatus('Error saving file'); + } +}; + +/** + * Plush the current graph under the given project name. + */ +EditorUi.prototype.validate = function(a, b) { + var graph = this.editor.graph; + a = null != a ? a : graph.model.getRoot(); + b = null != b ? b : {}; + for (var c = !0, d = graph.model.getChildCount(a), e = 0; e < d; e++) { + var f = graph.model.getChildAt(a, e), + g = b; + graph.isValidRoot(f) && (g = {}); + g = this.validate(f, g); + null != g ? graph.setCellWarning(f, g.replace(/\n/g, "\x3cbr\x3e")) : graph.setCellWarning(f, null); + c = c && null == g + } + d = ""; + if (graph.model.isVertex(a)) { + switch (a.value.nodeName) { + case 'question': + d = (a.value.getAttribute('question') !== "") ? "" : + 'Question can not be empty' + "\n"; + d += (a.value.getAttribute('label') !== "") ? "" : 'Label can not be empty' + "\n"; + + break; + case 'input': + d = (a.value.getAttribute('question') !== "") ? "" : 'Question can not be empty' + "\n"; + d += (a.value.getAttribute('label') !== "") ? "" : 'Label can not be empty' + "\n"; + + break; + case 'start': + d = this.validateBlock('start') ? '' : "Only one Start block is allowed" + "\n"; + d += (a.value.getAttribute('label') !== "") ? "" : 'Label can not be empty' + "\n"; + + break; + } + } + + if (graph.model.isEdge(a)) { + var z = graph.model.getCell(a.source.getId()); + switch (z.value.nodeName) { + case 'question': + // var patt = /^[a-zA-Z0-9][a-zA-Z0-9\s]*$/; + var str = String(a.getValue()); + console.log(str); + if (str === 'null' || str === 'undefined') { + d = "Value can not be empty" + "\n"; + } else { + var result = str.split(","); + result.forEach(function(entry, key) { + d = d + ((entry.trim() !== "") ? "" : 'Value' + (key + 1) + ' can not be empty' + "\n"); + }); + } + // console.log(a.getValue()); + // if ((str == 'undefined') || (str == 'null')) { + // str = ' '; + // } + // d = ((a.getValue() !== "") && (a.getValue() !== 'undefined') && (a.getValue() !== null)) ? '' : "Value can not be empty" + "\n"; + // d = d + ((patt.test(str.trim())) ? "" : 'Value can not be empty' + "\n"); + // + // res.forEach(function(entry) { + // d = d + ((patt.test(entry.trim())) ? "" : 'Can not be empty' + "\n"); + // }); + break; + + } + } + + graph.isCellCollapsed(a) && !c && (d += (mxResources.get(graph.containsValidationErrorsResource) || graph.containsValidationErrorsResource) + "\n"); + d = graph.model.isEdge(a) ? d + (graph.getEdgeValidationError(a, graph.model.getTerminal(a, !0), graph.model.getTerminal(a, !1)) || "") : d + (graph.getCellValidationError(a) || ""); + e = graph.validateCell(a, b); + null != e && (d += e); + null == graph.model.getParent(a) && graph.view.validate(); + return 0 < d.length || !c ? d : null +} + +EditorUi.prototype.validateBlock = function(blockName) { + var graph = this.editor.graph; + var parent = graph.getDefaultParent(); + var count = 0; + // var model = graph.getModel(); + //We can also use model.getChildren(parent) + parent.children.forEach(function(n) { + if (graph.model.isVertex(n) && n.value.nodeName == blockName) { + count++; + } + }); + return count > 1 ? false : true; +} + +EditorUi.prototype.publish = function(name) { + + var editor = this.editor; + + if (name != null) { + + var response = this.validate(); + if (response === null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + + var xhr = new XMLHttpRequest(); + xhr.open("PUT", SAVE_URL + this.editor.data.id, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + editor.setStatus('Published at ' + JSON.parse(xhr.response).updatedAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error saving project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('draft=' + xml + '&production=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error publishing file'); + } + } else { + editor.setStatus('Error publishing project: '); + } + } else { + this.editor.setStatus('Error publishing file'); + } + // } + + + +}; + +/** + * Create variable + */ +EditorUi.prototype.variable = function(name) { + var editor = this.editor; + + if (name != null) { + try { + + var xhr = new XMLHttpRequest(); + xhr.open("POST", VARIABLE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Variable created at ' + JSON.parse(xhr.response).createdAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error cloning project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('name=' + name); + } catch (e) { + this.editor.setStatus('Error creating variable'); + } + } else { + this.editor.setStatus('Error creating variable'); + } +}; + +/** + * Returns the URL for a copy of this editor with no state. + */ +EditorUi.prototype.getUrl = function(pathname) { + var href = (pathname != null) ? pathname : window.location.pathname; + var parms = (href.indexOf('?') > 0) ? 1 : 0; + + // Removes template URL parameter for new blank diagram + for (var key in urlParams) { + if (parms == 0) { + href += '?'; + } else { + href += '&'; + } + + href += key + '=' + urlParams[key]; + parms++; + } + + return href; +}; + +/** + * Updates the states of the given undo/redo items. + */ +EditorUi.prototype.addUndoListener = function() { + var undo = this.actions.get('undo'); + var redo = this.actions.get('redo'); + + var undoMgr = this.editor.undoManager; + + var undoListener = function() { + undo.setEnabled(undoMgr.canUndo()); + redo.setEnabled(undoMgr.canRedo()); + }; + + undoMgr.addListener(mxEvent.ADD, undoListener); + undoMgr.addListener(mxEvent.UNDO, undoListener); + undoMgr.addListener(mxEvent.REDO, undoListener); + undoMgr.addListener(mxEvent.CLEAR, undoListener); + + // Updates the button states once + undoListener(); +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +EditorUi.prototype.addSelectionListener = function() { + var selectionListener = mxUtils.bind(this, function() { + var graph = this.editor.graph; + var selected = !graph.isSelectionEmpty(); + var vertexSelected = false; + var edgeSelected = false; + + var cells = graph.getSelectionCells(); + + if (cells != null) { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().isEdge(cell)) { + edgeSelected = true; + } + + if (graph.getModel().isVertex(cell)) { + vertexSelected = true; + } + + if (edgeSelected && vertexSelected) { + break; + } + } + } + + // Updates action states + var actions = ['cut', 'copy', 'delete', 'duplicate', 'bold', 'italic', + 'style', 'underline', 'toFront', 'toBack', 'dashed', 'rounded', + 'shadow', + 'tilt', 'autosize' + ]; + + for (var i = 0; i < actions.length; i++) { + this.actions.get(actions[i]).setEnabled(selected); + } + + this.actions.get('curved').setEnabled(edgeSelected); + this.actions.get('rotation').setEnabled(vertexSelected); + this.actions.get('wordWrap').setEnabled(vertexSelected); + this.actions.get('group').setEnabled(graph.getSelectionCount() > 1); + this.actions.get('ungroup').setEnabled(graph.getSelectionCount() == 1 && + graph.getModel().getChildCount(graph.getSelectionCell()) > 0); + var oneVertexSelected = vertexSelected && graph.getSelectionCount() == 1; + this.actions.get('removeFromGroup').setEnabled(oneVertexSelected && + graph.getModel().isVertex(graph.getModel().getParent(graph.getSelectionCell())) + ); + + // Updates menu states + var menus = ['fontFamily', 'fontSize', 'alignment', 'position', 'text', + 'format', + 'arrange', 'linewidth', 'spacing' + ]; + + for (var i = 0; i < menus.length; i++) { + this.menus.get(menus[i]).setEnabled(selected); + } + + menus = ['line', 'lineend', 'linestart']; + + for (var i = 0; i < menus.length; i++) { + this.menus.get(menus[i]).setEnabled(edgeSelected); + } + + this.actions.get('setAsDefaultEdge').setEnabled(edgeSelected); + + this.menus.get('align').setEnabled(graph.getSelectionCount() > 1); + this.menus.get('direction').setEnabled(vertexSelected || (edgeSelected && + graph.isLoop(graph.view.getState(graph.getSelectionCell())))); + this.menus.get('navigation').setEnabled(graph.foldingEnabled && ((graph.view + .currentRoot != null) || + (graph.getSelectionCount() == 1 && graph.isValidRoot(graph.getSelectionCell())) + )); + this.actions.get('home').setEnabled(graph.view.currentRoot != null); + this.actions.get('exitGroup').setEnabled(graph.view.currentRoot != null); + var groupEnabled = graph.getSelectionCount() == 1 && graph.isValidRoot( + graph.getSelectionCell()); + this.actions.get('enterGroup').setEnabled(groupEnabled); + this.actions.get('expand').setEnabled(groupEnabled); + this.actions.get('collapse').setEnabled(groupEnabled); + this.actions.get('editLink').setEnabled(graph.getSelectionCount() == 1); + this.actions.get('openLink').setEnabled(graph.getSelectionCount() == 1 && + graph.getLinkForCell(graph.getSelectionCell()) != null); + }); + + this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE, + selectionListener); + selectionListener(); +}; + +/** + * Refreshes the viewport. + */ +EditorUi.prototype.refresh = function() { + var quirks = mxClient.IS_IE && (document.documentMode == null || document.documentMode == + 5); + var w = this.container.clientWidth; + var h = this.container.clientHeight; + + if (this.container == document.body) { + w = document.body.clientWidth || document.documentElement.clientWidth; + h = (quirks) ? document.body.clientHeight || document.documentElement.clientHeight : + document.documentElement.clientHeight; + } + + var effHsplitPosition = Math.max(0, Math.min(this.hsplitPosition, w - this.splitSize - + 20)); + var effVsplitPosition = Math.max(0, Math.min(this.vsplitPosition, h - this.menubarHeight - + this.toolbarHeight - this.footerHeight - 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 tmp = this.menubarHeight + this.toolbarHeight; + + if (!mxClient.IS_QUIRKS) { + tmp += 1; + } + + this.sidebarContainer.style.top = tmp + 'px'; + this.sidebarContainer.style.width = effHsplitPosition + 'px'; + this.outlineContainer.style.width = effHsplitPosition + 'px'; + this.outlineContainer.style.height = effVsplitPosition + 'px'; + this.outlineContainer.style.bottom = this.footerHeight + 'px'; + this.diagramContainer.style.left = (effHsplitPosition + this.splitSize) + + 'px'; + this.diagramContainer.style.top = this.sidebarContainer.style.top; + this.footerContainer.style.height = this.footerHeight + 'px'; + this.footerContainer.style.display = 'none'; + this.hsplit.style.top = this.sidebarContainer.style.top; + this.hsplit.style.bottom = this.outlineContainer.style.bottom; + this.hsplit.style.left = effHsplitPosition + 'px'; + this.vsplit.style.width = this.sidebarContainer.style.width; + this.vsplit.style.bottom = (effVsplitPosition + this.footerHeight) + 'px'; + + if (quirks) { + this.menubarContainer.style.width = w + 'px'; + this.toolbarContainer.style.width = this.menubarContainer.style.width; + var sidebarHeight = (h - effVsplitPosition - this.splitSize - this.footerHeight - + this.menubarHeight - this.toolbarHeight); + this.sidebarContainer.style.height = sidebarHeight + 'px'; + this.diagramContainer.style.width = (w - effHsplitPosition - this.splitSize) + + 'px'; + var diagramHeight = (h - this.footerHeight - this.menubarHeight - this.toolbarHeight); + this.diagramContainer.style.height = diagramHeight + 'px'; + this.footerContainer.style.width = this.menubarContainer.style.width; + this.hsplit.style.height = diagramHeight + 'px'; + } else { + this.sidebarContainer.style.bottom = (effVsplitPosition + this.splitSize + + this.footerHeight) + 'px'; + this.diagramContainer.style.bottom = this.outlineContainer.style.bottom; + } +}; + +/** + * Creates the required containers. + */ +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'); + + // Sets static style for containers + 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.left = '0px'; + 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'; +}; + +/** + * Creates the required containers. + */ +EditorUi.prototype.createUi = function() { + // Creates menubar + this.menubar = this.menus.createMenubar(this.createDiv('geMenubar')); + this.menubarContainer.appendChild(this.menubar.container); + + // Creates toolbar + this.toolbar = this.createToolbar(this.createDiv('geToolbar')); + this.toolbarContainer.appendChild(this.toolbar.container); + + // Creates the sidebar + this.sidebar = this.createSidebar(this.sidebarContainer); + + // Creates the footer + this.footerContainer.appendChild(this.createFooter()); + + // Adds status bar in menubar + this.statusContainer = this.createStatusContainer(); + + // Connects the status bar to the editor status + this.editor.addListener('statusChanged', mxUtils.bind(this, function() { + this.setStatusText(this.editor.getStatus()); + })); + + this.setStatusText(this.editor.getStatus()); + this.menubar.container.appendChild(this.statusContainer); + + // Inserts into DOM + this.container.appendChild(this.menubarContainer); + this.container.appendChild(this.toolbarContainer); + this.container.appendChild(this.sidebarContainer); + this.container.appendChild(this.outlineContainer); + this.container.appendChild(this.diagramContainer); + this.container.appendChild(this.footerContainer); + this.container.appendChild(this.hsplit); + this.container.appendChild(this.vsplit); + + // HSplit + this.addSplitHandler(this.hsplit, true, 0, mxUtils.bind(this, function( + value) { + this.hsplitPosition = value; + this.refresh(); + this.editor.graph.sizeDidChange(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); + + // VSplit + this.addSplitHandler(this.vsplit, false, this.footerHeight, mxUtils.bind( + this, + function(value) { + this.vsplitPosition = value; + this.refresh(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createStatusContainer = function() { + var container = document.createElement('a'); + container.className = 'geItem geStatus'; + + return container; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createStatusContainer = function() { + var container = document.createElement('a'); + container.className = 'geItem geStatus'; + + return container; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.setStatusText = function(value) { + this.statusContainer.innerHTML = value; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createToolbar = function(container) { + return new Toolbar(this, container); +}; + +/** + * Creates a new sidebar for the given container. + */ +EditorUi.prototype.createSidebar = function(container) { + return new Sidebar(this, container); +}; + +/** + * Creates and returns a new footer. + */ +EditorUi.prototype.createFooter = function() { + return this.createDiv('geFooter'); +}; + +/** + * Creates the actual toolbar for the toolbar container. + */ +EditorUi.prototype.createDiv = function(classname) { + var elt = document.createElement('div'); + elt.className = classname; + + return elt; +}; + +/** + * Creates the custom header. + */ +EditorUi.prototype.createHeader = function(classname) { + var elt = document.createElement(classname); + return elt; +}; + +/** + * Creates the custom header. + */ +EditorUi.prototype.createForm = function(classname) { + var elt = document.createElement('form'); + elt.className = classname; + + return elt; +}; + +/** + * Updates the states of the given undo/redo items. + */ +EditorUi.prototype.addSplitHandler = function(elt, horizontal, dx, onChange) { + var start = null; + var initial = null; + + function getValue() { + return parseInt(((horizontal) ? elt.style.left : elt.style.bottom)); + }; + + function moveHandler(evt) { + if (start != null) { + var pt = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + onChange(Math.max(0, initial + ((horizontal) ? (pt.x - start.x) : (start.y - + pt.y)) - dx)); + mxEvent.consume(evt); + } + }; + + function dropHandler(evt) { + moveHandler(evt); + start = null; + initial = null; + }; + + mxEvent.addGestureListeners(elt, function(evt) { + start = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + initial = getValue(); + mxEvent.consume(evt); + }); + + mxEvent.addListener(document, 'mousemove', moveHandler); + mxEvent.addListener(document, 'touchmove', moveHandler); + mxEvent.addListener(document, 'mouseup', dropHandler); + mxEvent.addListener(document, 'touchend', dropHandler); +}; + +/** + * Displays a print dialog. + */ +EditorUi.prototype.showDialog = function(elt, w, h, modal, closable, onClose) { + this.hideDialog(); + this.dialog = new Dialog(this, elt, w, (mxClient.IS_VML) ? h - 12 : h, + modal, + closable, onClose); +}; + +/** + * Displays a print dialog. + */ +EditorUi.prototype.hideDialog = function() { + if (this.dialog != null) { + this.dialog.close(); + this.dialog = null; + this.editor.graph.container.focus(); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +EditorUi.prototype.saveFile = function(forceDialog) { + if (!forceDialog && this.editor.filename != null) { + this.save(this.editor.getOrCreateFilename()); + } else { + this.showDialog(new SaveDialog(this).container, 300, 100, true, true); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +EditorUi.prototype.publishFile = function(forceDialog) { + if (!forceDialog && this.editor.filename != null) { + this.publish(this.editor.getOrCreateFilename()); + } else { + //this.showDialog(new SaveDialog(this).container, 300, 100, true, true); + } +}; + +/** + * Executes the given layout. + */ +EditorUi.prototype.executeLayout = function(layout, animate, ignoreChildCount) { + var graph = this.editor.graph; + var cell = graph.getSelectionCell(); + + // Allow global overridding of animation + animate = this.animate != null ? this.animate : animate; + + graph.getModel().beginUpdate(); + try { + layout.execute(graph.getDefaultParent(), cell); + } catch (e) { + throw e; + } finally { + // Animates the changes in the graph model except + // for Camino, where animation is too slow + if (animate && navigator.userAgent.indexOf('Camino') < 0) { + // New API for animating graph layout results asynchronously + var morph = new mxMorphing(graph); + morph.addListener(mxEvent.DONE, mxUtils.bind(this, function() { + graph.getModel().endUpdate(); + })); + + morph.startAnimation(); + } else { + graph.getModel().endUpdate(); + } + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +EditorUi.prototype.createKeyHandler = function(editor) { + var graph = this.editor.graph; + var keyHandler = new mxKeyHandler(graph); + + // Routes command-key to control-key on Mac + keyHandler.isControlDown = function(evt) { + return mxEvent.isControlDown(evt) || (mxClient.IS_MAC && evt.metaKey); + }; + + // Helper function to move cells with the cursor keys + function nudge(keyCode) { + if (!graph.isSelectionEmpty()) { + var dx = 0; + var dy = 0; + + if (keyCode == 37) { + dx = -1; + } else if (keyCode == 38) { + dy = -1; + } else if (keyCode == 39) { + dx = 1; + } else if (keyCode == 40) { + dy = 1; + } + + graph.moveCells(graph.getSelectionCells(), dx, dy); + graph.scrollCellToVisible(graph.getSelectionCell()); + } + }; + + // Binds keystrokes to actions + var bindAction = mxUtils.bind(this, function(code, control, key, shift) { + var action = this.actions.get(key); + + if (action != null) { + var f = function() { + if (action.enabled) { + action.funct(); + } + }; + + if (control) { + if (shift) { + keyHandler.bindControlShiftKey(code, f); + } else { + keyHandler.bindControlKey(code, f); + } + } else { + if (shift) { + keyHandler.bindShiftKey(code, f); + } else { + keyHandler.bindKey(code, f); + } + } + } + }); + + var ui = this; + var keyHandleEscape = keyHandler.escape; + keyHandler.escape = function(evt) { + ui.hideDialog(); + keyHandleEscape.apply(this, arguments); + }; + + // Ignores enter keystroke. Remove this line if you want the + // enter keystroke to stop editing. + keyHandler.enter = function() {}; + keyHandler.bindKey(8, function() { + graph.foldCells(true); + }); // Backspace + keyHandler.bindKey(13, function() { + graph.foldCells(false); + }); // Enter + keyHandler.bindKey(33, function() { + graph.exitGroup(); + }); // Page Up + keyHandler.bindKey(34, function() { + graph.enterGroup(); + }); // Page Down + keyHandler.bindKey(36, function() { + graph.home(); + }); // Home + keyHandler.bindKey(35, function() { + graph.refresh(); + }); // End + keyHandler.bindKey(37, function() { + nudge(37); + }); // Left arrow + keyHandler.bindKey(38, function() { + nudge(38); + }); // Up arrow + keyHandler.bindKey(39, function() { + nudge(39); + }); // Right arrow + keyHandler.bindKey(40, function() { + nudge(40); + }); // Down arrow + keyHandler.bindKey(113, function() { + graph.startEditingAtCell(); + }); + bindAction(46, false, 'delete'); // Delete + bindAction(82, true, 'tilt'); // Ctrl+R + bindAction(83, true, 'save'); // Ctrl+S + bindAction(83, true, 'saveAs', true); // Ctrl+Shift+S + bindAction(107, false, 'zoomIn'); // Add + bindAction(109, false, 'zoomOut'); // Subtract + bindAction(65, true, 'selectAll'); // Ctrl+A + bindAction(86, true, 'selectVertices', true); // Ctrl+Shift+V + bindAction(69, true, 'selectEdges', true); // Ctrl+Shift+E + bindAction(69, true, 'export'); // Ctrl+Shift+E + bindAction(66, true, 'toBack'); // Ctrl+B + bindAction(70, true, 'toFront'); // Ctrl+F + bindAction(68, true, 'duplicate'); // Ctrl+D + bindAction(90, true, 'undo'); // Ctrl+Z + bindAction(89, true, 'redo'); // Ctrl+Y + bindAction(88, true, 'cut'); // Ctrl+X + bindAction(67, true, 'copy'); // Ctrl+C + bindAction(81, true, 'connect'); // Ctrl+Q + bindAction(86, true, 'paste'); // Ctrl+V + bindAction(71, true, 'group'); // Ctrl+G + bindAction(71, true, 'grid', true); // Ctrl+Shift+G + bindAction(85, true, 'ungroup'); // Ctrl+U + bindAction(112, false, 'about'); // F1 + bindAction(80, true, 'publish', true); // Ctrl+Shift+P + + return keyHandler; +}; + +/** + * Giuseppe Careri + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createMultiplicities = function(graph, cells, source, + target) { + for (var i = 0; i < cells.length; i++) { + graph.push(new mxMultiplicity(true, cells[i], null, null, source[i][0], + source[i][1], null, mxResources.get(cells[i]) + ' must have ' + source[i][0] + ' outgoing edge.', null)); + graph.push(new mxMultiplicity(false, cells[i], null, null, target[i][0], + target[i][1], null, mxResources.get(cells[i]) + ' must have ' + target[i][0] + ' incoming edge.', null)); + }; +}; diff --git a/public/assets/plugins/jscripty/js/Graph.js b/public/assets/plugins/jscripty/js/Graph.js index 957c3a1..46f34e4 100644 --- a/public/assets/plugins/jscripty/js/Graph.js +++ b/public/assets/plugins/jscripty/js/Graph.js @@ -1 +1,748 @@ -var _0x151b=["\x63\x61\x6C\x6C","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x44\x72\x6F\x70\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x50\x61\x6E\x6E\x69\x6E\x67","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x4C\x6F\x6F\x70\x73","\x73\x65\x74\x4D\x75\x6C\x74\x69\x67\x72\x61\x70\x68","\x61\x6C\x6C\x6F\x77\x41\x75\x74\x6F\x50\x61\x6E\x6E\x69\x6E\x67","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73\x4F\x6E\x43\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64\x72\x65\x6E","\x74\x61\x72\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x44\x61\x6E\x67\x6C\x69\x6E\x67\x45\x64\x67\x65\x73","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x69\x73\x56\x61\x6C\x69\x64\x53\x6F\x75\x72\x63\x65","\x61\x70\x70\x6C\x79","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x6E\x65\x63\x74","\x32","\x61\x6C\x74\x65\x72\x6E\x61\x74\x65\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x76\x65\x72\x74\x69\x63\x61\x6C","\x6C\x6F\x61\x64\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x67\x65\x74\x52\x75\x62\x62\x65\x72\x62\x61\x6E\x64","\x63\x75\x72\x73\x6F\x72","\x73\x74\x79\x6C\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x70\x6F\x69\x6E\x74\x65\x72","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x64\x65\x66\x61\x75\x6C\x74","\x69\x73\x48\x74\x6D\x6C\x4C\x61\x62\x65\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x76\x69\x65\x77","\x67\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x68\x74\x6D\x6C","\x31","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x77\x72\x61\x70","\x67\x65\x74\x4C\x61\x62\x65\x6C\x56\x61\x6C\x75\x65","\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x68\x74\x6D\x6C\x45\x6E\x74\x69\x74\x69\x65\x73","\x69\x73\x43\x65\x6C\x6C\x4C\x6F\x63\x6B\x65\x64","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64","\x61\x63\x74\x69\x76\x65","\x67\x72\x61\x70\x68","\x67\x65\x74\x47\x72\x61\x70\x68\x58","\x67\x65\x74\x47\x72\x61\x70\x68\x59","\x73\x74\x61\x72\x74","\x70\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x63\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x72\x65\x6D\x6F\x76\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x69\x6E\x69\x74\x54\x6F\x75\x63\x68","\x65\x78\x74\x65\x6E\x64","\x6D\x69\x6E\x46\x69\x74\x53\x63\x61\x6C\x65","\x6D\x61\x78\x46\x69\x74\x53\x63\x61\x6C\x65","\x67\x65\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x2F\x64\x65\x66\x61\x75\x6C\x74\x2E\x78\x6D\x6C","\x6C\x6F\x61\x64","\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x67\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x64\x65\x63\x6F\x64\x65","\x66\x6C\x69\x70\x45\x64\x67\x65","\x67\x65\x74\x56\x61\x6C\x75\x65","\x45\x4C\x42\x4F\x57\x5F\x48\x4F\x52\x49\x5A\x4F\x4E\x54\x41\x4C","\x45\x4C\x42\x4F\x57\x5F\x56\x45\x52\x54\x49\x43\x41\x4C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x63\x6C\x6F\x6E\x65\x43\x65\x6C\x6C\x73","\x67\x65\x6F\x6D\x65\x74\x72\x79","\x70\x6F\x69\x6E\x74\x73","\x67\x65\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x53\x74\x79\x6C\x65","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x53\x74\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x53\x74\x61\x74\x65","\x66\x61\x63\x74\x6F\x72\x79\x4D\x65\x74\x68\x6F\x64","\x69\x73\x43\x65\x6C\x6C\x46\x6F\x6C\x64\x61\x62\x6C\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x63\x72\x65\x61\x74\x65\x47\x72\x6F\x75\x70\x43\x65\x6C\x6C","\x67\x72\x6F\x75\x70","\x67\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x46\x6F\x72\x43\x65\x6C\x6C","","\x69\x73\x56\x65\x72\x74\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x5F","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x67\x65\x74","\x63\x6F\x6E\x76\x65\x72\x74\x56\x61\x6C\x75\x65\x54\x6F\x53\x74\x72\x69\x6E\x67","\x6F\x62\x6A\x65\x63\x74","\x6C\x61\x62\x65\x6C","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x65\x6C\x6C\x4C\x61\x62\x65\x6C\x43\x68\x61\x6E\x67\x65\x64","\x63\x6C\x6F\x6E\x65\x4E\x6F\x64\x65","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x73\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x55\x73\x65\x72\x4F\x62\x6A\x65\x63\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6E\x6B","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x73\x65\x74\x56\x61\x6C\x75\x65","\x6D\x6F\x64\x65\x6C","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x6D\x61\x72\x6B\x65\x72","\x66\x69\x72\x73\x74","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x75\x70\x64\x61\x74\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x67\x72\x61\x70\x68\x58","\x67\x72\x61\x70\x68\x59","\x67\x65\x74\x43\x65\x6C\x6C\x41\x74","\x73\x74\x61\x74\x65","\x73\x68\x61\x70\x65","\x6E\x6F\x64\x65","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x4D\x4F\x55\x53\x45\x5F\x44\x4F\x57\x4E","\x69\x73\x4D\x65\x6E\x75\x53\x68\x6F\x77\x69\x6E\x67","\x67\x65\x74\x43\x65\x6C\x6C","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x4D\x4F\x55\x53\x45\x5F\x55\x50","\x69\x73\x45\x64\x69\x74\x69\x6E\x67","\x67\x65\x74\x45\x76\x65\x6E\x74","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x70\x6F\x70\x75\x70","\x63\x6F\x6E\x73\x75\x6D\x65","\x4D\x4F\x55\x53\x45\x5F\x4D\x4F\x56\x45","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x54\x6F\x70","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x42\x6F\x74\x74\x6F\x6D","\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x74\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x67\x72\x69\x64\x53\x69\x7A\x65","\x73\x65\x6C\x65\x63\x74\x4F\x6E\x50\x6F\x70\x75\x70","\x75\x73\x65\x4C\x65\x66\x74\x42\x75\x74\x74\x6F\x6E\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x69\x73\x50\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x69\x67\x6E\x6F\x72\x65\x43\x65\x6C\x6C","\x69\x73\x43\x6F\x6E\x74\x72\x6F\x6C\x44\x6F\x77\x6E","\x69\x73\x53\x68\x69\x66\x74\x44\x6F\x77\x6E","\x75\x73\x65\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x69\x73\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x6D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x64\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x63\x6F\x6E\x76\x65\x72\x74\x50\x6F\x69\x6E\x74","\x78","\x79","\x2F\x74\x6F\x75\x63\x68\x2D\x68\x61\x6E\x64\x6C\x65\x2E\x70\x6E\x67","\x68\x61\x6E\x64\x6C\x65\x49\x6D\x61\x67\x65","\x73\x69\x7A\x65\x72\x49\x6D\x61\x67\x65","\x73\x72\x63","\x2F\x74\x6F\x75\x63\x68\x2D\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x2E\x70\x6E\x67","\x69\x6E\x69\x74","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x49\x6D\x67","\x63\x72\x65\x61\x74\x65\x49\x6D\x61\x67\x65","\x77\x69\x64\x74\x68","\x32\x39\x70\x78","\x68\x65\x69\x67\x68\x74","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x74\x69\x74\x6C\x65","\x72\x65\x64\x69\x72\x65\x63\x74\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73","\x70\x61\x64\x64\x69\x6E\x67","\x32\x70\x78","\x69\x73\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x72\x65\x64\x72\x61\x77\x54\x6F\x6F\x6C\x73","\x72\x65\x64\x72\x61\x77","\x73\x69\x6E\x67\x6C\x65\x53\x69\x7A\x65\x72","\x6C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x70\x78","\x74\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x2F\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x2E\x70\x6E\x67","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x49\x53\x5F\x49\x45","\x49\x53\x5F\x53\x56\x47","\x64\x69\x76","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x63\x65\x6E\x74\x65\x72","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x64\x69\x73\x70\x6C\x61\x79","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x69\x6E\x6C\x69\x6E\x65","\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E"];Graph=function(_0xebe9x1,_0xebe9x2,_0xebe9x3,_0xebe9x4){mxGraph[_0x151b[0]](this,_0xebe9x1,_0xebe9x2,_0xebe9x3,_0xebe9x4);this[_0x151b[1]](true);this[_0x151b[2]](false);this[_0x151b[3]](true);this[_0x151b[4]](!mxClient.IS_TOUCH);this[_0x151b[5]](false);this[_0x151b[6]](false);this[_0x151b[7]]=true;this[_0x151b[8]]=false;this[_0x151b[9]]=false;this[_0x151b[11]][_0x151b[10]]=true;this[_0x151b[12]](false);this[_0x151b[11]][_0x151b[13]](false);this[_0x151b[11]][_0x151b[14]]=function(){return mxConnectionHandler[_0x151b[16]][_0x151b[14]][_0x151b[15]](this,arguments)&&urlParams[_0x151b[17]]!=_0x151b[18]};this[_0x151b[19]]=_0x151b[20];if(_0xebe9x4==null){this[_0x151b[21]]()};var _0xebe9x5= new mxRubberband(this);this[_0x151b[22]]=function(){return _0xebe9x5};this[_0x151b[29]][_0x151b[28]](mxEvent.PAN_START,mxUtils[_0x151b[27]](this,function(){this[_0x151b[25]][_0x151b[24]][_0x151b[23]]=_0x151b[26]}));this[_0x151b[29]][_0x151b[28]](mxEvent.PAN_END,mxUtils[_0x151b[27]](this,function(){this[_0x151b[25]][_0x151b[24]][_0x151b[23]]=_0x151b[30]}));this[_0x151b[31]]=function(_0xebe9x6){var _0xebe9x7=this[_0x151b[33]][_0x151b[32]](_0xebe9x6);var _0xebe9x8=(_0xebe9x7!=null)?_0xebe9x7[_0x151b[24]]:this[_0x151b[34]](_0xebe9x6);return _0xebe9x8[_0x151b[35]]==_0x151b[36]||_0xebe9x8[_0x151b[37]]==_0x151b[38]};this[_0x151b[40]][_0x151b[39]]=function(_0xebe9x7){var _0xebe9x9=mxCellRenderer[_0x151b[16]][_0x151b[39]][_0x151b[15]](this,arguments);if(_0xebe9x7[_0x151b[24]][_0x151b[37]]==_0x151b[38]&&_0xebe9x7[_0x151b[24]][_0x151b[35]]!=1){_0xebe9x9=mxUtils[_0x151b[41]](_0xebe9x9,false)};return _0xebe9x9};this[_0x151b[42]]=function(_0xebe9x6){return false};this[_0x151b[11]][_0x151b[43]]=16;var _0xebe9xa=this[_0x151b[11]][_0x151b[44]];this[_0x151b[11]][_0x151b[44]]=function(_0xebe9xb,_0xebe9x7){if(_0xebe9x7==null){if(!this[_0x151b[46]][_0x151b[29]][_0x151b[45]]){_0xebe9x5[_0x151b[49]](_0xebe9xb[_0x151b[47]](),_0xebe9xb[_0x151b[48]]());this[_0x151b[46]][_0x151b[29]][_0x151b[50]]=false}}else {if(tapAndHoldStartsConnection){_0xebe9xa[_0x151b[15]](this,arguments)}else {if(this[_0x151b[46]][_0x151b[52]](_0xebe9x7[_0x151b[51]])&&this[_0x151b[46]][_0x151b[53]]()>1){this[_0x151b[46]][_0x151b[54]](_0xebe9x7[_0x151b[51]])}}}};if(touchStyle){this[_0x151b[55]]()}};mxUtils[_0x151b[56]](Graph,mxGraph);Graph[_0x151b[16]][_0x151b[57]]=null;Graph[_0x151b[16]][_0x151b[58]]=null;Graph[_0x151b[16]][_0x151b[21]]=function(){var _0xebe9xc=mxUtils[_0x151b[61]](STYLE_PATH+_0x151b[60])[_0x151b[59]]();var _0xebe9xd= new mxCodec(_0xebe9xc[_0x151b[62]]);_0xebe9xd[_0x151b[64]](_0xebe9xc,this[_0x151b[63]]())};Graph[_0x151b[16]][_0x151b[65]]=function(_0xebe9xe){if(_0xebe9xe!=null){var _0xebe9x7=this[_0x151b[33]][_0x151b[32]](_0xebe9xe);var _0xebe9x8=(_0xebe9x7!=null)?_0xebe9x7[_0x151b[24]]:this[_0x151b[34]](_0xebe9xe);if(_0xebe9x8!=null){var _0xebe9xf=mxUtils[_0x151b[66]](_0xebe9x8,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL);var _0xebe9x10=(_0xebe9xf==mxConstants[_0x151b[67]])?mxConstants[_0x151b[68]]:mxConstants[_0x151b[67]];this[_0x151b[69]](mxConstants.STYLE_ELBOW,_0xebe9x10,[_0xebe9xe])}}};Graph[_0x151b[16]][_0x151b[70]]=function(_0xebe9x6){if(_0xebe9x6!=null&&this[_0x151b[72]]()[_0x151b[71]](_0xebe9x6)){var _0xebe9x11=this[_0x151b[72]]()[_0x151b[73]]([_0xebe9x6])[0];if(_0xebe9x11[_0x151b[74]]!=null){_0xebe9x11[_0x151b[74]][_0x151b[75]]=null};var _0xebe9x8=_0xebe9x11[_0x151b[76]]();_0xebe9x8=mxUtils[_0x151b[77]](_0xebe9x8,mxConstants.STYLE_ENTRY_X,null);_0xebe9x8=mxUtils[_0x151b[77]](_0xebe9x8,mxConstants.STYLE_ENTRY_Y,null);_0xebe9x8=mxUtils[_0x151b[77]](_0xebe9x8,mxConstants.STYLE_EXIT_X,null);_0xebe9x8=mxUtils[_0x151b[77]](_0xebe9x8,mxConstants.STYLE_EXIT_Y,null);_0xebe9x11[_0x151b[77]](_0xebe9x8);this[_0x151b[11]][_0x151b[78]]=function(_0xebe9xb){return this[_0x151b[46]][_0x151b[33]][_0x151b[79]](_0xebe9x11)};this[_0x151b[11]][_0x151b[80]]=function(){return this[_0x151b[46]][_0x151b[73]]([_0xebe9x11])[0]}}};Graph[_0x151b[16]][_0x151b[81]]=function(_0xebe9x6){return this[_0x151b[82]]&&this[_0x151b[83]](_0xebe9x6)};Graph[_0x151b[16]][_0x151b[84]]=function(_0xebe9x6){return this[_0x151b[83]](_0xebe9x6)};Graph[_0x151b[16]][_0x151b[85]]=function(){var _0xebe9x12=mxGraph[_0x151b[16]][_0x151b[85]][_0x151b[15]](this,arguments);_0xebe9x12[_0x151b[77]](_0x151b[86]);return _0xebe9x12};Graph[_0x151b[16]][_0x151b[87]]=function(_0xebe9x6){var _0xebe9x13=_0x151b[88];if(this[_0x151b[72]]()[_0x151b[89]](_0xebe9x6)){_0xebe9x13+=mxResources[_0x151b[93]](_0x151b[90]+_0xebe9x6[_0x151b[92]][_0x151b[91]])}else {if(this[_0x151b[72]]()[_0x151b[71]](_0xebe9x6)){_0xebe9x13=mxGraph[_0x151b[16]][_0x151b[87]][_0x151b[15]](this,arguments)}};return _0xebe9x13};Graph[_0x151b[16]][_0x151b[94]]=function(_0xebe9x6){if(_0xebe9x6[_0x151b[92]]!=null&& typeof (_0xebe9x6[_0x151b[92]])==_0x151b[95]){return _0xebe9x6[_0x151b[92]][_0x151b[97]](_0x151b[96])};return mxGraph[_0x151b[16]][_0x151b[94]][_0x151b[15]](this,arguments)};Graph[_0x151b[16]][_0x151b[98]]=function(_0xebe9x6,_0xebe9x10,_0xebe9x14){if(_0xebe9x6[_0x151b[92]]!=null&& typeof (_0xebe9x6[_0x151b[92]])==_0x151b[95]){var _0xebe9x15=_0xebe9x6[_0x151b[92]][_0x151b[99]](true);_0xebe9x15[_0x151b[100]](_0x151b[96],_0xebe9x10);_0xebe9x10=_0xebe9x15};mxGraph[_0x151b[16]][_0x151b[98]][_0x151b[15]](this,arguments)};Graph[_0x151b[16]][_0x151b[101]]=function(_0xebe9x6,_0xebe9x16){var _0xebe9x10=null;if(_0xebe9x6[_0x151b[92]]!=null&& typeof (_0xebe9x6[_0x151b[92]])==_0x151b[95]){_0xebe9x10=_0xebe9x6[_0x151b[92]][_0x151b[99]](true)}else {var _0xebe9x17=mxUtils[_0x151b[102]]();_0xebe9x10=_0xebe9x17[_0x151b[104]](_0x151b[103]);_0xebe9x10[_0x151b[100]](_0x151b[96],_0xebe9x6[_0x151b[92]])};if(_0xebe9x16!=null&&_0xebe9x16[_0x151b[105]]>0){_0xebe9x10[_0x151b[100]](_0x151b[106],_0xebe9x16)}else {_0xebe9x10[_0x151b[107]](_0x151b[106])};this[_0x151b[109]][_0x151b[108]](_0xebe9x6,_0xebe9x10)};Graph[_0x151b[16]][_0x151b[110]]=function(_0xebe9x6){if(_0xebe9x6[_0x151b[92]]!=null&& typeof (_0xebe9x6[_0x151b[92]])==_0x151b[95]){return _0xebe9x6[_0x151b[92]][_0x151b[97]](_0x151b[106])};return null};Graph[_0x151b[16]][_0x151b[55]]=function(){this[_0x151b[11]][_0x151b[112]][_0x151b[111]]=function(){return this[_0x151b[46]][_0x151b[11]][_0x151b[113]]!=null};this[_0x151b[28]](mxEvent.START_EDITING,function(_0xebe9x18,_0xebe9x19){this[_0x151b[29]][_0x151b[114]]()});var _0xebe9x1a=false;var _0xebe9x1b=null;this[_0x151b[115]]=function(_0xebe9xb){mxGraph[_0x151b[16]][_0x151b[115]][_0x151b[15]](this,arguments);if(_0xebe9xb[_0x151b[32]]()==null){var _0xebe9x6=this[_0x151b[118]](_0xebe9xb[_0x151b[116]],_0xebe9xb[_0x151b[117]]);if(this[_0x151b[72]]()[_0x151b[71]](_0xebe9x6)){_0xebe9xb[_0x151b[119]]=this[_0x151b[33]][_0x151b[32]](_0xebe9x6);if(_0xebe9xb[_0x151b[119]]!=null&&_0xebe9xb[_0x151b[119]][_0x151b[120]]!=null){this[_0x151b[25]][_0x151b[24]][_0x151b[23]]=_0xebe9xb[_0x151b[119]][_0x151b[120]][_0x151b[121]][_0x151b[24]][_0x151b[23]]}}};if(_0xebe9xb[_0x151b[32]]()==null){this[_0x151b[25]][_0x151b[24]][_0x151b[23]]=_0x151b[30]}};this[_0x151b[122]]=function(_0xebe9x1c,_0xebe9xb,_0xebe9x18){if(_0xebe9x1c==mxEvent[_0x151b[123]]){if(!this[_0x151b[29]][_0x151b[124]]()){_0xebe9x1b=_0xebe9xb[_0x151b[125]]();_0xebe9x1a=(_0xebe9x1b!=null)?this[_0x151b[52]](_0xebe9x1b):this[_0x151b[126]]()}else {_0xebe9x1a=false;_0xebe9x1b=null}}else {if(_0xebe9x1c==mxEvent[_0x151b[127]]){if(_0xebe9x1a&&!this[_0x151b[128]]()){if(!this[_0x151b[29]][_0x151b[124]]()){var _0xebe9x1d=mxEvent[_0x151b[130]](_0xebe9xb[_0x151b[129]]());var _0xebe9x1e=mxEvent[_0x151b[131]](_0xebe9xb[_0x151b[129]]());this[_0x151b[29]][_0x151b[132]](_0xebe9x1d+16,_0xebe9x1e,_0xebe9x1b,_0xebe9xb[_0x151b[129]]())};_0xebe9x1a=false;_0xebe9x1b=null;_0xebe9xb[_0x151b[133]]();return};_0xebe9x1a=false;_0xebe9x1b=null}};mxGraph[_0x151b[16]][_0x151b[122]][_0x151b[15]](this,arguments);if(_0xebe9x1c==mxEvent[_0x151b[134]]&&_0xebe9xb[_0x151b[135]]()){_0xebe9x1a=false;_0xebe9x1b=null}}};(function(){mxVertexHandler[_0x151b[16]][_0x151b[136]]=true;mxText[_0x151b[16]][_0x151b[137]]=5;mxText[_0x151b[16]][_0x151b[138]]=1;if(touchStyle){mxConstants[_0x151b[139]]=16;mxConstants[_0x151b[140]]=7;if(mxClient[_0x151b[141]]){mxVertexHandler[_0x151b[16]][_0x151b[142]]=4;mxEdgeHandler[_0x151b[16]][_0x151b[142]]=6;Graph[_0x151b[16]][_0x151b[142]]=14;Graph[_0x151b[16]][_0x151b[143]]=20;mxPanningHandler[_0x151b[16]][_0x151b[144]]=false;mxPanningHandler[_0x151b[16]][_0x151b[145]]=true;mxPanningHandler[_0x151b[16]][_0x151b[146]]=function(_0xebe9xb){var _0xebe9x19=_0xebe9xb[_0x151b[129]]();return (this[_0x151b[145]]&&(this[_0x151b[147]]||_0xebe9xb[_0x151b[32]]()==null))||(mxEvent[_0x151b[148]](_0xebe9x19)&&mxEvent[_0x151b[149]](_0xebe9x19))||(this[_0x151b[150]]&&mxEvent[_0x151b[151]](_0xebe9x19))}};var _0xebe9x1f=mxGraphHandler[_0x151b[16]][_0x151b[152]];mxGraphHandler[_0x151b[16]][_0x151b[152]]=function(_0xebe9x18,_0xebe9xb){_0xebe9x1f[_0x151b[15]](this,arguments);if(this[_0x151b[46]][_0x151b[52]](_0xebe9xb[_0x151b[125]]())&&this[_0x151b[46]][_0x151b[53]]()>1){this[_0x151b[153]]=false}};Graph[_0x151b[16]][_0x151b[154]]=function(_0xebe9x1){this[_0x151b[155]]= new mxTooltipHandler(this);this[_0x151b[155]][_0x151b[156]](false);this[_0x151b[157]]= new mxSelectionCellsHandler(this);this[_0x151b[29]]= new mxPanningHandler(this);this[_0x151b[29]][_0x151b[158]]=false;this[_0x151b[11]]= new mxConnectionHandler(this);this[_0x151b[11]][_0x151b[156]](false);this[_0x151b[159]]= new mxGraphHandler(this)};mxConnectionHandler[_0x151b[16]][_0x151b[160]]=function(_0xebe9xe,_0xebe9x20){if(touchStyle&&_0xebe9x20!=null){this[_0x151b[46]][_0x151b[161]](_0xebe9x20)}else {this[_0x151b[46]][_0x151b[161]](_0xebe9xe)}};var _0xebe9x21=mxGraph[_0x151b[16]][_0x151b[162]];Graph[_0x151b[16]][_0x151b[162]]=function(_0xebe9x19,_0xebe9x6){if(_0xebe9x6==null){var _0xebe9x22=mxUtils[_0x151b[163]](this[_0x151b[25]],mxEvent[_0x151b[130]](_0xebe9x19),mxEvent[_0x151b[131]](_0xebe9x19));_0xebe9x6=this[_0x151b[118]](_0xebe9x22[_0x151b[164]],_0xebe9x22[_0x151b[165]])};_0xebe9x21[_0x151b[0]](this,_0xebe9x19,_0xebe9x6)};var _0xebe9x23= new mxImage(IMAGE_PATH+_0x151b[166],16,16);mxVertexHandler[_0x151b[16]][_0x151b[167]]=_0xebe9x23;mxEdgeHandler[_0x151b[16]][_0x151b[167]]=_0xebe9x23;mxOutline[_0x151b[16]][_0x151b[168]]=_0xebe9x23; new Image()[_0x151b[169]]=_0xebe9x23[_0x151b[169]];var _0xebe9x24=IMAGE_PATH+_0x151b[170];var _0xebe9x25=mxVertexHandler[_0x151b[16]][_0x151b[171]];mxVertexHandler[_0x151b[16]][_0x151b[171]]=function(){_0xebe9x25[_0x151b[15]](this,arguments);if(showConnectorImg&&this[_0x151b[46]][_0x151b[11]][_0x151b[111]]()&&this[_0x151b[46]][_0x151b[172]](this[_0x151b[119]][_0x151b[51]])&&!this[_0x151b[46]][_0x151b[84]](this[_0x151b[119]][_0x151b[51]])&&this[_0x151b[46]][_0x151b[53]]()==1){this[_0x151b[173]]=mxUtils[_0x151b[174]](_0xebe9x24);this[_0x151b[173]][_0x151b[24]][_0x151b[23]]=_0x151b[26];this[_0x151b[173]][_0x151b[24]][_0x151b[175]]=_0x151b[176];this[_0x151b[173]][_0x151b[24]][_0x151b[177]]=_0x151b[176];this[_0x151b[173]][_0x151b[24]][_0x151b[178]]=_0x151b[179];if(!mxClient[_0x151b[141]]){this[_0x151b[173]][_0x151b[100]](_0x151b[180],mxResources[_0x151b[93]](_0x151b[17]));mxEvent[_0x151b[181]](this[_0x151b[173]],this[_0x151b[46]],this[_0x151b[119]])};this[_0x151b[173]][_0x151b[24]][_0x151b[182]]=_0x151b[183];mxEvent[_0x151b[185]](this[_0x151b[173]],mxUtils[_0x151b[27]](this,function(_0xebe9x19){this[_0x151b[46]][_0x151b[29]][_0x151b[114]]();var _0xebe9x22=mxUtils[_0x151b[163]](this[_0x151b[46]][_0x151b[25]],mxEvent[_0x151b[130]](_0xebe9x19),mxEvent[_0x151b[131]](_0xebe9x19));this[_0x151b[46]][_0x151b[11]][_0x151b[49]](this[_0x151b[119]],_0xebe9x22[_0x151b[164]],_0xebe9x22[_0x151b[165]]);this[_0x151b[46]][_0x151b[184]]=true;mxEvent[_0x151b[133]](_0xebe9x19)}));this[_0x151b[46]][_0x151b[25]][_0x151b[186]](this[_0x151b[173]])};this[_0x151b[187]]()};var _0xebe9x26=mxVertexHandler[_0x151b[16]][_0x151b[188]];mxVertexHandler[_0x151b[16]][_0x151b[188]]=function(){_0xebe9x26[_0x151b[15]](this);this[_0x151b[187]]()};mxVertexHandler[_0x151b[16]][_0x151b[187]]=function(){if(this[_0x151b[119]]!=null&&this[_0x151b[173]]!=null){if(mxVertexHandler[_0x151b[16]][_0x151b[189]]){this[_0x151b[173]][_0x151b[24]][_0x151b[190]]=(this[_0x151b[119]][_0x151b[164]]+this[_0x151b[119]][_0x151b[175]]-this[_0x151b[173]][_0x151b[191]]/2)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[193]]=(this[_0x151b[119]][_0x151b[165]]-this[_0x151b[173]][_0x151b[194]]/2)+_0x151b[192]}else {this[_0x151b[173]][_0x151b[24]][_0x151b[190]]=(this[_0x151b[119]][_0x151b[164]]+this[_0x151b[119]][_0x151b[175]]+mxConstants[_0x151b[139]]/2+4)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[193]]=(this[_0x151b[119]][_0x151b[165]]+(this[_0x151b[119]][_0x151b[177]]-this[_0x151b[173]][_0x151b[194]])/2)+_0x151b[192]}}};var _0xebe9x27=mxVertexHandler[_0x151b[16]][_0x151b[195]];mxVertexHandler[_0x151b[16]][_0x151b[195]]=function(_0xebe9x18,_0xebe9xb){_0xebe9x27[_0x151b[15]](this,arguments);if(this[_0x151b[173]]!=null){this[_0x151b[173]][_0x151b[197]][_0x151b[196]](this[_0x151b[173]]);this[_0x151b[173]]=null}}; new Image()[_0x151b[169]]=_0xebe9x24}else {var _0xebe9x28= new mxImage(IMAGE_PATH+_0x151b[198],15,15);mxConnectionHandler[_0x151b[16]][_0x151b[199]]=_0xebe9x28; new Image()[_0x151b[169]]=_0xebe9x28[_0x151b[169]];if(urlParams[_0x151b[17]]==_0x151b[18]){var _0xebe9x28= new mxImage(IMAGE_PATH+_0x151b[198],15,15);var _0xebe9x25=mxVertexHandler[_0x151b[16]][_0x151b[171]];mxVertexHandler[_0x151b[16]][_0x151b[171]]=function(){_0xebe9x25[_0x151b[15]](this,arguments);if(showConnectorImg&&this[_0x151b[46]][_0x151b[11]][_0x151b[111]]()&&this[_0x151b[46]][_0x151b[172]](this[_0x151b[119]][_0x151b[51]])&&!this[_0x151b[46]][_0x151b[84]](this[_0x151b[119]][_0x151b[51]])&&this[_0x151b[46]][_0x151b[53]]()==1){if(mxClient[_0x151b[200]]&&!mxClient[_0x151b[201]]){this[_0x151b[173]]=document[_0x151b[104]](_0x151b[202]);this[_0x151b[173]][_0x151b[24]][_0x151b[203]]=_0x151b[204]+_0xebe9x28[_0x151b[169]]+_0x151b[205];this[_0x151b[173]][_0x151b[24]][_0x151b[206]]=_0x151b[207];this[_0x151b[173]][_0x151b[24]][_0x151b[208]]=_0x151b[209];this[_0x151b[173]][_0x151b[24]][_0x151b[175]]=(_0xebe9x28[_0x151b[175]]+4)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[177]]=(_0xebe9x28[_0x151b[177]]+4)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[210]]=(mxClient[_0x151b[211]])?_0x151b[212]:_0x151b[213]}else {this[_0x151b[173]]=mxUtils[_0x151b[174]](_0xebe9x28[_0x151b[169]]);this[_0x151b[173]][_0x151b[24]][_0x151b[175]]=_0xebe9x28[_0x151b[175]]+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[177]]=_0xebe9x28[_0x151b[177]]+_0x151b[192]};this[_0x151b[173]][_0x151b[24]][_0x151b[23]]=_0x151b[26];this[_0x151b[173]][_0x151b[24]][_0x151b[178]]=_0x151b[179];this[_0x151b[173]][_0x151b[100]](_0x151b[180],mxResources[_0x151b[93]](_0x151b[17]));mxEvent[_0x151b[181]](this[_0x151b[173]],this[_0x151b[46]],this[_0x151b[119]]);this[_0x151b[173]][_0x151b[24]][_0x151b[182]]=_0x151b[183];mxEvent[_0x151b[28]](this[_0x151b[173]],_0x151b[214],mxUtils[_0x151b[27]](this,function(_0xebe9x19){this[_0x151b[46]][_0x151b[29]][_0x151b[114]]();var _0xebe9x22=mxUtils[_0x151b[163]](this[_0x151b[46]][_0x151b[25]],mxEvent[_0x151b[130]](_0xebe9x19),mxEvent[_0x151b[131]](_0xebe9x19));this[_0x151b[46]][_0x151b[11]][_0x151b[49]](this[_0x151b[119]],_0xebe9x22[_0x151b[164]],_0xebe9x22[_0x151b[165]]);this[_0x151b[46]][_0x151b[184]]=true;mxEvent[_0x151b[133]](_0xebe9x19)}));this[_0x151b[46]][_0x151b[25]][_0x151b[186]](this[_0x151b[173]])};this[_0x151b[187]]()};var _0xebe9x26=mxVertexHandler[_0x151b[16]][_0x151b[188]];mxVertexHandler[_0x151b[16]][_0x151b[188]]=function(){_0xebe9x26[_0x151b[15]](this);this[_0x151b[187]]()};mxVertexHandler[_0x151b[16]][_0x151b[187]]=function(){if(this[_0x151b[119]]!=null&&this[_0x151b[173]]!=null){if(mxVertexHandler[_0x151b[16]][_0x151b[189]]){this[_0x151b[173]][_0x151b[24]][_0x151b[190]]=(this[_0x151b[119]][_0x151b[164]]+this[_0x151b[119]][_0x151b[175]]-this[_0x151b[173]][_0x151b[191]]/2)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[193]]=(this[_0x151b[119]][_0x151b[165]]-this[_0x151b[173]][_0x151b[194]]/2)+_0x151b[192]}else {this[_0x151b[173]][_0x151b[24]][_0x151b[190]]=(this[_0x151b[119]][_0x151b[164]]+this[_0x151b[119]][_0x151b[175]]+mxConstants[_0x151b[139]]/2+2)+_0x151b[192];this[_0x151b[173]][_0x151b[24]][_0x151b[193]]=(this[_0x151b[119]][_0x151b[165]]+(this[_0x151b[119]][_0x151b[177]]-this[_0x151b[173]][_0x151b[194]])/2)+_0x151b[192]}}};var _0xebe9x27=mxVertexHandler[_0x151b[16]][_0x151b[195]];mxVertexHandler[_0x151b[16]][_0x151b[195]]=function(_0xebe9x18,_0xebe9xb){_0xebe9x27[_0x151b[15]](this,arguments);if(this[_0x151b[173]]!=null){this[_0x151b[173]][_0x151b[197]][_0x151b[196]](this[_0x151b[173]]);this[_0x151b[173]]=null}}}}})() \ No newline at end of file +/** + * $Id: Graph.js,v 1.14 2013-02-16 10:19:54 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph instance. Note that the constructor does not take a + * container because the graph instance is needed for creating the UI, which + * in turn will create the container for the graph. Hence, the container is + * assigned later in EditorUi. + */ +Graph = function(container, model, renderHint, stylesheet) +{ + mxGraph.call(this, container, model, renderHint, stylesheet); + + this.setConnectable(true); + this.setDropEnabled(false); + this.setPanning(true); + this.setTooltips(!mxClient.IS_TOUCH); + this.setAllowLoops(false); + this.setMultigraph(false); + this.allowAutoPanning = true; + this.resetEdgesOnConnect = false; + this.constrainChildren = false; + + // Centers the port icon on the target port + this.connectionHandler.targetConnectImage = true; + + // Does not allow dangling edges + this.setAllowDanglingEdges(false); + + // Enables cloning of connection sources + this.connectionHandler.setCreateTarget(false); + + // Disables built-in connection starts + this.connectionHandler.isValidSource = function() + { + return mxConnectionHandler.prototype.isValidSource.apply(this, arguments) && urlParams['connect'] != '2'; + }; + + // Sets the style to be used when an elbow edge is double clicked + this.alternateEdgeStyle = 'vertical'; + + if (stylesheet == null) + { + this.loadStylesheet(); + } + + // Creates rubberband selection + var rubberband = new mxRubberband(this); + + this.getRubberband = function() + { + return rubberband; + }; + + // Shows hand cursor while panning + 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'; + })); + + // Adds support for HTML labels via style. Note: Currently, only the Java + // backend supports HTML labels but CSS support is limited to the following: + // http://docs.oracle.com/javase/6/docs/api/index.html?javax/swing/text/html/CSS.html + this.isHtmlLabel = function(cell) + { + var state = this.view.getState(cell); + var style = (state != null) ? state.style : this.getCellStyle(cell); + + return style['html'] == '1' || style['whiteSpace'] == 'wrap'; + }; + + // HTML entities are displayed as plain text in wrapped plain text labels + this.cellRenderer.getLabelValue = function(state) + { + var result = mxCellRenderer.prototype.getLabelValue.apply(this, arguments); + + if (state.style['whiteSpace'] == 'wrap' && state.style['html'] != 1) + { + result = mxUtils.htmlEntities(result, false); + } + + return result; + }; + + // Unlocks all cells + this.isCellLocked = function(cell) + { + return false; + }; + + // Tap and hold brings up context menu. + // Tolerance slightly below graph tolerance is better. + this.connectionHandler.tapAndHoldTolerance = 16; + + // Tap and hold on background starts rubberband on cell starts connecting + var connectionHandlerTapAndHold = this.connectionHandler.tapAndHold; + this.connectionHandler.tapAndHold = function(me, state) + { + if (state == null) + { + if (!this.graph.panningHandler.active) + { + rubberband.start(me.getGraphX(), me.getGraphY()); + this.graph.panningHandler.panningTrigger = false; + } + } + else if (tapAndHoldStartsConnection) + { + connectionHandlerTapAndHold.apply(this, arguments); + } + else if (this.graph.isCellSelected(state.cell) && this.graph.getSelectionCount() > 1) + { + this.graph.removeSelectionCell(state.cell); + } + }; + + if (touchStyle) + { + this.initTouch(); + } +}; + +// Graph inherits from mxGraph +mxUtils.extend(Graph, mxGraph); + +/** + * Allows to all values in fit. + */ +Graph.prototype.minFitScale = null; + +/** + * Allows to all values in fit. + */ +Graph.prototype.maxFitScale = null; + +/** + * Loads the stylesheet for this graph. + */ +Graph.prototype.loadStylesheet = function() +{ + var node = mxUtils.load(STYLE_PATH + '/default.xml').getDocumentElement(); + var dec = new mxCodec(node.ownerDocument); + dec.decode(node, this.getStylesheet()); +}; + +/** + * Inverts the elbow edge style without removing existing styles. + */ +Graph.prototype.flipEdge = function(edge) +{ + if (edge != null) + { + var state = this.view.getState(edge); + var style = (state != null) ? state.style : this.getCellStyle(edge); + + if (style != null) + { + var elbow = mxUtils.getValue(style, mxConstants.STYLE_ELBOW, + mxConstants.ELBOW_HORIZONTAL); + var value = (elbow == mxConstants.ELBOW_HORIZONTAL) ? + mxConstants.ELBOW_VERTICAL : mxConstants.ELBOW_HORIZONTAL; + this.setCellStyles(mxConstants.STYLE_ELBOW, value, [edge]); + } + } +}; + +/** + * Sets the default edge for future connections. + */ +Graph.prototype.setDefaultEdge = function(cell) +{ + if (cell != null && this.getModel().isEdge(cell)) + { + // Take a snapshot of the cell at the moment of calling + var proto = this.getModel().cloneCells([cell])[0]; + + // Delete existing points + if (proto.geometry != null) + { + proto.geometry.points = null; + } + + // Delete entry-/exitXY styles + var style = proto.getStyle(); + style = mxUtils.setStyle(style, mxConstants.STYLE_ENTRY_X, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_ENTRY_Y, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_EXIT_X, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_EXIT_Y, null); + proto.setStyle(style); + + // Uses edge template for connect preview + this.connectionHandler.createEdgeState = function(me) + { + return this.graph.view.createState(proto); + }; + + // Creates new connections from edge template + this.connectionHandler.factoryMethod = function() + { + return this.graph.cloneCells([proto])[0]; + }; + } +}; + +/** + * Disables folding for non-swimlanes. + */ +Graph.prototype.isCellFoldable = function(cell) +{ + return this.foldingEnabled && this.isSwimlane(cell); +}; + +/** + * Disables drill-down for non-swimlanes. + */ +Graph.prototype.isValidRoot = function(cell) +{ + return this.isSwimlane(cell); +}; + +/** + * Overrides createGroupCell to set the group style for new groups to 'group'. + */ +Graph.prototype.createGroupCell = function() +{ + var group = mxGraph.prototype.createGroupCell.apply(this, arguments); + group.setStyle('group'); + + return group; +}; + +/** + * Giuseppe Careri + * Overrides tooltips to show position and size + */ +Graph.prototype.getTooltipForCell = function(cell) +{ + var tip = ''; + + if (this.getModel().isVertex(cell)) + { + // var geo = this.getCellGeometry(cell); + + // var f2 = function(x) + // { + // return Math.round(parseFloat(x) * 100) / 100; + // }; + + // if (geo != null) + // { + // if (tip == null) + // { + // tip = ''; + // } + // else if (tip.length > 0) + // { + // tip += '\n'; + // } + + // tip += 'X: ' + f2(geo.x) + '\nY: ' + f2(geo.y) + '\nW: ' + f2(geo.width) + '\nH: ' + f2(geo.height); + // } + + tip += mxResources.get('description_' + cell.value.nodeName); + } + else if (this.getModel().isEdge(cell)) + { + tip = mxGraph.prototype.getTooltipForCell.apply(this, arguments); + } + + return tip; +}; + +/** + * Giuseppe Careri + * Returns the label for the given cell. + */ +Graph.prototype.convertValueToString = function(cell) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + return cell.value.getAttribute('label'); + } + + return mxGraph.prototype.convertValueToString.apply(this, arguments); +}; + +/** + * Giuseppe Careri + * Handles label changes for XML user objects. + */ +Graph.prototype.cellLabelChanged = function(cell, value, autoSize) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + var tmp = cell.value.cloneNode(true); + tmp.setAttribute('label', value); + value = tmp; + } + + mxGraph.prototype.cellLabelChanged.apply(this, arguments); +}; + +/** + * Sets the link for the given cell. + */ +Graph.prototype.setLinkForCell = function(cell, link) +{ + var value = null; + + if (cell.value != null && typeof(cell.value) == 'object') + { + value = cell.value.cloneNode(true); + } + else + { + var doc = mxUtils.createXmlDocument(); + + value = doc.createElement('UserObject'); + value.setAttribute('label', cell.value); + } + + if (link != null && link.length > 0) + { + value.setAttribute('link', link); + } + else + { + value.removeAttribute('link'); + } + + this.model.setValue(cell, value); +}; + +/** + * Returns the link for the given cell. + */ +Graph.prototype.getLinkForCell = function(cell) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + return cell.value.getAttribute('link'); + } + + return null; +}; + +/** + * Customized graph for touch devices. + */ +Graph.prototype.initTouch = function() +{ + // Disables new connections via "hotspot" + this.connectionHandler.marker.isEnabled = function() + { + return this.graph.connectionHandler.first != null; + }; + + // Hides menu when editing starts + this.addListener(mxEvent.START_EDITING, function(sender, evt) + { + this.panningHandler.hideMenu(); + }); + + // Context menu for touchstyle + var showMenu = false; + var menuCell = null; + + // Checks if native hit detection did not return anything and does custom + // hit detection for edges to take into account the tolerance + this.updateMouseEvent = function(me) + { + mxGraph.prototype.updateMouseEvent.apply(this, arguments); + + if (me.getState() == null) + { + var cell = this.getCellAt(me.graphX, me.graphY); + + if (this.getModel().isEdge(cell)) + { + me.state = this.view.getState(cell); + + if (me.state != null && me.state.shape != null) + { + this.container.style.cursor = me.state.shape.node.style.cursor; + } + } + } + + if (me.getState() == null) + { + this.container.style.cursor = 'default'; + } + }; + + // Handles popup menu on touch devices (tap selected cell) + this.fireMouseEvent = function(evtName, me, sender) + { + if (evtName == mxEvent.MOUSE_DOWN) + { + if (!this.panningHandler.isMenuShowing()) + { + menuCell = me.getCell(); + showMenu = (menuCell != null) ? this.isCellSelected(menuCell) : this.isSelectionEmpty(); + } + else + { + showMenu = false; + menuCell = null; + } + } + else if (evtName == mxEvent.MOUSE_UP) + { + if (showMenu && !this.isEditing()) + { + if (!this.panningHandler.isMenuShowing()) + { + var x = mxEvent.getClientX(me.getEvent()); + var y = mxEvent.getClientY(me.getEvent()); + + this.panningHandler.popup(x + 16, y, menuCell, me.getEvent()); + } + + showMenu = false; + menuCell = null; + me.consume(); + + return; + } + + showMenu = false; + menuCell = null; + } + + mxGraph.prototype.fireMouseEvent.apply(this, arguments); + + if (evtName == mxEvent.MOUSE_MOVE && me.isConsumed()) + { + showMenu = false; + menuCell = null; + } + }; +}; + +/** + * Implements touch devices. + */ +(function() +{ + // Enables rotation handle + mxVertexHandler.prototype.rotationEnabled = true; + + // Matches label positions of mxGraph 1.x + mxText.prototype.baseSpacingTop = 5; + mxText.prototype.baseSpacingBottom = 1; + + // Touch-specific static overrides + if (touchStyle) + { + // Sets constants for touch style + mxConstants.HANDLE_SIZE = 16; + mxConstants.LABEL_HANDLE_SIZE = 7; + + // Larger tolerance and grid for real touch devices + if (mxClient.IS_TOUCH) + { + mxVertexHandler.prototype.tolerance = 4; + mxEdgeHandler.prototype.tolerance = 6; + Graph.prototype.tolerance = 14; + Graph.prototype.gridSize = 20; + + // One finger pans (no rubberband selection) must start regardless of mouse button + mxPanningHandler.prototype.selectOnPopup = false; + mxPanningHandler.prototype.useLeftButtonForPanning = true; + mxPanningHandler.prototype.isPanningTrigger = function(me) + { + var evt = me.getEvent(); + + return (this.useLeftButtonForPanning && (this.ignoreCell || me.getState() == null)/* && + mxEvent.isLeftMouseButton(evt)*/) || (mxEvent.isControlDown(evt) && + mxEvent.isShiftDown(evt)) || (this.usePopupTrigger && + mxEvent.isPopupTrigger(evt)); + }; + } + + // Don't clear selection if multiple cells selected + var graphHandlerMouseDown = mxGraphHandler.prototype.mouseDown; + mxGraphHandler.prototype.mouseDown = function(sender, me) + { + graphHandlerMouseDown.apply(this, arguments); + + if (this.graph.isCellSelected(me.getCell()) && this.graph.getSelectionCount() > 1) + { + this.delayedSelection = false; + } + }; + + // Changes order of panninghandler + Graph.prototype.createHandlers = function(container) + { + this.tooltipHandler = new mxTooltipHandler(this); + this.tooltipHandler.setEnabled(false); + // Selection cells first + this.selectionCellsHandler = new mxSelectionCellsHandler(this); + this.panningHandler = new mxPanningHandler(this); + this.panningHandler.panningEnabled = false; + this.connectionHandler = new mxConnectionHandler(this); + this.connectionHandler.setEnabled(false); + this.graphHandler = new mxGraphHandler(this); + }; + + // On connect the target is selected and we clone the cell of the preview edge for insert + mxConnectionHandler.prototype.selectCells = function(edge, target) + { + if (touchStyle && target != null) + { + this.graph.setSelectionCell(target); + } + else + { + this.graph.setSelectionCell(edge); + } + }; + + // Overrides double click handling to use the tolerance + // FIXME: Double click on edges in iPad needs focus on textarea + var graphDblClick = mxGraph.prototype.dblClick; + Graph.prototype.dblClick = function(evt, cell) + { + if (cell == null) + { + var pt = mxUtils.convertPoint(this.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + cell = this.getCellAt(pt.x, pt.y); + } + + graphDblClick.call(this, evt, cell); + }; + + // Rounded edge and vertex handles + var touchHandle = new mxImage(IMAGE_PATH + '/touch-handle.png', 16, 16); + mxVertexHandler.prototype.handleImage = touchHandle; + mxEdgeHandler.prototype.handleImage = touchHandle; + mxOutline.prototype.sizerImage = touchHandle; + + // Pre-fetches touch handle + new Image().src = touchHandle.src; + + // Adds connect icon to selected vertices + var connectorSrc = IMAGE_PATH + '/touch-connector.png'; + + var vertexHandlerInit = mxVertexHandler.prototype.init; + mxVertexHandler.prototype.init = function() + { + vertexHandlerInit.apply(this, arguments); + + // Only show connector image on one cell and do not show on containers + if (showConnectorImg && this.graph.connectionHandler.isEnabled() && + this.graph.isCellConnectable(this.state.cell) && + !this.graph.isValidRoot(this.state.cell) && + this.graph.getSelectionCount() == 1) + { + this.connectorImg = mxUtils.createImage(connectorSrc); + this.connectorImg.style.cursor = 'pointer'; + this.connectorImg.style.width = '29px'; + this.connectorImg.style.height = '29px'; + this.connectorImg.style.position = 'absolute'; + + if (!mxClient.IS_TOUCH) + { + this.connectorImg.setAttribute('title', mxResources.get('connect')); + mxEvent.redirectMouseEvents(this.connectorImg, this.graph, this.state); + } + + // Adds 2px tolerance + this.connectorImg.style.padding = '2px'; + + // Starts connecting on touch/mouse down + mxEvent.addGestureListeners(this.connectorImg, + mxUtils.bind(this, function(evt) + { + this.graph.panningHandler.hideMenu(); + var pt = mxUtils.convertPoint(this.graph.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + this.graph.connectionHandler.start(this.state, pt.x, pt.y); + this.graph.isMouseDown = true; + mxEvent.consume(evt); + }) + ); + + this.graph.container.appendChild(this.connectorImg); + } + + this.redrawTools(); + }; + + var vertexHandlerRedraw = mxVertexHandler.prototype.redraw; + mxVertexHandler.prototype.redraw = function() + { + vertexHandlerRedraw.apply(this); + this.redrawTools(); + }; + + mxVertexHandler.prototype.redrawTools = function() + { + if (this.state != null && this.connectorImg != null) + { + // Top right for single-sizer + if (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'; + } + else + { + this.connectorImg.style.left = (this.state.x + this.state.width + mxConstants.HANDLE_SIZE / 2 + 4/* - 2 padding*/) + 'px'; + this.connectorImg.style.top = (this.state.y + (this.state.height - this.connectorImg.offsetHeight) / 2) + 'px'; + } + } + }; + + var vertexHandlerDestroy = mxVertexHandler.prototype.destroy; + mxVertexHandler.prototype.destroy = function(sender, me) + { + vertexHandlerDestroy.apply(this, arguments); + + if (this.connectorImg != null) + { + this.connectorImg.parentNode.removeChild(this.connectorImg); + this.connectorImg = null; + } + }; + + // Pre-fetches touch connector + new Image().src = connectorSrc; + } + else + { + var img = new mxImage(IMAGE_PATH + '/connector.png', 15, 15); + mxConnectionHandler.prototype.connectImage = img; + + // Pre-fetches img + new Image().src = img.src; + + if (urlParams['connect'] == '2') // not touchStyle + { + var img = new mxImage(IMAGE_PATH + '/connector.png', 15, 15); + + var vertexHandlerInit = mxVertexHandler.prototype.init; + mxVertexHandler.prototype.init = function() + { + vertexHandlerInit.apply(this, arguments); + + // Only show connector image on one cell and do not show on containers + if (showConnectorImg && this.graph.connectionHandler.isEnabled() && + this.graph.isCellConnectable(this.state.cell) && + !this.graph.isValidRoot(this.state.cell) && + this.graph.getSelectionCount() == 1) + { + // Workaround for event redirection via image tag in quirks and IE8 + if (mxClient.IS_IE && !mxClient.IS_SVG) + { + this.connectorImg = document.createElement('div'); + this.connectorImg.style.backgroundImage = 'url(' + img.src + ')'; + this.connectorImg.style.backgroundPosition = 'center'; + this.connectorImg.style.backgroundRepeat = 'no-repeat'; + this.connectorImg.style.width = (img.width + 4) + 'px'; + this.connectorImg.style.height = (img.height + 4) + 'px'; + this.connectorImg.style.display = (mxClient.IS_QUIRKS) ? 'inline' : 'inline-block'; + } + else + { + this.connectorImg = mxUtils.createImage(img.src); + this.connectorImg.style.width = img.width + 'px'; + this.connectorImg.style.height = img.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); + + // Adds 2px tolerance + this.connectorImg.style.padding = '2px'; + + // Starts connecting on touch/mouse down + mxEvent.addListener(this.connectorImg, 'mousedown', + mxUtils.bind(this, function(evt) + { + this.graph.panningHandler.hideMenu(); + var pt = mxUtils.convertPoint(this.graph.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + this.graph.connectionHandler.start(this.state, pt.x, pt.y); + this.graph.isMouseDown = true; + mxEvent.consume(evt); + }) + ); + + this.graph.container.appendChild(this.connectorImg); + } + + this.redrawTools(); + }; + + var vertexHandlerRedraw = mxVertexHandler.prototype.redraw; + mxVertexHandler.prototype.redraw = function() + { + vertexHandlerRedraw.apply(this); + this.redrawTools(); + }; + + mxVertexHandler.prototype.redrawTools = function() + { + if (this.state != null && this.connectorImg != null) + { + // Top right for single-sizer + if (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'; + } + else + { + this.connectorImg.style.left = (this.state.x + this.state.width + mxConstants.HANDLE_SIZE / 2 + 2/* - 2 padding*/) + 'px'; + this.connectorImg.style.top = (this.state.y + (this.state.height - this.connectorImg.offsetHeight) / 2) + 'px'; + } + } + }; + + var vertexHandlerDestroy = mxVertexHandler.prototype.destroy; + mxVertexHandler.prototype.destroy = function(sender, me) + { + vertexHandlerDestroy.apply(this, arguments); + + if (this.connectorImg != null) + { + this.connectorImg.parentNode.removeChild(this.connectorImg); + this.connectorImg = null; + } + }; + } + } +})(); diff --git a/public/assets/plugins/jscripty/js/Menus.js b/public/assets/plugins/jscripty/js/Menus.js index 0188340..7d33b9e 100644 --- a/public/assets/plugins/jscripty/js/Menus.js +++ b/public/assets/plugins/jscripty/js/Menus.js @@ -1 +1,716 @@ -var _0xef0b=["\x65\x64\x69\x74\x6F\x72\x55\x69","\x6D\x65\x6E\x75\x73","\x69\x6E\x69\x74","\x73\x72\x63","\x2F\x63\x68\x65\x63\x6B\x6D\x61\x72\x6B\x2E\x67\x69\x66","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x67\x72\x61\x70\x68","\x65\x64\x69\x74\x6F\x72","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x48\x65\x6C\x76\x65\x74\x69\x63\x61","\x56\x65\x72\x64\x61\x6E\x61","\x54\x69\x6D\x65\x73\x20\x4E\x65\x77\x20\x52\x6F\x6D\x61\x6E","\x47\x61\x72\x61\x6D\x6F\x6E\x64","\x43\x6F\x6D\x69\x63\x20\x53\x61\x6E\x73\x20\x4D\x53","\x43\x6F\x75\x72\x69\x65\x72\x20\x4E\x65\x77","\x47\x65\x6F\x72\x67\x69\x61","\x4C\x75\x63\x69\x64\x61\x20\x43\x6F\x6E\x73\x6F\x6C\x65","\x54\x61\x68\x6F\x6D\x61","\x6C\x65\x6E\x67\x74\x68","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x73\x74\x79\x6C\x65\x43\x68\x61\x6E\x67\x65","\x73\x74\x79\x6C\x65","\x6E\x65\x78\x74\x53\x69\x62\x6C\x69\x6E\x67","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x61\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x63\x75\x73\x74\x6F\x6D","\x67\x65\x74","","\x70\x72\x6F\x6D\x70\x74\x43\x68\x61\x6E\x67\x65","\x62\x69\x6E\x64","\x70\x75\x74","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x28\x70\x74\x29","\x31\x32","\x6C\x69\x6E\x65\x77\x69\x64\x74\x68","\x70\x78","\x53\x54\x59\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x57\x49\x44\x54\x48","\x28\x70\x78\x29","\x31","\x6C\x69\x6E\x65","\x73\x74\x72\x61\x69\x67\x68\x74","\x53\x54\x59\x4C\x45\x5F\x45\x44\x47\x45","\x65\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E","\x65\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x53\x54\x59\x4C\x45\x5F\x45\x4C\x42\x4F\x57","\x65\x6C\x62\x6F\x77\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x76\x65\x72\x74\x69\x63\x61\x6C","\x6D\x61\x6E\x75\x61\x6C","\x73\x65\x67\x6D\x65\x6E\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x61\x75\x74\x6F\x6D\x61\x74\x69\x63","\x6F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6C\x69\x6E\x65\x65\x6E\x64","\x63\x6C\x61\x73\x73\x69\x63","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x44\x41\x52\x52\x4F\x57","\x41\x52\x52\x4F\x57\x5F\x43\x4C\x41\x53\x53\x49\x43","\x6F\x70\x65\x6E\x41\x72\x72\x6F\x77","\x41\x52\x52\x4F\x57\x5F\x4F\x50\x45\x4E","\x62\x6C\x6F\x63\x6B","\x41\x52\x52\x4F\x57\x5F\x42\x4C\x4F\x43\x4B","\x6F\x76\x61\x6C","\x41\x52\x52\x4F\x57\x5F\x4F\x56\x41\x4C","\x64\x69\x61\x6D\x6F\x6E\x64","\x41\x52\x52\x4F\x57\x5F\x44\x49\x41\x4D\x4F\x4E\x44","\x64\x69\x61\x6D\x6F\x6E\x64\x54\x68\x69\x6E","\x41\x52\x52\x4F\x57\x5F\x44\x49\x41\x4D\x4F\x4E\x44\x5F\x54\x48\x49\x4E","\x6E\x6F\x6E\x65","\x4E\x4F\x4E\x45","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74","\x65\x6E\x64\x46\x69\x6C\x6C","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x61\x64\x64\x49\x74\x65\x6D","\x73\x69\x7A\x65","\x6C\x69\x6E\x65\x73\x74\x61\x72\x74","\x53\x54\x59\x4C\x45\x5F\x53\x54\x41\x52\x54\x41\x52\x52\x4F\x57","\x73\x74\x61\x72\x74\x46\x69\x6C\x6C","\x73\x70\x61\x63\x69\x6E\x67","\x65\x6E\x61\x62\x6C\x65\x64","\x73\x68\x61\x64\x6F\x77","\x61\x63\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x44\x69\x73\x61\x62\x6C\x65\x64","\x74\x6F\x70","\x30","\x72\x69\x67\x68\x74","\x62\x6F\x74\x74\x6F\x6D","\x6C\x65\x66\x74","\x67\x6C\x6F\x62\x61\x6C","\x70\x65\x72\x69\x6D\x65\x74\x65\x72","\x73\x6F\x75\x72\x63\x65\x53\x70\x61\x63\x69\x6E\x67","\x74\x61\x72\x67\x65\x74\x53\x70\x61\x63\x69\x6E\x67","\x66\x6F\x72\x6D\x61\x74","\x61\x64\x64\x4D\x65\x6E\x75\x49\x74\x65\x6D","\x74\x65\x78\x74","\x61\x64\x64\x53\x75\x62\x6D\x65\x6E\x75","\x2D","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x61\x64\x64\x4D\x65\x6E\x75\x49\x74\x65\x6D\x73","\x61\x6C\x69\x67\x6E\x6D\x65\x6E\x74","\x77\x6F\x72\x64\x57\x72\x61\x70","\x74\x65\x78\x74\x4F\x70\x61\x63\x69\x74\x79","\x28\x25\x29","\x31\x30\x30","\x68\x69\x64\x65","\x6C\x65\x66\x74\x41\x6C\x69\x67\x6E","\x53\x54\x59\x4C\x45\x5F\x41\x4C\x49\x47\x4E","\x41\x4C\x49\x47\x4E\x5F\x4C\x45\x46\x54","\x63\x65\x6E\x74\x65\x72","\x41\x4C\x49\x47\x4E\x5F\x43\x45\x4E\x54\x45\x52","\x72\x69\x67\x68\x74\x41\x6C\x69\x67\x6E","\x41\x4C\x49\x47\x4E\x5F\x52\x49\x47\x48\x54","\x74\x6F\x70\x41\x6C\x69\x67\x6E","\x53\x54\x59\x4C\x45\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x41\x4C\x49\x47\x4E","\x41\x4C\x49\x47\x4E\x5F\x54\x4F\x50","\x6D\x69\x64\x64\x6C\x65","\x41\x4C\x49\x47\x4E\x5F\x4D\x49\x44\x44\x4C\x45","\x62\x6F\x74\x74\x6F\x6D\x41\x6C\x69\x67\x6E","\x41\x4C\x49\x47\x4E\x5F\x42\x4F\x54\x54\x4F\x4D","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x53\x54\x59\x4C\x45\x5F\x4C\x41\x42\x45\x4C\x5F\x50\x4F\x53\x49\x54\x49\x4F\x4E","\x53\x54\x59\x4C\x45\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x4C\x41\x42\x45\x4C\x5F\x50\x4F\x53\x49\x54\x49\x4F\x4E","\x64\x69\x72\x65\x63\x74\x69\x6F\x6E","\x66\x6C\x69\x70\x48","\x66\x6C\x69\x70\x56","\x74\x69\x6C\x74","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x61\x6C\x69\x67\x6E","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73","\x6C\x61\x79\x6F\x75\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x46\x6C\x6F\x77","\x65\x78\x65\x63\x75\x74\x65\x4C\x61\x79\x6F\x75\x74","\x76\x65\x72\x74\x69\x63\x61\x6C\x46\x6C\x6F\x77","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x68\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x65\x78\x70\x61\x6E\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x61\x72\x72\x61\x6E\x67\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x74\x6F\x42\x61\x63\x6B","\x67\x72\x6F\x75\x70","\x75\x6E\x67\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x76\x69\x65\x77","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x25","\x7A\x6F\x6F\x6D\x54\x6F","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x66\x69\x74\x57\x69\x6E\x64\x6F\x77","\x63\x75\x73\x74\x6F\x6D\x5A\x6F\x6F\x6D","\x66\x69\x74\x50\x61\x67\x65","\x66\x69\x74\x50\x61\x67\x65\x57\x69\x64\x74\x68","\x66\x69\x6C\x65","\x6E\x65\x77","\x6F\x70\x65\x6E","\x73\x61\x76\x65","\x73\x61\x76\x65\x41\x73","\x70\x75\x62\x6C\x69\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x69\x6D\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74","\x65\x64\x69\x74\x46\x69\x6C\x65","\x72\x65\x6E\x61\x6D\x65","\x70\x72\x69\x6E\x74","\x65\x64\x69\x74","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x75\x74","\x63\x6F\x70\x79","\x70\x61\x73\x74\x65","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x68\x65\x6C\x70","\x61\x62\x6F\x75\x74","\x61\x64\x64\x4D\x65\x6E\x75","\x65\x78\x65\x63\x75\x74\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x65\x6E\x74\x65\x72\x56\x61\x6C\x75\x65","\x20","\x70\x72\x6F\x6D\x70\x74","\x6C\x61\x62\x65\x6C","\x66\x75\x6E\x63\x74","\x74\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x69\x73\x53\x65\x6C\x65\x63\x74\x65\x64","\x61\x64\x64\x43\x68\x65\x63\x6B\x6D\x61\x72\x6B","\x61\x64\x64\x53\x68\x6F\x72\x74\x63\x75\x74","\x73\x68\x6F\x72\x74\x63\x75\x74","\x73\x70\x61\x6E","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6F\x6C\x6F\x72","\x67\x72\x61\x79","\x77\x72\x69\x74\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x2F\x63\x68\x65\x63\x6B\x6D\x61\x72\x6B\x2E\x67\x69\x66\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x32\x70\x78\x20\x35\x30\x25","\x63\x72\x65\x61\x74\x65\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x73\x6D\x61\x72\x74\x53\x65\x70\x61\x72\x61\x74\x6F\x72\x73","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x69\x73\x45\x64\x67\x65","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x62\x65\x6E\x64\x73","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x6F\x72\x45\x76\x65\x6E\x74","\x72\x65\x6D\x6F\x76\x65\x57\x61\x79\x70\x6F\x69\x6E\x74","\x68\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x64\x65\x78","\x61\x64\x64\x57\x61\x79\x70\x6F\x69\x6E\x74","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x63\x72\x65\x61\x74\x65\x4D\x65\x6E\x75\x62\x61\x72","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x63\x75\x72\x72\x65\x6E\x74\x4D\x65\x6E\x75","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x49\x74\x65\x6D","\x61\x64\x64\x4D\x65\x6E\x75\x48\x61\x6E\x64\x6C\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x64\x69\x76","\x20\x67\x65\x4D\x65\x6E\x75\x62\x61\x72\x4D\x65\x6E\x75","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x61\x70\x70\x6C\x79","\x64\x65\x73\x74\x72\x6F\x79","\x63\x75\x72\x72\x65\x6E\x74\x45\x6C\x74","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x70\x61\x67\x65\x2D\x73\x69\x64\x65\x62\x61\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x70\x6F\x70\x75\x70","\x63\x6F\x6E\x73\x75\x6D\x65","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x63\x6C\x69\x63\x6B","\x63\x61\x6C\x6C","\x65\x78\x74\x65\x6E\x64","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74"];Menus=function(_0xaa22x1){this[_0xef0b[0]]=_0xaa22x1;this[_0xef0b[1]]= new Object();this[_0xef0b[2]](); new Image()[_0xef0b[3]]=IMAGE_PATH+_0xef0b[4]};Menus[_0xef0b[5]][_0xef0b[2]]=function(){var _0xaa22x2=this[_0xef0b[0]][_0xef0b[7]][_0xef0b[6]];this[_0xef0b[30]](_0xef0b[8], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){var _0xaa22x5=[_0xef0b[9],_0xef0b[10],_0xef0b[11],_0xef0b[12],_0xef0b[13],_0xef0b[14],_0xef0b[15],_0xef0b[16],_0xef0b[17]];for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x5[_0xef0b[18]];_0xaa22x6++){var _0xaa22x7=this[_0xef0b[20]](_0xaa22x3,_0xaa22x5[_0xaa22x6],[mxConstants[_0xef0b[19]]],[_0xaa22x5[_0xaa22x6]],null,_0xaa22x4);_0xaa22x7[_0xef0b[23]][_0xef0b[22]][_0xef0b[21]][_0xef0b[8]]=_0xaa22x5[_0xaa22x6]};_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[25]),_0xef0b[27],mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[31], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){var _0xaa22x8=[6,8,9,10,11,12,14,18,24,36,48,72];for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x8[_0xef0b[18]];_0xaa22x6++){this[_0xef0b[20]](_0xaa22x3,_0xaa22x8[_0xaa22x6],[mxConstants[_0xef0b[32]]],[_0xaa22x8[_0xaa22x6]],null,_0xaa22x4)};_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[25]),_0xef0b[33],_0xef0b[34],mxConstants.STYLE_FONTSIZE,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[35], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){var _0xaa22x8=[1,2,3,4,8,12,16,24];for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x8[_0xef0b[18]];_0xaa22x6++){this[_0xef0b[20]](_0xaa22x3,_0xaa22x8[_0xaa22x6]+_0xef0b[36],[mxConstants[_0xef0b[37]]],[_0xaa22x8[_0xaa22x6]],null,_0xaa22x4)};_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[25]),_0xef0b[38],_0xef0b[39],mxConstants.STYLE_STROKEWIDTH,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[40], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[41]),[mxConstants[_0xef0b[42]]],[null],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[43]),[mxConstants[_0xef0b[42]]],[_0xef0b[44]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[45]),[mxConstants[_0xef0b[42]],mxConstants[_0xef0b[46]]],[_0xef0b[47],_0xef0b[45]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[48]),[mxConstants[_0xef0b[42]],mxConstants[_0xef0b[46]]],[_0xef0b[47],_0xef0b[48]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[49]),[mxConstants[_0xef0b[42]]],[_0xef0b[50]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[51]),[mxConstants[_0xef0b[42]]],[_0xef0b[52]],null,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[53], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[54]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[56]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[57]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[58]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[59]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[60]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[61]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[62]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[63]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[64]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[65]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[66]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[67]),[mxConstants[_0xef0b[55]]],[mxConstants[_0xef0b[68]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[69]),null,function(){_0xaa22x2[_0xef0b[71]](_0xef0b[70],true)},_0xaa22x4,null,true);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[73]),_0xef0b[38],mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[74], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[54]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[56]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[57]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[58]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[59]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[60]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[61]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[62]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[63]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[64]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[65]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[66]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[67]),[mxConstants[_0xef0b[75]]],[mxConstants[_0xef0b[68]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[69]),null,function(){_0xaa22x2[_0xef0b[71]](_0xef0b[76],true)},_0xaa22x4,null,true);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[73]),_0xef0b[38],mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[77], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){var _0xaa22x9=this[_0xef0b[0]][_0xef0b[80]][_0xef0b[26]](_0xef0b[79])[_0xef0b[78]];var _0xaa22xa=this[_0xef0b[26]](_0xef0b[40])[_0xef0b[78]];if(_0xaa22x9||_0xaa22x3[_0xef0b[81]]){this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[82]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SPACING_TOP,_0xaa22x4,_0xaa22x9);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[84]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SPACING_RIGHT,_0xaa22x4,_0xaa22x9);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[85]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SPACING_BOTTOM,_0xaa22x4,_0xaa22x9);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[86]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SPACING_LEFT,_0xaa22x4,_0xaa22x9);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[87]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SPACING,_0xaa22x4,_0xaa22x9);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[88]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_PERIMETER_SPACING,_0xaa22x4,_0xaa22x9)};if(_0xaa22xa||_0xaa22x3[_0xef0b[81]]){_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[89]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_SOURCE_PERIMETER_SPACING,_0xaa22x4,_0xaa22xa);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[90]),_0xef0b[38],_0xef0b[83],mxConstants.STYLE_TARGET_PERIMETER_SPACING,_0xaa22x4,_0xaa22xa)}})));this[_0xef0b[30]](_0xef0b[91], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[92]](_0xaa22x3,_0xef0b[21],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[93], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){var _0xaa22xb=this[_0xef0b[26]](_0xef0b[93])[_0xef0b[78]];_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[94]](_0xef0b[8],_0xaa22x3,_0xaa22x4);this[_0xef0b[94]](_0xef0b[31],_0xaa22x3,_0xaa22x4);this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],_0xef0b[96],_0xef0b[97],_0xef0b[98],_0xef0b[95]],_0xaa22x4);this[_0xef0b[94]](_0xef0b[100],_0xaa22x3,_0xaa22x4);this[_0xef0b[92]](_0xaa22x3,_0xef0b[101],_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[28]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[102]),_0xef0b[103],_0xef0b[104],mxConstants.STYLE_TEXT_OPACITY,_0xaa22x4,_0xaa22xb);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[105]),null,function(){_0xaa22x2[_0xef0b[71]](mxConstants.STYLE_NOLABEL,false)},_0xaa22x4,null,_0xaa22xb)})));this[_0xef0b[30]](_0xef0b[100], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[106]),[mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[108]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[109]),[mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[110]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[111]),[mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[112]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[113]),[mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[115]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[116]),[mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[117]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[118]),[mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[119]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[94]](_0xef0b[120],_0xaa22x3,_0xaa22x4);this[_0xef0b[94]](_0xef0b[77],_0xaa22x3,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);var _0xaa22xb=this[_0xef0b[26]](_0xef0b[93])[_0xef0b[78]];_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[48]),null,function(){_0xaa22x2[_0xef0b[71]](mxConstants.STYLE_HORIZONTAL,true)},_0xaa22x4,null,_0xaa22xb)})));this[_0xef0b[30]](_0xef0b[120], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[86]),[mxConstants[_0xef0b[121]],mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[108]],mxConstants[_0xef0b[112]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[109]),[mxConstants[_0xef0b[121]],mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[110]],mxConstants[_0xef0b[110]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[84]),[mxConstants[_0xef0b[121]],mxConstants[_0xef0b[107]]],[mxConstants[_0xef0b[112]],mxConstants[_0xef0b[108]]],null,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[82]),[mxConstants[_0xef0b[122]],mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[115]],mxConstants[_0xef0b[119]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[116]),[mxConstants[_0xef0b[122]],mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[117]],mxConstants[_0xef0b[117]]],null,_0xaa22x4);this[_0xef0b[20]](_0xaa22x3,mxResources[_0xef0b[26]](_0xef0b[85]),[mxConstants[_0xef0b[122]],mxConstants[_0xef0b[114]]],[mxConstants[_0xef0b[119]],mxConstants[_0xef0b[115]]],null,_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[123], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[124]),null,function(){_0xaa22x2[_0xef0b[71]](mxConstants.STYLE_FLIPH,false)},_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[125]),null,function(){_0xaa22x2[_0xef0b[71]](mxConstants.STYLE_FLIPV,false)},_0xaa22x4);this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],_0xef0b[126],_0xef0b[127]],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[128], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[106]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_LEFT)},_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[109]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_CENTER)},_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[111]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_RIGHT)},_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[113]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_TOP)},_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[116]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_MIDDLE)},_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[118]),null,function(){_0xaa22x2[_0xef0b[129]](mxConstants.ALIGN_BOTTOM)},_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[130], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[131]),null,mxUtils[_0xef0b[29]](this,function(){var _0xaa22xc= new mxHierarchicalLayout(_0xaa22x2,mxConstants.DIRECTION_WEST);this[_0xef0b[0]][_0xef0b[132]](_0xaa22xc,true,true)}),_0xaa22x4);_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xef0b[133]),null,mxUtils[_0xef0b[29]](this,function(){var _0xaa22xc= new mxHierarchicalLayout(_0xaa22x2,mxConstants.DIRECTION_NORTH);this[_0xef0b[0]][_0xef0b[132]](_0xaa22xc,true,true)}),_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[134], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[135],_0xef0b[95],_0xef0b[136],_0xef0b[137],_0xef0b[95],_0xef0b[138],_0xef0b[139]],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[140], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[141],_0xef0b[142],_0xef0b[95]],_0xaa22x4);this[_0xef0b[94]](_0xef0b[130],_0xaa22x3,_0xaa22x4);_0xaa22x3[_0xef0b[24]](_0xaa22x4);this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],_0xef0b[143],_0xef0b[144],_0xef0b[145]],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[146], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[147]],_0xaa22x4);_0xaa22x3[_0xef0b[24]]();var _0xaa22xd=[0.25,0.5,0.75,1,2,4];for(var _0xaa22x6=0;_0xaa22x6<_0xaa22xd[_0xef0b[18]];_0xaa22x6++){(function(_0xaa22xe){_0xaa22x3[_0xef0b[72]]((_0xaa22xe*100)+_0xef0b[148],null,function(){_0xaa22x2[_0xef0b[149]](_0xaa22xe)},_0xaa22x4)})(_0xaa22xd[_0xaa22x6])};this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],_0xef0b[150],_0xef0b[151],_0xef0b[95],_0xef0b[152],_0xef0b[153],_0xef0b[95],_0xef0b[154],_0xef0b[155]],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[156], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[157],_0xef0b[158],_0xef0b[95],_0xef0b[159],_0xef0b[160],_0xef0b[161],_0xef0b[95],_0xef0b[162],_0xef0b[95],_0xef0b[163],_0xef0b[164],_0xef0b[95],_0xef0b[165],_0xef0b[166],_0xef0b[95],_0xef0b[167]],_0xaa22x4)})));this[_0xef0b[30]](_0xef0b[168], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[169],_0xef0b[170],_0xef0b[95],_0xef0b[171],_0xef0b[172],_0xef0b[173],_0xef0b[174],_0xef0b[95],_0xef0b[175],_0xef0b[95],_0xef0b[176],_0xef0b[177],_0xef0b[178]])})));this[_0xef0b[30]](_0xef0b[179], new Menu(mxUtils[_0xef0b[29]](this,function(_0xaa22x3,_0xaa22x4){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[179],_0xef0b[95],_0xef0b[180]])})))};Menus[_0xef0b[5]][_0xef0b[30]]=function(_0xaa22xf,_0xaa22x3){this[_0xef0b[1]][_0xaa22xf]=_0xaa22x3};Menus[_0xef0b[5]][_0xef0b[26]]=function(_0xaa22xf){return this[_0xef0b[1]][_0xaa22xf]};Menus[_0xef0b[5]][_0xef0b[94]]=function(_0xaa22xf,_0xaa22x3,_0xaa22x4){var _0xaa22xb=this[_0xef0b[26]](_0xaa22xf)[_0xef0b[78]];if(_0xaa22x3[_0xef0b[81]]||_0xaa22xb){var _0xaa22x10=_0xaa22x3[_0xef0b[72]](mxResources[_0xef0b[26]](_0xaa22xf),null,null,_0xaa22x4,null,_0xaa22xb);this[_0xef0b[181]](_0xaa22xf,_0xaa22x3,_0xaa22x10)}};Menus[_0xef0b[5]][_0xef0b[181]]=function(_0xaa22xf,_0xaa22x11,_0xaa22x4){var _0xaa22x3=this[_0xef0b[26]](_0xaa22xf);if(_0xaa22x3!=null&&(_0xaa22x11[_0xef0b[81]]||_0xaa22x3[_0xef0b[78]])){this[_0xef0b[26]](_0xaa22xf)[_0xef0b[182]](_0xaa22x11,_0xaa22x4)}};Menus[_0xef0b[5]][_0xef0b[20]]=function(_0xaa22x3,_0xaa22x12,_0xaa22x13,_0xaa22x14,_0xaa22x15,_0xaa22x4){return _0xaa22x3[_0xef0b[72]](_0xaa22x12,null,mxUtils[_0xef0b[29]](this,function(){var _0xaa22x2=this[_0xef0b[0]][_0xef0b[7]][_0xef0b[6]];_0xaa22x2[_0xef0b[184]]()[_0xef0b[183]]();try{for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x13[_0xef0b[18]];_0xaa22x6++){_0xaa22x2[_0xef0b[185]](_0xaa22x13[_0xaa22x6],_0xaa22x14[_0xaa22x6])}}finally{_0xaa22x2[_0xef0b[184]]()[_0xef0b[186]]()}}),_0xaa22x4,_0xaa22x15)};Menus[_0xef0b[5]][_0xef0b[28]]=function(_0xaa22x3,_0xaa22x12,_0xaa22x16,_0xaa22x17,_0xaa22x18,_0xaa22x4,_0xaa22xb){return _0xaa22x3[_0xef0b[72]](_0xaa22x12,null,mxUtils[_0xef0b[29]](this,function(){var _0xaa22x2=this[_0xef0b[0]][_0xef0b[7]][_0xef0b[6]];var _0xaa22x19=_0xaa22x17;var _0xaa22x1a=_0xaa22x2[_0xef0b[189]]()[_0xef0b[188]](_0xaa22x2[_0xef0b[187]]());if(_0xaa22x1a!=null){_0xaa22x19=_0xaa22x1a[_0xef0b[21]][_0xaa22x18]||_0xaa22x19};_0xaa22x19=mxUtils[_0xef0b[192]](mxResources[_0xef0b[26]](_0xef0b[190])+((_0xaa22x16[_0xef0b[18]]>0)?(_0xef0b[191]+_0xaa22x16):_0xef0b[27]),_0xaa22x19);if(_0xaa22x19!=null&&_0xaa22x19[_0xef0b[18]]>0){_0xaa22x2[_0xef0b[185]](_0xaa22x18,_0xaa22x19)}}),_0xaa22x4,null,_0xaa22xb)};Menus[_0xef0b[5]][_0xef0b[92]]=function(_0xaa22x3,_0xaa22x18,_0xaa22x4){var _0xaa22x1b=this[_0xef0b[0]][_0xef0b[80]][_0xef0b[26]](_0xaa22x18);if(_0xaa22x1b!=null&&(_0xaa22x3[_0xef0b[81]]||_0xaa22x1b[_0xef0b[78]])){var _0xaa22x1c=_0xaa22x3[_0xef0b[72]](_0xaa22x1b[_0xef0b[193]],null,_0xaa22x1b[_0xef0b[194]],_0xaa22x4,null,_0xaa22x1b[_0xef0b[78]]);if(_0xaa22x1b[_0xef0b[195]]&&_0xaa22x1b[_0xef0b[196]]()){this[_0xef0b[197]](_0xaa22x1c)};this[_0xef0b[198]](_0xaa22x1c,_0xaa22x1b);return _0xaa22x1c};return null};Menus[_0xef0b[5]][_0xef0b[198]]=function(_0xaa22x1c,_0xaa22x1b){if(_0xaa22x1b[_0xef0b[199]]!=null){var _0xaa22x1d=_0xaa22x1c[_0xef0b[23]][_0xef0b[22]][_0xef0b[22]];var _0xaa22x1e=document[_0xef0b[201]](_0xef0b[200]);_0xaa22x1e[_0xef0b[21]][_0xef0b[202]]=_0xef0b[203];mxUtils[_0xef0b[204]](_0xaa22x1e,_0xaa22x1b[_0xef0b[199]]);_0xaa22x1d[_0xef0b[205]](_0xaa22x1e)}};Menus[_0xef0b[5]][_0xef0b[197]]=function(_0xaa22x1c){var _0xaa22x1d=_0xaa22x1c[_0xef0b[23]][_0xef0b[22]];_0xaa22x1d[_0xef0b[21]][_0xef0b[206]]=_0xef0b[207]+IMAGE_PATH+_0xef0b[208];_0xaa22x1d[_0xef0b[21]][_0xef0b[209]]=_0xef0b[210];_0xaa22x1d[_0xef0b[21]][_0xef0b[211]]=_0xef0b[212]};Menus[_0xef0b[5]][_0xef0b[99]]=function(_0xaa22x3,_0xaa22x13,_0xaa22x4){for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x13[_0xef0b[18]];_0xaa22x6++){if(_0xaa22x13[_0xaa22x6]==_0xef0b[95]){_0xaa22x3[_0xef0b[24]](_0xaa22x4)}else {this[_0xef0b[92]](_0xaa22x3,_0xaa22x13[_0xaa22x6],_0xaa22x4)}}};Menus[_0xef0b[5]][_0xef0b[213]]=function(_0xaa22x3,_0xaa22x1f,_0xaa22x20){var _0xaa22x2=this[_0xef0b[0]][_0xef0b[7]][_0xef0b[6]];_0xaa22x3[_0xef0b[214]]=true;if(_0xaa22x2[_0xef0b[215]]()){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[169],_0xef0b[170],_0xef0b[95],_0xef0b[173],_0xef0b[95]])}else {this[_0xef0b[99]](_0xaa22x3,[_0xef0b[174],_0xef0b[95],_0xef0b[171],_0xef0b[172],_0xef0b[95],_0xef0b[175]]);if(_0xaa22x2[_0xef0b[216]]()==1&&_0xaa22x2[_0xef0b[184]]()[_0xef0b[217]](_0xaa22x2[_0xef0b[187]]())){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[218]])};_0xaa22x3[_0xef0b[24]]()};if(_0xaa22x2[_0xef0b[216]]()>0){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[141],_0xef0b[142],_0xef0b[95]]);if(_0xaa22x2[_0xef0b[184]]()[_0xef0b[217]](_0xaa22x2[_0xef0b[187]]())){var _0xaa22x21=false;var _0xaa22x1f=_0xaa22x2[_0xef0b[187]]();if(_0xaa22x1f!=null&&_0xaa22x2[_0xef0b[184]]()[_0xef0b[217]](_0xaa22x1f)){var _0xaa22x22=_0xaa22x2[_0xef0b[220]][_0xef0b[219]](_0xaa22x1f);if(_0xaa22x22 instanceof mxEdgeHandler&&_0xaa22x22[_0xef0b[221]]!=null&&_0xaa22x22[_0xef0b[221]][_0xef0b[18]]>2){var _0xaa22x23=_0xaa22x22[_0xef0b[222]]( new mxMouseEvent(_0xaa22x20));var _0xaa22x24=this[_0xef0b[0]][_0xef0b[80]][_0xef0b[26]](_0xef0b[223]);_0xaa22x24[_0xef0b[224]]=_0xaa22x22;_0xaa22x24[_0xef0b[225]]=_0xaa22x23;_0xaa22x21=_0xaa22x23>0&&_0xaa22x23<_0xaa22x22[_0xef0b[221]][_0xef0b[18]]}};this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],(_0xaa22x21)?_0xef0b[223]:_0xef0b[226]])}else {if(_0xaa22x2[_0xef0b[216]]()>1){_0xaa22x3[_0xef0b[24]]();this[_0xef0b[99]](_0xaa22x3,[_0xef0b[143]])}};_0xaa22x3[_0xef0b[24]]();if(_0xaa22x2[_0xef0b[216]]()==1){var _0xaa22x25=_0xaa22x2[_0xef0b[227]](_0xaa22x2[_0xef0b[187]]());if(_0xaa22x25!=null){this[_0xef0b[99]](_0xaa22x3,[_0xef0b[228]])}}}else {this[_0xef0b[99]](_0xaa22x3,[_0xef0b[95],_0xef0b[176],_0xef0b[177],_0xef0b[95],_0xef0b[178]])}};Menus[_0xef0b[5]][_0xef0b[229]]=function(_0xaa22x26){var _0xaa22x27= new Menubar(this[_0xef0b[0]],_0xaa22x26);var _0xaa22x28=[_0xef0b[156],_0xef0b[168],_0xef0b[146],_0xef0b[91],_0xef0b[93],_0xef0b[140]];for(var _0xaa22x6=0;_0xaa22x6<_0xaa22x28[_0xef0b[18]];_0xaa22x6++){_0xaa22x27[_0xef0b[181]](mxResources[_0xef0b[26]](_0xaa22x28[_0xaa22x6]),this[_0xef0b[26]](_0xaa22x28[_0xaa22x6])[_0xef0b[194]])};return _0xaa22x27};function Menubar(_0xaa22x1,_0xaa22x26){this[_0xef0b[0]]=_0xaa22x1;this[_0xef0b[230]]=_0xaa22x26;mxEvent[_0xef0b[232]](document,mxUtils[_0xef0b[29]](this,function(_0xaa22x20){this[_0xef0b[231]]()}))}Menubar[_0xef0b[5]][_0xef0b[231]]=function(){if(this[_0xef0b[233]]!=null){this[_0xef0b[233]][_0xef0b[231]]()}};Menubar[_0xef0b[5]][_0xef0b[181]]=function(_0xaa22x12,_0xaa22x2a){var _0xaa22x2b=document[_0xef0b[201]](_0xef0b[234]);_0xaa22x2b[_0xef0b[237]](_0xef0b[235],_0xef0b[236]);_0xaa22x2b[_0xef0b[238]]=_0xef0b[239];mxUtils[_0xef0b[204]](_0xaa22x2b,_0xaa22x12);this[_0xef0b[240]](_0xaa22x2b,_0xaa22x2a);this[_0xef0b[230]][_0xef0b[205]](_0xaa22x2b);return _0xaa22x2b};Menubar[_0xef0b[5]][_0xef0b[240]]=function(_0xaa22x2b,_0xaa22x2a){if(_0xaa22x2a!=null){var _0xaa22x2c=true;var _0xaa22x2d=mxUtils[_0xef0b[29]](this,function(_0xaa22x20){if(_0xaa22x2c&&_0xaa22x2b[_0xef0b[78]]==null||_0xaa22x2b[_0xef0b[78]]){this[_0xef0b[0]][_0xef0b[7]][_0xef0b[6]][_0xef0b[241]][_0xef0b[231]]();var _0xaa22x3= new mxPopupMenu(_0xaa22x2a);_0xaa22x3[_0xef0b[242]][_0xef0b[238]]+=_0xef0b[243];_0xaa22x3[_0xef0b[214]]=true;_0xaa22x3[_0xef0b[81]]=true;_0xaa22x3[_0xef0b[244]]=true;_0xaa22x3[_0xef0b[231]]=mxUtils[_0xef0b[29]](this,function(){mxPopupMenu[_0xef0b[5]][_0xef0b[231]][_0xef0b[245]](_0xaa22x3,arguments);_0xaa22x3[_0xef0b[246]]();this[_0xef0b[233]]=null;this[_0xef0b[247]]=null});var _0xaa22x2e=_0xaa22x2b[_0xef0b[248]]+document[_0xef0b[251]](_0xef0b[250])[_0xef0b[249]]+22;var _0xaa22x2f=_0xaa22x2b[_0xef0b[252]]+_0xaa22x2b[_0xef0b[253]]+140;_0xaa22x3[_0xef0b[254]](_0xaa22x2e,_0xaa22x2f,null,_0xaa22x20);this[_0xef0b[233]]=_0xaa22x3;this[_0xef0b[247]]=_0xaa22x2b};_0xaa22x2c=true;mxEvent[_0xef0b[255]](_0xaa22x20)});mxEvent[_0xef0b[257]](_0xaa22x2b,_0xef0b[256],mxUtils[_0xef0b[29]](this,function(_0xaa22x20){if(this[_0xef0b[233]]!=null&&this[_0xef0b[247]]!=_0xaa22x2b){this[_0xef0b[231]]();_0xaa22x2d(_0xaa22x20)}}));mxEvent[_0xef0b[257]](_0xaa22x2b,_0xef0b[258],mxUtils[_0xef0b[29]](this,function(){_0xaa22x2c=this[_0xef0b[247]]!=_0xaa22x2b}));mxEvent[_0xef0b[257]](_0xaa22x2b,_0xef0b[259],_0xaa22x2d)}};function Menu(_0xaa22x2a,_0xaa22xb){mxEventSource[_0xef0b[260]](this);this[_0xef0b[194]]=_0xaa22x2a;this[_0xef0b[78]]=(_0xaa22xb!=null)?_0xaa22xb:true}mxUtils[_0xef0b[261]](Menu,mxEventSource);Menu[_0xef0b[5]][_0xef0b[262]]=function(_0xaa22x19){if(this[_0xef0b[78]]!=_0xaa22x19){this[_0xef0b[78]]=_0xaa22x19;this[_0xef0b[264]]( new mxEventObject(_0xef0b[263]))}};Menu[_0xef0b[5]][_0xef0b[182]]=function(_0xaa22x3,_0xaa22x4){this[_0xef0b[194]](_0xaa22x3,_0xaa22x4)} \ No newline at end of file +/** + * $Id: Menus.js,v 1.13 2013-02-20 16:21:29 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph editor + */ +Menus = function(editorUi) { + this.editorUi = editorUi; + this.menus = new Object(); + this.init(); + + // Pre-fetches checkmark image + new Image().src = IMAGE_PATH + '/checkmark.gif'; +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.init = function() { + var graph = this.editorUi.editor.graph; + + this.put('fontFamily', new Menu(mxUtils.bind(this, function(menu, parent) { + var fonts = ['Helvetica', 'Verdana', 'Times New Roman', 'Garamond', + 'Comic Sans MS', + 'Courier New', 'Georgia', 'Lucida Console', 'Tahoma' + ]; + + for (var i = 0; i < fonts.length; i++) { + var tr = this.styleChange(menu, fonts[i], [mxConstants.STYLE_FONTFAMILY], [ + fonts[i] + ], null, parent); + tr.firstChild.nextSibling.style.fontFamily = fonts[i]; + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '', mxConstants.DEFAULT_FONTFAMILY, + mxConstants.STYLE_FONTFAMILY, parent); + }))); + this.put('fontSize', new Menu(mxUtils.bind(this, function(menu, parent) { + var sizes = [6, 8, 9, 10, 11, 12, 14, 18, 24, 36, 48, 72]; + + for (var i = 0; i < sizes.length; i++) { + this.styleChange(menu, sizes[i], [mxConstants.STYLE_FONTSIZE], [sizes[i]], + null, parent); + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '(pt)', '12', + mxConstants.STYLE_FONTSIZE, parent); + }))); + this.put('linewidth', new Menu(mxUtils.bind(this, function(menu, parent) { + var sizes = [1, 2, 3, 4, 8, 12, 16, 24]; + + for (var i = 0; i < sizes.length; i++) { + this.styleChange(menu, sizes[i] + 'px', [mxConstants.STYLE_STROKEWIDTH], [ + sizes[i] + ], null, parent); + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '(px)', '1', + mxConstants.STYLE_STROKEWIDTH, parent); + }))); + this.put('line', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('straight'), [mxConstants.STYLE_EDGE], [ + null + ], null, parent); + this.styleChange(menu, mxResources.get('entityRelation'), [mxConstants.STYLE_EDGE], [ + 'entityRelationEdgeStyle' + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('horizontal'), [mxConstants.STYLE_EDGE, + mxConstants.STYLE_ELBOW + ], ['elbowEdgeStyle', 'horizontal'], null, parent); + this.styleChange(menu, mxResources.get('vertical'), [mxConstants.STYLE_EDGE, + mxConstants.STYLE_ELBOW + ], ['elbowEdgeStyle', 'vertical'], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('manual'), [mxConstants.STYLE_EDGE], [ + 'segmentEdgeStyle' + ], null, parent); + this.styleChange(menu, mxResources.get('automatic'), [mxConstants.STYLE_EDGE], [ + 'orthogonalEdgeStyle' + ], null, parent); + }))); + this.put('lineend', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('classic'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_CLASSIC + ], null, parent); + this.styleChange(menu, mxResources.get('openArrow'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_OPEN + ], null, parent); + this.styleChange(menu, mxResources.get('block'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_BLOCK + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('oval'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_OVAL + ], null, parent); + this.styleChange(menu, mxResources.get('diamond'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_DIAMOND + ], null, parent); + this.styleChange(menu, mxResources.get('diamondThin'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_DIAMOND_THIN + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('none'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.NONE + ], null, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('transparent'), null, function() { + graph.toggleCellStyles('endFill', true); + }, parent, null, true); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('size'), '(px)', mxConstants.DEFAULT_MARKERSIZE, + mxConstants.STYLE_ENDSIZE, parent); + }))); + this.put('linestart', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('classic'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_CLASSIC + ], null, parent); + this.styleChange(menu, mxResources.get('openArrow'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_OPEN + ], null, parent); + this.styleChange(menu, mxResources.get('block'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_BLOCK + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('oval'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_OVAL + ], null, parent); + this.styleChange(menu, mxResources.get('diamond'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_DIAMOND + ], null, parent); + this.styleChange(menu, mxResources.get('diamondThin'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_DIAMOND_THIN + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('none'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.NONE + ], null, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('transparent'), null, function() { + graph.toggleCellStyles('startFill', true); + }, parent, null, true); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('size'), '(px)', mxConstants.DEFAULT_MARKERSIZE, + mxConstants.STYLE_STARTSIZE, parent); + }))); + this.put('spacing', new Menu(mxUtils.bind(this, function(menu, parent) { + // Uses shadow action and line menu to analyze selection + var vertexSelected = this.editorUi.actions.get('shadow').enabled; + var edgeSelected = this.get('line').enabled; + + if (vertexSelected || menu.showDisabled) { + this.promptChange(menu, mxResources.get('top'), '(px)', '0', + mxConstants.STYLE_SPACING_TOP, parent, vertexSelected); + this.promptChange(menu, mxResources.get('right'), '(px)', '0', + mxConstants.STYLE_SPACING_RIGHT, parent, vertexSelected); + this.promptChange(menu, mxResources.get('bottom'), '(px)', '0', + mxConstants.STYLE_SPACING_BOTTOM, parent, vertexSelected); + this.promptChange(menu, mxResources.get('left'), '(px)', '0', + mxConstants.STYLE_SPACING_LEFT, parent, vertexSelected); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('global'), '(px)', '0', + mxConstants.STYLE_SPACING, parent, vertexSelected); + this.promptChange(menu, mxResources.get('perimeter'), '(px)', '0', + mxConstants.STYLE_PERIMETER_SPACING, parent, vertexSelected); + } + + if (edgeSelected || menu.showDisabled) { + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('sourceSpacing'), '(px)', '0', + mxConstants.STYLE_SOURCE_PERIMETER_SPACING, parent, edgeSelected); + this.promptChange(menu, mxResources.get('targetSpacing'), '(px)', '0', + mxConstants.STYLE_TARGET_PERIMETER_SPACING, parent, edgeSelected); + } + }))); + this.put('format', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItem(menu, 'style', parent); + }))); + this.put('text', new Menu(mxUtils.bind(this, function(menu, parent) { + var enabled = this.get('text').enabled; + menu.addSeparator(parent); + this.addSubmenu('fontFamily', menu, parent); + this.addSubmenu('fontSize', menu, parent); + this.addMenuItems(menu, ['-', 'bold', 'italic', 'underline', '-'], + parent); + this.addSubmenu('alignment', menu, parent); + this.addMenuItem(menu, 'wordWrap', parent); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('textOpacity'), '(%)', '100', + mxConstants.STYLE_TEXT_OPACITY, parent, enabled); + menu.addItem(mxResources.get('hide'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_NOLABEL, false); + }, parent, null, enabled); + }))); + this.put('alignment', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('leftAlign'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_LEFT + ], null, parent); + this.styleChange(menu, mxResources.get('center'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_CENTER + ], null, parent); + this.styleChange(menu, mxResources.get('rightAlign'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_RIGHT + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('topAlign'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_TOP + ], null, parent); + this.styleChange(menu, mxResources.get('middle'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_MIDDLE + ], null, parent); + this.styleChange(menu, mxResources.get('bottomAlign'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_BOTTOM + ], null, parent); + menu.addSeparator(parent); + this.addSubmenu('position', menu, parent); + this.addSubmenu('spacing', menu, parent); + menu.addSeparator(parent); + var enabled = this.get('text').enabled; + menu.addItem(mxResources.get('vertical'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_HORIZONTAL, true); + }, parent, null, enabled); + }))); + this.put('position', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('left'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_LEFT, mxConstants.ALIGN_RIGHT], null, parent); + this.styleChange(menu, mxResources.get('center'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_CENTER, mxConstants.ALIGN_CENTER], null, parent); + this.styleChange(menu, mxResources.get('right'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_LEFT], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('top'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_TOP, mxConstants.ALIGN_BOTTOM], null, parent); + this.styleChange(menu, mxResources.get('middle'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_MIDDLE, mxConstants.ALIGN_MIDDLE], null, parent); + this.styleChange(menu, mxResources.get('bottom'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_BOTTOM, mxConstants.ALIGN_TOP], null, parent); + }))); + this.put('direction', new Menu(mxUtils.bind(this, function(menu, parent) { + menu.addItem(mxResources.get('flipH'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_FLIPH, false); + }, parent); + menu.addItem(mxResources.get('flipV'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_FLIPV, false); + }, parent); + this.addMenuItems(menu, ['-', 'tilt', 'rotation'], parent); + }))); + this.put('align', new Menu(mxUtils.bind(this, function(menu, parent) { + menu.addItem(mxResources.get('leftAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_LEFT); + }, parent); + menu.addItem(mxResources.get('center'), null, function() { + graph.alignCells(mxConstants.ALIGN_CENTER); + }, parent); + menu.addItem(mxResources.get('rightAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_RIGHT); + }, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('topAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_TOP); + }, parent); + menu.addItem(mxResources.get('middle'), null, function() { + graph.alignCells(mxConstants.ALIGN_MIDDLE); + }, parent); + menu.addItem(mxResources.get('bottomAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_BOTTOM); + }, parent); + }))); + this.put('layout', new Menu(mxUtils.bind(this, function(menu, parent) { + // menu.addItem(mxResources.get('horizontalTree'), null, mxUtils.bind(this, function() + // { + // if (!graph.isSelectionEmpty()) + // { + // var layout = new mxCompactTreeLayout(graph, true); + // layout.edgeRouting = false; + // layout.levelDistance = 30; + // this.editorUi.executeLayout(layout, true, true); + // } + // }), parent); + // menu.addItem(mxResources.get('verticalTree'), null, mxUtils.bind(this, function() + // { + // if (!graph.isSelectionEmpty()) + // { + // var layout = new mxCompactTreeLayout(graph, false); + // layout.edgeRouting = false; + // layout.levelDistance = 30; + // this.editorUi.executeLayout(layout, true, true); + // } + // }), parent); + // menu.addSeparator(parent); + menu.addItem(mxResources.get('horizontalFlow'), null, mxUtils.bind(this, + function() { + var layout = new mxHierarchicalLayout(graph, mxConstants.DIRECTION_WEST); + this.editorUi.executeLayout(layout, true, true); + }), parent); + menu.addItem(mxResources.get('verticalFlow'), null, mxUtils.bind(this, + function() { + var layout = new mxHierarchicalLayout(graph, mxConstants.DIRECTION_NORTH); + this.editorUi.executeLayout(layout, true, true); + }), parent); + //menu.addSeparator(parent); + // menu.addItem(mxResources.get('organic'), null, mxUtils.bind(this, function() + // { + // var layout = new mxFastOrganicLayout(graph); + // this.editorUi.executeLayout(layout, true, true); + // }), parent); + // menu.addItem(mxResources.get('circle'), null, mxUtils.bind(this, function() + // { + // var layout = new mxCircleLayout(graph); + // this.editorUi.executeLayout(layout, true, true, graph.getSelectionCells()); + // }), parent); + }))); + this.put('navigation', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['home', '-', 'exitGroup', 'enterGroup', '-', + 'expand', 'collapse' + ], parent); + }))); + this.put('arrange', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['toFront', 'toBack', '-'], parent); + //this.addSubmenu('direction', menu, parent); + this.addSubmenu('layout', menu, parent); + //this.addSubmenu('align', menu, parent); + menu.addSeparator(parent); + //this.addSubmenu('navigation', menu, parent); + this.addMenuItems(menu, ['-', 'group', 'ungroup', 'removeFromGroup'], + parent); + //this.addMenuItems(menu, ['-', 'group', 'ungroup', 'removeFromGroup', '-', 'autosize'], parent); + }))); + this.put('view', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['actualSize'], parent); + menu.addSeparator(); + var scales = [0.25, 0.5, 0.75, 1, 2, 4]; + + for (var i = 0; i < scales.length; i++) { + (function(scale) { + menu.addItem((scale * 100) + '%', null, function() { + graph.zoomTo(scale); + }, parent); + })(scales[i]); + } + + this.addMenuItems(menu, ['-', 'zoomIn', 'zoomOut', '-', 'fitWindow', + 'customZoom', '-', 'fitPage', 'fitPageWidth' + ], parent); + }))); + this.put('file', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['new', 'open', '-', 'save', 'saveAs', 'publish', + '-', 'variable', '-', 'import', 'export', '-', 'editFile', 'rename', '-', + 'print' + ], parent); + }))); + this.put('edit', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['undo', 'redo', '-', 'cut', 'copy', 'paste', + 'delete', '-', 'duplicate', '-', + 'selectVertices', 'selectEdges', 'selectAll' + ]); + }))); + this.put('help', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['help', '-', 'about']); + }))); +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.put = function(name, menu) { + this.menus[name] = menu; +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.get = function(name) { + return this.menus[name]; +}; + +/** + * Adds the given submenu. + */ +Menus.prototype.addSubmenu = function(name, menu, parent) { + var enabled = this.get(name).enabled; + + if (menu.showDisabled || enabled) { + var submenu = menu.addItem(mxResources.get(name), null, null, parent, null, + enabled); + this.addMenu(name, menu, submenu); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.addMenu = function(name, popupMenu, parent) { + var menu = this.get(name); + + if (menu != null && (popupMenu.showDisabled || menu.enabled)) { + this.get(name).execute(popupMenu, parent); + } +}; + +/** + * Adds a style change item to the given menu. + */ +Menus.prototype.styleChange = function(menu, label, keys, values, sprite, + parent) { + return menu.addItem(label, null, mxUtils.bind(this, function() { + var graph = this.editorUi.editor.graph; + + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < keys.length; i++) { + graph.setCellStyles(keys[i], values[i]); + } + } finally { + graph.getModel().endUpdate(); + } + }), parent, sprite); +}; + +/** + * Adds a style change item with a prompt to the given menu. + */ +Menus.prototype.promptChange = function(menu, label, hint, defaultValue, key, + parent, enabled) { + return menu.addItem(label, null, mxUtils.bind(this, function() { + var graph = this.editorUi.editor.graph; + var value = defaultValue; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[key] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ((hint.length > 0) ? + (' ' + hint) : ''), value); + + if (value != null && value.length > 0) { + graph.setCellStyles(key, value); + } + }), parent, null, enabled); +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.addMenuItem = function(menu, key, parent) { + var action = this.editorUi.actions.get(key); + + if (action != null && (menu.showDisabled || action.enabled)) { + var item = menu.addItem(action.label, null, action.funct, parent, null, + action.enabled); + + // Adds checkmark image + if (action.toggleAction && action.isSelected()) { + this.addCheckmark(item); + } + + this.addShortcut(item, action); + + return item; + } + + return null; +}; + +/** + * Adds a checkmark to the given menuitem. + */ +Menus.prototype.addShortcut = function(item, action) { + if (action.shortcut != null) { + var td = item.firstChild.nextSibling.nextSibling; + var span = document.createElement('span'); + span.style.color = 'gray'; + mxUtils.write(span, action.shortcut); + td.appendChild(span); + } +}; + +/** + * Adds a checkmark to the given menuitem. + */ +Menus.prototype.addCheckmark = function(item) { + var td = item.firstChild.nextSibling; + td.style.backgroundImage = 'url(' + IMAGE_PATH + '/checkmark.gif)'; + td.style.backgroundRepeat = 'no-repeat'; + td.style.backgroundPosition = '2px 50%'; +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.addMenuItems = function(menu, keys, parent) { + for (var i = 0; i < keys.length; i++) { + if (keys[i] == '-') { + menu.addSeparator(parent); + } else { + this.addMenuItem(menu, keys[i], parent); + } + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.createPopupMenu = function(menu, cell, evt) { + var graph = this.editorUi.editor.graph; + menu.smartSeparators = true; + + if (graph.isSelectionEmpty()) { + this.addMenuItems(menu, ['undo', 'redo', '-', 'paste', '-']); + } else { + this.addMenuItems(menu, ['delete', '-', 'cut', 'copy', '-', 'duplicate']); + + if (graph.getSelectionCount() == 1 && graph.getModel().isEdge(graph.getSelectionCell())) { + this.addMenuItems(menu, ['setAsDefaultEdge']); + } + + menu.addSeparator(); + } + + if (graph.getSelectionCount() > 0) { + this.addMenuItems(menu, ['toFront', 'toBack', '-']); + + if (graph.getModel().isEdge(graph.getSelectionCell())) { + var isWaypoint = false; + var cell = graph.getSelectionCell(); + + if (cell != null && graph.getModel().isEdge(cell)) { + var handler = graph.selectionCellsHandler.getHandler(cell); + + if (handler instanceof mxEdgeHandler && handler.bends != null && handler.bends + .length > 2) { + var index = handler.getHandleForEvent(new mxMouseEvent(evt)); + + // Configures removeWaypoint action before execution + var rmWaypointAction = this.editorUi.actions.get('removeWaypoint'); + rmWaypointAction.handler = handler; + rmWaypointAction.index = index; + + isWaypoint = index > 0 && index < handler.bends.length; + } + } + + this.addMenuItems(menu, ['-', (isWaypoint) ? 'removeWaypoint' : + 'addWaypoint' + ]); + } else if (graph.getSelectionCount() > 1) { + menu.addSeparator(); + this.addMenuItems(menu, ['group']); + } + + menu.addSeparator(); + + if (graph.getSelectionCount() == 1) { + var link = graph.getLinkForCell(graph.getSelectionCell()); + + if (link != null) { + this.addMenuItems(menu, ['openLink']); + } + } + } else { + this.addMenuItems(menu, ['-', 'selectVertices', 'selectEdges', '-', + 'selectAll' + ]); + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.createMenubar = function(container) { + var menubar = new Menubar(this.editorUi, container); + // var menus = ['file', 'edit', 'view', 'format', 'text', 'arrange', + // 'help' + // ]; + var menus = ['file', 'edit', 'view', 'format', 'text', 'arrange']; + for (var i = 0; i < menus.length; i++) { + menubar.addMenu(mxResources.get(menus[i]), this.get(menus[i]).funct); + } + + return menubar; +}; + +/** + * Construcs a new menubar for the given editor. + */ +function Menubar(editorUi, container) { + this.editorUi = editorUi; + this.container = container; + + // Global handler to hide the current menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) { + this.hideMenu(); + })); +}; + +/** + * Adds the menubar elements. + */ +Menubar.prototype.hideMenu = function() { + if (this.currentMenu != null) { + this.currentMenu.hideMenu(); + } +}; + +/** + * Adds a submenu to this menubar. + */ +Menubar.prototype.addMenu = function(label, funct) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geItem'; + mxUtils.write(elt, label); + + this.addMenuHandler(elt, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds a handler for showing a menu in the given element. + */ +Menubar.prototype.addMenuHandler = function(elt, funct) { + if (funct != null) { + var show = true; + + var clickHandler = mxUtils.bind(this, function(evt) { + if (show && elt.enabled == null || elt.enabled) { + this.editorUi.editor.graph.panningHandler.hideMenu(); + var menu = new mxPopupMenu(funct); + menu.div.className += ' geMenubarMenu'; + menu.smartSeparators = true; + menu.showDisabled = true; + menu.autoExpand = true; + + // Disables autoexpand and destroys menu when hidden + menu.hideMenu = mxUtils.bind(this, function() { + mxPopupMenu.prototype.hideMenu.apply(menu, arguments); + menu.destroy(); + this.currentMenu = null; + this.currentElt = null; + }); + + // Added width of the page-sidebar + var x = elt.offsetLeft + document.getElementById('page-sidebar').offsetWidth + + 22; + // Added static height of the page-navbar + var y = elt.offsetTop + elt.offsetHeight + 140; + + menu.popup(x, y, null, evt); + + //menu.popup(elt.offsetLeft + 4, elt.offsetTop + elt.offsetHeight + 4, null, evt); + this.currentMenu = menu; + this.currentElt = elt; + } + + show = true; + mxEvent.consume(evt); + }); + + // Shows menu automatically while in expanded state + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + if (this.currentMenu != null && this.currentElt != elt) { + this.hideMenu(); + clickHandler(evt); + } + })); + + // Hides menu if already showing + mxEvent.addListener(elt, 'mousedown', mxUtils.bind(this, function() { + show = this.currentElt != elt; + })); + + mxEvent.addListener(elt, 'click', clickHandler); + } +}; + +/** + * Constructs a new action for the given parameters. + */ +function Menu(funct, enabled) { + mxEventSource.call(this); + this.funct = funct; + this.enabled = (enabled != null) ? enabled : true; +}; + +// Menu inherits from mxEventSource +mxUtils.extend(Menu, mxEventSource); + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Menu.prototype.setEnabled = function(value) { + if (this.enabled != value) { + this.enabled = value; + this.fireEvent(new mxEventObject('stateChanged')); + } +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Menu.prototype.execute = function(menu, parent) { + this.funct(menu, parent); +}; diff --git a/public/assets/plugins/jscripty/js/Shapes.js b/public/assets/plugins/jscripty/js/Shapes.js index 4afc1cb..42e13ca 100644 --- a/public/assets/plugins/jscripty/js/Shapes.js +++ b/public/assets/plugins/jscripty/js/Shapes.js @@ -1 +1,1234 @@ -var _0xf2e3=["\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x73\x74\x72\x75\x63\x74\x6F\x72","\x73\x69\x7A\x65","\x72\x65\x64\x72\x61\x77\x50\x61\x74\x68","\x73\x74\x79\x6C\x65","\x67\x65\x74\x56\x61\x6C\x75\x65","\x6D\x69\x6E","\x6D\x6F\x76\x65\x54\x6F","\x6C\x69\x6E\x65\x54\x6F","\x65\x6E\x64","\x63\x6C\x6F\x73\x65","\x63\x75\x62\x65","\x64\x65\x66\x61\x75\x6C\x74\x53\x68\x61\x70\x65\x73","\x6E\x6F\x74\x65","\x74\x61\x62\x57\x69\x64\x74\x68","\x74\x61\x62\x48\x65\x69\x67\x68\x74","\x74\x61\x62\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x72\x69\x67\x68\x74","\x6C\x65\x66\x74","\x66\x6F\x6C\x64\x65\x72","\x63\x61\x72\x64","\x71\x75\x61\x64\x54\x6F","\x74\x61\x70\x65","\x73\x74\x65\x70","\x63\x61\x6C\x6C","\x65\x78\x74\x65\x6E\x64","\x69\x73\x48\x74\x6D\x6C\x41\x6C\x6C\x6F\x77\x65\x64","\x70\x61\x69\x6E\x74\x46\x6F\x72\x65\x67\x72\x6F\x75\x6E\x64","\x62\x65\x67\x69\x6E","\x73\x74\x72\x6F\x6B\x65","\x61\x70\x70\x6C\x79","\x70\x6C\x75\x73","\x64\x6F\x75\x62\x6C\x65","\x73\x74\x72\x6F\x6B\x65\x77\x69\x64\x74\x68","\x6D\x61\x78","\x70\x61\x69\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x73\x65\x74\x44\x61\x73\x68\x65\x64","\x73\x79\x6D\x62\x6F\x6C","\x41\x6C\x69\x67\x6E","\x56\x65\x72\x74\x69\x63\x61\x6C\x41\x6C\x69\x67\x6E","\x57\x69\x64\x74\x68","\x48\x65\x69\x67\x68\x74","\x53\x70\x61\x63\x69\x6E\x67","\x41\x72\x63\x53\x70\x61\x63\x69\x6E\x67","\x67\x65\x74\x41\x72\x63\x53\x69\x7A\x65","\x41\x4C\x49\x47\x4E\x5F\x43\x45\x4E\x54\x45\x52","\x41\x4C\x49\x47\x4E\x5F\x52\x49\x47\x48\x54","\x41\x4C\x49\x47\x4E\x5F\x4D\x49\x44\x44\x4C\x45","\x41\x4C\x49\x47\x4E\x5F\x42\x4F\x54\x54\x4F\x4D","\x73\x61\x76\x65","\x70\x61\x69\x6E\x74\x56\x65\x72\x74\x65\x78\x53\x68\x61\x70\x65","\x72\x65\x73\x74\x6F\x72\x65","\x65\x78\x74","\x6D\x65\x73\x73\x61\x67\x65","\x61\x64\x64\x50\x69\x70\x65","\x63\x75\x72\x76\x65\x54\x6F","\x75\x6D\x6C\x41\x63\x74\x6F\x72","\x6C\x6F\x6C\x6C\x69\x70\x6F\x70","\x6A\x65\x74\x74\x79\x57\x69\x64\x74\x68","\x6A\x65\x74\x74\x79\x48\x65\x69\x67\x68\x74","\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74","\x6F\x75\x74\x65\x72\x53\x74\x72\x6F\x6B\x65","\x65\x6C\x6C\x69\x70\x73\x65","\x66\x69\x6C\x6C\x41\x6E\x64\x53\x74\x72\x6F\x6B\x65","\x73\x65\x74\x53\x68\x61\x64\x6F\x77","\x65\x6E\x64\x53\x74\x61\x74\x65","\x73\x74\x61\x72\x74\x53\x74\x61\x74\x65","\x69\x6E\x69\x74\x53\x68\x61\x70\x65\x73","\x78","\x79","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x73\x68\x61\x70\x65\x73","\x70\x61\x69\x6E\x74\x45\x64\x67\x65\x53\x68\x61\x70\x65","\x6C\x65\x6E\x67\x74\x68","\x73\x71\x72\x74","\x6C\x69\x6E\x6B","\x64\x61\x73\x68","\x61\x64\x64\x4D\x61\x72\x6B\x65\x72","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x75\x73\x65\x47\x72\x69\x64\x46\x6F\x72\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65","\x69\x6E\x69\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x73\x74\x61\x74\x65","\x67\x72\x61\x70\x68","\x76\x69\x65\x77","\x68\x61\x6E\x64\x6C\x65\x49\x6D\x61\x67\x65","\x73\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65","\x73\x72\x63","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x44\x49\x41\x4C\x45\x43\x54\x5F\x56\x4D\x4C","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x67\x65\x74\x56\x69\x65\x77","\x63\x75\x72\x73\x6F\x72","\x6E\x6F\x64\x65","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x43\x75\x72\x73\x6F\x72","\x72\x65\x64\x69\x72\x65\x63\x74\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73","\x64\x65\x66\x61\x75\x6C\x74","\x72\x65\x64\x72\x61\x77","\x62\x6F\x75\x6E\x64\x73","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x42\x6F\x75\x6E\x64\x73","\x64\x65\x73\x74\x72\x6F\x79","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x53\x6F\x75\x72\x63\x65","\x6D\x6F\x75\x73\x65\x4D\x6F\x76\x65","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74\x47\x72\x61\x70\x68\x58","\x67\x65\x74\x47\x72\x61\x70\x68\x59","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x50\x6F\x69\x6E\x74","\x67\x65\x74\x45\x76\x65\x6E\x74","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64\x45\x76\x65\x6E\x74","\x73\x63\x61\x6C\x65","\x73\x6E\x61\x70","\x75\x70\x64\x61\x74\x65\x53\x74\x79\x6C\x65","\x6D\x6F\x76\x65\x53\x69\x7A\x65\x72\x54\x6F","\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65","\x6D\x6F\x75\x73\x65\x55\x70","\x61\x70\x70\x6C\x79\x53\x74\x79\x6C\x65","\x72\x65\x73\x65\x74","\x67\x65\x74\x53\x68\x61\x70\x65\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x73\x68\x61\x70\x65","\x74\x6F\x52\x61\x64\x69\x61\x6E\x73","\x63\x6F\x73","\x73\x69\x6E","\x69\x73\x50\x61\x69\x6E\x74\x42\x6F\x75\x6E\x64\x73\x49\x6E\x76\x65\x72\x74\x65\x64","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x50\x6F\x69\x6E\x74","\x66\x6C\x69\x70\x48","\x66\x6C\x69\x70\x56","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x58","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x59","\x67\x65\x74\x52\x6F\x74\x61\x74\x65\x64\x50\x6F\x69\x6E\x74","\x75\x70\x64\x61\x74\x65\x53\x74\x79\x6C\x65\x55\x6E\x72\x6F\x74\x61\x74\x65\x64","\x72\x6F\x75\x6E\x64","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x63\x65\x6C\x6C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x72\x74\x53\x69\x7A\x65","\x64\x65\x66\x61\x75\x6C\x74\x56\x61\x6C\x75\x65","\x73\x63\x61\x6C\x65\x46\x61\x63\x74\x6F\x72","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x41\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x73\x74\x65\x6E\x63\x69\x6C","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73"];(function(){function _0x5b71x1(){}_0x5b71x1[_0xf2e3[0]]= new mxCylinder();_0x5b71x1[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x1;_0x5b71x1[_0xf2e3[0]][_0xf2e3[2]]=20;_0x5b71x1[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x8=Math[_0xf2e3[6]](_0x5b71x5,Math[_0xf2e3[6]](_0x5b71x6,mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]])));if(_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x8,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](_0x5b71x8,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](0,0);_0x5b71x2[_0xf2e3[7]](_0x5b71x8,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x8);_0x5b71x2[_0xf2e3[9]]()}else {_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71x8,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](_0x5b71x8,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6-_0x5b71x8);_0x5b71x2[_0xf2e3[8]](0,0);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[11]]=_0x5b71x1;function _0x5b71x9(){}_0x5b71x9[_0xf2e3[0]]= new mxCylinder();_0x5b71x9[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x9;_0x5b71x9[_0xf2e3[0]][_0xf2e3[2]]=30;_0x5b71x9[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x8=Math[_0xf2e3[6]](_0x5b71x5,Math[_0xf2e3[6]](_0x5b71x6,mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]])));if(_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x5-_0x5b71x8,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71x8,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x8);_0x5b71x2[_0xf2e3[9]]()}else {_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71x8,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,0);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[13]]=_0x5b71x9;function _0x5b71xa(){}_0x5b71xa[_0xf2e3[0]]= new mxCylinder();_0x5b71xa[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71xa;_0x5b71xa[_0xf2e3[0]][_0xf2e3[14]]=60;_0x5b71xa[_0xf2e3[0]][_0xf2e3[15]]=20;_0x5b71xa[_0xf2e3[0]][_0xf2e3[16]]=_0xf2e3[17];_0x5b71xa[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71xb=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[14],this[_0xf2e3[14]]);var _0x5b71xc=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[15],this[_0xf2e3[15]]);var _0x5b71xd=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[16],this[_0xf2e3[16]]);var _0x5b71xe=Math[_0xf2e3[6]](_0x5b71x5,_0x5b71xb);var _0x5b71xf=Math[_0xf2e3[6]](_0x5b71x6,_0x5b71xc);if(_0x5b71x7){if(_0x5b71xd==_0xf2e3[18]){_0x5b71x2[_0xf2e3[7]](0,_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71xe,_0x5b71xf)}else {_0x5b71x2[_0xf2e3[7]](_0x5b71x5-_0x5b71xe,_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71xf)};_0x5b71x2[_0xf2e3[9]]()}else {if(_0x5b71xd==_0xf2e3[18]){_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71xe,0);_0x5b71x2[_0xf2e3[8]](_0x5b71xe,_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71xf)}else {_0x5b71x2[_0xf2e3[7]](0,_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71xe,_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71xe,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,0)};_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71xf);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[19]]=_0x5b71xa;function _0x5b71x10(){}_0x5b71x10[_0xf2e3[0]]= new mxCylinder();_0x5b71x10[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x10;_0x5b71x10[_0xf2e3[0]][_0xf2e3[2]]=30;_0x5b71x10[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x8=Math[_0xf2e3[6]](_0x5b71x5,Math[_0xf2e3[6]](_0x5b71x6,mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]])));if(!_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x8,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x8);_0x5b71x2[_0xf2e3[8]](_0x5b71x8,0);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[20]]=_0x5b71x10;function _0x5b71x11(){}_0x5b71x11[_0xf2e3[0]]= new mxCylinder();_0x5b71x11[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x11;_0x5b71x11[_0xf2e3[0]][_0xf2e3[2]]=0.4;_0x5b71x11[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x8=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]]);var _0x5b71xf=_0x5b71x6*_0x5b71x8;var _0x5b71x12=1.4;if(!_0x5b71x7){_0x5b71x2[_0xf2e3[7]](0,_0x5b71xf/2);_0x5b71x2[_0xf2e3[21]](_0x5b71x5/4,_0x5b71xf*_0x5b71x12,_0x5b71x5/2,_0x5b71xf/2);_0x5b71x2[_0xf2e3[21]](_0x5b71x5*3/4,_0x5b71xf*(1-_0x5b71x12),_0x5b71x5,_0x5b71xf/2);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6-_0x5b71xf/2);_0x5b71x2[_0xf2e3[21]](_0x5b71x5*3/4,_0x5b71x6-_0x5b71xf*_0x5b71x12,_0x5b71x5/2,_0x5b71x6-_0x5b71xf/2);_0x5b71x2[_0xf2e3[21]](_0x5b71x5/4,_0x5b71x6-_0x5b71xf*(1-_0x5b71x12),0,_0x5b71x6-_0x5b71xf/2);_0x5b71x2[_0xf2e3[8]](0,_0x5b71xf/2);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[22]]=_0x5b71x11;function _0x5b71x13(){}_0x5b71x13[_0xf2e3[0]]= new mxCylinder();_0x5b71x13[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x13;_0x5b71x13[_0xf2e3[0]][_0xf2e3[2]]=0.2;_0x5b71x13[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x8=_0x5b71x5*mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]]);if(!_0x5b71x7){_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71x8,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6/2);_0x5b71x2[_0xf2e3[8]](_0x5b71x5-_0x5b71x8,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](_0x5b71x8,_0x5b71x6/2);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[23]]=_0x5b71x13;function _0x5b71x14(){mxRectangleShape[_0xf2e3[24]](this)}mxUtils[_0xf2e3[25]](_0x5b71x14,mxRectangleShape);_0x5b71x14[_0xf2e3[0]][_0xf2e3[26]]=function(){return false};_0x5b71x14[_0xf2e3[0]][_0xf2e3[27]]=function(_0x5b71x15,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6){var _0x5b71x16=Math[_0xf2e3[6]](_0x5b71x5/5,_0x5b71x6/5)+1;_0x5b71x15[_0xf2e3[28]]();_0x5b71x15[_0xf2e3[7]](_0x5b71x3+_0x5b71x5/2,_0x5b71x4+_0x5b71x16);_0x5b71x15[_0xf2e3[8]](_0x5b71x3+_0x5b71x5/2,_0x5b71x4+_0x5b71x6-_0x5b71x16);_0x5b71x15[_0xf2e3[7]](_0x5b71x3+_0x5b71x16,_0x5b71x4+_0x5b71x6/2);_0x5b71x15[_0xf2e3[8]](_0x5b71x3+_0x5b71x5-_0x5b71x16,_0x5b71x4+_0x5b71x6/2);_0x5b71x15[_0xf2e3[9]]();_0x5b71x15[_0xf2e3[29]]();mxRectangleShape[_0xf2e3[0]][_0xf2e3[27]][_0xf2e3[30]](this,arguments)};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[31]]=_0x5b71x14;function _0x5b71x17(){mxRectangleShape[_0xf2e3[24]](this)}mxUtils[_0xf2e3[25]](_0x5b71x17,mxRectangleShape);_0x5b71x17[_0xf2e3[0]][_0xf2e3[26]]=function(){return false};_0x5b71x17[_0xf2e3[0]][_0xf2e3[27]]=function(_0x5b71x15,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6){if(this[_0xf2e3[4]]!=null){if(this[_0xf2e3[4]][_0xf2e3[32]]==1){var _0x5b71x18=Math[_0xf2e3[34]](2,this[_0xf2e3[33]]+1);mxRectangleShape[_0xf2e3[0]][_0xf2e3[35]][_0xf2e3[24]](this,_0x5b71x15,_0x5b71x3+_0x5b71x18,_0x5b71x4+_0x5b71x18,_0x5b71x5-2*_0x5b71x18,_0x5b71x6-2*_0x5b71x18);mxRectangleShape[_0xf2e3[0]][_0xf2e3[27]][_0xf2e3[30]](this,arguments);_0x5b71x3+=_0x5b71x18;_0x5b71x4+=_0x5b71x18;_0x5b71x5-=2*_0x5b71x18;_0x5b71x6-=2*_0x5b71x18};_0x5b71x15[_0xf2e3[36]](false);var _0x5b71x19=0;var _0x5b71x1a=null;do{_0x5b71x1a=mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19]];if(_0x5b71x1a!=null){var _0x5b71x1b=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[38]];var _0x5b71x1c=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[39]];var _0x5b71x1d=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[40]];var _0x5b71x1e=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[41]];var _0x5b71x1f=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[42]]||0;var _0x5b71x20=this[_0xf2e3[4]][_0xf2e3[37]+_0x5b71x19+_0xf2e3[43]];if(_0x5b71x20!=null){_0x5b71x1f+=this[_0xf2e3[44]](_0x5b71x5+this[_0xf2e3[33]],_0x5b71x6+this[_0xf2e3[33]])*_0x5b71x20};var _0x5b71x21=_0x5b71x3;var _0x5b71x22=_0x5b71x4;if(_0x5b71x1b==mxConstants[_0xf2e3[45]]){_0x5b71x21+=(_0x5b71x5-_0x5b71x1d)/2}else {if(_0x5b71x1b==mxConstants[_0xf2e3[46]]){_0x5b71x21+=_0x5b71x5-_0x5b71x1d-_0x5b71x1f}else {_0x5b71x21+=_0x5b71x1f}};if(_0x5b71x1c==mxConstants[_0xf2e3[47]]){_0x5b71x22+=(_0x5b71x6-_0x5b71x1e)/2}else {if(_0x5b71x1c==mxConstants[_0xf2e3[48]]){_0x5b71x22+=_0x5b71x6-_0x5b71x1e-_0x5b71x1f}else {_0x5b71x22+=_0x5b71x1f}};_0x5b71x15[_0xf2e3[49]]();var _0x5b71x23= new _0x5b71x1a();_0x5b71x23[_0xf2e3[4]]=this[_0xf2e3[4]];_0x5b71x1a[_0xf2e3[0]][_0xf2e3[50]][_0xf2e3[24]](_0x5b71x23,_0x5b71x15,_0x5b71x21,_0x5b71x22,_0x5b71x1d,_0x5b71x1e);_0x5b71x15[_0xf2e3[51]]()};_0x5b71x19++}while(_0x5b71x1a!=null);}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[52]]=_0x5b71x17;function _0x5b71x24(){}_0x5b71x24[_0xf2e3[0]]= new mxCylinder();_0x5b71x24[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x24;_0x5b71x24[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){if(_0x5b71x7){_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5/2,_0x5b71x6/2);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,0);_0x5b71x2[_0xf2e3[9]]()}else {_0x5b71x2[_0xf2e3[7]](0,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[10]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[53]]=_0x5b71x24;function _0x5b71x25(){}_0x5b71x25[_0xf2e3[0]]= new mxCylinder();_0x5b71x25[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x25;_0x5b71x25[_0xf2e3[0]][_0xf2e3[54]]=true;_0x5b71x25[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x1d=_0x5b71x5/3;var _0x5b71x1e=_0x5b71x6/4;if(!_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[55]](_0x5b71x5/2-_0x5b71x1d,_0x5b71x1e,_0x5b71x5/2-_0x5b71x1d,0,_0x5b71x5/2,0);_0x5b71x2[_0xf2e3[55]](_0x5b71x5/2+_0x5b71x1d,0,_0x5b71x5/2+_0x5b71x1d,_0x5b71x1e,_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[8]](_0x5b71x5/2,2*_0x5b71x6/3);_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x6/3);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6/3);_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x6/3);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6/3);_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,2*_0x5b71x6/3);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x6);_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,2*_0x5b71x6/3);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[56]]=_0x5b71x25;function _0x5b71x26(){}_0x5b71x26[_0xf2e3[0]]= new mxCylinder();_0x5b71x26[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x26;_0x5b71x26[_0xf2e3[0]][_0xf2e3[2]]=10;_0x5b71x26[_0xf2e3[0]][_0xf2e3[54]]=true;_0x5b71x26[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71x27=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[2]]);var _0x5b71x1d=_0x5b71x27*2/3;var _0x5b71x1e=_0x5b71x27;if(!_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[55]](_0x5b71x5/2-_0x5b71x1d,_0x5b71x1e,_0x5b71x5/2-_0x5b71x1d,0,_0x5b71x5/2,0);_0x5b71x2[_0xf2e3[55]](_0x5b71x5/2+_0x5b71x1d,0,_0x5b71x5/2+_0x5b71x1d,_0x5b71x1e,_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[7]](_0x5b71x5/2,_0x5b71x1e);_0x5b71x2[_0xf2e3[8]](_0x5b71x5/2,_0x5b71x6);_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[57]]=_0x5b71x26;function _0x5b71x28(){}_0x5b71x28[_0xf2e3[0]]= new mxCylinder();_0x5b71x28[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x28;_0x5b71x28[_0xf2e3[0]][_0xf2e3[58]]=32;_0x5b71x28[_0xf2e3[0]][_0xf2e3[59]]=12;_0x5b71x28[_0xf2e3[0]][_0xf2e3[3]]=function(_0x5b71x2,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6,_0x5b71x7){var _0x5b71xe=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[58],this[_0xf2e3[58]]);var _0x5b71xf=mxUtils[_0xf2e3[5]](this[_0xf2e3[4]],_0xf2e3[59],this[_0xf2e3[59]]);var _0x5b71x29=_0x5b71xe/2;var _0x5b71x2a=_0x5b71x29+_0x5b71xe/2;var _0x5b71x2b=0.3*_0x5b71x6-_0x5b71xf/2;var _0x5b71x2c=0.7*_0x5b71x6-_0x5b71xf/2;if(_0x5b71x7){_0x5b71x2[_0xf2e3[7]](_0x5b71x29,_0x5b71x2b);_0x5b71x2[_0xf2e3[8]](_0x5b71x2a,_0x5b71x2b);_0x5b71x2[_0xf2e3[8]](_0x5b71x2a,_0x5b71x2b+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2b+_0x5b71xf);_0x5b71x2[_0xf2e3[7]](_0x5b71x29,_0x5b71x2c);_0x5b71x2[_0xf2e3[8]](_0x5b71x2a,_0x5b71x2c);_0x5b71x2[_0xf2e3[8]](_0x5b71x2a,_0x5b71x2c+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2c+_0x5b71xf);_0x5b71x2[_0xf2e3[9]]()}else {_0x5b71x2[_0xf2e3[7]](_0x5b71x29,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,0);_0x5b71x2[_0xf2e3[8]](_0x5b71x5,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x6);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2c+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x2c+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x2c);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2c);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2b+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x2b+_0x5b71xf);_0x5b71x2[_0xf2e3[8]](0,_0x5b71x2b);_0x5b71x2[_0xf2e3[8]](_0x5b71x29,_0x5b71x2b);_0x5b71x2[_0xf2e3[10]]();_0x5b71x2[_0xf2e3[9]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[60]]=_0x5b71x28;function _0x5b71x2d(){}_0x5b71x2d[_0xf2e3[0]]= new mxDoubleEllipse();_0x5b71x2d[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x2d;_0x5b71x2d[_0xf2e3[0]][_0xf2e3[61]]=true;_0x5b71x2d[_0xf2e3[0]][_0xf2e3[50]]=function(_0x5b71x15,_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6){var _0x5b71x18=Math[_0xf2e3[6]](4,Math[_0xf2e3[6]](_0x5b71x5/5,_0x5b71x6/5));if(_0x5b71x5>0&&_0x5b71x6>0){_0x5b71x15[_0xf2e3[62]](_0x5b71x3+_0x5b71x18,_0x5b71x4+_0x5b71x18,_0x5b71x5-2*_0x5b71x18,_0x5b71x6-2*_0x5b71x18);_0x5b71x15[_0xf2e3[63]]()};_0x5b71x15[_0xf2e3[64]](false);if(this[_0xf2e3[61]]){_0x5b71x15[_0xf2e3[62]](_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6);_0x5b71x15[_0xf2e3[29]]()}};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[65]]=_0x5b71x2d;function _0x5b71x2e(){}_0x5b71x2e[_0xf2e3[0]]= new _0x5b71x2d();_0x5b71x2e[_0xf2e3[0]][_0xf2e3[1]]=_0x5b71x2e;_0x5b71x2e[_0xf2e3[0]][_0xf2e3[61]]=false;mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[66]]=_0x5b71x2e;var _0x5b71x2f=mxImageExport[_0xf2e3[0]][_0xf2e3[67]];mxImageExport[_0xf2e3[0]][_0xf2e3[67]]=function(){_0x5b71x2f[_0xf2e3[30]](this,arguments);function _0x5b71x30(_0x5b71x31){return {drawShape:function(_0x5b71x32,_0x5b71x33,_0x5b71x34,_0x5b71x35){var _0x5b71x3=_0x5b71x34[_0xf2e3[68]];var _0x5b71x4=_0x5b71x34[_0xf2e3[69]];var _0x5b71x5=_0x5b71x34[_0xf2e3[70]];var _0x5b71x6=_0x5b71x34[_0xf2e3[71]];if(_0x5b71x35){var _0x5b71x18=Math[_0xf2e3[6]](4,Math[_0xf2e3[6]](_0x5b71x5/5,_0x5b71x6/5));_0x5b71x3+=_0x5b71x18;_0x5b71x4+=_0x5b71x18;_0x5b71x5-=2*_0x5b71x18;_0x5b71x6-=2*_0x5b71x18;if(_0x5b71x5>0&&_0x5b71x6>0){_0x5b71x32[_0xf2e3[62]](_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6)};return true}else {_0x5b71x32[_0xf2e3[63]]();if(_0x5b71x31){_0x5b71x32[_0xf2e3[62]](_0x5b71x3,_0x5b71x4,_0x5b71x5,_0x5b71x6);_0x5b71x32[_0xf2e3[29]]()}}}}}this[_0xf2e3[72]][_0xf2e3[65]]=_0x5b71x30(true);this[_0xf2e3[72]][_0xf2e3[66]]=_0x5b71x30(false)};function _0x5b71x36(){mxArrow[_0xf2e3[24]](this)}mxUtils[_0xf2e3[25]](_0x5b71x36,mxArrow);_0x5b71x36[_0xf2e3[0]][_0xf2e3[73]]=function(_0x5b71x15,_0x5b71x37){var _0x5b71x1d=10;var _0x5b71x38=_0x5b71x37[0];var _0x5b71x39=_0x5b71x37[_0x5b71x37[_0xf2e3[74]]-1];var _0x5b71xe=_0x5b71x39[_0xf2e3[68]]-_0x5b71x38[_0xf2e3[68]];var _0x5b71xf=_0x5b71x39[_0xf2e3[69]]-_0x5b71x38[_0xf2e3[69]];var _0x5b71x3a=Math[_0xf2e3[75]](_0x5b71xe*_0x5b71xe+_0x5b71xf*_0x5b71xf);var _0x5b71x3b=_0x5b71x3a;var _0x5b71x3c=_0x5b71xe/_0x5b71x3a;var _0x5b71x3d=_0x5b71xf/_0x5b71x3a;var _0x5b71x3e=_0x5b71x3b*_0x5b71x3c;var _0x5b71x3f=_0x5b71x3b*_0x5b71x3d;var _0x5b71x40=_0x5b71x1d*_0x5b71x3d/3;var _0x5b71x41=-_0x5b71x1d*_0x5b71x3c/3;var _0x5b71x42=_0x5b71x38[_0xf2e3[68]]-_0x5b71x40/2;var _0x5b71x43=_0x5b71x38[_0xf2e3[69]]-_0x5b71x41/2;var _0x5b71x44=_0x5b71x42+_0x5b71x40;var _0x5b71x45=_0x5b71x43+_0x5b71x41;var _0x5b71x46=_0x5b71x44+_0x5b71x3e;var _0x5b71x47=_0x5b71x45+_0x5b71x3f;var _0x5b71x48=_0x5b71x46+_0x5b71x40;var _0x5b71x49=_0x5b71x47+_0x5b71x41;var _0x5b71x4a=_0x5b71x48-3*_0x5b71x40;var _0x5b71x4b=_0x5b71x49-3*_0x5b71x41;_0x5b71x15[_0xf2e3[28]]();_0x5b71x15[_0xf2e3[7]](_0x5b71x44,_0x5b71x45);_0x5b71x15[_0xf2e3[8]](_0x5b71x46,_0x5b71x47);_0x5b71x15[_0xf2e3[7]](_0x5b71x4a+_0x5b71x40,_0x5b71x4b+_0x5b71x41);_0x5b71x15[_0xf2e3[8]](_0x5b71x42,_0x5b71x43);_0x5b71x15[_0xf2e3[29]]()};mxCellRenderer[_0xf2e3[0]][_0xf2e3[12]][_0xf2e3[76]]=_0x5b71x36;mxMarker[_0xf2e3[78]](_0xf2e3[77],function(_0x5b71x32,_0x5b71x1a,_0x5b71x4c,_0x5b71x39,_0x5b71x4d,_0x5b71x4e,_0x5b71x4f,_0x5b71x50,_0x5b71x51,_0x5b71x52){var _0x5b71x3c=_0x5b71x4d*(_0x5b71x4f+_0x5b71x51+1);var _0x5b71x3d=_0x5b71x4e*(_0x5b71x4f+_0x5b71x51+1);return function(){_0x5b71x32[_0xf2e3[28]]();_0x5b71x32[_0xf2e3[7]](_0x5b71x39[_0xf2e3[68]]-_0x5b71x3c/2-_0x5b71x3d/2,_0x5b71x39[_0xf2e3[69]]-_0x5b71x3d/2+_0x5b71x3c/2);_0x5b71x32[_0xf2e3[8]](_0x5b71x39[_0xf2e3[68]]+_0x5b71x3d/2-3*_0x5b71x3c/2,_0x5b71x39[_0xf2e3[69]]-3*_0x5b71x3d/2-_0x5b71x3c/2);_0x5b71x32[_0xf2e3[29]]()}});var _0x5b71x53=-99;if( typeof (mxVertexHandler)!=_0xf2e3[79]){function _0x5b71x54(_0x5b71x33){mxVertexHandler[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x54,mxVertexHandler);_0x5b71x54[_0xf2e3[0]][_0xf2e3[80]]=false;_0x5b71x54[_0xf2e3[0]][_0xf2e3[81]]=function(){this[_0xf2e3[82]]=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],mxConstants.STYLE_HORIZONTAL,true);var _0x5b71x55=this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]];if(this[_0xf2e3[86]]!=null){var _0x5b71x34= new mxRectangle(0,0,this[_0xf2e3[86]][_0xf2e3[70]],this[_0xf2e3[86]][_0xf2e3[71]]);this[_0xf2e3[87]]= new mxImageShape(_0x5b71x34,this[_0xf2e3[86]][_0xf2e3[88]])}else {var _0x5b71x4f=10;var _0x5b71x34= new mxRectangle(0,0,_0x5b71x4f,_0x5b71x4f);this[_0xf2e3[87]]= new mxRhombus(_0x5b71x34,mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)};this[_0xf2e3[87]][_0xf2e3[89]]=(_0x5b71x55[_0xf2e3[89]]!=mxConstants[_0xf2e3[90]])?mxConstants[_0xf2e3[91]]:mxConstants[_0xf2e3[90]];this[_0xf2e3[87]][_0xf2e3[81]](_0x5b71x55[_0xf2e3[93]]()[_0xf2e3[92]]());this[_0xf2e3[87]][_0xf2e3[95]][_0xf2e3[4]][_0xf2e3[94]]=this[_0xf2e3[96]]();mxEvent[_0xf2e3[97]](this[_0xf2e3[87]][_0xf2e3[95]],_0x5b71x55,this[_0xf2e3[83]]);mxVertexHandler[_0xf2e3[0]][_0xf2e3[81]][_0xf2e3[30]](this,arguments)};_0x5b71x54[_0xf2e3[0]][_0xf2e3[96]]=function(){return _0xf2e3[98]};_0x5b71x54[_0xf2e3[0]][_0xf2e3[99]]=function(){mxVertexHandler[_0xf2e3[0]][_0xf2e3[99]][_0xf2e3[30]](this,arguments);var _0x5b71x4f=this[_0xf2e3[87]][_0xf2e3[100]][_0xf2e3[70]];this[_0xf2e3[87]][_0xf2e3[100]]=this[_0xf2e3[101]](_0x5b71x4f);this[_0xf2e3[87]][_0xf2e3[99]]()};_0x5b71x54[_0xf2e3[0]][_0xf2e3[102]]=function(){mxVertexHandler[_0xf2e3[0]][_0xf2e3[102]][_0xf2e3[30]](this,arguments);if(this[_0xf2e3[87]]!=null){this[_0xf2e3[87]][_0xf2e3[102]]();this[_0xf2e3[87]]=null}};_0x5b71x54[_0xf2e3[0]][_0xf2e3[103]]=function(_0x5b71x56){if(_0x5b71x56[_0xf2e3[104]](this[_0xf2e3[87]])){return _0x5b71x53};return mxVertexHandler[_0xf2e3[0]][_0xf2e3[103]][_0xf2e3[30]](this,arguments)};_0x5b71x54[_0xf2e3[0]][_0xf2e3[105]]=function(_0x5b71x57,_0x5b71x56){if(!_0x5b71x56[_0xf2e3[106]]()&&this[_0xf2e3[107]]==_0x5b71x53){var _0x5b71x58= new mxPoint(_0x5b71x56[_0xf2e3[108]](),_0x5b71x56[_0xf2e3[109]]());this[_0xf2e3[110]](_0x5b71x58);var _0x5b71x59=this[_0xf2e3[84]][_0xf2e3[112]](_0x5b71x56[_0xf2e3[111]]());var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];if(_0x5b71x59&&this[_0xf2e3[80]]){_0x5b71x58[_0xf2e3[68]]=this[_0xf2e3[84]][_0xf2e3[114]](_0x5b71x58[_0xf2e3[68]]/_0x5b71x5a)*_0x5b71x5a;_0x5b71x58[_0xf2e3[69]]=this[_0xf2e3[84]][_0xf2e3[114]](_0x5b71x58[_0xf2e3[69]]/_0x5b71x5a)*_0x5b71x5a};this[_0xf2e3[115]](_0x5b71x58);this[_0xf2e3[116]](this[_0xf2e3[87]],_0x5b71x58[_0xf2e3[68]],_0x5b71x58[_0xf2e3[69]]);this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]][_0xf2e3[117]][_0xf2e3[99]](this[_0xf2e3[83]],true);_0x5b71x56[_0xf2e3[118]]()}else {mxVertexHandler[_0xf2e3[0]][_0xf2e3[105]][_0xf2e3[30]](this,arguments)}};_0x5b71x54[_0xf2e3[0]][_0xf2e3[119]]=function(_0x5b71x57,_0x5b71x56){if(!_0x5b71x56[_0xf2e3[106]]()&&this[_0xf2e3[107]]==_0x5b71x53){this[_0xf2e3[120]]();this[_0xf2e3[121]]();_0x5b71x56[_0xf2e3[118]]()}else {mxVertexHandler[_0xf2e3[0]][_0xf2e3[119]][_0xf2e3[30]](this,arguments)}};_0x5b71x54[_0xf2e3[0]][_0xf2e3[101]]=function(_0x5b71x4f){var _0x5b71x5b=this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[122]]();var _0x5b71x5c=mxUtils[_0xf2e3[124]](_0x5b71x5b);var _0x5b71x5d=Math[_0xf2e3[125]](_0x5b71x5c);var _0x5b71x5e=Math[_0xf2e3[126]](_0x5b71x5c);var _0x5b71x34= new mxRectangle(this[_0xf2e3[83]][_0xf2e3[68]],this[_0xf2e3[83]][_0xf2e3[69]],this[_0xf2e3[83]][_0xf2e3[70]],this[_0xf2e3[83]][_0xf2e3[71]]);if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[127]]()){var _0x5b71x5f=(_0x5b71x34[_0xf2e3[70]]-_0x5b71x34[_0xf2e3[71]])/2;_0x5b71x34[_0xf2e3[68]]+=_0x5b71x5f;_0x5b71x34[_0xf2e3[69]]-=_0x5b71x5f;var _0x5b71x23=_0x5b71x34[_0xf2e3[70]];_0x5b71x34[_0xf2e3[70]]=_0x5b71x34[_0xf2e3[71]];_0x5b71x34[_0xf2e3[71]]=_0x5b71x23};var _0x5b71x60=this[_0xf2e3[128]](_0x5b71x34);if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[129]]){_0x5b71x60[_0xf2e3[68]]=2*_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x60[_0xf2e3[68]]};if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[130]]){_0x5b71x60[_0xf2e3[69]]=2*_0x5b71x34[_0xf2e3[69]]+_0x5b71x34[_0xf2e3[71]]-_0x5b71x60[_0xf2e3[69]]};_0x5b71x60=mxUtils[_0xf2e3[133]](_0x5b71x60,_0x5b71x5d,_0x5b71x5e, new mxPoint(this[_0xf2e3[83]][_0xf2e3[131]](),this[_0xf2e3[83]][_0xf2e3[132]]()));return new mxRectangle(_0x5b71x60[_0xf2e3[68]]-_0x5b71x4f/2,_0x5b71x60[_0xf2e3[69]]-_0x5b71x4f/2,_0x5b71x4f,_0x5b71x4f)};_0x5b71x54[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){return null};_0x5b71x54[_0xf2e3[0]][_0xf2e3[115]]=function(_0x5b71x58){};_0x5b71x54[_0xf2e3[0]][_0xf2e3[110]]=function(_0x5b71x58){_0x5b71x58[_0xf2e3[68]]=Math[_0xf2e3[34]](this[_0xf2e3[83]][_0xf2e3[68]],Math[_0xf2e3[6]](this[_0xf2e3[83]][_0xf2e3[68]]+this[_0xf2e3[83]][_0xf2e3[70]],_0x5b71x58[_0xf2e3[68]]));_0x5b71x58[_0xf2e3[69]]=Math[_0xf2e3[34]](this[_0xf2e3[83]][_0xf2e3[69]],Math[_0xf2e3[6]](this[_0xf2e3[83]][_0xf2e3[69]]+this[_0xf2e3[83]][_0xf2e3[71]],_0x5b71x58[_0xf2e3[69]]))};_0x5b71x54[_0xf2e3[0]][_0xf2e3[120]]=function(){};function _0x5b71x61(_0x5b71x33){_0x5b71x54[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x61,_0x5b71x54);_0x5b71x61[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];var _0x5b71xb=Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[70]],mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[14],60)*_0x5b71x5a);var _0x5b71xc=Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]],mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[15],20)*_0x5b71x5a);var _0x5b71xd=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[16],_0xf2e3[17]);var _0x5b71x3=(_0x5b71xd==_0xf2e3[18])?_0x5b71x34[_0xf2e3[68]]+_0x5b71xb:_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71xb;return new mxPoint(_0x5b71x3,_0x5b71x34[_0xf2e3[69]]+_0x5b71xc)};_0x5b71x61[_0xf2e3[0]][_0xf2e3[115]]=function(_0x5b71x58){var _0x5b71x5b=this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[122]]();var _0x5b71x5c=mxUtils[_0xf2e3[124]](_0x5b71x5b);var _0x5b71x5d=Math[_0xf2e3[125]](-_0x5b71x5c);var _0x5b71x5e=Math[_0xf2e3[126]](-_0x5b71x5c);var _0x5b71x34= new mxRectangle(this[_0xf2e3[83]][_0xf2e3[68]],this[_0xf2e3[83]][_0xf2e3[69]],this[_0xf2e3[83]][_0xf2e3[70]],this[_0xf2e3[83]][_0xf2e3[71]]);if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[127]]()){var _0x5b71x5f=(_0x5b71x34[_0xf2e3[70]]-_0x5b71x34[_0xf2e3[71]])/2;_0x5b71x34[_0xf2e3[68]]+=_0x5b71x5f;_0x5b71x34[_0xf2e3[69]]-=_0x5b71x5f;var _0x5b71x23=_0x5b71x34[_0xf2e3[70]];_0x5b71x34[_0xf2e3[70]]=_0x5b71x34[_0xf2e3[71]];_0x5b71x34[_0xf2e3[71]]=_0x5b71x23};var _0x5b71x60= new mxPoint(_0x5b71x58[_0xf2e3[68]],_0x5b71x58[_0xf2e3[69]]);_0x5b71x60=mxUtils[_0xf2e3[133]](_0x5b71x60,_0x5b71x5d,_0x5b71x5e, new mxPoint(this[_0xf2e3[83]][_0xf2e3[131]](),this[_0xf2e3[83]][_0xf2e3[132]]()));if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[129]]){_0x5b71x60[_0xf2e3[68]]=2*_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x60[_0xf2e3[68]]};if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[130]]){_0x5b71x60[_0xf2e3[69]]=2*_0x5b71x34[_0xf2e3[69]]+_0x5b71x34[_0xf2e3[71]]-_0x5b71x60[_0xf2e3[69]]};var _0x5b71x62=this[_0xf2e3[134]](_0x5b71x60,_0x5b71x34);if(_0x5b71x62!=null){if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[129]]){_0x5b71x62[_0xf2e3[68]]=2*_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x62[_0xf2e3[68]]};if(this[_0xf2e3[83]][_0xf2e3[123]][_0xf2e3[130]]){_0x5b71x62[_0xf2e3[69]]=2*_0x5b71x34[_0xf2e3[69]]+_0x5b71x34[_0xf2e3[71]]-_0x5b71x62[_0xf2e3[69]]};_0x5b71x5d=Math[_0xf2e3[125]](_0x5b71x5c);_0x5b71x5e=Math[_0xf2e3[126]](_0x5b71x5c);_0x5b71x62=mxUtils[_0xf2e3[133]](_0x5b71x62,_0x5b71x5d,_0x5b71x5e, new mxPoint(this[_0xf2e3[83]][_0xf2e3[131]](),this[_0xf2e3[83]][_0xf2e3[132]]()));_0x5b71x58[_0xf2e3[68]]=_0x5b71x62[_0xf2e3[68]];_0x5b71x58[_0xf2e3[69]]=_0x5b71x62[_0xf2e3[69]]}};_0x5b71x61[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x60,_0x5b71x34){var _0x5b71xd=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[16],_0xf2e3[17]);var _0x5b71xb=(_0x5b71xd==_0xf2e3[18])?_0x5b71x60[_0xf2e3[68]]-_0x5b71x34[_0xf2e3[68]]:_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x60[_0xf2e3[68]];var _0x5b71xc=_0x5b71x60[_0xf2e3[69]]-_0x5b71x34[_0xf2e3[69]];var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[14]]=Math[_0xf2e3[135]](Math[_0xf2e3[34]](1,_0x5b71xb)/_0x5b71x5a);this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[15]]=Math[_0xf2e3[135]](Math[_0xf2e3[34]](1,_0x5b71xc)/_0x5b71x5a)};_0x5b71x61[_0xf2e3[0]][_0xf2e3[120]]=function(){var _0x5b71x63=this[_0xf2e3[84]][_0xf2e3[136]]();_0x5b71x63[_0xf2e3[137]]();try{this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]][_0xf2e3[139]](_0xf2e3[14],this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[14]],[this[_0xf2e3[83]][_0xf2e3[138]]]);this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]][_0xf2e3[139]](_0xf2e3[15],this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[15]],[this[_0xf2e3[83]][_0xf2e3[138]]])}finally{_0x5b71x63[_0xf2e3[140]]()}};function _0x5b71x64(_0x5b71x33){_0x5b71x61[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x64,_0x5b71x61);_0x5b71x64[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];var _0x5b71x65=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]/2,_0x5b71x34[_0xf2e3[69]]+Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]],_0x5b71x65*_0x5b71x5a))};_0x5b71x64[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x58,_0x5b71x34){_0x5b71x58[_0xf2e3[68]]=_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]/2;startSize=_0x5b71x58[_0xf2e3[69]]-_0x5b71x34[_0xf2e3[69]];var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[141]]=Math[_0xf2e3[135]](Math[_0xf2e3[34]](1,startSize)/_0x5b71x5a);return _0x5b71x58};_0x5b71x64[_0xf2e3[0]][_0xf2e3[120]]=function(){this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]][_0xf2e3[139]](_0xf2e3[141],this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[141]],[this[_0xf2e3[83]][_0xf2e3[138]]])};function _0x5b71x66(_0x5b71x33){_0x5b71x61[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x66,_0x5b71x61);_0x5b71x66[_0xf2e3[0]][_0xf2e3[142]]=20;_0x5b71x66[_0xf2e3[0]][_0xf2e3[143]]=1;_0x5b71x66[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];var _0x5b71x67=Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[70]],Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]],mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[142]])*_0x5b71x5a/this[_0xf2e3[143]]));return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x67,_0x5b71x34[_0xf2e3[69]]+_0x5b71x67)};_0x5b71x66[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x60,_0x5b71x34){var _0x5b71x4f=Math[_0xf2e3[34]](0,Math[_0xf2e3[6]](Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[70]]/this[_0xf2e3[143]],_0x5b71x60[_0xf2e3[68]]-_0x5b71x34[_0xf2e3[68]]),Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]]/this[_0xf2e3[143]],_0x5b71x60[_0xf2e3[69]]-_0x5b71x34[_0xf2e3[69]])));var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[2]]=Math[_0xf2e3[135]](Math[_0xf2e3[34]](1,_0x5b71x4f)/_0x5b71x5a)*this[_0xf2e3[143]];return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x4f,_0x5b71x34[_0xf2e3[69]]+_0x5b71x4f)};_0x5b71x66[_0xf2e3[0]][_0xf2e3[120]]=function(){this[_0xf2e3[83]][_0xf2e3[85]][_0xf2e3[84]][_0xf2e3[139]](_0xf2e3[2],this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[2]],[this[_0xf2e3[83]][_0xf2e3[138]]])};function _0x5b71x68(_0x5b71x33){_0x5b71x66[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x68,_0x5b71x66);_0x5b71x68[_0xf2e3[0]][_0xf2e3[142]]=30;_0x5b71x68[_0xf2e3[0]][_0xf2e3[143]]=2;function _0x5b71x69(_0x5b71x33){_0x5b71x66[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x69,_0x5b71x66);_0x5b71x69[_0xf2e3[0]][_0xf2e3[142]]=30;_0x5b71x69[_0xf2e3[0]][_0xf2e3[143]]=1;_0x5b71x69[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];var _0x5b71x67=Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[70]],Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]],mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[142]])*_0x5b71x5a/this[_0xf2e3[143]]));return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x67,_0x5b71x34[_0xf2e3[69]]+_0x5b71x67)};_0x5b71x69[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x60,_0x5b71x34){var _0x5b71x4f=Math[_0xf2e3[34]](0,Math[_0xf2e3[6]](Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[70]]/this[_0xf2e3[143]],_0x5b71x60[_0xf2e3[68]]-_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]),Math[_0xf2e3[6]](_0x5b71x34[_0xf2e3[71]]/this[_0xf2e3[143]],_0x5b71x60[_0xf2e3[69]]-_0x5b71x34[_0xf2e3[69]])));var _0x5b71x5a=this[_0xf2e3[84]][_0xf2e3[93]]()[_0xf2e3[113]];this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[2]]=Math[_0xf2e3[135]](Math[_0xf2e3[34]](1,_0x5b71x4f)/_0x5b71x5a)*this[_0xf2e3[143]];return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]-_0x5b71x4f,_0x5b71x34[_0xf2e3[69]]+_0x5b71x4f)};function _0x5b71x6a(_0x5b71x33){_0x5b71x66[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x6a,_0x5b71x66);_0x5b71x6a[_0xf2e3[0]][_0xf2e3[142]]=0.2;_0x5b71x6a[_0xf2e3[0]][_0xf2e3[143]]=1;_0x5b71x6a[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x67=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[142]]);return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]*_0x5b71x67,_0x5b71x34[_0xf2e3[69]]+_0x5b71x34[_0xf2e3[71]]/2)};_0x5b71x6a[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x60,_0x5b71x34){var _0x5b71x4f=Math[_0xf2e3[6]](1,(_0x5b71x60[_0xf2e3[68]]-_0x5b71x34[_0xf2e3[68]])/_0x5b71x34[_0xf2e3[70]]);this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[2]]=_0x5b71x4f;return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x4f*_0x5b71x34[_0xf2e3[70]],_0x5b71x34[_0xf2e3[69]]+_0x5b71x34[_0xf2e3[71]]/2)};function _0x5b71x6b(_0x5b71x33){_0x5b71x66[_0xf2e3[24]](this,_0x5b71x33)}mxUtils[_0xf2e3[25]](_0x5b71x6b,_0x5b71x66);_0x5b71x6b[_0xf2e3[0]][_0xf2e3[142]]=0.4;_0x5b71x6b[_0xf2e3[0]][_0xf2e3[143]]=1;_0x5b71x6b[_0xf2e3[0]][_0xf2e3[128]]=function(_0x5b71x34){var _0x5b71x67=mxUtils[_0xf2e3[5]](this[_0xf2e3[83]][_0xf2e3[4]],_0xf2e3[2],this[_0xf2e3[142]]);return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]/2,_0x5b71x34[_0xf2e3[69]]+_0x5b71x67*_0x5b71x34[_0xf2e3[71]]/2)};_0x5b71x6b[_0xf2e3[0]][_0xf2e3[134]]=function(_0x5b71x60,_0x5b71x34){var _0x5b71x4f=Math[_0xf2e3[34]](0,Math[_0xf2e3[6]](1,((_0x5b71x60[_0xf2e3[69]]-_0x5b71x34[_0xf2e3[69]])/_0x5b71x34[_0xf2e3[71]])*2));this[_0xf2e3[83]][_0xf2e3[4]][_0xf2e3[2]]=_0x5b71x4f;return new mxPoint(_0x5b71x34[_0xf2e3[68]]+_0x5b71x34[_0xf2e3[70]]/2,_0x5b71x34[_0xf2e3[69]]+_0x5b71x4f*_0x5b71x34[_0xf2e3[71]]/2)};var _0x5b71x6c={"\x73\x77\x69\x6D\x6C\x61\x6E\x65":_0x5b71x64,"\x66\x6F\x6C\x64\x65\x72":_0x5b71x61,"\x63\x75\x62\x65":_0x5b71x66,"\x63\x61\x72\x64":_0x5b71x68,"\x6E\x6F\x74\x65":_0x5b71x69,"\x73\x74\x65\x70":_0x5b71x6a,"\x74\x61\x70\x65":_0x5b71x6b};var _0x5b71x6d=mxGraph[_0xf2e3[0]][_0xf2e3[144]];mxGraph[_0xf2e3[0]][_0xf2e3[144]]=function(_0x5b71x33){if(_0x5b71x33!=null){var _0x5b71x6e=_0x5b71x6c[_0x5b71x33[_0xf2e3[4]][_0xf2e3[123]]];if(_0x5b71x6e!=null){return new _0x5b71x6e(_0x5b71x33)}};return _0x5b71x6d[_0xf2e3[30]](this,arguments)}};mxGraph[_0xf2e3[0]][_0xf2e3[145]]=function(_0x5b71x6f,_0x5b71x50){if(_0x5b71x6f!=null&&_0x5b71x6f[_0xf2e3[123]]!=null){if(_0x5b71x6f[_0xf2e3[123]][_0xf2e3[146]]!=null){if(_0x5b71x6f[_0xf2e3[123]][_0xf2e3[146]]!=null){return _0x5b71x6f[_0xf2e3[123]][_0xf2e3[146]][_0xf2e3[147]]}}else {if(_0x5b71x6f[_0xf2e3[123]][_0xf2e3[147]]!=null){return _0x5b71x6f[_0xf2e3[123]][_0xf2e3[147]]}}};return null};mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0,0.25),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(1,0.25),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];mxLabel[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];mxImageShape[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];mxSwimlane[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];_0x5b71x14[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];_0x5b71x9[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];_0x5b71x10[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];_0x5b71x1[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];_0x5b71xa[_0xf2e3[0]][_0xf2e3[147]]=mxRectangleShape[_0xf2e3[0]][_0xf2e3[147]];mxCylinder[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.15,0.05),false), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.85,0.05),false), new mxConnectionConstraint( new mxPoint(0,0.3),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.7),true), new mxConnectionConstraint( new mxPoint(1,0.3),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.7),true), new mxConnectionConstraint( new mxPoint(0.15,0.95),false), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.85,0.95),false)];_0x5b71x25[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0.1),false), new mxConnectionConstraint( new mxPoint(0.5,0),false), new mxConnectionConstraint( new mxPoint(0.75,0.1),false), new mxConnectionConstraint( new mxPoint(0,1/3),false), new mxConnectionConstraint( new mxPoint(0,1),false), new mxConnectionConstraint( new mxPoint(1,1/3),false), new mxConnectionConstraint( new mxPoint(1,1),false), new mxConnectionConstraint( new mxPoint(0.5,0.5),false)];_0x5b71x28[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0,0.3),true), new mxConnectionConstraint( new mxPoint(0,0.7),true), new mxConnectionConstraint( new mxPoint(1,0.25),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];mxActor[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.25,0.2),false), new mxConnectionConstraint( new mxPoint(0.1,0.5),false), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(0.75,0.25),false), new mxConnectionConstraint( new mxPoint(0.9,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];_0x5b71x11[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.35),false), new mxConnectionConstraint( new mxPoint(0,0.5),false), new mxConnectionConstraint( new mxPoint(0,0.65),false), new mxConnectionConstraint( new mxPoint(1,0.35),false), new mxConnectionConstraint( new mxPoint(1,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.65),false), new mxConnectionConstraint( new mxPoint(0.25,1),false), new mxConnectionConstraint( new mxPoint(0.75,0),false)];_0x5b71x13[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true), new mxConnectionConstraint( new mxPoint(0.1,0.25),false), new mxConnectionConstraint( new mxPoint(0.2,0.5),false), new mxConnectionConstraint( new mxPoint(0.1,0.75),false), new mxConnectionConstraint( new mxPoint(0.9,0.25),false), new mxConnectionConstraint( new mxPoint(1,0.5),false), new mxConnectionConstraint( new mxPoint(0.9,0.75),false)];mxLine[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.5),false), new mxConnectionConstraint( new mxPoint(0.25,0.5),false), new mxConnectionConstraint( new mxPoint(0.75,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.5),false)];_0x5b71x26[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.5,0),false), new mxConnectionConstraint( new mxPoint(0.5,1),false)];mxEllipse[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0,0),true), new mxConnectionConstraint( new mxPoint(1,0),true), new mxConnectionConstraint( new mxPoint(0,1),true), new mxConnectionConstraint( new mxPoint(1,1),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.5))];mxDoubleEllipse[_0xf2e3[0]][_0xf2e3[147]]=mxEllipse[_0xf2e3[0]][_0xf2e3[147]];mxRhombus[_0xf2e3[0]][_0xf2e3[147]]=mxEllipse[_0xf2e3[0]][_0xf2e3[147]];mxTriangle[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.25),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(1,0.5),true)];mxHexagon[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.375,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.625,0),true), new mxConnectionConstraint( new mxPoint(0.125,0.25),false), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0.125,0.75),false), new mxConnectionConstraint( new mxPoint(0.875,0.25),false), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(0.875,0.75),false), new mxConnectionConstraint( new mxPoint(0.375,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.625,1),true)];mxCloud[_0xf2e3[0]][_0xf2e3[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0.25),false), new mxConnectionConstraint( new mxPoint(0.4,0.1),false), new mxConnectionConstraint( new mxPoint(0.16,0.55),false), new mxConnectionConstraint( new mxPoint(0.07,0.4),false), new mxConnectionConstraint( new mxPoint(0.31,0.8),false), new mxConnectionConstraint( new mxPoint(0.13,0.77),false), new mxConnectionConstraint( new mxPoint(0.8,0.8),false), new mxConnectionConstraint( new mxPoint(0.55,0.95),false), new mxConnectionConstraint( new mxPoint(0.875,0.5),false), new mxConnectionConstraint( new mxPoint(0.96,0.7),false), new mxConnectionConstraint( new mxPoint(0.625,0.2),false), new mxConnectionConstraint( new mxPoint(0.88,0.25),false)];mxArrow[_0xf2e3[0]][_0xf2e3[147]]=null})() \ No newline at end of file +/** + * $Id: Shapes.js,v 1.13 2013-02-02 06:44:30 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ + +/** + * Registers shapes. + */ +(function() +{ + // Cube Shape, supports size style + function CubeShape() { }; + CubeShape.prototype = new mxCylinder(); + CubeShape.prototype.constructor = CubeShape; + CubeShape.prototype.size = 20; + CubeShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (isForeground) + { + path.moveTo(s, h); + path.lineTo(s, s); + path.lineTo(0, 0); + path.moveTo(s, s); + path.lineTo(w, s); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, s); + path.lineTo(w, h); + path.lineTo(s, h); + path.lineTo(0, h - s); + path.lineTo(0, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['cube'] = CubeShape; + + // Note Shape, supports size style + function NoteShape() { }; + NoteShape.prototype = new mxCylinder(); + NoteShape.prototype.constructor = NoteShape; + NoteShape.prototype.size = 30; + NoteShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (isForeground) + { + path.moveTo(w - s, 0); + path.lineTo(w - s, s); + path.lineTo(w, s); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, s); + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['note'] = NoteShape; + + // Folder Shape, supports tabWidth, tabHeight styles + function FolderShape() { }; + FolderShape.prototype = new mxCylinder(); + FolderShape.prototype.constructor = FolderShape; + FolderShape.prototype.tabWidth = 60; + FolderShape.prototype.tabHeight = 20; + FolderShape.prototype.tabPosition = 'right'; + FolderShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var tw = mxUtils.getValue(this.style, 'tabWidth', this.tabWidth); + var th = mxUtils.getValue(this.style, 'tabHeight', this.tabHeight); + var tp = mxUtils.getValue(this.style, 'tabPosition', this.tabPosition); + var dx = Math.min(w, tw); + var dy = Math.min(h, th); + + if (isForeground) + { + if (tp == 'left') + { + path.moveTo(0, dy); + path.lineTo(dx, dy); + } + // Right is default + else + { + path.moveTo(w - dx, dy); + path.lineTo(w, dy); + } + + path.end(); + } + else + { + if (tp == 'left') + { + path.moveTo(0, 0); + path.lineTo(dx, 0); + path.lineTo(dx, dy); + path.lineTo(w, dy); + } + // Right is default + else + { + path.moveTo(0, dy); + path.lineTo(w - dx, dy); + path.lineTo(w - dx, 0); + path.lineTo(w, 0); + } + + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, dy); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['folder'] = FolderShape; + + // Card Shape, supports size style + function CardShape() { }; + CardShape.prototype = new mxCylinder(); + CardShape.prototype.constructor = CardShape; + CardShape.prototype.size = 30; + CardShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (!isForeground) + { + path.moveTo(s, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, s); + path.lineTo(s, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['card'] = CardShape; + + // Tape Shape, supports size style + function TapeShape() { }; + TapeShape.prototype = new mxCylinder(); + TapeShape.prototype.constructor = TapeShape; + TapeShape.prototype.size = 0.4; + TapeShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = mxUtils.getValue(this.style, 'size', this.size); + var dy = h * s; + var fy = 1.4; + + if (!isForeground) + { + path.moveTo(0, dy / 2); + path.quadTo(w / 4, dy * fy, w / 2, dy / 2); + path.quadTo(w * 3 / 4, dy * (1 - fy), w, dy / 2); + path.lineTo(w, h - dy / 2); + path.quadTo(w * 3 / 4, h - dy * fy, w / 2, h - dy / 2); + path.quadTo(w / 4, h - dy * (1 - fy), 0, h - dy / 2); + path.lineTo(0, dy / 2); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['tape'] = TapeShape; + + // Tape Shape, supports size style + function StepShape() { }; + StepShape.prototype = new mxCylinder(); + StepShape.prototype.constructor = StepShape; + StepShape.prototype.size = 0.2; + StepShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = w * mxUtils.getValue(this.style, 'size', this.size); + + if (!isForeground) + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, h / 2); + path.lineTo(w - s, h); + path.lineTo(0, h); + path.lineTo(s, h / 2); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['step'] = StepShape; + + // Plus Shape + function PlusShape() + { + mxRectangleShape.call(this); + }; + mxUtils.extend(PlusShape, mxRectangleShape); + PlusShape.prototype.isHtmlAllowed = function() + { + return false; + }; + PlusShape.prototype.paintForeground = function(c, x, y, w, h) + { + var border = Math.min(w / 5, h / 5) + 1; + + c.begin(); + c.moveTo(x + w / 2, y + border); + c.lineTo(x + w / 2, y + h - border); + c.moveTo(x + border, y + h / 2); + c.lineTo(x + w - border, y + h / 2); + c.end(); + c.stroke(); + mxRectangleShape.prototype.paintForeground.apply(this, arguments); + }; + + mxCellRenderer.prototype.defaultShapes['plus'] = PlusShape; + + // CompositeShape + function ExtendedShape() + { + mxRectangleShape.call(this); + }; + mxUtils.extend(ExtendedShape, mxRectangleShape); + ExtendedShape.prototype.isHtmlAllowed = function() + { + return false; + }; + ExtendedShape.prototype.paintForeground = function(c, x, y, w, h) + { + if (this.style != null) + { + if (this.style['double'] == 1) + { + var inset = Math.max(2, this.strokewidth + 1); + + mxRectangleShape.prototype.paintBackground.call(this, c, x + inset, y + inset, w - 2 * inset, h - 2 * inset); + mxRectangleShape.prototype.paintForeground.apply(this, arguments); + + x += inset; + y += inset; + w -= 2 * inset; + h -= 2 * inset; + } + + c.setDashed(false); + + // Draws the symbols defined in the style. The symbols are + // numbered from 1...n. Possible postfixes are align, + // verticalAlign, spacing, arcSpacing, width, height + var counter = 0; + var shape = null; + + do + { + shape = mxCellRenderer.prototype.defaultShapes[this.style['symbol' + counter]]; + + if (shape != null) + { + var align = this.style['symbol' + counter + 'Align']; + var valign = this.style['symbol' + counter + 'VerticalAlign']; + var width = this.style['symbol' + counter + 'Width']; + var height = this.style['symbol' + counter + 'Height']; + var spacing = this.style['symbol' + counter + 'Spacing'] || 0; + var arcspacing = this.style['symbol' + counter + 'ArcSpacing']; + + if (arcspacing != null) + { + spacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing; + } + + var x2 = x; + var y2 = y; + + if (align == mxConstants.ALIGN_CENTER) + { + x2 += (w - width) / 2; + } + else if (align == mxConstants.ALIGN_RIGHT) + { + x2 += w - width - spacing; + } + else + { + x2 += spacing; + } + + if (valign == mxConstants.ALIGN_MIDDLE) + { + y2 += (h - height) / 2; + } + else if (valign == mxConstants.ALIGN_BOTTOM) + { + y2 += h - height - spacing; + } + else + { + y2 += spacing; + } + + c.save(); + + // Small hack to pass style along into subshape + var tmp = new shape(); + // TODO: Clone style and override settings (eg. strokewidth) + tmp.style = this.style; + shape.prototype.paintVertexShape.call(tmp, c, x2, y2, width, height); + c.restore(); + } + + counter++; + } + while (shape != null); + } + }; + + mxCellRenderer.prototype.defaultShapes['ext'] = ExtendedShape; + + // Tape Shape, supports size style + function MessageShape() { }; + MessageShape.prototype = new mxCylinder(); + MessageShape.prototype.constructor = MessageShape; + MessageShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + if (isForeground) + { + path.moveTo(0, 0); + path.lineTo(w / 2, h / 2); + path.lineTo(w, 0); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(0, h); + path.close(); + } + }; + + mxCellRenderer.prototype.defaultShapes['message'] = MessageShape; + + // New Actor Shape + function UmlActorShape() { }; + UmlActorShape.prototype = new mxCylinder(); + UmlActorShape.prototype.constructor = UmlActorShape; + UmlActorShape.prototype.addPipe = true; + UmlActorShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var width = w / 3; + var height = h / 4; + + if (!isForeground) + { + path.moveTo(w / 2, height); + path.curveTo(w / 2 - width, height, w / 2 - width, 0, w / 2, 0); + path.curveTo(w / 2 + width, 0, w / 2 + width, height, w / 2, height); + path.close(); + + path.moveTo(w / 2, height); + path.lineTo(w / 2, 2 * h / 3); + + // Arms + path.moveTo(w / 2, h / 3); + path.lineTo(0, h / 3); + path.moveTo(w / 2, h / 3); + path.lineTo(w, h / 3); + + // Legs + path.moveTo(w / 2, 2 * h / 3); + path.lineTo(0, h); + path.moveTo(w / 2, 2 * h / 3); + path.lineTo(w, h); + path.end(); + } + }; + + // Replaces existing actor shape + mxCellRenderer.prototype.defaultShapes['umlActor'] = UmlActorShape; + + // New Actor Shape + function LollipopShape() { }; + LollipopShape.prototype = new mxCylinder(); + LollipopShape.prototype.constructor = LollipopShape; + LollipopShape.prototype.size = 10; + LollipopShape.prototype.addPipe = true; + LollipopShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var ss = mxUtils.getValue(this.style, 'size', this.size); + var width = ss * 2 / 3; + var height = ss; + + if (!isForeground) + { + path.moveTo(w / 2, height); + path.curveTo(w / 2 - width, height, w / 2 - width, 0, w / 2, 0); + path.curveTo(w / 2 + width, 0, w / 2 + width, height, w / 2, height); + path.close(); + + path.moveTo(w / 2, height); + path.lineTo(w / 2, h); + path.end(); + } + }; + + // Replaces existing actor shape + mxCellRenderer.prototype.defaultShapes['lollipop'] = LollipopShape; + + // Folder Shape, supports tabWidth, tabHeight styles + function ComponentShape() { }; + ComponentShape.prototype = new mxCylinder(); + ComponentShape.prototype.constructor = ComponentShape; + ComponentShape.prototype.jettyWidth = 32; + ComponentShape.prototype.jettyHeight = 12; + ComponentShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var dx = mxUtils.getValue(this.style, 'jettyWidth', this.jettyWidth); + var dy = mxUtils.getValue(this.style, 'jettyHeight', this.jettyHeight); + var x0 = dx / 2; + var x1 = x0 + dx / 2; + var y0 = 0.3 * h - dy / 2; + var y1 = 0.7 * h - dy / 2; + + if (isForeground) + { + path.moveTo(x0, y0); + path.lineTo(x1, y0); + path.lineTo(x1, y0 + dy); + path.lineTo(x0, y0 + dy); + path.moveTo(x0, y1); + path.lineTo(x1, y1); + path.lineTo(x1, y1 + dy); + path.lineTo(x0, y1 + dy); + path.end(); + } + else + { + path.moveTo(x0, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(x0, h); + path.lineTo(x0, y1 + dy); + path.lineTo(0, y1 + dy); + path.lineTo(0, y1); + path.lineTo(x0, y1); + path.lineTo(x0, y0 + dy); + path.lineTo(0, y0 + dy); + path.lineTo(0, y0); + path.lineTo(x0, y0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['component'] = ComponentShape; + + // State Shapes derives from double ellipse + function StateShape() { }; + StateShape.prototype = new mxDoubleEllipse(); + StateShape.prototype.constructor = StateShape; + StateShape.prototype.outerStroke = true; + StateShape.prototype.paintVertexShape = function(c, x, y, w, h) + { + var inset = Math.min(4, Math.min(w / 5, h / 5)); + + if (w > 0 && h > 0) + { + c.ellipse(x + inset, y + inset, w - 2 * inset, h - 2 * inset); + c.fillAndStroke(); + } + + c.setShadow(false); + + if (this.outerStroke) + { + c.ellipse(x, y, w, h); + c.stroke(); + } + }; + + mxCellRenderer.prototype.defaultShapes['endState'] = StateShape; + + function StartStateShape() { }; + StartStateShape.prototype = new StateShape(); + StartStateShape.prototype.constructor = StartStateShape; + StartStateShape.prototype.outerStroke = false; + + mxCellRenderer.prototype.defaultShapes['startState'] = StartStateShape; + + // Image export for state shapes + var imageExportInitShapes = mxImageExport.prototype.initShapes; + mxImageExport.prototype.initShapes = function() + { + imageExportInitShapes.apply(this, arguments); + + function createStateShape(outerStroke) + { + return { + drawShape: function(canvas, state, bounds, background) + { + var x = bounds.x; + var y = bounds.y; + var w = bounds.width; + var h = bounds.height; + + if (background) + { + var inset = Math.min(4, Math.min(w / 5, h / 5)); + x += inset; + y += inset; + w -= 2 * inset; + h -= 2 * inset; + + if (w > 0 && h > 0) + { + canvas.ellipse(x, y, w, h); + } + + return true; + } + else + { + canvas.fillAndStroke(); + + if (outerStroke) + { + canvas.ellipse(x, y, w, h); + canvas.stroke(); + } + } + } + }; + }; + + this.shapes['endState'] = createStateShape(true); + this.shapes['startState'] = createStateShape(false); + }; + + // Defines custom edge shape + function LinkShape() + { + mxArrow.call(this); + }; + mxUtils.extend(LinkShape, mxArrow); + LinkShape.prototype.paintEdgeShape = function(c, pts) + { + var width = 10; + + // Base vector (between end points) + var p0 = pts[0]; + var pe = pts[pts.length - 1]; + + var dx = pe.x - p0.x; + var dy = pe.y - p0.y; + var dist = Math.sqrt(dx * dx + dy * dy); + var length = dist; + + // Computes the norm and the inverse norm + var nx = dx / dist; + var ny = dy / dist; + var basex = length * nx; + var basey = length * ny; + var floorx = width * ny/3; + var floory = -width * nx/3; + + // Computes points + var p0x = p0.x - floorx / 2; + var p0y = p0.y - floory / 2; + var p1x = p0x + floorx; + var p1y = p0y + floory; + var p2x = p1x + basex; + var p2y = p1y + basey; + var p3x = p2x + floorx; + var p3y = p2y + floory; + // p4 not necessary + var p5x = p3x - 3 * floorx; + var p5y = p3y - 3 * floory; + + c.begin(); + c.moveTo(p1x, p1y); + c.lineTo(p2x, p2y); + c.moveTo(p5x + floorx, p5y + floory); + c.lineTo(p0x, p0y); + c.stroke(); + }; + + // Registers the link shape + mxCellRenderer.prototype.defaultShapes['link'] = LinkShape; + + // Registers and defines the custom marker + mxMarker.addMarker('dash', function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) + { + var nx = unitX * (size + sw + 1); + var ny = unitY * (size + sw + 1); + + return function() + { + canvas.begin(); + canvas.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2); + canvas.lineTo(pe.x + ny / 2 - 3 * nx / 2, pe.y - 3 * ny / 2 - nx / 2); + canvas.stroke(); + }; + }); + + // Implements custom handlers + var SPECIAL_HANDLE_INDEX = -99; + + // Handlers are only added if mxVertexHandler is defined (ie. not in embedded graph) + if (typeof(mxVertexHandler) != 'undefined') + { + function mxExtVertexHandler(state) + { + mxVertexHandler.call(this, state); + }; + + mxUtils.extend(mxExtVertexHandler, mxVertexHandler); + + mxExtVertexHandler.prototype.useGridForSpecialHandle = false; + + mxExtVertexHandler.prototype.init = function() + { + this.horizontal = mxUtils.getValue(this.state.style, mxConstants.STYLE_HORIZONTAL, true); + var graph = this.state.view.graph; + + if (this.handleImage != null) + { + var bounds = new mxRectangle(0, 0, this.handleImage.width, this.handleImage.height); + this.specialHandle = new mxImageShape(bounds, this.handleImage.src); + } + else + { + var size = 10; + var bounds = new mxRectangle(0, 0, size, size); + this.specialHandle = new mxRhombus(bounds, mxConstants.HANDLE_FILLCOLOR, mxConstants.HANDLE_STROKECOLOR); + } + + this.specialHandle.dialect = (graph.dialect != mxConstants.DIALECT_SVG) ? + mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; + this.specialHandle.init(graph.getView().getOverlayPane()); + this.specialHandle.node.style.cursor = this.getSpecialHandleCursor(); + + mxEvent.redirectMouseEvents(this.specialHandle.node, graph, this.state); + mxVertexHandler.prototype.init.apply(this, arguments); + }; + + mxExtVertexHandler.prototype.getSpecialHandleCursor = function() + { + return 'default'; + }; + + mxExtVertexHandler.prototype.redraw = function() + { + mxVertexHandler.prototype.redraw.apply(this, arguments); + + var size = this.specialHandle.bounds.width; + this.specialHandle.bounds = this.getSpecialHandleBounds(size); + this.specialHandle.redraw(); + }; + + mxExtVertexHandler.prototype.destroy = function() + { + mxVertexHandler.prototype.destroy.apply(this, arguments); + + if (this.specialHandle != null) + { + this.specialHandle.destroy(); + this.specialHandle = null; + } + }; + + mxExtVertexHandler.prototype.getHandleForEvent = function(me) + { + if (me.isSource(this.specialHandle)) + { + return SPECIAL_HANDLE_INDEX; + } + + return mxVertexHandler.prototype.getHandleForEvent.apply(this, arguments); + }; + + mxExtVertexHandler.prototype.mouseMove = function(sender, me) + { + if (!me.isConsumed() && this.index == SPECIAL_HANDLE_INDEX) + { + var point = new mxPoint(me.getGraphX(), me.getGraphY()); + this.constrainPoint(point); + var gridEnabled = this.graph.isGridEnabledEvent(me.getEvent()); + var scale = this.graph.getView().scale; + + if (gridEnabled && this.useGridForSpecialHandle) + { + point.x = this.graph.snap(point.x / scale) * scale; + point.y = this.graph.snap(point.y / scale) * scale; + } + + this.updateStyle(point); + this.moveSizerTo(this.specialHandle, point.x, point.y); + this.state.view.graph.cellRenderer.redraw(this.state, true); + me.consume(); + } + else + { + mxVertexHandler.prototype.mouseMove.apply(this, arguments); + } + }; + + mxExtVertexHandler.prototype.mouseUp = function(sender, me) + { + if (!me.isConsumed() && this.index == SPECIAL_HANDLE_INDEX) + { + this.applyStyle(); + this.reset(); + me.consume(); + } + else + { + mxVertexHandler.prototype.mouseUp.apply(this, arguments); + } + }; + + mxExtVertexHandler.prototype.getSpecialHandleBounds = function(size) + { + var rotation = this.state.shape.getShapeRotation(); + var alpha = mxUtils.toRadians(rotation); + var cos = Math.cos(alpha); + var sin = Math.sin(alpha); + + var bounds = new mxRectangle(this.state.x, this.state.y, this.state.width, this.state.height); + + if (this.state.shape.isPaintBoundsInverted()) + { + var t = (bounds.width - bounds.height) / 2; + bounds.x += t; + bounds.y -= t; + var tmp = bounds.width; + bounds.width = bounds.height; + bounds.height = tmp; + } + + var pt = this.getSpecialHandlePoint(bounds); + + if (this.state.shape.flipH) + { + pt.x = 2 * bounds.x + bounds.width - pt.x; + } + + if (this.state.shape.flipV) + { + pt.y = 2 * bounds.y + bounds.height - pt.y; + } + + pt = mxUtils.getRotatedPoint(pt, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + + return new mxRectangle(pt.x - size / 2, pt.y - size / 2, size, size); + }; + + mxExtVertexHandler.prototype.getSpecialHandlePoint = function(bounds) + { + // Hook for subclassers + return null; + }; + + mxExtVertexHandler.prototype.updateStyle = function(point) + { + // Hook for subclassers + }; + + mxExtVertexHandler.prototype.constrainPoint = function(point) + { + point.x = Math.max(this.state.x, Math.min(this.state.x + this.state.width, point.x)); + point.y = Math.max(this.state.y, Math.min(this.state.y + this.state.height, point.y)); + }; + + mxExtVertexHandler.prototype.applyStyle = function() + { + // Hook for subclassers + }; + + // Folder Handler + function mxFolderHandler(state) + { + mxExtVertexHandler.call(this, state); + }; + + mxUtils.extend(mxFolderHandler, mxExtVertexHandler); + + mxFolderHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var tw = Math.min(bounds.width, mxUtils.getValue(this.state.style, 'tabWidth', 60) * scale); + var th = Math.min(bounds.height, mxUtils.getValue(this.state.style, 'tabHeight', 20) * scale); + + var tp = mxUtils.getValue(this.state.style, 'tabPosition', 'right'); + var x = (tp == 'left') ? bounds.x + tw : bounds.x + bounds.width - tw; + + return new mxPoint(x, bounds.y + th); + }; + + mxFolderHandler.prototype.updateStyle = function(point) + { + var rotation = this.state.shape.getShapeRotation(); + var alpha = mxUtils.toRadians(rotation); + var cos = Math.cos(-alpha); + var sin = Math.sin(-alpha); + + var bounds = new mxRectangle(this.state.x, this.state.y, this.state.width, this.state.height); + + if (this.state.shape.isPaintBoundsInverted()) + { + var t = (bounds.width - bounds.height) / 2; + bounds.x += t; + bounds.y -= t; + var tmp = bounds.width; + bounds.width = bounds.height; + bounds.height = tmp; + } + + var pt = new mxPoint(point.x, point.y); + pt = mxUtils.getRotatedPoint(pt, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + + if (this.state.shape.flipH) + { + pt.x = 2 * bounds.x + bounds.width - pt.x; + } + + if (this.state.shape.flipV) + { + pt.y = 2 * bounds.y + bounds.height - pt.y; + } + + var result = this.updateStyleUnrotated(pt, bounds); + + // Modifies point to use rotated coordinates of return value + if (result != null) + { + if (this.state.shape.flipH) + { + result.x = 2 * bounds.x + bounds.width - result.x; + } + + if (this.state.shape.flipV) + { + result.y = 2 * bounds.y + bounds.height - result.y; + } + + cos = Math.cos(alpha); + sin = Math.sin(alpha); + result = mxUtils.getRotatedPoint(result, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + point.x = result.x; + point.y = result.y; + } + }; + + mxFolderHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var tp = mxUtils.getValue(this.state.style, 'tabPosition', 'right'); + var tw = (tp == 'left') ? pt.x - bounds.x : bounds.x + bounds.width - pt.x; + var th = pt.y - bounds.y; + + var scale = this.graph.getView().scale; + this.state.style['tabWidth'] = Math.round(Math.max(1, tw) / scale); + this.state.style['tabHeight'] = Math.round(Math.max(1, th) / scale); + }; + + mxFolderHandler.prototype.applyStyle = function() + { + var model = this.graph.getModel(); + model.beginUpdate(); + try + { + this.state.view.graph.setCellStyles('tabWidth', this.state.style['tabWidth'], [this.state.cell]); + this.state.view.graph.setCellStyles('tabHeight', this.state.style['tabHeight'], [this.state.cell]); + } + finally + { + model.endUpdate(); + } + }; + + // Swimlane Handler + function mxSwimlaneHandler(state) + { + mxFolderHandler.call(this, state); + }; + + mxUtils.extend(mxSwimlaneHandler, mxFolderHandler); + + mxSwimlaneHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var startSize = mxUtils.getValue(this.state.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE); + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + Math.min(bounds.height, startSize * scale)); + }; + + mxSwimlaneHandler.prototype.updateStyleUnrotated = function(point, bounds) + { + point.x = bounds.x + bounds.width / 2; + startSize = point.y - bounds.y; + var scale = this.graph.getView().scale; + this.state.style['startSize'] = Math.round(Math.max(1, startSize) / scale); + + return point; + }; + + mxSwimlaneHandler.prototype.applyStyle = function() + { + this.state.view.graph.setCellStyles('startSize', this.state.style['startSize'], [this.state.cell]); + }; + + // Cube Handler + function mxCubeHandler(state) + { + mxFolderHandler.call(this, state); + }; + + mxUtils.extend(mxCubeHandler, mxFolderHandler); + + mxCubeHandler.prototype.defaultValue = 20; + + mxCubeHandler.prototype.scaleFactor = 1; + + mxCubeHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var sz = Math.min(bounds.width, Math.min(bounds.height, + mxUtils.getValue(this.state.style, 'size', this.defaultValue) * scale / this.scaleFactor)); + + return new mxPoint(bounds.x + sz, bounds.y + sz); + }; + + mxCubeHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(Math.min(bounds.width / this.scaleFactor, pt.x - bounds.x), + Math.min(bounds.height / this.scaleFactor, pt.y - bounds.y))); + var scale = this.graph.getView().scale; + this.state.style['size'] = Math.round(Math.max(1, size) / scale) * this.scaleFactor; + + // Stays on the diagonal + return new mxPoint(bounds.x + size, bounds.y + size); + }; + + mxCubeHandler.prototype.applyStyle = function() + { + this.state.view.graph.setCellStyles('size', this.state.style['size'], [this.state.cell]); + }; + + // Card Handler + function mxCardHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxCardHandler, mxCubeHandler); + + mxCardHandler.prototype.defaultValue = 30; + + mxCardHandler.prototype.scaleFactor = 2; + + // Note Handler + function mxNoteHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxNoteHandler, mxCubeHandler); + + mxNoteHandler.prototype.defaultValue = 30; + + mxNoteHandler.prototype.scaleFactor = 1; + + mxNoteHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var sz = Math.min(bounds.width, Math.min(bounds.height, + mxUtils.getValue(this.state.style, 'size', this.defaultValue) * scale / this.scaleFactor)); + + return new mxPoint(bounds.x + bounds.width - sz, bounds.y + sz); + }; + + mxNoteHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(Math.min(bounds.width / this.scaleFactor, pt.x - bounds.x + bounds.width), + Math.min(bounds.height / this.scaleFactor, pt.y - bounds.y))); + var scale = this.graph.getView().scale; + this.state.style['size'] = Math.round(Math.max(1, size) / scale) * this.scaleFactor; + + // Stays on the diagonal + return new mxPoint(bounds.x + bounds.width - size, bounds.y + size); + }; + + // Step Handler + function mxStepHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxStepHandler, mxCubeHandler); + + mxStepHandler.prototype.defaultValue = 0.2; + + mxStepHandler.prototype.scaleFactor = 1; + + mxStepHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var sz = mxUtils.getValue(this.state.style, 'size', this.defaultValue); + + return new mxPoint(bounds.x + bounds.width * sz, bounds.y + bounds.height / 2); + }; + + mxStepHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.min(1, (pt.x - bounds.x) / bounds.width); + this.state.style['size'] = size; + + return new mxPoint(bounds.x + size * bounds.width, bounds.y + bounds.height / 2); + }; + + // Tape Handler + function mxTapeHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxTapeHandler, mxCubeHandler); + + mxTapeHandler.prototype.defaultValue = 0.4; + + mxTapeHandler.prototype.scaleFactor = 1; + + mxTapeHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var sz = mxUtils.getValue(this.state.style, 'size', this.defaultValue); + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + sz * bounds.height / 2); + }; + + mxTapeHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(1, ((pt.y - bounds.y) / bounds.height) * 2)); + this.state.style['size'] = size; + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + size * bounds.height / 2); + }; + + var handlers = {'swimlane': mxSwimlaneHandler, 'folder': mxFolderHandler, 'cube': mxCubeHandler, + 'card': mxCardHandler, 'note': mxNoteHandler, 'step': mxStepHandler, 'tape': mxTapeHandler}; + + var mxGraphCreateHandler = mxGraph.prototype.createHandler; + mxGraph.prototype.createHandler = function(state) + { + if (state != null) + { + var ctor = handlers[state.style['shape']]; + + if (ctor != null) + { + return new ctor(state); + } + } + + return mxGraphCreateHandler.apply(this, arguments); + }; + } + + // Constraints + mxGraph.prototype.getAllConnectionConstraints = function(terminal, source) + { + if (terminal != null && terminal.shape != null) + { + if (terminal.shape.stencil != null) + { + if (terminal.shape.stencil != null) + { + return terminal.shape.stencil.constraints; + } + } + else if (terminal.shape.constraints != null) + { + return terminal.shape.constraints; + } + } + + return null; + }; + + mxRectangleShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0, 0.25), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(1, 0.25), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + mxLabel.prototype.constraints = mxRectangleShape.prototype.constraints; + mxImageShape.prototype.constraints = mxRectangleShape.prototype.constraints; + mxSwimlane.prototype.constraints = mxRectangleShape.prototype.constraints; + PlusShape.prototype.constraints = mxRectangleShape.prototype.constraints; + NoteShape.prototype.constraints = mxRectangleShape.prototype.constraints; + CardShape.prototype.constraints = mxRectangleShape.prototype.constraints; + CubeShape.prototype.constraints = mxRectangleShape.prototype.constraints; + FolderShape.prototype.constraints = mxRectangleShape.prototype.constraints; + mxCylinder.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.15, 0.05), false), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.85, 0.05), false), + new mxConnectionConstraint(new mxPoint(0, 0.3), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.7), true), + new mxConnectionConstraint(new mxPoint(1, 0.3), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.7), true), + new mxConnectionConstraint(new mxPoint(0.15, 0.95), false), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.85, 0.95), false)]; + UmlActorShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0.1), false), + new mxConnectionConstraint(new mxPoint(0.5, 0), false), + new mxConnectionConstraint(new mxPoint(0.75, 0.1), false), + new mxConnectionConstraint(new mxPoint(0, 1/3), false), + new mxConnectionConstraint(new mxPoint(0, 1), false), + new mxConnectionConstraint(new mxPoint(1, 1/3), false), + new mxConnectionConstraint(new mxPoint(1, 1), false), + new mxConnectionConstraint(new mxPoint(0.5, 0.5), false)]; + ComponentShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0, 0.3), true), + new mxConnectionConstraint(new mxPoint(0, 0.7), true), + new mxConnectionConstraint(new mxPoint(1, 0.25), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + mxActor.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.25, 0.2), false), + new mxConnectionConstraint(new mxPoint(0.1, 0.5), false), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.75, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + TapeShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.35), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), false), + new mxConnectionConstraint(new mxPoint(0, 0.65), false), + new mxConnectionConstraint(new mxPoint(1, 0.35), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.65), false), + new mxConnectionConstraint(new mxPoint(0.25, 1), false), + new mxConnectionConstraint(new mxPoint(0.75, 0), false)]; + // TODO: Relative ports + StepShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true), + new mxConnectionConstraint(new mxPoint(0.1, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.2, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.1, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.25), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.75), false)]; + mxLine.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.25, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.75, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false)]; + LollipopShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.5, 0), false), + new mxConnectionConstraint(new mxPoint(0.5, 1), false)]; + mxEllipse.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0), true), new mxConnectionConstraint(new mxPoint(1, 0), true), + new mxConnectionConstraint(new mxPoint(0, 1), true), new mxConnectionConstraint(new mxPoint(1, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), new mxConnectionConstraint(new mxPoint(1, 0.5))]; + mxDoubleEllipse.prototype.constraints = mxEllipse.prototype.constraints; + mxRhombus.prototype.constraints = mxEllipse.prototype.constraints; + mxTriangle.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.25), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true)]; + mxHexagon.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.375, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.625, 0), true), + new mxConnectionConstraint(new mxPoint(0.125, 0.25), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0.125, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.875, 0.25), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(0.875, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.375, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.625, 1), true)]; + mxCloud.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.4, 0.1), false), + new mxConnectionConstraint(new mxPoint(0.16, 0.55), false), + new mxConnectionConstraint(new mxPoint(0.07, 0.4), false), + new mxConnectionConstraint(new mxPoint(0.31, 0.8), false), + new mxConnectionConstraint(new mxPoint(0.13, 0.77), false), + new mxConnectionConstraint(new mxPoint(0.8, 0.8), false), + new mxConnectionConstraint(new mxPoint(0.55, 0.95), false), + new mxConnectionConstraint(new mxPoint(0.875, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.96, 0.7), false), + new mxConnectionConstraint(new mxPoint(0.625, 0.2), false), + new mxConnectionConstraint(new mxPoint(0.88, 0.25), false)]; + mxArrow.prototype.constraints = null; +})(); diff --git a/public/assets/plugins/jscripty/js/Sidebar.js b/public/assets/plugins/jscripty/js/Sidebar.js index 2d05e1a..970d060 100644 --- a/public/assets/plugins/jscripty/js/Sidebar.js +++ b/public/assets/plugins/jscripty/js/Sidebar.js @@ -1 +1,782 @@ -var _0x626f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x64\x69\x74\x6F\x72\x55\x69","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x70\x61\x6C\x65\x74\x74\x65\x73","\x73\x68\x6F\x77\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x67\x72\x61\x70\x68","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x65\x64\x69\x74\x6F\x72","\x72\x65\x73\x65\x74\x56\x69\x65\x77\x4F\x6E\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x61\x75\x74\x6F\x53\x63\x72\x6F\x6C\x6C","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x73\x74\x79\x6C\x65","\x68\x69\x64\x64\x65\x6E","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x6D\x6F\x75\x73\x65\x75\x70","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x73\x63\x72\x6F\x6C\x6C","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x68\x69\x64\x65\x54\x6F\x6F\x6C\x74\x69\x70","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x67\x65\x74\x53\x6F\x75\x72\x63\x65","\x63\x75\x72\x72\x65\x6E\x74\x45\x6C\x74","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x6D\x6F\x75\x73\x65\x6F\x75\x74","\x74\x6F\x45\x6C\x65\x6D\x65\x6E\x74","\x72\x65\x6C\x61\x74\x65\x64\x54\x61\x72\x67\x65\x74","\x69\x6E\x69\x74","\x73\x72\x63","\x2F\x74\x6F\x6F\x6C\x74\x69\x70\x2E\x70\x6E\x67","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x6C\x6F\x67","\x65\x6E\x74\x72\x79","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x67\x65\x74","\x2F","\x5F\x31\x32\x38\x78\x31\x32\x38\x2E\x70\x6E\x67","\x73\x74\x61\x72\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x69\x6E\x70\x75\x74","\x65\x6E\x64","\x61\x64\x64\x49\x6D\x61\x67\x65\x50\x61\x6C\x65\x74\x74\x65","\x65\x6E\x61\x62\x6C\x65\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x42\x6F\x72\x64\x65\x72","\x74\x68\x75\x6D\x62\x42\x6F\x72\x64\x65\x72","\x74\x6F\x6F\x6C\x74\x69\x70\x44\x65\x6C\x61\x79","\x69\x6E\x73\x74\x61\x6C\x6C\x45\x64\x67\x65\x73","\x67\x65\x61\x72\x49\x6D\x61\x67\x65","\x2F\x63\x6C\x69\x70\x61\x72\x74\x2F\x47\x65\x61\x72\x5F\x31\x32\x38\x78\x31\x32\x38\x2E\x70\x6E\x67","\x74\x68\x75\x6D\x62\x57\x69\x64\x74\x68","\x74\x68\x75\x6D\x62\x48\x65\x69\x67\x68\x74","\x74\x68\x75\x6D\x62\x50\x61\x64\x64\x69\x6E\x67","\x73\x69\x64\x65\x62\x61\x72\x54\x69\x74\x6C\x65\x53\x69\x7A\x65","\x73\x69\x64\x65\x62\x61\x72\x54\x69\x74\x6C\x65\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x54\x69\x74\x6C\x65\x73","\x73\x68\x6F\x77\x54\x6F\x6F\x6C\x74\x69\x70","\x74\x68\x72\x65\x61\x64","\x63\x6C\x65\x61\x72\x54\x69\x6D\x65\x6F\x75\x74","\x74\x6F\x6F\x6C\x74\x69\x70","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x53\x69\x64\x65\x62\x61\x72\x54\x6F\x6F\x6C\x74\x69\x70","\x67\x72\x61\x70\x68\x32","\x73\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x76\x69\x65\x77","\x49\x53\x5F\x53\x56\x47","\x63\x61\x6E\x76\x61\x73","\x72\x65\x6C\x61\x74\x69\x76\x65","\x74\x6F\x6F\x6C\x74\x69\x70\x49\x6D\x61\x67\x65","\x63\x72\x65\x61\x74\x65\x49\x6D\x61\x67\x65","\x77\x69\x64\x74\x68","\x31\x34\x70\x78","\x68\x65\x69\x67\x68\x74","\x32\x37\x70\x78","\x64\x69\x73\x70\x6C\x61\x79","\x62\x6C\x6F\x63\x6B","\x6C\x61\x62\x65\x6C\x73\x56\x69\x73\x69\x62\x6C\x65","\x63\x6C\x65\x61\x72","\x6D\x6F\x64\x65\x6C","\x61\x64\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x76\x69\x73\x69\x62\x6C\x65","\x70\x78","\x6C\x65\x6E\x67\x74\x68","\x74\x6F\x6F\x6C\x74\x69\x70\x54\x69\x74\x6C\x65","\x62\x6F\x72\x64\x65\x72\x54\x6F\x70","\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20\x67\x72\x61\x79","\x74\x65\x78\x74\x41\x6C\x69\x67\x6E","\x63\x65\x6E\x74\x65\x72","\x31\x30\x30\x25","\x70\x61\x64\x64\x69\x6E\x67\x54\x6F\x70","\x32\x70\x78","\x36\x70\x78","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","","\x77\x72\x69\x74\x65","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x6D\x61\x72\x67\x69\x6E\x54\x6F\x70","\x74\x6F\x70","\x6E\x6F\x6E\x65","\x78","\x6D\x69\x6E","\x79","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x73\x70\x6C\x69\x74\x53\x69\x7A\x65","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x6D\x61\x78","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x28","\x2C","\x29","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6C\x65\x66\x74","\x64\x72\x61\x77\x50\x61\x6E\x65","\x73\x65\x74\x54\x69\x6D\x65\x6F\x75\x74","\x63\x72\x65\x61\x74\x65\x54\x69\x74\x6C\x65","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x67\x65\x54\x69\x74\x6C\x65","\x63\x72\x65\x61\x74\x65\x54\x68\x75\x6D\x62","\x73\x63\x61\x6C\x65\x41\x6E\x64\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x66\x6C\x6F\x6F\x72","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x4E\x4F\x5F\x46\x4F","\x63\x6C\x6F\x6E\x65\x4E\x6F\x64\x65","\x6F\x77\x6E\x65\x72\x53\x56\x47\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x74\x43\x61\x6E\x76\x61\x73","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x49\x53\x5F\x49\x45\x36","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x49\x6D\x61\x67\x65","\x63\x75\x72\x73\x6F\x72","\x70\x6F\x69\x6E\x74\x65\x72","\x6D\x69\x6E\x57\x69\x64\x74\x68","\x6D\x69\x6E\x48\x65\x69\x67\x68\x74","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x6E\x6F\x77\x72\x61\x70","\x49\x53\x5F\x49\x45","\x34\x70\x78","\x63\x72\x65\x61\x74\x65\x49\x74\x65\x6D","\x67\x65\x49\x74\x65\x6D","\x70\x61\x64\x64\x69\x6E\x67","\x63\x6C\x69\x63\x6B","\x63\x6F\x6E\x73\x75\x6D\x65","\x63\x72\x65\x61\x74\x65\x44\x72\x6F\x70\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x49\x6D\x70\x6F\x72\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x69\x73\x56\x61\x6C\x69\x64\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x69\x73\x53\x70\x6C\x69\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x70\x6C\x69\x74\x54\x61\x72\x67\x65\x74","\x73\x70\x6C\x69\x74\x45\x64\x67\x65","\x69\x6D\x70\x6F\x72\x74\x43\x65\x6C\x6C\x73","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x63\x72\x65\x61\x74\x65\x44\x72\x61\x67\x50\x72\x65\x76\x69\x65\x77","\x62\x6F\x72\x64\x65\x72","\x31\x70\x78\x20\x64\x61\x73\x68\x65\x64\x20\x62\x6C\x61\x63\x6B","\x63\x72\x65\x61\x74\x65\x44\x72\x61\x67\x53\x6F\x75\x72\x63\x65","\x61\x75\x74\x6F\x73\x63\x72\x6F\x6C\x6C","\x6D\x61\x6B\x65\x44\x72\x61\x67\x67\x61\x62\x6C\x65","\x67\x65\x74\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x61\x70\x70\x6C\x79","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x61\x64\x64\x43\x6C\x69\x63\x6B\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x6D\x6F\x75\x73\x65\x55\x70","\x69\x73\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x63\x75\x72\x72\x65\x6E\x74\x47\x72\x61\x70\x68","\x74\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x61\x62\x73","\x67\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x64\x72\x6F\x70","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x6C\x61\x62\x65\x6C","\x66\x6F\x72\x45\x61\x63\x68","\x63\x72\x65\x61\x74\x65\x56\x65\x72\x74\x65\x78\x54\x65\x6D\x70\x6C\x61\x74\x65","\x6F\x74\x68\x65\x72","\x61\x64\x64","\x48\x6F\x73\x74","\x55\x73\x65\x72\x6E\x61\x6D\x65","\x50\x61\x73\x73\x77\x6F\x72\x64","\x54\x6F","\x53\x75\x62\x6A\x65\x63\x74","\x42\x6F\x64\x79","\x65\x6D\x61\x69\x6C","\x76\x65\x72\x74\x65\x78","\x63\x72\x65\x61\x74\x65\x56\x65\x72\x74\x65\x78\x54\x65\x6D\x70\x6C\x61\x74\x65\x46\x72\x6F\x6D\x43\x65\x6C\x6C\x73","\x69\x73\x47\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x54\x65\x6D\x70\x6C\x61\x74\x65","\x73\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x6F\x6D\x65\x74\x72\x79","\x65\x64\x67\x65","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x54\x65\x6D\x70\x6C\x61\x74\x65\x46\x72\x6F\x6D\x43\x65\x6C\x6C\x73","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x23\x66\x66\x66\x66\x66\x66","\x61\x64\x64\x50\x61\x6C\x65\x74\x74\x65","\x67\x65\x53\x69\x64\x65\x62\x61\x72","\x61\x64\x64\x46\x6F\x6C\x64\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x2F\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64\x2E\x67\x69\x66\x29","\x2F\x65\x78\x70\x61\x6E\x64\x65\x64\x2E\x67\x69\x66\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x31\x30\x30\x25\x20\x35\x30\x25","\x77\x61\x69\x74","\x72\x65\x6D\x6F\x76\x65\x50\x61\x6C\x65\x74\x74\x65","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x69\x6D\x61\x67\x65\x3B\x69\x6D\x61\x67\x65\x3D"];_0x626f[0];function Sidebar(_0xfd42x2,_0xfd42x3){this[_0x626f[1]]=_0xfd42x2;this[_0x626f[2]]=_0xfd42x3;this[_0x626f[3]]= new Object();this[_0x626f[4]]=true;this[_0x626f[5]]= new Graph(document[_0x626f[7]](_0x626f[6]),null,null,this[_0x626f[1]][_0x626f[9]][_0x626f[5]][_0x626f[8]]());this[_0x626f[5]][_0x626f[10]]=false;this[_0x626f[5]][_0x626f[11]]=false;this[_0x626f[5]][_0x626f[12]](false);this[_0x626f[5]][_0x626f[13]]=false;this[_0x626f[5]][_0x626f[14]](false);this[_0x626f[5]][_0x626f[15]](false);this[_0x626f[5]][_0x626f[2]][_0x626f[17]][_0x626f[16]]=_0x626f[18];this[_0x626f[5]][_0x626f[2]][_0x626f[17]][_0x626f[19]]=_0x626f[20];document[_0x626f[22]][_0x626f[21]](this[_0x626f[5]][_0x626f[2]]);if(!mxClient[_0x626f[23]]){mxEvent[_0x626f[26]](document,_0x626f[24],mxUtils[_0x626f[25]](this,function(){this[_0x626f[4]]=true}));mxEvent[_0x626f[26]](_0xfd42x3,_0x626f[27],mxUtils[_0x626f[25]](this,function(){this[_0x626f[4]]=true}));mxEvent[_0x626f[26]](document,_0x626f[28],mxUtils[_0x626f[25]](this,function(){this[_0x626f[4]]=false;this[_0x626f[29]]()}));mxEvent[_0x626f[26]](document,_0x626f[30],mxUtils[_0x626f[25]](this,function(_0xfd42x4){var _0xfd42x5=mxEvent[_0x626f[31]](_0xfd42x4);while(_0xfd42x5!=null){if(_0xfd42x5==this[_0x626f[32]]){return};_0xfd42x5=_0xfd42x5[_0x626f[33]]};this[_0x626f[29]]()}));mxEvent[_0x626f[26]](document,_0x626f[34],mxUtils[_0x626f[25]](this,function(_0xfd42x4){if(_0xfd42x4[_0x626f[35]]==null&&_0xfd42x4[_0x626f[36]]==null){this[_0x626f[29]]()}}))};this[_0x626f[37]](); new Image()[_0x626f[38]]=IMAGE_PATH+_0x626f[39]}Sidebar[_0x626f[40]][_0x626f[37]]=function(){var _0xfd42x6=STENCIL_PATH;console[_0x626f[41]](_0xfd42x6);this[_0x626f[51]](_0x626f[42],mxResources[_0x626f[44]](_0x626f[43]),_0xfd42x6+_0x626f[45],_0x626f[46],[_0x626f[47],_0x626f[48],_0x626f[49],_0x626f[50]],[mxResources[_0x626f[44]](_0x626f[47]),mxResources[_0x626f[44]](_0x626f[48]),mxResources[_0x626f[44]](_0x626f[49]),mxResources[_0x626f[44]](_0x626f[50])])};Sidebar[_0x626f[40]][_0x626f[52]]=!mxClient[_0x626f[23]];Sidebar[_0x626f[40]][_0x626f[53]]=16;Sidebar[_0x626f[40]][_0x626f[54]]=3;Sidebar[_0x626f[40]][_0x626f[55]]=300;Sidebar[_0x626f[40]][_0x626f[56]]=true;Sidebar[_0x626f[40]][_0x626f[57]]=STENCIL_PATH+_0x626f[58];Sidebar[_0x626f[40]][_0x626f[59]]=34;Sidebar[_0x626f[40]][_0x626f[60]]=34;Sidebar[_0x626f[40]][_0x626f[61]]=2;Sidebar[_0x626f[40]][_0x626f[62]]=9;Sidebar[_0x626f[40]][_0x626f[63]]=false;Sidebar[_0x626f[40]][_0x626f[64]]=false;Sidebar[_0x626f[40]][_0x626f[65]]=function(_0xfd42x7,_0xfd42x8,_0xfd42x9,_0xfd42xa){if(this[_0x626f[52]]&&this[_0x626f[4]]){if(this[_0x626f[32]]!=_0xfd42x7){if(this[_0x626f[66]]!=null){window[_0x626f[67]](this[_0x626f[66]]);this[_0x626f[66]]=null};var _0xfd42xb=mxUtils[_0x626f[25]](this,function(){if(this[_0x626f[68]]==null){this[_0x626f[68]]=document[_0x626f[7]](_0x626f[6]);this[_0x626f[68]][_0x626f[69]]=_0x626f[70];document[_0x626f[22]][_0x626f[21]](this[_0x626f[68]]);this[_0x626f[71]]= new Graph(this[_0x626f[68]],null,null,this[_0x626f[1]][_0x626f[9]][_0x626f[5]][_0x626f[8]]());this[_0x626f[71]][_0x626f[73]][_0x626f[72]](this[_0x626f[53]],this[_0x626f[53]]);this[_0x626f[71]][_0x626f[10]]=false;this[_0x626f[71]][_0x626f[11]]=false;this[_0x626f[71]][_0x626f[13]]=false;this[_0x626f[71]][_0x626f[14]](false);this[_0x626f[71]][_0x626f[12]](false);this[_0x626f[71]][_0x626f[15]](false);if(!mxClient[_0x626f[74]]){this[_0x626f[71]][_0x626f[73]][_0x626f[75]][_0x626f[17]][_0x626f[19]]=_0x626f[76]};this[_0x626f[77]]=mxUtils[_0x626f[78]](IMAGE_PATH+_0x626f[39]);this[_0x626f[77]][_0x626f[17]][_0x626f[19]]=_0x626f[20];this[_0x626f[77]][_0x626f[17]][_0x626f[79]]=_0x626f[80];this[_0x626f[77]][_0x626f[17]][_0x626f[81]]=_0x626f[82];document[_0x626f[22]][_0x626f[21]](this[_0x626f[77]])};this[_0x626f[68]][_0x626f[17]][_0x626f[83]]=_0x626f[84];this[_0x626f[71]][_0x626f[85]]=(_0xfd42xa==null||_0xfd42xa);this[_0x626f[71]][_0x626f[87]][_0x626f[86]]();this[_0x626f[71]][_0x626f[88]](_0xfd42x8);var _0xfd42xc=this[_0x626f[71]][_0x626f[89]]();var _0xfd42xd=_0xfd42xc[_0x626f[79]]+2*this[_0x626f[53]];var _0xfd42xe=_0xfd42xc[_0x626f[81]]+2*this[_0x626f[53]];if(mxClient[_0x626f[90]]){_0xfd42xd+=4;_0xfd42xe+=4;this[_0x626f[68]][_0x626f[17]][_0x626f[91]]=_0x626f[18]}else {this[_0x626f[68]][_0x626f[17]][_0x626f[91]]=_0x626f[92]};this[_0x626f[77]][_0x626f[17]][_0x626f[16]]=_0x626f[92];this[_0x626f[68]][_0x626f[17]][_0x626f[79]]=_0xfd42xd+_0x626f[93];if(this[_0x626f[64]]&&_0xfd42x9!=null&&_0xfd42x9[_0x626f[94]]>0){if(this[_0x626f[95]]==null){this[_0x626f[95]]=document[_0x626f[7]](_0x626f[6]);this[_0x626f[95]][_0x626f[17]][_0x626f[96]]=_0x626f[97];this[_0x626f[95]][_0x626f[17]][_0x626f[98]]=_0x626f[99];this[_0x626f[95]][_0x626f[17]][_0x626f[79]]=_0x626f[100];this[_0x626f[95]][_0x626f[17]][_0x626f[91]]=_0x626f[18];if(mxClient[_0x626f[74]]){this[_0x626f[95]][_0x626f[17]][_0x626f[101]]=_0x626f[102]}else {this[_0x626f[95]][_0x626f[17]][_0x626f[19]]=_0x626f[20];this[_0x626f[95]][_0x626f[17]][_0x626f[101]]=_0x626f[103]};this[_0x626f[68]][_0x626f[21]](this[_0x626f[95]])}else {this[_0x626f[95]][_0x626f[104]]=_0x626f[105]};this[_0x626f[95]][_0x626f[17]][_0x626f[83]]=_0x626f[105];mxUtils[_0x626f[106]](this[_0x626f[95]],_0xfd42x9);var _0xfd42xf=this[_0x626f[95]][_0x626f[107]]+10;_0xfd42xe+=_0xfd42xf;if(mxClient[_0x626f[74]]){this[_0x626f[95]][_0x626f[17]][_0x626f[108]]=(-_0xfd42xf)+_0x626f[93]}else {_0xfd42xe-=6;this[_0x626f[95]][_0x626f[17]][_0x626f[109]]=(_0xfd42xe-_0xfd42xf)+_0x626f[93]}}else {if(this[_0x626f[95]]!=null&&this[_0x626f[95]][_0x626f[33]]!=null){this[_0x626f[95]][_0x626f[17]][_0x626f[83]]=_0x626f[110]}};this[_0x626f[68]][_0x626f[17]][_0x626f[81]]=_0xfd42xe+_0x626f[93];var _0xfd42x10=-Math[_0x626f[112]](0,_0xfd42xc[_0x626f[111]]-this[_0x626f[53]]);var _0xfd42x11=-Math[_0x626f[112]](0,_0xfd42xc[_0x626f[113]]-this[_0x626f[53]]);var _0xfd42x12=this[_0x626f[2]][_0x626f[114]]+this[_0x626f[1]][_0x626f[115]]+3;var _0xfd42x13=Math[_0x626f[118]](0,(this[_0x626f[2]][_0x626f[116]]+_0xfd42x7[_0x626f[116]]-this[_0x626f[2]][_0x626f[117]]-_0xfd42xe/2+16));if(mxClient[_0x626f[74]]){this[_0x626f[71]][_0x626f[73]][_0x626f[75]][_0x626f[123]](_0x626f[119],_0x626f[120]+_0xfd42x10+_0x626f[121]+_0xfd42x11+_0x626f[122])}else {this[_0x626f[71]][_0x626f[73]][_0x626f[125]][_0x626f[17]][_0x626f[124]]=_0xfd42x10+_0x626f[93];this[_0x626f[71]][_0x626f[73]][_0x626f[125]][_0x626f[17]][_0x626f[109]]=_0xfd42x11+_0x626f[93]};_0xfd42x13+=90;this[_0x626f[68]][_0x626f[17]][_0x626f[19]]=_0x626f[20];this[_0x626f[68]][_0x626f[17]][_0x626f[124]]=_0xfd42x12+_0x626f[93];this[_0x626f[68]][_0x626f[17]][_0x626f[109]]=_0xfd42x13+_0x626f[93];this[_0x626f[77]][_0x626f[17]][_0x626f[124]]=(_0xfd42x12-13)+_0x626f[93];this[_0x626f[77]][_0x626f[17]][_0x626f[109]]=(_0xfd42x13+_0xfd42xe/2-13)+_0x626f[93]});if(this[_0x626f[68]]!=null&&this[_0x626f[68]][_0x626f[17]][_0x626f[83]]!=_0x626f[110]){_0xfd42xb()}else {this[_0x626f[66]]=window[_0x626f[126]](_0xfd42xb,this[_0x626f[55]])};this[_0x626f[32]]=_0xfd42x7}}};Sidebar[_0x626f[40]][_0x626f[29]]=function(){if(this[_0x626f[66]]!=null){window[_0x626f[67]](this[_0x626f[66]]);this[_0x626f[66]]=null};if(this[_0x626f[68]]!=null){this[_0x626f[68]][_0x626f[17]][_0x626f[83]]=_0x626f[110];this[_0x626f[77]][_0x626f[17]][_0x626f[16]]=_0x626f[18];this[_0x626f[32]]=null}};Sidebar[_0x626f[40]][_0x626f[127]]=function(_0xfd42x14){var _0xfd42x7=document[_0x626f[7]](_0x626f[128]);_0xfd42x7[_0x626f[123]](_0x626f[129],_0x626f[130]);_0xfd42x7[_0x626f[69]]=_0x626f[131];mxUtils[_0x626f[106]](_0xfd42x7,_0xfd42x14);return _0xfd42x7};Sidebar[_0x626f[40]][_0x626f[132]]=function(_0xfd42x8,_0xfd42xd,_0xfd42xe,_0xfd42x15,_0xfd42x9,_0xfd42xa){this[_0x626f[5]][_0x626f[85]]=(_0xfd42xa==null||_0xfd42xa);this[_0x626f[5]][_0x626f[73]][_0x626f[133]](1,0,0);this[_0x626f[5]][_0x626f[88]](_0xfd42x8);var _0xfd42xc=this[_0x626f[5]][_0x626f[89]]();var _0xfd42x16=this[_0x626f[54]];var _0xfd42x17=Math[_0x626f[112]]((_0xfd42xd-2)/(_0xfd42xc[_0x626f[79]]-_0xfd42xc[_0x626f[111]]+_0xfd42x16),(_0xfd42xe-2)/(_0xfd42xc[_0x626f[81]]-_0xfd42xc[_0x626f[113]]+_0xfd42x16));var _0xfd42x10=-Math[_0x626f[112]](_0xfd42xc[_0x626f[111]],0);var _0xfd42x11=-Math[_0x626f[112]](_0xfd42xc[_0x626f[113]],0);this[_0x626f[5]][_0x626f[73]][_0x626f[133]](_0xfd42x17,_0xfd42x10,_0xfd42x11);_0xfd42xc=this[_0x626f[5]][_0x626f[89]]();var _0xfd42x18=Math[_0x626f[118]](0,Math[_0x626f[134]]((_0xfd42xd-_0xfd42xc[_0x626f[79]]-_0xfd42xc[_0x626f[111]])/2));var _0xfd42xf=Math[_0x626f[118]](0,Math[_0x626f[134]]((_0xfd42xe-_0xfd42xc[_0x626f[81]]-_0xfd42xc[_0x626f[113]])/2));var _0xfd42x19=null;if(this[_0x626f[5]][_0x626f[135]]==mxConstants[_0x626f[136]]&&!mxClient[_0x626f[137]]){_0xfd42x19=this[_0x626f[5]][_0x626f[73]][_0x626f[140]]()[_0x626f[139]][_0x626f[138]](true)}else {_0xfd42x19=this[_0x626f[5]][_0x626f[2]][_0x626f[138]](false);_0xfd42x19[_0x626f[104]]=this[_0x626f[5]][_0x626f[2]][_0x626f[104]]};this[_0x626f[5]][_0x626f[141]]()[_0x626f[86]]();if(mxClient[_0x626f[142]]){_0xfd42x15[_0x626f[17]][_0x626f[143]]=_0x626f[144]+this[_0x626f[1]][_0x626f[9]][_0x626f[145]]+_0x626f[122]};var _0xfd42x1a=3;_0xfd42x19[_0x626f[17]][_0x626f[19]]=_0x626f[76];_0xfd42x19[_0x626f[17]][_0x626f[91]]=_0x626f[18];_0xfd42x19[_0x626f[17]][_0x626f[146]]=_0x626f[147];_0xfd42x19[_0x626f[17]][_0x626f[124]]=(_0xfd42x18+_0xfd42x1a)+_0x626f[93];_0xfd42x19[_0x626f[17]][_0x626f[109]]=(_0xfd42xf+_0xfd42x1a)+_0x626f[93];_0xfd42x19[_0x626f[17]][_0x626f[79]]=_0xfd42xd+_0x626f[93];_0xfd42x19[_0x626f[17]][_0x626f[81]]=_0xfd42xe+_0x626f[93];_0xfd42x19[_0x626f[17]][_0x626f[16]]=_0x626f[105];_0xfd42x19[_0x626f[17]][_0x626f[148]]=_0x626f[105];_0xfd42x19[_0x626f[17]][_0x626f[149]]=_0x626f[105];_0xfd42x15[_0x626f[21]](_0xfd42x19);if(this[_0x626f[63]]&&_0xfd42x9!=null){var _0xfd42x1b=(mxClient[_0x626f[90]])?2*this[_0x626f[61]]+2:0;_0xfd42x15[_0x626f[17]][_0x626f[81]]=(this[_0x626f[60]]+_0xfd42x1b+this[_0x626f[62]]+8)+_0x626f[93];var _0xfd42x1c=document[_0x626f[7]](_0x626f[6]);_0xfd42x1c[_0x626f[17]][_0x626f[150]]=this[_0x626f[62]]+_0x626f[93];_0xfd42x1c[_0x626f[17]][_0x626f[98]]=_0x626f[99];_0xfd42x1c[_0x626f[17]][_0x626f[151]]=_0x626f[152];if(mxClient[_0x626f[153]]){_0xfd42x1c[_0x626f[17]][_0x626f[81]]=(this[_0x626f[62]]+12)+_0x626f[93]};_0xfd42x1c[_0x626f[17]][_0x626f[101]]=_0x626f[154];mxUtils[_0x626f[106]](_0xfd42x1c,_0xfd42x9);_0xfd42x15[_0x626f[21]](_0xfd42x1c)}};Sidebar[_0x626f[40]][_0x626f[155]]=function(_0xfd42x8,_0xfd42x9,_0xfd42xa){var _0xfd42x7=document[_0x626f[7]](_0x626f[128]);_0xfd42x7[_0x626f[123]](_0x626f[129],_0x626f[130]);_0xfd42x7[_0x626f[69]]=_0x626f[156];_0xfd42x7[_0x626f[17]][_0x626f[91]]=_0x626f[18];var _0xfd42x1b=(mxClient[_0x626f[90]])?8+2*this[_0x626f[61]]:6;_0xfd42x7[_0x626f[17]][_0x626f[79]]=(this[_0x626f[59]]+_0xfd42x1b)+_0x626f[93];_0xfd42x7[_0x626f[17]][_0x626f[81]]=(this[_0x626f[60]]+_0xfd42x1b)+_0x626f[93];_0xfd42x7[_0x626f[17]][_0x626f[157]]=this[_0x626f[61]]+_0x626f[93];mxEvent[_0x626f[26]](_0xfd42x7,_0x626f[158],function(_0xfd42x4){mxEvent[_0x626f[159]](_0xfd42x4)});this[_0x626f[132]](_0xfd42x8,this[_0x626f[59]],this[_0x626f[60]],_0xfd42x7,_0xfd42x9,_0xfd42xa);return _0xfd42x7};Sidebar[_0x626f[40]][_0x626f[160]]=function(_0xfd42x8,_0xfd42x1d){return function(_0xfd42x1e,_0xfd42x4,_0xfd42x1f,_0xfd42x20,_0xfd42x21){if(_0xfd42x1e[_0x626f[161]]()){_0xfd42x8=_0xfd42x1e[_0x626f[162]](_0xfd42x8);if(_0xfd42x8[_0x626f[94]]>0){var _0xfd42x22=(_0xfd42x1f!=null)?_0xfd42x1e[_0x626f[163]](_0xfd42x1f,_0xfd42x8,_0xfd42x4):false;var _0xfd42x23=null;if(_0xfd42x1f!=null&& !_0xfd42x22){_0xfd42x1f=null};if(_0xfd42x1d&&_0xfd42x1e[_0x626f[164]]()&&_0xfd42x1e[_0x626f[165]](_0xfd42x1f,_0xfd42x8,_0xfd42x4)){_0xfd42x1e[_0x626f[166]](_0xfd42x1f,_0xfd42x8,null,_0xfd42x20,_0xfd42x21);_0xfd42x23=_0xfd42x8}else {if(_0xfd42x8[_0x626f[94]]>0){_0xfd42x23=_0xfd42x1e[_0x626f[167]](_0xfd42x8,_0xfd42x20,_0xfd42x21,_0xfd42x1f)}};if(_0xfd42x23!=null&&_0xfd42x23[_0x626f[94]]>0){_0xfd42x1e[_0x626f[168]](_0xfd42x23[0]);_0xfd42x1e[_0x626f[169]](_0xfd42x23)}}}}};Sidebar[_0x626f[40]][_0x626f[170]]=function(_0xfd42xd,_0xfd42xe){var _0xfd42x7=document[_0x626f[7]](_0x626f[6]);_0xfd42x7[_0x626f[17]][_0x626f[171]]=_0x626f[172];_0xfd42x7[_0x626f[17]][_0x626f[79]]=_0xfd42xd+_0x626f[93];_0xfd42x7[_0x626f[17]][_0x626f[81]]=_0xfd42xe+_0x626f[93];return _0xfd42x7};Sidebar[_0x626f[40]][_0x626f[173]]=function(_0xfd42x7,_0xfd42x24,_0xfd42x25){var _0xfd42x26=mxUtils[_0x626f[175]](_0xfd42x7,this[_0x626f[1]][_0x626f[9]][_0x626f[5]],_0xfd42x24,_0xfd42x25,0,0,this[_0x626f[1]][_0x626f[9]][_0x626f[5]][_0x626f[174]],true,true);_0xfd42x26[_0x626f[176]]=function(_0xfd42x1e,_0xfd42x20,_0xfd42x21){var _0xfd42x1f=mxDragSource[_0x626f[40]][_0x626f[176]][_0x626f[177]](this,arguments);if(!_0xfd42x1e[_0x626f[178]](_0xfd42x1f)){_0xfd42x1f=null};return _0xfd42x1f};return _0xfd42x26};Sidebar[_0x626f[40]][_0x626f[179]]=function(_0xfd42x7,_0xfd42x27){var _0xfd42x1e=this[_0x626f[1]][_0x626f[9]][_0x626f[5]];var _0xfd42x28=null;mxEvent[_0x626f[182]](_0xfd42x7,function(_0xfd42x4){_0xfd42x28= new mxPoint(mxEvent[_0x626f[180]](_0xfd42x4),mxEvent[_0x626f[181]](_0xfd42x4))});var _0xfd42x29=_0xfd42x27[_0x626f[183]];_0xfd42x27[_0x626f[183]]=function(_0xfd42x4){if(!mxEvent[_0x626f[184]](_0xfd42x4)&&this[_0x626f[185]]==null&&_0xfd42x28!=null){var _0xfd42x2a=_0xfd42x1e[_0x626f[186]];if(Math[_0x626f[187]](_0xfd42x28[_0x626f[111]]-mxEvent[_0x626f[180]](_0xfd42x4))<=_0xfd42x2a&&Math[_0x626f[187]](_0xfd42x28[_0x626f[113]]-mxEvent[_0x626f[181]](_0xfd42x4))<=_0xfd42x2a){var _0xfd42x2b=_0xfd42x1e[_0x626f[188]]();_0xfd42x27[_0x626f[189]](_0xfd42x1e,_0xfd42x4,null,_0xfd42x2b,_0xfd42x2b)}};_0xfd42x29[_0x626f[177]](this,arguments);_0xfd42x28=null}};Sidebar[_0x626f[40]][_0x626f[190]]=function(_0xfd42x2c,_0xfd42x14,_0xfd42x2d,_0xfd42x2e){var _0xfd42x2f=mxUtils[_0x626f[190]]();var _0xfd42x19=_0xfd42x2f[_0x626f[7]](_0xfd42x2c);_0xfd42x19[_0x626f[123]](_0x626f[191],_0xfd42x14);_0xfd42x2d[_0x626f[192]](function(_0xfd42x30,_0xfd42x31){_0xfd42x19[_0x626f[123]](_0xfd42x30,_0xfd42x2e[_0xfd42x31]?_0xfd42x2e[_0xfd42x31]:_0x626f[105])});return _0xfd42x19};Sidebar[_0x626f[40]][_0x626f[193]]=function(_0xfd42x32,_0xfd42xd,_0xfd42xe,_0xfd42x33,_0xfd42x9,_0xfd42xa){var _0xfd42x2d=[];var _0xfd42x2e=[];switch(_0xfd42x33){case _0x626f[48]:_0xfd42x2d=[_0x626f[48],_0x626f[194]];_0xfd42x2e=[_0x626f[105]];break;case _0x626f[49]:_0xfd42x2d=[_0x626f[48],_0x626f[195]];_0xfd42x2e=[_0x626f[105]];break;case _0x626f[202]:_0xfd42x2d=[_0x626f[196],_0x626f[197],_0x626f[198],_0x626f[199],_0x626f[200],_0x626f[201]];_0xfd42x2e=[_0x626f[105]];break;default:_0xfd42x2d=[];_0xfd42x2e=[];break};var _0xfd42x19=this[_0x626f[190]](_0xfd42x33,_0xfd42x9,_0xfd42x2d,_0xfd42x2e);var _0xfd42x8=[ new mxCell(_0xfd42x19, new mxGeometry(0,0,_0xfd42xd,_0xfd42xe),_0xfd42x32)];_0xfd42x8[0][_0x626f[203]]=true;return this[_0x626f[204]](_0xfd42x8,_0xfd42xd,_0xfd42xe,_0xfd42x9,_0xfd42xa)};Sidebar[_0x626f[40]][_0x626f[204]]=function(_0xfd42x8,_0xfd42xd,_0xfd42xe,_0xfd42x9,_0xfd42xa){var _0xfd42x7=this[_0x626f[155]](_0xfd42x8,_0xfd42x9,_0xfd42xa);var _0xfd42x27=this[_0x626f[173]](_0xfd42x7,this[_0x626f[160]](_0xfd42x8,true),this[_0x626f[170]](_0xfd42xd,_0xfd42xe));this[_0x626f[179]](_0xfd42x7,_0xfd42x27);_0xfd42x27[_0x626f[205]]=mxUtils[_0x626f[25]](this,function(){return this[_0x626f[1]][_0x626f[9]][_0x626f[5]][_0x626f[207]][_0x626f[206]]});if(!touchStyle){mxEvent[_0x626f[26]](_0xfd42x7,_0x626f[30],mxUtils[_0x626f[25]](this,function(_0xfd42x4){this[_0x626f[65]](_0xfd42x7,_0xfd42x8,_0xfd42x9,_0xfd42xa)}))};return _0xfd42x7};Sidebar[_0x626f[40]][_0x626f[208]]=function(_0xfd42x32,_0xfd42xd,_0xfd42xe,_0xfd42x33,_0xfd42x9,_0xfd42xa){var _0xfd42x8=[ new mxCell((_0xfd42x33!=null)?_0xfd42x33:_0x626f[105], new mxGeometry(0,0,_0xfd42xd,_0xfd42xe),_0xfd42x32)];_0xfd42x8[0][_0x626f[210]][_0x626f[209]]( new mxPoint(0,_0xfd42xe),true);_0xfd42x8[0][_0x626f[210]][_0x626f[209]]( new mxPoint(_0xfd42xd,0),false);_0xfd42x8[0][_0x626f[210]][_0x626f[76]]=true;_0xfd42x8[0][_0x626f[211]]=true;return this[_0x626f[212]](_0xfd42x8,_0xfd42xd,_0xfd42xe,_0xfd42x9,_0xfd42xa)};Sidebar[_0x626f[40]][_0x626f[212]]=function(_0xfd42x8,_0xfd42xd,_0xfd42xe,_0xfd42x9,_0xfd42xa){var _0xfd42x7=this[_0x626f[155]](_0xfd42x8,_0xfd42x9,_0xfd42xa);this[_0x626f[173]](_0xfd42x7,this[_0x626f[160]](_0xfd42x8,false),this[_0x626f[170]](_0xfd42xd,_0xfd42xe));var _0xfd42x1e=this[_0x626f[1]][_0x626f[9]][_0x626f[5]];mxEvent[_0x626f[26]](_0xfd42x7,_0x626f[158],mxUtils[_0x626f[25]](this,function(_0xfd42x4){if(this[_0x626f[56]]){_0xfd42x1e[_0x626f[213]](_0xfd42x8[0])};_0xfd42x7[_0x626f[17]][_0x626f[214]]=_0x626f[215];window[_0x626f[126]](function(){_0xfd42x7[_0x626f[17]][_0x626f[214]]=_0x626f[105]},300);mxEvent[_0x626f[159]](_0xfd42x4)}));touchStyle=false;if(!touchStyle){mxEvent[_0x626f[26]](_0xfd42x7,_0x626f[30],mxUtils[_0x626f[25]](this,function(_0xfd42x4){this[_0x626f[65]](_0xfd42x7,_0xfd42x8,_0xfd42x9,_0xfd42xa)}))};return _0xfd42x7};Sidebar[_0x626f[40]][_0x626f[216]]=function(_0xfd42x34,_0xfd42x9,_0xfd42x35,_0xfd42x36){var _0xfd42x7=this[_0x626f[127]](_0xfd42x9);this[_0x626f[2]][_0x626f[21]](_0xfd42x7);var _0xfd42x1c=document[_0x626f[7]](_0x626f[6]);_0xfd42x1c[_0x626f[69]]=_0x626f[217];if(_0xfd42x35){_0xfd42x36(_0xfd42x1c);_0xfd42x36=null}else {_0xfd42x1c[_0x626f[17]][_0x626f[83]]=_0x626f[110]};this[_0x626f[218]](_0xfd42x7,_0xfd42x1c,_0xfd42x36);var _0xfd42x37=document[_0x626f[7]](_0x626f[6]);_0xfd42x37[_0x626f[21]](_0xfd42x1c);this[_0x626f[2]][_0x626f[21]](_0xfd42x37);if(_0xfd42x34!=null){this[_0x626f[3]][_0xfd42x34]=[_0xfd42x7,_0xfd42x37]}};Sidebar[_0x626f[40]][_0x626f[218]]=function(_0xfd42x9,_0xfd42x38,_0xfd42x39){var _0xfd42x3a=false;_0xfd42x9[_0x626f[17]][_0x626f[143]]=(_0xfd42x38[_0x626f[17]][_0x626f[83]]==_0x626f[110])?_0x626f[144]+IMAGE_PATH+_0x626f[219]:_0x626f[144]+IMAGE_PATH+_0x626f[220];_0xfd42x9[_0x626f[17]][_0x626f[221]]=_0x626f[222];_0xfd42x9[_0x626f[17]][_0x626f[223]]=_0x626f[224];mxEvent[_0x626f[26]](_0xfd42x9,_0x626f[158],function(_0xfd42x4){if(_0xfd42x38[_0x626f[17]][_0x626f[83]]==_0x626f[110]){if(!_0xfd42x3a){_0xfd42x3a=true;if(_0xfd42x39!=null){_0xfd42x9[_0x626f[17]][_0x626f[146]]=_0x626f[225];window[_0x626f[126]](function(){_0xfd42x39(_0xfd42x38);_0xfd42x9[_0x626f[17]][_0x626f[146]]=_0x626f[105]},0)}};_0xfd42x9[_0x626f[17]][_0x626f[143]]=_0x626f[144]+IMAGE_PATH+_0x626f[220];_0xfd42x38[_0x626f[17]][_0x626f[83]]=_0x626f[84]}else {_0xfd42x9[_0x626f[17]][_0x626f[143]]=_0x626f[144]+IMAGE_PATH+_0x626f[219];_0xfd42x38[_0x626f[17]][_0x626f[83]]=_0x626f[110]};mxEvent[_0x626f[159]](_0xfd42x4)})};Sidebar[_0x626f[40]][_0x626f[226]]=function(_0xfd42x34){var _0xfd42x3b=this[_0x626f[3]][_0xfd42x34];if(_0xfd42x3b!=null){this[_0x626f[3]][_0xfd42x34]=null;for(var _0xfd42x3c=0;_0xfd42x3c<_0xfd42x3b[_0x626f[94]];_0xfd42x3c++){this[_0x626f[2]][_0x626f[227]](_0xfd42x3b[_0xfd42x3c])};return true};return false};Sidebar[_0x626f[40]][_0x626f[51]]=function(_0xfd42x34,_0xfd42x9,_0xfd42x3d,_0xfd42x3e,_0xfd42x3f,_0xfd42x40){this[_0x626f[216]](_0xfd42x34,_0xfd42x9,(_0xfd42x34===_0x626f[42]),mxUtils[_0x626f[25]](this,function(_0xfd42x38){var _0xfd42x41=_0xfd42x40!=null;for(var _0xfd42x3c=0;_0xfd42x3c<_0xfd42x3f[_0x626f[94]];_0xfd42x3c++){var _0xfd42x42=_0xfd42x3d+_0xfd42x3f[_0xfd42x3c]+_0xfd42x3e;_0xfd42x38[_0x626f[21]](this[_0x626f[193]](_0x626f[228]+_0xfd42x42,80,80,_0xfd42x3f[_0xfd42x3c],(_0xfd42x41)?_0xfd42x40[_0xfd42x3c]:null,_0xfd42x41))}}))} \ No newline at end of file +'use strict'; + +/** + * Construcs a new sidebar for the given editor. + */ +function Sidebar(editorUi, container) { + this.editorUi = editorUi; + this.container = container; + this.palettes = new Object(); + this.showTooltips = true; + this.graph = new Graph(document.createElement('div'), null, null, this.editorUi + .editor.graph.getStylesheet()); + this.graph.resetViewOnRootChange = false; + this.graph.foldingEnabled = false; + this.graph.setConnectable(false); + this.graph.autoScroll = false; + this.graph.setTooltips(false); + this.graph.setEnabled(false); + + // Container must be in the DOM for correct HTML rendering + this.graph.container.style.visibility = 'hidden'; + this.graph.container.style.position = 'absolute'; + document.body.appendChild(this.graph.container); + + if (!mxClient.IS_TOUCH) { + mxEvent.addListener(document, 'mouseup', mxUtils.bind(this, function() { + this.showTooltips = true; + })); + + // Enables tooltips after scroll + mxEvent.addListener(container, 'scroll', mxUtils.bind(this, function() { + this.showTooltips = true; + })); + + mxEvent.addListener(document, 'mousedown', mxUtils.bind(this, function() { + this.showTooltips = false; + this.hideTooltip(); + })); + + mxEvent.addListener(document, 'mousemove', mxUtils.bind(this, function(evt) { + var src = mxEvent.getSource(evt); + + while (src != null) { + if (src == this.currentElt) { + return; + } + + src = src.parentNode; + } + + this.hideTooltip(); + })); + + // Handles mouse leaving the window + mxEvent.addListener(document, 'mouseout', mxUtils.bind(this, function(evt) { + if (evt.toElement == null && evt.relatedTarget == null) { + this.hideTooltip(); + } + })); + } + + this.init(); + + // Pre-fetches tooltip image + new Image().src = IMAGE_PATH + '/tooltip.png'; +}; + +/** + * Adds all palettes to the sidebar. + */ +Sidebar.prototype.init = function() { + var dir = STENCIL_PATH; + console.log(dir); + + // this.addImagePalette('entry', mxResources.get('application'), dir + '/', + // '_128x128.png', ['start', 'question', 'input', 'end', 'email'], [mxResources.get('start'), + // mxResources.get('question'), mxResources.get('input'), mxResources.get('end'), mxResources.get('email') + // ]); + this.addImagePalette('entry', mxResources.get('application'), dir + '/', + '_128x128.png', ['start', 'question', 'input', 'end'], [mxResources.get('start'), + mxResources.get('question'), mxResources.get('input'), mxResources.get('end') + ]); + // this.addBpmnPalette(dir, false); + +}; + +/** + * Specifies if tooltips should be visible. Default is true. + */ +Sidebar.prototype.enableTooltips = !mxClient.IS_TOUCH; + +/** + * Specifies the delay for the tooltip. Default is 16 px. + */ +Sidebar.prototype.tooltipBorder = 16; + +/** + * Specifies the delay for the tooltip. Default is 3 px. + */ +Sidebar.prototype.thumbBorder = 3; + +/** + * Specifies the delay for the tooltip. Default is 300 ms. + */ +Sidebar.prototype.tooltipDelay = 300; + +/** + * Specifies if edges should be used as templates if clicked. Default is true. + */ +Sidebar.prototype.installEdges = true; + +/** + * Specifies the URL of the gear image. + */ +Sidebar.prototype.gearImage = STENCIL_PATH + '/clipart/Gear_128x128.png'; + +/** + * Specifies the width of the thumbnails. + */ +Sidebar.prototype.thumbWidth = 34; + +/** + * Specifies the height of the thumbnails. + */ +Sidebar.prototype.thumbHeight = 34; + +/** + * Specifies the padding for the thumbnails. Default is 3. + */ +Sidebar.prototype.thumbPadding = 2; + +/** + * Specifies the size of the sidebar titles. + */ +Sidebar.prototype.sidebarTitleSize = 9; + +/** + * Specifies if titles in the sidebar should be enabled. + */ +Sidebar.prototype.sidebarTitles = false; + +/** + * Specifies if titles in the tooltips should be enabled. + */ +Sidebar.prototype.tooltipTitles = false; + +/** + * Adds all palettes to the sidebar. + */ +Sidebar.prototype.showTooltip = function(elt, cells, title, showLabel) { + if (this.enableTooltips && this.showTooltips) { + if (this.currentElt != elt) { + if (this.thread != null) { + window.clearTimeout(this.thread); + this.thread = null; + } + + var show = mxUtils.bind(this, function() { + // Lazy creation of the DOM nodes and graph instance + if (this.tooltip == null) { + this.tooltip = document.createElement('div'); + this.tooltip.className = 'geSidebarTooltip'; + document.body.appendChild(this.tooltip); + + this.graph2 = new Graph(this.tooltip, null, null, this.editorUi.editor.graph + .getStylesheet()); + this.graph2.view.setTranslate(this.tooltipBorder, this.tooltipBorder); + this.graph2.resetViewOnRootChange = false; + this.graph2.foldingEnabled = false; + this.graph2.autoScroll = false; + this.graph2.setTooltips(false); + this.graph2.setConnectable(false); + this.graph2.setEnabled(false); + + if (!mxClient.IS_SVG) { + this.graph2.view.canvas.style.position = 'relative'; + } + + this.tooltipImage = mxUtils.createImage(IMAGE_PATH + '/tooltip.png'); + this.tooltipImage.style.position = 'absolute'; + this.tooltipImage.style.width = '14px'; + this.tooltipImage.style.height = '27px'; + + document.body.appendChild(this.tooltipImage); + } + + this.tooltip.style.display = 'block'; + this.graph2.labelsVisible = (showLabel == null || showLabel); + this.graph2.model.clear(); + this.graph2.addCells(cells); + + var bounds = this.graph2.getGraphBounds(); + var width = bounds.width + 2 * this.tooltipBorder; + var height = bounds.height + 2 * this.tooltipBorder; + + if (mxClient.IS_QUIRKS) { + width += 4; + height += 4; + this.tooltip.style.overflow = 'hidden'; + } else { + this.tooltip.style.overflow = 'visible'; + } + + this.tooltipImage.style.visibility = 'visible'; + this.tooltip.style.width = width + 'px'; + + // Adds title for entry + if (this.tooltipTitles && title != null && title.length > 0) { + if (this.tooltipTitle == null) { + this.tooltipTitle = document.createElement('div'); + this.tooltipTitle.style.borderTop = '1px solid gray'; + this.tooltipTitle.style.textAlign = 'center'; + this.tooltipTitle.style.width = '100%'; + + // Oversize titles are cut-off currently. Should make tooltip wider later. + this.tooltipTitle.style.overflow = 'hidden'; + + if (mxClient.IS_SVG) { + this.tooltipTitle.style.paddingTop = '2px'; + } else { + this.tooltipTitle.style.position = 'absolute'; + this.tooltipTitle.style.paddingTop = '6px'; + } + + this.tooltip.appendChild(this.tooltipTitle); + } else { + this.tooltipTitle.innerHTML = ''; + } + + this.tooltipTitle.style.display = ''; + mxUtils.write(this.tooltipTitle, title); + + var dy = this.tooltipTitle.offsetHeight + 10; + height += dy; + + if (mxClient.IS_SVG) { + this.tooltipTitle.style.marginTop = (-dy) + 'px'; + } else { + height -= 6; + this.tooltipTitle.style.top = (height - dy) + 'px'; + } + } else if (this.tooltipTitle != null && this.tooltipTitle.parentNode != + null) { + this.tooltipTitle.style.display = 'none'; + } + + this.tooltip.style.height = height + 'px'; + var x0 = -Math.min(0, bounds.x - this.tooltipBorder); + var y0 = -Math.min(0, bounds.y - this.tooltipBorder); + + var left = this.container.clientWidth + this.editorUi.splitSize + 3; + var top = Math.max(0, (this.container.offsetTop + elt.offsetTop - this.container + .scrollTop - height / 2 + 16)); + + if (mxClient.IS_SVG) { + this.graph2.view.canvas.setAttribute('transform', 'translate(' + x0 + + ',' + y0 + ')'); + } else { + this.graph2.view.drawPane.style.left = x0 + 'px'; + this.graph2.view.drawPane.style.top = y0 + 'px'; + } + + // Workaround for ignored position CSS style in IE9 + // (changes to relative without the following line) + // Added width of the page-sidebar + // left += document.getElementById('page-sidebar').offsetWidth; + // Added static height of the page-navbar + top += 90; + + this.tooltip.style.position = 'absolute'; + this.tooltip.style.left = left + 'px'; + this.tooltip.style.top = top + 'px'; + this.tooltipImage.style.left = (left - 13) + 'px'; + this.tooltipImage.style.top = (top + height / 2 - 13) + 'px'; + }); + + if (this.tooltip != null && this.tooltip.style.display != 'none') { + show(); + } else { + this.thread = window.setTimeout(show, this.tooltipDelay); + } + + this.currentElt = elt; + } + } +}; + +/** + * Hides the current tooltip. + */ +Sidebar.prototype.hideTooltip = function() { + if (this.thread != null) { + window.clearTimeout(this.thread); + this.thread = null; + } + + if (this.tooltip != null) { + this.tooltip.style.display = 'none'; + this.tooltipImage.style.visibility = 'hidden'; + this.currentElt = null; + } +}; + +/** + * Creates and returns the given title element. + */ +Sidebar.prototype.createTitle = function(label) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geTitle'; + mxUtils.write(elt, label); + + return elt; +}; + +/** + * Creates a thumbnail for the given cells. + */ +Sidebar.prototype.createThumb = function(cells, width, height, parent, title, + showLabel) { + this.graph.labelsVisible = (showLabel == null || showLabel); + this.graph.view.scaleAndTranslate(1, 0, 0); + this.graph.addCells(cells); + var bounds = this.graph.getGraphBounds(); + var corr = this.thumbBorder; + var s = Math.min((width - 2) / (bounds.width - bounds.x + corr), (height - 2) / + (bounds.height - bounds.y + corr)); + var x0 = -Math.min(bounds.x, 0); + var y0 = -Math.min(bounds.y, 0); + this.graph.view.scaleAndTranslate(s, x0, y0); + + bounds = this.graph.getGraphBounds(); + var dx = Math.max(0, Math.floor((width - bounds.width - bounds.x) / 2)); + var dy = Math.max(0, Math.floor((height - bounds.height - bounds.y) / 2)); + + var node = null; + + // For supporting HTML labels in IE9 standards mode the container is cloned instead + if (this.graph.dialect == mxConstants.DIALECT_SVG && !mxClient.NO_FO) { + node = this.graph.view.getCanvas().ownerSVGElement.cloneNode(true); + } + // LATER: Check if deep clone can be used for quirks if container in DOM + else { + node = this.graph.container.cloneNode(false); + node.innerHTML = this.graph.container.innerHTML; + } + + this.graph.getModel().clear(); + + // Catch-all event handling + if (mxClient.IS_IE6) { + parent.style.backgroundImage = 'url(' + this.editorUi.editor.transparentImage + + ')'; + } + + var dd = 3; + node.style.position = 'relative'; + node.style.overflow = 'hidden'; + node.style.cursor = 'pointer'; + node.style.left = (dx + dd) + 'px'; + node.style.top = (dy + dd) + 'px'; + node.style.width = width + 'px'; + node.style.height = height + 'px'; + node.style.visibility = ''; + node.style.minWidth = ''; + node.style.minHeight = ''; + + parent.appendChild(node); + + // Adds title for sidebar entries + if (this.sidebarTitles && title != null) { + var border = (mxClient.IS_QUIRKS) ? 2 * this.thumbPadding + 2 : 0; + parent.style.height = (this.thumbHeight + border + this.sidebarTitleSize + 8) + + 'px'; + + var div = document.createElement('div'); + div.style.fontSize = this.sidebarTitleSize + 'px'; + div.style.textAlign = 'center'; + div.style.whiteSpace = 'nowrap'; + + if (mxClient.IS_IE) { + div.style.height = (this.sidebarTitleSize + 12) + 'px'; + } + + div.style.paddingTop = '4px'; + mxUtils.write(div, title); + parent.appendChild(div); + } +}; + +/** + * Creates and returns a new palette item for the given image. + */ +Sidebar.prototype.createItem = function(cells, title, showLabel) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geItem'; + elt.style.overflow = 'hidden'; + var border = (mxClient.IS_QUIRKS) ? 8 + 2 * this.thumbPadding : 6; + elt.style.width = (this.thumbWidth + border) + 'px'; + elt.style.height = (this.thumbHeight + border) + 'px'; + elt.style.padding = this.thumbPadding + 'px'; + + // Blocks default click action + mxEvent.addListener(elt, 'click', function(evt) { + mxEvent.consume(evt); + }); + + this.createThumb(cells, this.thumbWidth, this.thumbHeight, elt, title, + showLabel); + + return elt; +}; + + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createDropHandler = function(cells, allowSplit) { + return function(graph, evt, target, x, y) { + if (graph.isEnabled()) { + cells = graph.getImportableCells(cells); + + if (cells.length > 0) { + var validDropTarget = (target != null) ? + graph.isValidDropTarget(target, cells, evt) : false; + var select = null; + + if (target != null && !validDropTarget) { + target = null; + } + + // Splits the target edge or inserts into target group + if (allowSplit && graph.isSplitEnabled() && graph.isSplitTarget(target, + cells, evt)) { + graph.splitEdge(target, cells, null, x, y); + select = cells; + } else if (cells.length > 0) { + select = graph.importCells(cells, x, y, target); + } + + if (select != null && select.length > 0) { + graph.scrollCellToVisible(select[0]); + graph.setSelectionCells(select); + } + } + } + }; +}; + +/** + * Creates and returns a preview element for the given width and height. + */ +Sidebar.prototype.createDragPreview = function(width, height) { + var elt = document.createElement('div'); + elt.style.border = '1px dashed black'; + elt.style.width = width + 'px'; + elt.style.height = height + 'px'; + + return elt; +}; + +/** + * Creates a drag source for the given element. + */ +Sidebar.prototype.createDragSource = function(elt, dropHandler, preview) { + var dragSource = mxUtils.makeDraggable(elt, this.editorUi.editor.graph, + dropHandler, + preview, 0, 0, this.editorUi.editor.graph.autoscroll, true, true); + + + + // Allows drop into cell only if target is a valid root + dragSource.getDropTarget = function(graph, x, y) { + var target = mxDragSource.prototype.getDropTarget.apply(this, arguments); + if (!graph.isValidRoot(target)) { + target = null; + } + + return target; + }; + + return dragSource; +}; + + + +/** + * Adds a handler for inserting the cell with a single click. + */ +Sidebar.prototype.addClickHandler = function(elt, ds) { + var graph = this.editorUi.editor.graph; + var first = null; + + mxEvent.addGestureListeners(elt, function(evt) { + first = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + }); + + var oldMouseUp = ds.mouseUp; + ds.mouseUp = function(evt) { + if (!mxEvent.isPopupTrigger(evt) && this.currentGraph == null && first != + null) { + var tol = graph.tolerance; + + if (Math.abs(first.x - mxEvent.getClientX(evt)) <= tol && + Math.abs(first.y - mxEvent.getClientY(evt)) <= tol) { + var gs = graph.getGridSize(); + ds.drop(graph, evt, null, gs, gs); + } + } + + oldMouseUp.apply(this, arguments); + first = null; + }; +}; + +/** + * Giuseppe Careri + * Create xml document vertex + */ +Sidebar.prototype.createXmlDocument = function(element, label, variables, + values) { + var doc = mxUtils.createXmlDocument(); + var node = doc.createElement(element) + node.setAttribute('label', label); + + variables.forEach(function(variable, index) { + node.setAttribute(variable, values[index] ? values[index] : ''); + }); + + return node; +} + +/** + * Giuseppe Careri + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createVertexTemplate = function(style, width, height, value, + title, showLabel) { + var variables = []; + var values = []; + + switch (value) { + + case 'question': + variables = ['question', 'other']; + values = ['']; + break; + case 'input': + variables = ['question', 'add']; + values = ['']; + break; + case 'email': + variables = ["Host", "Username", "Password", "To", "Subject", "Body"]; + values = ['']; + break; + default: + variables = []; + values = []; + break; + } + + var node = this.createXmlDocument(value, title, variables, values); + + //var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, width, height), style)]; + var cells = [new mxCell(node, new mxGeometry(0, 0, width, height), style)]; + cells[0].vertex = true; + + return this.createVertexTemplateFromCells(cells, width, height, title, + showLabel); +}; + + + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createVertexTemplateFromCells = function(cells, width, height, + title, showLabel) { + var elt = this.createItem(cells, title, showLabel); + var ds = this.createDragSource(elt, this.createDropHandler(cells, true), this + .createDragPreview(width, height)); + this.addClickHandler(elt, ds); + + // Uses guides for vertices only if enabled in graph + ds.isGuidesEnabled = mxUtils.bind(this, function() { + return this.editorUi.editor.graph.graphHandler.guidesEnabled; + }); + + // Shows a tooltip with the rendered cell + if (!touchStyle) { + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + this.showTooltip(elt, cells, title, showLabel); + })); + } + + return elt; +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createEdgeTemplate = function(style, width, height, value, + title, showLabel) { + var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, + width, height), style)]; + cells[0].geometry.setTerminalPoint(new mxPoint(0, height), true); + cells[0].geometry.setTerminalPoint(new mxPoint(width, 0), false); + cells[0].geometry.relative = true; + cells[0].edge = true; + + return this.createEdgeTemplateFromCells(cells, width, height, title, + showLabel); +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createEdgeTemplateFromCells = function(cells, width, height, + title, showLabel) { + var elt = this.createItem(cells, title, showLabel); + this.createDragSource(elt, this.createDropHandler(cells, false), this.createDragPreview( + width, height)); + + // Installs the default edge + var graph = this.editorUi.editor.graph; + mxEvent.addListener(elt, 'click', mxUtils.bind(this, function(evt) { + if (this.installEdges) { + graph.setDefaultEdge(cells[0]); + } + + // Highlights the entry for 200ms + elt.style.backgroundColor = '#ffffff'; + + window.setTimeout(function() { + elt.style.backgroundColor = ''; + }, 300); + + mxEvent.consume(evt); + })); + + // Shows a tooltip with the rendered cell + touchStyle = false; + if (!touchStyle) { + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + this.showTooltip(elt, cells, title, showLabel); + })); + } + + return elt; +}; + +/** + * Adds the given palette. + */ +Sidebar.prototype.addPalette = function(id, title, expanded, onInit) { + var elt = this.createTitle(title); + this.container.appendChild(elt); + + var div = document.createElement('div'); + div.className = 'geSidebar'; + + if (expanded) { + onInit(div); + onInit = null; + } else { + div.style.display = 'none'; + } + + this.addFoldingHandler(elt, div, onInit); + + var outer = document.createElement('div'); + outer.appendChild(div); + this.container.appendChild(outer); + + // Keeps references to the DOM nodes + if (id != null) { + this.palettes[id] = [elt, outer]; + } +}; + +/** + * Create the given title element. + */ +Sidebar.prototype.addFoldingHandler = function(title, content, funct) { + var initialized = false; + + title.style.backgroundImage = (content.style.display == 'none') ? + 'url(' + IMAGE_PATH + '/collapsed.gif)' : 'url(' + IMAGE_PATH + + '/expanded.gif)'; + title.style.backgroundRepeat = 'no-repeat'; + title.style.backgroundPosition = '100% 50%'; + + mxEvent.addListener(title, 'click', function(evt) { + if (content.style.display == 'none') { + if (!initialized) { + initialized = true; + + if (funct != null) { + title.style.cursor = 'wait'; + window.setTimeout(function() { + funct(content); + title.style.cursor = ''; + }, 0); + } + } + + title.style.backgroundImage = 'url(' + IMAGE_PATH + '/expanded.gif)'; + content.style.display = 'block'; + } else { + title.style.backgroundImage = 'url(' + IMAGE_PATH + '/collapsed.gif)'; + content.style.display = 'none'; + } + + mxEvent.consume(evt); + }); +}; + +/** + * Removes the palette for the given ID. + */ +Sidebar.prototype.removePalette = function(id) { + var elts = this.palettes[id]; + + if (elts != null) { + this.palettes[id] = null; + + for (var i = 0; i < elts.length; i++) { + this.container.removeChild(elts[i]); + } + + return true; + } + + return false; +}; + +/** + * Adds the given image palette. + */ +Sidebar.prototype.addImagePalette = function(id, title, prefix, postfix, items, + titles) { + // Giuseppe Careri + // Expanded Sidebar only entry + this.addPalette(id, title, (id === 'entry'), mxUtils.bind(this, function( + content) { + var showTitles = titles != null; + + for (var i = 0; i < items.length; i++) { + var icon = prefix + items[i] + postfix; + content.appendChild(this.createVertexTemplate('image;image=' + icon, 80, + 80, items[i], (showTitles) ? titles[i] : null, showTitles)); + } + })); +}; +// ***********modified*************** +// Sidebar.prototype.addBpmnPalette = function(dir, expand) { +// //Abigael Dawit +// +// var fns = [ +// this.createVertexTemplate( +// 'text;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;', +// 40, 20, 'Text', 'Text', null), +// //this.createVertexTemplate('shape=ext;rounded=1;whiteSpace=wrap;dashed=1;dashPattern=1 4;', 120, 80, 'Event\nSub-Process', 'Event Sub-Process', null), +// this.createVertexTemplate('shape=swimlane;whiteSpace=wrap;startSize=60;', +// 120, 160, 'Container', 'Container', null), +// // this.createVertexTemplate('shape=ellipse;', 120, 160, 'Ellips', 'Ellipse', null) +// this.createVertexTemplate( +// 'shape=swimlane;html=1;horizontal=0;swimlaneFillColor=white;swimlaneLine=0;fillColor=none;rounded=1;verticalAlign=middle', +// 300, 120, 'Lane', 'Lane', null) +// +// ] +// +// this.addPalette('utility', 'Utility ', false, mxUtils.bind(this, function( +// content) { +// //var showTitles = titles != null; +// for (var i = 0; i < fns.length; i++) { +// content.appendChild(fns[i]); +// } +// })); +// +// }; diff --git a/public/assets/plugins/jscripty/js/Toolbar.js b/public/assets/plugins/jscripty/js/Toolbar.js index efbfd7d..7eab562 100644 --- a/public/assets/plugins/jscripty/js/Toolbar.js +++ b/public/assets/plugins/jscripty/js/Toolbar.js @@ -1 +1,407 @@ -var _0xbe3c=["\x65\x64\x69\x74\x6F\x72\x55\x69","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x69\x6E\x69\x74","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x62\x69\x6E\x64","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x73\x61\x76\x65","\x70\x75\x62\x6C\x69\x73\x68","\x2D","\x70\x72\x69\x6E\x74","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x6F\x70\x79","\x63\x75\x74","\x70\x61\x73\x74\x65","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x61\x64\x64\x49\x74\x65\x6D\x73","\x48\x65\x6C\x76\x65\x74\x69\x63\x61","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x67\x65\x74","\x61\x64\x64\x4D\x65\x6E\x75","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x73\x74\x79\x6C\x65","\x6E\x6F\x77\x72\x61\x70","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x68\x69\x64\x64\x65\x6E","\x77\x69\x64\x74\x68","\x37\x30\x70\x78","\x61\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x31\x32","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x33\x30\x70\x78","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x67\x72\x61\x70\x68","\x65\x64\x69\x74\x6F\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x6C\x65\x6E\x67\x74\x68","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2E","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x63\x75\x72\x72\x65\x6E\x74\x4D\x65\x6E\x75","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x6E\x75\x73","\x66\x75\x6E\x63\x74","\x61\x64\x64\x4D\x65\x6E\x75\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x65\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x72\x65\x61\x74\x65\x4C\x61\x62\x65\x6C","\x63\x72\x65\x61\x74\x65\x42\x75\x74\x74\x6F\x6E","\x69\x6E\x69\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x61\x64\x64\x4D\x65\x6E\x75\x48\x61\x6E\x64\x6C\x65\x72","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x67\x65\x53\x70\x72\x69\x74\x65\x2D","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x61\x64\x64\x49\x74\x65\x6D","\x61\x63\x74\x69\x6F\x6E\x73","\x6C\x61\x62\x65\x6C","\x61\x64\x64\x42\x75\x74\x74\x6F\x6E","\x61\x64\x64\x43\x6C\x69\x63\x6B\x48\x61\x6E\x64\x6C\x65\x72","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x61\x64\x64\x45\x64\x67\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x69\x73\x45\x64\x67\x65","\x74\x61\x62\x69\x6E\x64\x65\x78","\x30","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x74\x69\x74\x6C\x65","\x61\x64\x64\x45\x6E\x61\x62\x6C\x65\x64\x53\x74\x61\x74\x65","\x20\x67\x65\x44\x69\x73\x61\x62\x6C\x65\x64","\x63\x6C\x69\x63\x6B","\x63\x6F\x6E\x73\x75\x6D\x65","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x67\x65\x42\x75\x74\x74\x6F\x6E","\x67\x65\x53\x70\x72\x69\x74\x65\x20","\x67\x65\x4C\x61\x62\x65\x6C","\x77\x72\x69\x74\x65","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x20\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72\x4D\x65\x6E\x75","\x73\x68\x6F\x77\x44\x69\x73\x61\x62\x6C\x65\x64","\x6C\x61\x62\x65\x6C\x73","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x70\x6F\x70\x75\x70"];function Toolbar(_0xae99x2,_0xae99x3){this[_0xbe3c[0]]=_0xae99x2;this[_0xbe3c[1]]=_0xae99x3;this[_0xbe3c[2]]();mxEvent[_0xbe3c[5]](document,mxUtils[_0xbe3c[4]](this,function(_0xae99x4){this[_0xbe3c[3]]()}))}Toolbar[_0xbe3c[6]][_0xbe3c[2]]=function(){this[_0xbe3c[21]]([_0xbe3c[7],_0xbe3c[8],_0xbe3c[9],_0xbe3c[10],_0xbe3c[11],_0xbe3c[12],_0xbe3c[9],_0xbe3c[13],_0xbe3c[14],_0xbe3c[15],_0xbe3c[16],_0xbe3c[9],_0xbe3c[17],_0xbe3c[9],_0xbe3c[18],_0xbe3c[19],_0xbe3c[20],_0xbe3c[9]]);var _0xae99x5=this[_0xbe3c[25]](_0xbe3c[22],mxResources[_0xbe3c[24]](_0xbe3c[23]),true,_0xbe3c[23]);_0xae99x5[_0xbe3c[27]][_0xbe3c[26]]=_0xbe3c[28];_0xae99x5[_0xbe3c[27]][_0xbe3c[29]]=_0xbe3c[30];_0xae99x5[_0xbe3c[27]][_0xbe3c[31]]=_0xbe3c[32];this[_0xbe3c[33]]();var _0xae99x6=this[_0xbe3c[25]](_0xbe3c[34],mxResources[_0xbe3c[24]](_0xbe3c[35]),true,_0xbe3c[35]);_0xae99x6[_0xbe3c[27]][_0xbe3c[26]]=_0xbe3c[28];_0xae99x6[_0xbe3c[27]][_0xbe3c[29]]=_0xbe3c[30];_0xae99x6[_0xbe3c[27]][_0xbe3c[31]]=_0xbe3c[36];this[_0xbe3c[21]]([_0xbe3c[9],_0xbe3c[37],_0xbe3c[38],_0xbe3c[39]]);var _0xae99x7=this[_0xbe3c[0]][_0xbe3c[41]][_0xbe3c[40]];var _0xae99x8=mxUtils[_0xbe3c[4]](this,function(){var _0xae99x9=_0xbe3c[22];var _0xae99xa=_0xbe3c[34];var _0xae99xb=_0xae99x7[_0xbe3c[44]]()[_0xbe3c[43]](_0xae99x7[_0xbe3c[42]]());if(_0xae99xb!=null){_0xae99x9=_0xae99xb[_0xbe3c[27]][mxConstants[_0xbe3c[45]]]||_0xae99x9;_0xae99xa=_0xae99xb[_0xbe3c[27]][mxConstants[_0xbe3c[46]]]||_0xae99xa;if(_0xae99x9[_0xbe3c[47]]>10){_0xae99x9=_0xae99x9[_0xbe3c[48]](0,8)+_0xbe3c[49]};_0xae99x5[_0xbe3c[50]]=_0xae99x9;_0xae99x6[_0xbe3c[50]]=_0xae99xa}});_0xae99x7[_0xbe3c[52]]()[_0xbe3c[51]](mxEvent.CHANGE,_0xae99x8);_0xae99x7[_0xbe3c[53]]()[_0xbe3c[51]](mxEvent.CHANGE,_0xae99x8)};Toolbar[_0xbe3c[6]][_0xbe3c[3]]=function(){if(this[_0xbe3c[54]]!=null){this[_0xbe3c[54]][_0xbe3c[3]]();this[_0xbe3c[54]][_0xbe3c[55]]();this[_0xbe3c[54]]=null}};Toolbar[_0xbe3c[6]][_0xbe3c[25]]=function(_0xae99xc,_0xae99xd,_0xae99xe,_0xae99xf){var _0xae99x10=this[_0xbe3c[0]][_0xbe3c[56]][_0xbe3c[24]](_0xae99xf);var _0xae99x11=this[_0xbe3c[58]](_0xae99xc,_0xae99xd,_0xae99xe,_0xae99x10[_0xbe3c[57]]);_0xae99x10[_0xbe3c[51]](_0xbe3c[59],function(){_0xae99x11[_0xbe3c[61]](_0xae99x10[_0xbe3c[60]])});return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[58]]=function(_0xae99xc,_0xae99xd,_0xae99xe,_0xae99x12){var _0xae99x11=(_0xae99xe)?this[_0xbe3c[62]](_0xae99xc):this[_0xbe3c[63]](_0xae99xc);this[_0xbe3c[64]](_0xae99x11,_0xae99xd);this[_0xbe3c[65]](_0xae99x11,_0xae99xe,_0xae99x12);this[_0xbe3c[1]][_0xbe3c[66]](_0xae99x11);return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[33]]=function(){var _0xae99x11=document[_0xbe3c[68]](_0xbe3c[67]);_0xae99x11[_0xbe3c[69]]=_0xbe3c[70];this[_0xbe3c[1]][_0xbe3c[66]](_0xae99x11);return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[21]]=function(_0xae99x13){for(var _0xae99x14=0;_0xae99x14<_0xae99x13[_0xbe3c[47]];_0xae99x14++){var _0xae99x15=_0xae99x13[_0xae99x14];if(_0xae99x15==_0xbe3c[9]){this[_0xbe3c[33]]()}else {this[_0xbe3c[73]](_0xbe3c[71]+_0xae99x15[_0xbe3c[72]](),_0xae99x15)}}};Toolbar[_0xbe3c[6]][_0xbe3c[73]]=function(_0xae99x16,_0xae99x15){var _0xae99x17=this[_0xbe3c[0]][_0xbe3c[74]][_0xbe3c[24]](_0xae99x15);var _0xae99x11=null;if(_0xae99x17!=null){_0xae99x11=this[_0xbe3c[76]](_0xae99x16,_0xae99x17[_0xbe3c[75]],_0xae99x17[_0xbe3c[57]]);_0xae99x11[_0xbe3c[61]](_0xae99x17[_0xbe3c[60]]);_0xae99x17[_0xbe3c[51]](_0xbe3c[59],function(){_0xae99x11[_0xbe3c[61]](_0xae99x17[_0xbe3c[60]])})};return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[76]]=function(_0xae99x18,_0xae99xd,_0xae99x12){var _0xae99x11=this[_0xbe3c[63]](_0xae99x18);this[_0xbe3c[64]](_0xae99x11,_0xae99xd);this[_0xbe3c[77]](_0xae99x11,_0xae99x12);this[_0xbe3c[1]][_0xbe3c[66]](_0xae99x11);return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[78]]=function(_0xae99x19){var _0xae99x7=this[_0xbe3c[0]][_0xbe3c[41]][_0xbe3c[40]];var _0xae99x1a=function(){var _0xae99x1b=!_0xae99x7[_0xbe3c[79]]();for(var _0xae99x14=0;_0xae99x14<_0xae99x19[_0xbe3c[47]];_0xae99x14++){_0xae99x19[_0xae99x14][_0xbe3c[61]](_0xae99x1b)}};_0xae99x7[_0xbe3c[52]]()[_0xbe3c[51]](mxEvent.CHANGE,_0xae99x1a);_0xae99x1a()};Toolbar[_0xbe3c[6]][_0xbe3c[80]]=function(_0xae99x19){var _0xae99x7=this[_0xbe3c[0]][_0xbe3c[41]][_0xbe3c[40]];var _0xae99x1a=function(){var _0xae99x1c=false;if(!_0xae99x7[_0xbe3c[79]]()){var _0xae99x1d=_0xae99x7[_0xbe3c[81]]();for(var _0xae99x14=0;_0xae99x14<_0xae99x1d[_0xbe3c[47]];_0xae99x14++){if(_0xae99x7[_0xbe3c[53]]()[_0xbe3c[82]](_0xae99x1d[_0xae99x14])){_0xae99x1c=true;break}}};for(var _0xae99x14=0;_0xae99x14<_0xae99x19[_0xbe3c[47]];_0xae99x14++){_0xae99x19[_0xae99x14][_0xbe3c[61]](_0xae99x1c)}};_0xae99x7[_0xbe3c[52]]()[_0xbe3c[51]](mxEvent.CHANGE,_0xae99x1a);_0xae99x1a()};Toolbar[_0xbe3c[6]][_0xbe3c[64]]=function(_0xae99x11,_0xae99xd){_0xae99x11[_0xbe3c[85]](_0xbe3c[83],_0xbe3c[84]);if(_0xae99xd!=null){_0xae99x11[_0xbe3c[85]](_0xbe3c[86],_0xae99xd)};this[_0xbe3c[87]](_0xae99x11)};Toolbar[_0xbe3c[6]][_0xbe3c[87]]=function(_0xae99x11){var _0xae99x18=_0xae99x11[_0xbe3c[69]];_0xae99x11[_0xbe3c[61]]=function(_0xae99x1e){_0xae99x11[_0xbe3c[60]]=_0xae99x1e;if(_0xae99x1e){_0xae99x11[_0xbe3c[69]]=_0xae99x18}else {_0xae99x11[_0xbe3c[69]]=_0xae99x18+_0xbe3c[88]}};_0xae99x11[_0xbe3c[61]](true)};Toolbar[_0xbe3c[6]][_0xbe3c[77]]=function(_0xae99x11,_0xae99x12){if(_0xae99x12!=null){mxEvent[_0xbe3c[51]](_0xae99x11,_0xbe3c[89],function(_0xae99x4){if(_0xae99x11[_0xbe3c[60]]){_0xae99x12(_0xae99x4)};mxEvent[_0xbe3c[90]](_0xae99x4)})}};Toolbar[_0xbe3c[6]][_0xbe3c[63]]=function(_0xae99x18){var _0xae99x11=document[_0xbe3c[68]](_0xbe3c[91]);_0xae99x11[_0xbe3c[85]](_0xbe3c[92],_0xbe3c[93]);_0xae99x11[_0xbe3c[69]]=_0xbe3c[94];var _0xae99x1f=document[_0xbe3c[68]](_0xbe3c[67]);_0xae99x1f[_0xbe3c[69]]=_0xbe3c[95]+_0xae99x18;_0xae99x11[_0xbe3c[66]](_0xae99x1f);return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[62]]=function(_0xae99xc,_0xae99xd){var _0xae99x11=document[_0xbe3c[68]](_0xbe3c[91]);_0xae99x11[_0xbe3c[85]](_0xbe3c[92],_0xbe3c[93]);_0xae99x11[_0xbe3c[69]]=_0xbe3c[96];mxUtils[_0xbe3c[97]](_0xae99x11,_0xae99xc);return _0xae99x11};Toolbar[_0xbe3c[6]][_0xbe3c[65]]=function(_0xae99x11,_0xae99xe,_0xae99x12,_0xae99x20){if(_0xae99x12!=null){var _0xae99x7=this[_0xbe3c[0]][_0xbe3c[41]][_0xbe3c[40]];var _0xae99x10=null;mxEvent[_0xbe3c[51]](_0xae99x11,_0xbe3c[89],mxUtils[_0xbe3c[4]](this,function(_0xae99x4){if(_0xae99x11[_0xbe3c[60]]==null||_0xae99x11[_0xbe3c[60]]){_0xae99x7[_0xbe3c[98]][_0xbe3c[3]]();_0xae99x10= new mxPopupMenu(_0xae99x12);_0xae99x10[_0xbe3c[67]][_0xbe3c[69]]+=_0xbe3c[99];_0xae99x10[_0xbe3c[100]]=_0xae99x20;_0xae99x10[_0xbe3c[101]]=_0xae99xe;_0xae99x10[_0xbe3c[102]]=true;_0xae99x10[_0xbe3c[106]](_0xae99x11[_0xbe3c[103]],_0xae99x11[_0xbe3c[104]]+_0xae99x11[_0xbe3c[105]]+34,null,_0xae99x4);this[_0xbe3c[54]]=_0xae99x10};mxEvent[_0xbe3c[90]](_0xae99x4)}))}} \ No newline at end of file +/** + * $Id: Toolbar.js,v 1.3 2013-02-20 16:21:29 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Construcs a new toolbar for the given editor. + */ +function Toolbar(editorUi, container) +{ + this.editorUi = editorUi; + this.container = container; + this.init(); + + // Global handler to hide the current menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) + { + this.hideMenu(); + })); +}; + +/** + * Adds the toolbar elements. + */ +Toolbar.prototype.init = function() +{ + this.addItems(['save', 'publish', '-', 'print', 'undo', 'redo', '-', 'copy', 'cut', 'paste', 'delete', '-', 'duplicate', '-', 'actualSize', 'zoomIn', 'zoomOut', '-']); + var fontElt = this.addMenu('Helvetica', mxResources.get('fontFamily'), true, 'fontFamily'); + fontElt.style.whiteSpace = 'nowrap'; + fontElt.style.overflow = 'hidden'; + fontElt.style.width = '70px'; + this.addSeparator(); + var sizeElt = this.addMenu('12', mxResources.get('fontSize'), true, 'fontSize'); + sizeElt.style.whiteSpace = 'nowrap'; + sizeElt.style.overflow = 'hidden'; + sizeElt.style.width = '30px'; + + this.addItems(['-', 'bold', 'italic', 'underline']); + // Giuseppe Careri + // var align = this.addMenuFunction('geSprite-left', mxResources.get('align'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_LEFT], 'geIcon geSprite geSprite-left', null).setAttribute('title', mxResources.get('left')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_CENTER], 'geIcon geSprite geSprite-center', null).setAttribute('title', mxResources.get('center')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_RIGHT], 'geIcon geSprite geSprite-right', null).setAttribute('title', mxResources.get('right')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_TOP], 'geIcon geSprite geSprite-top', null).setAttribute('title', mxResources.get('top')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_MIDDLE], 'geIcon geSprite geSprite-middle', null).setAttribute('title', mxResources.get('middle')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_BOTTOM], 'geIcon geSprite geSprite-bottom', null).setAttribute('title', mxResources.get('bottom')); + // })); + // this.addItems(['fontColor', '-']); + // var line = this.addMenuFunction('geSprite-straight', mxResources.get('line'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], [null], 'geIcon geSprite geSprite-straight', null).setAttribute('title', mxResources.get('straight')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['entityRelationEdgeStyle'], 'geIcon geSprite geSprite-entity', null).setAttribute('title', mxResources.get('entityRelation')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE, mxConstants.STYLE_ELBOW], ['elbowEdgeStyle', 'horizontal'], 'geIcon geSprite geSprite-helbow', null).setAttribute('title', mxResources.get('horizontal')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE, mxConstants.STYLE_ELBOW], ['elbowEdgeStyle', 'vertical'], 'geIcon geSprite geSprite-velbow', null).setAttribute('title', mxResources.get('vertical')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['segmentEdgeStyle'], 'geIcon geSprite geSprite-segment', null).setAttribute('title', mxResources.get('manual')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['orthogonalEdgeStyle'], 'geIcon geSprite geSprite-orthogonal', null).setAttribute('title', mxResources.get('automatic')); + // })); + // var linestart = this.addMenuFunction('geSprite-startclassic', mxResources.get('lineend'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.NONE, 0], 'geIcon geSprite geSprite-noarrow', null).setAttribute('title', mxResources.get('none')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_CLASSIC, 1], 'geIcon geSprite geSprite-startclassic', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OPEN, 1], 'geIcon geSprite geSprite-startopen', null).setAttribute('title', mxResources.get('openArrow')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_BLOCK, 1], 'geIcon geSprite geSprite-startblock', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OVAL, 1], 'geIcon geSprite geSprite-startoval', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND, 1], 'geIcon geSprite geSprite-startdiamond', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND_THIN, 1], 'geIcon geSprite geSprite-startthindiamond', null).setAttribute('title', mxResources.get('diamondThin')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_CLASSIC, 0], 'geIcon geSprite geSprite-startclassictrans', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_BLOCK, 0], 'geIcon geSprite geSprite-startblocktrans', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OVAL, 0], 'geIcon geSprite geSprite-startovaltrans', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND, 0], 'geIcon geSprite geSprite-startdiamondtrans', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND_THIN, 0], 'geIcon geSprite geSprite-startthindiamondtrans', null).setAttribute('title', mxResources.get('diamondThin')); + // })); + // var lineend = this.addMenuFunction('geSprite-endclassic', mxResources.get('lineend'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.NONE, 0], 'geIcon geSprite geSprite-noarrow', null).setAttribute('title', mxResources.get('none')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_CLASSIC, 1], 'geIcon geSprite geSprite-endclassic', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OPEN, 1], 'geIcon geSprite geSprite-endopen', null).setAttribute('title', mxResources.get('openArrow')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_BLOCK, 1], 'geIcon geSprite geSprite-endblock', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OVAL, 1], 'geIcon geSprite geSprite-endoval', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND, 1], 'geIcon geSprite geSprite-enddiamond', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND_THIN, 1], 'geIcon geSprite geSprite-endthindiamond', null).setAttribute('title', mxResources.get('diamondThin')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_CLASSIC, 0], 'geIcon geSprite geSprite-endclassictrans', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_BLOCK, 0], 'geIcon geSprite geSprite-endblocktrans', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OVAL, 0], 'geIcon geSprite geSprite-endovaltrans', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND, 0], 'geIcon geSprite geSprite-enddiamondtrans', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND_THIN, 0], 'geIcon geSprite geSprite-endthindiamondtrans', null).setAttribute('title', mxResources.get('diamondThin')); + // })); + // this.addItems(['-', 'strokeColor', 'image', 'fillColor']); + // this.addItem('geSprite-gradientcolor', 'gradientColor').setAttribute('title', mxResources.get('gradient')); + // this.addItems(['shadow']); + + var graph = this.editorUi.editor.graph; + + // Update font size and font family labels + var update = mxUtils.bind(this, function() + { + var ff = 'Helvetica'; + var fs = '12'; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) + { + ff = state.style[mxConstants.STYLE_FONTFAMILY] || ff; + fs = state.style[mxConstants.STYLE_FONTSIZE] || fs; + + if (ff.length > 10) + { + ff = ff.substring(0, 8) + '...'; + } + + fontElt.innerHTML = ff; + sizeElt.innerHTML = fs; + } + }); + + graph.getSelectionModel().addListener(mxEvent.CHANGE, update); + graph.getModel().addListener(mxEvent.CHANGE, update); + + // Giuseppe Careri + // Updates button states + //this.addEdgeSelectionHandler([line, linestart, lineend]); + //this.addSelectionHandler([align]); +}; + +/** + * Hides the current menu. + */ +Toolbar.prototype.hideMenu = function() +{ + if (this.currentMenu != null) + { + this.currentMenu.hideMenu(); + this.currentMenu.destroy(); + this.currentMenu = null; + } +}; + +/** + * Adds a label to the toolbar. + */ +Toolbar.prototype.addMenu = function(label, tooltip, showLabels, name) +{ + var menu = this.editorUi.menus.get(name); + var elt = this.addMenuFunction(label, tooltip, showLabels, menu.funct); + + menu.addListener('stateChanged', function() + { + elt.setEnabled(menu.enabled); + }); + + return elt; +}; + +/** + * Adds a label to the toolbar. + */ +Toolbar.prototype.addMenuFunction = function(label, tooltip, showLabels, funct) +{ + var elt = (showLabels) ? this.createLabel(label) : this.createButton(label); + this.initElement(elt, tooltip); + this.addMenuHandler(elt, showLabels, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds a separator to the separator. + */ +Toolbar.prototype.addSeparator = function() +{ + var elt = document.createElement('div'); + elt.className = 'geSeparator'; + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds given action item + */ +Toolbar.prototype.addItems = function(keys) +{ + for (var i = 0; i < keys.length; i++) + { + var key = keys[i]; + + if (key == '-') + { + this.addSeparator(); + } + else + { + this.addItem('geSprite-' + key.toLowerCase(), key); + } + } +}; + +/** + * Adds given action item + */ +Toolbar.prototype.addItem = function(sprite, key) +{ + var action = this.editorUi.actions.get(key); + var elt = null; + + if (action != null) + { + elt = this.addButton(sprite, action.label, action.funct); + elt.setEnabled(action.enabled); + + action.addListener('stateChanged', function() + { + elt.setEnabled(action.enabled); + }); + } + + return elt; +}; + +/** + * Adds a button to the toolbar. + */ +Toolbar.prototype.addButton = function(classname, tooltip, funct) +{ + var elt = this.createButton(classname); + + this.initElement(elt, tooltip); + this.addClickHandler(elt, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +Toolbar.prototype.addSelectionHandler = function(items) +{ + var graph = this.editorUi.editor.graph; + + var selectionListener = function() + { + var selected = !graph.isSelectionEmpty(); + + for (var i = 0; i < items.length; i++) + { + items[i].setEnabled(selected); + } + }; + + graph.getSelectionModel().addListener(mxEvent.CHANGE, selectionListener); + selectionListener(); +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +Toolbar.prototype.addEdgeSelectionHandler = function(items) +{ + var graph = this.editorUi.editor.graph; + + var selectionListener = function() + { + var edgeSelected = false; + + if (!graph.isSelectionEmpty()) + { + var cells = graph.getSelectionCells(); + + for (var i = 0; i < cells.length; i++) + { + if (graph.getModel().isEdge(cells[i])) + { + edgeSelected = true; + break; + } + } + } + + for (var i = 0; i < items.length; i++) + { + items[i].setEnabled(edgeSelected); + } + }; + + graph.getSelectionModel().addListener(mxEvent.CHANGE, selectionListener); + selectionListener(); +}; + +/** + * Initializes the given toolbar element. + */ +Toolbar.prototype.initElement = function(elt, tooltip) +{ + elt.setAttribute('tabindex', '0'); + + // Adds tooltip + if (tooltip != null) + { + elt.setAttribute('title', tooltip); + } + + this.addEnabledState(elt); +}; + +/** + * Adds enabled state with setter to DOM node (avoids JS wrapper). + */ +Toolbar.prototype.addEnabledState = function(elt) +{ + var classname = elt.className; + + elt.setEnabled = function(value) + { + elt.enabled = value; + + if (value) + { + elt.className = classname; + } + else + { + elt.className = classname + ' geDisabled'; + } + }; + + elt.setEnabled(true); +}; + +/** + * Adds enabled state with setter to DOM node (avoids JS wrapper). + */ +Toolbar.prototype.addClickHandler = function(elt, funct) +{ + if (funct != null) + { + mxEvent.addListener(elt, 'click', function(evt) + { + if (elt.enabled) + { + funct(evt); + } + + mxEvent.consume(evt); + }); + } +}; + +/** + * Creates and returns a new button. + */ +Toolbar.prototype.createButton = function(classname) +{ + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geButton'; + + var inner = document.createElement('div'); + inner.className = 'geSprite ' + classname; + elt.appendChild(inner); + + return elt; +}; + +/** + * Creates and returns a new button. + */ +Toolbar.prototype.createLabel = function(label, tooltip) +{ + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geLabel'; + mxUtils.write(elt, label); + + return elt; +}; + +/** + * Adds a handler for showing a menu in the given element. + */ +Toolbar.prototype.addMenuHandler = function(elt, showLabels, funct, showAll) +{ + if (funct != null) + { + var graph = this.editorUi.editor.graph; + var menu = null; + + mxEvent.addListener(elt, 'click', mxUtils.bind(this, function(evt) + { + if (elt.enabled == null || elt.enabled) + { + graph.panningHandler.hideMenu(); + menu = new mxPopupMenu(funct); + menu.div.className += ' geToolbarMenu'; + menu.showDisabled = showAll; + menu.labels = showLabels; + menu.autoExpand = true; + + menu.popup(elt.offsetLeft, elt.offsetTop + elt.offsetHeight + 34, null, evt); + this.currentMenu = menu; + } + + mxEvent.consume(evt); + })); + } +}; diff --git a/public/assets/plugins/jscripty/js/custom.js b/public/assets/plugins/jscripty/js/custom.js index 76d6753..a53e30b 100644 --- a/public/assets/plugins/jscripty/js/custom.js +++ b/public/assets/plugins/jscripty/js/custom.js @@ -1 +1,283 @@ -var _0xc2aa=["\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x3F","\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66","\x26","\x73\x70\x6C\x69\x74","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x6C\x65\x6E\x67\x74\x68","\x3D","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x74\x74\x70\x3A\x2F\x2F\x65\x78\x70\x2E\x64\x72\x61\x77\x2E\x69\x6F\x2F\x49\x6D\x61\x67\x65\x45\x78\x70\x6F\x72\x74\x32\x2F\x65\x78\x70\x6F\x72\x74","\x68\x74\x74\x70\x3A\x2F\x2F\x6C\x6F\x63\x61\x6C\x68\x6F\x73\x74\x3A\x33\x30\x30\x30","\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F","\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x73\x2F","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x73\x74\x65\x6E\x63\x69\x6C\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x73\x68\x61\x70\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x69\x6D\x61\x67\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x73\x74\x79\x6C\x65\x73","\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x6F\x70\x65\x6E","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x74\x65\x6D\x70\x6C\x61\x74\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x72\x65\x73\x6F\x75\x72\x63\x65\x73","\x2F\x64\x69\x61","\x63\x75\x73\x74\x6F\x6D","\x4E\x47\x5F\x54\x52\x41\x4E\x53\x4C\x41\x54\x45\x5F\x4C\x41\x4E\x47\x5F\x4B\x45\x59","\x67\x65\x74\x49\x74\x65\x6D","\x6C\x6F\x67","\x65\x6E","\x65\x6E\x5F\x45\x4E","\x69\x74","\x6D\x78\x4C\x61\x6E\x67\x75\x61\x67\x65","\x61\x72","\x62\x73","\x63\x73","\x64\x61","\x64\x65","\x65\x6C","\x65\x73","\x65\x73\x2D\x61\x72","\x66\x72","\x68\x75","\x69\x64","\x6A\x61","\x6B\x6F","\x6E\x6C","\x6E\x6F","\x70\x6C","\x70\x74\x2D\x62\x72","\x70\x74","\x72\x6F","\x72\x75","\x73\x72","\x73\x76","\x74\x68","\x74\x72","\x75\x6B","\x7A\x68","\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68","\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x6A\x73","\x55\x53\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x53\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x4D\x61\x6C\x65","\x55\x4B\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x4B\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x4D\x61\x6C\x65","\x41\x75\x73\x74\x72\x61\x6C\x69\x61\x6E\x20\x45\x6E\x67\x6C\x69\x73\x68","\x55\x53\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x53\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x4D\x61\x6C\x65","\x43\x68\x69\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x43\x68\x69\x6E\x65\x73\x65\x20\x4D\x61\x6C\x65","\x48\x6F\x6E\x67\x20\x4B\x6F\x6E\x67\x20\x43\x61\x6E\x74\x6F\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x54\x61\x69\x77\x61\x6E\x20\x43\x68\x69\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x4D\x61\x6C\x65","\x4B\x6F\x72\x65\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x4B\x6F\x72\x65\x61\x6E\x20\x4D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x48\x75\x6E\x67\x61\x72\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x42\x72\x61\x7A\x69\x6C\x69\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x43\x61\x74\x61\x6C\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x43\x7A\x65\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x44\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x69\x6E\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x44\x75\x74\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x49\x74\x61\x6C\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x54\x75\x72\x6B\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65\x09","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x54\x75\x72\x6B\x69\x73\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x47\x65\x72\x6D\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x47\x65\x72\x6D\x61\x6E\x20\x4D\x61\x6C\x65","\x52\x75\x73\x73\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x52\x75\x73\x73\x69\x61\x6E\x20\x4D\x61\x6C\x65","\x53\x77\x65\x64\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x4D\x61\x6C\x65","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x55\x53\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x43\x61\x6E\x61\x64\x61\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x55\x4B\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x41\x75\x73\x74\x72\x61\x6C\x69\x61\x29","\x53\x70\x61\x6E\x69\x73\x68\x20\x28\x53\x70\x61\x69\x6E\x29","\x53\x70\x61\x6E\x69\x73\x68\x20\x28\x4D\x65\x78\x69\x63\x6F\x29","\x49\x74\x61\x6C\x69\x61\x6E\x20\x28\x49\x74\x61\x6C\x79\x29\x20\x2F\x20\x46\x69\x6E\x6E\x69\x73\x68\x20\x28\x46\x69\x6E\x6C\x61\x6E\x64\x29","\x46\x72\x65\x6E\x63\x68\x20\x28\x46\x72\x61\x6E\x63\x65\x29","\x46\x72\x65\x6E\x63\x68\x20\x28\x43\x61\x6E\x61\x64\x61\x29","\x50\x6F\x6C\x69\x73\x68\x20\x28\x50\x6F\x6C\x61\x6E\x64\x29","\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x28\x50\x6F\x72\x74\x75\x67\x61\x6C\x29","\x43\x61\x74\x61\x6C\x61\x6E\x20\x28\x43\x61\x74\x61\x6C\x61\x6E\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x54\x61\x69\x77\x61\x6E\x29","\x44\x61\x6E\x69\x73\x68\x20\x28\x44\x65\x6E\x6D\x61\x72\x6B\x29","\x47\x65\x72\x6D\x61\x6E\x20\x28\x47\x65\x72\x6D\x61\x6E\x79\x29","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x28\x4A\x61\x70\x61\x6E\x29","\x4B\x6F\x72\x65\x61\x6E\x20\x28\x4B\x6F\x72\x65\x61\x29","\x44\x75\x74\x63\x68\x20\x28\x4E\x65\x74\x68\x65\x72\x6C\x61\x6E\x64\x73\x29","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x28\x4E\x6F\x72\x77\x61\x79\x29","\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x28\x42\x72\x61\x7A\x69\x6C\x29","\x52\x75\x73\x73\x69\x61\x6E\x20\x28\x52\x75\x73\x73\x69\x61\x29","\x53\x77\x65\x64\x69\x73\x68\x20\x28\x53\x77\x65\x64\x65\x6E\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x43\x68\x69\x6E\x61\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x48\x6F\x6E\x67\x20\x4B\x6F\x6E\x67\x29","\x44\x65\x66\x61\x75\x6C\x74","\x44\x61\x74\x65","\x55\x53\x20\x4D\x6F\x6E\x65\x79","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39\x39","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39\x39\x39","\x54\x69\x6D\x65","\x50\x68\x6F\x6E\x65\x20\x6E\x75\x6D\x62\x65\x72","\x53\x74\x72\x65\x65\x74\x73","\x55\x53\x20\x43\x69\x74\x79\x2F\x53\x74\x61\x74\x65\x73","\x41\x66\x72\x69\x6B\x61\x61\x6E\x73","\x41\x6C\x62\x61\x6E\x69\x61\x6E","\x41\x6D\x68\x61\x72\x69\x63","\x41\x72\x61\x62\x69\x63","\x41\x72\x6D\x65\x6E\x69\x61\x6E","\x41\x7A\x65\x72\x62\x61\x69\x6A\x61\x6E\x69","\x42\x61\x73\x71\x75\x65","\x42\x65\x6C\x61\x72\x75\x73\x69\x61\x6E","\x42\x65\x6E\x67\x61\x6C\x69","\x42\x69\x68\x61\x72\x69","\x42\x6F\x73\x6E\x69\x61\x6E","\x42\x72\x65\x74\x6F\x6E","\x42\x75\x6C\x67\x61\x72\x69\x61\x6E","\x43\x61\x6D\x62\x6F\x64\x69\x61\x6E","\x43\x61\x74\x61\x6C\x61\x6E","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x53\x69\x6D\x70\x6C\x69\x66\x69\x65\x64\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x54\x72\x61\x64\x69\x74\x69\x6F\x6E\x61\x6C\x29","\x43\x6F\x72\x73\x69\x63\x61\x6E","\x43\x72\x6F\x61\x74\x69\x61\x6E","\x43\x7A\x65\x63\x68","\x44\x61\x6E\x69\x73\x68","\x44\x75\x74\x63\x68","\x45\x6E\x67\x6C\x69\x73\x68","\x45\x73\x70\x65\x72\x61\x6E\x74\x6F","\x45\x73\x74\x6F\x6E\x69\x61\x6E","\x46\x61\x72\x6F\x65\x73\x65","\x46\x69\x6C\x69\x70\x69\x6E\x6F","\x46\x69\x6E\x6E\x69\x73\x68","\x46\x72\x65\x6E\x63\x68","\x46\x72\x69\x73\x69\x61\x6E","\x47\x61\x6C\x69\x63\x69\x61\x6E","\x47\x65\x6F\x72\x67\x69\x61\x6E","\x47\x65\x72\x6D\x61\x6E","\x47\x72\x65\x65\x6B","\x47\x75\x61\x72\x61\x6E\x69","\x47\x75\x6A\x61\x72\x61\x74\x69","\x48\x61\x63\x6B\x65\x72","\x48\x61\x75\x73\x61","\x48\x65\x62\x72\x65\x77","\x48\x69\x6E\x64\x69","\x48\x75\x6E\x67\x61\x72\x69\x61\x6E","\x49\x63\x65\x6C\x61\x6E\x64\x69\x63","\x49\x6E\x64\x6F\x6E\x65\x73\x69\x61\x6E","\x49\x6E\x74\x65\x72\x6C\x69\x6E\x67\x75\x61","\x49\x72\x69\x73\x68","\x49\x74\x61\x6C\x69\x61\x6E","\x4A\x61\x76\x61\x6E\x65\x73\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65","\x4B\x61\x6E\x6E\x61\x64\x61","\x4B\x61\x7A\x61\x6B\x68","\x4B\x69\x6E\x79\x61\x72\x77\x61\x6E\x64\x61","\x4B\x69\x72\x75\x6E\x64\x69","\x4B\x6C\x69\x6E\x67\x6F\x6E","\x4B\x75\x72\x64\x69\x73\x68","\x4B\x6F\x72\x65\x61\x6E","\x4B\x79\x72\x67\x79\x7A","\x4C\x61\x6F\x74\x68\x69\x61\x6E","\x4C\x61\x74\x69\x6E","\x4C\x61\x74\x76\x69\x61\x6E","\x4C\x69\x6E\x67\x61\x6C\x61","\x4C\x69\x74\x68\x75\x61\x6E\x69\x61\x6E","\x4D\x61\x63\x65\x64\x6F\x6E\x69\x61\x6E","\x4D\x61\x6C\x61\x67\x61\x73\x79","\x4D\x61\x6C\x61\x79","\x4D\x61\x6C\x61\x79\x61\x6C\x61\x6D","\x4D\x61\x6C\x74\x65\x73\x65","\x4D\x61\x6F\x72\x69","\x4D\x61\x72\x61\x74\x68\x69","\x4D\x6F\x6C\x64\x61\x76\x69\x61\x6E","\x4D\x6F\x6E\x67\x6F\x6C\x69\x61\x6E","\x4D\x6F\x6E\x74\x65\x6E\x65\x67\x72\x69\x6E","\x4E\x65\x70\x61\x6C\x69","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x28\x4E\x79\x6E\x6F\x72\x73\x6B\x29","\x4F\x63\x63\x69\x74\x61\x6E","\x4F\x72\x69\x79\x61","\x4F\x72\x6F\x6D\x6F","\x50\x61\x73\x68\x74\x6F","\x50\x65\x72\x73\x69\x61\x6E","\x50\x69\x72\x61\x74\x65","\x50\x6F\x6C\x69\x73\x68","\x50\x75\x6E\x6A\x61\x62\x69","\x51\x75\x65\x63\x68\x75\x61","\x52\x6F\x6D\x61\x6E\x69\x61\x6E","\x52\x6F\x6D\x61\x6E\x73\x68","\x52\x75\x73\x73\x69\x61\x6E","\x53\x63\x6F\x74\x73\x20\x47\x61\x65\x6C\x69\x63","\x53\x65\x72\x62\x69\x61\x6E","\x53\x65\x72\x62\x6F\x2D\x43\x72\x6F\x61\x74\x69\x61\x6E","\x53\x65\x73\x6F\x74\x68\x6F","\x53\x68\x6F\x6E\x61","\x53\x69\x6E\x64\x68\x69","\x53\x69\x6E\x68\x61\x6C\x65\x73\x65","\x53\x6C\x6F\x76\x61\x6B","\x53\x6C\x6F\x76\x65\x6E\x69\x61\x6E","\x53\x6F\x6D\x61\x6C\x69","\x53\x70\x61\x6E\x69\x73\x68","\x53\x75\x6E\x64\x61\x6E\x65\x73\x65","\x53\x77\x61\x68\x69\x6C\x69","\x53\x77\x65\x64\x69\x73\x68","\x54\x61\x6A\x69\x6B","\x54\x61\x6D\x69\x6C","\x54\x61\x74\x61\x72","\x54\x65\x6C\x75\x67\x75","\x54\x68\x61\x69","\x54\x69\x67\x72\x69\x6E\x79\x61","\x54\x6F\x6E\x67\x61","\x54\x75\x72\x6B\x69\x73\x68","\x54\x75\x72\x6B\x6D\x65\x6E","\x54\x77\x69","\x55\x69\x67\x68\x75\x72","\x55\x6B\x72\x61\x69\x6E\x69\x61\x6E","\x55\x72\x64\x75","\x55\x7A\x62\x65\x6B","\x56\x69\x65\x74\x6E\x61\x6D\x65\x73\x65","\x57\x65\x6C\x73\x68","\x58\x68\x6F\x73\x61","\x59\x69\x64\x64\x69\x73\x68","\x59\x6F\x72\x75\x62\x61","\x5A\x75\x6C\x75"];var urlParams=(function(_0xbe6cx2){var _0xbe6cx3= new Object();var _0xbe6cx4=_0xbe6cx2[_0xc2aa[3]](_0xc2aa[2]);if(_0xbe6cx4>0){var _0xbe6cx5=_0xbe6cx2[_0xc2aa[6]](_0xbe6cx4+1)[_0xc2aa[5]](_0xc2aa[4]);for(var _0xbe6cx6=0;_0xbe6cx6<_0xbe6cx5[_0xc2aa[7]];_0xbe6cx6++){_0xbe6cx4=_0xbe6cx5[_0xbe6cx6][_0xc2aa[9]](_0xc2aa[8]);if(_0xbe6cx4>0){_0xbe6cx3[_0xbe6cx5[_0xbe6cx6][_0xc2aa[6]](0,_0xbe6cx4)]=_0xbe6cx5[_0xbe6cx6][_0xc2aa[6]](_0xbe6cx4+1)}}};return _0xbe6cx3})(window[_0xc2aa[1]][_0xc2aa[0]]);var t0= new Date();var MAX_REQUEST_SIZE=10485760;var MAX_WIDTH=12000;var MAX_HEIGHT=12000;var EXPORT_URL=_0xc2aa[10];var SHARE_HOST=_0xc2aa[11];var SAVE_URL=_0xc2aa[12];var VARIABLE_URL=_0xc2aa[13];var STENCIL_PATH=_0xc2aa[14];var SHAPES_PATH=_0xc2aa[15];var IMAGE_PATH=_0xc2aa[16];var STYLE_PATH=_0xc2aa[17];var CSS_PATH=_0xc2aa[17];var OPEN_FORM=_0xc2aa[18];var TEMPLATE_PATH=_0xc2aa[19];var RESOURCES_PATH=_0xc2aa[20];var RESOURCE_BASE=RESOURCES_PATH+_0xc2aa[21];var tapAndHoldStartsConnection=true;var showConnectorImg=true;var mxLoadResources=false;console[_0xc2aa[25]](_0xc2aa[22],localStorage[_0xc2aa[24]](_0xc2aa[23]));switch(localStorage[_0xc2aa[24]](_0xc2aa[23])){case _0xc2aa[27]:mxLanguage=_0xc2aa[26];break;case _0xc2aa[28]:mxLanguage=_0xc2aa[28];break;default:mxLanguage=_0xc2aa[28]};console[_0xc2aa[25]](_0xc2aa[29],mxLanguage);var mxLanguages=[_0xc2aa[30],_0xc2aa[31],_0xc2aa[32],_0xc2aa[33],_0xc2aa[34],_0xc2aa[35],_0xc2aa[36],_0xc2aa[37],_0xc2aa[38],_0xc2aa[39],_0xc2aa[40],_0xc2aa[28],_0xc2aa[41],_0xc2aa[42],_0xc2aa[43],_0xc2aa[44],_0xc2aa[45],_0xc2aa[46],_0xc2aa[47],_0xc2aa[48],_0xc2aa[49],_0xc2aa[50],_0xc2aa[51],_0xc2aa[52],_0xc2aa[53],_0xc2aa[54],_0xc2aa[55]];var mxBasePath=_0xc2aa[56];var geBasePath=_0xc2aa[57];var ISPEECHLANG={usenglishfemale:_0xc2aa[58],usenglishmale:_0xc2aa[59],ukenglishfemale:_0xc2aa[60],ukenglishmale:_0xc2aa[61],auenglishfemale:_0xc2aa[62],usspanishfemale:_0xc2aa[63],usspanishmale:_0xc2aa[64],chchinesefemale:_0xc2aa[65],chchinesemale:_0xc2aa[66],hkchinesefemale:_0xc2aa[67],twchinesefemale:_0xc2aa[68],jpjapanesefemale:_0xc2aa[69],jpjapanesemale:_0xc2aa[70],krkoreanfemale:_0xc2aa[71],krkoreanmale:_0xc2aa[72],caenglishfemale:_0xc2aa[73],huhungarianfemale:_0xc2aa[74],brportuguesefemale:_0xc2aa[75],eurportuguesefemale:_0xc2aa[76],eurportuguesemale:_0xc2aa[77],eurspanishfemale:_0xc2aa[78],eurspanishmale:_0xc2aa[79],eurcatalanfemale:_0xc2aa[80],eurczechfemale:_0xc2aa[81],eurdanishfemale:_0xc2aa[82],eurfinnishfemale:_0xc2aa[83],eurfrenchfemale:_0xc2aa[84],eurfrenchmale:_0xc2aa[85],eurnorwegianfemale:_0xc2aa[86],eurdutchfemale:_0xc2aa[87],eurpolishfemale:_0xc2aa[88],euritalianfemale:_0xc2aa[89],eurturkishfemale:_0xc2aa[90],eurturkishmale:_0xc2aa[91],eurgermanfemale:_0xc2aa[92],eurgermanmale:_0xc2aa[93],rurussianfemale:_0xc2aa[94],rurussianmale:_0xc2aa[95],swswedishfemale:_0xc2aa[96],cafrenchfemale:_0xc2aa[97],cafrenchmale:_0xc2aa[98]};var ISPEECHASRLANG={"\x65\x6E\x2D\x55\x53":_0xc2aa[99],"\x65\x6E\x2D\x43\x41":_0xc2aa[100],"\x65\x6E\x2D\x47\x42":_0xc2aa[101],"\x65\x6E\x2D\x41\x55":_0xc2aa[102],"\x65\x73\x2D\x45\x53":_0xc2aa[103],"\x65\x73\x2D\x4D\x58":_0xc2aa[104],"\x69\x74\x2D\x49\x54":_0xc2aa[105],"\x66\x72\x2D\x46\x52":_0xc2aa[106],"\x66\x72\x2D\x43\x41":_0xc2aa[107],"\x70\x6C\x2D\x50\x4C":_0xc2aa[108],"\x70\x74\x2D\x50\x54":_0xc2aa[109],"\x63\x61\x2D\x45\x53":_0xc2aa[110],"\x7A\x68\x2D\x54\x57":_0xc2aa[111],"\x64\x61\x2D\x44\x4B":_0xc2aa[112],"\x66\x72\x2D\x46\x52":_0xc2aa[113],"\x6A\x61\x2D\x4A\x50":_0xc2aa[114],"\x6B\x6F\x2D\x4B\x52":_0xc2aa[115],"\x6E\x6C\x2D\x4E\x4C":_0xc2aa[116],"\x6E\x62\x2D\x4E\x4F":_0xc2aa[117],"\x70\x74\x2D\x42\x52":_0xc2aa[118],"\x72\x75\x2D\x52\x55":_0xc2aa[119],"\x73\x76\x2D\x53\x45":_0xc2aa[120],"\x7A\x68\x2D\x43\x4E":_0xc2aa[121],"\x7A\x68\x2D\x48\x4B":_0xc2aa[122]};var ISPEECHASRMODEL={0:_0xc2aa[123],date:_0xc2aa[124],usmoney:_0xc2aa[125],numbersto9:_0xc2aa[126],numbersto99:_0xc2aa[127],numbersto999:_0xc2aa[128],time:_0xc2aa[129],phonenumber:_0xc2aa[130],streets:_0xc2aa[131],citystate:_0xc2aa[132]};var GOOGLETTSLANG={"\x61\x66":_0xc2aa[133],"\x73\x71":_0xc2aa[134],"\x61\x6D":_0xc2aa[135],"\x61\x72":_0xc2aa[136],"\x68\x79":_0xc2aa[137],"\x61\x7A":_0xc2aa[138],"\x65\x75":_0xc2aa[139],"\x62\x65":_0xc2aa[140],"\x62\x6E":_0xc2aa[141],"\x62\x68":_0xc2aa[142],"\x62\x73":_0xc2aa[143],"\x62\x72":_0xc2aa[144],"\x62\x67":_0xc2aa[145],"\x6B\x6D":_0xc2aa[146],"\x63\x61":_0xc2aa[147],"\x7A\x68\x2D\x43\x4E":_0xc2aa[148],"\x7A\x68\x2D\x54\x57":_0xc2aa[149],"\x63\x6F":_0xc2aa[150],"\x68\x72":_0xc2aa[151],"\x63\x73":_0xc2aa[152],"\x64\x61":_0xc2aa[153],"\x6E\x6C":_0xc2aa[154],"\x65\x6E":_0xc2aa[155],"\x65\x6F":_0xc2aa[156],"\x65\x74":_0xc2aa[157],"\x66\x6F":_0xc2aa[158],"\x74\x6C":_0xc2aa[159],"\x66\x69":_0xc2aa[160],"\x66\x72":_0xc2aa[161],"\x66\x79":_0xc2aa[162],"\x67\x6C":_0xc2aa[163],"\x6B\x61":_0xc2aa[164],"\x64\x65":_0xc2aa[165],"\x65\x6C":_0xc2aa[166],"\x67\x6E":_0xc2aa[167],"\x67\x75":_0xc2aa[168],"\x78\x78\x2D\x68\x61\x63\x6B\x65\x72":_0xc2aa[169],"\x68\x61":_0xc2aa[170],"\x69\x77":_0xc2aa[171],"\x68\x69":_0xc2aa[172],"\x68\x75":_0xc2aa[173],"\x69\x73":_0xc2aa[174],"\x69\x64":_0xc2aa[175],"\x69\x61":_0xc2aa[176],"\x67\x61":_0xc2aa[177],"\x69\x74":_0xc2aa[178],"\x6A\x77":_0xc2aa[179],"\x6A\x61":_0xc2aa[180],"\x6B\x6E":_0xc2aa[181],"\x6B\x6B":_0xc2aa[182],"\x72\x77":_0xc2aa[183],"\x72\x6E":_0xc2aa[184],"\x78\x78\x2D\x6B\x6C\x69\x6E\x67\x6F\x6E":_0xc2aa[185],"\x6B\x75":_0xc2aa[186],"\x6B\x6F":_0xc2aa[187],"\x6B\x79":_0xc2aa[188],"\x6C\x6F":_0xc2aa[189],"\x6C\x61":_0xc2aa[190],"\x6C\x76":_0xc2aa[191],"\x6C\x6E":_0xc2aa[192],"\x6C\x74":_0xc2aa[193],"\x6D\x6B":_0xc2aa[194],"\x6D\x67":_0xc2aa[195],"\x6D\x73":_0xc2aa[196],"\x6D\x6C":_0xc2aa[197],"\x6D\x74":_0xc2aa[198],"\x6D\x69":_0xc2aa[199],"\x6D\x72":_0xc2aa[200],"\x6D\x6F":_0xc2aa[201],"\x6D\x6E":_0xc2aa[202],"\x73\x72\x2D\x4D\x45":_0xc2aa[203],"\x6E\x65":_0xc2aa[204],"\x6E\x6F":_0xc2aa[205],"\x6E\x6E":_0xc2aa[206],"\x6F\x63":_0xc2aa[207],"\x6F\x72":_0xc2aa[208],"\x6F\x6D":_0xc2aa[209],"\x70\x73":_0xc2aa[210],"\x66\x61":_0xc2aa[211],"\x78\x78\x2D\x70\x69\x72\x61\x74\x65":_0xc2aa[212],"\x70\x6C":_0xc2aa[213],"\x70\x74\x2D\x42\x52":_0xc2aa[118],"\x70\x74\x2D\x50\x54":_0xc2aa[109],"\x70\x61":_0xc2aa[214],"\x71\x75":_0xc2aa[215],"\x72\x6F":_0xc2aa[216],"\x72\x6D":_0xc2aa[217],"\x72\x75":_0xc2aa[218],"\x67\x64":_0xc2aa[219],"\x73\x72":_0xc2aa[220],"\x73\x68":_0xc2aa[221],"\x73\x74":_0xc2aa[222],"\x73\x6E":_0xc2aa[223],"\x73\x64":_0xc2aa[224],"\x73\x69":_0xc2aa[225],"\x73\x6B":_0xc2aa[226],"\x73\x6C":_0xc2aa[227],"\x73\x6F":_0xc2aa[228],"\x65\x73":_0xc2aa[229],"\x73\x75":_0xc2aa[230],"\x73\x77":_0xc2aa[231],"\x73\x76":_0xc2aa[232],"\x74\x67":_0xc2aa[233],"\x74\x61":_0xc2aa[234],"\x74\x74":_0xc2aa[235],"\x74\x65":_0xc2aa[236],"\x74\x68":_0xc2aa[237],"\x74\x69":_0xc2aa[238],"\x74\x6F":_0xc2aa[239],"\x74\x72":_0xc2aa[240],"\x74\x6B":_0xc2aa[241],"\x74\x77":_0xc2aa[242],"\x75\x67":_0xc2aa[243],"\x75\x6B":_0xc2aa[244],"\x75\x72":_0xc2aa[245],"\x75\x7A":_0xc2aa[246],"\x76\x69":_0xc2aa[247],"\x63\x79":_0xc2aa[248],"\x78\x68":_0xc2aa[249],"\x79\x69":_0xc2aa[250],"\x79\x6F":_0xc2aa[251],"\x7A\x75":_0xc2aa[252]} \ No newline at end of file +var urlParams = (function(url) { + var result = new Object(); + var idx = url.lastIndexOf('?'); + + if (idx > 0) { + var params = url.substring(idx + 1).split('&'); + + for (var i = 0; i < params.length; i++) { + idx = params[i].indexOf('='); + + if (idx > 0) { + result[params[i].substring(0, idx)] = params[i].substring(idx + 1); + } + } + } + + return result; +})(window.location.href); + +var t0 = new Date(); + +// Public global variables +var MAX_REQUEST_SIZE = 10485760; +var MAX_WIDTH = 12000; +var MAX_HEIGHT = 12000; + +// CUSTOM_PARAMETERS - URLs for save and export +var EXPORT_URL = 'http://exp.draw.io/ImageExport2/export'; +var SHARE_HOST = 'http://localhost:3000'; + +var SAVE_URL = 'api/jscripty/projects/'; +var VARIABLE_URL = 'api/square/variables/'; + +// Paths and files +var STENCIL_PATH = '/assets/plugins/jscripty/stencils'; +var SHAPES_PATH = '/assets/plugins/mxgraph/shapes'; +var IMAGE_PATH = '/assets/plugins/mxgraph/images'; +// Path for images inside the diagram +//var GRAPH_IMAGE_PATH = 'assets/plugins/mxgraph/img'; +//var ICONFINDER_PATH = 'iconfinder'; +var STYLE_PATH = '/assets/plugins/mxgraph/styles'; +var CSS_PATH = '/assets/plugins/mxgraph/styles'; +var OPEN_FORM = 'api/jscripty/projects/open'; +var TEMPLATE_PATH = '/assets/plugins/jscripty/templates'; + +// Directory for i18 files and basename for main i18n file +var RESOURCES_PATH = '/assets/plugins/jscripty/resources'; +var RESOURCE_BASE = RESOURCES_PATH + '/dia'; + +// Specifies connection mode for touch devices (at least one should be true) +var tapAndHoldStartsConnection = true; +var showConnectorImg = true; + +var mxLoadResources = false; +// var mxLanguage = ''; +console.log('custom', localStorage.getItem("NG_TRANSLATE_LANG_KEY")); +switch (localStorage.getItem("NG_TRANSLATE_LANG_KEY")) { + case 'en_EN': + mxLanguage = 'en'; + break; + case 'it': + mxLanguage = 'it'; + break; + default: + mxLanguage = 'it'; +} +console.log('mxLanguage', mxLanguage); + +var mxLanguages = ['ar', 'bs', 'cs', 'da', 'de', 'el', 'es', 'es-ar', 'fr', + 'hu', 'id', 'it', 'ja', 'ko', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', + 'sr', 'sv', 'th', 'tr', 'uk', 'zh' +]; +var mxBasePath = 'assets/plugins/mxgraph'; +var geBasePath = 'assets/plugins/mxgraph/js'; + +var ISPEECHLANG = { + usenglishfemale: "US English Female", + usenglishmale: "US English Male", + ukenglishfemale: "UK English Female", + ukenglishmale: "UK English Male", + auenglishfemale: "Australian English", + usspanishfemale: "US Spanish Female", + usspanishmale: "US Spanish Male", + chchinesefemale: "Chinese Female", + chchinesemale: "Chinese Male", + hkchinesefemale: "Hong Kong Cantonese Female", + twchinesefemale: "Taiwan Chinese Female", + jpjapanesefemale: "Japanese Female", + jpjapanesemale: "Japanese Male", + krkoreanfemale: "Korean Female", + krkoreanmale: "Korean Male", + caenglishfemale: "Canadian English Female", + huhungarianfemale: "Hungarian Female", + brportuguesefemale: "Brazilian Portuguese Female", + eurportuguesefemale: "European Portuguese Female", + eurportuguesemale: "European Portuguese Male", + eurspanishfemale: "European Spanish Female", + eurspanishmale: "European Spanish Male", + eurcatalanfemale: "European Catalan Female", + eurczechfemale: "European Czech Female", + eurdanishfemale: "European Danish Female", + eurfinnishfemale: "European Finnish Female", + eurfrenchfemale: "European French Female", + eurfrenchmale: "European French Male", + eurnorwegianfemale: "European Norwegian Female", + eurdutchfemale: "European Dutch Female", + eurpolishfemale: "European Polish Female", + euritalianfemale: "European Italian Female", + eurturkishfemale: "European Turkish Female ", + eurturkishmale: "European Turkish Male", + eurgermanfemale: "European German Female", + eurgermanmale: "European German Male", + rurussianfemale: "Russian Female", + rurussianmale: "Russian Male", + swswedishfemale: "Swedish Female", + cafrenchfemale: "Canadian French Female", + cafrenchmale: "Canadian French Male" +}; + +var ISPEECHASRLANG = { + "en-US": "English (US)", + "en-CA": "English (Canada)", + "en-GB": "English (UK)", + "en-AU": "English (Australia)", + "es-ES": "Spanish (Spain)", + "es-MX": "Spanish (Mexico)", + "it-IT": "Italian (Italy) / Finnish (Finland)", + "fr-FR": "French (France)", + "fr-CA": "French (Canada)", + "pl-PL": "Polish (Poland)", + "pt-PT": "Portuguese (Portugal)", + "ca-ES": "Catalan (Catalan)", + "zh-TW": "Chinese (Taiwan)", + "da-DK": "Danish (Denmark)", + "fr-FR": "German (Germany)", + "ja-JP": "Japanese (Japan)", + "ko-KR": "Korean (Korea)", + "nl-NL": "Dutch (Netherlands)", + "nb-NO": "Norwegian (Norway)", + "pt-BR": "Portuguese (Brazil)", + "ru-RU": "Russian (Russia)", + "sv-SE": "Swedish (Sweden)", + "zh-CN": "Chinese (China)", + "zh-HK": "Chinese (Hong Kong)" +}; + +var ISPEECHASRMODEL = { + 0: "Default", + date: "Date", + usmoney: "US Money", + numbersto9: "Numbers to 9", + numbersto99: "Numbers to 99", + numbersto999: "Numbers to 999", + time: "Time", + phonenumber: "Phone number", + streets: "Streets", + citystate: "US City/States" +}; + +var GOOGLETTSLANG = { + "af": "Afrikaans", + "sq": "Albanian", + "am": "Amharic", + "ar": "Arabic", + "hy": "Armenian", + "az": "Azerbaijani", + "eu": "Basque", + "be": "Belarusian", + "bn": "Bengali", + "bh": "Bihari", + "bs": "Bosnian", + "br": "Breton", + "bg": "Bulgarian", + "km": "Cambodian", + "ca": "Catalan", + "zh-CN": "Chinese (Simplified)", + "zh-TW": "Chinese (Traditional)", + "co": "Corsican", + "hr": "Croatian", + "cs": "Czech", + "da": "Danish", + "nl": "Dutch", + "en": "English", + "eo": "Esperanto", + "et": "Estonian", + "fo": "Faroese", + "tl": "Filipino", + "fi": "Finnish", + "fr": "French", + "fy": "Frisian", + "gl": "Galician", + "ka": "Georgian", + "de": "German", + "el": "Greek", + "gn": "Guarani", + "gu": "Gujarati", + "xx-hacker": "Hacker", + "ha": "Hausa", + "iw": "Hebrew", + "hi": "Hindi", + "hu": "Hungarian", + "is": "Icelandic", + "id": "Indonesian", + "ia": "Interlingua", + "ga": "Irish", + "it": "Italian", + "jw": "Javanese", + "ja": "Japanese", + "kn": "Kannada", + "kk": "Kazakh", + "rw": "Kinyarwanda", + "rn": "Kirundi", + "xx-klingon": "Klingon", + "ku": "Kurdish", + "ko": "Korean", + "ky": "Kyrgyz", + "lo": "Laothian", + "la": "Latin", + "lv": "Latvian", + "ln": "Lingala", + "lt": "Lithuanian", + "mk": "Macedonian", + "mg": "Malagasy", + "ms": "Malay", + "ml": "Malayalam", + "mt": "Maltese", + "mi": "Maori", + "mr": "Marathi", + "mo": "Moldavian", + "mn": "Mongolian", + "sr-ME": "Montenegrin", + "ne": "Nepali", + "no": "Norwegian", + "nn": "Norwegian (Nynorsk)", + "oc": "Occitan", + "or": "Oriya", + "om": "Oromo", + "ps": "Pashto", + "fa": "Persian", + "xx-pirate": "Pirate", + "pl": "Polish", + "pt-BR": "Portuguese (Brazil)", + "pt-PT": "Portuguese (Portugal)", + "pa": "Punjabi", + "qu": "Quechua", + "ro": "Romanian", + "rm": "Romansh", + "ru": "Russian", + "gd": "Scots Gaelic", + "sr": "Serbian", + "sh": "Serbo-Croatian", + "st": "Sesotho", + "sn": "Shona", + "sd": "Sindhi", + "si": "Sinhalese", + "sk": "Slovak", + "sl": "Slovenian", + "so": "Somali", + "es": "Spanish", + "su": "Sundanese", + "sw": "Swahili", + "sv": "Swedish", + "tg": "Tajik", + "ta": "Tamil", + "tt": "Tatar", + "te": "Telugu", + "th": "Thai", + "ti": "Tigrinya", + "to": "Tonga", + "tr": "Turkish", + "tk": "Turkmen", + "tw": "Twi", + "ug": "Uighur", + "uk": "Ukrainian", + "ur": "Urdu", + "uz": "Uzbek", + "vi": "Vietnamese", + "cy": "Welsh", + "xh": "Xhosa", + "yi": "Yiddish", + "yo": "Yoruba", + "zu": "Zulu" +}; diff --git a/public/assets/plugins/mxgraph/js/mxClient.js b/public/assets/plugins/mxgraph/js/mxClient.js index 5ab5c2a..e795889 100644 --- a/public/assets/plugins/mxgraph/js/mxClient.js +++ b/public/assets/plugins/mxgraph/js/mxClient.js @@ -1 +1,18737 @@ -var _0xe4bc=["\x32\x2E\x30\x2E\x30\x2E\x30","\x4D\x53\x49\x45","\x69\x6E\x64\x65\x78\x4F\x66","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x4D\x53\x49\x45\x20\x36","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x76","\x6F","\x4D\x6F\x7A\x69\x6C\x6C\x61\x2F","\x4F\x70\x65\x72\x61\x2F","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x34\x2E","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x33\x2E","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x32\x2E","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x31\x2E","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x30\x2E","\x50\x72\x65\x73\x74\x6F\x2F\x31\x2E","\x41\x70\x70\x6C\x65\x57\x65\x62\x4B\x69\x74\x2F","\x43\x68\x72\x6F\x6D\x65\x2F","\x46\x69\x72\x65\x66\x6F\x78\x2F","\x46\x69\x72\x65\x66\x6F\x78\x2F\x31\x2E","\x46\x69\x72\x65\x66\x6F\x78\x2F\x32\x2E","\x49\x63\x65\x77\x65\x61\x73\x65\x6C\x2F","\x49\x63\x65\x77\x65\x61\x73\x65\x6C\x2F\x31\x2E","\x49\x63\x65\x77\x65\x61\x73\x65\x6C\x2F\x32\x2E","\x53\x65\x61\x4D\x6F\x6E\x6B\x65\x79\x2F","\x53\x65\x61\x4D\x6F\x6E\x6B\x65\x79\x2F\x31\x2E","\x49\x63\x65\x61\x70\x65\x2F","\x49\x63\x65\x61\x70\x65\x2F\x31\x2E","\x53\x65\x61\x6D\x6F\x6E\x6B\x65\x79\x2F","\x47\x61\x6C\x65\x6F\x6E\x2F","\x45\x70\x69\x70\x68\x61\x6E\x79\x2F","\x47\x65\x63\x6B\x6F\x2F","\x43\x61\x6D\x69\x6E\x6F\x2F\x31\x2E","\x45\x70\x69\x70\x68\x61\x6E\x79\x2F\x32\x2E","\x4D\x6F\x7A\x69\x6C\x6C\x61\x2F\x32\x2E","\x4D\x49\x43\x52\x4F\x53\x4F\x46\x54\x20\x49\x4E\x54\x45\x52\x4E\x45\x54\x20\x45\x58\x50\x4C\x4F\x52\x45\x52","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x61\x70\x70\x4E\x61\x6D\x65","\x4D\x41\x43\x49\x4E\x54\x4F\x53\x48","\x49\x50\x41\x44","\x49\x50\x4F\x44","\x49\x50\x48\x4F\x4E\x45","\x41\x4E\x44\x52\x4F\x49\x44","\x68\x74\x74\x70\x3A\x2F\x2F","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x68\x74\x74\x70\x73\x3A\x2F\x2F","\x49\x53\x5F\x56\x4D\x4C","\x49\x53\x5F\x53\x56\x47","\x49\x53\x5F\x49\x45\x36","\x3C\x6C\x69\x6E\x6B\x20\x72\x65\x6C\x3D\x22","\x22\x20\x68\x72\x65\x66\x3D\x22","\x22\x20\x63\x68\x61\x72\x73\x65\x74\x3D\x22\x49\x53\x4F\x2D\x38\x38\x35\x39\x2D\x31\x22\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x2F\x63\x73\x73\x22\x2F\x3E","\x77\x72\x69\x74\x65","\x6C\x69\x6E\x6B","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x72\x65\x6C","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x68\x61\x72\x73\x65\x74","\x49\x53\x4F\x2D\x38\x38\x35\x39\x2D\x31","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x63\x73\x73","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x65\x61\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x22","\x22\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E","\x6C\x65\x6E\x67\x74\x68","\x6F\x62\x6A\x65\x63\x74\x73","\x6D\x78\x4C\x69\x73\x74\x65\x6E\x65\x72\x4C\x69\x73\x74","\x72\x65\x6D\x6F\x76\x65\x41\x6C\x6C\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x49\x53\x5F\x4F\x50","\x49\x53\x5F\x4F\x54","\x43\x53\x53\x5F\x50\x52\x45\x46\x49\x58","\x4F","\x49\x53\x5F\x53\x46","\x49\x53\x5F\x47\x43","\x57\x65\x62\x6B\x69\x74","\x49\x53\x5F\x4D\x54","\x4D\x6F\x7A","\x49\x53\x5F\x49\x45","\x6D\x73","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x2E\x74\x78\x74","\x2F","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x62\x61\x73\x65\x50\x61\x74\x68","\x2E","\x69\x6D\x61\x67\x65\x42\x61\x73\x65\x50\x61\x74\x68","\x2F\x69\x6D\x61\x67\x65\x73","\x6C\x61\x6E\x67\x75\x61\x67\x65","\x75\x73\x65\x72\x4C\x61\x6E\x67\x75\x61\x67\x65","\x64\x65\x66\x61\x75\x6C\x74\x4C\x61\x6E\x67\x75\x61\x67\x65","\x65\x6E","\x73\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x2F\x63\x73\x73\x2F\x63\x6F\x6D\x6D\x6F\x6E\x2E\x63\x73\x73","\x6C\x61\x6E\x67\x75\x61\x67\x65\x73","\x75\x72\x6E\x3A\x73\x63\x68\x65\x6D\x61\x73\x2D\x6D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2D\x63\x6F\x6D\x3A\x76\x6D\x6C","\x23\x64\x65\x66\x61\x75\x6C\x74\x23\x56\x4D\x4C","\x61\x64\x64","\x6E\x61\x6D\x65\x73\x70\x61\x63\x65\x73","\x75\x72\x6E\x3A\x73\x63\x68\x65\x6D\x61\x73\x2D\x6D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2D\x63\x6F\x6D\x3A\x6F\x66\x66\x69\x63\x65\x3A\x6F\x66\x66\x69\x63\x65","\x63\x72\x65\x61\x74\x65\x53\x74\x79\x6C\x65\x53\x68\x65\x65\x74","\x63\x73\x73\x54\x65\x78\x74","\x76\x5C\x3A\x2A\x7B\x62\x65\x68\x61\x76\x69\x6F\x72\x3A\x75\x72\x6C\x28\x23\x64\x65\x66\x61\x75\x6C\x74\x23\x56\x4D\x4C\x29\x7D\x6F\x5C\x3A\x2A\x7B\x62\x65\x68\x61\x76\x69\x6F\x72\x3A\x75\x72\x6C\x28\x23\x64\x65\x66\x61\x75\x6C\x74\x23\x56\x4D\x4C\x29\x7D","\x2F\x63\x73\x73\x2F\x65\x78\x70\x6C\x6F\x72\x65\x72\x2E\x63\x73\x73","\x6F\x6E\x75\x6E\x6C\x6F\x61\x64","\x64\x69\x73\x70\x6F\x73\x65","\x61\x74\x74\x61\x63\x68\x45\x76\x65\x6E\x74","\x43\x6F\x6E\x73\x6F\x6C\x65","","\x77\x69\x6E\x64\x6F\x77","\x62\x6F\x64\x79","\x63\x6F\x6E\x73\x6F\x6C\x65\x4E\x61\x6D\x65","\x20\x2D\x20\x6D\x78\x47\x72\x61\x70\x68\x20","\x56\x45\x52\x53\x49\x4F\x4E","\x74\x61\x62\x6C\x65","\x77\x69\x64\x74\x68","\x31\x30\x30\x25","\x68\x65\x69\x67\x68\x74","\x74\x62\x6F\x64\x79","\x74\x72","\x74\x64","\x76\x65\x72\x74\x69\x63\x61\x6C\x41\x6C\x69\x67\x6E","\x73\x74\x79\x6C\x65","\x74\x6F\x70","\x74\x65\x78\x74\x61\x72\x65\x61","\x72\x65\x61\x64\x4F\x6E\x6C\x79","\x74\x72\x75\x65","\x72\x65\x73\x69\x7A\x65","\x6E\x6F\x6E\x65","\x76\x61\x6C\x75\x65","\x62\x75\x66\x66\x65\x72","\x49\x53\x5F\x4E\x53","\x42\x61\x63\x6B\x43\x6F\x6D\x70\x61\x74","\x63\x6F\x6D\x70\x61\x74\x4D\x6F\x64\x65","\x39\x39\x25","\x33\x30\x70\x78","\x49\x6E\x66\x6F","\x69\x6E\x66\x6F","\x61\x64\x64\x42\x75\x74\x74\x6F\x6E","\x44\x4F\x4D","\x67\x65\x74\x49\x6E\x6E\x65\x72\x48\x74\x6D\x6C","\x64\x65\x62\x75\x67","\x54\x72\x61\x63\x65","\x54\x52\x41\x43\x45","\x54\x72\x61\x63\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64","\x54\x72\x61\x63\x69\x6E\x67\x20\x64\x69\x73\x61\x62\x6C\x65\x64","\x43\x6F\x70\x79","\x63\x6F\x70\x79","\x61\x6C\x65\x72\x74","\x53\x68\x6F\x77","\x70\x6F\x70\x75\x70","\x43\x6C\x65\x61\x72","\x6E\x75\x6D\x62\x65\x72","\x69\x6E\x6E\x65\x72\x57\x69\x64\x74\x68","\x69\x6E\x6E\x65\x72\x48\x65\x69\x67\x68\x74","\x63\x6C\x69\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x6D\x61\x78","\x73\x65\x74\x4D\x61\x78\x69\x6D\x69\x7A\x61\x62\x6C\x65","\x73\x65\x74\x53\x63\x72\x6F\x6C\x6C\x61\x62\x6C\x65","\x73\x65\x74\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x73\x65\x74\x43\x6C\x6F\x73\x61\x62\x6C\x65","\x64\x65\x73\x74\x72\x6F\x79\x4F\x6E\x43\x6C\x6F\x73\x65","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x70\x78","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x39\x32\x70\x78","\x77\x72\x69\x74\x65\x6C\x6E","\x62\x75\x74\x74\x6F\x6E","\x63\x6C\x69\x63\x6B","\x69\x73\x56\x69\x73\x69\x62\x6C\x65","\x73\x65\x74\x56\x69\x73\x69\x62\x6C\x65","\x69\x6E\x69\x74","\x45\x6E\x74\x65\x72\x69\x6E\x67\x20","\x67\x65\x74\x54\x69\x6D\x65","\x20\x28","\x20\x6D\x73\x29","\x4C\x65\x61\x76\x69\x6E\x67\x20","\x44\x45\x42\x55\x47","\x61\x70\x70\x6C\x79","\x57\x41\x52\x4E","\x20","\x50\x72\x65\x73\x74\x6F\x2F\x32\x2E\x35","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x68\x69\x64\x64\x65\x6E","\x76\x69\x73\x69\x62\x6C\x65","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x73\x63\x72\x6F\x6C\x6C\x48\x65\x69\x67\x68\x74","\x0A","\x6D\x78\x4F\x62\x6A\x65\x63\x74\x49\x64","\x6F\x62\x6A\x65\x63\x74","\x46\x49\x45\x4C\x44\x5F\x4E\x41\x4D\x45","\x63\x6F\x6E\x73\x74\x72\x75\x63\x74\x6F\x72","\x67\x65\x74\x46\x75\x6E\x63\x74\x69\x6F\x6E\x4E\x61\x6D\x65","\x23","\x63\x6F\x75\x6E\x74\x65\x72","\x63\x6C\x65\x61\x72","\x6D\x61\x70","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x67\x65\x74","\x70\x75\x74","\x72\x65\x6D\x6F\x76\x65","\x67\x65\x74\x4B\x65\x79\x73","\x70\x75\x73\x68","\x67\x65\x74\x56\x61\x6C\x75\x65\x73","\x76\x69\x73\x69\x74","\x6C\x6F\x61\x64\x44\x65\x66\x61\x75\x6C\x74\x42\x75\x6E\x64\x6C\x65","\x69\x73\x4C\x61\x6E\x67\x75\x61\x67\x65\x53\x75\x70\x70\x6F\x72\x74\x65\x64","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2D","\x6C\x6F\x61\x64\x53\x70\x65\x63\x69\x61\x6C\x42\x75\x6E\x64\x6C\x65","\x5F","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x4E\x4F\x4E\x45","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x42\x75\x6E\x64\x6C\x65","\x6C\x6F\x61\x64","\x69\x73\x52\x65\x61\x64\x79","\x67\x65\x74\x54\x65\x78\x74","\x70\x61\x72\x73\x65","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x42\x75\x6E\x64\x6C\x65","\x73\x70\x6C\x69\x74","\x63\x68\x61\x72\x41\x74","\x3D","\x63\x68\x61\x72\x43\x6F\x64\x65\x41\x74","\x72\x65\x73\x6F\x75\x72\x63\x65\x73\x45\x6E\x63\x6F\x64\x65\x64","\x25","\x72\x65\x70\x6C\x61\x63\x65","\x72\x65\x73\x6F\x75\x72\x63\x65\x73","\x7B","\x7D","\x6A\x6F\x69\x6E","\x78","\x79","\x65\x71\x75\x61\x6C\x73","\x63\x6C\x6F\x6E\x65","\x63\x61\x6C\x6C","\x73\x65\x74\x52\x65\x63\x74","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x58","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x59","\x6D\x69\x6E","\x67\x72\x6F\x77","\x67\x65\x74\x50\x6F\x69\x6E\x74","\x63\x65\x6C\x6C","\x63\x68\x69\x6C\x64","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x69\x73\x45\x64\x67\x65","\x6D\x6F\x64\x65\x6C","\x6E\x6F\x64\x65","\x73\x68\x61\x70\x65","\x73\x65\x74\x4F\x70\x61\x63\x69\x74\x79","\x73\x63\x61\x6C\x65","\x67\x65\x6F\x6D\x65\x74\x72\x79","\x70\x72\x65\x76\x69\x6F\x75\x73","\x72\x65\x64\x72\x61\x77","\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x63\x61\x73\x63\x61\x64\x65\x4F\x70\x61\x63\x69\x74\x79","\x73\x65\x74\x54\x69\x6D\x65\x6F\x75\x74","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x67\x65\x74\x43\x68\x69\x6C\x64\x41\x74","\x67\x65\x74\x45\x64\x67\x65\x73","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x65\x72\x72\x6F\x72","\x63\x6C\x6F\x73\x65","\x2F\x65\x72\x72\x6F\x72\x2E\x67\x69\x66","\x63\x75\x72\x73\x6F\x72","\x63\x68\x69\x6C\x64\x4E\x6F\x64\x65\x73","\x72\x65\x6D\x6F\x76\x65\x43\x75\x72\x73\x6F\x72\x73","\x63\x75\x72\x72\x65\x6E\x74\x53\x74\x79\x6C\x65","\x67\x65\x74\x43\x6F\x6D\x70\x75\x74\x65\x64\x53\x74\x79\x6C\x65","\x67\x65\x74\x43\x75\x72\x72\x65\x6E\x74\x53\x74\x79\x6C\x65","\x73\x63\x72\x6F\x6C\x6C","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x61\x75\x74\x6F","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x76\x61\x72\x20\x5F\x6D\x78\x4A\x61\x76\x61\x53\x63\x72\x69\x70\x74\x45\x78\x70\x72\x65\x73\x73\x69\x6F\x6E\x3D","\x6D\x65\x73\x73\x61\x67\x65","\x20\x77\x68\x69\x6C\x65\x20\x65\x76\x61\x6C\x75\x61\x74\x69\x6E\x67\x20","\x77\x61\x72\x6E","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x66\x69\x6E\x64\x4E\x6F\x64\x65","\x6E\x65\x78\x74\x53\x69\x62\x6C\x69\x6E\x67","\x6E\x6F\x64\x65\x54\x79\x70\x65","\x4E\x4F\x44\x45\x54\x59\x50\x45\x5F\x45\x4C\x45\x4D\x45\x4E\x54","\x66\x69\x6E\x64\x4E\x6F\x64\x65\x42\x79\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x2F\x2F\x2A\x5B\x40","\x3D\x27","\x27\x5D","\x73\x65\x6C\x65\x63\x74\x53\x69\x6E\x67\x6C\x65\x4E\x6F\x64\x65","\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x69\x74\x65\x72\x61\x74\x65\x4E\x65\x78\x74","\x65\x76\x61\x6C\x75\x61\x74\x65","\x6E\x61\x6D\x65","\x28","\x73\x70\x6C\x69\x63\x65","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x69\x6D\x70\x6C\x65\x6D\x65\x6E\x74\x61\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x41\x63\x74\x69\x76\x65\x58\x4F\x62\x6A\x65\x63\x74","\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x58\x4D\x4C\x44\x4F\x4D","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x61\x73\x79\x6E\x63","\x66\x61\x6C\x73\x65","\x6C\x6F\x61\x64\x58\x4D\x4C","\x74\x65\x78\x74\x2F\x78\x6D\x6C","\x70\x61\x72\x73\x65\x46\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x65\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x72\x65\x6D\x6F\x76\x65\x41\x6C\x6C\x52\x61\x6E\x67\x65\x73","\x20\x20","\x4E\x4F\x44\x45\x54\x59\x50\x45\x5F\x54\x45\x58\x54","\x6E\x6F\x64\x65\x56\x61\x6C\x75\x65","\x3C","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x68\x74\x6D\x6C\x45\x6E\x74\x69\x74\x69\x65\x73","\x3D\x22","\x22","\x3E\x0A","\x67\x65\x74\x50\x72\x65\x74\x74\x79\x58\x6D\x6C","\x3C\x2F","\x2F\x3E\x0A","\x70\x72\x65\x76\x69\x6F\x75\x73\x53\x69\x62\x6C\x69\x6E\x67","\x67\x65\x74\x54\x65\x78\x74\x43\x6F\x6E\x74\x65\x6E\x74","\x74\x72\x69\x6D","\x26\x61\x6D\x70\x3B","\x26\x71\x75\x6F\x74\x3B","\x26\x23\x33\x39\x3B","\x26\x6C\x74\x3B","\x26\x67\x74\x3B","\x26\x23\x78\x61\x3B","\x74\x61\x67\x55\x72\x6E","\x78\x6D\x6C","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x73\x65\x72\x69\x61\x6C\x69\x7A\x65\x54\x6F\x53\x74\x72\x69\x6E\x67","\x3E","\x6F\x75\x74\x65\x72\x48\x54\x4D\x4C","\x2F\x3E","\x63\x72\x65\x61\x74\x65\x54\x65\x78\x74\x4E\x6F\x64\x65","\x62\x72","\x70","\x66\x69\x6C\x74\x65\x72","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x41\x6C\x70\x68\x61\x49\x6D\x61\x67\x65\x4C\x6F\x61\x64\x65\x72\x28\x73\x72\x63\x3D\x27","\x2F\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x2E\x67\x69\x66\x27\x2C\x20\x73\x69\x7A\x69\x6E\x67\x4D\x65\x74\x68\x6F\x64\x3D\x27\x73\x63\x61\x6C\x65\x27\x29","\x65\x78\x65\x63\x75\x74\x65","\x73\x70\x61\x6E","\x63\x6F\x6C\x6F\x72","\x62\x6C\x75\x65","\x74\x65\x78\x74\x44\x65\x63\x6F\x72\x61\x74\x69\x6F\x6E","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x70\x6F\x69\x6E\x74\x65\x72","\x70\x61\x64\x64\x69\x6E\x67\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x73\x63\x72\x6F\x6C\x6C\x4C\x65\x66\x74","\x6C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x55\x6E\x69\x76\x65\x72\x73\x61\x6C\x58\x50\x43\x6F\x6E\x6E\x65\x63\x74","\x65\x6E\x61\x62\x6C\x65\x50\x72\x69\x76\x69\x6C\x65\x67\x65","\x50\x72\x69\x76\x69\x6C\x65\x67\x65\x4D\x61\x6E\x61\x67\x65\x72","\x73\x65\x63\x75\x72\x69\x74\x79","\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x20\x74\x6F\x20\x72\x65\x61\x64\x20\x66\x69\x6C\x65\x20\x64\x65\x6E\x69\x65\x64\x2E","\x6E\x73\x49\x4C\x6F\x63\x61\x6C\x46\x69\x6C\x65","\x69\x6E\x74\x65\x72\x66\x61\x63\x65\x73","\x63\x72\x65\x61\x74\x65\x49\x6E\x73\x74\x61\x6E\x63\x65","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x66\x69\x6C\x65\x2F\x6C\x6F\x63\x61\x6C\x3B\x31","\x63\x6C\x61\x73\x73\x65\x73","\x69\x6E\x69\x74\x57\x69\x74\x68\x50\x61\x74\x68","\x65\x78\x69\x73\x74\x73","\x46\x69\x6C\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2E","\x6E\x73\x49\x46\x69\x6C\x65\x49\x6E\x70\x75\x74\x53\x74\x72\x65\x61\x6D","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x6E\x65\x74\x77\x6F\x72\x6B\x2F\x66\x69\x6C\x65\x2D\x69\x6E\x70\x75\x74\x2D\x73\x74\x72\x65\x61\x6D\x3B\x31","\x6E\x73\x49\x53\x63\x72\x69\x70\x74\x61\x62\x6C\x65\x49\x6E\x70\x75\x74\x53\x74\x72\x65\x61\x6D","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x73\x63\x72\x69\x70\x74\x61\x62\x6C\x65\x69\x6E\x70\x75\x74\x73\x74\x72\x65\x61\x6D\x3B\x31","\x61\x76\x61\x69\x6C\x61\x62\x6C\x65","\x72\x65\x61\x64","\x53\x63\x72\x69\x70\x74\x69\x6E\x67\x2E\x46\x69\x6C\x65\x53\x79\x73\x74\x65\x6D\x4F\x62\x6A\x65\x63\x74","\x72\x65\x61\x64\x41\x6C\x6C","\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x20\x74\x6F\x20\x77\x72\x69\x74\x65\x20\x66\x69\x6C\x65\x20\x64\x65\x6E\x69\x65\x64\x2E","\x63\x72\x65\x61\x74\x65","\x6E\x73\x49\x46\x69\x6C\x65\x4F\x75\x74\x70\x75\x74\x53\x74\x72\x65\x61\x6D","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x6E\x65\x74\x77\x6F\x72\x6B\x2F\x66\x69\x6C\x65\x2D\x6F\x75\x74\x70\x75\x74\x2D\x73\x74\x72\x65\x61\x6D\x3B\x31","\x66\x6C\x75\x73\x68","\x69\x66\x72\x61\x6D\x65","\x73\x72\x63","\x63\x6F\x6E\x74\x65\x6E\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x6F\x70\x65\x6E","\x66\x6F\x63\x75\x73","\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x20\x74\x6F\x20\x73\x61\x76\x65\x20\x64\x6F\x63\x75\x6D\x65\x6E\x74\x20\x64\x65\x6E\x69\x65\x64\x2E","\x64\x6F\x63\x75\x6D\x65\x6E\x74","\x63\x6F\x6E\x74\x65\x6E\x74\x57\x69\x6E\x64\x6F\x77","\x53\x61\x76\x65\x41\x73","\x65\x78\x65\x63\x43\x6F\x6D\x6D\x61\x6E\x64","\x63\x6C\x69\x70\x62\x6F\x61\x72\x64\x44\x61\x74\x61","\x54\x65\x78\x74","\x73\x65\x74\x44\x61\x74\x61","\x6E\x73\x49\x43\x6C\x69\x70\x62\x6F\x61\x72\x64","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x77\x69\x64\x67\x65\x74\x2F\x63\x6C\x69\x70\x62\x6F\x61\x72\x64\x3B\x31","\x6E\x73\x49\x54\x72\x61\x6E\x73\x66\x65\x72\x61\x62\x6C\x65","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x77\x69\x64\x67\x65\x74\x2F\x74\x72\x61\x6E\x73\x66\x65\x72\x61\x62\x6C\x65\x3B\x31","\x74\x65\x78\x74\x2F\x75\x6E\x69\x63\x6F\x64\x65","\x61\x64\x64\x44\x61\x74\x61\x46\x6C\x61\x76\x6F\x72","\x6E\x73\x49\x53\x75\x70\x70\x6F\x72\x74\x73\x53\x74\x72\x69\x6E\x67","\x40\x6D\x6F\x7A\x69\x6C\x6C\x61\x2E\x6F\x72\x67\x2F\x73\x75\x70\x70\x6F\x72\x74\x73\x2D\x73\x74\x72\x69\x6E\x67\x3B\x31","\x64\x61\x74\x61","\x73\x65\x74\x54\x72\x61\x6E\x73\x66\x65\x72\x44\x61\x74\x61","\x6B\x47\x6C\x6F\x62\x61\x6C\x43\x6C\x69\x70\x62\x6F\x61\x72\x64","\x47\x45\x54","\x73\x65\x6E\x64","\x73\x69\x6D\x75\x6C\x61\x74\x65","\x6F\x6E\x72\x65\x61\x64\x79\x73\x74\x61\x74\x65\x63\x68\x61\x6E\x67\x65","\x72\x65\x61\x64\x79\x53\x74\x61\x74\x65","\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72","\x20\x3D\x20\x5B\x6E\x75\x6C\x6C\x5D\x0A","\x20\x3D\x3E\x20\x5B\x46\x75\x6E\x63\x74\x69\x6F\x6E\x5D\x0A","\x20\x3D\x3E\x20\x5B","\x5D\x0A","\x20\x3D\x20","\x50\x49","\x61\x62\x73","\x63\x6F\x73","\x73\x69\x6E","\x73\x71\x72\x74","\x61\x74\x61\x6E\x32","\x63\x65\x69\x6C","\x74\x6F\x52\x61\x64\x69\x61\x6E\x73","\x67\x65\x74\x52\x6F\x74\x61\x74\x65\x64\x50\x6F\x69\x6E\x74","\x67\x65\x74\x56\x61\x6C\x75\x65","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x4E\x4F\x4E\x45","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x4E\x4F\x52\x54\x48","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x57\x45\x53\x54","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x53\x4F\x55\x54\x48","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x45\x41\x53\x54","\x61\x62\x73\x6F\x6C\x75\x74\x65\x50\x6F\x69\x6E\x74\x73","\x70\x74\x53\x65\x67\x44\x69\x73\x74\x53\x71","\x76\x69\x65\x77","\x63\x6F\x6E\x74\x61\x69\x6E\x73","\x6F\x66\x66\x73\x65\x74\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x53\x63\x72\x6F\x6C\x6C\x4F\x72\x69\x67\x69\x6E","\x67\x65\x74\x4F\x66\x66\x73\x65\x74","\x5E\x5B","\x5C\x73","\x5D\x2B","\x67","\x5B","\x5D\x2B\x24","\x72\x74\x72\x69\x6D","\x6C\x74\x72\x69\x6D","\x30\x78","\x30\x58","\x61\x6E\x69\x6D\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x73","\x66\x61\x64\x65\x4F\x75\x74","\x69\x73\x56\x6D\x6C","\x61\x6C\x70\x68\x61\x28\x6F\x70\x61\x63\x69\x74\x79\x3D","\x29","\x6F\x70\x61\x63\x69\x74\x79","\x43\x53\x53\x31\x43\x6F\x6D\x70\x61\x74","\x56\x4D\x4C\x5F\x50\x52\x45\x46\x49\x58","\x3A\x69\x6D\x61\x67\x65","\x62\x6F\x72\x64\x65\x72\x53\x74\x79\x6C\x65","\x69\x6D\x67","\x62\x6F\x72\x64\x65\x72","\x30","\x63\x6F\x6D\x70\x61\x72\x65","\x73\x6F\x72\x74","\x3B","\x69\x6E\x64\x65\x78\x4F\x66\x53\x74\x79\x6C\x65\x6E\x61\x6D\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x53\x74\x79\x6C\x65","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x73\x65\x74\x53\x74\x79\x6C\x65\x46\x6C\x61\x67","\x3D\x30","\x41\x4C\x49\x47\x4E\x5F\x43\x45\x4E\x54\x45\x52","\x41\x4C\x49\x47\x4E\x5F\x52\x49\x47\x48\x54","\x41\x4C\x49\x47\x4E\x5F\x4D\x49\x44\x44\x4C\x45","\x41\x4C\x49\x47\x4E\x5F\x42\x4F\x54\x54\x4F\x4D","\x44\x45\x46\x41\x55\x4C\x54\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x44\x45\x46\x41\x55\x4C\x54\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x64\x69\x76","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x72\x6F\x75\x6E\x64","\x6C\x69\x6E\x65\x48\x65\x69\x67\x68\x74","\x4C\x49\x4E\x45\x5F\x48\x45\x49\x47\x48\x54","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x6E\x6F\x77\x72\x61\x70","\x64\x69\x73\x70\x6C\x61\x79","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x69\x6E\x6C\x69\x6E\x65","\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B","\x7A\x6F\x6F\x6D","\x31","\x67\x65\x74\x52\x6F\x6F\x74","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x69\x73\x45\x76\x65\x6E\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x45\x76\x65\x6E\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x64\x72\x61\x77\x50\x61\x6E\x65","\x6F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74\x4E\x53","\x63\x61\x6E\x76\x61\x73","\x63\x6C\x6F\x6E\x65\x4E\x6F\x64\x65","\x67\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65","\x65\x6E\x63\x6F\x64\x65","\x64\x65\x73\x74\x72\x6F\x79","\x50\x41\x47\x45\x5F\x46\x4F\x52\x4D\x41\x54\x5F\x41\x34\x5F\x50\x4F\x52\x54\x52\x41\x49\x54","\x67\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x53\x63\x61\x6C\x65","\x66\x6C\x6F\x6F\x72","\x3C\x68\x74\x6D\x6C\x3E\x3C\x68\x65\x61\x64\x3E","\x62\x61\x73\x65","\x3C\x73\x74\x79\x6C\x65\x3E","\x73\x74\x79\x6C\x65\x53\x68\x65\x65\x74\x73","\x3C\x2F\x73\x74\x79\x6C\x65\x3E\x3C\x2F\x68\x65\x61\x64\x3E","\x3C\x62\x6F\x64\x79\x3E","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x3C\x2F\x62\x6F\x64\x79\x3E","\x3C\x68\x74\x6D\x6C\x3E","\x44\x49\x56","\x3C\x68\x74\x6D\x6C","\x3C\x68\x65\x61\x64\x3E","\x67\x65\x74\x4F\x75\x74\x65\x72\x48\x74\x6D\x6C","\x3C\x2F\x68\x65\x61\x64\x3E","\x3C\x2F\x68\x74\x6D\x6C\x3E","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x28","\x2C","\x6F\x77\x6E\x65\x72\x53\x56\x47\x45\x6C\x65\x6D\x65\x6E\x74","\x73\x68\x6F\x77","\x70\x72\x69\x6E\x74","\x36\x33\x36\x70\x78","\x34\x36\x30\x70\x78","\x70\x72\x65","\x26\x6E\x62\x73\x70\x3B","\x3C\x62\x72\x3E","\x50\x6F\x70\x75\x70\x20\x57\x69\x6E\x64\x6F\x77","\x3C\x70\x72\x65\x3E","\x3C\x2F\x70\x72\x65","\x70\x61\x64\x64\x69\x6E\x67","\x32\x30\x70\x78","\x65\x72\x72\x6F\x72\x49\x6D\x61\x67\x65","\x76\x61\x6C\x69\x67\x6E","\x62\x6F\x74\x74\x6F\x6D","\x6D\x69\x64\x64\x6C\x65","\xA0","\x65\x72\x72\x6F\x72\x52\x65\x73\x6F\x75\x72\x63\x65","\x66\x6C\x6F\x61\x74\x3A\x72\x69\x67\x68\x74","\x63\x6C\x6F\x73\x65\x52\x65\x73\x6F\x75\x72\x63\x65","\x64\x72\x61\x67\x4F\x66\x66\x73\x65\x74","\x54\x4F\x4F\x4C\x54\x49\x50\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x4F\x46\x46\x53\x45\x54","\x61\x75\x74\x6F\x73\x63\x72\x6F\x6C\x6C","\x73\x65\x74\x47\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x68\x69\x67\x68\x6C\x69\x67\x68\x74\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74\x73","\x67\x65\x74\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x67\x65\x74\x47\x72\x61\x70\x68\x46\x6F\x72\x45\x76\x65\x6E\x74","\x63\x72\x65\x61\x74\x65\x44\x72\x61\x67\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x72\x65\x61\x74\x65\x50\x72\x65\x76\x69\x65\x77\x45\x6C\x65\x6D\x65\x6E\x74","\x65\x78\x61\x63\x74","\x66\x61\x73\x74\x65\x72","\x66\x61\x73\x74\x65\x73\x74","\x73\x76\x67","\x76\x6D\x6C","\x6D\x69\x78\x65\x64\x48\x74\x6D\x6C","\x70\x72\x65\x66\x65\x72\x48\x74\x6D\x6C","\x73\x74\x72\x69\x63\x74\x48\x74\x6D\x6C","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x77\x33\x2E\x6F\x72\x67\x2F\x32\x30\x30\x30\x2F\x73\x76\x67","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x77\x33\x2E\x6F\x72\x67\x2F\x31\x39\x39\x39\x2F\x78\x68\x74\x6D\x6C","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x77\x33\x2E\x6F\x72\x67\x2F\x31\x39\x39\x39\x2F\x78\x6C\x69\x6E\x6B","\x67\x72\x61\x79","\x23\x30\x30\x46\x46\x30\x30","\x23\x46\x46\x30\x30\x30\x30","\x6D\x6F\x76\x65","\x64\x65\x66\x61\x75\x6C\x74","\x23\x30\x30\x30\x30\x46\x46","\x23\x30\x30\x39\x39\x46\x46","\x62\x6C\x61\x63\x6B","\x79\x65\x6C\x6C\x6F\x77","\x23\x30\x30\x46\x46\x46\x46","\x23\x30\x30\x33\x33\x46\x46","\x41\x72\x69\x61\x6C\x2C\x48\x65\x6C\x76\x65\x74\x69\x63\x61","\x70\x65\x72\x69\x6D\x65\x74\x65\x72","\x73\x6F\x75\x72\x63\x65\x50\x6F\x72\x74","\x74\x61\x72\x67\x65\x74\x50\x6F\x72\x74","\x70\x6F\x72\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x74\x65\x78\x74\x4F\x70\x61\x63\x69\x74\x79","\x6F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C","\x65\x78\x69\x74\x58","\x65\x78\x69\x74\x59","\x65\x78\x69\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x65\x6E\x74\x72\x79\x58","\x65\x6E\x74\x72\x79\x59","\x65\x6E\x74\x72\x79\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x66\x69\x6C\x6C\x43\x6F\x6C\x6F\x72","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x46\x69\x6C\x6C\x43\x6F\x6C\x6F\x72","\x67\x72\x61\x64\x69\x65\x6E\x74\x43\x6F\x6C\x6F\x72","\x67\x72\x61\x64\x69\x65\x6E\x74\x44\x69\x72\x65\x63\x74\x69\x6F\x6E","\x73\x74\x72\x6F\x6B\x65\x43\x6F\x6C\x6F\x72","\x73\x65\x70\x61\x72\x61\x74\x6F\x72\x43\x6F\x6C\x6F\x72","\x73\x74\x72\x6F\x6B\x65\x57\x69\x64\x74\x68","\x61\x6C\x69\x67\x6E","\x6C\x61\x62\x65\x6C\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x76\x65\x72\x74\x69\x63\x61\x6C\x4C\x61\x62\x65\x6C\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x69\x6D\x61\x67\x65\x41\x73\x70\x65\x63\x74","\x69\x6D\x61\x67\x65\x41\x6C\x69\x67\x6E","\x69\x6D\x61\x67\x65\x56\x65\x72\x74\x69\x63\x61\x6C\x41\x6C\x69\x67\x6E","\x67\x6C\x61\x73\x73","\x69\x6D\x61\x67\x65","\x69\x6D\x61\x67\x65\x57\x69\x64\x74\x68","\x69\x6D\x61\x67\x65\x48\x65\x69\x67\x68\x74","\x69\x6D\x61\x67\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x69\x6D\x61\x67\x65\x42\x6F\x72\x64\x65\x72","\x66\x6C\x69\x70\x48","\x66\x6C\x69\x70\x56","\x6E\x6F\x4C\x61\x62\x65\x6C","\x6E\x6F\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6C\x61\x62\x65\x6C\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x6C\x61\x62\x65\x6C\x42\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x6C\x61\x62\x65\x6C\x50\x61\x64\x64\x69\x6E\x67","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x53\x68\x61\x70\x65","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x49\x6D\x61\x67\x65","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x43\x6F\x6C\x6F\x72","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x53\x74\x72\x6F\x6B\x65\x43\x6F\x6C\x6F\x72","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x47\x72\x61\x64\x69\x65\x6E\x74\x43\x6F\x6C\x6F\x72","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x53\x70\x61\x63\x69\x6E\x67","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x57\x69\x64\x74\x68","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x48\x65\x69\x67\x68\x74","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x44\x69\x72\x65\x63\x74\x69\x6F\x6E","\x73\x68\x61\x64\x6F\x77","\x73\x65\x67\x6D\x65\x6E\x74","\x65\x6E\x64\x41\x72\x72\x6F\x77","\x73\x74\x61\x72\x74\x41\x72\x72\x6F\x77","\x65\x6E\x64\x53\x69\x7A\x65","\x73\x74\x61\x72\x74\x53\x69\x7A\x65","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x4C\x69\x6E\x65","\x65\x6E\x64\x46\x69\x6C\x6C","\x73\x74\x61\x72\x74\x46\x69\x6C\x6C","\x64\x61\x73\x68\x65\x64","\x64\x61\x73\x68\x50\x61\x74\x74\x65\x72\x6E","\x72\x6F\x75\x6E\x64\x65\x64","\x63\x75\x72\x76\x65\x64","\x61\x72\x63\x53\x69\x7A\x65","\x73\x6D\x6F\x6F\x74\x68","\x73\x6F\x75\x72\x63\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x53\x70\x61\x63\x69\x6E\x67","\x74\x61\x72\x67\x65\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x53\x70\x61\x63\x69\x6E\x67","\x70\x65\x72\x69\x6D\x65\x74\x65\x72\x53\x70\x61\x63\x69\x6E\x67","\x73\x70\x61\x63\x69\x6E\x67","\x73\x70\x61\x63\x69\x6E\x67\x54\x6F\x70","\x73\x70\x61\x63\x69\x6E\x67\x4C\x65\x66\x74","\x73\x70\x61\x63\x69\x6E\x67\x42\x6F\x74\x74\x6F\x6D","\x73\x70\x61\x63\x69\x6E\x67\x52\x69\x67\x68\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x64\x69\x72\x65\x63\x74\x69\x6F\x6E","\x65\x6C\x62\x6F\x77","\x66\x6F\x6E\x74\x43\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x53\x74\x79\x6C\x65","\x61\x75\x74\x6F\x73\x69\x7A\x65","\x66\x6F\x6C\x64\x61\x62\x6C\x65","\x65\x64\x69\x74\x61\x62\x6C\x65","\x62\x65\x6E\x64\x61\x62\x6C\x65","\x6D\x6F\x76\x61\x62\x6C\x65","\x72\x65\x73\x69\x7A\x61\x62\x6C\x65","\x63\x6C\x6F\x6E\x65\x61\x62\x6C\x65","\x64\x65\x6C\x65\x74\x61\x62\x6C\x65","\x65\x64\x67\x65\x53\x74\x79\x6C\x65","\x6C\x6F\x6F\x70\x53\x74\x79\x6C\x65","\x72\x6F\x75\x74\x69\x6E\x67\x43\x65\x6E\x74\x65\x72\x58","\x72\x6F\x75\x74\x69\x6E\x67\x43\x65\x6E\x74\x65\x72\x59","\x72\x65\x63\x74\x61\x6E\x67\x6C\x65","\x65\x6C\x6C\x69\x70\x73\x65","\x64\x6F\x75\x62\x6C\x65\x45\x6C\x6C\x69\x70\x73\x65","\x72\x68\x6F\x6D\x62\x75\x73","\x6C\x69\x6E\x65","\x61\x72\x72\x6F\x77","\x6C\x61\x62\x65\x6C","\x63\x79\x6C\x69\x6E\x64\x65\x72","\x73\x77\x69\x6D\x6C\x61\x6E\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72","\x61\x63\x74\x6F\x72","\x63\x6C\x6F\x75\x64","\x74\x72\x69\x61\x6E\x67\x6C\x65","\x68\x65\x78\x61\x67\x6F\x6E","\x63\x6C\x61\x73\x73\x69\x63","\x62\x6C\x6F\x63\x6B","\x6F\x76\x61\x6C","\x64\x69\x61\x6D\x6F\x6E\x64","\x64\x69\x61\x6D\x6F\x6E\x64\x54\x68\x69\x6E","\x63\x65\x6E\x74\x65\x72","\x72\x69\x67\x68\x74","\x6E\x6F\x72\x74\x68","\x73\x6F\x75\x74\x68","\x65\x61\x73\x74","\x77\x65\x73\x74","\x76\x65\x72\x74\x69\x63\x61\x6C","\x65\x6C\x62\x6F\x77\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x65\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6C\x6F\x6F\x70\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x73\x69\x64\x65\x54\x6F\x53\x69\x64\x65\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x74\x6F\x70\x54\x6F\x42\x6F\x74\x74\x6F\x6D\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x73\x65\x67\x6D\x65\x6E\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x65\x6C\x6C\x69\x70\x73\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x72\x65\x63\x74\x61\x6E\x67\x6C\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x72\x68\x6F\x6D\x62\x75\x73\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x74\x72\x69\x61\x6E\x67\x6C\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x70\x72\x6F\x70\x65\x72\x74\x69\x65\x73","\x63\x6F\x6E\x73\x75\x6D\x65\x64","\x67\x65\x74\x4E\x61\x6D\x65","\x67\x65\x74\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73","\x67\x65\x74\x50\x72\x6F\x70\x65\x72\x74\x79","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x63\x6F\x6E\x73\x75\x6D\x65","\x65\x76\x74","\x73\x74\x61\x74\x65","\x67\x72\x61\x70\x68\x58","\x67\x72\x61\x70\x68\x59","\x67\x65\x74\x45\x76\x65\x6E\x74","\x67\x65\x74\x53\x6F\x75\x72\x63\x65","\x69\x73\x53\x6F\x75\x72\x63\x65","\x67\x65\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x59","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x67\x65\x74\x47\x72\x61\x70\x68\x58","\x67\x65\x74\x47\x72\x61\x70\x68\x59","\x67\x65\x74\x43\x65\x6C\x6C","\x69\x73\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x72\x65\x74\x75\x72\x6E\x56\x61\x6C\x75\x65","\x73\x65\x74\x45\x76\x65\x6E\x74\x53\x6F\x75\x72\x63\x65","\x65\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x65\x76\x65\x6E\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x65\x76\x65\x6E\x74\x53\x6F\x75\x72\x63\x65","\x67\x65\x74\x45\x76\x65\x6E\x74\x53\x6F\x75\x72\x63\x65","\x72\x65\x6D\x6F\x76\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x6F\x6E","\x66","\x72\x65\x6D\x6F\x76\x65\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72","\x64\x65\x74\x61\x63\x68\x45\x76\x65\x6E\x74","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x6D\x6F\x75\x73\x65\x75\x70","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x74\x6F\x75\x63\x68\x73\x74\x61\x72\x74","\x74\x6F\x75\x63\x68\x6D\x6F\x76\x65","\x74\x6F\x75\x63\x68\x65\x6E\x64","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x64\x62\x6C\x63\x6C\x69\x63\x6B","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x72\x65\x6C\x65\x61\x73\x65","\x65\x76\x65\x6E\x74","\x64\x65\x74\x61\x69\x6C","\x77\x68\x65\x65\x6C\x44\x65\x6C\x74\x61","\x6D\x6F\x75\x73\x65\x77\x68\x65\x65\x6C","\x44\x4F\x4D\x4D\x6F\x75\x73\x65\x53\x63\x72\x6F\x6C\x6C","\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x6F\x6E\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x72\x65\x74\x75\x72\x6E\x20\x66\x61\x6C\x73\x65\x3B","\x73\x72\x63\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x61\x72\x67\x65\x74","\x69\x73\x52\x69\x67\x68\x74\x4D\x6F\x75\x73\x65\x42\x75\x74\x74\x6F\x6E","\x69\x73\x53\x68\x69\x66\x74\x44\x6F\x77\x6E","\x69\x73\x43\x6F\x6E\x74\x72\x6F\x6C\x44\x6F\x77\x6E","\x73\x68\x69\x66\x74\x4B\x65\x79","\x61\x6C\x74\x4B\x65\x79","\x63\x74\x72\x6C\x4B\x65\x79","\x6D\x65\x74\x61\x4B\x65\x79","\x74\x6F\x75\x63\x68\x65\x73","\x63\x68\x61\x6E\x67\x65\x64\x54\x6F\x75\x63\x68\x65\x73","\x63\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x4D\x61\x69\x6E\x45\x76\x65\x6E\x74","\x63\x6C\x69\x65\x6E\x74\x59","\x73\x74\x6F\x70\x50\x72\x6F\x70\x61\x67\x61\x74\x69\x6F\x6E","\x63\x61\x6E\x63\x65\x6C\x42\x75\x62\x62\x6C\x65","\x6D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x6D\x6F\x75\x73\x65\x4D\x6F\x76\x65","\x6D\x6F\x75\x73\x65\x55\x70","\x61\x63\x74\x69\x76\x61\x74\x65","\x72\x65\x73\x69\x7A\x65\x53\x74\x61\x72\x74","\x72\x65\x73\x69\x7A\x65\x45\x6E\x64","\x6D\x6F\x76\x65\x53\x74\x61\x72\x74","\x6D\x6F\x76\x65\x45\x6E\x64","\x70\x61\x6E\x53\x74\x61\x72\x74","\x70\x61\x6E","\x70\x61\x6E\x45\x6E\x64","\x6D\x69\x6E\x69\x6D\x69\x7A\x65","\x6E\x6F\x72\x6D\x61\x6C\x69\x7A\x65","\x6D\x61\x78\x69\x6D\x69\x7A\x65","\x68\x69\x64\x65","\x72\x65\x66\x72\x65\x73\x68","\x73\x69\x7A\x65","\x73\x65\x6C\x65\x63\x74","\x66\x69\x72\x65\x64","\x72\x65\x63\x65\x69\x76\x65","\x63\x6F\x6E\x6E\x65\x63\x74","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74","\x73\x75\x73\x70\x65\x6E\x64","\x72\x65\x73\x75\x6D\x65","\x6D\x61\x72\x6B","\x73\x65\x73\x73\x69\x6F\x6E","\x72\x6F\x6F\x74","\x70\x6F\x73\x74","\x73\x61\x76\x65","\x62\x65\x66\x6F\x72\x65\x41\x64\x64\x56\x65\x72\x74\x65\x78","\x61\x64\x64\x56\x65\x72\x74\x65\x78","\x61\x66\x74\x65\x72\x41\x64\x64\x56\x65\x72\x74\x65\x78","\x64\x6F\x6E\x65","\x65\x78\x65\x63\x75\x74\x65\x64","\x73\x74\x61\x72\x74\x45\x64\x69\x74","\x65\x6E\x64\x45\x64\x69\x74","\x62\x65\x66\x6F\x72\x65\x55\x6E\x64\x6F","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x68\x61\x6E\x67\x65","\x6E\x6F\x74\x69\x66\x79","\x6C\x61\x79\x6F\x75\x74\x43\x65\x6C\x6C\x73","\x73\x63\x61\x6C\x65\x41\x6E\x64\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x75\x70","\x64\x6F\x77\x6E","\x61\x64\x64\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x41\x64\x64\x65\x64","\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x4D\x6F\x76\x65\x64","\x72\x65\x73\x69\x7A\x65\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x52\x65\x73\x69\x7A\x65\x64","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x54\x6F\x67\x67\x6C\x65\x64","\x6F\x72\x64\x65\x72\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x4F\x72\x64\x65\x72\x65\x64","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x52\x65\x6D\x6F\x76\x65\x64","\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x75\x6E\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x66\x6F\x6C\x64\x43\x65\x6C\x6C\x73","\x63\x65\x6C\x6C\x73\x46\x6F\x6C\x64\x65\x64","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73","\x6C\x61\x62\x65\x6C\x43\x68\x61\x6E\x67\x65\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x43\x65\x6C\x6C","\x63\x65\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x73\x70\x6C\x69\x74\x45\x64\x67\x65","\x66\x6C\x69\x70\x45\x64\x67\x65","\x73\x74\x61\x72\x74\x45\x64\x69\x74\x69\x6E\x67","\x61\x64\x64\x4F\x76\x65\x72\x6C\x61\x79","\x72\x65\x6D\x6F\x76\x65\x4F\x76\x65\x72\x6C\x61\x79","\x75\x70\x64\x61\x74\x65\x43\x65\x6C\x6C\x53\x69\x7A\x65","\x65\x73\x63\x61\x70\x65","\x64\x6F\x75\x62\x6C\x65\x43\x6C\x69\x63\x6B","\x73\x74\x61\x72\x74","\x72\x65\x73\x65\x74","\x75\x72\x6C","\x70\x61\x72\x61\x6D\x73","\x6D\x65\x74\x68\x6F\x64","\x50\x4F\x53\x54","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x62\x69\x6E\x61\x72\x79","\x72\x65\x71\x75\x65\x73\x74","\x69\x73\x42\x69\x6E\x61\x72\x79","\x73\x65\x74\x42\x69\x6E\x61\x72\x79","\x72\x65\x73\x70\x6F\x6E\x73\x65\x54\x65\x78\x74","\x67\x65\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x74\x58\x6D\x6C","\x72\x65\x73\x70\x6F\x6E\x73\x65\x58\x4D\x4C","\x70\x61\x72\x73\x65\x58\x6D\x6C","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73","\x58\x4D\x4C\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x6F\x76\x65\x72\x72\x69\x64\x65\x4D\x69\x6D\x65\x54\x79\x70\x65","\x74\x65\x78\x74\x2F\x70\x6C\x61\x69\x6E\x3B\x20\x63\x68\x61\x72\x73\x65\x74\x3D\x78\x2D\x75\x73\x65\x72\x2D\x64\x65\x66\x69\x6E\x65\x64","\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x58\x4D\x4C\x48\x54\x54\x50","\x6F\x6E\x72\x65\x61\x64\x79\x73\x74\x61\x74\x65\x63\x68\x61\x61\x6E\x67\x65","\x62\x69\x6E\x64","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72\x73","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x78\x2D\x77\x77\x77\x2D\x66\x6F\x72\x6D\x2D\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72","\x6F\x6E\x62\x65\x66\x6F\x72\x65\x75\x6E\x6C\x6F\x61\x64","\x66\x6F\x72\x6D","\x61\x63\x74\x69\x6F\x6E","\x26","\x73\x75\x62\x6D\x69\x74","\x63\x65\x6C\x6C\x73","\x69\x6E\x73\x65\x72\x74\x43\x6F\x75\x6E\x74","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x67\x65\x74\x45\x78\x70\x6F\x72\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x63\x6C\x6F\x6E\x65\x43\x65\x6C\x6C\x73","\x67\x65\x74\x49\x6D\x70\x6F\x72\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x53\x54\x45\x50\x53\x49\x5A\x45","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x69\x6D\x70\x6F\x72\x74\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x63\x6F\x6E\x74\x65\x6E\x74","\x69\x6E\x73\x74\x61\x6C\x6C\x4D\x61\x78\x69\x6D\x69\x7A\x65\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x4D\x69\x6E\x69\x6D\x69\x7A\x65\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x43\x6C\x6F\x73\x65\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x4D\x69\x6E\x69\x6D\x69\x7A\x61\x62\x6C\x65","\x73\x65\x74\x54\x69\x74\x6C\x65","\x69\x6E\x73\x74\x61\x6C\x6C\x4D\x6F\x76\x65\x48\x61\x6E\x64\x6C\x65\x72","\x72\x65\x70\x6C\x61\x63\x65\x43\x68\x69\x6C\x64","\x63\x6C\x6F\x73\x65\x49\x6D\x61\x67\x65","\x2F\x63\x6C\x6F\x73\x65\x2E\x67\x69\x66","\x6D\x69\x6E\x69\x6D\x69\x7A\x65\x49\x6D\x61\x67\x65","\x2F\x6D\x69\x6E\x69\x6D\x69\x7A\x65\x2E\x67\x69\x66","\x6E\x6F\x72\x6D\x61\x6C\x69\x7A\x65\x49\x6D\x61\x67\x65","\x2F\x6E\x6F\x72\x6D\x61\x6C\x69\x7A\x65\x2E\x67\x69\x66","\x6D\x61\x78\x69\x6D\x69\x7A\x65\x49\x6D\x61\x67\x65","\x2F\x6D\x61\x78\x69\x6D\x69\x7A\x65\x2E\x67\x69\x66","\x72\x65\x73\x69\x7A\x65\x49\x6D\x61\x67\x65","\x2F\x72\x65\x73\x69\x7A\x65\x2E\x67\x69\x66","\x6D\x69\x6E\x69\x6D\x75\x6D\x53\x69\x7A\x65","\x74\x69\x74\x6C\x65","\x6D\x78\x57\x69\x6E\x64\x6F\x77","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x54\x69\x74\x6C\x65","\x50\x61\x6E\x65","\x63\x6F\x6E\x74\x65\x6E\x74\x57\x72\x61\x70\x70\x65\x72","\x61\x63\x74\x69\x76\x65\x57\x69\x6E\x64\x6F\x77","\x7A\x49\x6E\x64\x65\x78","\x70\x72\x65\x76\x69\x6F\x75\x73\x57\x69\x6E\x64\x6F\x77","\x66\x69\x74","\x69\x73\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x32\x70\x78","\x6E\x77\x2D\x72\x65\x73\x69\x7A\x65","\x73\x65\x74\x53\x69\x7A\x65","\x72\x65\x6D\x6F\x76\x65\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x67\x65\x74\x4D\x69\x6E\x69\x6D\x75\x6D\x53\x69\x7A\x65","\x4D\x69\x6E\x69\x6D\x69\x7A\x65","\x6D\x61\x72\x67\x69\x6E\x52\x69\x67\x68\x74","\x31\x70\x78","\x4E\x6F\x72\x6D\x61\x6C\x69\x7A\x65","\x4D\x61\x78\x69\x6D\x69\x7A\x65","\x6D\x61\x72\x67\x69\x6E\x4C\x65\x66\x74","\x30\x70\x78","\x73\x65\x74\x4C\x6F\x63\x61\x74\x69\x6F\x6E","\x63\x6C\x6F\x73\x65\x49\x6D\x67","\x43\x6C\x6F\x73\x65","\x69\x6E\x73\x65\x72\x74\x42\x65\x66\x6F\x72\x65","\x73\x65\x74\x49\x6D\x61\x67\x65","\x34\x70\x78","\x6D\x61\x72\x67\x69\x6E\x54\x6F\x70","\x2D\x32\x70\x78","\x67\x65\x74\x54\x61\x62\x6C\x65","\x61\x64\x64\x42\x75\x74\x74\x6F\x6E\x73","\x6F\x6B","\x4F\x4B","\x63\x61\x6E\x63\x65\x6C","\x43\x61\x6E\x63\x65\x6C","\x61\x64\x64\x54\x65\x78\x74","\x69\x6E\x70\x75\x74","\x74\x65\x78\x74","\x61\x64\x64\x46\x69\x65\x6C\x64","\x61\x64\x64\x43\x68\x65\x63\x6B\x62\x6F\x78","\x63\x68\x65\x63\x6B\x62\x6F\x78","\x63\x68\x65\x63\x6B\x65\x64","\x61\x64\x64\x54\x65\x78\x74\x61\x72\x65\x61","\x72\x6F\x77\x73","\x61\x64\x64\x43\x6F\x6D\x62\x6F","\x6D\x75\x6C\x74\x69\x70\x6C\x65","\x61\x64\x64\x4F\x70\x74\x69\x6F\x6E","\x6F\x70\x74\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x65\x64","\x72\x65\x73\x69\x7A\x65\x57\x69\x64\x74\x68","\x72\x65\x73\x69\x7A\x65\x48\x65\x69\x67\x68\x74","\x68\x61\x6E\x64\x6C\x69\x6E\x67\x52\x65\x73\x69\x7A\x65","\x67\x65\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74\x57\x69\x64\x74\x68","\x67\x65\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x65\x6C\x65\x6D\x65\x6E\x74","\x64\x72\x6F\x70\x48\x61\x6E\x64\x6C\x65\x72","\x64\x72\x61\x67\x45\x6C\x65\x6D\x65\x6E\x74","\x70\x72\x65\x76\x69\x65\x77\x45\x6C\x65\x6D\x65\x6E\x74","\x65\x6E\x61\x62\x6C\x65\x64","\x63\x75\x72\x72\x65\x6E\x74\x47\x72\x61\x70\x68","\x63\x75\x72\x72\x65\x6E\x74\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x63\x75\x72\x72\x65\x6E\x74\x50\x6F\x69\x6E\x74","\x63\x75\x72\x72\x65\x6E\x74\x47\x75\x69\x64\x65","\x63\x75\x72\x72\x65\x6E\x74\x48\x69\x67\x68\x6C\x69\x67\x68\x74","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x64\x72\x61\x67\x45\x6C\x65\x6D\x65\x6E\x74\x5A\x49\x6E\x64\x65\x78","\x64\x72\x61\x67\x45\x6C\x65\x6D\x65\x6E\x74\x4F\x70\x61\x63\x69\x74\x79","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x47\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x43\x65\x6C\x6C\x41\x74","\x6D\x6F\x75\x73\x65\x4D\x6F\x76\x65\x48\x61\x6E\x64\x6C\x65\x72","\x73\x74\x61\x72\x74\x44\x72\x61\x67","\x6D\x6F\x75\x73\x65\x55\x70\x48\x61\x6E\x64\x6C\x65\x72","\x73\x74\x6F\x70\x44\x72\x61\x67","\x67\x72\x61\x70\x68\x43\x6F\x6E\x74\x61\x69\x6E\x73\x45\x76\x65\x6E\x74","\x64\x72\x61\x67\x45\x78\x69\x74","\x64\x72\x61\x67\x45\x6E\x74\x65\x72","\x64\x72\x61\x67\x4F\x76\x65\x72","\x64\x72\x6F\x70","\x69\x73\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x67\x65\x74\x47\x75\x69\x64\x65\x53\x74\x61\x74\x65\x73","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x61\x75\x74\x6F\x53\x63\x72\x6F\x6C\x6C","\x61\x75\x74\x6F\x45\x78\x74\x65\x6E\x64","\x73\x63\x72\x6F\x6C\x6C\x50\x6F\x69\x6E\x74\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x69\x73\x44\x72\x6F\x70\x45\x6E\x61\x62\x6C\x65\x64","\x68\x69\x67\x68\x6C\x69\x67\x68\x74","\x33","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64\x45\x76\x65\x6E\x74","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x72\x69\x64\x53\x69\x7A\x65","\x73\x6E\x61\x70","\x70\x72\x65\x76\x69\x65\x77\x4F\x66\x66\x73\x65\x74","\x6E\x6F\x52\x65\x73\x65\x74","\x75\x70\x64\x61\x74\x65\x44\x65\x66\x61\x75\x6C\x74\x4D\x6F\x64\x65","\x61\x64\x64\x49\x74\x65\x6D","\x6D\x78\x54\x6F\x6F\x6C\x62\x61\x72\x4D\x6F\x64\x65","\x6D\x78\x54\x6F\x6F\x6C\x62\x61\x72\x49\x74\x65\x6D","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x6D\x65\x6E\x75","\x63\x75\x72\x72\x65\x6E\x74\x49\x6D\x67","\x69\x73\x4D\x65\x6E\x75\x53\x68\x6F\x77\x69\x6E\x67","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x66\x61\x63\x74\x6F\x72\x79\x4D\x65\x74\x68\x6F\x64","\x53\x65\x6C\x65\x63\x74\x65\x64","\x6D\x6F\x75\x73\x65\x6F\x75\x74","\x6D\x78\x54\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6D\x62\x6F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6D\x78\x54\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6D\x62\x6F","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E\x43\x6F\x6D\x62\x6F","\x73\x65\x6C\x65\x63\x74\x65\x64\x49\x6E\x64\x65\x78","\x6F\x70\x74\x69\x6F\x6E\x73","\x66\x75\x6E\x63\x74","\x61\x64\x64\x53\x77\x69\x74\x63\x68\x4D\x6F\x64\x65","\x69\x6E\x69\x74\x69\x61\x6C\x43\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x61\x6C\x74\x49\x63\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x65\x64\x4D\x6F\x64\x65","\x64\x65\x66\x61\x75\x6C\x74\x4D\x6F\x64\x65","\x73\x65\x6C\x65\x63\x74\x4D\x6F\x64\x65","\x61\x64\x64\x4D\x6F\x64\x65","\x64\x65\x66\x61\x75\x6C\x74\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x72\x65\x73\x65\x74\x4D\x6F\x64\x65","\x61\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x61\x64\x64\x42\x72\x65\x61\x6B","\x61\x64\x64\x4C\x69\x6E\x65","\x68\x72","\x36\x70\x78","\x75\x72\x6C\x49\x6E\x69\x74","\x75\x72\x6C\x50\x6F\x6C\x6C","\x75\x72\x6C\x4E\x6F\x74\x69\x66\x79","\x63\x6F\x64\x65\x63","\x6C\x6F\x6F\x6B\x75\x70","\x65\x64\x69\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x73\x75\x73\x70\x65\x6E\x64\x65\x64","\x3C\x65\x64\x69\x74\x3E","\x63\x68\x61\x6E\x67\x65\x73","\x75\x6E\x64\x6F\x6E\x65","\x65\x6E\x63\x6F\x64\x65\x43\x68\x61\x6E\x67\x65\x73","\x3C\x2F\x65\x64\x69\x74\x3E","\x6C\x69\x6E\x65\x66\x65\x65\x64","\x65\x73\x63\x61\x70\x65\x50\x6F\x73\x74\x44\x61\x74\x61","\x73\x69\x67\x6E\x69\x66\x69\x63\x61\x6E\x74\x52\x65\x6D\x6F\x74\x65\x43\x68\x61\x6E\x67\x65\x73","\x73\x65\x6E\x74","\x72\x65\x63\x65\x69\x76\x65\x64","\x70\x6F\x6C\x6C\x69\x6E\x67","\x70\x6F\x6C\x6C","\x73\x74\x6F\x70","\x72\x65\x61\x73\x6F\x6E","\x6D\x78\x53\x65\x73\x73\x69\x6F\x6E\x2E\x6E\x6F\x74\x69\x66\x79\x3A\x20","\x20\x78\x6D\x6C\x3D","\x3C\x6D\x65\x73\x73\x61\x67\x65\x3E\x3C\x64\x65\x6C\x74\x61\x3E","\x3C\x2F\x64\x65\x6C\x74\x61\x3E\x3C\x2F\x6D\x65\x73\x73\x61\x67\x65\x3E","\x78\x6D\x6C\x3D","\x69\x73\x56\x61\x6C\x69\x64\x52\x65\x73\x70\x6F\x6E\x73\x65","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x73\x70\x6F\x6E\x73\x65\x3A\x20","\x52\x65\x73\x70\x6F\x6E\x73\x65\x20\x6E\x6F\x74\x20\x72\x65\x61\x64\x79","\x54\x72\x61\x6E\x73\x6D\x69\x73\x73\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x3C\x3F\x70\x68\x70","\x6E\x61\x6D\x65\x73\x70\x61\x63\x65","\x70\x72\x65\x66\x69\x78","\x70\x72\x6F\x63\x65\x73\x73\x53\x74\x61\x74\x65","\x64\x65\x6C\x74\x61","\x70\x72\x6F\x63\x65\x73\x73\x44\x65\x6C\x74\x61","\x64\x65\x63\x6F\x64\x65","\x70\x72\x6F\x63\x65\x73\x73\x45\x64\x69\x74","\x64\x65\x63\x6F\x64\x65\x43\x68\x61\x6E\x67\x65\x73","\x63\x72\x65\x61\x74\x65\x55\x6E\x64\x6F\x61\x62\x6C\x65\x45\x64\x69\x74","\x73\x6F\x75\x72\x63\x65","\x64\x65\x63\x6F\x64\x65\x43\x68\x61\x6E\x67\x65","\x6D\x78\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x6D\x78\x43\x68\x69\x6C\x64\x43\x68\x61\x6E\x67\x65","\x70\x61\x72\x65\x6E\x74","\x63\x65\x6C\x6C\x52\x65\x6D\x6F\x76\x65\x64","\x67\x65\x74\x49\x64","\x70\x75\x74\x4F\x62\x6A\x65\x63\x74","\x73\x69\x67\x6E\x69\x66\x69\x63\x61\x6E\x74","\x72\x65\x64\x6F\x6E\x65","\x69\x73\x45\x6D\x70\x74\x79","\x69\x73\x53\x69\x67\x6E\x69\x66\x69\x63\x61\x6E\x74","\x64\x69\x65","\x68\x69\x73\x74\x6F\x72\x79","\x69\x6E\x64\x65\x78\x4F\x66\x4E\x65\x78\x74\x41\x64\x64","\x63\x61\x6E\x55\x6E\x64\x6F","\x63\x61\x6E\x52\x65\x64\x6F","\x75\x6E\x64\x6F\x61\x62\x6C\x65\x45\x64\x69\x74\x48\x61\x70\x70\x65\x6E\x65\x64","\x73\x68\x69\x66\x74","\x64\x61\x74\x61\x3A\x69\x6D\x61\x67\x65","\x69\x73\x52\x65\x6C\x61\x74\x69\x76\x65\x55\x72\x6C","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x2F\x2F","\x68\x6F\x73\x74","\x70\x61\x74\x68\x6E\x61\x6D\x65","\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66","\x74\x68\x72\x65\x61\x64","\x61\x63\x74\x69\x76\x65","\x64\x79","\x64\x78","\x74\x30\x79","\x74\x30\x78","\x74\x64\x79","\x74\x64\x78","\x73\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x6D\x6F\x75\x73\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x61\x64\x64\x4D\x6F\x75\x73\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x68\x61\x73\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x70\x61\x6E\x47\x72\x61\x70\x68","\x70\x61\x6E\x44\x78","\x70\x61\x6E\x44\x79","\x67\x65\x74\x44\x78","\x67\x65\x74\x44\x79","\x64\x65\x6C\x61\x79","\x73\x65\x74\x49\x6E\x74\x65\x72\x76\x61\x6C","\x69\x73\x41\x63\x74\x69\x76\x65","\x70\x61\x6E\x54\x6F","\x68\x61\x6E\x64\x6C\x65\x4D\x6F\x75\x73\x65\x4F\x75\x74","\x64\x61\x6D\x70\x65\x72","\x63\x6C\x65\x61\x72\x49\x6E\x74\x65\x72\x76\x61\x6C","\x73\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65\x4D\x6F\x75\x73\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x73\x75\x62\x6D\x65\x6E\x75\x49\x6D\x61\x67\x65","\x2F\x73\x75\x62\x6D\x65\x6E\x75\x2E\x67\x69\x66","\x75\x73\x65\x4C\x65\x66\x74\x42\x75\x74\x74\x6F\x6E\x46\x6F\x72\x50\x6F\x70\x75\x70","\x69\x74\x65\x6D\x43\x6F\x75\x6E\x74","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x73\x6D\x61\x72\x74\x53\x65\x70\x61\x72\x61\x74\x6F\x72\x73","\x6C\x61\x62\x65\x6C\x73","\x6D\x78\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x64\x69\x73\x61\x62\x6C\x65\x43\x6F\x6E\x74\x65\x78\x74\x4D\x65\x6E\x75","\x69\x73\x4C\x65\x66\x74\x4D\x6F\x75\x73\x65\x42\x75\x74\x74\x6F\x6E","\x77\x69\x6C\x6C\x41\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x63\x6F\x6E\x74\x61\x69\x6E\x73\x49\x74\x65\x6D\x73","\x6D\x78\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75\x49\x74\x65\x6D","\x6D\x78\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75\x49\x63\x6F\x6E","\x20\x64\x69\x73\x61\x62\x6C\x65\x64","\x70\x61\x64\x64\x69\x6E\x67\x52\x69\x67\x68\x74","\x74\x65\x78\x74\x41\x6C\x69\x67\x6E","\x63\x72\x65\x61\x74\x65\x53\x75\x62\x6D\x65\x6E\x75","\x65\x76\x65\x6E\x74\x52\x65\x63\x65\x69\x76\x65\x72","\x61\x63\x74\x69\x76\x65\x52\x6F\x77","\x68\x69\x64\x65\x53\x75\x62\x6D\x65\x6E\x75","\x73\x68\x6F\x77\x53\x75\x62\x6D\x65\x6E\x75","\x6D\x78\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75\x49\x74\x65\x6D\x48\x6F\x76\x65\x72","\x30\x20\x30\x20\x30\x20\x30\x70\x78","\x63\x6F\x6C\x53\x70\x61\x6E","\x32","\x73\x68\x6F\x77\x4D\x65\x6E\x75","\x63\x68\x61\x6E\x67\x65\x48\x61\x6E\x64\x6C\x65\x72","\x67\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C\x43\x68\x61\x6E\x67\x65\x64","\x73\x65\x74\x47\x72\x61\x70\x68","\x67\x72\x61\x70\x68","\x61\x75\x74\x6F\x53\x61\x76\x65\x44\x65\x6C\x61\x79","\x61\x75\x74\x6F\x53\x61\x76\x65\x54\x68\x72\x6F\x74\x74\x6C\x65","\x61\x75\x74\x6F\x53\x61\x76\x65\x54\x68\x72\x65\x73\x68\x6F\x6C\x64","\x69\x67\x6E\x6F\x72\x65\x64\x43\x68\x61\x6E\x67\x65\x73","\x6C\x61\x73\x74\x53\x6E\x61\x70\x73\x68\x6F\x74","\x73\x74\x61\x72\x74\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x73\x74\x6F\x70\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x73\x74\x65\x70\x73","\x65\x61\x73\x65","\x73\x74\x65\x70","\x61\x6E\x69\x6D\x61\x74\x65\x43\x65\x6C\x6C","\x67\x65\x74\x44\x65\x6C\x74\x61","\x69\x73\x56\x65\x72\x74\x65\x78","\x6D\x6F\x76\x65\x53\x74\x61\x74\x65","\x73\x74\x6F\x70\x52\x65\x63\x75\x72\x73\x69\x6F\x6E","\x67\x65\x74\x4F\x72\x69\x67\x69\x6E\x46\x6F\x72\x43\x65\x6C\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x43\x65\x6C\x6C\x47\x65\x6F\x6D\x65\x74\x72\x79","\x69\x6D\x61\x67\x65\x73","\x61\x6C\x74","\x70\x75\x74\x49\x6D\x61\x67\x65","\x67\x65\x74\x49\x6D\x61\x67\x65","\x66\x61\x6C\x6C\x62\x61\x63\x6B","\x69\x6E\x63\x6C\x75\x64\x65\x4F\x76\x65\x72\x6C\x61\x79\x73","\x64\x72\x61\x77\x53\x74\x61\x74\x65","\x64\x72\x61\x77\x43\x65\x6C\x6C\x53\x74\x61\x74\x65","\x76\x69\x73\x69\x74\x53\x74\x61\x74\x65\x73\x52\x65\x63\x75\x72\x73\x69\x76\x65","\x64\x72\x61\x77\x4F\x76\x65\x72\x6C\x61\x79\x73","\x70\x61\x69\x6E\x74","\x72\x65\x73\x74\x6F\x72\x65","\x6F\x76\x65\x72\x6C\x61\x79\x73","\x63\x6F\x6E\x76\x65\x72\x74\x65\x72","\x63\x72\x65\x61\x74\x65\x55\x72\x6C\x43\x6F\x6E\x76\x65\x72\x74\x65\x72","\x73\x74\x61\x74\x65\x73","\x70\x61\x74\x68","\x72\x6F\x74\x61\x74\x65\x48\x74\x6D\x6C","\x6C\x61\x73\x74\x58","\x6C\x61\x73\x74\x59","\x6D\x6F\x76\x65\x4F\x70","\x4D","\x6C\x69\x6E\x65\x4F\x70","\x4C","\x71\x75\x61\x64\x4F\x70","\x51","\x63\x75\x72\x76\x65\x4F\x70","\x43","\x63\x6C\x6F\x73\x65\x4F\x70","\x5A","\x70\x6F\x69\x6E\x74\x65\x72\x45\x76\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65\x53\x74\x61\x74\x65","\x33\x20\x33","\x66\x6C\x61\x74","\x6D\x69\x74\x65\x72","\x23\x30\x30\x30\x30\x30\x30","\x53\x48\x41\x44\x4F\x57\x43\x4F\x4C\x4F\x52","\x53\x48\x41\x44\x4F\x57\x5F\x4F\x50\x41\x43\x49\x54\x59","\x53\x48\x41\x44\x4F\x57\x5F\x4F\x46\x46\x53\x45\x54\x5F\x58","\x53\x48\x41\x44\x4F\x57\x5F\x4F\x46\x46\x53\x45\x54\x5F\x59","\x66\x6F\x72\x6D\x61\x74","\x61\x64\x64\x4F\x70","\x72\x6F\x74\x61\x74\x65\x50\x6F\x69\x6E\x74","\x70\x6F\x70","\x73\x65\x74\x41\x6C\x70\x68\x61","\x61\x6C\x70\x68\x61","\x73\x65\x74\x46\x69\x6C\x6C\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x47\x72\x61\x64\x69\x65\x6E\x74","\x66\x69\x6C\x6C\x41\x6C\x70\x68\x61","\x67\x72\x61\x64\x69\x65\x6E\x74\x41\x6C\x70\x68\x61","\x73\x65\x74\x53\x74\x72\x6F\x6B\x65\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x53\x74\x72\x6F\x6B\x65\x57\x69\x64\x74\x68","\x73\x65\x74\x44\x61\x73\x68\x65\x64","\x73\x65\x74\x44\x61\x73\x68\x50\x61\x74\x74\x65\x72\x6E","\x73\x65\x74\x4C\x69\x6E\x65\x43\x61\x70","\x6C\x69\x6E\x65\x43\x61\x70","\x73\x65\x74\x4C\x69\x6E\x65\x4A\x6F\x69\x6E","\x6C\x69\x6E\x65\x4A\x6F\x69\x6E","\x73\x65\x74\x4D\x69\x74\x65\x72\x4C\x69\x6D\x69\x74","\x6D\x69\x74\x65\x72\x4C\x69\x6D\x69\x74","\x73\x65\x74\x46\x6F\x6E\x74\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x46\x6F\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x46\x6F\x6E\x74\x42\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x42\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x46\x6F\x6E\x74\x53\x69\x7A\x65","\x73\x65\x74\x46\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x73\x65\x74\x46\x6F\x6E\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x53\x68\x61\x64\x6F\x77","\x73\x65\x74\x53\x68\x61\x64\x6F\x77\x43\x6F\x6C\x6F\x72","\x73\x68\x61\x64\x6F\x77\x43\x6F\x6C\x6F\x72","\x73\x65\x74\x53\x68\x61\x64\x6F\x77\x41\x6C\x70\x68\x61","\x73\x68\x61\x64\x6F\x77\x41\x6C\x70\x68\x61","\x73\x65\x74\x53\x68\x61\x64\x6F\x77\x4F\x66\x66\x73\x65\x74","\x73\x68\x61\x64\x6F\x77\x44\x78","\x73\x68\x61\x64\x6F\x77\x44\x79","\x62\x65\x67\x69\x6E","\x6D\x6F\x76\x65\x54\x6F","\x6C\x69\x6E\x65\x54\x6F","\x71\x75\x61\x64\x54\x6F","\x63\x75\x72\x76\x65\x54\x6F","\x61\x72\x63\x54\x6F","\x61\x72\x63\x54\x6F\x43\x75\x72\x76\x65\x73","\x65\x6E\x64","\x77\x72\x69\x74\x65\x44\x65\x66\x61\x75\x6C\x74\x73","\x65\x78\x74\x65\x6E\x64","\x74\x65\x78\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x6F\x6D\x70\x72\x65\x73\x73\x65\x64","\x66\x6F\x6E\x74\x66\x61\x6D\x69\x6C\x79","\x66\x61\x6D\x69\x6C\x79","\x66\x6F\x6E\x74\x73\x69\x7A\x65","\x73\x68\x61\x64\x6F\x77\x63\x6F\x6C\x6F\x72","\x73\x68\x61\x64\x6F\x77\x61\x6C\x70\x68\x61","\x73\x68\x61\x64\x6F\x77\x6F\x66\x66\x73\x65\x74","\x74\x6F\x46\x69\x78\x65\x64","\x72\x6F\x74\x61\x74\x65","\x74\x68\x65\x74\x61","\x63\x78","\x63\x79","\x66\x69\x6C\x6C\x63\x6F\x6C\x6F\x72","\x67\x72\x61\x64\x69\x65\x6E\x74","\x63\x31","\x63\x32","\x77","\x68","\x61\x6C\x70\x68\x61\x31","\x61\x6C\x70\x68\x61\x32","\x73\x74\x72\x6F\x6B\x65\x63\x6F\x6C\x6F\x72","\x73\x74\x72\x6F\x6B\x65\x77\x69\x64\x74\x68","\x64\x61\x73\x68\x70\x61\x74\x74\x65\x72\x6E","\x70\x61\x74\x74\x65\x72\x6E","\x6C\x69\x6E\x65\x63\x61\x70","\x63\x61\x70","\x6C\x69\x6E\x65\x6A\x6F\x69\x6E","\x6D\x69\x74\x65\x72\x6C\x69\x6D\x69\x74","\x6C\x69\x6D\x69\x74","\x66\x6F\x6E\x74\x63\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x63\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x62\x6F\x72\x64\x65\x72\x63\x6F\x6C\x6F\x72","\x66\x6F\x6E\x74\x73\x74\x79\x6C\x65","\x72\x65\x63\x74","\x72\x6F\x75\x6E\x64\x72\x65\x63\x74","\x63\x6F\x6E\x76\x65\x72\x74","\x61\x73\x70\x65\x63\x74","\x71\x75\x61\x64","\x78\x31","\x79\x31","\x78\x32","\x79\x32","\x63\x75\x72\x76\x65","\x78\x33","\x79\x33","\x69\x73\x4E\x6F\x64\x65","\x73\x74\x72","\x77\x72\x61\x70","\x66\x69\x6C\x6C","\x63\x6C\x69\x70","\x73\x74\x72\x6F\x6B\x65","\x66\x69\x6C\x6C\x41\x6E\x64\x53\x74\x72\x6F\x6B\x65","\x66\x69\x6C\x6C\x73\x74\x72\x6F\x6B\x65","\x67\x72\x61\x64\x69\x65\x6E\x74\x73","\x64\x65\x66\x73","\x73\x74\x79\x6C\x65\x45\x6E\x61\x62\x6C\x65\x64","\x63\x72\x65\x61\x74\x65\x53\x74\x79\x6C\x65","\x6D\x61\x74\x63\x68\x48\x74\x6D\x6C\x41\x6C\x69\x67\x6E\x6D\x65\x6E\x74","\x66\x6F\x45\x6E\x61\x62\x6C\x65\x64","\x73\x74\x72\x6F\x6B\x65\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x72\x65\x66\x43\x6F\x75\x6E\x74","\x62\x6C\x6F\x63\x6B\x49\x6D\x61\x67\x65\x50\x6F\x69\x6E\x74\x65\x72\x45\x76\x65\x6E\x74\x73","\x73\x76\x67\x7B\x66\x6F\x6E\x74\x2D\x66\x61\x6D\x69\x6C\x79\x3A","\x3B\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65\x3A","\x3B\x66\x69\x6C\x6C\x3A\x6E\x6F\x6E\x65\x3B\x73\x74\x72\x6F\x6B\x65\x2D\x6D\x69\x74\x65\x72\x6C\x69\x6D\x69\x74\x3A\x31\x30\x7D","\x4E\x53\x5F\x53\x56\x47","\x78\x6D\x6C\x6E\x73","\x63\x72\x65\x61\x74\x65\x47\x72\x61\x64\x69\x65\x6E\x74\x49\x64","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x53\x4F\x55\x54\x48","\x73","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x45\x41\x53\x54","\x65","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4E\x4F\x52\x54\x48","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x57\x45\x53\x54","\x6D\x78\x2D\x67\x72\x61\x64\x69\x65\x6E\x74\x2D","\x67\x65\x74\x53\x76\x67\x47\x72\x61\x64\x69\x65\x6E\x74","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x69\x64","\x63\x72\x65\x61\x74\x65\x53\x76\x67\x47\x72\x61\x64\x69\x65\x6E\x74","\x6C\x69\x6E\x65\x61\x72\x47\x72\x61\x64\x69\x65\x6E\x74","\x30\x25","\x3B\x73\x74\x6F\x70\x2D\x6F\x70\x61\x63\x69\x74\x79\x3A","\x6F\x66\x66\x73\x65\x74","\x73\x74\x6F\x70\x2D\x63\x6F\x6C\x6F\x72\x3A","\x61\x64\x64\x4E\x6F\x64\x65","\x64","\x75\x70\x64\x61\x74\x65\x46\x69\x6C\x6C","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74","\x75\x70\x64\x61\x74\x65\x53\x74\x72\x6F\x6B\x65","\x63\x72\x65\x61\x74\x65\x53\x68\x61\x64\x6F\x77","\x63\x72\x65\x61\x74\x65\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x70\x6F\x69\x6E\x74\x65\x72\x2D\x65\x76\x65\x6E\x74\x73","\x61\x6C\x6C","\x66\x69\x6C\x6C\x2D\x6F\x70\x61\x63\x69\x74\x79","\x75\x72\x6C\x28\x23","\x73\x74\x72\x6F\x6B\x65\x2D\x6F\x70\x61\x63\x69\x74\x79","\x73\x74\x72\x6F\x6B\x65\x2D\x77\x69\x64\x74\x68","\x75\x70\x64\x61\x74\x65\x53\x74\x72\x6F\x6B\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x73\x74\x72\x6F\x6B\x65\x2D\x64\x61\x73\x68\x61\x72\x72\x61\x79","\x63\x72\x65\x61\x74\x65\x44\x61\x73\x68\x50\x61\x74\x74\x65\x72\x6E","\x73\x74\x72\x6F\x6B\x65\x2D\x6C\x69\x6E\x65\x6A\x6F\x69\x6E","\x62\x75\x74\x74","\x73\x74\x72\x6F\x6B\x65\x2D\x6C\x69\x6E\x65\x63\x61\x70","\x73\x74\x72\x6F\x6B\x65\x2D\x6D\x69\x74\x65\x72\x6C\x69\x6D\x69\x74","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x77\x68\x69\x74\x65","\x29\x73\x63\x61\x6C\x65\x28","\x29\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x28","\x72\x6F\x74\x61\x74\x65\x28","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x43\x78","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x43\x79","\x72\x78","\x72\x79","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65\x4E\x53","\x78\x6C\x69\x6E\x6B\x3A\x68\x72\x65\x66","\x70\x72\x65\x73\x65\x72\x76\x65\x41\x73\x70\x65\x63\x74\x52\x61\x74\x69\x6F","\x73\x63\x61\x6C\x65\x28","\x70\x6F\x69\x6E\x74\x65\x72\x2D\x65\x76\x65\x6E\x74\x73\x3A\x6E\x6F\x6E\x65","\x63\x72\x65\x61\x74\x65\x44\x69\x76","\x64\x69\x73\x70\x6C\x61\x79\x3A\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B\x3B\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65\x3A","\x70\x78\x3B\x66\x6F\x6E\x74\x2D\x66\x61\x6D\x69\x6C\x79\x3A","\x3B\x63\x6F\x6C\x6F\x72\x3A","\x3B\x6C\x69\x6E\x65\x2D\x68\x65\x69\x67\x68\x74\x3A","\x70\x78\x3B","\x46\x4F\x4E\x54\x5F\x42\x4F\x4C\x44","\x66\x6F\x6E\x74\x2D\x77\x65\x69\x67\x68\x74\x3A\x62\x6F\x6C\x64\x3B","\x46\x4F\x4E\x54\x5F\x49\x54\x41\x4C\x49\x43","\x66\x6F\x6E\x74\x2D\x73\x74\x79\x6C\x65\x3A\x69\x74\x61\x6C\x69\x63\x3B","\x46\x4F\x4E\x54\x5F\x55\x4E\x44\x45\x52\x4C\x49\x4E\x45","\x66\x6F\x6E\x74\x2D\x64\x65\x63\x6F\x72\x61\x74\x69\x6F\x6E\x3A\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65\x3B","\x74\x65\x78\x74\x2D\x61\x6C\x69\x67\x6E\x3A\x63\x65\x6E\x74\x65\x72\x3B","\x74\x65\x78\x74\x2D\x61\x6C\x69\x67\x6E\x3A\x72\x69\x67\x68\x74\x3B","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x2D\x63\x6F\x6C\x6F\x72\x3A","\x62\x6F\x72\x64\x65\x72\x3A\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20","\x26\x61\x6D\x70\x3B\x67\x74\x3B","\x26\x61\x6D\x70\x3B\x6C\x74\x3B","\x3C\x64\x69\x76\x20\x78\x6D\x6C\x6E\x73\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x77\x33\x2E\x6F\x72\x67\x2F\x31\x39\x39\x39\x2F\x78\x68\x74\x6D\x6C\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x64\x69\x73\x70\x6C\x61\x79\x3A\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B\x3B","\x22\x3E","\x3C\x2F\x64\x69\x76\x3E","\x3C\x68\x72\x20\x2F\x3E","\x3C\x62\x72\x20\x2F\x3E","\x3C\x64\x69\x76\x20\x78\x6D\x6C\x6E\x73\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x77\x33\x2E\x6F\x72\x67\x2F\x31\x39\x39\x39\x2F\x78\x68\x74\x6D\x6C\x22\x20\x73\x74\x79\x6C\x65\x3D\x22","\x68\x74\x6D\x6C","\x76\x65\x72\x74\x69\x63\x61\x6C\x2D\x61\x6C\x69\x67\x6E\x3A\x74\x6F\x70\x3B","\x6F\x76\x65\x72\x66\x6C\x6F\x77\x3A\x68\x69\x64\x64\x65\x6E\x3B","\x6D\x61\x78\x2D\x68\x65\x69\x67\x68\x74\x3A","\x77\x69\x64\x74\x68\x3A","\x77\x68\x69\x74\x65\x2D\x73\x70\x61\x63\x65\x3A\x6E\x6F\x72\x6D\x61\x6C\x3B","\x77\x68\x69\x74\x65\x2D\x73\x70\x61\x63\x65\x3A\x6E\x6F\x77\x72\x61\x70\x3B","\x66\x6F\x72\x65\x69\x67\x6E\x4F\x62\x6A\x65\x63\x74","\x70\x6C\x61\x69\x6E\x54\x65\x78\x74","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x70","\x6D\x78\x2D\x63\x6C\x69\x70\x2D","\x63\x6C\x69\x70\x50\x61\x74\x68","\x63\x6C\x69\x70\x2D\x70\x61\x74\x68","\x75\x70\x64\x61\x74\x65\x46\x6F\x6E\x74","\x74\x65\x78\x74\x2D\x61\x6E\x63\x68\x6F\x72","\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65","\x61\x64\x64\x54\x65\x78\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x66\x6F\x6E\x74\x2D\x66\x61\x6D\x69\x6C\x79","\x66\x6F\x6E\x74\x2D\x77\x65\x69\x67\x68\x74","\x62\x6F\x6C\x64","\x66\x6F\x6E\x74\x2D\x73\x74\x79\x6C\x65","\x69\x74\x61\x6C\x69\x63","\x74\x65\x78\x74\x2D\x64\x65\x63\x6F\x72\x61\x74\x69\x6F\x6E","\x67\x65\x74\x42\x42\x6F\x78","\x66\x6F\x6E\x74\x57\x65\x69\x67\x68\x74","\x3C\x62\x72\x2F\x3E","\x6D\x6F\x64","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x28\x30\x2E\x35\x2C\x20\x30\x2E\x35\x29","\x6D","\x6C","\x63","\x72\x6F\x74\x61\x74\x65\x64\x48\x74\x6D\x6C\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x76\x6D\x6C\x53\x63\x61\x6C\x65","\x20\x65","\x63\x6F\x6F\x72\x64\x73\x69\x7A\x65","\x73\x74\x72\x6F\x6B\x65\x77\x65\x69\x67\x68\x74","\x73\x74\x72\x6F\x6B\x65\x64","\x63\x72\x65\x61\x74\x65\x53\x74\x72\x6F\x6B\x65","\x63\x72\x65\x61\x74\x65\x46\x69\x6C\x6C","\x63\x72\x65\x61\x74\x65\x54\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x46\x69\x6C\x6C","\x66\x69\x6C\x6C\x65\x64","\x3A\x66\x69\x6C\x6C","\x2F\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x2E\x67\x69\x66","\x74\x69\x6C\x65","\x63\x6F\x6C\x6F\x72\x32","\x66\x6C\x69\x70","\x61\x6E\x67\x6C\x65","\x4F\x46\x46\x49\x43\x45\x5F\x50\x52\x45\x46\x49\x58","\x3A\x6F\x70\x61\x63\x69\x74\x79\x32","\x3A\x73\x74\x72\x6F\x6B\x65","\x65\x6E\x64\x63\x61\x70","\x6A\x6F\x69\x6E\x73\x74\x79\x6C\x65","\x31\x30","\x64\x61\x73\x68\x73\x74\x79\x6C\x65","\x67\x65\x74\x56\x6D\x6C\x44\x61\x73\x68\x53\x74\x79\x6C\x65","\x64\x61\x73\x68","\x30\x20\x32","\x63\x72\x65\x61\x74\x65\x53\x68\x61\x64\x6F\x77\x53\x74\x72\x6F\x6B\x65","\x63\x72\x65\x61\x74\x65\x53\x68\x61\x64\x6F\x77\x46\x69\x6C\x6C","\x3A\x73\x68\x61\x70\x65","\x63\x20","\x63\x72\x65\x61\x74\x65\x52\x65\x63\x74","\x3A\x72\x65\x63\x74","\x3A\x72\x6F\x75\x6E\x64\x72\x65\x63\x74","\x61\x72\x63\x73\x69\x7A\x65","\x3A\x6F\x76\x61\x6C","\x61\x74\x6D\x6F\x73\x74","\x69\x67\x6E\x6F\x72\x65","\x66\x72\x61\x6D\x65","\x31\x38\x30","\x66\x6F\x6E\x74\x44\x65\x63\x6F\x72\x61\x74\x69\x6F\x6E","\x3A\x67\x72\x6F\x75\x70","\x72\x65\x6C\x61\x74\x69\x76\x65","\x67\x65\x74\x41\x6C\x69\x67\x6E\x6D\x65\x6E\x74\x41\x73\x50\x6F\x69\x6E\x74","\x6E\x6F\x72\x6D\x61\x6C","\x6D\x61\x78\x48\x65\x69\x67\x68\x74","\x67\x72\x6F\x75\x70","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x4D\x61\x74\x72\x69\x78\x28\x4D\x31\x31\x3D","\x2C\x20\x4D\x31\x32\x3D","\x2C\x20\x4D\x32\x31\x3D","\x2C\x20\x4D\x32\x32\x3D","\x2C\x20\x73\x69\x7A\x69\x6E\x67\x4D\x65\x74\x68\x6F\x64\x3D\x27\x61\x75\x74\x6F\x20\x65\x78\x70\x61\x6E\x64\x27\x29","\x3A\x70\x61\x74\x68","\x74\x65\x78\x74\x70\x61\x74\x68\x6F\x6B","\x6D\x20","\x20\x6C\x20","\x3A\x74\x65\x78\x74\x70\x61\x74\x68","\x76\x2D\x74\x65\x78\x74\x2D\x61\x6C\x69\x67\x6E\x3A","\x73\x74\x72\x69\x6E\x67","\x73\x65\x74\x53\x74\x61\x74\x65\x73","\x67\x75\x69\x64\x65\x58","\x67\x75\x69\x64\x65\x59","\x67\x65\x74\x47\x75\x69\x64\x65\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x63\x72\x65\x61\x74\x65\x47\x75\x69\x64\x65\x53\x68\x61\x70\x65","\x69\x73\x44\x61\x73\x68\x65\x64","\x44\x49\x41\x4C\x45\x43\x54\x5F\x56\x4D\x4C","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x70\x6F\x69\x6E\x74\x73","\x73\x63\x72\x6F\x6C\x6C\x57\x69\x64\x74\x68","\x64\x65\x73\x63","\x70\x61\x72\x73\x65\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x61\x72\x73\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x64\x65\x66\x61\x75\x6C\x74\x4C\x6F\x63\x61\x6C\x69\x7A\x65\x64","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x77\x30","\x68\x30","\x62\x67\x4E\x6F\x64\x65","\x66\x67\x4E\x6F\x64\x65","\x66\x6F\x72\x65\x67\x72\x6F\x75\x6E\x64","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x76\x61\x72\x69\x61\x62\x6C\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x73","\x67\x65\x74\x43\x68\x69\x6C\x64\x4E\x6F\x64\x65\x73","\x70\x61\x72\x73\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x65\x76\x61\x6C\x75\x61\x74\x65\x54\x65\x78\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x65\x76\x61\x6C\x75\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6C\x6F\x63\x61\x6C\x69\x7A\x65\x64","\x65\x76\x61\x6C","\x64\x72\x61\x77\x53\x68\x61\x70\x65","\x64\x72\x61\x77\x43\x68\x69\x6C\x64\x72\x65\x6E","\x63\x6F\x6D\x70\x75\x74\x65\x41\x73\x70\x65\x63\x74","\x69\x6E\x68\x65\x72\x69\x74","\x67\x65\x74\x4E\x75\x6D\x62\x65\x72","\x64\x72\x61\x77\x4E\x6F\x64\x65","\x66\x69\x78\x65\x64","\x61\x72\x63","\x78\x2D\x61\x78\x69\x73\x2D\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x6C\x61\x72\x67\x65\x2D\x61\x72\x63\x2D\x66\x6C\x61\x67","\x73\x77\x65\x65\x70\x2D\x66\x6C\x61\x67","\x52\x45\x43\x54\x41\x4E\x47\x4C\x45\x5F\x52\x4F\x55\x4E\x44\x49\x4E\x47\x5F\x46\x41\x43\x54\x4F\x52","\x61\x6C\x69\x67\x6E\x2D\x73\x68\x61\x70\x65","\x69\x6E\x63\x6C\x75\x64\x65\x2D\x73\x68\x61\x70\x65","\x67\x65\x74\x53\x74\x65\x6E\x63\x69\x6C","\x73\x74\x65\x6E\x63\x69\x6C","\x62\x6F\x75\x6E\x64\x73","\x62\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x73\x76\x67\x53\x74\x72\x6F\x6B\x65\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x73\x74\x65\x6E\x63\x69\x6C\x50\x6F\x69\x6E\x74\x65\x72\x45\x76\x65\x6E\x74\x73","\x69\x73\x50\x61\x72\x73\x65\x56\x6D\x6C","\x69\x73\x48\x74\x6D\x6C\x41\x6C\x6C\x6F\x77\x65\x64","\x67\x65\x74\x53\x76\x67\x53\x63\x72\x65\x65\x6E\x4F\x66\x66\x73\x65\x74","\x63\x72\x65\x61\x74\x65\x53\x76\x67","\x63\x72\x65\x61\x74\x65\x48\x74\x6D\x6C","\x63\x72\x65\x61\x74\x65\x56\x6D\x6C","\x72\x65\x63\x6F\x6E\x66\x69\x67\x75\x72\x65","\x75\x70\x64\x61\x74\x65\x42\x6F\x75\x6E\x64\x73\x46\x72\x6F\x6D\x50\x6F\x69\x6E\x74\x73","\x63\x68\x65\x63\x6B\x42\x6F\x75\x6E\x64\x73","\x72\x65\x64\x72\x61\x77\x48\x74\x6D\x6C\x53\x68\x61\x70\x65","\x72\x65\x64\x72\x61\x77\x53\x68\x61\x70\x65","\x75\x70\x64\x61\x74\x65\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x63\x72\x65\x61\x74\x65\x56\x6D\x6C\x47\x72\x6F\x75\x70","\x63\x72\x65\x61\x74\x65\x43\x61\x6E\x76\x61\x73","\x68\x61\x73\x43\x68\x69\x6C\x64\x4E\x6F\x64\x65\x73","\x6C\x61\x73\x74\x43\x68\x69\x6C\x64","\x62\x65\x66\x6F\x72\x65\x65\x6E\x64","\x69\x6E\x73\x65\x72\x74\x41\x64\x6A\x61\x63\x65\x6E\x74\x48\x54\x4D\x4C","\x61\x64\x64\x54\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x46\x69\x6C\x74\x65\x72","\x64\x65\x73\x74\x72\x6F\x79\x43\x61\x6E\x76\x61\x73","\x75\x70\x64\x61\x74\x65\x56\x6D\x6C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6D\x78\x52\x65\x66\x43\x6F\x75\x6E\x74","\x6F\x6C\x64\x47\x72\x61\x64\x69\x65\x6E\x74\x73","\x72\x65\x6C\x65\x61\x73\x65\x53\x76\x67\x47\x72\x61\x64\x69\x65\x6E\x74\x73","\x69\x73\x50\x61\x69\x6E\x74\x42\x6F\x75\x6E\x64\x73\x49\x6E\x76\x65\x72\x74\x65\x64","\x75\x70\x64\x61\x74\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x43\x61\x6E\x76\x61\x73","\x70\x61\x69\x6E\x74\x53\x74\x65\x6E\x63\x69\x6C\x53\x68\x61\x70\x65","\x70\x61\x69\x6E\x74\x45\x64\x67\x65\x53\x68\x61\x70\x65","\x70\x61\x69\x6E\x74\x56\x65\x72\x74\x65\x78\x53\x68\x61\x70\x65","\x69\x73\x53\x68\x61\x64\x6F\x77","\x67\x65\x74\x47\x72\x61\x64\x69\x65\x6E\x74\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x53\x68\x61\x70\x65\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x61\x64\x64\x54\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x63\x74\x61\x6E\x67\x6C\x65","\x73\x65\x74\x54\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x70\x61\x69\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x70\x61\x69\x6E\x74\x46\x6F\x72\x65\x67\x72\x6F\x75\x6E\x64","\x67\x65\x74\x41\x72\x63\x53\x69\x7A\x65","\x70\x61\x69\x6E\x74\x47\x6C\x61\x73\x73\x45\x66\x66\x65\x63\x74","\x23\x66\x66\x66\x66\x66\x66","\x69\x73\x52\x6F\x75\x6E\x64\x65\x64","\x73\x74\x65\x6E\x63\x69\x6C\x46\x6C\x69\x70\x48","\x73\x74\x65\x6E\x63\x69\x6C\x46\x6C\x69\x70\x56","\x73\x65\x74\x43\x75\x72\x73\x6F\x72","\x67\x65\x74\x43\x75\x72\x73\x6F\x72","\x63\x72\x65\x61\x74\x65\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x61\x75\x67\x6D\x65\x6E\x74\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x67\x65\x74\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x67\x65\x74\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x67\x65\x74\x54\x65\x78\x74\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x76\x65\x72\x74\x69\x63\x61\x6C\x54\x65\x78\x74\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28\x27","\x2F\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x2E\x67\x69\x66\x27\x29","\x73\x74\x65\x6E\x63\x69\x6C\x73","\x6D\x61\x72\x6B\x65\x72\x73","\x41\x52\x52\x4F\x57\x5F\x43\x4C\x41\x53\x53\x49\x43","\x41\x52\x52\x4F\x57\x5F\x44\x49\x41\x4D\x4F\x4E\x44","\x61\x64\x64\x4D\x61\x72\x6B\x65\x72","\x72\x65\x64\x72\x61\x77\x50\x61\x74\x68","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x42\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x46\x69\x6C\x74\x65\x72\x73","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x43\x6F\x6C\x6F\x72\x73","\x62\x6F\x72\x64\x65\x72\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x73\x6F\x6C\x69\x64","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x64\x72\x6F\x70\x53\x68\x61\x64\x6F\x77\x20\x28\x4F\x66\x66\x58\x3D\x27","\x27\x2C\x20\x4F\x66\x66\x59\x3D\x27","\x27\x2C\x20\x43\x6F\x6C\x6F\x72\x3D\x27","\x27\x29","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x67\x72\x61\x64\x69\x65\x6E\x74\x28\x73\x74\x61\x72\x74\x43\x6F\x6C\x6F\x72\x53\x74\x72\x3D\x27","\x27\x2C\x20\x65\x6E\x64\x43\x6F\x6C\x6F\x72\x53\x74\x72\x3D\x27","\x27\x2C\x20\x67\x72\x61\x64\x69\x65\x6E\x74\x54\x79\x70\x65\x3D\x27","\x70\x61\x69\x6E\x74\x4C\x69\x6E\x65","\x61\x72\x72\x6F\x77\x57\x69\x64\x74\x68","\x41\x52\x52\x4F\x57\x5F\x57\x49\x44\x54\x48","\x41\x52\x52\x4F\x57\x5F\x53\x50\x41\x43\x49\x4E\x47","\x41\x52\x52\x4F\x57\x5F\x53\x49\x5A\x45","\x44\x45\x46\x41\x55\x4C\x54\x5F\x46\x4F\x4E\x54\x53\x54\x59\x4C\x45","\x63\x6C\x69\x70\x70\x65\x64","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x54\x6F\x70","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x42\x6F\x74\x74\x6F\x6D","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x4C\x65\x66\x74","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x52\x69\x67\x68\x74","\x72\x65\x70\x6C\x61\x63\x65\x4C\x69\x6E\x65\x66\x65\x65\x64\x73","\x69\x67\x6E\x6F\x72\x65\x43\x6C\x69\x70\x70\x65\x64\x53\x74\x72\x69\x6E\x67\x53\x69\x7A\x65","\x69\x67\x6E\x6F\x72\x65\x53\x74\x72\x69\x6E\x67\x53\x69\x7A\x65","\x74\x65\x78\x74\x44\x69\x76","\x75\x70\x64\x61\x74\x65\x53\x69\x7A\x65","\x6D\x61\x72\x67\x69\x6E","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x54\x52\x49\x43\x54\x48\x54\x4D\x4C","\x75\x70\x64\x61\x74\x65\x56\x61\x6C\x75\x65","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x46\x69\x6C\x74\x65\x72","\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x4F\x72\x69\x67\x69\x6E","\x25\x20","\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x25\x2C","\x25\x29\x73\x63\x61\x6C\x65\x28","\x29\x20\x72\x6F\x74\x61\x74\x65\x28","\x64\x65\x67\x29","\x30\x25\x20\x30\x25","\x25\x29","\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20","\x3C\x64\x69\x76\x20\x73\x74\x79\x6C\x65\x3D\x22\x7A\x6F\x6F\x6D\x3A\x31\x3B","\x64\x69\x73\x70\x6C\x61\x79\x3A\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B\x3B\x5F\x64\x69\x73\x70\x6C\x61\x79\x3A\x69\x6E\x6C\x69\x6E\x65\x3B\x70\x61\x64\x64\x69\x6E\x67\x2D\x62\x6F\x74\x74\x6F\x6D\x3A\x31\x70\x78\x3B\x70\x61\x64\x64\x69\x6E\x67\x2D\x72\x69\x67\x68\x74\x3A\x31\x70\x78\x3B\x6C\x69\x6E\x65\x2D\x68\x65\x69\x67\x68\x74\x3A","\x75\x70\x64\x61\x74\x65\x4D\x61\x72\x67\x69\x6E","\x67\x65\x74\x53\x70\x61\x63\x69\x6E\x67","\x70\x72\x65\x73\x65\x72\x76\x65\x49\x6D\x61\x67\x65\x41\x73\x70\x65\x63\x74","\x69\x6D\x61\x67\x65\x46\x6C\x69\x70\x48","\x69\x6D\x61\x67\x65\x46\x6C\x69\x70\x56","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x42\x61\x73\x69\x63\x49\x6D\x61\x67\x65\x28\x72\x6F\x74\x61\x74\x69\x6F\x6E\x3D\x32\x29","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x42\x61\x73\x69\x63\x49\x6D\x61\x67\x65\x28\x6D\x69\x72\x72\x6F\x72\x3D\x31\x29","\x70\x72\x6F\x67\x69\x64\x3A\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x42\x61\x73\x69\x63\x49\x6D\x61\x67\x65\x28\x72\x6F\x74\x61\x74\x69\x6F\x6E\x3D\x32\x2C\x20\x6D\x69\x72\x72\x6F\x72\x3D\x31\x29","\x69\x6D\x61\x67\x65\x53\x69\x7A\x65","\x44\x45\x46\x41\x55\x4C\x54\x5F\x49\x4D\x41\x47\x45\x53\x49\x5A\x45","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72\x53\x69\x7A\x65","\x69\x6E\x64\x69\x63\x61\x74\x6F\x72","\x70\x61\x69\x6E\x74\x49\x6D\x61\x67\x65","\x70\x61\x69\x6E\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72","\x67\x65\x74\x49\x6D\x61\x67\x65\x42\x6F\x75\x6E\x64\x73","\x41\x4C\x49\x47\x4E\x5F\x54\x4F\x50","\x67\x65\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x42\x6F\x75\x6E\x64\x73","\x63\x72\x65\x61\x74\x65\x4D\x61\x72\x6B\x65\x72","\x53\x54\x59\x4C\x45\x5F\x43\x55\x52\x56\x45\x44","\x70\x61\x69\x6E\x74\x43\x75\x72\x76\x65\x64\x4C\x69\x6E\x65","\x53\x54\x59\x4C\x45\x5F\x53\x54\x41\x52\x54\x53\x49\x5A\x45","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x44\x53\x49\x5A\x45","\x53\x54\x59\x4C\x45\x5F\x53\x54\x41\x52\x54\x41\x52\x52\x4F\x57","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x44\x41\x52\x52\x4F\x57","\x53\x54\x59\x4C\x45\x5F\x53\x54\x41\x52\x54\x46\x49\x4C\x4C","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x44\x46\x49\x4C\x4C","\x70\x61\x69\x6E\x74\x52\x6F\x75\x6E\x64\x65\x64\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x70\x61\x69\x6E\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x70\x61\x69\x6E\x74\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x75\x73\x65\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78","\x6D\x6F\x76\x65\x43\x65\x6C\x6C","\x67\x65\x74\x47\x72\x61\x70\x68","\x67\x65\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x67\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x74\x72\x61\x76\x65\x72\x73\x65","\x67\x65\x74\x45\x64\x67\x65\x43\x6F\x75\x6E\x74","\x67\x65\x74\x45\x64\x67\x65\x41\x74","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x67\x65\x74\x56\x69\x73\x69\x62\x6C\x65\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x69\x73\x56\x65\x72\x74\x65\x78\x4D\x6F\x76\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x4D\x6F\x76\x61\x62\x6C\x65","\x69\x73\x56\x65\x72\x74\x65\x78\x49\x67\x6E\x6F\x72\x65\x64","\x69\x73\x43\x65\x6C\x6C\x56\x69\x73\x69\x62\x6C\x65","\x69\x73\x45\x64\x67\x65\x49\x67\x6E\x6F\x72\x65\x64","\x73\x65\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x73\x65\x74\x4F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C\x45\x64\x67\x65","\x67\x65\x74\x50\x61\x72\x65\x6E\x74\x4F\x66\x66\x73\x65\x74","\x69\x73\x41\x6E\x63\x65\x73\x74\x6F\x72","\x67\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x73\x65\x74\x45\x64\x67\x65\x50\x6F\x69\x6E\x74\x73","\x73\x65\x74\x52\x65\x6C\x61\x74\x69\x76\x65","\x73\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x73\x65\x74\x56\x65\x72\x74\x65\x78\x4C\x6F\x63\x61\x74\x69\x6F\x6E","\x67\x65\x74\x56\x65\x72\x74\x65\x78\x42\x6F\x75\x6E\x64\x73","\x61\x72\x72\x61\x6E\x67\x65\x47\x72\x6F\x75\x70\x73","\x67\x65\x74\x43\x68\x69\x6C\x64\x56\x65\x72\x74\x69\x63\x65\x73","\x67\x65\x74\x42\x6F\x75\x6E\x64\x69\x6E\x67\x42\x6F\x78\x46\x72\x6F\x6D\x47\x65\x6F\x6D\x65\x74\x72\x79","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x67\x65\x74\x53\x74\x61\x72\x74\x53\x69\x7A\x65","\x78\x30","\x79\x30","\x6B\x65\x65\x70\x46\x69\x72\x73\x74\x4C\x6F\x63\x61\x74\x69\x6F\x6E","\x72\x65\x73\x69\x7A\x65\x50\x61\x72\x65\x6E\x74","\x72\x65\x73\x69\x7A\x65\x4C\x61\x73\x74","\x69\x73\x48\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x67\x65\x74\x49\x6E\x64\x65\x78","\x67\x65\x74\x50\x61\x72\x65\x6E\x74\x53\x69\x7A\x65","\x69\x73\x4C\x61\x79\x65\x72","\x63\x75\x72\x72\x65\x6E\x74\x52\x6F\x6F\x74","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x72\x65\x73\x69\x7A\x65\x56\x65\x72\x74\x69\x63\x65\x73","\x69\x6E\x76\x65\x72\x74","\x67\x72\x6F\x75\x70\x50\x61\x64\x64\x69\x6E\x67","\x70\x61\x72\x65\x6E\x74\x73\x43\x68\x61\x6E\x67\x65\x64","\x6D\x6F\x76\x65\x54\x72\x65\x65","\x6C\x65\x76\x65\x6C\x44\x69\x73\x74\x61\x6E\x63\x65","\x6E\x6F\x64\x65\x44\x69\x73\x74\x61\x6E\x63\x65","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73","\x70\x72\x65\x66\x48\x6F\x7A\x45\x64\x67\x65\x53\x65\x70","\x70\x72\x65\x66\x56\x65\x72\x74\x45\x64\x67\x65\x4F\x66\x66","\x6D\x69\x6E\x45\x64\x67\x65\x4A\x65\x74\x74\x79","\x63\x68\x61\x6E\x6E\x65\x6C\x42\x75\x66\x66\x65\x72","\x65\x64\x67\x65\x52\x6F\x75\x74\x69\x6E\x67","\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x73","\x66\x69\x6E\x64\x54\x72\x65\x65\x52\x6F\x6F\x74\x73","\x64\x66\x73","\x6C\x61\x79\x6F\x75\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x4C\x61\x79\x6F\x75\x74","\x76\x65\x72\x74\x69\x63\x61\x6C\x4C\x61\x79\x6F\x75\x74","\x6D\x6F\x76\x65\x4E\x6F\x64\x65","\x61\x64\x6A\x75\x73\x74\x50\x61\x72\x65\x6E\x74\x73","\x6C\x6F\x63\x61\x6C\x45\x64\x67\x65\x50\x72\x6F\x63\x65\x73\x73\x69\x6E\x67","\x6E\x65\x78\x74","\x63\x72\x65\x61\x74\x65\x4E\x6F\x64\x65","\x61\x74\x74\x61\x63\x68\x50\x61\x72\x65\x6E\x74","\x6C\x61\x79\x6F\x75\x74\x4C\x65\x61\x66","\x6F\x66\x66\x73\x65\x74\x58","\x6F\x66\x66\x73\x65\x74\x59","\x75\x70\x70\x65\x72\x48\x65\x61\x64","\x63\x6F\x6E\x74\x6F\x75\x72","\x63\x72\x65\x61\x74\x65\x4C\x69\x6E\x65","\x6C\x6F\x77\x65\x72\x48\x65\x61\x64","\x75\x70\x70\x65\x72\x54\x61\x69\x6C","\x6C\x6F\x77\x65\x72\x54\x61\x69\x6C","\x6D\x65\x72\x67\x65","\x62\x72\x69\x64\x67\x65","\x73\x6F\x72\x74\x43\x65\x6C\x6C\x73","\x70\x72\x6F\x63\x65\x73\x73\x4E\x6F\x64\x65\x4F\x75\x74\x67\x6F\x69\x6E\x67","\x67\x65\x74\x45\x64\x67\x65\x73\x42\x65\x74\x77\x65\x65\x6E","\x77\x65\x69\x67\x68\x74\x65\x64\x56\x61\x6C\x75\x65","\x6E\x75\x64\x67\x65","\x76\x69\x73\x69\x74\x65\x64","\x72\x61\x6E\x6B\x49\x6E\x64\x65\x78","\x75\x73\x65\x49\x6E\x70\x75\x74\x4F\x72\x69\x67\x69\x6E","\x64\x69\x73\x61\x62\x6C\x65\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x66\x6F\x72\x63\x65\x43\x6F\x6E\x73\x74\x61\x6E\x74","\x66\x6F\x72\x63\x65\x43\x6F\x6E\x73\x74\x61\x6E\x74\x53\x71\x75\x61\x72\x65\x64","\x6D\x69\x6E\x44\x69\x73\x74\x61\x6E\x63\x65\x4C\x69\x6D\x69\x74","\x6D\x61\x78\x44\x69\x73\x74\x61\x6E\x63\x65\x4C\x69\x6D\x69\x74","\x6D\x69\x6E\x44\x69\x73\x74\x61\x6E\x63\x65\x4C\x69\x6D\x69\x74\x53\x71\x75\x61\x72\x65\x64","\x69\x6E\x69\x74\x69\x61\x6C\x54\x65\x6D\x70","\x74\x65\x6D\x70\x65\x72\x61\x74\x75\x72\x65","\x6D\x61\x78\x49\x74\x65\x72\x61\x74\x69\x6F\x6E\x73","\x69\x74\x65\x72\x61\x74\x69\x6F\x6E","\x61\x6C\x6C\x6F\x77\x65\x64\x54\x6F\x52\x75\x6E","\x76\x65\x72\x74\x65\x78\x41\x72\x72\x61\x79","\x67\x65\x74\x42\x6F\x75\x6E\x64\x73","\x69\x6E\x64\x69\x63\x65\x73","\x64\x69\x73\x70\x58","\x64\x69\x73\x70\x59","\x63\x65\x6C\x6C\x4C\x6F\x63\x61\x74\x69\x6F\x6E","\x69\x73\x4D\x6F\x76\x65\x61\x62\x6C\x65","\x6E\x65\x69\x67\x68\x62\x6F\x75\x72\x73","\x72\x61\x64\x69\x75\x73","\x72\x61\x64\x69\x75\x73\x53\x71\x75\x61\x72\x65\x64","\x67\x65\x74\x4F\x70\x70\x6F\x73\x69\x74\x65\x73","\x72\x65\x73\x65\x74\x45\x64\x67\x65","\x63\x61\x6C\x63\x52\x65\x70\x75\x6C\x73\x69\x6F\x6E","\x63\x61\x6C\x63\x41\x74\x74\x72\x61\x63\x74\x69\x6F\x6E","\x63\x61\x6C\x63\x50\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x72\x65\x64\x75\x63\x65\x54\x65\x6D\x70\x65\x72\x61\x74\x75\x72\x65","\x72\x61\x6E\x64\x6F\x6D","\x6D\x6F\x76\x65\x43\x69\x72\x63\x6C\x65","\x67\x65\x74\x52\x61\x64\x69\x75\x73","\x63\x69\x72\x63\x6C\x65","\x66\x69\x6E\x64\x50\x61\x72\x61\x6C\x6C\x65\x6C\x73","\x67\x65\x74\x45\x64\x67\x65\x49\x64","\x72\x6F\x75\x74\x65","\x6C\x61\x79\x6F\x75\x74\x73","\x6D\x61\x73\x74\x65\x72","\x70\x6C\x61\x63\x65\x4C\x61\x62\x65\x6C\x73","\x61\x76\x6F\x69\x64","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x73","\x74\x65\x6D\x70","\x6D\x61\x78\x52\x61\x6E\x6B","\x6D\x69\x6E\x52\x61\x6E\x6B","\x6E\x65\x78\x74\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x65\x6C\x6C\x73","\x70\x72\x65\x76\x69\x6F\x75\x73\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x4E\x65\x78\x74\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x50\x72\x65\x76\x69\x6F\x75\x73\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x47\x65\x6E\x65\x72\x61\x6C\x50\x75\x72\x70\x6F\x73\x65\x56\x61\x72\x69\x61\x62\x6C\x65","\x73\x65\x74\x47\x65\x6E\x65\x72\x61\x6C\x50\x75\x72\x70\x6F\x73\x65\x56\x61\x72\x69\x61\x62\x6C\x65","\x73\x65\x74\x58","\x73\x65\x74\x59","\x63\x6F\x6E\x6E\x65\x63\x74\x73\x41\x73\x54\x61\x72\x67\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x73\x41\x73\x53\x6F\x75\x72\x63\x65","\x68\x61\x73\x68\x43\x6F\x64\x65","\x67\x65\x74\x52\x61\x6E\x6B\x56\x61\x6C\x75\x65","\x67\x65\x74\x43\x6F\x72\x65\x43\x65\x6C\x6C","\x65\x64\x67\x65\x73","\x69\x73\x52\x65\x76\x65\x72\x73\x65\x64","\x74\x69\x67\x68\x74\x65\x6E\x54\x6F\x53\x6F\x75\x72\x63\x65","\x72\x6F\x6F\x74\x73","\x76\x65\x72\x74\x65\x78\x4D\x61\x70\x70\x65\x72","\x65\x64\x67\x65\x4D\x61\x70\x70\x65\x72","\x53\x4F\x55\x52\x43\x45\x53\x43\x41\x4E\x53\x54\x41\x52\x54\x52\x41\x4E\x4B","\x63\x72\x65\x61\x74\x65\x49\x6E\x74\x65\x72\x6E\x61\x6C\x43\x65\x6C\x6C\x73","\x72\x61\x6E\x6B\x73","\x64\x66\x73\x43\x6F\x75\x6E\x74","\x69\x6E\x69\x74\x69\x61\x6C\x52\x61\x6E\x6B","\x73\x6C\x69\x63\x65","\x66\x69\x78\x52\x61\x6E\x6B\x73","\x65\x78\x74\x65\x6E\x64\x65\x64\x44\x66\x73","\x6E\x65\x73\x74\x65\x64\x42\x65\x73\x74\x52\x61\x6E\x6B\x73","\x63\x75\x72\x72\x65\x6E\x74\x42\x65\x73\x74\x43\x72\x6F\x73\x73\x69\x6E\x67\x73","\x69\x74\x65\x72\x61\x74\x69\x6F\x6E\x73\x57\x69\x74\x68\x6F\x75\x74\x49\x6D\x70\x72\x6F\x76\x65\x6D\x65\x6E\x74","\x6D\x61\x78\x4E\x6F\x49\x6D\x70\x72\x6F\x76\x65\x6D\x65\x6E\x74\x49\x74\x65\x72\x61\x74\x69\x6F\x6E\x73","\x63\x61\x6C\x63\x75\x6C\x61\x74\x65\x43\x72\x6F\x73\x73\x69\x6E\x67\x73","\x77\x65\x69\x67\x68\x74\x65\x64\x4D\x65\x64\x69\x61\x6E","\x74\x72\x61\x6E\x73\x70\x6F\x73\x65","\x63\x61\x6C\x63\x75\x6C\x61\x74\x65\x52\x61\x6E\x6B\x43\x72\x6F\x73\x73\x69\x6E\x67","\x6D\x65\x64\x69\x61\x6E\x52\x61\x6E\x6B","\x6D\x65\x64\x69\x61\x6E\x56\x61\x6C\x75\x65","\x6C\x65\x6E\x74\x68","\x67\x65\x74\x49\x6E\x63\x6F\x6D\x69\x6E\x67\x45\x64\x67\x65\x73","\x69\x6E\x74\x72\x61\x43\x65\x6C\x6C\x53\x70\x61\x63\x69\x6E\x67","\x69\x6E\x74\x65\x72\x52\x61\x6E\x6B\x43\x65\x6C\x6C\x53\x70\x61\x63\x69\x6E\x67","\x6F\x72\x69\x65\x6E\x74\x61\x74\x69\x6F\x6E","\x69\x6E\x69\x74\x69\x61\x6C\x58","\x70\x61\x72\x61\x6C\x6C\x65\x6C\x45\x64\x67\x65\x53\x70\x61\x63\x69\x6E\x67","\x6A\x65\x74\x74\x79\x50\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x6C\x69\x6D\x69\x74\x58","\x63\x75\x72\x72\x65\x6E\x74\x58\x44\x65\x6C\x74\x61","\x77\x69\x64\x65\x73\x74\x52\x61\x6E\x6B","\x72\x61\x6E\x6B\x54\x6F\x70\x59","\x72\x61\x6E\x6B\x42\x6F\x74\x74\x6F\x6D\x59","\x77\x69\x64\x65\x73\x74\x52\x61\x6E\x6B\x56\x61\x6C\x75\x65","\x72\x61\x6E\x6B\x57\x69\x64\x74\x68\x73","\x72\x61\x6E\x6B\x59","\x66\x69\x6E\x65\x54\x75\x6E\x69\x6E\x67","\x50\x4F\x4C\x59\x4C\x49\x4E\x45","\x6E\x65\x78\x74\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x61\x63\x68\x65","\x70\x72\x65\x76\x69\x6F\x75\x73\x4C\x61\x79\x65\x72\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x43\x61\x63\x68\x65","\x70\x72\x69\x6E\x74\x53\x74\x61\x74\x75\x73","\x3D\x3D\x3D\x3D\x3D\x3D\x43\x6F\x6F\x72\x64\x20\x61\x73\x73\x69\x67\x6E\x6D\x65\x6E\x74\x20\x64\x65\x62\x75\x67\x3D\x3D\x3D\x3D\x3D\x3D\x3D","\x52\x61\x6E\x6B\x20","\x20\x3A\x20","\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D","\x69\x6E\x69\x74\x69\x61\x6C\x43\x6F\x6F\x72\x64\x73","\x6D\x69\x6E\x4E\x6F\x64\x65","\x6D\x65\x64\x69\x61\x6E\x50\x6F\x73","\x6D\x69\x6E\x50\x61\x74\x68","\x73\x65\x74\x43\x65\x6C\x6C\x4C\x6F\x63\x61\x74\x69\x6F\x6E\x73","\x6D\x65\x64\x69\x61\x6E\x58\x56\x61\x6C\x75\x65","\x72\x61\x6E\x6B\x4D\x65\x64\x69\x61\x6E\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x63\x61\x6C\x63\x75\x6C\x61\x74\x65\x64\x57\x65\x69\x67\x68\x74\x65\x64\x56\x61\x6C\x75\x65","\x63\x61\x6C\x63\x75\x6C\x61\x74\x65\x57\x69\x64\x65\x73\x74\x52\x61\x6E\x6B","\x72\x61\x6E\x6B\x43\x6F\x6F\x72\x64\x69\x6E\x61\x74\x65\x73","\x65\x64\x67\x65\x2E\x65\x64\x67\x65\x73\x20\x69\x73\x20\x6E\x75\x6C\x6C","\x41\x74\x20\x6C\x65\x61\x73\x74\x20\x6F\x6E\x65\x20\x63\x65\x6C\x6C\x20\x68\x61\x73\x20\x6E\x6F\x20\x62\x6F\x75\x6E\x64\x73","\x72\x65\x70\x6F\x73\x69\x74\x69\x6F\x6E\x56\x61\x6C\x69\x64","\x4D\x41\x58\x5F\x56\x41\x4C\x55\x45","\x4F\x52\x54\x48\x4F\x47\x4F\x4E\x41\x4C","\x43\x55\x52\x56\x45","\x73\x65\x74\x45\x64\x67\x65\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x69\x73\x50\x6F\x72\x74","\x70\x72\x6F\x63\x65\x73\x73\x52\x65\x76\x65\x72\x73\x65\x64\x45\x64\x67\x65","\x64\x65\x74\x65\x72\x6D\x69\x6E\x69\x73\x74\x69\x63","\x6D\x6F\x76\x65\x50\x61\x72\x65\x6E\x74","\x70\x61\x72\x65\x6E\x74\x42\x6F\x72\x64\x65\x72","\x69\x6E\x74\x65\x72\x48\x69\x65\x72\x61\x72\x63\x68\x79\x53\x70\x61\x63\x69\x6E\x67","\x74\x72\x61\x76\x65\x72\x73\x65\x41\x6E\x63\x65\x73\x74\x6F\x72\x73","\x65\x64\x67\x65\x73\x43\x61\x63\x68\x65","\x72\x75\x6E","\x75\x70\x64\x61\x74\x65\x47\x72\x6F\x75\x70\x42\x6F\x75\x6E\x64\x73","\x66\x69\x6E\x64\x52\x6F\x6F\x74\x73","\x63\x6F\x6E\x63\x61\x74","\x69\x73\x56\x61\x6C\x69\x64\x41\x6E\x63\x65\x73\x74\x6F\x72","\x66\x69\x6C\x74\x65\x72\x44\x65\x73\x63\x65\x6E\x64\x61\x6E\x74\x73","\x63\x79\x63\x6C\x65\x53\x74\x61\x67\x65","\x6C\x61\x79\x65\x72\x69\x6E\x67\x53\x74\x61\x67\x65","\x63\x72\x6F\x73\x73\x69\x6E\x67\x53\x74\x61\x67\x65","\x70\x6C\x61\x63\x65\x6D\x65\x6E\x74\x53\x74\x61\x67\x65","\x63\x75\x72\x72\x65\x6E\x74\x45\x64\x69\x74","\x73\x65\x74\x52\x6F\x6F\x74","\x6D\x61\x69\x6E\x74\x61\x69\x6E\x45\x64\x67\x65\x50\x61\x72\x65\x6E\x74","\x63\x72\x65\x61\x74\x65\x49\x64\x73","\x70\x6F\x73\x74\x66\x69\x78","\x6E\x65\x78\x74\x49\x64","\x75\x70\x64\x61\x74\x65\x4C\x65\x76\x65\x6C","\x65\x6E\x64\x69\x6E\x67\x55\x70\x64\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x52\x6F\x6F\x74","\x69\x73\x43\x72\x65\x61\x74\x65\x49\x64\x73","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x49\x64\x73","\x69\x6E\x73\x65\x72\x74","\x66\x69\x6C\x74\x65\x72\x43\x65\x6C\x6C\x73","\x67\x65\x74\x44\x65\x73\x63\x65\x6E\x64\x61\x6E\x74\x73","\x72\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65\x64","\x63\x65\x6C\x6C\x41\x64\x64\x65\x64","\x69\x73\x52\x6F\x6F\x74","\x75\x70\x64\x61\x74\x65\x45\x64\x67\x65\x50\x61\x72\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65\x49\x64","\x73\x65\x74\x49\x64","\x69\x73\x4E\x75\x6D\x65\x72\x69\x63","\x75\x70\x64\x61\x74\x65\x45\x64\x67\x65\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x4E\x65\x61\x72\x65\x73\x74\x43\x6F\x6D\x6D\x6F\x6E\x41\x6E\x63\x65\x73\x74\x6F\x72","\x67\x65\x74\x4F\x72\x69\x67\x69\x6E","\x50\x41\x54\x48\x5F\x53\x45\x50\x41\x52\x41\x54\x4F\x52","\x67\x65\x74\x50\x61\x72\x65\x6E\x74\x50\x61\x74\x68","\x70\x61\x72\x65\x6E\x74\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x67\x65\x74\x43\x68\x69\x6C\x64\x72\x65\x6E","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x43\x68\x69\x6C\x64\x45\x64\x67\x65\x73","\x73\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x73\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x73","\x74\x65\x72\x6D\x69\x6E\x61\x6C\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x69\x6E\x73\x65\x72\x74\x45\x64\x67\x65","\x72\x65\x6D\x6F\x76\x65\x45\x64\x67\x65","\x67\x65\x74\x44\x69\x72\x65\x63\x74\x65\x64\x45\x64\x67\x65\x43\x6F\x75\x6E\x74","\x67\x65\x74\x4F\x75\x74\x67\x6F\x69\x6E\x67\x45\x64\x67\x65\x73","\x67\x65\x74\x54\x6F\x70\x6D\x6F\x73\x74\x43\x65\x6C\x6C\x73","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x56\x61\x6C\x75\x65","\x76\x61\x6C\x75\x65\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x76\x61\x6C\x75\x65\x43\x68\x61\x6E\x67\x65\x64","\x67\x65\x6F\x6D\x65\x74\x72\x79\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x73\x74\x79\x6C\x65\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x69\x73\x43\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x73\x65\x74\x43\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64\x53\x74\x61\x74\x65\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x76\x69\x73\x69\x62\x6C\x65\x53\x74\x61\x74\x65\x46\x6F\x72\x43\x65\x6C\x6C\x43\x68\x61\x6E\x67\x65\x64","\x6D\x65\x72\x67\x65\x43\x68\x69\x6C\x64\x72\x65\x6E","\x6D\x65\x72\x67\x65\x43\x68\x69\x6C\x64\x72\x65\x6E\x49\x6D\x70\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74\x73","\x63\x6C\x6F\x6E\x65\x43\x65\x6C\x6C","\x63\x6C\x6F\x6E\x65\x43\x65\x6C\x6C\x49\x6D\x70\x6C","\x72\x65\x73\x74\x6F\x72\x65\x43\x6C\x6F\x6E\x65","\x63\x65\x6C\x6C\x43\x6C\x6F\x6E\x65\x64","\x70\x72\x65\x76\x69\x6F\x75\x73\x49\x6E\x64\x65\x78","\x69\x6E\x64\x65\x78","\x74\x65\x72\x6D\x69\x6E\x61\x6C","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x61\x74\x74\x72\x69\x62\x75\x74\x65","\x6F\x6E\x49\x6E\x69\x74","\x76\x65\x72\x74\x65\x78","\x65\x64\x67\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x6D\x78\x54\x72\x61\x6E\x73\x69\x65\x6E\x74","\x69\x64\x20\x76\x61\x6C\x75\x65\x20\x70\x61\x72\x65\x6E\x74\x20\x73\x6F\x75\x72\x63\x65\x20\x74\x61\x72\x67\x65\x74\x20\x63\x68\x69\x6C\x64\x72\x65\x6E\x20\x65\x64\x67\x65\x73","\x73\x65\x74\x56\x65\x72\x74\x65\x78","\x73\x65\x74\x45\x64\x67\x65","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x50\x61\x72\x65\x6E\x74","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x45\x64\x67\x65\x49\x6E\x64\x65\x78","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x63\x6C\x6F\x6E\x65\x56\x61\x6C\x75\x65","\x54\x52\x41\x4E\x53\x4C\x41\x54\x45\x5F\x43\x4F\x4E\x54\x52\x4F\x4C\x5F\x50\x4F\x49\x4E\x54\x53","\x61\x6C\x74\x65\x72\x6E\x61\x74\x65\x42\x6F\x75\x6E\x64\x73","\x73\x6F\x75\x72\x63\x65\x50\x6F\x69\x6E\x74","\x74\x61\x72\x67\x65\x74\x50\x6F\x69\x6E\x74","\x73\x77\x61\x70","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x73\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x74\x61\x6E","\x70\x6F\x77","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x53\x54\x59\x4C\x45\x5F\x44\x49\x52\x45\x43\x54\x49\x4F\x4E","\x70\x61\x67\x65\x53\x63\x61\x6C\x65","\x70\x61\x67\x65\x46\x6F\x72\x6D\x61\x74","\x50\x72\x69\x6E\x74\x65\x72\x2D\x66\x72\x69\x65\x6E\x64\x6C\x79\x20\x76\x65\x72\x73\x69\x6F\x6E","\x70\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72","\x61\x75\x74\x6F\x4F\x72\x69\x67\x69\x6E","\x70\x72\x69\x6E\x74\x4F\x76\x65\x72\x6C\x61\x79\x73","\x77\x6E\x64","\x70\x61\x67\x65\x43\x6F\x75\x6E\x74","\x67\x65\x74\x57\x69\x6E\x64\x6F\x77","\x67\x65\x74\x44\x6F\x63\x74\x79\x70\x65","\x3C\x6D\x65\x74\x61\x20\x68\x74\x74\x70\x2D\x65\x71\x75\x69\x76\x3D\x22\x58\x2D\x55\x41\x2D\x43\x6F\x6D\x70\x61\x74\x69\x62\x6C\x65\x22\x20\x63\x6F\x6E\x74\x65\x6E\x74\x3D\x22\x49\x45\x3D\x38\x22\x3E","\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65\x4F\x76\x65\x72\x6C\x61\x79","\x67\x65\x74\x44\x72\x61\x77\x50\x61\x6E\x65","\x77\x72\x69\x74\x65\x48\x65\x61\x64","\x3C\x62\x6F\x64\x79\x20\x63\x6C\x61\x73\x73\x3D\x22\x6D\x78\x50\x61\x67\x65\x22\x3E","\x63\x72\x65\x61\x74\x65\x50\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x41\x66\x74\x65\x72","\x61\x6C\x77\x61\x79\x73","\x6D\x78\x50\x61\x67\x65\x42\x72\x65\x61\x6B","\x67\x65\x74\x43\x6F\x76\x65\x72\x50\x61\x67\x65\x73","\x67\x65\x74\x41\x70\x70\x65\x6E\x64\x69\x63\x65\x73","\x61\x64\x64\x47\x72\x61\x70\x68\x46\x72\x61\x67\x6D\x65\x6E\x74","\x72\x65\x6E\x64\x65\x72\x50\x61\x67\x65","\x6D\x78\x50\x61\x67\x65\x2D","\x3C\x74\x69\x74\x6C\x65\x3E","\x3C\x2F\x74\x69\x74\x6C\x65\x3E","\x3C\x73\x74\x79\x6C\x65\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x2F\x63\x73\x73\x22\x3E","\x40\x6D\x65\x64\x69\x61\x20\x70\x72\x69\x6E\x74\x20\x7B","\x20\x20\x74\x61\x62\x6C\x65\x2E\x6D\x78\x50\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72\x20\x7B\x20\x64\x69\x73\x70\x6C\x61\x79\x3A\x20\x6E\x6F\x6E\x65\x3B\x20\x7D","\x20\x20\x68\x72\x2E\x6D\x78\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x20\x7B\x20\x64\x69\x73\x70\x6C\x61\x79\x3A\x20\x6E\x6F\x6E\x65\x3B\x20\x7D","\x40\x6D\x65\x64\x69\x61\x20\x73\x63\x72\x65\x65\x6E\x20\x7B","\x20\x20\x74\x61\x62\x6C\x65\x2E\x6D\x78\x50\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72\x20\x7B\x20\x70\x6F\x73\x69\x74\x69\x6F\x6E\x3A\x20\x66\x69\x78\x65\x64\x3B\x20\x72\x69\x67\x68\x74\x3A\x20\x31\x30\x70\x78\x3B\x20\x74\x6F\x70\x3A\x20\x31\x30\x70\x78\x3B\x66\x6F\x6E\x74\x2D\x66\x61\x6D\x69\x6C\x79\x3A\x20\x41\x72\x69\x61\x6C\x3B\x20\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65\x3A\x31\x30\x70\x74\x3B\x20\x62\x6F\x72\x64\x65\x72\x3A\x20\x73\x6F\x6C\x69\x64\x20\x31\x70\x78\x20\x64\x61\x72\x6B\x67\x72\x61\x79\x3B\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x3A\x20\x77\x68\x69\x74\x65\x3B\x20\x62\x6F\x72\x64\x65\x72\x2D\x63\x6F\x6C\x6C\x61\x70\x73\x65\x3A\x63\x6F\x6C\x6C\x61\x70\x73\x65\x3B\x20\x7D","\x20\x20\x74\x61\x62\x6C\x65\x2E\x6D\x78\x50\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72\x20\x74\x64\x20\x7B\x20\x62\x6F\x72\x64\x65\x72\x3A\x20\x73\x6F\x6C\x69\x64\x20\x31\x70\x78\x20\x67\x72\x61\x79\x3B\x20\x70\x61\x64\x64\x69\x6E\x67\x3A\x34\x70\x78\x3B\x20\x7D","\x20\x20\x62\x6F\x64\x79\x2E\x6D\x78\x50\x61\x67\x65\x20\x7B\x20\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x3A\x20\x67\x72\x61\x79\x3B\x20\x7D","\x3C\x2F\x73\x74\x79\x6C\x65\x3E","\x6D\x78\x50\x61\x67\x65\x53\x65\x6C\x65\x63\x74\x6F\x72","\x61","\x23\x6D\x78\x50\x61\x67\x65\x2D","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x49\x6E\x73\x69\x64\x65","\x67\x65\x74\x43\x61\x6E\x76\x61\x73","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x6E\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x6E\x65","\x73\x74\x79\x6C\x65\x73","\x63\x72\x65\x61\x74\x65\x44\x65\x66\x61\x75\x6C\x74\x56\x65\x72\x74\x65\x78\x53\x74\x79\x6C\x65","\x70\x75\x74\x44\x65\x66\x61\x75\x6C\x74\x56\x65\x72\x74\x65\x78\x53\x74\x79\x6C\x65","\x63\x72\x65\x61\x74\x65\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x70\x75\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x53\x48\x41\x50\x45","\x53\x48\x41\x50\x45\x5F\x52\x45\x43\x54\x41\x4E\x47\x4C\x45","\x53\x54\x59\x4C\x45\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52","\x52\x65\x63\x74\x61\x6E\x67\x6C\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72","\x53\x54\x59\x4C\x45\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x41\x4C\x49\x47\x4E","\x53\x54\x59\x4C\x45\x5F\x41\x4C\x49\x47\x4E","\x53\x54\x59\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x23\x43\x33\x44\x39\x46\x46","\x53\x54\x59\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x43\x4F\x4C\x4F\x52","\x23\x36\x34\x38\x32\x42\x39","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x43\x4F\x4C\x4F\x52","\x23\x37\x37\x34\x34\x30\x30","\x53\x48\x41\x50\x45\x5F\x43\x4F\x4E\x4E\x45\x43\x54\x4F\x52","\x23\x34\x34\x36\x32\x39\x39","\x64\x65\x66\x61\x75\x6C\x74\x56\x65\x72\x74\x65\x78","\x70\x75\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x64\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x56\x65\x72\x74\x65\x78\x53\x74\x79\x6C\x65","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6F\x72\x69\x67\x69\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65\x4F\x66\x66\x73\x65\x74","\x69\x6E\x76\x61\x6C\x69\x64","\x69\x6E\x76\x61\x6C\x69\x64\x4F\x72\x64\x65\x72","\x6F\x72\x64\x65\x72\x43\x68\x61\x6E\x67\x65\x64","\x76\x69\x73\x69\x62\x6C\x65\x53\x6F\x75\x72\x63\x65\x53\x74\x61\x74\x65","\x76\x69\x73\x69\x62\x6C\x65\x54\x61\x72\x67\x65\x74\x53\x74\x61\x74\x65","\x74\x65\x72\x6D\x69\x6E\x61\x6C\x44\x69\x73\x74\x61\x6E\x63\x65","\x73\x65\x67\x6D\x65\x6E\x74\x73","\x67\x65\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x42\x6F\x75\x6E\x64\x73","\x73\x65\x74\x41\x62\x73\x6F\x6C\x75\x74\x65\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x74\x56\x69\x73\x69\x62\x6C\x65\x54\x65\x72\x6D\x69\x6E\x61\x6C\x53\x74\x61\x74\x65","\x73\x65\x74\x56\x69\x73\x69\x62\x6C\x65\x54\x65\x72\x6D\x69\x6E\x61\x6C\x53\x74\x61\x74\x65","\x64\x6F\x6E\x65\x52\x65\x73\x6F\x75\x72\x63\x65","\x75\x70\x64\x61\x74\x69\x6E\x67\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x52\x65\x73\x6F\x75\x72\x63\x65","\x75\x70\x64\x61\x74\x69\x6E\x67\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x73\x69\x6E\x67\x6C\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x69\x73\x53\x69\x6E\x67\x6C\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x73\x65\x74\x53\x69\x6E\x67\x6C\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x69\x73\x53\x65\x6C\x65\x63\x74\x65\x64","\x63\x68\x61\x6E\x67\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x73\x65\x74\x43\x65\x6C\x6C","\x73\x65\x74\x43\x65\x6C\x6C\x73","\x67\x65\x74\x46\x69\x72\x73\x74\x53\x65\x6C\x65\x63\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x61\x62\x6C\x65","\x61\x64\x64\x43\x65\x6C\x6C","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x61\x64\x64\x65\x64","\x72\x65\x6D\x6F\x76\x65\x64","\x6D\x78\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x68\x61\x6E\x67\x65\x2E\x65\x78\x65\x63\x75\x74\x65","\x65\x6E\x74\x65\x72","\x6C\x65\x61\x76\x65","\x65\x64\x69\x74\x69\x6E\x67\x43\x65\x6C\x6C","\x74\x72\x69\x67\x67\x65\x72","\x6D\x6F\x64\x69\x66\x69\x65\x64","\x61\x75\x74\x6F\x53\x69\x7A\x65","\x65\x6D\x70\x74\x79\x4C\x61\x62\x65\x6C\x54\x65\x78\x74","\x74\x65\x78\x74\x4E\x6F\x64\x65","\x6D\x78\x43\x65\x6C\x6C\x45\x64\x69\x74\x6F\x72","\x63\x6F\x6C\x73","\x32\x30","\x34","\x62\x6C\x75\x72","\x66\x6F\x63\x75\x73\x4C\x6F\x73\x74","\x6B\x65\x79\x64\x6F\x77\x6E","\x6B\x65\x79\x43\x6F\x64\x65","\x69\x73\x45\x6E\x74\x65\x72\x53\x74\x6F\x70\x73\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x73\x74\x6F\x70\x45\x64\x69\x74\x69\x6E\x67","\x63\x6C\x65\x61\x72\x4F\x6E\x43\x68\x61\x6E\x67\x65","\x73\x65\x74\x4D\x6F\x64\x69\x66\x69\x65\x64","\x6B\x65\x79\x70\x72\x65\x73\x73","\x69\x73\x4C\x61\x62\x65\x6C\x43\x6C\x69\x70\x70\x65\x64","\x69\x73\x57\x72\x61\x70\x70\x69\x6E\x67","\x41\x4C\x49\x47\x4E\x5F\x4C\x45\x46\x54","\x69\x73\x4D\x6F\x64\x69\x66\x69\x65\x64","\x69\x73\x49\x6E\x76\x6F\x6B\x65\x73\x53\x74\x6F\x70\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x69\x73\x48\x69\x64\x65\x4C\x61\x62\x65\x6C","\x6F\x75\x74\x6C\x69\x6E\x65","\x67\x65\x74\x45\x64\x69\x74\x6F\x72\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x49\x6E\x69\x74\x69\x61\x6C\x56\x61\x6C\x75\x65","\x67\x65\x74\x45\x6D\x70\x74\x79\x4C\x61\x62\x65\x6C\x54\x65\x78\x74","\x63\x72\x65\x61\x74\x65\x54\x65\x78\x74\x44\x69\x76","\x67\x65\x74\x43\x75\x72\x72\x65\x6E\x74\x56\x61\x6C\x75\x65","\x67\x65\x74\x45\x64\x69\x74\x69\x6E\x67\x56\x61\x6C\x75\x65","\x53\x54\x59\x4C\x45\x5F\x53\x50\x41\x43\x49\x4E\x47","\x53\x54\x59\x4C\x45\x5F\x53\x50\x41\x43\x49\x4E\x47\x5F\x54\x4F\x50","\x53\x54\x59\x4C\x45\x5F\x53\x50\x41\x43\x49\x4E\x47\x5F\x52\x49\x47\x48\x54","\x53\x54\x59\x4C\x45\x5F\x53\x50\x41\x43\x49\x4E\x47\x5F\x42\x4F\x54\x54\x4F\x4D","\x53\x54\x59\x4C\x45\x5F\x53\x50\x41\x43\x49\x4E\x47\x5F\x4C\x45\x46\x54","\x67\x65\x74\x45\x64\x69\x74\x69\x6E\x67\x43\x65\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65\x53\x68\x61\x70\x65","\x64\x65\x66\x61\x75\x6C\x74\x56\x65\x72\x74\x65\x78\x53\x68\x61\x70\x65","\x64\x65\x66\x61\x75\x6C\x74\x54\x65\x78\x74\x53\x68\x61\x70\x65","\x6C\x65\x67\x61\x63\x79\x43\x6F\x6E\x74\x72\x6F\x6C\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x64\x65\x66\x61\x75\x6C\x74\x53\x68\x61\x70\x65\x73","\x72\x65\x67\x69\x73\x74\x65\x72\x53\x68\x61\x70\x65","\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65","\x63\x72\x65\x61\x74\x65\x53\x68\x61\x70\x65","\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65\x53\x68\x61\x70\x65","\x6F\x72\x64\x65\x72\x65\x64","\x6B\x65\x65\x70\x45\x64\x67\x65\x73\x49\x6E\x46\x6F\x72\x65\x67\x72\x6F\x75\x6E\x64","\x66\x69\x72\x73\x74\x45\x64\x67\x65","\x69\x6E\x73\x65\x72\x74\x53\x74\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x73","\x69\x6E\x73\x74\x61\x6C\x6C\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x67\x65\x74\x50\x72\x65\x76\x69\x6F\x75\x73\x53\x74\x61\x74\x65\x49\x6E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x66\x69\x6E\x64\x50\x72\x65\x76\x69\x6F\x75\x73\x53\x74\x61\x74\x65\x49\x6E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6F\x72\x64\x65\x72","\x6F\x72\x64\x65\x72\x45\x64\x67\x65","\x6B\x65\x65\x70\x45\x64\x67\x65\x73\x49\x6E\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x67\x65\x74\x53\x68\x61\x70\x65\x43\x6F\x6E\x73\x74\x72\x75\x63\x74\x6F\x72","\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x53\x68\x61\x70\x65","\x67\x65\x74\x53\x68\x61\x70\x65","\x67\x65\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x53\x68\x61\x70\x65","\x67\x65\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x43\x6F\x6C\x6F\x72","\x67\x65\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x47\x72\x61\x64\x69\x65\x6E\x74\x43\x6F\x6C\x6F\x72","\x53\x54\x59\x4C\x45\x5F\x49\x4E\x44\x49\x43\x41\x54\x4F\x52\x5F\x44\x49\x52\x45\x43\x54\x49\x4F\x4E","\x67\x65\x74\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x49\x6D\x61\x67\x65","\x70\x6F\x73\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x65\x53\x68\x61\x70\x65","\x72\x65\x73\x6F\x6C\x76\x65\x43\x6F\x6C\x6F\x72","\x67\x65\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x49\x6E\x64\x69\x63\x61\x74\x6F\x72\x43\x6F\x6C\x6F\x72\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x69\x6E\x64\x69\x63\x61\x74\x65\x64","\x67\x65\x74\x4C\x61\x62\x65\x6C\x56\x61\x6C\x75\x65","\x67\x65\x74\x4C\x61\x62\x65\x6C","\x63\x72\x65\x61\x74\x65\x4C\x61\x62\x65\x6C","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x69\x73\x48\x74\x6D\x6C\x4C\x61\x62\x65\x6C","\x67\x65\x74\x56\x65\x72\x74\x69\x63\x61\x6C\x41\x6C\x69\x67\x6E","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x54\x59\x4C\x45","\x53\x54\x59\x4C\x45\x5F\x48\x4F\x52\x49\x5A\x4F\x4E\x54\x41\x4C","\x53\x54\x59\x4C\x45\x5F\x4C\x41\x42\x45\x4C\x5F\x42\x41\x43\x4B\x47\x52\x4F\x55\x4E\x44\x43\x4F\x4C\x4F\x52","\x53\x54\x59\x4C\x45\x5F\x4C\x41\x42\x45\x4C\x5F\x42\x4F\x52\x44\x45\x52\x43\x4F\x4C\x4F\x52","\x53\x54\x59\x4C\x45\x5F\x4F\x56\x45\x52\x46\x4C\x4F\x57","\x53\x54\x59\x4C\x45\x5F\x4C\x41\x42\x45\x4C\x5F\x50\x41\x44\x44\x49\x4E\x47","\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65\x4C\x61\x62\x65\x6C","\x63\x6F\x6E\x76\x65\x72\x74\x50\x6F\x69\x6E\x74","\x69\x73\x4C\x61\x62\x65\x6C\x45\x76\x65\x6E\x74","\x49\x4D\x47","\x4E\x4F\x5F\x46\x4F","\x67\x65\x74\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x73","\x6F\x76\x65\x72\x6C\x61\x79","\x69\x6E\x73\x74\x61\x6C\x6C\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x69\x73\x45\x64\x69\x74\x69\x6E\x67","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x74\x72\x6F\x6C","\x67\x65\x74\x46\x6F\x6C\x64\x69\x6E\x67\x49\x6D\x61\x67\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x63\x6F\x6E\x74\x72\x6F\x6C","\x69\x6E\x69\x74\x43\x6F\x6E\x74\x72\x6F\x6C","\x44\x49\x41\x4C\x45\x43\x54\x5F\x50\x52\x45\x46\x45\x52\x48\x54\x4D\x4C","\x69\x6E\x6E\x65\x72\x4E\x6F\x64\x65","\x69\x73\x53\x68\x61\x70\x65\x45\x76\x65\x6E\x74","\x67\x65\x73\x74\x75\x72\x65\x73\x74\x61\x72\x74","\x6C\x61\x73\x74\x54\x6F\x75\x63\x68\x54\x69\x6D\x65","\x67\x65\x73\x74\x75\x72\x65\x65\x6E\x64","\x67\x65\x73\x74\x75\x72\x65\x45\x6E\x61\x62\x6C\x65\x64","\x68\x61\x6E\x64\x6C\x65\x47\x65\x73\x74\x75\x72\x65","\x72\x65\x64\x72\x61\x77\x4C\x61\x62\x65\x6C","\x67\x65\x74\x4C\x61\x62\x65\x6C\x42\x6F\x75\x6E\x64\x73","\x69\x73\x43\x6C\x69\x70\x70\x69\x6E\x67","\x67\x65\x74\x54\x65\x78\x74\x53\x63\x61\x6C\x65","\x72\x6F\x74\x61\x74\x65\x4C\x61\x62\x65\x6C\x42\x6F\x75\x6E\x64\x73","\x72\x65\x64\x72\x61\x77\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x73","\x72\x65\x64\x72\x61\x77\x43\x6F\x6E\x74\x72\x6F\x6C","\x67\x65\x74\x43\x6F\x6E\x74\x72\x6F\x6C\x42\x6F\x75\x6E\x64\x73","\x65\x71\x75\x61\x6C\x45\x6E\x74\x72\x69\x65\x73","\x65\x71\x75\x61\x6C\x50\x6F\x69\x6E\x74\x73","\x67\x65\x74\x50\x6F\x72\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x67\x65\x74\x52\x6F\x75\x74\x69\x6E\x67\x43\x65\x6E\x74\x65\x72\x59","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D\x43\x6F\x6E\x74\x72\x6F\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x74\x52\x6F\x75\x74\x69\x6E\x67\x43\x65\x6E\x74\x65\x72\x58","\x53\x54\x59\x4C\x45\x5F\x45\x4C\x42\x4F\x57","\x45\x4C\x42\x4F\x57\x5F\x56\x45\x52\x54\x49\x43\x41\x4C","\x6F\x72\x74\x68\x42\x75\x66\x66\x65\x72","\x44\x49\x52\x45\x43\x54\x49\x4F\x4E\x5F\x4D\x41\x53\x4B\x5F\x41\x4C\x4C","\x6C\x69\x6D\x69\x74\x73","\x76\x65\x72\x74\x65\x78\x53\x65\x70\x65\x72\x61\x74\x69\x6F\x6E\x73","\x72\x65\x76\x65\x72\x73\x65\x50\x6F\x72\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x72\x6F\x75\x74\x65\x50\x61\x74\x74\x65\x72\x6E\x73","\x77\x61\x79\x50\x6F\x69\x6E\x74\x73\x31","\x64\x69\x72\x56\x65\x63\x74\x6F\x72\x73","\x54\x41\x52\x47\x45\x54\x5F\x4D\x41\x53\x4B","\x53\x4F\x55\x52\x43\x45\x5F\x4D\x41\x53\x4B","\x53\x49\x44\x45\x5F\x4D\x41\x53\x4B","\x43\x45\x4E\x54\x45\x52\x5F\x4D\x41\x53\x4B","\x76\x61\x6C\x75\x65\x73","\x70\x75\x74\x56\x61\x6C\x75\x65","\x67\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x45\x4D\x50\x54\x59\x5F\x50\x4F\x49\x4E\x54","\x75\x70\x64\x61\x74\x69\x6E\x67\x44\x6F\x63\x75\x6D\x65\x6E\x74\x52\x65\x73\x6F\x75\x72\x63\x65","\x75\x70\x64\x61\x74\x69\x6E\x67\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x61\x6C\x6C\x6F\x77\x45\x76\x61\x6C","\x63\x61\x70\x74\x75\x72\x65\x44\x6F\x63\x75\x6D\x65\x6E\x74\x47\x65\x73\x74\x75\x72\x65","\x6F\x70\x74\x69\x6D\x69\x7A\x65\x56\x6D\x6C\x52\x65\x66\x6C\x6F\x77\x73","\x72\x65\x6E\x64\x65\x72\x69\x6E\x67","\x75\x70\x64\x61\x74\x65\x53\x74\x79\x6C\x65","\x73\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x73\x65\x74\x43\x75\x72\x72\x65\x6E\x74\x52\x6F\x6F\x74","\x73\x69\x7A\x65\x44\x69\x64\x43\x68\x61\x6E\x67\x65","\x72\x65\x76\x61\x6C\x69\x64\x61\x74\x65","\x70\x72\x65\x76\x69\x6F\x75\x73\x53\x63\x61\x6C\x65","\x70\x72\x65\x76\x69\x6F\x75\x73\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x73\x65\x74\x53\x63\x61\x6C\x65","\x69\x6E\x76\x61\x6C\x69\x64\x61\x74\x65","\x76\x61\x6C\x69\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65\x53\x74\x61\x74\x65","\x6D\x78\x47\x72\x61\x70\x68\x56\x69\x65\x77\x2E\x76\x61\x6C\x69\x64\x61\x74\x65","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x6F\x75\x6E\x64\x73","\x76\x61\x6C\x69\x64\x61\x74\x65\x50\x6F\x69\x6E\x74\x73","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x63\x72\x65\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x72\x65\x64\x72\x61\x77\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x70\x61\x67\x65\x56\x69\x73\x69\x62\x6C\x65","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x42\x6F\x75\x6E\x64\x73","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x48\x69\x64\x65\x4F\x6E\x48\x6F\x76\x65\x72","\x53\x54\x59\x4C\x45\x5F\x52\x4F\x54\x41\x54\x49\x4F\x4E","\x75\x70\x64\x61\x74\x65\x56\x65\x72\x74\x65\x78\x4C\x61\x62\x65\x6C\x4F\x66\x66\x73\x65\x74","\x67\x65\x74\x43\x68\x69\x6C\x64\x4F\x66\x66\x73\x65\x74\x46\x6F\x72\x43\x65\x6C\x6C","\x75\x70\x64\x61\x74\x65\x46\x69\x78\x65\x64\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74\x73","\x75\x70\x64\x61\x74\x65\x50\x6F\x69\x6E\x74\x73","\x75\x70\x64\x61\x74\x65\x46\x6C\x6F\x61\x74\x69\x6E\x67\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74\x73","\x75\x70\x64\x61\x74\x65\x45\x64\x67\x65\x42\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x45\x64\x67\x65\x4C\x61\x62\x65\x6C\x4F\x66\x66\x73\x65\x74","\x63\x68\x69\x6C\x64\x4D\x6F\x76\x65\x64","\x69\x73\x52\x65\x6E\x64\x65\x72\x69\x6E\x67","\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x75\x70\x64\x61\x74\x65\x46\x69\x78\x65\x64\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x50\x6F\x69\x6E\x74","\x67\x65\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x72\x74","\x64\x65\x66\x61\x75\x6C\x74\x4C\x6F\x6F\x70\x53\x74\x79\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x45\x44\x47\x45","\x69\x73\x41\x6C\x6C\x6F\x77\x45\x76\x61\x6C","\x75\x70\x64\x61\x74\x65\x46\x6C\x6F\x61\x74\x69\x6E\x67\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x74\x4E\x65\x78\x74\x50\x6F\x69\x6E\x74","\x69\x73\x4F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C","\x53\x54\x59\x4C\x45\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52\x5F\x53\x50\x41\x43\x49\x4E\x47","\x53\x54\x59\x4C\x45\x5F\x53\x4F\x55\x52\x43\x45\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52\x5F\x53\x50\x41\x43\x49\x4E\x47","\x53\x54\x59\x4C\x45\x5F\x54\x41\x52\x47\x45\x54\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52\x5F\x53\x50\x41\x43\x49\x4E\x47","\x67\x65\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x50\x6F\x69\x6E\x74","\x53\x54\x59\x4C\x45\x5F\x53\x4F\x55\x52\x43\x45\x5F\x50\x4F\x52\x54","\x53\x54\x59\x4C\x45\x5F\x54\x41\x52\x47\x45\x54\x5F\x50\x4F\x52\x54","\x67\x65\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x53\x54\x59\x4C\x45\x5F\x52\x4F\x55\x54\x49\x4E\x47\x5F\x43\x45\x4E\x54\x45\x52\x5F\x58","\x53\x54\x59\x4C\x45\x5F\x52\x4F\x55\x54\x49\x4E\x47\x5F\x43\x45\x4E\x54\x45\x52\x5F\x59","\x67\x65\x74\x52\x65\x6C\x61\x74\x69\x76\x65\x50\x6F\x69\x6E\x74","\x72\x65\x6C\x61\x74\x69\x76\x65\x43\x63\x77","\x73\x65\x74\x52\x65\x6E\x64\x65\x72\x69\x6E\x67","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x45\x76\x61\x6C","\x67\x65\x74\x53\x74\x61\x74\x65\x73","\x67\x65\x74\x43\x65\x6C\x6C\x53\x74\x61\x74\x65\x73","\x69\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x45\x76\x65\x6E\x74","\x69\x73\x53\x63\x72\x6F\x6C\x6C\x45\x76\x65\x6E\x74","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x6D\x6F\x76\x65\x48\x61\x6E\x64\x6C\x65\x72","\x65\x6E\x64\x48\x61\x6E\x64\x6C\x65\x72","\x63\x72\x65\x61\x74\x65\x48\x74\x6D\x6C\x50\x61\x6E\x65","\x75\x70\x64\x61\x74\x65\x48\x74\x6D\x6C\x43\x61\x6E\x76\x61\x73\x53\x69\x7A\x65","\x63\x72\x65\x61\x74\x65\x56\x6D\x6C\x50\x61\x6E\x65","\x63\x6F\x6F\x72\x64\x6F\x72\x69\x67\x69\x6E","\x30\x2C\x30","\x73\x74\x61\x74\x69\x63","\x69\x73\x55\x70","\x67\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65\x46\x6F\x72\x52\x6F\x6F\x74","\x55\x50","\x44\x4F\x57\x4E","\x6D\x6F\x75\x73\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x72\x65\x6E\x64\x65\x72\x48\x69\x6E\x74","\x52\x45\x4E\x44\x45\x52\x49\x4E\x47\x5F\x48\x49\x4E\x54\x5F\x45\x58\x41\x43\x54","\x52\x45\x4E\x44\x45\x52\x49\x4E\x47\x5F\x48\x49\x4E\x54\x5F\x46\x41\x53\x54\x45\x53\x54","\x52\x45\x4E\x44\x45\x52\x49\x4E\x47\x5F\x48\x49\x4E\x54\x5F\x46\x41\x53\x54\x45\x52","\x44\x49\x41\x4C\x45\x43\x54\x5F\x4D\x49\x58\x45\x44\x48\x54\x4D\x4C","\x6D\x75\x6C\x74\x69\x70\x6C\x69\x63\x69\x74\x69\x65\x73","\x69\x6D\x61\x67\x65\x42\x75\x6E\x64\x6C\x65\x73","\x63\x72\x65\x61\x74\x65\x43\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x63\x72\x65\x61\x74\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x63\x72\x65\x61\x74\x65\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x73\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x63\x72\x65\x61\x74\x65\x47\x72\x61\x70\x68\x56\x69\x65\x77","\x67\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C\x43\x68\x61\x6E\x67\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72\x73","\x2F\x72\x65\x73\x6F\x75\x72\x63\x65\x73\x2F\x67\x72\x61\x70\x68","\x45\x4D\x50\x54\x59\x5F\x41\x52\x52\x41\x59","\x63\x65\x6C\x6C\x45\x64\x69\x74\x6F\x72","\x70\x6F\x72\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x64\x6F\x75\x62\x6C\x65\x54\x61\x70\x45\x6E\x61\x62\x6C\x65\x64","\x64\x6F\x75\x62\x6C\x65\x54\x61\x70\x54\x69\x6D\x65\x6F\x75\x74","\x64\x6F\x75\x62\x6C\x65\x54\x61\x70\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x6C\x61\x73\x74\x54\x6F\x75\x63\x68\x59","\x74\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x64\x65\x66\x61\x75\x6C\x74\x4F\x76\x65\x72\x6C\x61\x70","\x64\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x61\x6C\x74\x65\x72\x6E\x61\x74\x65\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x73\x56\x69\x73\x69\x62\x6C\x65","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x43\x6F\x6C\x6F\x72","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x61\x73\x68\x65\x64","\x6D\x69\x6E\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x69\x73\x74","\x70\x72\x65\x66\x65\x72\x50\x61\x67\x65\x53\x69\x7A\x65","\x65\x73\x63\x61\x70\x65\x45\x6E\x61\x62\x6C\x65\x64","\x69\x6E\x76\x6F\x6B\x65\x73\x53\x74\x6F\x70\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x65\x6E\x74\x65\x72\x53\x74\x6F\x70\x73\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x75\x73\x65\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x65\x78\x70\x6F\x72\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x6D\x70\x6F\x72\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x65\x6C\x6C\x73\x4C\x6F\x63\x6B\x65\x64","\x63\x65\x6C\x6C\x73\x43\x6C\x6F\x6E\x65\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x45\x64\x69\x74\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x44\x65\x6C\x65\x74\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x65\x64\x67\x65\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x76\x65\x72\x74\x65\x78\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x64\x72\x6F\x70\x45\x6E\x61\x62\x6C\x65\x64","\x73\x70\x6C\x69\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x65\x6C\x6C\x73\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x42\x65\x6E\x64\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x53\x65\x6C\x65\x63\x74\x61\x62\x6C\x65","\x63\x65\x6C\x6C\x73\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x61\x75\x74\x6F\x53\x69\x7A\x65\x43\x65\x6C\x6C\x73","\x74\x69\x6D\x65\x72\x41\x75\x74\x6F\x53\x63\x72\x6F\x6C\x6C","\x61\x6C\x6C\x6F\x77\x41\x75\x74\x6F\x50\x61\x6E\x6E\x69\x6E\x67","\x69\x67\x6E\x6F\x72\x65\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x6D\x61\x78\x69\x6D\x75\x6D\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x6D\x69\x6E\x69\x6D\x75\x6D\x47\x72\x61\x70\x68\x53\x69\x7A\x65","\x6D\x69\x6E\x69\x6D\x75\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x53\x69\x7A\x65","\x6D\x61\x78\x69\x6D\x75\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x53\x69\x7A\x65","\x72\x65\x73\x69\x7A\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x61\x6C\x6C\x6F\x77\x4E\x65\x67\x61\x74\x69\x76\x65\x43\x6F\x6F\x72\x64\x69\x6E\x61\x74\x65\x73","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64\x72\x65\x6E","\x65\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73","\x65\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73\x4F\x6E\x41\x64\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x54\x6F\x50\x72\x65\x66\x65\x72\x72\x65\x64\x53\x69\x7A\x65","\x7A\x6F\x6F\x6D\x46\x61\x63\x74\x6F\x72","\x6B\x65\x65\x70\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x56\x69\x73\x69\x62\x6C\x65\x4F\x6E\x5A\x6F\x6F\x6D","\x63\x65\x6E\x74\x65\x72\x5A\x6F\x6F\x6D","\x72\x65\x73\x65\x74\x56\x69\x65\x77\x4F\x6E\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73\x4F\x6E\x52\x65\x73\x69\x7A\x65","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73\x4F\x6E\x4D\x6F\x76\x65","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73\x4F\x6E\x43\x6F\x6E\x6E\x65\x63\x74","\x61\x6C\x6C\x6F\x77\x4C\x6F\x6F\x70\x73","\x4C\x6F\x6F\x70","\x6D\x75\x6C\x74\x69\x67\x72\x61\x70\x68","\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65\x45\x64\x67\x65\x73","\x61\x6C\x6C\x6F\x77\x44\x61\x6E\x67\x6C\x69\x6E\x67\x45\x64\x67\x65\x73","\x63\x6C\x6F\x6E\x65\x49\x6E\x76\x61\x6C\x69\x64\x45\x64\x67\x65\x73","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x4F\x6E\x4D\x6F\x76\x65","\x6C\x61\x62\x65\x6C\x73\x56\x69\x73\x69\x62\x6C\x65","\x68\x74\x6D\x6C\x4C\x61\x62\x65\x6C\x73","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x4E\x65\x73\x74\x69\x6E\x67","\x6D\x69\x6E\x46\x69\x74\x53\x63\x61\x6C\x65","\x6D\x61\x78\x46\x69\x74\x53\x63\x61\x6C\x65","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64\x49\x6D\x61\x67\x65","\x2F\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64\x2E\x67\x69\x66","\x65\x78\x70\x61\x6E\x64\x65\x64\x49\x6D\x61\x67\x65","\x2F\x65\x78\x70\x61\x6E\x64\x65\x64\x2E\x67\x69\x66","\x77\x61\x72\x6E\x69\x6E\x67\x49\x6D\x61\x67\x65","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x69\x6D\x61\x67\x65\x73\x2F\x77\x61\x72\x6E\x69\x6E\x67\x2E\x67\x69\x66","\x61\x6C\x72\x65\x61\x64\x79\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64\x52\x65\x73\x6F\x75\x72\x63\x65","\x61\x6C\x72\x65\x61\x64\x79\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x63\x6F\x6E\x74\x61\x69\x6E\x73\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72\x73\x52\x65\x73\x6F\x75\x72\x63\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x73\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72\x73","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x45\x78\x70\x61\x6E\x64\x52\x65\x73\x6F\x75\x72\x63\x65","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x2D\x65\x78\x70\x61\x6E\x64","\x63\x72\x65\x61\x74\x65\x43\x65\x6C\x6C\x45\x64\x69\x74\x6F\x72","\x75\x6E\x6C\x6F\x61\x64","\x73\x65\x6C\x65\x63\x74\x73\x74\x61\x72\x74","\x3C\x76\x3A\x67\x72\x6F\x75\x70\x20\x73\x74\x79\x6C\x65\x3D\x22\x44\x49\x53\x50\x4C\x41\x59\x3A\x20\x6E\x6F\x6E\x65\x3B\x22\x3E\x3C\x2F\x76\x3A\x67\x72\x6F\x75\x70\x3E","\x70\x61\x6E\x6E\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65\x73","\x70\x72\x6F\x63\x65\x73\x73\x43\x68\x61\x6E\x67\x65","\x67\x65\x74\x52\x65\x6D\x6F\x76\x65\x64\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65\x73","\x72\x65\x6D\x6F\x76\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x63\x6C\x65\x61\x72\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x72\x65\x6D\x6F\x76\x65\x53\x74\x61\x74\x65\x46\x6F\x72\x43\x65\x6C\x6C","\x68\x6F\x6D\x65","\x61\x64\x64\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x73","\x63\x6C\x65\x61\x72\x43\x65\x6C\x6C\x4F\x76\x65\x72\x6C\x61\x79\x73","\x73\x65\x74\x43\x65\x6C\x6C\x57\x61\x72\x6E\x69\x6E\x67","\x3C\x66\x6F\x6E\x74\x20\x63\x6F\x6C\x6F\x72\x3D\x72\x65\x64\x3E","\x3C\x2F\x66\x6F\x6E\x74\x3E","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x73\x74\x61\x72\x74\x45\x64\x69\x74\x69\x6E\x67\x41\x74\x43\x65\x6C\x6C","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x45\x64\x69\x74\x61\x62\x6C\x65","\x63\x6F\x6E\x76\x65\x72\x74\x56\x61\x6C\x75\x65\x54\x6F\x53\x74\x72\x69\x6E\x67","\x69\x73\x41\x75\x74\x6F\x53\x69\x7A\x65\x43\x65\x6C\x6C","\x63\x65\x6C\x6C\x4C\x61\x62\x65\x6C\x43\x68\x61\x6E\x67\x65\x64","\x63\x65\x6C\x6C\x53\x69\x7A\x65\x55\x70\x64\x61\x74\x65\x64","\x68\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65\x41\x74","\x69\x73\x54\x6F\x67\x67\x6C\x65\x45\x76\x65\x6E\x74","\x70\x61\x6E\x6E\x69\x6E\x67\x4D\x61\x6E\x61\x67\x65\x72","\x63\x72\x65\x61\x74\x65\x50\x61\x6E\x6E\x69\x6E\x67\x4D\x61\x6E\x61\x67\x65\x72","\x67\x65\x74\x42\x6F\x72\x64\x65\x72\x53\x69\x7A\x65\x73","\x74\x68\x69\x6E","\x6D\x65\x64\x69\x75\x6D","\x74\x68\x69\x63\x6B","\x62\x6F\x72\x64\x65\x72\x4C\x65\x66\x74\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72\x54\x6F\x70\x57\x69\x64\x74\x68","\x70\x61\x64\x64\x69\x6E\x67\x54\x6F\x70","\x62\x6F\x72\x64\x65\x72\x52\x69\x67\x68\x74\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72\x42\x6F\x74\x74\x6F\x6D\x57\x69\x64\x74\x68","\x70\x61\x64\x64\x69\x6E\x67\x42\x6F\x74\x74\x6F\x6D","\x67\x65\x74\x50\x72\x65\x66\x65\x72\x72\x65\x64\x50\x61\x67\x65\x53\x69\x7A\x65","\x67\x65\x74\x42\x6F\x72\x64\x65\x72","\x64\x6F\x52\x65\x73\x69\x7A\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6D\x69\x6E\x57\x69\x64\x74\x68","\x6D\x69\x6E\x48\x65\x69\x67\x68\x74","\x75\x70\x64\x61\x74\x65\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x76\x65\x72\x74\x69\x63\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x70\x6F\x73\x74\x50\x72\x6F\x63\x65\x73\x73\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x49\x4D\x41\x47\x45","\x67\x65\x74\x49\x6D\x61\x67\x65\x46\x72\x6F\x6D\x42\x75\x6E\x64\x6C\x65\x73","\x64\x61\x74\x61\x3A\x69\x6D\x61\x67\x65\x2F","\x3B\x62\x61\x73\x65\x36\x34\x2C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x46\x6C\x61\x67\x73","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x46\x6C\x61\x67\x73","\x61\x64\x64\x49\x6D\x61\x67\x65\x42\x75\x6E\x64\x6C\x65","\x72\x65\x6D\x6F\x76\x65\x49\x6D\x61\x67\x65\x42\x75\x6E\x64\x6C\x65","\x62\x61\x63\x6B","\x67\x65\x74\x43\x65\x6C\x6C\x73\x46\x6F\x72\x47\x72\x6F\x75\x70","\x63\x72\x65\x61\x74\x65\x47\x72\x6F\x75\x70\x43\x65\x6C\x6C","\x67\x65\x74\x42\x6F\x75\x6E\x64\x73\x46\x6F\x72\x47\x72\x6F\x75\x70","\x61\x64\x64\x41\x6C\x6C\x45\x64\x67\x65\x73","\x67\x65\x74\x45\x64\x67\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x69\x6E\x73\x65\x72\x74\x56\x65\x72\x74\x65\x78","\x63\x72\x65\x61\x74\x65\x56\x65\x72\x74\x65\x78","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65","\x61\x64\x64\x45\x64\x67\x65","\x69\x73\x41\x6C\x6C\x6F\x77\x4E\x65\x67\x61\x74\x69\x76\x65\x43\x6F\x6F\x72\x64\x69\x6E\x61\x74\x65\x73","\x69\x73\x45\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73\x4F\x6E\x41\x64\x64","\x69\x73\x45\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74","\x65\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64","\x67\x65\x74\x44\x65\x6C\x65\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x69\x6E\x63\x6C\x75\x64\x65\x45\x64\x67\x65\x73","\x6E\x65\x77\x45\x64\x67\x65","\x67\x65\x74\x46\x6F\x6C\x64\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x72\x65\x63\x75\x72\x73\x65","\x69\x73\x43\x65\x6C\x6C\x46\x6F\x6C\x64\x61\x62\x6C\x65","\x73\x77\x61\x70\x42\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x41\x6C\x74\x65\x72\x6E\x61\x74\x65\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x50\x72\x65\x66\x65\x72\x72\x65\x64\x53\x69\x7A\x65\x46\x6F\x72\x43\x65\x6C\x6C","\x67\x65\x74\x41\x6C\x6C\x45\x64\x67\x65\x73","\x69\x67\x6E\x6F\x72\x65\x43\x68\x69\x6C\x64\x72\x65\x6E","\x53\x48\x41\x50\x45\x5F\x4C\x41\x42\x45\x4C","\x53\x54\x59\x4C\x45\x5F\x49\x4D\x41\x47\x45\x5F\x57\x49\x44\x54\x48","\x53\x54\x59\x4C\x45\x5F\x49\x4D\x41\x47\x45\x5F\x48\x45\x49\x47\x48\x54","\x67\x65\x74\x53\x69\x7A\x65\x46\x6F\x72\x53\x74\x72\x69\x6E\x67","\x72\x65\x73\x69\x7A\x65\x43\x65\x6C\x6C","\x69\x73\x43\x6C\x6F\x6E\x65\x49\x6E\x76\x61\x6C\x69\x64\x45\x64\x67\x65\x73","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x4E\x65\x67\x61\x74\x69\x76\x65\x43\x6F\x6F\x72\x64\x69\x6E\x61\x74\x65\x73","\x69\x73\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x4F\x6E\x4D\x6F\x76\x65","\x69\x73\x41\x6C\x6C\x6F\x77\x44\x61\x6E\x67\x6C\x69\x6E\x67\x45\x64\x67\x65\x73","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x47\x72\x61\x70\x68","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x43\x65\x6C\x6C","\x67\x65\x74\x43\x65\x6C\x6C\x43\x6F\x6E\x74\x61\x69\x6E\x6D\x65\x6E\x74\x41\x72\x65\x61","\x67\x65\x74\x43\x75\x72\x72\x65\x6E\x74\x52\x6F\x6F\x74","\x67\x65\x74\x4D\x61\x78\x69\x6D\x75\x6D\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x69\x73\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x70","\x67\x65\x74\x41\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x53\x54\x59\x4C\x45\x5F\x45\x58\x49\x54\x5F\x58","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x54\x52\x59\x5F\x58","\x53\x54\x59\x4C\x45\x5F\x45\x58\x49\x54\x5F\x59","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x54\x52\x59\x5F\x59","\x53\x54\x59\x4C\x45\x5F\x45\x58\x49\x54\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x54\x52\x59\x5F\x50\x45\x52\x49\x4D\x45\x54\x45\x52","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x70\x6F\x69\x6E\x74","\x53\x54\x59\x4C\x45\x5F\x46\x4C\x49\x50\x48","\x53\x54\x59\x4C\x45\x5F\x46\x4C\x49\x50\x56","\x69\x73\x50\x6F\x72\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x46\x6F\x72\x50\x6F\x72\x74","\x69\x73\x43\x65\x6C\x6C\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x67\x65\x74\x43\x65\x6C\x6C\x42\x6F\x75\x6E\x64\x73","\x73\x68\x69\x66\x74\x50\x72\x65\x76\x69\x65\x77\x31","\x73\x68\x69\x66\x74\x50\x72\x65\x76\x69\x65\x77\x32","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x7A\x6F\x6F\x6D\x41\x63\x74\x75\x61\x6C","\x7A\x6F\x6F\x6D\x54\x6F","\x73\x63\x72\x6F\x6C\x6C\x52\x65\x63\x74\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x7A\x6F\x6F\x6D\x54\x6F\x52\x65\x63\x74","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x4F\x52\x54\x48\x4F\x47\x4F\x4E\x41\x4C","\x53\x65\x67\x6D\x65\x6E\x74\x43\x6F\x6E\x6E\x65\x63\x74\x6F\x72","\x45\x6C\x62\x6F\x77\x43\x6F\x6E\x6E\x65\x63\x74\x6F\x72","\x53\x69\x64\x65\x54\x6F\x53\x69\x64\x65","\x54\x6F\x70\x54\x6F\x42\x6F\x74\x74\x6F\x6D","\x45\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E","\x4F\x72\x74\x68\x43\x6F\x6E\x6E\x65\x63\x74\x6F\x72","\x69\x73\x4C\x6F\x6F\x70","\x69\x73\x43\x6C\x6F\x6E\x65\x45\x76\x65\x6E\x74","\x49\x53\x5F\x4D\x41\x43","\x69\x73\x4D\x65\x74\x61\x44\x6F\x77\x6E","\x69\x73\x41\x6C\x74\x44\x6F\x77\x6E","\x69\x73\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x65\x64\x45\x76\x65\x6E\x74","\x69\x73\x46\x6F\x72\x63\x65\x4D\x61\x72\x71\x75\x65\x65\x45\x76\x65\x6E\x74","\x76\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x41\x6C\x65\x72\x74","\x69\x73\x45\x64\x67\x65\x56\x61\x6C\x69\x64","\x69\x73\x56\x61\x6C\x69\x64\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x63\x68\x65\x63\x6B","\x76\x61\x6C\x69\x64\x61\x74\x65\x45\x64\x67\x65","\x76\x61\x6C\x69\x64\x61\x74\x65\x47\x72\x61\x70\x68","\x67\x65\x74\x43\x65\x6C\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x76\x61\x6C\x69\x64\x61\x74\x65\x43\x65\x6C\x6C","\x61\x74\x74\x72","\x63\x6F\x75\x6E\x74\x45\x72\x72\x6F\x72","\x73\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x74\x6F\x53\x74\x72\x69\x6E\x67","\x69\x73\x48\x74\x6D\x6C\x4C\x61\x62\x65\x6C\x73","\x73\x65\x74\x48\x74\x6D\x6C\x4C\x61\x62\x65\x6C\x73","\x53\x54\x59\x4C\x45\x5F\x57\x48\x49\x54\x45\x5F\x53\x50\x41\x43\x45","\x67\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x46\x6F\x72\x4E\x6F\x64\x65","\x67\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x46\x6F\x72\x43\x65\x6C\x6C","\x67\x65\x74\x43\x75\x72\x73\x6F\x72\x46\x6F\x72\x43\x65\x6C\x6C","\x53\x54\x59\x4C\x45\x5F\x49\x4E\x44\x49\x43\x41\x54\x4F\x52\x5F\x43\x4F\x4C\x4F\x52","\x53\x54\x59\x4C\x45\x5F\x49\x4E\x44\x49\x43\x41\x54\x4F\x52\x5F\x47\x52\x41\x44\x49\x45\x4E\x54\x43\x4F\x4C\x4F\x52","\x53\x54\x59\x4C\x45\x5F\x49\x4E\x44\x49\x43\x41\x54\x4F\x52\x5F\x53\x48\x41\x50\x45","\x53\x54\x59\x4C\x45\x5F\x49\x4E\x44\x49\x43\x41\x54\x4F\x52\x5F\x49\x4D\x41\x47\x45","\x73\x65\x74\x42\x6F\x72\x64\x65\x72","\x53\x48\x41\x50\x45\x5F\x53\x57\x49\x4D\x4C\x41\x4E\x45","\x69\x73\x52\x65\x73\x69\x7A\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x65\x74\x52\x65\x73\x69\x7A\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x69\x73\x45\x73\x63\x61\x70\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x45\x73\x63\x61\x70\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x49\x6E\x76\x6F\x6B\x65\x73\x53\x74\x6F\x70\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x73\x65\x74\x45\x6E\x74\x65\x72\x53\x74\x6F\x70\x73\x43\x65\x6C\x6C\x45\x64\x69\x74\x69\x6E\x67","\x69\x73\x43\x65\x6C\x6C\x4C\x6F\x63\x6B\x65\x64","\x69\x73\x43\x65\x6C\x6C\x73\x4C\x6F\x63\x6B\x65\x64","\x73\x65\x74\x43\x65\x6C\x6C\x73\x4C\x6F\x63\x6B\x65\x64","\x67\x65\x74\x43\x6C\x6F\x6E\x65\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x69\x73\x43\x65\x6C\x6C\x43\x6C\x6F\x6E\x65\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x43\x6C\x6F\x6E\x65\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x43\x4C\x4F\x4E\x45\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x43\x6C\x6F\x6E\x65\x61\x62\x6C\x65","\x63\x61\x6E\x45\x78\x70\x6F\x72\x74\x43\x65\x6C\x6C","\x63\x61\x6E\x49\x6D\x70\x6F\x72\x74\x43\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x73\x53\x65\x6C\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x73\x53\x65\x6C\x65\x63\x74\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x44\x65\x6C\x65\x74\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x44\x65\x6C\x65\x74\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x44\x45\x4C\x45\x54\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x44\x65\x6C\x65\x74\x61\x62\x6C\x65","\x69\x73\x4C\x61\x62\x65\x6C\x4D\x6F\x76\x61\x62\x6C\x65","\x67\x65\x74\x4D\x6F\x76\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x69\x73\x43\x65\x6C\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x4D\x4F\x56\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x73\x65\x74\x50\x6F\x72\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x73\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x67\x65\x74\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x73\x65\x74\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x69\x73\x56\x65\x72\x74\x65\x78\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x73\x65\x74\x56\x65\x72\x74\x65\x78\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x69\x73\x45\x64\x67\x65\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x73\x65\x74\x45\x64\x67\x65\x4C\x61\x62\x65\x6C\x73\x4D\x6F\x76\x61\x62\x6C\x65","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65\x4E\x65\x73\x74\x69\x6E\x67","\x73\x65\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65\x4E\x65\x73\x74\x69\x6E\x67","\x73\x65\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x4D\x75\x6C\x74\x69\x67\x72\x61\x70\x68","\x73\x65\x74\x4D\x75\x6C\x74\x69\x67\x72\x61\x70\x68","\x69\x73\x41\x6C\x6C\x6F\x77\x4C\x6F\x6F\x70\x73","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x44\x61\x6E\x67\x6C\x69\x6E\x67\x45\x64\x67\x65\x73","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65\x45\x64\x67\x65\x73","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65\x45\x64\x67\x65\x73","\x73\x65\x74\x43\x6C\x6F\x6E\x65\x49\x6E\x76\x61\x6C\x69\x64\x45\x64\x67\x65\x73","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x4C\x6F\x6F\x70\x73","\x73\x65\x74\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x4F\x6E\x4D\x6F\x76\x65","\x73\x65\x74\x44\x72\x6F\x70\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x70\x6C\x69\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x53\x70\x6C\x69\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x43\x65\x6C\x6C\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x52\x45\x53\x49\x5A\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x52\x65\x73\x69\x7A\x61\x62\x6C\x65","\x69\x73\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74\x4D\x6F\x76\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x42\x65\x6E\x64\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x42\x65\x6E\x64\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x42\x45\x4E\x44\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x42\x65\x6E\x64\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x45\x64\x69\x74\x61\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x45\x44\x49\x54\x41\x42\x4C\x45","\x73\x65\x74\x43\x65\x6C\x6C\x73\x45\x64\x69\x74\x61\x62\x6C\x65","\x69\x73\x43\x65\x6C\x6C\x73\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x73\x44\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x69\x73\x56\x61\x6C\x69\x64\x53\x6F\x75\x72\x63\x65","\x69\x73\x56\x61\x6C\x69\x64\x54\x61\x72\x67\x65\x74","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x50\x61\x6E\x6E\x69\x6E\x67","\x69\x73\x41\x75\x74\x6F\x53\x69\x7A\x65\x43\x65\x6C\x6C\x73","\x53\x54\x59\x4C\x45\x5F\x41\x55\x54\x4F\x53\x49\x5A\x45","\x73\x65\x74\x41\x75\x74\x6F\x53\x69\x7A\x65\x43\x65\x6C\x6C\x73","\x69\x73\x45\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73","\x73\x65\x74\x45\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73","\x73\x65\x74\x45\x78\x74\x65\x6E\x64\x50\x61\x72\x65\x6E\x74\x73\x4F\x6E\x41\x64\x64","\x69\x73\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64\x72\x65\x6E","\x73\x65\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64\x72\x65\x6E","\x69\x73\x41\x6C\x6C\x6F\x77\x4F\x76\x65\x72\x6C\x61\x70\x50\x61\x72\x65\x6E\x74","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4C\x44\x41\x42\x4C\x45","\x69\x73\x56\x61\x6C\x69\x64\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x69\x73\x53\x70\x6C\x69\x74\x54\x61\x72\x67\x65\x74","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x68\x69\x74\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65\x43\x6F\x6E\x74\x65\x6E\x74","\x67\x65\x74\x50\x6F\x69\x6E\x74\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x43\x65\x6C\x6C\x73","\x67\x65\x74\x43\x65\x6C\x6C\x73\x42\x65\x79\x6F\x6E\x64","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x72\x65\x6D\x6F\x76\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x52\x65\x67\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x73\x46\x6F\x72\x45\x76\x65\x6E\x74","\x73\x65\x6C\x65\x63\x74\x4E\x65\x78\x74\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x50\x72\x65\x76\x69\x6F\x75\x73\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x50\x61\x72\x65\x6E\x74\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x43\x68\x69\x6C\x64\x43\x65\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x73","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72","\x75\x70\x64\x61\x74\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x4D\x4F\x55\x53\x45\x5F\x44\x4F\x57\x4E","\x6C\x61\x73\x74\x54\x6F\x75\x63\x68\x58","\x6C\x61\x73\x74\x4D\x6F\x75\x73\x65\x58","\x6C\x61\x73\x74\x4D\x6F\x75\x73\x65\x59","\x4D\x4F\x55\x53\x45\x5F\x55\x50","\x4D\x4F\x55\x53\x45\x5F\x4D\x4F\x56\x45","\x64\x65\x73\x74\x72\x6F\x79\x65\x64","\x74\x6F\x6F\x6C\x74\x69\x70","\x68\x65\x6C\x70","\x67\x72\x61\x70\x68\x52\x65\x6E\x64\x65\x72\x48\x69\x6E\x74","\x73\x68\x6F\x77\x56\x69\x65\x77\x70\x6F\x72\x74","\x73\x69\x7A\x65\x72\x53\x69\x7A\x65","\x75\x70\x64\x61\x74\x65\x4F\x6E\x50\x61\x6E","\x73\x69\x7A\x65\x72\x49\x6D\x61\x67\x65","\x73\x68\x61\x70\x65\x2D\x72\x65\x6E\x64\x65\x72\x69\x6E\x67","\x6F\x70\x74\x69\x6D\x69\x7A\x65\x53\x70\x65\x65\x64","\x69\x6D\x61\x67\x65\x2D\x72\x65\x6E\x64\x65\x72\x69\x6E\x67","\x75\x70\x64\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72","\x75\x70\x64\x61\x74\x65","\x70\x61\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x72\x65\x66\x72\x65\x73\x68\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x42\x6F\x72\x64\x65\x72","\x72\x65\x64\x69\x72\x65\x63\x74\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73","\x73\x69\x7A\x65\x72","\x63\x72\x65\x61\x74\x65\x53\x69\x7A\x65\x72","\x73\x65\x74\x5A\x6F\x6F\x6D\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x53\x6F\x75\x72\x63\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x53\x69\x7A\x65","\x67\x65\x74\x4F\x75\x74\x6C\x69\x6E\x65\x4F\x66\x66\x73\x65\x74","\x73\x74\x61\x72\x74\x58","\x73\x74\x61\x72\x74\x59","\x64\x78\x30","\x64\x79\x30","\x6E","\x76\x61\x6C\x69\x64\x4E\x65\x69\x67\x68\x62\x6F\x72\x73","\x74\x79\x70\x65\x45\x72\x72\x6F\x72","\x76\x61\x6C\x69\x64\x4E\x65\x69\x67\x68\x62\x6F\x72\x73\x41\x6C\x6C\x6F\x77\x65\x64","\x63\x68\x65\x63\x6B\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x63\x68\x65\x63\x6B\x4E\x65\x69\x67\x68\x62\x6F\x72\x73","\x63\x68\x65\x63\x6B\x54\x79\x70\x65","\x75\x6E\x64\x6F\x48\x61\x6E\x64\x6C\x65\x72","\x62\x75\x62\x62\x6C\x69\x6E\x67","\x69\x73\x42\x75\x62\x62\x6C\x69\x6E\x67","\x73\x65\x74\x42\x75\x62\x62\x6C\x69\x6E\x67","\x67\x65\x74\x4C\x61\x79\x6F\x75\x74","\x67\x65\x74\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65\x73","\x67\x65\x74\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65","\x65\x78\x65\x63\x75\x74\x65\x4C\x61\x79\x6F\x75\x74","\x72\x65\x73\x69\x7A\x65\x48\x61\x6E\x64\x6C\x65\x72","\x66\x6F\x6C\x64\x48\x61\x6E\x64\x6C\x65\x72","\x73\x68\x69\x66\x74\x52\x69\x67\x68\x74\x77\x61\x72\x64\x73","\x73\x68\x69\x66\x74\x44\x6F\x77\x6E\x77\x61\x72\x64\x73","\x69\x73\x43\x65\x6C\x6C\x49\x67\x6E\x6F\x72\x65\x64","\x69\x73\x43\x65\x6C\x6C\x53\x68\x69\x66\x74\x61\x62\x6C\x65","\x69\x73\x53\x68\x69\x66\x74\x52\x69\x67\x68\x74\x77\x61\x72\x64\x73","\x73\x65\x74\x53\x68\x69\x66\x74\x52\x69\x67\x68\x74\x77\x61\x72\x64\x73","\x69\x73\x53\x68\x69\x66\x74\x44\x6F\x77\x6E\x77\x61\x72\x64\x73","\x73\x65\x74\x53\x68\x69\x66\x74\x44\x6F\x77\x6E\x77\x61\x72\x64\x73","\x63\x65\x6C\x6C\x52\x65\x73\x69\x7A\x65\x64","\x67\x65\x74\x43\x65\x6C\x6C\x73\x54\x6F\x53\x68\x69\x66\x74","\x73\x68\x69\x66\x74\x43\x65\x6C\x6C","\x61\x64\x64\x45\x6E\x61\x62\x6C\x65\x64","\x72\x65\x73\x69\x7A\x65\x45\x6E\x61\x62\x6C\x65\x64","\x61\x64\x64\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x41\x64\x64\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x52\x65\x73\x69\x7A\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x48\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x73\x65\x74\x41\x64\x64\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x52\x65\x73\x69\x7A\x65\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65\x49\x67\x6E\x6F\x72\x65\x64","\x69\x73\x43\x65\x6C\x6C\x48\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x41\x64\x64\x65\x64","\x72\x65\x73\x69\x7A\x65\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x6F\x6C\x64\x42\x6F\x75\x6E\x64\x73","\x6F\x6C\x64\x53\x74\x61\x74\x65\x73","\x6F\x6C\x64\x53\x63\x61\x6C\x65","\x64\x65\x6C\x74\x61\x73","\x63\x6F\x75\x6E\x74","\x58","\x59","\x61\x64\x64\x45\x64\x67\x65\x73","\x72\x65\x73\x6F\x6C\x76\x65","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x53\x74\x61\x74\x65","\x72\x65\x76\x61\x6C\x69\x64\x61\x74\x65\x53\x74\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x50\x72\x65\x76\x69\x65\x77\x53\x68\x61\x70\x65","\x6D\x61\x78\x43\x65\x6C\x6C\x73","\x68\x69\x67\x68\x6C\x69\x67\x68\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x6C\x6F\x6E\x65\x45\x6E\x61\x62\x6C\x65\x64","\x6D\x6F\x76\x65\x45\x6E\x61\x62\x6C\x65\x64","\x67\x75\x69\x64\x65","\x63\x75\x72\x72\x65\x6E\x74\x44\x78","\x63\x75\x72\x72\x65\x6E\x74\x44\x79","\x75\x70\x64\x61\x74\x65\x43\x75\x72\x73\x6F\x72","\x73\x65\x6C\x65\x63\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x4F\x6E\x44\x72\x6F\x70","\x73\x63\x72\x6F\x6C\x6C\x4F\x6E\x4D\x6F\x76\x65","\x70\x72\x65\x76\x69\x65\x77\x43\x6F\x6C\x6F\x72","\x68\x74\x6D\x6C\x50\x72\x65\x76\x69\x65\x77","\x73\x63\x61\x6C\x65\x47\x72\x69\x64","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x43\x6C\x6F\x6E\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x43\x6C\x6F\x6E\x65\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x4D\x6F\x76\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x4D\x6F\x76\x65\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x65\x6C\x65\x63\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x52\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x73\x65\x74\x52\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x49\x6E\x69\x74\x69\x61\x6C\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x44\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x64\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x63\x65\x6C\x6C\x57\x61\x73\x43\x6C\x69\x63\x6B\x65\x64","\x53\x45\x4C\x45\x43\x54","\x66\x69\x72\x73\x74","\x67\x65\x74\x50\x72\x65\x76\x69\x65\x77\x42\x6F\x75\x6E\x64\x73","\x63\x72\x65\x61\x74\x65\x50\x72\x65\x76\x69\x65\x77\x53\x68\x61\x70\x65","\x70\x42\x6F\x75\x6E\x64\x73","\x75\x73\x65\x47\x75\x69\x64\x65\x73\x46\x6F\x72\x45\x76\x65\x6E\x74","\x73\x65\x74\x48\x69\x67\x68\x6C\x69\x67\x68\x74\x43\x6F\x6C\x6F\x72","\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x49\x4E\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4E\x4E\x45\x43\x54\x5F\x54\x41\x52\x47\x45\x54\x5F\x43\x4F\x4C\x4F\x52","\x43\x55\x52\x53\x4F\x52\x5F\x4D\x4F\x56\x41\x42\x4C\x45\x5F\x45\x44\x47\x45","\x43\x55\x52\x53\x4F\x52\x5F\x4D\x4F\x56\x41\x42\x4C\x45\x5F\x56\x45\x52\x54\x45\x58","\x73\x65\x6C\x65\x63\x74\x44\x65\x6C\x61\x79\x65\x64","\x64\x65\x73\x74\x72\x6F\x79\x53\x68\x61\x70\x65\x73","\x67\x75\x69\x64\x65\x73","\x73\x68\x6F\x75\x6C\x64\x52\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x74\x72\x69\x67\x67\x65\x72\x58","\x74\x72\x69\x67\x67\x65\x72\x59","\x75\x73\x65\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x75\x73\x65\x4C\x65\x66\x74\x42\x75\x74\x74\x6F\x6E\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x73\x65\x6C\x65\x63\x74\x4F\x6E\x50\x6F\x70\x75\x70","\x63\x6C\x65\x61\x72\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4F\x6E\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x69\x67\x6E\x6F\x72\x65\x43\x65\x6C\x6C","\x70\x72\x65\x76\x69\x65\x77\x45\x6E\x61\x62\x6C\x65\x64","\x75\x73\x65\x47\x72\x69\x64","\x69\x73\x50\x61\x6E\x6E\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x50\x61\x6E\x6E\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x50\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x70\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65\x50\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x67\x65\x74\x43\x65\x6C\x6C\x46\x6F\x72\x50\x6F\x70\x75\x70\x45\x76\x65\x6E\x74","\x76\x61\x6C\x69\x64\x43\x6F\x6C\x6F\x72","\x44\x45\x46\x41\x55\x4C\x54\x5F\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x69\x6E\x76\x61\x6C\x69\x64\x43\x6F\x6C\x6F\x72","\x44\x45\x46\x41\x55\x4C\x54\x5F\x49\x4E\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x68\x6F\x74\x73\x70\x6F\x74","\x44\x45\x46\x41\x55\x4C\x54\x5F\x48\x4F\x54\x53\x50\x4F\x54","\x68\x6F\x74\x73\x70\x6F\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x75\x72\x72\x65\x6E\x74\x43\x6F\x6C\x6F\x72","\x76\x61\x6C\x69\x64\x53\x74\x61\x74\x65","\x6D\x61\x72\x6B\x65\x64\x53\x74\x61\x74\x65","\x73\x65\x74\x48\x6F\x74\x73\x70\x6F\x74","\x67\x65\x74\x48\x6F\x74\x73\x70\x6F\x74","\x73\x65\x74\x48\x6F\x74\x73\x70\x6F\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x48\x6F\x74\x73\x70\x6F\x74\x45\x6E\x61\x62\x6C\x65\x64","\x68\x61\x73\x56\x61\x6C\x69\x64\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x61\x6C\x69\x64\x53\x74\x61\x74\x65","\x67\x65\x74\x4D\x61\x72\x6B\x65\x64\x53\x74\x61\x74\x65","\x75\x6E\x6D\x61\x72\x6B","\x70\x72\x6F\x63\x65\x73\x73","\x69\x73\x56\x61\x6C\x69\x64\x53\x74\x61\x74\x65","\x67\x65\x74\x4D\x61\x72\x6B\x65\x72\x43\x6F\x6C\x6F\x72","\x6D\x61\x72\x6B\x43\x65\x6C\x6C","\x67\x65\x74\x53\x74\x61\x74\x65\x54\x6F\x4D\x61\x72\x6B","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x73\x48\x6F\x74\x73\x70\x6F\x74","\x72\x65\x73\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x68\x61\x6E\x64\x6C\x65\x72\x73","\x6D\x61\x78\x48\x61\x6E\x64\x6C\x65\x72\x73","\x6D\x6F\x76\x65\x49\x63\x6F\x6E\x46\x72\x6F\x6E\x74","\x6D\x6F\x76\x65\x49\x63\x6F\x6E\x42\x61\x63\x6B","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x74\x61\x72\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x63\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x6D\x61\x72\x6B\x65\x72","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x48\x61\x6E\x64\x6C\x65\x72","\x77\x61\x79\x70\x6F\x69\x6E\x74\x73\x45\x6E\x61\x62\x6C\x65\x64","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x45\x6E\x61\x62\x6C\x65\x64","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x44\x65\x6C\x61\x79","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x49\x6E\x50\x72\x6F\x67\x72\x65\x73\x73","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x56\x61\x6C\x69\x64","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x69\x6E\x69\x74\x69\x61\x6C\x54\x6F\x75\x63\x68\x58","\x69\x6E\x69\x74\x69\x61\x6C\x54\x6F\x75\x63\x68\x59","\x69\x67\x6E\x6F\x72\x65\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x63\x6F\x6E\x4F\x66\x66\x73\x65\x74","\x65\x64\x67\x65\x53\x74\x61\x74\x65","\x64\x72\x69\x6C\x6C\x48\x61\x6E\x64\x6C\x65\x72","\x6D\x6F\x75\x73\x65\x44\x6F\x77\x6E\x43\x6F\x75\x6E\x74\x65\x72","\x6D\x6F\x76\x65\x50\x72\x65\x76\x69\x65\x77\x41\x77\x61\x79","\x69\x73\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x69\x63\x6F\x6E\x53\x74\x61\x74\x65","\x69\x63\x6F\x6E\x73","\x72\x65\x64\x72\x61\x77\x49\x63\x6F\x6E\x73","\x64\x65\x73\x74\x72\x6F\x79\x49\x63\x6F\x6E\x73","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6E\x67","\x76\x61\x6C\x69\x64\x61\x74\x65\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x53\x74\x61\x74\x65","\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x69\x73\x4D\x6F\x76\x65\x49\x63\x6F\x6E\x54\x6F\x46\x72\x6F\x6E\x74\x46\x6F\x72\x53\x74\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x49\x63\x6F\x6E\x73","\x43\x55\x52\x53\x4F\x52\x5F\x43\x4F\x4E\x4E\x45\x43\x54","\x63\x75\x72\x72\x65\x6E\x74\x53\x74\x61\x74\x65","\x69\x63\x6F\x6E","\x67\x65\x74\x49\x63\x6F\x6E\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x69\x73\x53\x74\x61\x72\x74\x45\x76\x65\x6E\x74","\x63\x75\x72\x72\x65\x6E\x74\x46\x6F\x63\x75\x73","\x63\x75\x72\x72\x65\x6E\x74\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x73\x6F\x75\x72\x63\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x77\x61\x79\x70\x6F\x69\x6E\x74\x73","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x54\x68\x72\x65\x61\x64","\x63\x6C\x65\x61\x72\x54\x69\x6D\x65\x6F\x75\x74","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64","\x73\x65\x6C\x65\x63\x74\x65\x64\x49\x63\x6F\x6E","\x69\x73\x49\x6D\x6D\x65\x64\x69\x61\x74\x65\x43\x6F\x6E\x6E\x65\x63\x74\x53\x6F\x75\x72\x63\x65","\x75\x70\x64\x61\x74\x65\x43\x75\x72\x72\x65\x6E\x74\x53\x74\x61\x74\x65","\x63\x6F\x6E\x76\x65\x72\x74\x57\x61\x79\x70\x6F\x69\x6E\x74","\x67\x65\x74\x54\x61\x72\x67\x65\x74\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x50\x6F\x69\x6E\x74","\x67\x65\x74\x53\x6F\x75\x72\x63\x65\x50\x65\x72\x69\x6D\x65\x74\x65\x72\x50\x6F\x69\x6E\x74","\x64\x72\x61\x77\x50\x72\x65\x76\x69\x65\x77","\x75\x70\x64\x61\x74\x65\x49\x63\x6F\x6E\x73","\x69\x73\x53\x74\x6F\x70\x45\x76\x65\x6E\x74","\x61\x64\x64\x57\x61\x79\x70\x6F\x69\x6E\x74\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x45\x64\x67\x65\x57\x69\x64\x74\x68","\x67\x65\x74\x45\x64\x67\x65\x43\x6F\x6C\x6F\x72","\x49\x4E\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x63\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x41\x6C\x69\x67\x6E\x6D\x65\x6E\x74\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x70\x6F\x69\x6E\x74\x49\x6D\x61\x67\x65","\x2F\x70\x6F\x69\x6E\x74\x2E\x67\x69\x66","\x68\x69\x67\x68\x6C\x69\x67\x68\x74\x43\x6F\x6C\x6F\x72","\x66\x6F\x63\x75\x73\x49\x63\x6F\x6E\x73","\x66\x6F\x63\x75\x73\x48\x69\x67\x68\x6C\x69\x67\x68\x74","\x66\x6F\x63\x75\x73\x50\x6F\x69\x6E\x74\x73","\x63\x75\x72\x72\x65\x6E\x74\x46\x6F\x63\x75\x73\x41\x72\x65\x61","\x67\x65\x74\x49\x6D\x61\x67\x65\x46\x6F\x72\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74","\x69\x73\x45\x76\x65\x6E\x74\x49\x67\x6E\x6F\x72\x65\x64","\x72\x65\x70\x61\x69\x6E\x74","\x64\x65\x66\x61\x75\x6C\x74\x4F\x70\x61\x63\x69\x74\x79","\x73\x68\x61\x72\x65\x64\x44\x69\x76","\x63\x75\x72\x72\x65\x6E\x74\x58","\x63\x75\x72\x72\x65\x6E\x74\x59","\x64\x72\x61\x67\x48\x61\x6E\x64\x6C\x65\x72","\x6D\x78\x52\x75\x62\x62\x65\x72\x62\x61\x6E\x64","\x73\x69\x6E\x67\x6C\x65\x53\x69\x7A\x65\x72","\x61\x6C\x6C\x6F\x77\x48\x61\x6E\x64\x6C\x65\x42\x6F\x75\x6E\x64\x73\x43\x68\x65\x63\x6B","\x68\x61\x6E\x64\x6C\x65\x49\x6D\x61\x67\x65","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x52\x61\x73\x74\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x42\x6F\x75\x6E\x64\x73","\x63\x72\x65\x61\x74\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x53\x68\x61\x70\x65","\x73\x69\x7A\x65\x72\x73","\x6E\x2D\x72\x65\x73\x69\x7A\x65","\x6E\x65\x2D\x72\x65\x73\x69\x7A\x65","\x77\x2D\x72\x65\x73\x69\x7A\x65","\x65\x2D\x72\x65\x73\x69\x7A\x65","\x73\x77\x2D\x72\x65\x73\x69\x7A\x65","\x73\x2D\x72\x65\x73\x69\x7A\x65","\x73\x65\x2D\x72\x65\x73\x69\x7A\x65","\x6C\x61\x62\x65\x6C\x53\x68\x61\x70\x65","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x53\x68\x61\x70\x65","\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6C\x6F\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x53\x74\x72\x6F\x6B\x65\x57\x69\x64\x74\x68","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x44\x61\x73\x68\x65\x64","\x56\x45\x52\x54\x45\x58\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x56\x45\x52\x54\x45\x58\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x53\x54\x52\x4F\x4B\x45\x57\x49\x44\x54\x48","\x56\x45\x52\x54\x45\x58\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x44\x41\x53\x48\x45\x44","\x63\x72\x65\x61\x74\x65\x53\x69\x7A\x65\x72\x53\x68\x61\x70\x65","\x69\x73\x53\x69\x7A\x65\x72\x56\x69\x73\x69\x62\x6C\x65","\x52\x4F\x54\x41\x54\x49\x4F\x4E\x5F\x48\x41\x4E\x44\x4C\x45","\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x6D\x6F\x76\x65\x53\x69\x7A\x65\x72\x54\x6F","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x6F\x72\x45\x76\x65\x6E\x74","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45","\x70\x72\x65\x76\x69\x65\x77","\x63\x75\x72\x72\x65\x6E\x74\x41\x6C\x70\x68\x61","\x61\x74\x61\x6E","\x75\x6E\x69\x6F\x6E","\x72\x6F\x74\x61\x74\x65\x43\x65\x6C\x6C","\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64\x72\x65\x6E","\x62\x65\x6E\x64\x73","\x72\x65\x6D\x6F\x76\x65\x45\x6E\x61\x62\x6C\x65\x64","\x73\x6E\x61\x70\x54\x6F\x54\x65\x72\x6D\x69\x6E\x61\x6C\x73","\x61\x62\x73\x70\x6F\x69\x6E\x74\x73","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x50\x6F\x69\x6E\x74\x73","\x69\x73\x41\x64\x64\x50\x6F\x69\x6E\x74\x45\x76\x65\x6E\x74","\x61\x64\x64\x50\x6F\x69\x6E\x74","\x63\x72\x65\x61\x74\x65\x42\x65\x6E\x64\x73","\x69\x6E\x69\x74\x42\x65\x6E\x64","\x43\x55\x52\x53\x4F\x52\x5F\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45","\x69\x73\x52\x65\x6D\x6F\x76\x65\x50\x6F\x69\x6E\x74\x45\x76\x65\x6E\x74","\x45\x44\x47\x45\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x45\x44\x47\x45\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x53\x54\x52\x4F\x4B\x45\x57\x49\x44\x54\x48","\x45\x44\x47\x45\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x44\x41\x53\x48\x45\x44","\x69\x73\x48\x61\x6E\x64\x6C\x65\x56\x69\x73\x69\x62\x6C\x65","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x53\x68\x61\x70\x65","\x69\x73\x48\x61\x6E\x64\x6C\x65\x45\x6E\x61\x62\x6C\x65\x64","\x43\x55\x52\x53\x4F\x52\x5F\x42\x45\x4E\x44\x5F\x48\x41\x4E\x44\x4C\x45","\x72\x65\x6D\x6F\x76\x65\x50\x6F\x69\x6E\x74","\x69\x73\x54\x61\x72\x67\x65\x74","\x69\x73\x4C\x61\x62\x65\x6C","\x63\x6C\x6F\x6E\x65\x50\x72\x65\x76\x69\x65\x77\x53\x74\x61\x74\x65","\x67\x65\x74\x53\x6E\x61\x70\x54\x6F\x54\x65\x72\x6D\x69\x6E\x61\x6C\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x67\x65\x74\x50\x72\x65\x76\x69\x65\x77\x54\x65\x72\x6D\x69\x6E\x61\x6C\x53\x74\x61\x74\x65","\x67\x65\x74\x50\x72\x65\x76\x69\x65\x77\x50\x6F\x69\x6E\x74\x73","\x75\x70\x64\x61\x74\x65\x50\x72\x65\x76\x69\x65\x77\x53\x74\x61\x74\x65","\x73\x65\x74\x50\x72\x65\x76\x69\x65\x77\x43\x6F\x6C\x6F\x72","\x6D\x6F\x76\x65\x4C\x61\x62\x65\x6C","\x63\x68\x61\x6E\x67\x65\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x63\x68\x61\x6E\x67\x65\x50\x6F\x69\x6E\x74\x73","\x61\x64\x64\x50\x6F\x69\x6E\x74\x41\x74","\x66\x69\x6E\x64\x4E\x65\x61\x72\x65\x73\x74\x53\x65\x67\x6D\x65\x6E\x74","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x69\x6C\x6C\x43\x6F\x6C\x6F\x72","\x4C\x4F\x43\x4B\x45\x44\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x43\x4F\x4E\x4E\x45\x43\x54\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x72\x65\x64\x72\x61\x77\x49\x6E\x6E\x65\x72\x42\x65\x6E\x64\x73","\x66\x6C\x69\x70\x45\x6E\x61\x62\x6C\x65\x64","\x64\x6F\x75\x62\x6C\x65\x43\x6C\x69\x63\x6B\x4F\x72\x69\x65\x6E\x74\x61\x74\x69\x6F\x6E\x52\x65\x73\x6F\x75\x72\x63\x65","\x64\x6F\x75\x62\x6C\x65\x43\x6C\x69\x63\x6B\x4F\x72\x69\x65\x6E\x74\x61\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x56\x69\x72\x74\x75\x61\x6C\x42\x65\x6E\x64","\x67\x65\x74\x43\x75\x72\x73\x6F\x72\x46\x6F\x72\x42\x65\x6E\x64","\x45\x44\x47\x45\x53\x54\x59\x4C\x45\x5F\x54\x4F\x50\x54\x4F\x42\x4F\x54\x54\x4F\x4D","\x45\x44\x47\x45\x53\x54\x59\x4C\x45\x5F\x45\x4C\x42\x4F\x57","\x72\x6F\x77\x2D\x72\x65\x73\x69\x7A\x65","\x63\x6F\x6C\x2D\x72\x65\x73\x69\x7A\x65","\x6E\x6F\x72\x6D\x61\x6C\x4B\x65\x79\x73","\x73\x68\x69\x66\x74\x4B\x65\x79\x73","\x63\x6F\x6E\x74\x72\x6F\x6C\x4B\x65\x79\x73","\x63\x6F\x6E\x74\x72\x6F\x6C\x53\x68\x69\x66\x74\x4B\x65\x79\x73","\x6B\x65\x79\x44\x6F\x77\x6E","\x62\x69\x6E\x64\x4B\x65\x79","\x62\x69\x6E\x64\x53\x68\x69\x66\x74\x4B\x65\x79","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x4B\x65\x79","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x53\x68\x69\x66\x74\x4B\x65\x79","\x67\x65\x74\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x69\x73\x47\x72\x61\x70\x68\x45\x76\x65\x6E\x74","\x68\x69\x64\x65\x4F\x6E\x48\x6F\x76\x65\x72","\x73\x65\x74\x48\x69\x64\x65\x4F\x6E\x48\x6F\x76\x65\x72","\x6D\x78\x54\x6F\x6F\x6C\x74\x69\x70","\x68\x69\x64\x65\x54\x6F\x6F\x6C\x74\x69\x70","\x73\x74\x61\x74\x65\x53\x6F\x75\x72\x63\x65","\x72\x65\x73\x65\x74\x54\x69\x6D\x65\x72","\x48\x49\x47\x48\x4C\x49\x47\x48\x54\x5F\x53\x54\x52\x4F\x4B\x45\x57\x49\x44\x54\x48","\x72\x65\x70\x61\x69\x6E\x74\x48\x61\x6E\x64\x6C\x65\x72","\x6B\x65\x65\x70\x4F\x6E\x54\x6F\x70","\x64\x72\x61\x77\x48\x69\x67\x68\x6C\x69\x67\x68\x74","\x65\x64\x69\x74\x6F\x72","\x68\x69\x64\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73","\x62\x69\x6E\x64\x41\x63\x74\x69\x6F\x6E","\x63\x6F\x6E\x66\x69\x67","\x63\x72\x65\x61\x74\x65\x4D\x65\x6E\x75","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x61\x64\x64\x49\x74\x65\x6D\x73","\x69\x66","\x61\x73","\x69\x63\x6F\x6E\x43\x6C\x73","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E","\x73\x65\x70\x61\x72\x61\x74\x6F\x72","\x6E\x6F\x63\x65\x6C\x6C","\x6E\x63\x65\x6C\x6C\x73","\x6E\x6F\x74\x52\x6F\x6F\x74","\x6E\x6F\x6E\x45\x6D\x70\x74\x79","\x65\x78\x70\x61\x6E\x64\x61\x62\x6C\x65","\x63\x6F\x6C\x6C\x61\x70\x73\x61\x62\x6C\x65","\x76\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x65\x6D\x70\x74\x79\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x74\x6F\x6F\x6C\x62\x61\x72","\x69\x6E\x73\x65\x72\x74\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x2F\x73\x65\x70\x61\x72\x61\x74\x6F\x72\x2E\x67\x69\x66","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E\x4F\x70\x74\x69\x6F\x6E","\x73\x65\x74\x4D\x6F\x64\x65","\x61\x64\x64\x50\x72\x6F\x74\x6F\x74\x79\x70\x65","\x69\x6E\x73\x74\x61\x6C\x6C\x44\x72\x6F\x70\x48\x61\x6E\x64\x6C\x65\x72","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x46\x6C\x6F\x77","\x6D\x61\x6B\x65\x44\x72\x61\x67\x67\x61\x62\x6C\x65","\x61\x63\x74\x69\x6F\x6E\x73","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E\x73","\x63\x79\x63\x6C\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x56\x61\x6C\x75\x65\x73","\x70\x6F\x70\x75\x70\x48\x61\x6E\x64\x6C\x65\x72","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x63\x72\x65\x61\x74\x65\x47\x72\x61\x70\x68","\x63\x72\x65\x61\x74\x65\x54\x6F\x6F\x6C\x62\x61\x72","\x6B\x65\x79\x48\x61\x6E\x64\x6C\x65\x72","\x63\x6F\x6E\x66\x69\x67\x75\x72\x65","\x63\x79\x63\x6C\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x4E\x61\x6D\x65","\x49\x53\x5F\x4C\x4F\x43\x41\x4C","\x63\x72\x65\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x2F\x72\x65\x73\x6F\x75\x72\x63\x65\x73\x2F\x65\x64\x69\x74\x6F\x72","\x61\x73\x6B\x5A\x6F\x6F\x6D\x52\x65\x73\x6F\x75\x72\x63\x65","\x61\x73\x6B\x5A\x6F\x6F\x6D","\x6C\x61\x73\x74\x53\x61\x76\x65\x64\x52\x65\x73\x6F\x75\x72\x63\x65","\x6C\x61\x73\x74\x53\x61\x76\x65\x64","\x63\x75\x72\x72\x65\x6E\x74\x46\x69\x6C\x65\x52\x65\x73\x6F\x75\x72\x63\x65","\x63\x75\x72\x72\x65\x6E\x74\x46\x69\x6C\x65","\x70\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x52\x65\x73\x6F\x75\x72\x63\x65","\x74\x61\x73\x6B\x73\x52\x65\x73\x6F\x75\x72\x63\x65","\x74\x61\x73\x6B\x73","\x68\x65\x6C\x70\x52\x65\x73\x6F\x75\x72\x63\x65","\x6F\x75\x74\x6C\x69\x6E\x65\x52\x65\x73\x6F\x75\x72\x63\x65","\x64\x62\x6C\x43\x6C\x69\x63\x6B\x41\x63\x74\x69\x6F\x6E","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x52\x65\x71\x75\x69\x72\x65\x64","\x66\x6F\x72\x63\x65\x64\x49\x6E\x73\x65\x72\x74\x69\x6E\x67","\x74\x65\x6D\x70\x6C\x61\x74\x65\x73","\x64\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x64\x65\x66\x61\x75\x6C\x74\x47\x72\x6F\x75\x70","\x67\x72\x6F\x75\x70\x42\x6F\x72\x64\x65\x72\x53\x69\x7A\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x70\x6F\x73\x74\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x4E\x61\x6D\x65","\x75\x72\x6C\x50\x6F\x73\x74","\x75\x72\x6C\x49\x6D\x61\x67\x65","\x6C\x61\x79\x6F\x75\x74\x44\x69\x61\x67\x72\x61\x6D","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x53\x70\x61\x63\x69\x6E\x67","\x6D\x61\x69\x6E\x74\x61\x69\x6E\x53\x77\x69\x6D\x6C\x61\x6E\x65\x73","\x6C\x61\x79\x6F\x75\x74\x53\x77\x69\x6D\x6C\x61\x6E\x65\x73","\x63\x79\x63\x6C\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x49\x6E\x64\x65\x78","\x74\x61\x73\x6B\x73\x57\x69\x6E\x64\x6F\x77\x49\x6D\x61\x67\x65","\x74\x61\x73\x6B\x73\x54\x6F\x70","\x68\x65\x6C\x70\x57\x69\x6E\x64\x6F\x77\x49\x6D\x61\x67\x65","\x75\x72\x6C\x48\x65\x6C\x70","\x68\x65\x6C\x70\x57\x69\x64\x74\x68","\x68\x65\x6C\x70\x48\x65\x69\x67\x68\x74","\x70\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x57\x69\x64\x74\x68","\x70\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x48\x65\x69\x67\x68\x74","\x6D\x6F\x76\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x44\x69\x61\x6C\x6F\x67","\x76\x61\x6C\x69\x64\x61\x74\x69\x6E\x67","\x65\x78\x70\x6F\x72\x74\x49\x6D\x61\x67\x65","\x67\x65\x74\x55\x72\x6C\x49\x6D\x61\x67\x65","\x67\x65\x74\x56\x69\x65\x77\x58\x6D\x6C","\x5F\x62\x6C\x61\x6E\x6B","\x63\x75\x74","\x70\x61\x73\x74\x65","\x64\x65\x6C\x65\x74\x65","\x75\x6E\x67\x72\x6F\x75\x70","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x73\x68\x6F\x77\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73","\x73\x65\x6C\x65\x63\x74\x4E\x6F\x6E\x65","\x74\x6F\x42\x61\x63\x6B","\x74\x6F\x46\x72\x6F\x6E\x74","\x73\x65\x6C\x65\x63\x74\x50\x72\x65\x76\x69\x6F\x75\x73","\x73\x65\x6C\x65\x63\x74\x4E\x65\x78\x74","\x73\x65\x6C\x65\x63\x74\x50\x61\x72\x65\x6E\x74","\x73\x65\x6C\x65\x63\x74\x43\x68\x69\x6C\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65\x41\x6C\x6C","\x65\x78\x70\x61\x6E\x64","\x65\x78\x70\x61\x6E\x64\x41\x6C\x6C","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x4C\x65\x66\x74","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x43\x65\x6E\x74\x65\x72","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x52\x69\x67\x68\x74","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x54\x6F\x70","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x4D\x69\x64\x64\x6C\x65","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73\x42\x6F\x74\x74\x6F\x6D","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x4C\x65\x66\x74","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x43\x65\x6E\x74\x65\x72","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x52\x69\x67\x68\x74","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x54\x6F\x70","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x4D\x69\x64\x64\x6C\x65","\x61\x6C\x69\x67\x6E\x46\x6F\x6E\x74\x42\x6F\x74\x74\x6F\x6D","\x70\x72\x6F\x6D\x70\x74","\x74\x6F\x67\x67\x6C\x65\x54\x61\x73\x6B\x73","\x73\x68\x6F\x77\x54\x61\x73\x6B\x73","\x74\x6F\x67\x67\x6C\x65\x48\x65\x6C\x70","\x73\x68\x6F\x77\x48\x65\x6C\x70","\x74\x6F\x67\x67\x6C\x65\x4F\x75\x74\x6C\x69\x6E\x65","\x73\x68\x6F\x77\x4F\x75\x74\x6C\x69\x6E\x65","\x74\x6F\x67\x67\x6C\x65\x43\x6F\x6E\x73\x6F\x6C\x65","\x72\x65\x73\x65\x74\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x73\x65\x74\x46\x69\x72\x73\x74\x54\x69\x6D\x65","\x63\x6F\x6F\x6B\x69\x65","\x6D\x78\x67\x72\x61\x70\x68\x3D\x73\x65\x65\x6E\x3B\x20\x65\x78\x70\x69\x72\x65\x73\x3D\x46\x72\x69\x2C\x20\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x30\x31\x20\x30\x32\x3A\x34\x37\x3A\x31\x31\x20\x55\x54\x43\x3B\x20\x70\x61\x74\x68\x3D\x2F","\x43\x61\x6E\x6E\x6F\x74\x20\x65\x78\x65\x63\x75\x74\x65\x20","\x3A\x20","\x43\x61\x6E\x6E\x6F\x74\x20\x66\x69\x6E\x64\x20\x61\x63\x74\x69\x6F\x6E\x20","\x61\x64\x64\x54\x65\x6D\x70\x6C\x61\x74\x65","\x67\x65\x74\x54\x65\x6D\x70\x6C\x61\x74\x65","\x69\x6E\x73\x74\x61\x6C\x6C\x44\x62\x6C\x43\x6C\x69\x63\x6B\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x55\x6E\x64\x6F\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x44\x72\x69\x6C\x6C\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x43\x68\x61\x6E\x67\x65\x48\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x73\x74\x61\x6C\x6C\x49\x6E\x73\x65\x72\x74\x48\x61\x6E\x64\x6C\x65\x72","\x63\x72\x65\x61\x74\x65\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x63\x72\x65\x61\x74\x65\x53\x77\x69\x6D\x6C\x61\x6E\x65\x4D\x61\x6E\x61\x67\x65\x72","\x63\x72\x65\x61\x74\x65\x4C\x61\x79\x6F\x75\x74\x4D\x61\x6E\x61\x67\x65\x72","\x73\x77\x69\x6D\x6C\x61\x6E\x65\x4C\x61\x79\x6F\x75\x74","\x63\x72\x65\x61\x74\x65\x53\x77\x69\x6D\x6C\x61\x6E\x65\x4C\x61\x79\x6F\x75\x74","\x64\x69\x61\x67\x72\x61\x6D\x4C\x61\x79\x6F\x75\x74","\x63\x72\x65\x61\x74\x65\x44\x69\x61\x67\x72\x61\x6D\x4C\x61\x79\x6F\x75\x74","\x73\x65\x74\x47\x72\x61\x70\x68\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x72\x75\x62\x62\x65\x72\x62\x61\x6E\x64","\x73\x65\x74\x54\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x65\x74\x53\x74\x61\x74\x75\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x74\x6F\x4C\x6F\x63\x61\x6C\x65\x53\x74\x72\x69\x6E\x67","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x65\x74\x54\x69\x74\x6C\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x74\x54\x69\x74\x6C\x65","\x74\x72\x65\x65\x4C\x61\x79\x6F\x75\x74","\x20\x3E\x20","\x67\x65\x74\x52\x6F\x6F\x74\x54\x69\x74\x6C\x65","\x63\x72\x65\x61\x74\x65\x47\x72\x6F\x75\x70","\x72\x65\x61\x64\x47\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C","\x67\x65\x74\x55\x72\x6C\x50\x6F\x73\x74","\x77\x72\x69\x74\x65\x47\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C","\x70\x6F\x73\x74\x44\x69\x61\x67\x72\x61\x6D","\x73\x77\x61\x70\x53\x74\x79\x6C\x65\x73","\x63\x72\x65\x61\x74\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73","\x69\x73\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x56\x69\x73\x69\x62\x6C\x65","\x72\x65\x61\x64\x6F\x6E\x6C\x79","\x49\x44","\x53\x74\x79\x6C\x65","\x63\x72\x65\x61\x74\x65\x54\x61\x73\x6B\x73","\x72\x65\x66\x72\x65\x73\x68\x54\x61\x73\x6B\x73","\x66\x72\x61\x6D\x65\x42\x6F\x72\x64\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65\x43\x79\x63\x6C\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x79\x63\x6C\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x69\x73\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x65\x64\x4D\x6F\x76\x69\x6E\x67","\x63\x6F\x64\x65\x63\x73","\x74\x65\x6D\x70\x6C\x61\x74\x65","\x61\x64\x64\x41\x6C\x69\x61\x73","\x61\x6C\x69\x61\x73\x65\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x65\x6E\x63\x6F\x64\x65\x44\x65\x66\x61\x75\x6C\x74\x73","\x67\x65\x74\x4F\x62\x6A\x65\x63\x74","\x72\x65\x66\x65\x72\x65\x6E\x63\x65","\x67\x65\x74\x43\x6F\x64\x65\x63","\x69\x6D\x70\x6F\x72\x74\x4E\x6F\x64\x65","\x6D\x78\x43\x6F\x64\x65\x63\x2E\x65\x6E\x63\x6F\x64\x65\x3A\x20\x4E\x6F\x20\x63\x6F\x64\x65\x63\x20\x66\x6F\x72\x20","\x43\x61\x6E\x6E\x6F\x74\x20\x64\x65\x63\x6F\x64\x65\x20","\x65\x6E\x63\x6F\x64\x65\x43\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x64\x65\x63","\x64\x65\x63\x6F\x64\x65\x43\x65\x6C\x6C","\x69\x6E\x73\x65\x72\x74\x49\x6E\x74\x6F\x47\x72\x61\x70\x68","\x65\x78\x63\x6C\x75\x64\x65","\x69\x64\x72\x65\x66\x73","\x6D\x61\x70\x70\x69\x6E\x67","\x72\x65\x76\x65\x72\x73\x65","\x63\x6C\x6F\x6E\x65\x54\x65\x6D\x70\x6C\x61\x74\x65","\x67\x65\x74\x46\x69\x65\x6C\x64\x4E\x61\x6D\x65","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65\x4E\x61\x6D\x65","\x69\x73\x45\x78\x63\x6C\x75\x64\x65\x64","\x69\x73\x52\x65\x66\x65\x72\x65\x6E\x63\x65","\x62\x65\x66\x6F\x72\x65\x45\x6E\x63\x6F\x64\x65","\x65\x6E\x63\x6F\x64\x65\x4F\x62\x6A\x65\x63\x74","\x61\x66\x74\x65\x72\x45\x6E\x63\x6F\x64\x65","\x65\x6E\x63\x6F\x64\x65\x56\x61\x6C\x75\x65","\x6D\x78\x4F\x62\x6A\x65\x63\x74\x43\x6F\x64\x65\x63\x2E\x65\x6E\x63\x6F\x64\x65\x3A\x20\x4E\x6F\x20\x49\x44\x20\x66\x6F\x72\x20","\x77\x72\x69\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x77\x72\x69\x74\x65\x50\x72\x69\x6D\x69\x74\x69\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x77\x72\x69\x74\x65\x43\x6F\x6D\x70\x6C\x65\x78\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x6F\x6E\x76\x65\x72\x74\x56\x61\x6C\x75\x65\x54\x6F\x58\x6D\x6C","\x6D\x78\x4F\x62\x6A\x65\x63\x74\x43\x6F\x64\x65\x63\x2E\x65\x6E\x63\x6F\x64\x65\x3A\x20\x4E\x6F\x20\x6E\x6F\x64\x65\x20\x66\x6F\x72\x20","\x63\x6F\x6E\x76\x65\x72\x74\x56\x61\x6C\x75\x65\x46\x72\x6F\x6D\x58\x6D\x6C","\x62\x65\x66\x6F\x72\x65\x44\x65\x63\x6F\x64\x65","\x64\x65\x63\x6F\x64\x65\x4E\x6F\x64\x65","\x61\x66\x74\x65\x72\x44\x65\x63\x6F\x64\x65","\x64\x65\x63\x6F\x64\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x63\x6F\x64\x65\x43\x68\x69\x6C\x64\x72\x65\x6E","\x64\x65\x63\x6F\x64\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6D\x78\x4F\x62\x6A\x65\x63\x74\x43\x6F\x64\x65\x63\x2E\x64\x65\x63\x6F\x64\x65\x3A\x20\x4E\x6F\x20\x6F\x62\x6A\x65\x63\x74\x20\x66\x6F\x72\x20","\x70\x72\x6F\x63\x65\x73\x73\x49\x6E\x63\x6C\x75\x64\x65","\x64\x65\x63\x6F\x64\x65\x43\x68\x69\x6C\x64","\x67\x65\x74\x46\x69\x65\x6C\x64\x54\x65\x6D\x70\x6C\x61\x74\x65","\x61\x64\x64\x4F\x62\x6A\x65\x63\x74\x56\x61\x6C\x75\x65","\x69\x6E\x63\x6C\x75\x64\x65","\x72\x65\x6D\x6F\x76\x65\x57\x68\x69\x74\x65\x73\x70\x61\x63\x65","\x64\x65\x63\x6F\x64\x65\x52\x6F\x6F\x74","\x67\x72\x61\x70\x68\x4C\x69\x73\x74\x65\x6E\x65\x72\x73\x20\x65\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72\x73\x20\x76\x69\x65\x77\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72\x20\x65\x64\x69\x74\x6F\x72\x20\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x6C\x61\x79\x65\x72","\x67\x65\x74\x53\x74\x72\x69\x6E\x67\x56\x61\x6C\x75\x65","\x6D\x78\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74\x43\x6F\x64\x65\x63\x2E\x64\x65\x63\x6F\x64\x65\x3A\x20\x73\x74\x79\x6C\x65\x73\x68\x65\x65\x74\x20","\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x74\x6F\x20\x65\x78\x74\x65\x6E\x64","\x70\x72\x65\x73\x73\x65\x64\x49\x63\x6F\x6E","\x6D\x6F\x64\x65","\x74\x6F\x67\x67\x6C\x65","\x2D\x2D\x2D","\x63\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x54\x65\x6D\x70\x6C\x61\x74\x65\x20","\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x6D\x6F\x64\x69\x66\x69\x65\x64\x20\x6C\x61\x73\x74\x53\x6E\x61\x70\x73\x68\x6F\x74\x20\x69\x67\x6E\x6F\x72\x65\x64\x43\x68\x61\x6E\x67\x65\x73\x20\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72\x20\x67\x72\x61\x70\x68\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x74\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x41\x72\x72\x61\x79","\x64\x65\x63\x6F\x64\x65\x54\x65\x6D\x70\x6C\x61\x74\x65\x73","\x75\x69","\x64\x65\x63\x6F\x64\x65\x55\x69","\x73\x65\x74\x4D\x61\x70\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x72\x65\x73\x6F\x75\x72\x63\x65","\x62\x61\x73\x65\x6E\x61\x6D\x65"];var mxClient={VERSION:_0xe4bc[0],IS_IE:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[1]),IS_IE6:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[4]),IS_QUIRKS:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[1])&&(null==document[_0xe4bc[5]]||5==document[_0xe4bc[5]]),VML_PREFIX:_0xe4bc[6],OFFICE_PREFIX:_0xe4bc[7],IS_NS:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[8])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[1]),IS_OP:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[9]),IS_OT:0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[10])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[11])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[12])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[13])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[14])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[15]),IS_SF:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[16])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[17]),IS_GC:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[17]),IS_MT:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[18])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[19])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[20])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[21])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[22])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[23])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[24])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[25])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[26])&&0>navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[27]),IS_SVG:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[18])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[21])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[28])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[26])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[29])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[30])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[16])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[31])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[9]),NO_FO:0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[19])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[22])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[20])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[23])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[25])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[27])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[32])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[33])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[9])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[1])||0<=navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[34]),IS_VML:_0xe4bc[35]==navigator[_0xe4bc[37]][_0xe4bc[36]](),IS_MAC:0document[_0xe4bc[45]][_0xe4bc[44]][_0xe4bc[2]](_0xe4bc[43])&&0>document[_0xe4bc[45]][_0xe4bc[44]][_0xe4bc[2]](_0xe4bc[46]),isBrowserSupported:function(){return mxClient[_0xe4bc[47]]||mxClient[_0xe4bc[48]]},link:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=_0x5d2ax4||document;if(mxClient[_0xe4bc[49]]){_0x5d2ax4[_0xe4bc[53]](_0xe4bc[50]+_0x5d2ax2+_0xe4bc[51]+_0x5d2ax3+_0xe4bc[52])}else {var _0x5d2ax5=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[54]);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[56],_0x5d2ax2);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[44],_0x5d2ax3);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[58],_0xe4bc[59]);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[60],_0xe4bc[61]);_0x5d2ax4[_0xe4bc[64]](_0xe4bc[63])[0][_0xe4bc[62]](_0x5d2ax5)}},include:function(_0x5d2ax2){document[_0xe4bc[53]](_0xe4bc[65]+_0x5d2ax2+_0xe4bc[66])},dispose:function(){for(var _0x5d2ax2=0;_0x5d2ax2_0x5d2ax5&&_0x5d2ax12?(_0x5d2ax5++,window[_0xe4bc[261]](_0x5d2ax9,_0x5d2axa)):null!=_0x5d2ax4&&_0x5d2ax4()},_0x5d2axa=30;_0x5d2ax9()},cascadeOpacity:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax3),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5;_0x5d2ax9++){var _0x5d2axa=_0x5d2ax2[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax3,_0x5d2ax9),_0x5d2ax12=_0x5d2ax2[_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2axa);null!=_0x5d2ax12&&(mxUtils[_0xe4bc[254]](_0x5d2ax12[_0xe4bc[253]][_0xe4bc[252]],_0x5d2ax4),mxEffects[_0xe4bc[260]](_0x5d2ax2,_0x5d2axa,_0x5d2ax4))};_0x5d2ax3=_0x5d2ax2[_0xe4bc[251]][_0xe4bc[264]](_0x5d2ax3);if(null!=_0x5d2ax3){for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax5=_0x5d2ax2[_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax3[_0x5d2ax9]),null!=_0x5d2ax5&&mxUtils[_0xe4bc[254]](_0x5d2ax5[_0xe4bc[253]][_0xe4bc[252]],_0x5d2ax4)}}},fadeOut:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax5=_0x5d2ax5||40;_0x5d2ax9=_0x5d2ax9||30;var _0x5d2ax12=_0x5d2ax3||100;mxUtils[_0xe4bc[254]](_0x5d2ax2,_0x5d2ax12);if(_0x5d2axa||null==_0x5d2axa){var _0x5d2ax13=function(){_0x5d2ax12=Math[_0xe4bc[160]](_0x5d2ax12-_0x5d2ax5,0);mxUtils[_0xe4bc[254]](_0x5d2ax2,_0x5d2ax12);0<_0x5d2ax12?window[_0xe4bc[261]](_0x5d2ax13,_0x5d2ax9):(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188],_0x5d2ax4&&_0x5d2ax2[_0xe4bc[265]]&&_0x5d2ax2[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax2))};window[_0xe4bc[261]](_0x5d2ax13,_0x5d2ax9)}else {_0x5d2ax2[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188],_0x5d2ax4&&_0x5d2ax2[_0xe4bc[265]]&&_0x5d2ax2[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax2)}}},mxUtils={errorResource:_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[267]:_0xe4bc[110],closeResource:_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[268]:_0xe4bc[110],errorImage:mxClient[_0xe4bc[88]]+_0xe4bc[269],removeCursors:function(_0x5d2ax2){null!=_0x5d2ax2[_0xe4bc[124]]&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[110]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[271]];if(null!=_0x5d2ax2){for(var _0x5d2ax3=_0x5d2ax2[_0xe4bc[67]],_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3;_0x5d2ax4+=1){mxUtils[_0xe4bc[272]](_0x5d2ax2[_0x5d2ax4])}}},getCurrentStyle:function(){return mxClient[_0xe4bc[80]]?function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[273]]:null}:function(_0x5d2ax2){return null!=_0x5d2ax2?window[_0xe4bc[274]](_0x5d2ax2,_0xe4bc[110]):null}}(),hasScrollbars:function(_0x5d2ax2){_0x5d2ax2=mxUtils[_0xe4bc[275]](_0x5d2ax2);return null!=_0x5d2ax2&&(_0xe4bc[276]==_0x5d2ax2[_0xe4bc[277]]||_0xe4bc[278]==_0x5d2ax2[_0xe4bc[277]])},bind:function(_0x5d2ax2,_0x5d2ax3){return function(){return _0x5d2ax3[_0xe4bc[183]](_0x5d2ax2,arguments)}},eval:function(_0x5d2ax2){var _0x5d2ax3=null;if(0<=_0x5d2ax2[_0xe4bc[2]](_0xe4bc[279])){try{eval(_0xe4bc[280]+_0x5d2ax2),_0x5d2ax3=_mxJavaScriptExpression,_mxJavaScriptExpression=null}catch(c){mxLog[_0xe4bc[283]](c[_0xe4bc[281]]+_0xe4bc[282]+_0x5d2ax2)}}else {try{_0x5d2ax3=eval(_0x5d2ax2)}catch(d){mxLog[_0xe4bc[283]](d[_0xe4bc[281]]+_0xe4bc[282]+_0x5d2ax2)}};return _0x5d2ax3},findNode:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax2[_0xe4bc[284]](_0x5d2ax3);if(null!=_0x5d2ax5&&_0x5d2ax5==_0x5d2ax4){return _0x5d2ax2};for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax2;){_0x5d2ax5=mxUtils[_0xe4bc[286]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4);if(null!=_0x5d2ax5){return _0x5d2ax5};_0x5d2ax2=_0x5d2ax2[_0xe4bc[287]]};return null},findNodeByAttribute:function(){return 9<=document[_0xe4bc[5]]?function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=null;if(null!=_0x5d2ax2){if(_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]&&_0x5d2ax2[_0xe4bc[284]](_0x5d2ax3)==_0x5d2ax4){_0x5d2ax5=_0x5d2ax2}else {for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax2&&null==_0x5d2ax5;){_0x5d2ax5=mxUtils[_0xe4bc[290]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4),_0x5d2ax2=_0x5d2ax2[_0xe4bc[287]]}}};return _0x5d2ax5}:mxClient[_0xe4bc[80]]?function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return null==_0x5d2ax2?null:_0x5d2ax2[_0xe4bc[295]][_0xe4bc[294]](_0xe4bc[291]+_0x5d2ax3+_0xe4bc[292]+_0x5d2ax4+_0xe4bc[293])}:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return null==_0x5d2ax2?null:_0x5d2ax2[_0xe4bc[295]][_0xe4bc[297]](_0xe4bc[291]+_0x5d2ax3+_0xe4bc[292]+_0x5d2ax4+_0xe4bc[293],_0x5d2ax2[_0xe4bc[295]],null,XPathResult.ANY_TYPE,null)[_0xe4bc[296]]()}}(),getFunctionName:function(_0x5d2ax2){var _0x5d2ax3=null;if(null!=_0x5d2ax2){if(null!=_0x5d2ax2[_0xe4bc[298]]){_0x5d2ax3=_0x5d2ax2[_0xe4bc[298]]}else {_0x5d2ax2=_0x5d2ax2.toString();for(_0x5d2ax3=9;_0xe4bc[185]==_0x5d2ax2[_0xe4bc[225]](_0x5d2ax3);){_0x5d2ax3++};var _0x5d2ax4=_0x5d2ax2[_0xe4bc[2]](_0xe4bc[299],_0x5d2ax3),_0x5d2ax3=_0x5d2ax2[_0xe4bc[85]](_0x5d2ax3,_0x5d2ax4)}};return _0x5d2ax3},indexOf:function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2&&null!=_0x5d2ax3){for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){if(_0x5d2ax2[_0x5d2ax4]==_0x5d2ax3){return _0x5d2ax4}}};return -1},remove:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=null;if(_0xe4bc[194]== typeof _0x5d2ax3){for(var _0x5d2ax5=mxUtils[_0xe4bc[2]](_0x5d2ax3,_0x5d2ax2);0<=_0x5d2ax5;){_0x5d2ax3[_0xe4bc[300]](_0x5d2ax5,1),_0x5d2ax4=_0x5d2ax2,_0x5d2ax5=mxUtils[_0xe4bc[2]](_0x5d2ax3,_0x5d2ax2)}};for(var _0x5d2ax9 in _0x5d2ax3){_0x5d2ax3[_0x5d2ax9]==_0x5d2ax2&&( delete _0x5d2ax3[_0x5d2ax9],_0x5d2ax4=_0x5d2ax2)};return _0x5d2ax4},isNode:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return null!=_0x5d2ax2&&!isNaN(_0x5d2ax2[_0xe4bc[288]])&&(null==_0x5d2ax3||_0x5d2ax2[_0xe4bc[301]][_0xe4bc[216]]()==_0x5d2ax3[_0xe4bc[216]]())?null==_0x5d2ax4||_0x5d2ax2[_0xe4bc[284]](_0x5d2ax4)==_0x5d2ax5:!1},getChildNodes:function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=_0x5d2ax3||mxConstants[_0xe4bc[289]];for(var _0x5d2ax4=[],_0x5d2ax5=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax5;){_0x5d2ax5[_0xe4bc[288]]==_0x5d2ax3&&_0x5d2ax4[_0xe4bc[207]](_0x5d2ax5),_0x5d2ax5=_0x5d2ax5[_0xe4bc[287]]};return _0x5d2ax4},createXmlDocument:function(){var _0x5d2ax2=null;document[_0xe4bc[302]]&&document[_0xe4bc[302]][_0xe4bc[303]]?_0x5d2ax2=document[_0xe4bc[302]][_0xe4bc[303]](_0xe4bc[110],_0xe4bc[110],null):window[_0xe4bc[304]]&&(_0x5d2ax2= new ActiveXObject(_0xe4bc[305]));return _0x5d2ax2},parseXml:function(){return mxClient[_0xe4bc[80]]&&(_0xe4bc[82]=== typeof document[_0xe4bc[5]]||9>document[_0xe4bc[5]])?function(_0x5d2ax2){var _0x5d2ax3=mxUtils[_0xe4bc[306]]();_0x5d2ax3[_0xe4bc[307]]=_0xe4bc[308];_0x5d2ax3[_0xe4bc[309]](_0x5d2ax2);return _0x5d2ax3}:function(_0x5d2ax2){return ( new DOMParser)[_0xe4bc[311]](_0x5d2ax2,_0xe4bc[310])}}(),clearSelection:function(){if(document[_0xe4bc[312]]){return function(){document[_0xe4bc[312]][_0xe4bc[313]]()}};if(window[_0xe4bc[314]]){return function(){window[_0xe4bc[314]]()[_0xe4bc[315]]()}}}(),getPrettyXml:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=[];if(null!=_0x5d2ax2){if(_0x5d2ax3=_0x5d2ax3||_0xe4bc[316],_0x5d2ax4=_0x5d2ax4||_0xe4bc[110],_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[317]]){_0x5d2ax5[_0xe4bc[207]](_0x5d2ax2[_0xe4bc[318]])}else {_0x5d2ax5[_0xe4bc[207]](_0x5d2ax4+_0xe4bc[319]+_0x5d2ax2[_0xe4bc[301]]);var _0x5d2ax9=_0x5d2ax2[_0xe4bc[320]];if(null!=_0x5d2ax9){for(var _0x5d2axa=0;_0x5d2axa<_0x5d2ax9[_0xe4bc[67]];_0x5d2axa++){var _0x5d2ax12=mxUtils[_0xe4bc[321]](_0x5d2ax9[_0x5d2axa][_0xe4bc[318]]);_0x5d2ax5[_0xe4bc[207]](_0xe4bc[185]+_0x5d2ax9[_0x5d2axa][_0xe4bc[301]]+_0xe4bc[322]+_0x5d2ax12+_0xe4bc[323])}};_0x5d2ax9=_0x5d2ax2[_0xe4bc[285]];if(null!=_0x5d2ax9){for(_0x5d2ax5[_0xe4bc[207]](_0xe4bc[324]);null!=_0x5d2ax9;){_0x5d2ax5[_0xe4bc[207]](mxUtils[_0xe4bc[325]](_0x5d2ax9,_0x5d2ax3,_0x5d2ax4+_0x5d2ax3)),_0x5d2ax9=_0x5d2ax9[_0xe4bc[287]]};_0x5d2ax5[_0xe4bc[207]](_0x5d2ax4+_0xe4bc[326]+_0x5d2ax2[_0xe4bc[301]]+_0xe4bc[324])}else {_0x5d2ax5[_0xe4bc[207]](_0xe4bc[327])}}};return _0x5d2ax5[_0xe4bc[234]](_0xe4bc[110])},removeWhitespace:function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=_0x5d2ax3?_0x5d2ax2[_0xe4bc[328]]:_0x5d2ax2[_0xe4bc[287]];null!=_0x5d2ax4&&_0x5d2ax4[_0xe4bc[288]]==mxConstants[_0xe4bc[317]];){var _0x5d2ax5=_0x5d2ax3?_0x5d2ax4[_0xe4bc[328]]:_0x5d2ax4[_0xe4bc[287]],_0x5d2ax9=mxUtils[_0xe4bc[329]](_0x5d2ax4);0==mxUtils[_0xe4bc[330]](_0x5d2ax9)[_0xe4bc[67]]&&_0x5d2ax4[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax4);_0x5d2ax4=_0x5d2ax5}},htmlEntities:function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2=(_0x5d2ax2||_0xe4bc[110])[_0xe4bc[230]](/&/g,_0xe4bc[331]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[230]](/"/g,_0xe4bc[332]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[230]](/\'/g,_0xe4bc[333]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[230]](//g,_0xe4bc[335]);if(null==_0x5d2ax3||_0x5d2ax3){_0x5d2ax2=_0x5d2ax2[_0xe4bc[230]](/\n/g,_0xe4bc[336])};return _0x5d2ax2},isVml:function(_0x5d2ax2){return null!=_0x5d2ax2&&_0xe4bc[97]==_0x5d2ax2[_0xe4bc[337]]},getXml:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0xe4bc[110];null!=_0x5d2ax2&&(_0x5d2ax4=_0x5d2ax2[_0xe4bc[338]],_0x5d2ax4=null==_0x5d2ax4?_0x5d2ax2[_0xe4bc[339]]?_0x5d2ax2[_0xe4bc[339]]:( new XMLSerializer)[_0xe4bc[340]](_0x5d2ax2):_0x5d2ax4[_0xe4bc[230]](/\r\n\t[\t]*/g,_0xe4bc[110])[_0xe4bc[230]](/>\r\n/g,_0xe4bc[341])[_0xe4bc[230]](/\r\n/g,_0xe4bc[192]));return _0x5d2ax4=_0x5d2ax4[_0xe4bc[230]](/\n/g,_0x5d2ax3||_0xe4bc[336])},getTextContent:function(_0x5d2ax2){var _0x5d2ax3=_0xe4bc[110];null!=_0x5d2ax2&&(null!=_0x5d2ax2[_0xe4bc[285]]&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]]),_0x5d2ax3=_0x5d2ax2[_0xe4bc[318]]||_0xe4bc[110]);return _0x5d2ax3},getInnerHtml:function(){return mxClient[_0xe4bc[80]]?function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[339]]:_0xe4bc[110]}:function(_0x5d2ax2){return null!=_0x5d2ax2?( new XMLSerializer)[_0xe4bc[340]](_0x5d2ax2):_0xe4bc[110]}}(),getOuterHtml:function(){return mxClient[_0xe4bc[80]]?function(_0x5d2ax2){if(null!=_0x5d2ax2){if(null!=_0x5d2ax2[_0xe4bc[342]]){return _0x5d2ax2[_0xe4bc[342]]};var _0x5d2ax3=[];_0x5d2ax3[_0xe4bc[207]](_0xe4bc[319]+_0x5d2ax2[_0xe4bc[301]]);var _0x5d2ax4=_0x5d2ax2[_0xe4bc[320]];if(null!=_0x5d2ax4){for(var _0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){var _0x5d2ax9=_0x5d2ax4[_0x5d2ax5][_0xe4bc[318]];null!=_0x5d2ax9&&0<_0x5d2ax9[_0xe4bc[67]]&&(_0x5d2ax3[_0xe4bc[207]](_0xe4bc[185]),_0x5d2ax3[_0xe4bc[207]](_0x5d2ax4[_0x5d2ax5][_0xe4bc[301]]),_0x5d2ax3[_0xe4bc[207]](_0xe4bc[322]),_0x5d2ax3[_0xe4bc[207]](_0x5d2ax9),_0x5d2ax3[_0xe4bc[207]](_0xe4bc[323]))}};0==_0x5d2ax2[_0xe4bc[339]][_0xe4bc[67]]?_0x5d2ax3[_0xe4bc[207]](_0xe4bc[343]):(_0x5d2ax3[_0xe4bc[207]](_0xe4bc[341]),_0x5d2ax3[_0xe4bc[207]](_0x5d2ax2[_0xe4bc[339]]),_0x5d2ax3[_0xe4bc[207]](_0xe4bc[326]+_0x5d2ax2[_0xe4bc[301]]+_0xe4bc[341]));return _0x5d2ax3[_0xe4bc[234]](_0xe4bc[110])};return _0xe4bc[110]}:function(_0x5d2ax2){return null!=_0x5d2ax2?( new XMLSerializer)[_0xe4bc[340]](_0x5d2ax2):_0xe4bc[110]}}(),write:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[295]][_0xe4bc[344]](_0x5d2ax3);null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[62]](_0x5d2ax4);return _0x5d2ax4},writeln:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[295]][_0xe4bc[344]](_0x5d2ax3);null!=_0x5d2ax2&&(_0x5d2ax2[_0xe4bc[62]](_0x5d2ax4),_0x5d2ax2[_0xe4bc[62]](document[_0xe4bc[55]](_0xe4bc[345])));return _0x5d2ax4},br:function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=_0x5d2ax3||1;for(var _0x5d2ax4=null,_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax3;_0x5d2ax5++){null!=_0x5d2ax2&&(_0x5d2ax4=_0x5d2ax2[_0xe4bc[295]][_0xe4bc[55]](_0xe4bc[345]),_0x5d2ax2[_0xe4bc[62]](_0x5d2ax4))};return _0x5d2ax4},button:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:document;_0x5d2ax4=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[172]);mxUtils[_0xe4bc[53]](_0x5d2ax4,_0x5d2ax2);mxEvent[_0xe4bc[169]](_0x5d2ax4,_0xe4bc[173],function(_0x5d2ax2){_0x5d2ax3(_0x5d2ax2)});return _0x5d2ax4},para:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[346]);mxUtils[_0xe4bc[53]](_0x5d2ax4,_0x5d2ax3);null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[62]](_0x5d2ax4);return _0x5d2ax4},addTransparentBackgroundFilter:function(_0x5d2ax2){_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]+=_0xe4bc[348]+mxClient[_0xe4bc[88]]+_0xe4bc[349]},linkAction:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){return mxUtils[_0xe4bc[54]](_0x5d2ax2,_0x5d2ax3,function(){_0x5d2ax4[_0xe4bc[350]](_0x5d2ax5)},_0x5d2ax9)},linkInvoke:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){return mxUtils[_0xe4bc[54]](_0x5d2ax2,_0x5d2ax3,function(){_0x5d2ax4[_0x5d2ax5](_0x5d2ax9)},_0x5d2axa)},link:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[351]);_0x5d2ax9[_0xe4bc[124]][_0xe4bc[352]]=_0xe4bc[353];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[354]]=_0xe4bc[355];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[356];null!=_0x5d2ax5&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[357]]=_0x5d2ax5+_0xe4bc[168]);mxEvent[_0xe4bc[169]](_0x5d2ax9,_0xe4bc[173],_0x5d2ax4);mxUtils[_0xe4bc[53]](_0x5d2ax9,_0x5d2ax3);null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[62]](_0x5d2ax9);return _0x5d2ax9},fit:function(_0x5d2ax2){var _0x5d2ax3=parseInt(_0x5d2ax2[_0xe4bc[358]]),_0x5d2ax4=parseInt(_0x5d2ax2[_0xe4bc[359]]),_0x5d2ax5=document[_0xe4bc[112]],_0x5d2ax9=document[_0xe4bc[158]],_0x5d2axa=(_0x5d2ax5[_0xe4bc[360]]||_0x5d2ax9[_0xe4bc[360]])+(_0x5d2ax5[_0xe4bc[159]]||_0x5d2ax9[_0xe4bc[159]]);_0x5d2ax3+_0x5d2ax4>_0x5d2axa&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[361]]=Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[360]]||_0x5d2ax9[_0xe4bc[360]],_0x5d2axa-_0x5d2ax4)+_0xe4bc[168]);_0x5d2ax3=parseInt(_0x5d2ax2[_0xe4bc[362]]);_0x5d2ax4=parseInt(_0x5d2ax2[_0xe4bc[167]]);_0x5d2axa=(_0x5d2ax5[_0xe4bc[190]]||_0x5d2ax9[_0xe4bc[190]])+Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[157]]||0,_0x5d2ax9[_0xe4bc[157]]);_0x5d2ax3+_0x5d2ax4>_0x5d2axa&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[125]]=Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[190]]||_0x5d2ax9[_0xe4bc[190]],_0x5d2axa-_0x5d2ax4)+_0xe4bc[168])},open:function(_0x5d2ax2){if(mxClient[_0xe4bc[133]]){try{netscape[_0xe4bc[366]][_0xe4bc[365]][_0xe4bc[364]](_0xe4bc[363])}catch(b){return mxUtils[_0xe4bc[150]](_0xe4bc[367]),_0xe4bc[110]};var _0x5d2ax4=Components[_0xe4bc[372]][_0xe4bc[371]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[368]]);_0x5d2ax4[_0xe4bc[373]](_0x5d2ax2);if(!_0x5d2ax4[_0xe4bc[374]]()){return mxUtils[_0xe4bc[150]](_0xe4bc[375]),_0xe4bc[110]};_0x5d2ax2=Components[_0xe4bc[372]][_0xe4bc[377]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[376]]);_0x5d2ax2[_0xe4bc[176]](_0x5d2ax4,1,4,null);_0x5d2ax4=Components[_0xe4bc[372]][_0xe4bc[379]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[378]]);_0x5d2ax4[_0xe4bc[176]](_0x5d2ax2);return _0x5d2ax4[_0xe4bc[381]](_0x5d2ax4[_0xe4bc[380]]())};_0x5d2ax4=( new ActiveXObject(_0xe4bc[382])).OpenTextFile(_0x5d2ax2,1);_0x5d2ax2=_0x5d2ax4[_0xe4bc[383]]();_0x5d2ax4[_0xe4bc[268]]();return _0x5d2ax2},save:function(_0x5d2ax2,_0x5d2ax3){if(mxClient[_0xe4bc[133]]){try{netscape[_0xe4bc[366]][_0xe4bc[365]][_0xe4bc[364]](_0xe4bc[363])}catch(c){mxUtils[_0xe4bc[150]](_0xe4bc[384]);return};var _0x5d2ax5=Components[_0xe4bc[372]][_0xe4bc[371]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[368]]);_0x5d2ax5[_0xe4bc[373]](_0x5d2ax2);_0x5d2ax5[_0xe4bc[374]]()||_0x5d2ax5[_0xe4bc[385]](0,420);var _0x5d2ax9=Components[_0xe4bc[372]][_0xe4bc[387]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[386]]);_0x5d2ax9[_0xe4bc[176]](_0x5d2ax5,34,4,null);_0x5d2ax9[_0xe4bc[53]](_0x5d2ax3,_0x5d2ax3[_0xe4bc[67]]);_0x5d2ax9[_0xe4bc[388]]();_0x5d2ax9[_0xe4bc[268]]()}else {_0x5d2ax5=( new ActiveXObject(_0xe4bc[382])).CreateTextFile(_0x5d2ax2,!0),_0x5d2ax5.Write(_0x5d2ax3),_0x5d2ax5.Close()}},saveAs:function(_0x5d2ax2){var _0x5d2ax3=document[_0xe4bc[55]](_0xe4bc[389]);_0x5d2ax3[_0xe4bc[57]](_0xe4bc[390],_0xe4bc[110]);_0x5d2ax3[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax3);try{if(mxClient[_0xe4bc[133]]){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[391]];_0x5d2ax4[_0xe4bc[392]]();_0x5d2ax4[_0xe4bc[53]](_0x5d2ax2);_0x5d2ax4[_0xe4bc[268]]();try{netscape[_0xe4bc[366]][_0xe4bc[365]][_0xe4bc[364]](_0xe4bc[363]),_0x5d2ax3[_0xe4bc[393]](),saveDocument(_0x5d2ax4)}catch(d){mxUtils[_0xe4bc[150]](_0xe4bc[394])}}else {_0x5d2ax4=_0x5d2ax3[_0xe4bc[396]][_0xe4bc[395]],_0x5d2ax4[_0xe4bc[53]](_0x5d2ax2),_0x5d2ax4[_0xe4bc[398]](_0xe4bc[397],!1,document[_0xe4bc[45]])}}finally{document[_0xe4bc[112]][_0xe4bc[266]](_0x5d2ax3)}},copy:function(_0x5d2ax2){if(window[_0xe4bc[399]]){window[_0xe4bc[399]][_0xe4bc[401]](_0xe4bc[400],_0x5d2ax2)}else {netscape[_0xe4bc[366]][_0xe4bc[365]][_0xe4bc[364]](_0xe4bc[363]);var _0x5d2ax3=Components[_0xe4bc[372]][_0xe4bc[403]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[402]]);if(_0x5d2ax3){var _0x5d2ax4=Components[_0xe4bc[372]][_0xe4bc[405]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[404]]);if(_0x5d2ax4){_0x5d2ax4[_0xe4bc[407]](_0xe4bc[406]);var _0x5d2ax5=Components[_0xe4bc[372]][_0xe4bc[409]][_0xe4bc[370]](Components[_0xe4bc[369]][_0xe4bc[408]]);_0x5d2ax5[_0xe4bc[410]]=_0x5d2ax2;_0x5d2ax4[_0xe4bc[411]](_0xe4bc[406],_0x5d2ax5,2*_0x5d2ax2[_0xe4bc[67]]);_0x5d2ax3[_0xe4bc[401]](_0x5d2ax4,null,Components[_0xe4bc[369]][_0xe4bc[402]][_0xe4bc[412]])}}}},load:function(_0x5d2ax2){_0x5d2ax2= new mxXmlRequest(_0x5d2ax2,null,_0xe4bc[413],!1);_0x5d2ax2[_0xe4bc[414]]();return _0x5d2ax2},get:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return ( new mxXmlRequest(_0x5d2ax2,null,_0xe4bc[413]))[_0xe4bc[414]](_0x5d2ax3,_0x5d2ax4)},post:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return ( new mxXmlRequest(_0x5d2ax2,_0x5d2ax3))[_0xe4bc[414]](_0x5d2ax4,_0x5d2ax5)},submit:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return ( new mxXmlRequest(_0x5d2ax2,_0x5d2ax3))[_0xe4bc[415]](_0x5d2ax4,_0x5d2ax5)},loadInto:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxClient[_0xe4bc[80]]?_0x5d2ax3[_0xe4bc[416]]=function(){4==_0x5d2ax3[_0xe4bc[417]]&&_0x5d2ax4()}:_0x5d2ax3[_0xe4bc[418]](_0xe4bc[219],_0x5d2ax4,!1);_0x5d2ax3[_0xe4bc[219]](_0x5d2ax2)},getValue:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2[_0x5d2ax3]:null;null==_0x5d2ax2&&(_0x5d2ax2=_0x5d2ax4);return _0x5d2ax2},getNumber:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2[_0x5d2ax3]:null;null==_0x5d2ax2&&(_0x5d2ax2=_0x5d2ax4||0);return Number(_0x5d2ax2)},getColor:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2[_0x5d2ax3]:null;null==_0x5d2ax2?_0x5d2ax2=_0x5d2ax4:_0x5d2ax2==mxConstants[_0xe4bc[217]]&&(_0x5d2ax2=null);return _0x5d2ax2},clone:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!1;var _0x5d2ax5=null;if(null!=_0x5d2ax2&&_0xe4bc[279]== typeof _0x5d2ax2[_0xe4bc[196]]){var _0x5d2ax5= new _0x5d2ax2[_0xe4bc[196]],_0x5d2ax9;for(_0x5d2ax9 in _0x5d2ax2){if(_0x5d2ax9!=mxObjectIdentity[_0xe4bc[195]]&&(null==_0x5d2ax3||0>mxUtils[_0xe4bc[2]](_0x5d2ax3,_0x5d2ax9))){_0x5d2ax5[_0x5d2ax9]=!_0x5d2ax4&&_0xe4bc[194]== typeof _0x5d2ax2[_0x5d2ax9]?mxUtils[_0xe4bc[238]](_0x5d2ax2[_0x5d2ax9]):_0x5d2ax2[_0x5d2ax9]}}};return _0x5d2ax5},equalPoints:function(_0x5d2ax2,_0x5d2ax3){if(null==_0x5d2ax2&&null!=_0x5d2ax3||null!=_0x5d2ax2&&null==_0x5d2ax3||null!=_0x5d2ax2&&null!=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[67]]!=_0x5d2ax3[_0xe4bc[67]]){return !1};if(null!=_0x5d2ax2&&null!=_0x5d2ax3){for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){if(_0x5d2ax2[_0x5d2ax4]==_0x5d2ax3[_0x5d2ax4]||null!=_0x5d2ax2[_0x5d2ax4]&&!_0x5d2ax2[_0x5d2ax4][_0xe4bc[237]](_0x5d2ax3[_0x5d2ax4])){return !1}}};return !0},equalEntries:function(_0x5d2ax2,_0x5d2ax3){if(null==_0x5d2ax2&&null!=_0x5d2ax3||null!=_0x5d2ax2&&null==_0x5d2ax3||null!=_0x5d2ax2&&null!=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[67]]!=_0x5d2ax3[_0xe4bc[67]]){return !1};if(null!=_0x5d2ax2&&null!=_0x5d2ax3){for(var _0x5d2ax4 in _0x5d2ax2){if(_0x5d2ax2[_0x5d2ax4]!=_0x5d2ax3[_0x5d2ax4]){return !1}}};return !0},extend:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=function(){};_0x5d2ax4[_0xe4bc[202]]=_0x5d2ax3[_0xe4bc[202]];_0x5d2ax2[_0xe4bc[202]]= new _0x5d2ax4;_0x5d2ax2[_0xe4bc[202]][_0xe4bc[196]]=_0x5d2ax2},toString:function(_0x5d2ax2){var _0x5d2ax3=_0xe4bc[110],_0x5d2ax4;for(_0x5d2ax4 in _0x5d2ax2){try{if(null==_0x5d2ax2[_0x5d2ax4]){_0x5d2ax3+=_0x5d2ax4+_0xe4bc[419]}else {if(_0xe4bc[279]== typeof _0x5d2ax2[_0x5d2ax4]){_0x5d2ax3+=_0x5d2ax4+_0xe4bc[420]}else {if(_0xe4bc[194]== typeof _0x5d2ax2[_0x5d2ax4]){var _0x5d2ax5=mxUtils[_0xe4bc[197]](_0x5d2ax2[_0x5d2ax4][_0xe4bc[196]]),_0x5d2ax3=_0x5d2ax3+(_0x5d2ax4+_0xe4bc[421]+_0x5d2ax5+_0xe4bc[422])}else {_0x5d2ax3+=_0x5d2ax4+_0xe4bc[423]+_0x5d2ax2[_0x5d2ax4]+_0xe4bc[192]}}}}catch(e){_0x5d2ax3+=_0x5d2ax4+_0xe4bc[226]+e[_0xe4bc[281]]}};return _0x5d2ax3},toRadians:function(_0x5d2ax2){return Math[_0xe4bc[424]]*_0x5d2ax2/180},arcToCurves:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14){_0x5d2ax13-=_0x5d2ax2;_0x5d2ax14-=_0x5d2ax3;if(0===_0x5d2ax4||0===_0x5d2ax5){return _0x5d2ax18};_0x5d2ax4=Math[_0xe4bc[425]](_0x5d2ax4);_0x5d2ax5=Math[_0xe4bc[425]](_0x5d2ax5);var _0x5d2ax15=-_0x5d2ax13/2,_0x5d2ax16=-_0x5d2ax14/2,_0x5d2ax17=Math[_0xe4bc[426]](_0x5d2ax9*Math[_0xe4bc[424]]/180),_0x5d2ax18=Math[_0xe4bc[427]](_0x5d2ax9*Math[_0xe4bc[424]]/180);_0x5d2ax9=_0x5d2ax17*_0x5d2ax15+_0x5d2ax18*_0x5d2ax16;var _0x5d2ax15=-1*_0x5d2ax18*_0x5d2ax15+_0x5d2ax17*_0x5d2ax16,_0x5d2ax16=_0x5d2ax9*_0x5d2ax9,_0x5d2ax19=_0x5d2ax15*_0x5d2ax15,_0x5d2ax1a=_0x5d2ax4*_0x5d2ax4,_0x5d2ax1b=_0x5d2ax5*_0x5d2ax5,_0x5d2ax1c=_0x5d2ax16/_0x5d2ax1a+_0x5d2ax19/_0x5d2ax1b;1<_0x5d2ax1c?(_0x5d2ax4*=Math[_0xe4bc[428]](_0x5d2ax1c),_0x5d2ax5*=Math[_0xe4bc[428]](_0x5d2ax1c),_0x5d2axa=0):(_0x5d2ax1c=1,_0x5d2axa===_0x5d2ax12&&(_0x5d2ax1c= -1),_0x5d2axa=_0x5d2ax1c*Math[_0xe4bc[428]]((_0x5d2ax1a*_0x5d2ax1b-_0x5d2ax1a*_0x5d2ax19-_0x5d2ax1b*_0x5d2ax16)/(_0x5d2ax1a*_0x5d2ax19+_0x5d2ax1b*_0x5d2ax16)));_0x5d2ax16=_0x5d2axa*_0x5d2ax4*_0x5d2ax15/_0x5d2ax5;_0x5d2ax19=-1*_0x5d2axa*_0x5d2ax5*_0x5d2ax9/_0x5d2ax4;_0x5d2ax13=_0x5d2ax17*_0x5d2ax16-_0x5d2ax18*_0x5d2ax19+_0x5d2ax13/2;_0x5d2ax14=_0x5d2ax18*_0x5d2ax16+_0x5d2ax17*_0x5d2ax19+_0x5d2ax14/2;_0x5d2ax1a=Math[_0xe4bc[429]]((_0x5d2ax15-_0x5d2ax19)/_0x5d2ax5,(_0x5d2ax9-_0x5d2ax16)/_0x5d2ax4)-Math[_0xe4bc[429]](0,1);_0x5d2axa=0<=_0x5d2ax1a?_0x5d2ax1a:2*Math[_0xe4bc[424]]+_0x5d2ax1a;_0x5d2ax1a=Math[_0xe4bc[429]]((-_0x5d2ax15-_0x5d2ax19)/_0x5d2ax5,(-_0x5d2ax9-_0x5d2ax16)/_0x5d2ax4)-Math[_0xe4bc[429]]((_0x5d2ax15-_0x5d2ax19)/_0x5d2ax5,(_0x5d2ax9-_0x5d2ax16)/_0x5d2ax4);_0x5d2ax9=0<=_0x5d2ax1a?_0x5d2ax1a:2*Math[_0xe4bc[424]]+_0x5d2ax1a;0==_0x5d2ax12&&0<_0x5d2ax9?_0x5d2ax9-=2*Math[_0xe4bc[424]]:0!=_0x5d2ax12&&0>_0x5d2ax9&&(_0x5d2ax9+=2*Math[_0xe4bc[424]]);_0x5d2ax12=2*_0x5d2ax9/Math[_0xe4bc[424]];_0x5d2ax12=Math[_0xe4bc[430]](0>_0x5d2ax12?-1*_0x5d2ax12:_0x5d2ax12);_0x5d2ax9/=_0x5d2ax12;_0x5d2ax15=8/3*Math[_0xe4bc[427]](_0x5d2ax9/4)*Math[_0xe4bc[427]](_0x5d2ax9/4)/Math[_0xe4bc[427]](_0x5d2ax9/2);_0x5d2ax16=_0x5d2ax17*_0x5d2ax4;_0x5d2ax17*=_0x5d2ax5;_0x5d2ax4*=_0x5d2ax18;_0x5d2ax5*=_0x5d2ax18;for(var _0x5d2ax1d=Math[_0xe4bc[426]](_0x5d2axa),_0x5d2ax1e=Math[_0xe4bc[427]](_0x5d2axa),_0x5d2ax19=-_0x5d2ax15*(_0x5d2ax16*_0x5d2ax1e+_0x5d2ax5*_0x5d2ax1d),_0x5d2ax1a=-_0x5d2ax15*(_0x5d2ax4*_0x5d2ax1e-_0x5d2ax17*_0x5d2ax1d),_0x5d2ax1c=_0x5d2ax1b=0,_0x5d2ax18=[],_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax12;++_0x5d2ax1f){_0x5d2axa+=_0x5d2ax9;var _0x5d2ax1d=Math[_0xe4bc[426]](_0x5d2axa),_0x5d2ax1e=Math[_0xe4bc[427]](_0x5d2axa),_0x5d2ax1b=_0x5d2ax16*_0x5d2ax1d-_0x5d2ax5*_0x5d2ax1e+_0x5d2ax13,_0x5d2ax1c=_0x5d2ax4*_0x5d2ax1d+_0x5d2ax17*_0x5d2ax1e+_0x5d2ax14,_0x5d2ax20=-_0x5d2ax15*(_0x5d2ax16*_0x5d2ax1e+_0x5d2ax5*_0x5d2ax1d),_0x5d2ax1d=-_0x5d2ax15*(_0x5d2ax4*_0x5d2ax1e-_0x5d2ax17*_0x5d2ax1d),_0x5d2ax1e=6*_0x5d2ax1f;_0x5d2ax18[_0x5d2ax1e]=Number(_0x5d2ax19+_0x5d2ax2);_0x5d2ax18[_0x5d2ax1e+1]=Number(_0x5d2ax1a+_0x5d2ax3);_0x5d2ax18[_0x5d2ax1e+2]=Number(_0x5d2ax1b-_0x5d2ax20+_0x5d2ax2);_0x5d2ax18[_0x5d2ax1e+3]=Number(_0x5d2ax1c-_0x5d2ax1d+_0x5d2ax3);_0x5d2ax18[_0x5d2ax1e+4]=Number(_0x5d2ax1b+_0x5d2ax2);_0x5d2ax18[_0x5d2ax1e+5]=Number(_0x5d2ax1c+_0x5d2ax3);_0x5d2ax19=_0x5d2ax1b+_0x5d2ax20;_0x5d2ax1a=_0x5d2ax1c+_0x5d2ax1d};return _0x5d2ax18},getBoundingBox:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=null;if(null!=_0x5d2ax2&&null!=_0x5d2ax3&&0!=_0x5d2ax3){var _0x5d2ax5=mxUtils[_0xe4bc[431]](_0x5d2ax3),_0x5d2ax4=Math[_0xe4bc[426]](_0x5d2ax5),_0x5d2ax9=Math[_0xe4bc[427]](_0x5d2ax5),_0x5d2axa= new mxPoint(_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]/2,_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]/2),_0x5d2ax12= new mxPoint(_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]]),_0x5d2ax5= new mxPoint(_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]],_0x5d2ax2[_0xe4bc[236]]),_0x5d2ax13= new mxPoint(_0x5d2ax5[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]),_0x5d2ax14= new mxPoint(_0x5d2ax2[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]]),_0x5d2ax12=mxUtils[_0xe4bc[432]](_0x5d2ax12,_0x5d2ax4,_0x5d2ax9,_0x5d2axa),_0x5d2ax5=mxUtils[_0xe4bc[432]](_0x5d2ax5,_0x5d2ax4,_0x5d2ax9,_0x5d2axa),_0x5d2ax13=mxUtils[_0xe4bc[432]](_0x5d2ax13,_0x5d2ax4,_0x5d2ax9,_0x5d2axa),_0x5d2ax14=mxUtils[_0xe4bc[432]](_0x5d2ax14,_0x5d2ax4,_0x5d2ax9,_0x5d2axa),_0x5d2ax4= new mxRectangle(_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],0,0);_0x5d2ax4[_0xe4bc[99]]( new mxRectangle(_0x5d2ax5[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[236]],0,0));_0x5d2ax4[_0xe4bc[99]]( new mxRectangle(_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],0,0));_0x5d2ax4[_0xe4bc[99]]( new mxRectangle(_0x5d2ax14[_0xe4bc[235]],_0x5d2ax14[_0xe4bc[236]],0,0))};return _0x5d2ax4},getRotatedPoint:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5: new mxPoint;var _0x5d2ax9=_0x5d2ax2[_0xe4bc[235]]-_0x5d2ax5[_0xe4bc[235]];_0x5d2ax2=_0x5d2ax2[_0xe4bc[236]]-_0x5d2ax5[_0xe4bc[236]];return new mxPoint(_0x5d2ax9*_0x5d2ax3-_0x5d2ax2*_0x5d2ax4+_0x5d2ax5[_0xe4bc[235]],_0x5d2ax2*_0x5d2ax3+_0x5d2ax9*_0x5d2ax4+_0x5d2ax5[_0xe4bc[236]])},getPortConstraints:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax2=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_PORT_CONSTRAINT,null);if(null==_0x5d2ax2){return _0x5d2ax5};_0x5d2ax5=_0x5d2ax2.toString();_0x5d2ax2=mxConstants[_0xe4bc[434]];0<=_0x5d2ax5[_0xe4bc[2]](mxConstants.DIRECTION_NORTH)&&(_0x5d2ax2|=mxConstants[_0xe4bc[435]]);0<=_0x5d2ax5[_0xe4bc[2]](mxConstants.DIRECTION_WEST)&&(_0x5d2ax2|=mxConstants[_0xe4bc[436]]);0<=_0x5d2ax5[_0xe4bc[2]](mxConstants.DIRECTION_SOUTH)&&(_0x5d2ax2|=mxConstants[_0xe4bc[437]]);0<=_0x5d2ax5[_0xe4bc[2]](mxConstants.DIRECTION_EAST)&&(_0x5d2ax2|=mxConstants[_0xe4bc[438]]);return _0x5d2ax2},reversePortConstraints:function(_0x5d2ax2){var _0x5d2ax3=0,_0x5d2ax3=(_0x5d2ax2&mxConstants[_0xe4bc[436]])<<3,_0x5d2ax3=_0x5d2ax3|(_0x5d2ax2&mxConstants[_0xe4bc[435]])<<1,_0x5d2ax3=_0x5d2ax3|(_0x5d2ax2&mxConstants[_0xe4bc[437]])>>1;return _0x5d2ax3|=(_0x5d2ax2&mxConstants[_0xe4bc[438]])>>3},findNearestSegment:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=-1;if(0<_0x5d2ax2[_0xe4bc[439]][_0xe4bc[67]]){for(var _0x5d2ax9=_0x5d2ax2[_0xe4bc[439]][0],_0x5d2axa=null,_0x5d2ax12=1;_0x5d2ax12<_0x5d2ax2[_0xe4bc[439]][_0xe4bc[67]];_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax12],_0x5d2ax9=mxUtils[_0xe4bc[440]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4);if(null==_0x5d2axa||_0x5d2ax9<_0x5d2axa){_0x5d2axa=_0x5d2ax9,_0x5d2ax5=_0x5d2ax12-1};_0x5d2ax9=_0x5d2ax13}};return _0x5d2ax5},rectangleIntersectsSegment:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax2[_0xe4bc[236]],_0x5d2ax9=_0x5d2ax2[_0xe4bc[235]],_0x5d2axa=_0x5d2ax5+_0x5d2ax2[_0xe4bc[119]],_0x5d2ax12=_0x5d2ax9+_0x5d2ax2[_0xe4bc[117]];_0x5d2ax2=_0x5d2ax3[_0xe4bc[235]];var _0x5d2ax13=_0x5d2ax4[_0xe4bc[235]];_0x5d2ax3[_0xe4bc[235]]>_0x5d2ax4[_0xe4bc[235]]&&(_0x5d2ax2=_0x5d2ax4[_0xe4bc[235]],_0x5d2ax13=_0x5d2ax3[_0xe4bc[235]]);_0x5d2ax13>_0x5d2ax12&&(_0x5d2ax13=_0x5d2ax12);_0x5d2ax2<_0x5d2ax9&&(_0x5d2ax2=_0x5d2ax9);if(_0x5d2ax2>_0x5d2ax13){return !1};var _0x5d2ax9=_0x5d2ax3[_0xe4bc[236]],_0x5d2ax12=_0x5d2ax4[_0xe4bc[236]],_0x5d2ax14=_0x5d2ax4[_0xe4bc[235]]-_0x5d2ax3[_0xe4bc[235]];1E-7_0x5d2ax12&&(_0x5d2ax3=_0x5d2ax12,_0x5d2ax12=_0x5d2ax9,_0x5d2ax9=_0x5d2ax3);_0x5d2ax12>_0x5d2axa&&(_0x5d2ax12=_0x5d2axa);_0x5d2ax9<_0x5d2ax5&&(_0x5d2ax9=_0x5d2ax5);return _0x5d2ax9>_0x5d2ax12?!1:!0},contains:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax2[_0xe4bc[235]]<=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]>=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[236]]<=_0x5d2ax4&&_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]>=_0x5d2ax4},intersects:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[117]],_0x5d2ax5=_0x5d2ax2[_0xe4bc[119]],_0x5d2ax9=_0x5d2ax3[_0xe4bc[117]],_0x5d2axa=_0x5d2ax3[_0xe4bc[119]];if(0>=_0x5d2ax9||0>=_0x5d2axa||0>=_0x5d2ax4||0>=_0x5d2ax5){return !1};var _0x5d2ax12=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax13=_0x5d2ax2[_0xe4bc[236]],_0x5d2ax14=_0x5d2ax3[_0xe4bc[235]],_0x5d2ax15=_0x5d2ax3[_0xe4bc[236]],_0x5d2ax9=_0x5d2ax9+_0x5d2ax14,_0x5d2axa=_0x5d2axa+_0x5d2ax15,_0x5d2ax4=_0x5d2ax4+_0x5d2ax12,_0x5d2ax5=_0x5d2ax5+_0x5d2ax13;return (_0x5d2ax9<_0x5d2ax14||_0x5d2ax9>_0x5d2ax12)&&(_0x5d2axa<_0x5d2ax15||_0x5d2axa>_0x5d2ax13)&&(_0x5d2ax4<_0x5d2ax12||_0x5d2ax4>_0x5d2ax14)&&(_0x5d2ax5<_0x5d2ax13||_0x5d2ax5>_0x5d2ax15)},intersectsHotspot:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:1;_0x5d2ax9=null!=_0x5d2ax9?_0x5d2ax9:0;_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:0;if(0<_0x5d2ax5){var _0x5d2ax12=_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax13=_0x5d2ax2[_0xe4bc[242]](),_0x5d2ax14=_0x5d2ax2[_0xe4bc[117]],_0x5d2ax15=_0x5d2ax2[_0xe4bc[119]],_0x5d2ax16=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_STARTSIZE)*_0x5d2ax2[_0xe4bc[441]][_0xe4bc[255]];0<_0x5d2ax16&&(mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_HORIZONTAL,!0)?(_0x5d2ax13=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax16/2,_0x5d2ax15=_0x5d2ax16):(_0x5d2ax12=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax16/2,_0x5d2ax14=_0x5d2ax16));_0x5d2ax14=Math[_0xe4bc[160]](_0x5d2ax9,_0x5d2ax14*_0x5d2ax5);_0x5d2ax15=Math[_0xe4bc[160]](_0x5d2ax9,_0x5d2ax15*_0x5d2ax5);0<_0x5d2axa&&(_0x5d2ax14=Math[_0xe4bc[243]](_0x5d2ax14,_0x5d2axa),_0x5d2ax15=Math[_0xe4bc[243]](_0x5d2ax15,_0x5d2axa));_0x5d2ax5= new mxRectangle(_0x5d2ax12-_0x5d2ax14/2,_0x5d2ax13-_0x5d2ax15/2,_0x5d2ax14,_0x5d2ax15);_0x5d2ax12=mxUtils[_0xe4bc[431]](mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_ROTATION)||0);0!=_0x5d2ax12&&(_0x5d2ax9=Math[_0xe4bc[426]](-_0x5d2ax12),_0x5d2axa=Math[_0xe4bc[427]](-_0x5d2ax12),_0x5d2ax12= new mxPoint(_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax2[_0xe4bc[242]]()),_0x5d2ax2=mxUtils[_0xe4bc[432]]( new mxPoint(_0x5d2ax3,_0x5d2ax4),_0x5d2ax9,_0x5d2axa,_0x5d2ax12),_0x5d2ax3=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[236]]);return mxUtils[_0xe4bc[442]](_0x5d2ax5,_0x5d2ax3,_0x5d2ax4)};return !0},getOffset:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=0,_0x5d2ax5=0;if(null!=_0x5d2ax3&&_0x5d2ax3){var _0x5d2ax9=document[_0xe4bc[112]],_0x5d2axa=document[_0xe4bc[158]],_0x5d2ax4=_0x5d2ax4+(_0x5d2ax9[_0xe4bc[360]]||_0x5d2axa[_0xe4bc[360]]),_0x5d2ax5=_0x5d2ax5+(_0x5d2ax9[_0xe4bc[190]]||_0x5d2axa[_0xe4bc[190]])};for(;_0x5d2ax2[_0xe4bc[443]];){_0x5d2ax4+=_0x5d2ax2[_0xe4bc[358]],_0x5d2ax5+=_0x5d2ax2[_0xe4bc[362]],_0x5d2ax2=_0x5d2ax2[_0xe4bc[443]]};return new mxPoint(_0x5d2ax4,_0x5d2ax5)},getScrollOrigin:function(_0x5d2ax2){for(var _0x5d2ax3=document[_0xe4bc[112]],_0x5d2ax4=document[_0xe4bc[158]],_0x5d2ax5= new mxPoint(_0x5d2ax3[_0xe4bc[360]]||_0x5d2ax4[_0xe4bc[360]],_0x5d2ax3[_0xe4bc[190]]||_0x5d2ax4[_0xe4bc[190]]);null!=_0x5d2ax2&&_0x5d2ax2!=_0x5d2ax3&&_0x5d2ax2!=_0x5d2ax4;){!isNaN(_0x5d2ax2[_0xe4bc[360]])&&!isNaN(_0x5d2ax2[_0xe4bc[190]])&&(_0x5d2ax5[_0xe4bc[235]]+=_0x5d2ax2[_0xe4bc[360]],_0x5d2ax5[_0xe4bc[236]]+=_0x5d2ax2[_0xe4bc[190]]),_0x5d2ax2=_0x5d2ax2[_0xe4bc[265]]};return _0x5d2ax5},convertPoint:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=mxUtils[_0xe4bc[444]](_0x5d2ax2);_0x5d2ax2=mxUtils[_0xe4bc[445]](_0x5d2ax2);_0x5d2ax2[_0xe4bc[235]]-=_0x5d2ax5[_0xe4bc[235]];_0x5d2ax2[_0xe4bc[236]]-=_0x5d2ax5[_0xe4bc[236]];return new mxPoint(_0x5d2ax3-_0x5d2ax2[_0xe4bc[235]],_0x5d2ax4-_0x5d2ax2[_0xe4bc[236]])},ltrim:function(_0x5d2ax2,_0x5d2ax3){return _0x5d2ax2[_0xe4bc[230]](RegExp(_0xe4bc[446]+(_0x5d2ax3||_0xe4bc[447])+_0xe4bc[448],_0xe4bc[449]),_0xe4bc[110])},rtrim:function(_0x5d2ax2,_0x5d2ax3){return _0x5d2ax2[_0xe4bc[230]](RegExp(_0xe4bc[450]+(_0x5d2ax3||_0xe4bc[447])+_0xe4bc[451],_0xe4bc[449]),_0xe4bc[110])},trim:function(_0x5d2ax2,_0x5d2ax3){return mxUtils[_0xe4bc[453]](mxUtils[_0xe4bc[452]](_0x5d2ax2,_0x5d2ax3),_0x5d2ax3)},isNumeric:function(_0x5d2ax2){return null!=_0x5d2ax2&&(null==_0x5d2ax2[_0xe4bc[67]]||0<_0x5d2ax2[_0xe4bc[67]]&&0>_0x5d2ax2[_0xe4bc[2]](_0xe4bc[454])&&0>_0x5d2ax2[_0xe4bc[2]](_0xe4bc[455]))&&!isNaN(_0x5d2ax2)},mod:function(_0x5d2ax2,_0x5d2ax3){return (_0x5d2ax2%_0x5d2ax3+_0x5d2ax3)%_0x5d2ax3},intersection:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13){var _0x5d2ax14=(_0x5d2ax13-_0x5d2axa)*(_0x5d2ax4-_0x5d2ax2)-(_0x5d2ax12-_0x5d2ax9)*(_0x5d2ax5-_0x5d2ax3);_0x5d2ax12=((_0x5d2ax12-_0x5d2ax9)*(_0x5d2ax3-_0x5d2axa)-(_0x5d2ax13-_0x5d2axa)*(_0x5d2ax2-_0x5d2ax9))/_0x5d2ax14;_0x5d2ax9=((_0x5d2ax4-_0x5d2ax2)*(_0x5d2ax3-_0x5d2axa)-(_0x5d2ax5-_0x5d2ax3)*(_0x5d2ax2-_0x5d2ax9))/_0x5d2ax14;return 0<=_0x5d2ax12&&1>=_0x5d2ax12&&0<=_0x5d2ax9&&1>=_0x5d2ax9? new mxPoint(_0x5d2ax2+_0x5d2ax12*(_0x5d2ax4-_0x5d2ax2),_0x5d2ax3+_0x5d2ax12*(_0x5d2ax5-_0x5d2ax3)):null},ptSegDistSq:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax4-=_0x5d2ax2;_0x5d2ax5-=_0x5d2ax3;_0x5d2ax9-=_0x5d2ax2;_0x5d2axa-=_0x5d2ax3;0>=_0x5d2ax9*_0x5d2ax4+_0x5d2axa*_0x5d2ax5?_0x5d2ax4=0:(_0x5d2ax9=_0x5d2ax4-_0x5d2ax9,_0x5d2axa=_0x5d2ax5-_0x5d2axa,_0x5d2ax2=_0x5d2ax9*_0x5d2ax4+_0x5d2axa*_0x5d2ax5,_0x5d2ax4=0>=_0x5d2ax2?0:_0x5d2ax2*_0x5d2ax2/(_0x5d2ax4*_0x5d2ax4+_0x5d2ax5*_0x5d2ax5));_0x5d2ax9=_0x5d2ax9*_0x5d2ax9+_0x5d2axa*_0x5d2axa-_0x5d2ax4;0>_0x5d2ax9&&(_0x5d2ax9=0);return _0x5d2ax9},relativeCcw:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax4-=_0x5d2ax2;_0x5d2ax5-=_0x5d2ax3;_0x5d2ax9-=_0x5d2ax2;_0x5d2axa-=_0x5d2ax3;_0x5d2ax2=_0x5d2ax9*_0x5d2ax5-_0x5d2axa*_0x5d2ax4;0==_0x5d2ax2&&(_0x5d2ax2=_0x5d2ax9*_0x5d2ax4+_0x5d2axa*_0x5d2ax5,0<_0x5d2ax2&&(_0x5d2ax2=(_0x5d2ax9-_0x5d2ax4)*_0x5d2ax4+(_0x5d2axa-_0x5d2ax5)*_0x5d2ax5,0>_0x5d2ax2&&(_0x5d2ax2=0)));return 0>_0x5d2ax2?-1:0<_0x5d2ax2?1:0},animateChanges:function(_0x5d2ax2,_0x5d2ax3){mxEffects[_0xe4bc[456]][_0xe4bc[183]](this,arguments)},cascadeOpacity:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxEffects[_0xe4bc[260]][_0xe4bc[183]](this,arguments)},fadeOut:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){mxEffects[_0xe4bc[457]][_0xe4bc[183]](this,arguments)},setOpacity:function(_0x5d2ax2,_0x5d2ax3){mxUtils[_0xe4bc[458]](_0x5d2ax2)?_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]=100<=_0x5d2ax3?null:_0xe4bc[459]+_0x5d2ax3/5+_0xe4bc[460]:mxClient[_0xe4bc[80]]&&(_0xe4bc[82]=== typeof document[_0xe4bc[5]]||9>document[_0xe4bc[5]])?_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]=100<=_0x5d2ax3?null:_0xe4bc[459]+_0x5d2ax3+_0xe4bc[460]:_0x5d2ax2[_0xe4bc[124]][_0xe4bc[461]]=_0x5d2ax3/100},createImage:function(_0x5d2ax2){var _0x5d2ax3=null;mxClient[_0xe4bc[49]]&&_0xe4bc[462]!=document[_0xe4bc[135]]?(_0x5d2ax3=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[464]),_0x5d2ax3[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax2),_0x5d2ax3[_0xe4bc[124]][_0xe4bc[465]]=_0xe4bc[130]):(_0x5d2ax3=document[_0xe4bc[55]](_0xe4bc[466]),_0x5d2ax3[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax2),_0x5d2ax3[_0xe4bc[57]](_0xe4bc[467],_0xe4bc[468]));return _0x5d2ax3},sortCells:function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;var _0x5d2ax4= new mxDictionary;_0x5d2ax2[_0xe4bc[470]](function(_0x5d2ax2,_0x5d2ax9){var _0x5d2axa=_0x5d2ax4[_0xe4bc[203]](_0x5d2ax2);null==_0x5d2axa&&(_0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2)[_0xe4bc[224]](mxCellPath.PATH_SEPARATOR),_0x5d2ax4[_0xe4bc[204]](_0x5d2ax2,_0x5d2axa));var _0x5d2ax12=_0x5d2ax4[_0xe4bc[203]](_0x5d2ax9);null==_0x5d2ax12&&(_0x5d2ax12=mxCellPath[_0xe4bc[385]](_0x5d2ax9)[_0xe4bc[224]](mxCellPath.PATH_SEPARATOR),_0x5d2ax4[_0xe4bc[204]](_0x5d2ax9,_0x5d2ax12));_0x5d2axa=mxCellPath[_0xe4bc[469]](_0x5d2axa,_0x5d2ax12);return 0==_0x5d2axa?0:0<_0x5d2axa==_0x5d2ax3?1:-1});return _0x5d2ax2},getStylename:function(_0x5d2ax2){return null!=_0x5d2ax2&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471])[0],0>_0x5d2ax2[_0xe4bc[2]](_0xe4bc[226]))?_0x5d2ax2:_0xe4bc[110]},getStylenames:function(_0x5d2ax2){var _0x5d2ax3=[];if(null!=_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471]);for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){0>_0x5d2ax2[_0x5d2ax4][_0xe4bc[2]](_0xe4bc[226])&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax2[_0x5d2ax4])}};return _0x5d2ax3},indexOfStylename:function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2&&null!=_0x5d2ax3){for(var _0x5d2ax4=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471]),_0x5d2ax5=0,_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax9++){if(_0x5d2ax4[_0x5d2ax9]==_0x5d2ax3){return _0x5d2ax5};_0x5d2ax5+=_0x5d2ax4[_0x5d2ax9][_0xe4bc[67]]+1}};return -1},addStylename:function(_0x5d2ax2,_0x5d2ax3){0>mxUtils[_0xe4bc[472]](_0x5d2ax2,_0x5d2ax3)&&(null==_0x5d2ax2?_0x5d2ax2=_0xe4bc[110]:0<_0x5d2ax2[_0xe4bc[67]]&&_0xe4bc[471]!=_0x5d2ax2[_0xe4bc[225]](_0x5d2ax2[_0xe4bc[67]]-1)&&(_0x5d2ax2+=_0xe4bc[471]),_0x5d2ax2+=_0x5d2ax3);return _0x5d2ax2},removeStylename:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=[];if(null!=_0x5d2ax2){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471]),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax5[_0x5d2ax9]!=_0x5d2ax3&&_0x5d2ax4[_0xe4bc[207]](_0x5d2ax5[_0x5d2ax9])}};return _0x5d2ax4[_0xe4bc[234]](_0xe4bc[471])},removeAllStylenames:function(_0x5d2ax2){var _0x5d2ax3=[];if(null!=_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471]);for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){0<=_0x5d2ax2[_0x5d2ax4][_0xe4bc[2]](_0xe4bc[226])&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax2[_0x5d2ax4])}};return _0x5d2ax3[_0xe4bc[234]](_0xe4bc[471])},setCellStyles:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]){_0x5d2ax2[_0xe4bc[473]]();try{for(var _0x5d2ax9=0;_0x5d2ax9<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax9++){if(null!=_0x5d2ax3[_0x5d2ax9]){var _0x5d2axa=mxUtils[_0xe4bc[475]](_0x5d2ax2[_0xe4bc[474]](_0x5d2ax3[_0x5d2ax9]),_0x5d2ax4,_0x5d2ax5);_0x5d2ax2[_0xe4bc[475]](_0x5d2ax3[_0x5d2ax9],_0x5d2axa)}}}finally{_0x5d2ax2[_0xe4bc[476]]()}}},setStyle:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=null!=_0x5d2ax4&&(_0xe4bc[82]== typeof _0x5d2ax4[_0xe4bc[67]]||0<_0x5d2ax4[_0xe4bc[67]]);if(null==_0x5d2ax2||0==_0x5d2ax2[_0xe4bc[67]]){_0x5d2ax5&&(_0x5d2ax2=_0x5d2ax3+_0xe4bc[226]+_0x5d2ax4)}else {var _0x5d2ax9=_0x5d2ax2[_0xe4bc[2]](_0x5d2ax3+_0xe4bc[226]);0>_0x5d2ax9?_0x5d2ax5&&(_0x5d2ax5=_0xe4bc[471]==_0x5d2ax2[_0xe4bc[225]](_0x5d2ax2[_0xe4bc[67]]-1)?_0xe4bc[110]:_0xe4bc[471],_0x5d2ax2=_0x5d2ax2+_0x5d2ax5+_0x5d2ax3+_0xe4bc[226]+_0x5d2ax4):(_0x5d2ax3=_0x5d2ax5?_0x5d2ax3+_0xe4bc[226]+_0x5d2ax4:_0xe4bc[110],_0x5d2ax4=_0x5d2ax2[_0xe4bc[2]](_0xe4bc[471],_0x5d2ax9),_0x5d2ax5||_0x5d2ax4++,_0x5d2ax2=_0x5d2ax2[_0xe4bc[85]](0,_0x5d2ax9)+_0x5d2ax3+(_0x5d2ax4>_0x5d2ax9?_0x5d2ax2[_0xe4bc[85]](_0x5d2ax4):_0xe4bc[110]))};return _0x5d2ax2},setCellStyleFlags:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]){_0x5d2ax2[_0xe4bc[473]]();try{for(var _0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[67]];_0x5d2axa++){if(null!=_0x5d2ax3[_0x5d2axa]){var _0x5d2ax12=mxUtils[_0xe4bc[477]](_0x5d2ax2[_0xe4bc[474]](_0x5d2ax3[_0x5d2axa]),_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[475]](_0x5d2ax3[_0x5d2axa],_0x5d2ax12)}}}finally{_0x5d2ax2[_0xe4bc[476]]()}}},setStyleFlag:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null==_0x5d2ax2||0==_0x5d2ax2[_0xe4bc[67]]){_0x5d2ax2=_0x5d2ax5||null==_0x5d2ax5?_0x5d2ax3+_0xe4bc[226]+_0x5d2ax4:_0x5d2ax3+_0xe4bc[478]}else {var _0x5d2ax9=_0x5d2ax2[_0xe4bc[2]](_0x5d2ax3+_0xe4bc[226]);if(0>_0x5d2ax9){_0x5d2ax9=_0xe4bc[471]==_0x5d2ax2[_0xe4bc[225]](_0x5d2ax2[_0xe4bc[67]]-1)?_0xe4bc[110]:_0xe4bc[471],_0x5d2ax2=_0x5d2ax5||null==_0x5d2ax5?_0x5d2ax2+_0x5d2ax9+_0x5d2ax3+_0xe4bc[226]+_0x5d2ax4:_0x5d2ax2+_0x5d2ax9+_0x5d2ax3+_0xe4bc[478]}else {var _0x5d2axa=_0x5d2ax2[_0xe4bc[2]](_0xe4bc[471],_0x5d2ax9),_0x5d2ax12=_0xe4bc[110],_0x5d2ax12=0>_0x5d2axa?_0x5d2ax2[_0xe4bc[85]](_0x5d2ax9+_0x5d2ax3[_0xe4bc[67]]+1):_0x5d2ax2[_0xe4bc[85]](_0x5d2ax9+_0x5d2ax3[_0xe4bc[67]]+1,_0x5d2axa),_0x5d2ax12=null==_0x5d2ax5?parseInt(_0x5d2ax12)^_0x5d2ax4:_0x5d2ax5?parseInt(_0x5d2ax12)|_0x5d2ax4:parseInt(_0x5d2ax12)& ~_0x5d2ax4;_0x5d2ax2=_0x5d2ax2[_0xe4bc[85]](0,_0x5d2ax9)+_0x5d2ax3+_0xe4bc[226]+_0x5d2ax12+(0<=_0x5d2axa?_0x5d2ax2[_0xe4bc[85]](_0x5d2axa):_0xe4bc[110])}};return _0x5d2ax2},getAlignmentAsPoint:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=0,_0x5d2ax5=0;_0x5d2ax2==mxConstants[_0xe4bc[479]]?_0x5d2ax4= -0.5:_0x5d2ax2==mxConstants[_0xe4bc[480]]&&(_0x5d2ax4= -1);_0x5d2ax3==mxConstants[_0xe4bc[481]]?_0x5d2ax5= -0.5:_0x5d2ax3==mxConstants[_0xe4bc[482]]&&(_0x5d2ax5= -1);return new mxPoint(_0x5d2ax4,_0x5d2ax5)},getSizeForString:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:mxConstants[_0xe4bc[483]];_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:mxConstants[_0xe4bc[484]];var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax5[_0xe4bc[124]][_0xe4bc[486]]=_0x5d2ax4;_0x5d2ax5[_0xe4bc[124]][_0xe4bc[487]]=Math[_0xe4bc[488]](_0x5d2ax3)+_0xe4bc[168];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[489]]=Math[_0xe4bc[488]](_0x5d2ax3*mxConstants[_0xe4bc[490]])+_0xe4bc[168];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[493]]=_0xe4bc[494];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[495]]=mxClient[_0xe4bc[496]]?_0xe4bc[497]:_0xe4bc[498];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[499]]=_0xe4bc[500];_0x5d2ax5[_0xe4bc[339]]=_0x5d2ax2;document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax5);_0x5d2ax2= new mxRectangle(0,0,_0x5d2ax5[_0xe4bc[359]],_0x5d2ax5[_0xe4bc[167]]);document[_0xe4bc[112]][_0xe4bc[266]](_0x5d2ax5);return _0x5d2ax2},getViewXml:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:0;_0x5d2ax9=null!=_0x5d2ax9?_0x5d2ax9:0;_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:1;null==_0x5d2ax4&&(_0x5d2ax4=[_0x5d2ax2[_0xe4bc[502]]()[_0xe4bc[501]]()]);var _0x5d2axa=_0x5d2ax2[_0xe4bc[249]](),_0x5d2ax12=null,_0x5d2ax13=_0x5d2axa[_0xe4bc[503]]();_0x5d2axa[_0xe4bc[504]](!1);var _0x5d2ax14=_0x5d2axa[_0xe4bc[505]],_0x5d2ax15=_0x5d2axa[_0xe4bc[506]];_0x5d2ax2[_0xe4bc[507]]==mxConstants[_0xe4bc[508]]?(_0x5d2axa[_0xe4bc[505]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449]),_0x5d2axa[_0xe4bc[510]][_0xe4bc[62]](_0x5d2axa[_0xe4bc[505]]),_0x5d2axa[_0xe4bc[506]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449])):(_0x5d2axa[_0xe4bc[505]]=_0x5d2axa[_0xe4bc[505]][_0xe4bc[511]](!1),_0x5d2axa[_0xe4bc[510]][_0xe4bc[62]](_0x5d2axa[_0xe4bc[505]]),_0x5d2axa[_0xe4bc[506]]=_0x5d2axa[_0xe4bc[506]][_0xe4bc[511]](!1));_0x5d2axa[_0xe4bc[510]][_0xe4bc[62]](_0x5d2axa[_0xe4bc[506]]);var _0x5d2ax16=_0x5d2axa[_0xe4bc[512]]();_0x5d2axa[_0xe4bc[513]]= new mxPoint(_0x5d2ax5,_0x5d2ax9);_0x5d2ax3= new mxTemporaryCellStates(_0x5d2ax2[_0xe4bc[249]](),_0x5d2ax3,_0x5d2ax4);try{_0x5d2ax12=( new mxCodec)[_0xe4bc[514]](_0x5d2ax2[_0xe4bc[249]]())}finally{_0x5d2ax3[_0xe4bc[515]](),_0x5d2axa[_0xe4bc[513]]=_0x5d2ax16,_0x5d2axa[_0xe4bc[510]][_0xe4bc[266]](_0x5d2axa[_0xe4bc[505]]),_0x5d2axa[_0xe4bc[510]][_0xe4bc[266]](_0x5d2axa[_0xe4bc[506]]),_0x5d2axa[_0xe4bc[505]]=_0x5d2ax14,_0x5d2axa[_0xe4bc[506]]=_0x5d2ax15,_0x5d2axa[_0xe4bc[504]](_0x5d2ax13)};return _0x5d2ax12},getScaleForPageCount:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(1>_0x5d2ax2){return 1};_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:mxConstants[_0xe4bc[516]];_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:0;var _0x5d2ax9=_0x5d2ax4[_0xe4bc[117]]-2*_0x5d2ax5;_0x5d2ax4=_0x5d2ax4[_0xe4bc[119]]-2*_0x5d2ax5;_0x5d2ax5=_0x5d2ax3[_0xe4bc[517]]()[_0xe4bc[238]]();_0x5d2ax3=_0x5d2ax3[_0xe4bc[249]]()[_0xe4bc[518]]();_0x5d2ax5[_0xe4bc[117]]/=_0x5d2ax3;_0x5d2ax5[_0xe4bc[119]]/=_0x5d2ax3;_0x5d2ax3=_0x5d2ax5[_0xe4bc[117]];_0x5d2ax4=_0x5d2ax3/_0x5d2ax5[_0xe4bc[119]]/(_0x5d2ax9/_0x5d2ax4);_0x5d2ax5=Math[_0xe4bc[428]](_0x5d2ax2);var _0x5d2axa=Math[_0xe4bc[428]](_0x5d2ax4);_0x5d2ax4=_0x5d2ax5*_0x5d2axa;_0x5d2ax5/=_0x5d2axa;if(1>_0x5d2ax4&&_0x5d2ax5>_0x5d2ax2){var _0x5d2ax12=_0x5d2ax5/_0x5d2ax2;_0x5d2ax5=_0x5d2ax2;_0x5d2ax4/=_0x5d2ax12};1>_0x5d2ax5&&_0x5d2ax4>_0x5d2ax2&&(_0x5d2ax12=_0x5d2ax4/_0x5d2ax2,_0x5d2ax4=_0x5d2ax2,_0x5d2ax5/=_0x5d2ax12);_0x5d2ax12=Math[_0xe4bc[430]](_0x5d2ax4)*Math[_0xe4bc[430]](_0x5d2ax5);for(_0x5d2axa=0;_0x5d2ax12>_0x5d2ax2;){var _0x5d2ax12=Math[_0xe4bc[519]](_0x5d2ax4)/_0x5d2ax4,_0x5d2ax13=Math[_0xe4bc[519]](_0x5d2ax5)/_0x5d2ax5;1==_0x5d2ax12&&(_0x5d2ax12=Math[_0xe4bc[519]](_0x5d2ax4-1)/_0x5d2ax4);1==_0x5d2ax13&&(_0x5d2ax13=Math[_0xe4bc[519]](_0x5d2ax5-1)/_0x5d2ax5);_0x5d2ax12=_0x5d2ax12>_0x5d2ax13?_0x5d2ax12:_0x5d2ax13;_0x5d2ax4*=_0x5d2ax12;_0x5d2ax5*=_0x5d2ax12;_0x5d2ax12=Math[_0xe4bc[430]](_0x5d2ax4)*Math[_0xe4bc[430]](_0x5d2ax5);_0x5d2axa++;if(10<_0x5d2axa){break}};return 0.99999*(_0x5d2ax9*_0x5d2ax4/_0x5d2ax3)},show:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:0;_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:0;null==_0x5d2ax3?_0x5d2ax3=window[_0xe4bc[392]]()[_0xe4bc[395]]:_0x5d2ax3[_0xe4bc[392]]();var _0x5d2ax9=_0x5d2ax2[_0xe4bc[517]]();_0x5d2ax4=-_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax4;_0x5d2ax5=-_0x5d2ax9[_0xe4bc[236]]+_0x5d2ax5;if(mxClient[_0xe4bc[80]]){for(var _0x5d2ax9=_0xe4bc[520],_0x5d2axa=document[_0xe4bc[64]](_0xe4bc[521]),_0x5d2ax12=0;_0x5d2ax12<_0x5d2axa[_0xe4bc[67]];_0x5d2ax12++){_0x5d2ax9+=_0x5d2axa[_0x5d2ax12][_0xe4bc[342]]};_0x5d2ax9+=_0xe4bc[522];for(_0x5d2ax12=0;_0x5d2ax12document[_0xe4bc[5]])?function(_0x5d2ax2){mxEvent[_0xe4bc[169]](_0x5d2ax2,_0xe4bc[768],function(){return !1})}:function(_0x5d2ax2){_0x5d2ax2[_0xe4bc[57]](_0xe4bc[769],_0xe4bc[770])}}(),getSource:function(_0x5d2ax2){return null!=_0x5d2ax2[_0xe4bc[771]]?_0x5d2ax2[_0xe4bc[771]]:_0x5d2ax2[_0xe4bc[772]]},isConsumed:function(_0x5d2ax2){return null!=_0x5d2ax2[_0xe4bc[721]]&&_0x5d2ax2[_0xe4bc[721]]},isLeftMouseButton:function(_0x5d2ax2){return _0x5d2ax2[_0xe4bc[172]]==(mxClient[_0xe4bc[80]]&&(_0xe4bc[82]=== typeof document[_0xe4bc[5]]||9>document[_0xe4bc[5]])?1:0)},isRightMouseButton:function(_0x5d2ax2){return 2==_0x5d2ax2[_0xe4bc[172]]},isPopupTrigger:function(_0x5d2ax2){return mxEvent[_0xe4bc[773]](_0x5d2ax2)||mxEvent[_0xe4bc[774]](_0x5d2ax2)&&!mxEvent[_0xe4bc[775]](_0x5d2ax2)},isShiftDown:function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[776]]:!1},isAltDown:function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[777]]:!1},isControlDown:function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[778]]:!1},isMetaDown:function(_0x5d2ax2){return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[779]]:!1},getMainEvent:function(_0x5d2ax2){(_0xe4bc[755]==_0x5d2ax2[_0xe4bc[60]]||_0xe4bc[756]==_0x5d2ax2[_0xe4bc[60]])&&null!=_0x5d2ax2[_0xe4bc[780]]&&null!=_0x5d2ax2[_0xe4bc[780]][0]?_0x5d2ax2=_0x5d2ax2[_0xe4bc[780]][0]:_0xe4bc[757]==_0x5d2ax2[_0xe4bc[60]]&&(null!=_0x5d2ax2[_0xe4bc[781]]&&null!=_0x5d2ax2[_0xe4bc[781]][0])&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[781]][0]);return _0x5d2ax2},getClientX:function(_0x5d2ax2){return mxEvent[_0xe4bc[783]](_0x5d2ax2)[_0xe4bc[782]]},getClientY:function(_0x5d2ax2){return mxEvent[_0xe4bc[783]](_0x5d2ax2)[_0xe4bc[784]]},consume:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!0;if(null!=_0x5d2ax3?_0x5d2ax3:1){_0x5d2ax2[_0xe4bc[738]]?(_0x5d2ax4&&_0x5d2ax2[_0xe4bc[785]](),_0x5d2ax2[_0xe4bc[738]]()):_0x5d2ax4&&(_0x5d2ax2[_0xe4bc[786]]= !0)};_0x5d2ax2[_0xe4bc[721]]= !0;_0x5d2ax2[_0xe4bc[739]]= !1},LABEL_HANDLE:-1,ROTATION_HANDLE:-2,MOUSE_DOWN:_0xe4bc[787],MOUSE_MOVE:_0xe4bc[788],MOUSE_UP:_0xe4bc[789],ACTIVATE:_0xe4bc[790],RESIZE_START:_0xe4bc[791],RESIZE:_0xe4bc[129],RESIZE_END:_0xe4bc[792],MOVE_START:_0xe4bc[793],MOVE:_0xe4bc[582],MOVE_END:_0xe4bc[794],PAN_START:_0xe4bc[795],PAN:_0xe4bc[796],PAN_END:_0xe4bc[797],MINIMIZE:_0xe4bc[798],NORMALIZE:_0xe4bc[799],MAXIMIZE:_0xe4bc[800],HIDE:_0xe4bc[801],SHOW:_0xe4bc[539],CLOSE:_0xe4bc[268],DESTROY:_0xe4bc[515],REFRESH:_0xe4bc[802],SIZE:_0xe4bc[803],SELECT:_0xe4bc[804],FIRED:_0xe4bc[805],GET:_0xe4bc[203],RECEIVE:_0xe4bc[806],CONNECT:_0xe4bc[807],DISCONNECT:_0xe4bc[808],SUSPEND:_0xe4bc[809],RESUME:_0xe4bc[810],MARK:_0xe4bc[811],SESSION:_0xe4bc[812],ROOT:_0xe4bc[813],POST:_0xe4bc[814],OPEN:_0xe4bc[392],SAVE:_0xe4bc[815],BEFORE_ADD_VERTEX:_0xe4bc[816],ADD_VERTEX:_0xe4bc[817],AFTER_ADD_VERTEX:_0xe4bc[818],DONE:_0xe4bc[819],EXECUTE:_0xe4bc[350],EXECUTED:_0xe4bc[820],BEGIN_UPDATE:_0xe4bc[473],START_EDIT:_0xe4bc[821],END_UPDATE:_0xe4bc[476],END_EDIT:_0xe4bc[822],BEFORE_UNDO:_0xe4bc[823],UNDO:_0xe4bc[824],REDO:_0xe4bc[825],CHANGE:_0xe4bc[826],NOTIFY:_0xe4bc[827],LAYOUT_CELLS:_0xe4bc[828],CLICK:_0xe4bc[173],SCALE:_0xe4bc[255],TRANSLATE:_0xe4bc[513],SCALE_AND_TRANSLATE:_0xe4bc[829],UP:_0xe4bc[830],DOWN:_0xe4bc[831],ADD:_0xe4bc[99],REMOVE:_0xe4bc[205],CLEAR:_0xe4bc[200],ADD_CELLS:_0xe4bc[832],CELLS_ADDED:_0xe4bc[833],MOVE_CELLS:_0xe4bc[834],CELLS_MOVED:_0xe4bc[835],RESIZE_CELLS:_0xe4bc[836],CELLS_RESIZED:_0xe4bc[837],TOGGLE_CELLS:_0xe4bc[838],CELLS_TOGGLED:_0xe4bc[839],ORDER_CELLS:_0xe4bc[840],CELLS_ORDERED:_0xe4bc[841],REMOVE_CELLS:_0xe4bc[842],CELLS_REMOVED:_0xe4bc[843],GROUP_CELLS:_0xe4bc[844],UNGROUP_CELLS:_0xe4bc[845],REMOVE_CELLS_FROM_PARENT:_0xe4bc[846],FOLD_CELLS:_0xe4bc[847],CELLS_FOLDED:_0xe4bc[848],ALIGN_CELLS:_0xe4bc[849],LABEL_CHANGED:_0xe4bc[850],CONNECT_CELL:_0xe4bc[851],CELL_CONNECTED:_0xe4bc[852],SPLIT_EDGE:_0xe4bc[853],FLIP_EDGE:_0xe4bc[854],START_EDITING:_0xe4bc[855],ADD_OVERLAY:_0xe4bc[856],REMOVE_OVERLAY:_0xe4bc[857],UPDATE_CELL_SIZE:_0xe4bc[858],ESCAPE:_0xe4bc[859],CLICK:_0xe4bc[173],DOUBLE_CLICK:_0xe4bc[860],START:_0xe4bc[861],RESET:_0xe4bc[862]};function mxXmlRequest(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){this[_0xe4bc[863]]=_0x5d2ax2;this[_0xe4bc[864]]=_0x5d2ax3;this[_0xe4bc[865]]=_0x5d2ax4||_0xe4bc[866];this[_0xe4bc[307]]=null!=_0x5d2ax5?_0x5d2ax5:!0;this[_0xe4bc[867]]=_0x5d2ax9;this[_0xe4bc[868]]=_0x5d2axa}mxXmlRequest[_0xe4bc[202]][_0xe4bc[863]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[864]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[865]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[307]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[869]]= !1;mxXmlRequest[_0xe4bc[202]][_0xe4bc[867]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[868]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[870]]=null;mxXmlRequest[_0xe4bc[202]][_0xe4bc[871]]=function(){return this[_0xe4bc[869]]};mxXmlRequest[_0xe4bc[202]][_0xe4bc[872]]=function(_0x5d2ax2){this[_0xe4bc[869]]=_0x5d2ax2};mxXmlRequest[_0xe4bc[202]][_0xe4bc[221]]=function(){return this[_0xe4bc[870]][_0xe4bc[873]]};mxXmlRequest[_0xe4bc[202]][_0xe4bc[220]]=function(){return 4==this[_0xe4bc[870]][_0xe4bc[417]]};mxXmlRequest[_0xe4bc[202]][_0xe4bc[874]]=function(){var _0x5d2ax2=this[_0xe4bc[875]]();return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[158]]:null};mxXmlRequest[_0xe4bc[202]][_0xe4bc[875]]=function(){var _0x5d2ax2=this[_0xe4bc[870]][_0xe4bc[876]];if(9<=document[_0xe4bc[5]]||null==_0x5d2ax2||null==_0x5d2ax2[_0xe4bc[158]]){_0x5d2ax2=mxUtils[_0xe4bc[877]](this[_0xe4bc[870]][_0xe4bc[873]])};return _0x5d2ax2};mxXmlRequest[_0xe4bc[202]][_0xe4bc[221]]=function(){return this[_0xe4bc[870]][_0xe4bc[873]]};mxXmlRequest[_0xe4bc[202]][_0xe4bc[878]]=function(){return this[_0xe4bc[870]][_0xe4bc[879]]};mxXmlRequest[_0xe4bc[202]][_0xe4bc[385]]=function(){if(window[_0xe4bc[880]]){return function(){var _0x5d2ax2= new XMLHttpRequest;this[_0xe4bc[871]]()&&_0x5d2ax2[_0xe4bc[881]]&&_0x5d2ax2[_0xe4bc[881]](_0xe4bc[882]);return _0x5d2ax2}};if(_0xe4bc[82]!= typeof ActiveXObject){return function(){return new ActiveXObject(_0xe4bc[883])}}}();mxXmlRequest[_0xe4bc[202]][_0xe4bc[414]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[870]]=this[_0xe4bc[385]]();null!=this[_0xe4bc[870]]&&(null!=_0x5d2ax2&&(this[_0xe4bc[870]][_0xe4bc[416]]=mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[220]]()&&(_0x5d2ax2(this),this[_0xe4bc[884]]=null)})),this[_0xe4bc[870]][_0xe4bc[392]](this[_0xe4bc[865]],this[_0xe4bc[863]],this[_0xe4bc[307]],this[_0xe4bc[867]],this[_0xe4bc[868]]),this[_0xe4bc[886]](this[_0xe4bc[870]],this[_0xe4bc[864]]),this[_0xe4bc[870]][_0xe4bc[414]](this[_0xe4bc[864]]))};mxXmlRequest[_0xe4bc[202]][_0xe4bc[886]]=function(_0x5d2ax2,_0x5d2ax3){null!=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[889]](_0xe4bc[887],_0xe4bc[888])};mxXmlRequest[_0xe4bc[202]][_0xe4bc[415]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2=_0x5d2ax2||document;var _0x5d2ax4=null;_0x5d2ax2==document&&(_0x5d2ax4=window[_0xe4bc[890]],window[_0xe4bc[890]]=null);var _0x5d2ax5=_0x5d2ax2[_0xe4bc[55]](_0xe4bc[891]);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[865],this[_0xe4bc[865]]);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[892],this[_0xe4bc[863]]);null!=_0x5d2ax3&&_0x5d2ax5[_0xe4bc[57]](_0xe4bc[772],_0x5d2ax3);_0x5d2ax5[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];for(var _0x5d2ax9=0navigator[_0xe4bc[3]][_0xe4bc[2]](_0xe4bc[186])&&(this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[277]]=_0x5d2ax2?_0xe4bc[278]:_0xe4bc[188])};mxWindow[_0xe4bc[202]][_0xe4bc[790]]=function(){if(mxWindow[_0xe4bc[930]]!=this){var _0x5d2ax2=mxUtils[_0xe4bc[275]](this[_0xe4bc[166]]()),_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[931]]:3;if(mxWindow[_0xe4bc[930]]){var _0x5d2ax3=mxWindow[_0xe4bc[930]][_0xe4bc[166]]();null!=_0x5d2ax3&&null!=_0x5d2ax3[_0xe4bc[124]]&&(_0x5d2ax3[_0xe4bc[124]][_0xe4bc[931]]=_0x5d2ax2)};_0x5d2ax3=mxWindow[_0xe4bc[930]];this[_0xe4bc[166]]()[_0xe4bc[124]][_0xe4bc[931]]=parseInt(_0x5d2ax2)+1;mxWindow[_0xe4bc[930]]=this;this[_0xe4bc[746]]( new mxEventObject(mxEvent.ACTIVATE,_0xe4bc[932],_0x5d2ax3))}};mxWindow[_0xe4bc[202]][_0xe4bc[166]]=function(){return this[_0xe4bc[485]]};mxWindow[_0xe4bc[202]][_0xe4bc[933]]=function(){mxUtils[_0xe4bc[933]](this[_0xe4bc[485]])};mxWindow[_0xe4bc[202]][_0xe4bc[934]]=function(){return null!=this[_0xe4bc[129]]?_0xe4bc[130]!=this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[495]]:!1};mxWindow[_0xe4bc[202]][_0xe4bc[163]]=function(_0x5d2ax2){_0x5d2ax2?null==this[_0xe4bc[129]]?(this[_0xe4bc[129]]=document[_0xe4bc[55]](_0xe4bc[466]),this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492],this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[553]]=_0xe4bc[935],this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[699]]=_0xe4bc[935],this[_0xe4bc[129]][_0xe4bc[57]](_0xe4bc[390],mxClient[_0xe4bc[88]]+_0xe4bc[922]),this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[936],mxEvent[_0xe4bc[759]](this[_0xe4bc[129]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[790]]();var _0x5d2ax4=mxEvent[_0xe4bc[731]](_0x5d2ax2),_0x5d2ax5=mxEvent[_0xe4bc[733]](_0x5d2ax2),_0x5d2ax9=this[_0xe4bc[485]][_0xe4bc[359]],_0x5d2axa=this[_0xe4bc[485]][_0xe4bc[167]],_0x5d2ax12=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){var _0x5d2ax3=mxEvent[_0xe4bc[731]](_0x5d2ax2)-_0x5d2ax4,_0x5d2ax12=mxEvent[_0xe4bc[733]](_0x5d2ax2)-_0x5d2ax5;this[_0xe4bc[937]](_0x5d2ax9+_0x5d2ax3,_0x5d2axa+_0x5d2ax12);this[_0xe4bc[746]]( new mxEventObject(mxEvent.RESIZE,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)}),_0x5d2ax13=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){mxEvent[_0xe4bc[938]](document,null,_0x5d2ax12,_0x5d2ax13);this[_0xe4bc[746]]( new mxEventObject(mxEvent.RESIZE_END,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)});mxEvent[_0xe4bc[759]](document,null,_0x5d2ax12,_0x5d2ax13);this[_0xe4bc[746]]( new mxEventObject(mxEvent.RESIZE_START,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)}),null,null),this[_0xe4bc[485]][_0xe4bc[62]](this[_0xe4bc[129]])):this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497]:null!=this[_0xe4bc[129]]&&(this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130])};mxWindow[_0xe4bc[202]][_0xe4bc[937]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2=Math[_0xe4bc[160]](this[_0xe4bc[923]][_0xe4bc[117]],_0x5d2ax2);_0x5d2ax3=Math[_0xe4bc[160]](this[_0xe4bc[923]][_0xe4bc[119]],_0x5d2ax3);mxClient[_0xe4bc[80]]||(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2+_0xe4bc[168],this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3+_0xe4bc[168]);this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2+_0xe4bc[168];this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3+_0xe4bc[168];mxClient[_0xe4bc[80]]||(this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[485]][_0xe4bc[167]]-this[_0xe4bc[924]][_0xe4bc[167]]-2+_0xe4bc[168])};mxWindow[_0xe4bc[202]][_0xe4bc[909]]=function(_0x5d2ax2){this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[495]]=_0x5d2ax2?_0xe4bc[110]:_0xe4bc[130]};mxWindow[_0xe4bc[202]][_0xe4bc[939]]=function(){return new mxRectangle(0,0,0,this[_0xe4bc[924]][_0xe4bc[167]])};mxWindow[_0xe4bc[202]][_0xe4bc[907]]=function(){this[_0xe4bc[798]]=document[_0xe4bc[55]](_0xe4bc[466]);this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[915]]);this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[611],_0xe4bc[699]);this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[940]);this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[356];this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[941]]=_0xe4bc[942];this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];this[_0xe4bc[924]][_0xe4bc[62]](this[_0xe4bc[798]]);var _0x5d2ax2=!1,_0x5d2ax3=null,_0x5d2ax4=null,_0x5d2ax5=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax5){this[_0xe4bc[790]]();if(_0x5d2ax2){_0x5d2ax2= !1,this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[915]]),this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[940]),this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[110],this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]]=_0x5d2ax3,mxClient[_0xe4bc[80]]||(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax4),this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax4,null!=this[_0xe4bc[129]]&&(this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110]),this[_0xe4bc[746]]( new mxEventObject(mxEvent.NORMALIZE,_0xe4bc[763],_0x5d2ax5))}else {_0x5d2ax2= !0;this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[917]]);this[_0xe4bc[798]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[943]);this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];_0x5d2ax3=this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]];this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];_0x5d2ax4=this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]];var _0x5d2axa=this[_0xe4bc[939]]();0<_0x5d2axa[_0xe4bc[119]]&&(mxClient[_0xe4bc[80]]||(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2axa[_0xe4bc[119]]+_0xe4bc[168]),this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2axa[_0xe4bc[119]]+_0xe4bc[168]);0<_0x5d2axa[_0xe4bc[117]]&&(mxClient[_0xe4bc[80]]||(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2axa[_0xe4bc[117]]+_0xe4bc[168]),this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2axa[_0xe4bc[117]]+_0xe4bc[168]);null!=this[_0xe4bc[129]]&&(this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188]);this[_0xe4bc[746]]( new mxEventObject(mxEvent.MINIMIZE,_0xe4bc[763],_0x5d2ax5))};mxEvent[_0xe4bc[722]](_0x5d2ax5)});mxEvent[_0xe4bc[169]](this[_0xe4bc[798]],_0xe4bc[751],_0x5d2ax5);mxClient[_0xe4bc[754]]&&mxEvent[_0xe4bc[169]](this[_0xe4bc[798]],_0xe4bc[755],_0x5d2ax5)};mxWindow[_0xe4bc[202]][_0xe4bc[161]]=function(_0x5d2ax2){this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]]=_0x5d2ax2?_0xe4bc[110]:_0xe4bc[130]};mxWindow[_0xe4bc[202]][_0xe4bc[906]]=function(){this[_0xe4bc[800]]=document[_0xe4bc[55]](_0xe4bc[466]);this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[919]]);this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[611],_0xe4bc[699]);this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[944]);this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[583];this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[945]]=_0xe4bc[942];this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[356];this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];this[_0xe4bc[924]][_0xe4bc[62]](this[_0xe4bc[800]]);var _0x5d2ax2=!1,_0x5d2ax3=null,_0x5d2ax4=null,_0x5d2ax5=null,_0x5d2ax9=null,_0x5d2axa=mxUtils[_0xe4bc[885]](this,function(_0x5d2axa){this[_0xe4bc[790]]();if(_0xe4bc[130]!=this[_0xe4bc[800]][_0xe4bc[124]][_0xe4bc[495]]){if(_0x5d2ax2){_0x5d2ax2= !1;this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[919]]);this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[944]);this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[110];this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=_0x5d2ax3+_0xe4bc[168];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]=_0x5d2ax4+_0xe4bc[168];if(!mxClient[_0xe4bc[80]]&&(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax5,this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax9,_0x5d2ax13=mxUtils[_0xe4bc[275]](this[_0xe4bc[929]]),_0xe4bc[278]==_0x5d2ax13[_0xe4bc[277]]||null!=this[_0xe4bc[129]])){this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[485]][_0xe4bc[167]]-this[_0xe4bc[924]][_0xe4bc[167]]-2+_0xe4bc[168]};this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax5;this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax9;null!=this[_0xe4bc[129]]&&(this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110]);this[_0xe4bc[746]]( new mxEventObject(mxEvent.NORMALIZE,_0xe4bc[763],_0x5d2axa))}else {_0x5d2ax2= !0;this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[917]]);this[_0xe4bc[800]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[943]);this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[110];this[_0xe4bc[798]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];_0x5d2ax3=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]);_0x5d2ax4=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]);_0x5d2ax5=this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]];_0x5d2ax9=this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[117]];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=_0xe4bc[946];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]=_0xe4bc[946];mxClient[_0xe4bc[80]]||(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=document[_0xe4bc[112]][_0xe4bc[157]]-2+_0xe4bc[168],this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=document[_0xe4bc[112]][_0xe4bc[159]]-2+_0xe4bc[168]);this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[117]]=document[_0xe4bc[112]][_0xe4bc[159]]-2+_0xe4bc[168];this[_0xe4bc[116]][_0xe4bc[124]][_0xe4bc[119]]=document[_0xe4bc[112]][_0xe4bc[157]]-2+_0xe4bc[168];null!=this[_0xe4bc[129]]&&(this[_0xe4bc[129]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188]);if(!mxClient[_0xe4bc[80]]){var _0x5d2ax13=mxUtils[_0xe4bc[275]](this[_0xe4bc[929]]);if(_0xe4bc[278]==_0x5d2ax13[_0xe4bc[277]]||null!=this[_0xe4bc[129]]){this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[485]][_0xe4bc[167]]-this[_0xe4bc[924]][_0xe4bc[167]]-2+_0xe4bc[168]}};this[_0xe4bc[746]]( new mxEventObject(mxEvent.MAXIMIZE,_0xe4bc[763],_0x5d2axa))};mxEvent[_0xe4bc[722]](_0x5d2axa)}});mxEvent[_0xe4bc[759]](this[_0xe4bc[800]],_0x5d2axa);mxEvent[_0xe4bc[169]](this[_0xe4bc[924]],_0xe4bc[760],_0x5d2axa)};mxWindow[_0xe4bc[202]][_0xe4bc[911]]=function(){this[_0xe4bc[924]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[582];mxEvent[_0xe4bc[759]](this[_0xe4bc[924]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){var _0x5d2ax3=mxEvent[_0xe4bc[731]](_0x5d2ax2),_0x5d2ax4=mxEvent[_0xe4bc[733]](_0x5d2ax2),_0x5d2ax5=this[_0xe4bc[730]](),_0x5d2ax9=this[_0xe4bc[732]](),_0x5d2axa=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){var _0x5d2axa=mxEvent[_0xe4bc[731]](_0x5d2ax2)-_0x5d2ax3,_0x5d2ax12=mxEvent[_0xe4bc[733]](_0x5d2ax2)-_0x5d2ax4;this[_0xe4bc[947]](_0x5d2ax5+_0x5d2axa,_0x5d2ax9+_0x5d2ax12);this[_0xe4bc[746]]( new mxEventObject(mxEvent.MOVE,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)}),_0x5d2ax12=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){mxEvent[_0xe4bc[938]](document,null,_0x5d2axa,_0x5d2ax12);this[_0xe4bc[746]]( new mxEventObject(mxEvent.MOVE_END,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)});mxEvent[_0xe4bc[759]](document,null,_0x5d2axa,_0x5d2ax12);this[_0xe4bc[746]]( new mxEventObject(mxEvent.MOVE_START,_0xe4bc[763],_0x5d2ax2));mxEvent[_0xe4bc[722]](_0x5d2ax2)}))};mxWindow[_0xe4bc[202]][_0xe4bc[947]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=_0x5d2ax2+_0xe4bc[168];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]=_0x5d2ax3+_0xe4bc[168]};mxWindow[_0xe4bc[202]][_0xe4bc[730]]=function(){return parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]])};mxWindow[_0xe4bc[202]][_0xe4bc[732]]=function(){return parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]])};mxWindow[_0xe4bc[202]][_0xe4bc[908]]=function(){this[_0xe4bc[948]]=document[_0xe4bc[55]](_0xe4bc[466]);this[_0xe4bc[948]][_0xe4bc[57]](_0xe4bc[390],this[_0xe4bc[913]]);this[_0xe4bc[948]][_0xe4bc[57]](_0xe4bc[611],_0xe4bc[699]);this[_0xe4bc[948]][_0xe4bc[57]](_0xe4bc[924],_0xe4bc[949]);this[_0xe4bc[948]][_0xe4bc[124]][_0xe4bc[945]]=_0xe4bc[935];this[_0xe4bc[948]][_0xe4bc[124]][_0xe4bc[270]]=_0xe4bc[356];this[_0xe4bc[948]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];this[_0xe4bc[924]][_0xe4bc[950]](this[_0xe4bc[948]],this[_0xe4bc[924]][_0xe4bc[285]]);mxEvent[_0xe4bc[759]](this[_0xe4bc[948]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[746]]( new mxEventObject(mxEvent.CLOSE,_0xe4bc[763],_0x5d2ax2));this[_0xe4bc[165]]?this[_0xe4bc[515]]():this[_0xe4bc[175]](!1);mxEvent[_0xe4bc[722]](_0x5d2ax2)}))};mxWindow[_0xe4bc[202]][_0xe4bc[951]]=function(_0x5d2ax2){this[_0xe4bc[618]]=document[_0xe4bc[55]](_0xe4bc[466]);this[_0xe4bc[618]][_0xe4bc[57]](_0xe4bc[390],_0x5d2ax2);this[_0xe4bc[618]][_0xe4bc[57]](_0xe4bc[611],_0xe4bc[361]);this[_0xe4bc[618]][_0xe4bc[124]][_0xe4bc[941]]=_0xe4bc[952];this[_0xe4bc[618]][_0xe4bc[124]][_0xe4bc[945]]=_0xe4bc[946];this[_0xe4bc[618]][_0xe4bc[124]][_0xe4bc[953]]=_0xe4bc[954];this[_0xe4bc[924]][_0xe4bc[950]](this[_0xe4bc[618]],this[_0xe4bc[924]][_0xe4bc[285]])};mxWindow[_0xe4bc[202]][_0xe4bc[164]]=function(_0x5d2ax2){this[_0xe4bc[948]][_0xe4bc[124]][_0xe4bc[495]]=_0x5d2ax2?_0xe4bc[110]:_0xe4bc[130]};mxWindow[_0xe4bc[202]][_0xe4bc[174]]=function(){return null!=this[_0xe4bc[485]]?_0xe4bc[188]!=this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[187]]:!1};mxWindow[_0xe4bc[202]][_0xe4bc[175]]=function(_0x5d2ax2){null!=this[_0xe4bc[485]]&&this[_0xe4bc[174]]()!=_0x5d2ax2&&(_0x5d2ax2?this[_0xe4bc[539]]():this[_0xe4bc[801]]())};mxWindow[_0xe4bc[202]][_0xe4bc[539]]=function(){this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110];this[_0xe4bc[790]]();var _0x5d2ax2=mxUtils[_0xe4bc[275]](this[_0xe4bc[929]]);if(!mxClient[_0xe4bc[80]]&&(_0xe4bc[278]==_0x5d2ax2[_0xe4bc[277]]||null!=this[_0xe4bc[129]])){this[_0xe4bc[929]][_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[485]][_0xe4bc[167]]-this[_0xe4bc[924]][_0xe4bc[167]]-2+_0xe4bc[168]};this[_0xe4bc[746]]( new mxEventObject(mxEvent.SHOW))};mxWindow[_0xe4bc[202]][_0xe4bc[801]]=function(){this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];this[_0xe4bc[746]]( new mxEventObject(mxEvent.HIDE))};mxWindow[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[746]]( new mxEventObject(mxEvent.DESTROY));null!=this[_0xe4bc[485]]&&(mxEvent[_0xe4bc[762]](this[_0xe4bc[485]]),this[_0xe4bc[485]][_0xe4bc[265]][_0xe4bc[266]](this[_0xe4bc[485]]),this[_0xe4bc[485]]=null);this[_0xe4bc[929]]=this[_0xe4bc[905]]=this[_0xe4bc[924]]=null};function mxForm(_0x5d2ax2){this[_0xe4bc[116]]=document[_0xe4bc[55]](_0xe4bc[116]);this[_0xe4bc[116]][_0xe4bc[926]]=_0x5d2ax2;this[_0xe4bc[112]]=document[_0xe4bc[55]](_0xe4bc[120]);this[_0xe4bc[116]][_0xe4bc[62]](this[_0xe4bc[112]])}mxForm[_0xe4bc[202]][_0xe4bc[116]]=null;mxForm[_0xe4bc[202]][_0xe4bc[112]]= !1;mxForm[_0xe4bc[202]][_0xe4bc[955]]=function(){return this[_0xe4bc[116]]};mxForm[_0xe4bc[202]][_0xe4bc[956]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[121]),_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]);_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]),_0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[172]);mxUtils[_0xe4bc[53]](_0x5d2ax9,mxResources[_0xe4bc[203]](_0xe4bc[957])||_0xe4bc[958]);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);mxEvent[_0xe4bc[169]](_0x5d2ax9,_0xe4bc[173],function(){_0x5d2ax2()});_0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[172]);mxUtils[_0xe4bc[53]](_0x5d2ax9,mxResources[_0xe4bc[203]](_0xe4bc[959])||_0xe4bc[960]);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);mxEvent[_0xe4bc[169]](_0x5d2ax9,_0xe4bc[173],function(){_0x5d2ax3()});_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);this[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax4)};mxForm[_0xe4bc[202]][_0xe4bc[961]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[962]);_0x5d2ax4[_0xe4bc[57]](_0xe4bc[60],_0xe4bc[963]);_0x5d2ax4[_0xe4bc[131]]=_0x5d2ax3;return this[_0xe4bc[964]](_0x5d2ax2,_0x5d2ax4)};mxForm[_0xe4bc[202]][_0xe4bc[965]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[962]);_0x5d2ax4[_0xe4bc[57]](_0xe4bc[60],_0xe4bc[966]);this[_0xe4bc[964]](_0x5d2ax2,_0x5d2ax4);_0x5d2ax3&&(_0x5d2ax4[_0xe4bc[967]]= !0);return _0x5d2ax4};mxForm[_0xe4bc[202]][_0xe4bc[968]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[126]);mxClient[_0xe4bc[133]]&&_0x5d2ax4--;_0x5d2ax5[_0xe4bc[57]](_0xe4bc[969],_0x5d2ax4||2);_0x5d2ax5[_0xe4bc[131]]=_0x5d2ax3;return this[_0xe4bc[964]](_0x5d2ax2,_0x5d2ax5)};mxForm[_0xe4bc[202]][_0xe4bc[970]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[804]);null!=_0x5d2ax4&&_0x5d2ax5[_0xe4bc[57]](_0xe4bc[803],_0x5d2ax4);_0x5d2ax3&&_0x5d2ax5[_0xe4bc[57]](_0xe4bc[971],_0xe4bc[128]);return this[_0xe4bc[964]](_0x5d2ax2,_0x5d2ax5)};mxForm[_0xe4bc[202]][_0xe4bc[972]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[973]);mxUtils[_0xe4bc[171]](_0x5d2ax9,_0x5d2ax3);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[131],_0x5d2ax4);_0x5d2ax5&&_0x5d2ax9[_0xe4bc[57]](_0xe4bc[974],_0x5d2ax5);_0x5d2ax2[_0xe4bc[62]](_0x5d2ax9)};mxForm[_0xe4bc[202]][_0xe4bc[964]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[121]),_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]);mxUtils[_0xe4bc[53]](_0x5d2ax5,_0x5d2ax2);_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax3);_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);this[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax4);return _0x5d2ax3};function mxImage(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[390]]=_0x5d2ax2;this[_0xe4bc[117]]=_0x5d2ax3;this[_0xe4bc[119]]=_0x5d2ax4}mxImage[_0xe4bc[202]][_0xe4bc[390]]=null;mxImage[_0xe4bc[202]][_0xe4bc[117]]=null;mxImage[_0xe4bc[202]][_0xe4bc[119]]=null;function mxDivResizer(_0x5d2ax2,_0x5d2ax3){if(_0xe4bc[485]==_0x5d2ax2[_0xe4bc[301]][_0xe4bc[216]]()){null==_0x5d2ax3&&(_0x5d2ax3=window);this[_0xe4bc[485]]=_0x5d2ax2;var _0x5d2ax4=mxUtils[_0xe4bc[275]](_0x5d2ax2);null!=_0x5d2ax4&&(this[_0xe4bc[975]]=_0xe4bc[278]==_0x5d2ax4[_0xe4bc[117]],this[_0xe4bc[976]]=_0xe4bc[278]==_0x5d2ax4[_0xe4bc[119]]);mxEvent[_0xe4bc[169]](_0x5d2ax3,_0xe4bc[129],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[977]]||(this[_0xe4bc[977]]= !0,this[_0xe4bc[129]](),this[_0xe4bc[977]]= !1)}));this[_0xe4bc[129]]()}}mxDivResizer[_0xe4bc[202]][_0xe4bc[975]]= !0;mxDivResizer[_0xe4bc[202]][_0xe4bc[976]]= !0;mxDivResizer[_0xe4bc[202]][_0xe4bc[977]]= !1;mxDivResizer[_0xe4bc[202]][_0xe4bc[129]]=function(){var _0x5d2ax2=this[_0xe4bc[978]](),_0x5d2ax3=this[_0xe4bc[979]](),_0x5d2ax4=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]),_0x5d2ax5=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[699]]),_0x5d2ax9=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]),_0x5d2axa=parseInt(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[553]]);this[_0xe4bc[975]]&&(!isNaN(_0x5d2ax4)&&!isNaN(_0x5d2ax5)&&0<=_0x5d2ax4&&0<=_0x5d2ax5&&0<_0x5d2ax2-_0x5d2ax5-_0x5d2ax4)&&(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2-_0x5d2ax5-_0x5d2ax4+_0xe4bc[168]);this[_0xe4bc[976]]&&(!isNaN(_0x5d2ax9)&&!isNaN(_0x5d2axa)&&0<=_0x5d2ax9&&0<=_0x5d2axa&&0<_0x5d2ax3-_0x5d2ax9-_0x5d2axa)&&(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3-_0x5d2ax9-_0x5d2axa+_0xe4bc[168])};mxDivResizer[_0xe4bc[202]][_0xe4bc[978]]=function(){return document[_0xe4bc[112]][_0xe4bc[159]]};mxDivResizer[_0xe4bc[202]][_0xe4bc[979]]=function(){return document[_0xe4bc[112]][_0xe4bc[157]]};function mxDragSource(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[980]]=_0x5d2ax2;this[_0xe4bc[981]]=_0x5d2ax3;mxEvent[_0xe4bc[759]](_0x5d2ax2,mxUtils[_0xe4bc[885]](this,this[_0xe4bc[787]]))}mxDragSource[_0xe4bc[202]][_0xe4bc[980]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[981]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[559]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[982]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[983]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[984]]= !0;mxDragSource[_0xe4bc[202]][_0xe4bc[985]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[986]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[987]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[988]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[989]]=null;mxDragSource[_0xe4bc[202]][_0xe4bc[561]]= !0;mxDragSource[_0xe4bc[202]][_0xe4bc[990]]= !0;mxDragSource[_0xe4bc[202]][_0xe4bc[991]]= !0;mxDragSource[_0xe4bc[202]][_0xe4bc[563]]= !0;mxDragSource[_0xe4bc[202]][_0xe4bc[992]]=100;mxDragSource[_0xe4bc[202]][_0xe4bc[993]]=70;mxDragSource[_0xe4bc[202]][_0xe4bc[994]]=function(){return this[_0xe4bc[984]]};mxDragSource[_0xe4bc[202]][_0xe4bc[995]]=function(_0x5d2ax2){this[_0xe4bc[984]]=_0x5d2ax2};mxDragSource[_0xe4bc[202]][_0xe4bc[996]]=function(){return this[_0xe4bc[990]]};mxDragSource[_0xe4bc[202]][_0xe4bc[562]]=function(_0x5d2ax2){this[_0xe4bc[990]]=_0x5d2ax2};mxDragSource[_0xe4bc[202]][_0xe4bc[997]]=function(){return this[_0xe4bc[991]]};mxDragSource[_0xe4bc[202]][_0xe4bc[998]]=function(_0x5d2ax2){this[_0xe4bc[991]]=_0x5d2ax2};mxDragSource[_0xe4bc[202]][_0xe4bc[565]]=function(_0x5d2ax2){return null};mxDragSource[_0xe4bc[202]][_0xe4bc[564]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax2[_0xe4bc[999]](_0x5d2ax3,_0x5d2ax4)};mxDragSource[_0xe4bc[202]][_0xe4bc[566]]=function(_0x5d2ax2){return this[_0xe4bc[980]][_0xe4bc[511]](!0)};mxDragSource[_0xe4bc[202]][_0xe4bc[567]]=function(_0x5d2ax2){return null};mxDragSource[_0xe4bc[202]][_0xe4bc[787]]=function(_0x5d2ax2){this[_0xe4bc[984]]&&(!mxEvent[_0xe4bc[721]](_0x5d2ax2)&&null==this[_0xe4bc[1000]])&&(this[_0xe4bc[1001]](_0x5d2ax2),this[_0xe4bc[1000]]=mxUtils[_0xe4bc[885]](this,this[_0xe4bc[788]]),this[_0xe4bc[1002]]=mxUtils[_0xe4bc[885]](this,this[_0xe4bc[789]]),mxEvent[_0xe4bc[759]](document,null,this[_0xe4bc[1000]],this[_0xe4bc[1002]]),mxEvent[_0xe4bc[722]](_0x5d2ax2,!0,!1))};mxDragSource[_0xe4bc[202]][_0xe4bc[1001]]=function(_0x5d2ax2){this[_0xe4bc[982]]=this[_0xe4bc[566]](_0x5d2ax2);this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[931]]=this[_0xe4bc[992]];mxUtils[_0xe4bc[254]](this[_0xe4bc[982]],this[_0xe4bc[993]])};mxDragSource[_0xe4bc[202]][_0xe4bc[1003]]=function(_0x5d2ax2){null!=this[_0xe4bc[982]]&&(null!=this[_0xe4bc[982]][_0xe4bc[265]]&&this[_0xe4bc[982]][_0xe4bc[265]][_0xe4bc[266]](this[_0xe4bc[982]]),this[_0xe4bc[982]]=null)};mxDragSource[_0xe4bc[202]][_0xe4bc[1004]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=mxEvent[_0xe4bc[731]](_0x5d2ax3),_0x5d2ax5=mxEvent[_0xe4bc[733]](_0x5d2ax3),_0x5d2ax9=mxUtils[_0xe4bc[445]](_0x5d2ax2[_0xe4bc[526]]),_0x5d2axa=mxUtils[_0xe4bc[444]]();return _0x5d2ax4>=_0x5d2ax9[_0xe4bc[235]]-_0x5d2axa[_0xe4bc[235]]&&_0x5d2ax5>=_0x5d2ax9[_0xe4bc[236]]-_0x5d2axa[_0xe4bc[236]]&&_0x5d2ax4<=_0x5d2ax9[_0xe4bc[235]]-_0x5d2axa[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[526]][_0xe4bc[359]]&&_0x5d2ax5<=_0x5d2ax9[_0xe4bc[236]]-_0x5d2axa[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[526]][_0xe4bc[167]]};mxDragSource[_0xe4bc[202]][_0xe4bc[788]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[565]](_0x5d2ax2);null!=_0x5d2ax3&&!this[_0xe4bc[1004]](_0x5d2ax3,_0x5d2ax2)&&(_0x5d2ax3=null);_0x5d2ax3!=this[_0xe4bc[985]]&&(null!=this[_0xe4bc[985]]&&this[_0xe4bc[1005]](this[_0xe4bc[985]]),this[_0xe4bc[985]]=_0x5d2ax3,null!=this[_0xe4bc[985]]&&this[_0xe4bc[1006]](this[_0xe4bc[985]]));null!=this[_0xe4bc[985]]&&this[_0xe4bc[1007]](this[_0xe4bc[985]],_0x5d2ax2);if(null!=this[_0xe4bc[982]]&&(null==this[_0xe4bc[983]]||_0xe4bc[189]!=this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[187]])){var _0x5d2ax3=mxEvent[_0xe4bc[731]](_0x5d2ax2),_0x5d2ax4=mxEvent[_0xe4bc[733]](_0x5d2ax2);null==this[_0xe4bc[982]][_0xe4bc[265]]&&document[_0xe4bc[112]][_0xe4bc[62]](this[_0xe4bc[982]]);this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[189];null!=this[_0xe4bc[559]]&&(_0x5d2ax3+=this[_0xe4bc[559]][_0xe4bc[235]],_0x5d2ax4+=this[_0xe4bc[559]][_0xe4bc[236]]);_0x5d2ax3+=document[_0xe4bc[112]][_0xe4bc[360]]||document[_0xe4bc[158]][_0xe4bc[360]];_0x5d2ax4+=document[_0xe4bc[112]][_0xe4bc[190]]||document[_0xe4bc[158]][_0xe4bc[190]];this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[361]]=_0x5d2ax3+_0xe4bc[168];this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[125]]=_0x5d2ax4+_0xe4bc[168]}else {null!=this[_0xe4bc[982]]&&(this[_0xe4bc[982]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188])};mxEvent[_0xe4bc[722]](_0x5d2ax2)};mxDragSource[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2){if(null!=this[_0xe4bc[985]]){if(null!=this[_0xe4bc[987]]&&(null==this[_0xe4bc[983]]||_0xe4bc[188]!=this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[187]])){var _0x5d2ax3=this[_0xe4bc[985]][_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax4=this[_0xe4bc[985]][_0xe4bc[441]][_0xe4bc[513]];this[_0xe4bc[1008]](this[_0xe4bc[985]],_0x5d2ax2,this[_0xe4bc[986]],this[_0xe4bc[987]][_0xe4bc[235]]/_0x5d2ax3-_0x5d2ax4[_0xe4bc[235]],this[_0xe4bc[987]][_0xe4bc[236]]/_0x5d2ax3-_0x5d2ax4[_0xe4bc[236]])};this[_0xe4bc[1005]](this[_0xe4bc[985]])};this[_0xe4bc[1003]](_0x5d2ax2);mxEvent[_0xe4bc[938]](document,null,this[_0xe4bc[1000]],this[_0xe4bc[1002]]);this[_0xe4bc[985]]=this[_0xe4bc[1002]]=this[_0xe4bc[1000]]=null;mxEvent[_0xe4bc[722]](_0x5d2ax2)};mxDragSource[_0xe4bc[202]][_0xe4bc[1006]]=function(_0x5d2ax2){_0x5d2ax2[_0xe4bc[1009]]= !0;this[_0xe4bc[983]]=this[_0xe4bc[567]](_0x5d2ax2);this[_0xe4bc[996]]()&&null!=this[_0xe4bc[983]]&&(this[_0xe4bc[988]]= new mxGuide(_0x5d2ax2,_0x5d2ax2[_0xe4bc[1011]][_0xe4bc[1010]]()));this[_0xe4bc[563]]&&(this[_0xe4bc[989]]= new mxCellHighlight(_0x5d2ax2,mxConstants.DROP_TARGET_COLOR))};mxDragSource[_0xe4bc[202]][_0xe4bc[1005]]=function(_0x5d2ax2){this[_0xe4bc[987]]=this[_0xe4bc[986]]=null;_0x5d2ax2[_0xe4bc[1009]]= !1;null!=this[_0xe4bc[983]]&&(null!=this[_0xe4bc[983]][_0xe4bc[265]]&&this[_0xe4bc[983]][_0xe4bc[265]][_0xe4bc[266]](this[_0xe4bc[983]]),this[_0xe4bc[983]]=null);null!=this[_0xe4bc[988]]&&(this[_0xe4bc[988]][_0xe4bc[515]](),this[_0xe4bc[988]]=null);null!=this[_0xe4bc[989]]&&(this[_0xe4bc[989]][_0xe4bc[515]](),this[_0xe4bc[989]]=null)};mxDragSource[_0xe4bc[202]][_0xe4bc[1007]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=mxUtils[_0xe4bc[445]](_0x5d2ax2[_0xe4bc[526]]),_0x5d2ax5=mxUtils[_0xe4bc[444]](_0x5d2ax2[_0xe4bc[526]]),_0x5d2ax9=mxEvent[_0xe4bc[731]](_0x5d2ax3)-_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax5[_0xe4bc[235]],_0x5d2ax4=mxEvent[_0xe4bc[733]](_0x5d2ax3)-_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax5[_0xe4bc[236]];_0x5d2ax2[_0xe4bc[1012]]&&(null==this[_0xe4bc[561]]||this[_0xe4bc[561]])&&_0x5d2ax2[_0xe4bc[1014]](_0x5d2ax9,_0x5d2ax4,_0x5d2ax2[_0xe4bc[1013]]);null!=this[_0xe4bc[989]]&&_0x5d2ax2[_0xe4bc[1015]]()&&(this[_0xe4bc[986]]=this[_0xe4bc[564]](_0x5d2ax2,_0x5d2ax9,_0x5d2ax4),_0x5d2ax5=_0x5d2ax2[_0xe4bc[249]]()[_0xe4bc[248]](this[_0xe4bc[986]]),this[_0xe4bc[989]][_0xe4bc[1016]](_0x5d2ax5));if(null!=this[_0xe4bc[983]]){null==this[_0xe4bc[983]][_0xe4bc[265]]&&(_0x5d2ax2[_0xe4bc[526]][_0xe4bc[62]](this[_0xe4bc[983]]),this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[931]]=_0xe4bc[1017],this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492]);var _0x5d2ax5=this[_0xe4bc[997]]()&&_0x5d2ax2[_0xe4bc[1018]](_0x5d2ax3),_0x5d2axa=!0;if(null!=this[_0xe4bc[988]]&&this[_0xe4bc[988]][_0xe4bc[1019]](_0x5d2ax3)){var _0x5d2axa=parseInt(this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[117]]),_0x5d2ax12=parseInt(this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[119]]),_0x5d2axa= new mxRectangle(0,0,_0x5d2axa,_0x5d2ax12),_0x5d2ax4= new mxPoint(_0x5d2ax9,_0x5d2ax4),_0x5d2ax4=this[_0xe4bc[988]][_0xe4bc[582]](_0x5d2axa,_0x5d2ax4,_0x5d2ax5),_0x5d2axa=!1,_0x5d2ax9=_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4=_0x5d2ax4[_0xe4bc[236]]}else {if(_0x5d2ax5){var _0x5d2ax5=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax12=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[513]],_0x5d2ax13=_0x5d2ax2[_0xe4bc[1020]]/2,_0x5d2ax9=(_0x5d2ax2[_0xe4bc[1021]](_0x5d2ax9/_0x5d2ax5-_0x5d2ax12[_0xe4bc[235]]-_0x5d2ax13)+_0x5d2ax12[_0xe4bc[235]])*_0x5d2ax5,_0x5d2ax4=(_0x5d2ax2[_0xe4bc[1021]](_0x5d2ax4/_0x5d2ax5-_0x5d2ax12[_0xe4bc[236]]-_0x5d2ax13)+_0x5d2ax12[_0xe4bc[236]])*_0x5d2ax5}};null!=this[_0xe4bc[988]]&&_0x5d2axa&&this[_0xe4bc[988]][_0xe4bc[801]]();null!=this[_0xe4bc[1022]]&&(_0x5d2ax9+=this[_0xe4bc[1022]][_0xe4bc[235]],_0x5d2ax4+=this[_0xe4bc[1022]][_0xe4bc[236]]);this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[361]]=Math[_0xe4bc[488]](_0x5d2ax9)+_0xe4bc[168];this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[125]]=Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[168];this[_0xe4bc[983]][_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[189]};this[_0xe4bc[987]]= new mxPoint(_0x5d2ax9,_0x5d2ax4)};mxDragSource[_0xe4bc[202]][_0xe4bc[1008]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){this[_0xe4bc[981]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[526]][_0xe4bc[393]]()};function mxToolbar(_0x5d2ax2){this[_0xe4bc[526]]=_0x5d2ax2}mxToolbar[_0xe4bc[202]]= new mxEventSource;mxToolbar[_0xe4bc[202]][_0xe4bc[196]]=mxToolbar;mxToolbar[_0xe4bc[202]][_0xe4bc[526]]=null;mxToolbar[_0xe4bc[202]][_0xe4bc[984]]= !0;mxToolbar[_0xe4bc[202]][_0xe4bc[1023]]= !1;mxToolbar[_0xe4bc[202]][_0xe4bc[1024]]= !0;mxToolbar[_0xe4bc[202]][_0xe4bc[1025]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){var _0x5d2ax12=document[_0xe4bc[55]](null!=_0x5d2ax3?_0xe4bc[466]:_0xe4bc[172]),_0x5d2ax13=_0x5d2ax9||(null!=_0x5d2axa?_0xe4bc[1026]:_0xe4bc[1027]);_0x5d2ax12[_0xe4bc[926]]=_0x5d2ax13;_0x5d2ax12[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax3);null!=_0x5d2ax2&&(null!=_0x5d2ax3?_0x5d2ax12[_0xe4bc[57]](_0xe4bc[924],_0x5d2ax2):mxUtils[_0xe4bc[53]](_0x5d2ax12,_0x5d2ax2));this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2ax12);null!=_0x5d2ax4&&(mxEvent[_0xe4bc[169]](_0x5d2ax12,_0xe4bc[173],_0x5d2ax4),mxClient[_0xe4bc[754]]&&mxEvent[_0xe4bc[169]](_0x5d2ax12,_0xe4bc[757],_0x5d2ax4));_0x5d2ax2=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){null!=_0x5d2ax5?_0x5d2ax12[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax3):_0x5d2ax12[_0xe4bc[124]][_0xe4bc[1028]]=_0xe4bc[110]});mxEvent[_0xe4bc[759]](_0x5d2ax12,mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){null!=_0x5d2ax5?_0x5d2ax12[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax5):_0x5d2ax12[_0xe4bc[124]][_0xe4bc[1028]]=_0xe4bc[579];if(null!=_0x5d2axa){null==this[_0xe4bc[1029]]&&(this[_0xe4bc[1029]]= new mxPopupMenu,this[_0xe4bc[1029]][_0xe4bc[176]]());var _0x5d2ax3=this[_0xe4bc[1030]];this[_0xe4bc[1029]][_0xe4bc[1031]]()&&this[_0xe4bc[1029]][_0xe4bc[1032]]();_0x5d2ax3!=_0x5d2ax12&&(this[_0xe4bc[1030]]=_0x5d2ax12,this[_0xe4bc[1029]][_0xe4bc[1033]]=_0x5d2axa,_0x5d2ax3= new mxPoint(_0x5d2ax12[_0xe4bc[358]],_0x5d2ax12[_0xe4bc[362]]+_0x5d2ax12[_0xe4bc[167]]),this[_0xe4bc[1029]][_0xe4bc[152]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],null,_0x5d2ax2),this[_0xe4bc[1029]][_0xe4bc[1031]]()&&(_0x5d2ax12[_0xe4bc[926]]=_0x5d2ax13+_0xe4bc[1034],this[_0xe4bc[1029]][_0xe4bc[1032]]=function(){mxPopupMenu[_0xe4bc[202]][_0xe4bc[1032]][_0xe4bc[183]](this);_0x5d2ax12[_0xe4bc[926]]=_0x5d2ax13;this[_0xe4bc[1030]]=null}))}}),null,_0x5d2ax2);mxEvent[_0xe4bc[169]](_0x5d2ax12,_0xe4bc[1035],_0x5d2ax2);return _0x5d2ax12};mxToolbar[_0xe4bc[202]][_0xe4bc[970]]=function(_0x5d2ax2){var _0x5d2ax3=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax3[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497];_0x5d2ax3[_0xe4bc[926]]=_0xe4bc[1036];var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[804]);_0x5d2ax4[_0xe4bc[926]]=_0x5d2ax2||_0xe4bc[1037];_0x5d2ax3[_0xe4bc[62]](_0x5d2ax4);this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2ax3);return _0x5d2ax4};mxToolbar[_0xe4bc[202]][_0xe4bc[1038]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[804]);_0x5d2ax4[_0xe4bc[926]]=_0x5d2ax3||_0xe4bc[1037];this[_0xe4bc[972]](_0x5d2ax4,_0x5d2ax2,null);mxEvent[_0xe4bc[169]](_0x5d2ax4,_0xe4bc[826],function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax4[_0xe4bc[1040]][_0x5d2ax4[_0xe4bc[1039]]];_0x5d2ax4[_0xe4bc[1039]]=0;null!=_0x5d2ax3[_0xe4bc[1041]]&&_0x5d2ax3[_0xe4bc[1041]](_0x5d2ax2)});this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2ax4);return _0x5d2ax4};mxToolbar[_0xe4bc[202]][_0xe4bc[972]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[973]);mxUtils[_0xe4bc[171]](_0x5d2ax5,_0x5d2ax3);_0xe4bc[279]== typeof _0x5d2ax4?_0x5d2ax5[_0xe4bc[1041]]=_0x5d2ax4:_0x5d2ax5[_0xe4bc[57]](_0xe4bc[131],_0x5d2ax4);_0x5d2ax2[_0xe4bc[62]](_0x5d2ax5);return _0x5d2ax5};mxToolbar[_0xe4bc[202]][_0xe4bc[1042]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=document[_0xe4bc[55]](_0xe4bc[466]);_0x5d2axa[_0xe4bc[1043]]=_0x5d2ax9||_0xe4bc[1026];_0x5d2axa[_0xe4bc[926]]=_0x5d2axa[_0xe4bc[1043]];_0x5d2axa[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax3);_0x5d2axa[_0xe4bc[1044]]=_0x5d2ax5;null!=_0x5d2ax2&&_0x5d2axa[_0xe4bc[57]](_0xe4bc[924],_0x5d2ax2);mxEvent[_0xe4bc[169]](_0x5d2axa,_0xe4bc[173],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){_0x5d2ax2=this[_0xe4bc[1045]][_0xe4bc[1044]];null!=_0x5d2ax2?(this[_0xe4bc[1045]][_0xe4bc[1044]]=this[_0xe4bc[1045]][_0xe4bc[284]](_0xe4bc[390]),this[_0xe4bc[1045]][_0xe4bc[57]](_0xe4bc[390],_0x5d2ax2)):this[_0xe4bc[1045]][_0xe4bc[926]]=this[_0xe4bc[1045]][_0xe4bc[1043]];this[_0xe4bc[1024]]&&(this[_0xe4bc[1046]]=_0x5d2axa);this[_0xe4bc[1045]]=_0x5d2axa;_0x5d2ax2=_0x5d2axa[_0xe4bc[1044]];null!=_0x5d2ax2?(_0x5d2axa[_0xe4bc[1044]]=_0x5d2axa[_0xe4bc[284]](_0xe4bc[390]),_0x5d2axa[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax2)):_0x5d2axa[_0xe4bc[926]]=_0x5d2axa[_0xe4bc[1043]]+_0xe4bc[1034];this[_0xe4bc[746]]( new mxEventObject(mxEvent.SELECT));_0x5d2ax4()}));this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2axa);null==this[_0xe4bc[1046]]&&(this[_0xe4bc[1046]]=_0x5d2axa,this[_0xe4bc[1047]](_0x5d2axa),_0x5d2ax4());return _0x5d2axa};mxToolbar[_0xe4bc[202]][_0xe4bc[1048]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:!0;var _0x5d2ax12=document[_0xe4bc[55]](null!=_0x5d2ax3?_0xe4bc[466]:_0xe4bc[172]);_0x5d2ax12[_0xe4bc[1043]]=_0x5d2ax9||_0xe4bc[1026];_0x5d2ax12[_0xe4bc[926]]=_0x5d2ax12[_0xe4bc[1043]];_0x5d2ax12[_0xe4bc[57]](_0xe4bc[390],_0x5d2ax3);_0x5d2ax12[_0xe4bc[1044]]=_0x5d2ax5;null!=_0x5d2ax2&&_0x5d2ax12[_0xe4bc[57]](_0xe4bc[924],_0x5d2ax2);this[_0xe4bc[984]]&&_0x5d2axa&&(mxEvent[_0xe4bc[169]](_0x5d2ax12,_0xe4bc[173],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1047]](_0x5d2ax12,_0x5d2ax4);this[_0xe4bc[1023]]= !1})),mxEvent[_0xe4bc[169]](_0x5d2ax12,_0xe4bc[760],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1047]](_0x5d2ax12,_0x5d2ax4);this[_0xe4bc[1023]]= !0})),null==this[_0xe4bc[1046]]&&(this[_0xe4bc[1046]]=_0x5d2ax12,this[_0xe4bc[1049]]=_0x5d2ax4,this[_0xe4bc[1047]](_0x5d2ax12,_0x5d2ax4)));this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2ax12);return _0x5d2ax12};mxToolbar[_0xe4bc[202]][_0xe4bc[1047]]=function(_0x5d2ax2,_0x5d2ax3){if(this[_0xe4bc[1045]]!=_0x5d2ax2){if(null!=this[_0xe4bc[1045]]){var _0x5d2ax4=this[_0xe4bc[1045]][_0xe4bc[1044]];null!=_0x5d2ax4?(this[_0xe4bc[1045]][_0xe4bc[1044]]=this[_0xe4bc[1045]][_0xe4bc[284]](_0xe4bc[390]),this[_0xe4bc[1045]][_0xe4bc[57]](_0xe4bc[390],_0x5d2ax4)):this[_0xe4bc[1045]][_0xe4bc[926]]=this[_0xe4bc[1045]][_0xe4bc[1043]]};this[_0xe4bc[1045]]=_0x5d2ax2;_0x5d2ax4=this[_0xe4bc[1045]][_0xe4bc[1044]];null!=_0x5d2ax4?(this[_0xe4bc[1045]][_0xe4bc[1044]]=this[_0xe4bc[1045]][_0xe4bc[284]](_0xe4bc[390]),this[_0xe4bc[1045]][_0xe4bc[57]](_0xe4bc[390],_0x5d2ax4)):this[_0xe4bc[1045]][_0xe4bc[926]]=this[_0xe4bc[1045]][_0xe4bc[1043]]+_0xe4bc[1034];this[_0xe4bc[746]]( new mxEventObject(mxEvent.SELECT,_0xe4bc[279],_0x5d2ax3))}};mxToolbar[_0xe4bc[202]][_0xe4bc[1050]]=function(_0x5d2ax2){(_0x5d2ax2||!this[_0xe4bc[1023]])&&this[_0xe4bc[1045]]!=this[_0xe4bc[1046]]&&this[_0xe4bc[1047]](this[_0xe4bc[1046]],this[_0xe4bc[1049]])};mxToolbar[_0xe4bc[202]][_0xe4bc[1051]]=function(_0x5d2ax2){return this[_0xe4bc[1025]](null,_0x5d2ax2,null)};mxToolbar[_0xe4bc[202]][_0xe4bc[1052]]=function(){mxUtils[_0xe4bc[345]](this[_0xe4bc[526]])};mxToolbar[_0xe4bc[202]][_0xe4bc[1053]]=function(){var _0x5d2ax2=document[_0xe4bc[55]](_0xe4bc[1054]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[941]]=_0xe4bc[1055];_0x5d2ax2[_0xe4bc[57]](_0xe4bc[803],_0xe4bc[500]);this[_0xe4bc[526]][_0xe4bc[62]](_0x5d2ax2)};mxToolbar[_0xe4bc[202]][_0xe4bc[515]]=function(){mxEvent[_0xe4bc[762]](this[_0xe4bc[526]]);this[_0xe4bc[1045]]=this[_0xe4bc[1049]]=this[_0xe4bc[1046]]=this[_0xe4bc[526]]=null;null!=this[_0xe4bc[1029]]&&this[_0xe4bc[1029]][_0xe4bc[515]]()};function mxSession(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[251]]=_0x5d2ax2;this[_0xe4bc[1056]]=_0x5d2ax3;this[_0xe4bc[1057]]=_0x5d2ax4;this[_0xe4bc[1058]]=_0x5d2ax5;null!=_0x5d2ax2&&(this[_0xe4bc[1059]]= new mxCodec,this[_0xe4bc[1059]][_0xe4bc[1060]]=function(_0x5d2ax3){return _0x5d2ax2[_0xe4bc[736]](_0x5d2ax3)});_0x5d2ax2[_0xe4bc[169]](mxEvent.NOTIFY,mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[720]](_0xe4bc[1061]);(null!=_0x5d2ax4&&this[_0xe4bc[143]]||this[_0xe4bc[1062]]&&!this[_0xe4bc[1063]])&&this[_0xe4bc[827]](_0xe4bc[1064]+this[_0xe4bc[1067]](_0x5d2ax4[_0xe4bc[1065]],_0x5d2ax4[_0xe4bc[1066]])+_0xe4bc[1068])}))}mxSession[_0xe4bc[202]]= new mxEventSource;mxSession[_0xe4bc[202]][_0xe4bc[196]]=mxSession;mxSession[_0xe4bc[202]][_0xe4bc[251]]=null;mxSession[_0xe4bc[202]][_0xe4bc[1056]]=null;mxSession[_0xe4bc[202]][_0xe4bc[1057]]=null;mxSession[_0xe4bc[202]][_0xe4bc[1058]]=null;mxSession[_0xe4bc[202]][_0xe4bc[1059]]=null;mxSession[_0xe4bc[202]][_0xe4bc[1069]]=_0xe4bc[336];mxSession[_0xe4bc[202]][_0xe4bc[1070]]= !0;mxSession[_0xe4bc[202]][_0xe4bc[1071]]= !0;mxSession[_0xe4bc[202]][_0xe4bc[1072]]=0;mxSession[_0xe4bc[202]][_0xe4bc[1073]]=0;mxSession[_0xe4bc[202]][_0xe4bc[143]]= !1;mxSession[_0xe4bc[202]][_0xe4bc[1062]]= !1;mxSession[_0xe4bc[202]][_0xe4bc[1063]]= !1;mxSession[_0xe4bc[202]][_0xe4bc[1074]]= !1;mxSession[_0xe4bc[202]][_0xe4bc[861]]=function(){this[_0xe4bc[143]]?(this[_0xe4bc[1062]]= !0,this[_0xe4bc[746]]( new mxEventObject(mxEvent.CONNECT))):this[_0xe4bc[1062]]||this[_0xe4bc[203]](this[_0xe4bc[1056]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1062]]= !0;this[_0xe4bc[746]]( new mxEventObject(mxEvent.CONNECT));this[_0xe4bc[1075]]()}))};mxSession[_0xe4bc[202]][_0xe4bc[809]]=function(){this[_0xe4bc[1062]]&&!this[_0xe4bc[1063]]&&(this[_0xe4bc[1063]]= !0,this[_0xe4bc[746]]( new mxEventObject(mxEvent.SUSPEND)))};mxSession[_0xe4bc[202]][_0xe4bc[810]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[1062]]&&this[_0xe4bc[1063]]&&(this[_0xe4bc[1063]]= !1,this[_0xe4bc[746]]( new mxEventObject(mxEvent.RESUME)),this[_0xe4bc[1074]]||this[_0xe4bc[1075]]())};mxSession[_0xe4bc[202]][_0xe4bc[1076]]=function(_0x5d2ax2){this[_0xe4bc[1062]]&&(this[_0xe4bc[1062]]= !1);this[_0xe4bc[746]]( new mxEventObject(mxEvent.DISCONNECT,_0xe4bc[1077],_0x5d2ax2))};mxSession[_0xe4bc[202]][_0xe4bc[1075]]=function(){this[_0xe4bc[1062]]&&!this[_0xe4bc[1063]]&&null!=this[_0xe4bc[1057]]?(this[_0xe4bc[1074]]= !0,this[_0xe4bc[203]](this[_0xe4bc[1057]],mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[1075]]()}))):this[_0xe4bc[1074]]= !1};mxSession[_0xe4bc[202]][_0xe4bc[827]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]&&(null!=this[_0xe4bc[1058]]&&(this[_0xe4bc[143]]?(mxLog[_0xe4bc[539]](),mxLog[_0xe4bc[143]](_0xe4bc[1078]+this[_0xe4bc[1058]]+_0xe4bc[1079]+_0x5d2ax2)):(_0x5d2ax2=_0xe4bc[1080]+_0x5d2ax2+_0xe4bc[1081],this[_0xe4bc[1070]]&&(_0x5d2ax2=encodeURIComponent(_0x5d2ax2)),mxUtils[_0xe4bc[814]](this[_0xe4bc[1058]],_0xe4bc[1082]+_0x5d2ax2,_0x5d2ax3,_0x5d2ax4))),this[_0xe4bc[1072]]+=_0x5d2ax2[_0xe4bc[67]],this[_0xe4bc[746]]( new mxEventObject(mxEvent.NOTIFY,_0xe4bc[863],this[_0xe4bc[1058]],_0xe4bc[338],_0x5d2ax2)))};mxSession[_0xe4bc[202]][_0xe4bc[203]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(_0xe4bc[82]!= typeof mxUtils){var _0x5d2ax5=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){null!=_0x5d2ax4?_0x5d2ax4(_0x5d2ax2):this[_0xe4bc[1076]](_0x5d2ax2)});mxUtils[_0xe4bc[203]](_0x5d2ax2,mxUtils[_0xe4bc[885]](this,function(_0x5d2ax4){if(_0xe4bc[82]!= typeof mxUtils){if(_0x5d2ax4[_0xe4bc[220]]()&&404!=_0x5d2ax4[_0xe4bc[878]]()){if(this[_0xe4bc[1073]]+=_0x5d2ax4[_0xe4bc[221]]()[_0xe4bc[67]],this[_0xe4bc[746]]( new mxEventObject(mxEvent.GET,_0xe4bc[863],_0x5d2ax2,_0xe4bc[870],_0x5d2ax4)),this[_0xe4bc[1083]](_0x5d2ax4)){if(0<_0x5d2ax4[_0xe4bc[221]]()[_0xe4bc[67]]){var _0x5d2axa=_0x5d2ax4[_0xe4bc[874]]();null==_0x5d2axa?_0x5d2ax5(_0xe4bc[1084]+_0x5d2ax4[_0xe4bc[221]]()):this[_0xe4bc[806]](_0x5d2axa)};null!=_0x5d2ax3&&_0x5d2ax3(_0x5d2ax4)}}else {_0x5d2ax5(_0xe4bc[1085])}}}),function(_0x5d2ax2){_0x5d2ax5(_0xe4bc[1086])})}};mxSession[_0xe4bc[202]][_0xe4bc[1083]]=function(_0x5d2ax2){return 0>_0x5d2ax2[_0xe4bc[221]]()[_0xe4bc[2]](_0xe4bc[1087])};mxSession[_0xe4bc[202]][_0xe4bc[1067]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=_0xe4bc[110],_0x5d2ax5=_0x5d2ax3?-1:1,_0x5d2ax9=_0x5d2ax3?_0x5d2ax2[_0xe4bc[67]]-1:0;0<=_0x5d2ax9&&_0x5d2ax9<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax9+=_0x5d2ax5){var _0x5d2axa=this[_0xe4bc[1059]][_0xe4bc[514]](_0x5d2ax2[_0x5d2ax9]),_0x5d2ax4=_0x5d2ax4+mxUtils[_0xe4bc[875]](_0x5d2axa,this[_0xe4bc[1069]])};return _0x5d2ax4};mxSession[_0xe4bc[202]][_0xe4bc[806]]=function(_0x5d2ax2){if(null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[284]](_0xe4bc[1088]);null!=_0x5d2ax3&&(this[_0xe4bc[251]][_0xe4bc[1089]]=_0x5d2ax3+_0xe4bc[213]);for(_0x5d2ax3=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax3;){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[301]][_0xe4bc[216]]();_0xe4bc[724]==_0x5d2ax4?this[_0xe4bc[1090]](_0x5d2ax3):_0xe4bc[1091]==_0x5d2ax4&&this[_0xe4bc[1092]](_0x5d2ax3);_0x5d2ax3=_0x5d2ax3[_0xe4bc[287]]};this[_0xe4bc[746]]( new mxEventObject(mxEvent.RECEIVE,_0xe4bc[252],_0x5d2ax2))}};mxSession[_0xe4bc[202]][_0xe4bc[1090]]=function(_0x5d2ax2){( new mxCodec(_0x5d2ax2[_0xe4bc[295]]))[_0xe4bc[1093]](_0x5d2ax2[_0xe4bc[285]],this[_0xe4bc[251]])};mxSession[_0xe4bc[202]][_0xe4bc[1092]]=function(_0x5d2ax2){for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax2;){_0xe4bc[1061]==_0x5d2ax2[_0xe4bc[301]]&&this[_0xe4bc[1094]](_0x5d2ax2),_0x5d2ax2=_0x5d2ax2[_0xe4bc[287]]}};mxSession[_0xe4bc[202]][_0xe4bc[1094]]=function(_0x5d2ax2){_0x5d2ax2=this[_0xe4bc[1095]](_0x5d2ax2);if(0<_0x5d2ax2[_0xe4bc[67]]){var _0x5d2ax3=this[_0xe4bc[1096]](_0x5d2ax2);this[_0xe4bc[251]][_0xe4bc[746]]( new mxEventObject(mxEvent.CHANGE,_0xe4bc[1061],_0x5d2ax3,_0xe4bc[1065],_0x5d2ax2));this[_0xe4bc[251]][_0xe4bc[746]]( new mxEventObject(mxEvent.UNDO,_0xe4bc[1061],_0x5d2ax3));this[_0xe4bc[746]]( new mxEventObject(mxEvent.FIRED,_0xe4bc[1061],_0x5d2ax3))}};mxSession[_0xe4bc[202]][_0xe4bc[1096]]=function(_0x5d2ax2){var _0x5d2ax3= new mxUndoableEdit(this[_0xe4bc[251]],this[_0xe4bc[1071]]);_0x5d2ax3[_0xe4bc[1065]]=_0x5d2ax2;_0x5d2ax3[_0xe4bc[827]]=function(){_0x5d2ax3[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.CHANGE,_0xe4bc[1061],_0x5d2ax3,_0xe4bc[1065],_0x5d2ax3[_0xe4bc[1065]]));_0x5d2ax3[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.NOTIFY,_0xe4bc[1061],_0x5d2ax3,_0xe4bc[1065],_0x5d2ax3[_0xe4bc[1065]]))};return _0x5d2ax3};mxSession[_0xe4bc[202]][_0xe4bc[1095]]=function(_0x5d2ax2){this[_0xe4bc[1059]][_0xe4bc[395]]=_0x5d2ax2[_0xe4bc[295]];var _0x5d2ax3=[];for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax2;){var _0x5d2ax4=this[_0xe4bc[1098]](_0x5d2ax2);null!=_0x5d2ax4&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax4);_0x5d2ax2=_0x5d2ax2[_0xe4bc[287]]};return _0x5d2ax3};mxSession[_0xe4bc[202]][_0xe4bc[1098]]=function(_0x5d2ax2){var _0x5d2ax3=null;_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]&&(_0x5d2ax3=_0xe4bc[1099]==_0x5d2ax2[_0xe4bc[301]]?( new mxCodec(_0x5d2ax2[_0xe4bc[295]]))[_0xe4bc[1093]](_0x5d2ax2):this[_0xe4bc[1059]][_0xe4bc[1093]](_0x5d2ax2),null!=_0x5d2ax3&&(_0x5d2ax3[_0xe4bc[251]]=this[_0xe4bc[251]],_0x5d2ax3[_0xe4bc[350]](),_0xe4bc[1100]==_0x5d2ax2[_0xe4bc[301]]&&null==_0x5d2ax3[_0xe4bc[1101]]&&this[_0xe4bc[1102]](_0x5d2ax3[_0xe4bc[247]])));return _0x5d2ax3};mxSession[_0xe4bc[202]][_0xe4bc[1102]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1059]][_0xe4bc[1104]](_0x5d2ax2[_0xe4bc[1103]](),_0x5d2ax2);for(var _0x5d2ax4=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax2),_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4;_0x5d2ax5++){this[_0xe4bc[1102]](this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2,_0x5d2ax5))}};function mxUndoableEdit(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1097]]=_0x5d2ax2;this[_0xe4bc[1065]]=[];this[_0xe4bc[1105]]=null!=_0x5d2ax3?_0x5d2ax3:!0}mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1097]]=null;mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1065]]=null;mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1105]]=null;mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1066]]= !1;mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1106]]= !1;mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1107]]=function(){return 0==this[_0xe4bc[1065]][_0xe4bc[67]]};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1108]]=function(){return this[_0xe4bc[1105]]};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[99]]=function(_0x5d2ax2){this[_0xe4bc[1065]][_0xe4bc[207]](_0x5d2ax2)};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[827]]=function(){};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[1109]]=function(){};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[824]]=function(){if(!this[_0xe4bc[1066]]){this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.START_EDIT));for(var _0x5d2ax2=this[_0xe4bc[1065]][_0xe4bc[67]]-1;0<=_0x5d2ax2;_0x5d2ax2--){var _0x5d2ax3=this[_0xe4bc[1065]][_0x5d2ax2];null!=_0x5d2ax3[_0xe4bc[350]]?_0x5d2ax3[_0xe4bc[350]]():null!=_0x5d2ax3[_0xe4bc[824]]&&_0x5d2ax3[_0xe4bc[824]]();this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.EXECUTED,_0xe4bc[826],_0x5d2ax3))};this[_0xe4bc[1066]]= !0;this[_0xe4bc[1106]]= !1;this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.END_EDIT))};this[_0xe4bc[827]]()};mxUndoableEdit[_0xe4bc[202]][_0xe4bc[825]]=function(){if(!this[_0xe4bc[1106]]){this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.START_EDIT));for(var _0x5d2ax2=this[_0xe4bc[1065]][_0xe4bc[67]],_0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2;_0x5d2ax3++){var _0x5d2ax4=this[_0xe4bc[1065]][_0x5d2ax3];null!=_0x5d2ax4[_0xe4bc[350]]?_0x5d2ax4[_0xe4bc[350]]():null!=_0x5d2ax4[_0xe4bc[825]]&&_0x5d2ax4[_0xe4bc[825]]();this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.EXECUTED,_0xe4bc[826],_0x5d2ax4))};this[_0xe4bc[1066]]= !1;this[_0xe4bc[1106]]= !0;this[_0xe4bc[1097]][_0xe4bc[746]]( new mxEventObject(mxEvent.END_EDIT))};this[_0xe4bc[827]]()};function mxUndoManager(_0x5d2ax2){this[_0xe4bc[803]]=null!=_0x5d2ax2?_0x5d2ax2:100;this[_0xe4bc[200]]()}mxUndoManager[_0xe4bc[202]]= new mxEventSource;mxUndoManager[_0xe4bc[202]][_0xe4bc[196]]=mxUndoManager;mxUndoManager[_0xe4bc[202]][_0xe4bc[803]]=null;mxUndoManager[_0xe4bc[202]][_0xe4bc[1110]]=null;mxUndoManager[_0xe4bc[202]][_0xe4bc[1111]]=0;mxUndoManager[_0xe4bc[202]][_0xe4bc[1107]]=function(){return 0==this[_0xe4bc[1110]][_0xe4bc[67]]};mxUndoManager[_0xe4bc[202]][_0xe4bc[200]]=function(){this[_0xe4bc[1110]]=[];this[_0xe4bc[1111]]=0;this[_0xe4bc[746]]( new mxEventObject(mxEvent.CLEAR))};mxUndoManager[_0xe4bc[202]][_0xe4bc[1112]]=function(){return 0this[_0xe4bc[1111]]){for(var _0x5d2ax2=this[_0xe4bc[1110]][_0xe4bc[300]](this[_0xe4bc[1111]],this[_0xe4bc[1110]][_0xe4bc[67]]-this[_0xe4bc[1111]]),_0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax3++){_0x5d2ax2[_0x5d2ax3][_0xe4bc[1109]]()}}};var mxUrlConverter=function(_0x5d2ax2){var _0x5d2ax3=!0,_0x5d2ax4=null,_0x5d2ax5=null;return {isEnabled:function(){return _0x5d2ax3},setEnabled:function(_0x5d2ax2){_0x5d2ax3=_0x5d2ax2},getBaseUrl:function(){return _0x5d2ax4},setBaseUrl:function(_0x5d2ax2){_0x5d2ax4=_0x5d2ax2},getBaseDomain:function(){return _0x5d2ax4},setBaseDomain:function(_0x5d2ax2){_0x5d2ax4=_0x5d2ax2},isRelativeUrl:function(_0x5d2ax2){return _0xe4bc[43]!=_0x5d2ax2[_0xe4bc[85]](0,7)&&_0xe4bc[46]!=_0x5d2ax2[_0xe4bc[85]](0,8)&&_0xe4bc[1116]!=_0x5d2ax2[_0xe4bc[85]](0,10)},convert:function(_0x5d2ax2){if(_0x5d2ax3&&this[_0xe4bc[1117]](_0x5d2ax2)){if(null==_0x5d2ax4){_0x5d2ax5=location[_0xe4bc[1118]]+_0xe4bc[1119]+location[_0xe4bc[1120]];_0x5d2ax4=_0x5d2ax5+location[_0xe4bc[1121]];var _0x5d2axa=_0x5d2ax4[_0xe4bc[1122]](_0xe4bc[84]);0<_0x5d2axa&&(_0x5d2ax4=_0x5d2ax4[_0xe4bc[85]](0,_0x5d2axa+1))};_0x5d2ax2=_0xe4bc[84]==_0x5d2ax2[_0xe4bc[225]](0)?_0x5d2ax5+_0x5d2ax2:_0x5d2ax4+_0x5d2ax2};return _0x5d2ax2}}};function mxPanningManager(_0x5d2ax2){this[_0xe4bc[1123]]=null;this[_0xe4bc[1124]]= !1;this[_0xe4bc[1125]]=this[_0xe4bc[1126]]=this[_0xe4bc[1127]]=this[_0xe4bc[1128]]=this[_0xe4bc[1129]]=this[_0xe4bc[1130]]=0;this[_0xe4bc[1131]]= !1;this[_0xe4bc[190]]=this[_0xe4bc[360]]=0;this[_0xe4bc[1132]]={mouseDown:function(_0x5d2ax2,_0x5d2ax3){},mouseMove:function(_0x5d2ax2,_0x5d2ax3){},mouseUp:mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1124]]&&this[_0xe4bc[1076]]()})};_0x5d2ax2[_0xe4bc[1133]](this[_0xe4bc[1132]]);mxEvent[_0xe4bc[169]](document,_0xe4bc[753],mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[1124]]&&this[_0xe4bc[1076]]()}));var _0x5d2ax3=mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[1131]]=mxUtils[_0xe4bc[1134]](_0x5d2ax2[_0xe4bc[526]]);this[_0xe4bc[360]]=_0x5d2ax2[_0xe4bc[526]][_0xe4bc[360]];this[_0xe4bc[190]]=_0x5d2ax2[_0xe4bc[526]][_0xe4bc[190]];return window[_0xe4bc[1141]](mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[1130]]-=this[_0xe4bc[1126]];this[_0xe4bc[1129]]-=this[_0xe4bc[1125]];if(this[_0xe4bc[1131]]){var _0x5d2ax3=-_0x5d2ax2[_0xe4bc[526]][_0xe4bc[360]]-Math[_0xe4bc[430]](this[_0xe4bc[1126]]),_0x5d2ax5=-_0x5d2ax2[_0xe4bc[526]][_0xe4bc[190]]-Math[_0xe4bc[430]](this[_0xe4bc[1125]]);_0x5d2ax2[_0xe4bc[1135]](_0x5d2ax3,_0x5d2ax5);_0x5d2ax2[_0xe4bc[1136]]=this[_0xe4bc[360]]-_0x5d2ax2[_0xe4bc[526]][_0xe4bc[360]];_0x5d2ax2[_0xe4bc[1137]]=this[_0xe4bc[190]]-_0x5d2ax2[_0xe4bc[526]][_0xe4bc[190]];_0x5d2ax2[_0xe4bc[746]]( new mxEventObject(mxEvent.PAN))}else {_0x5d2ax2[_0xe4bc[1135]](this[_0xe4bc[1138]](),this[_0xe4bc[1139]]())}}),this[_0xe4bc[1140]])});this[_0xe4bc[1142]]=function(){return active};this[_0xe4bc[1138]]=function(){return Math[_0xe4bc[488]](this[_0xe4bc[1130]])};this[_0xe4bc[1139]]=function(){return Math[_0xe4bc[488]](this[_0xe4bc[1129]])};this[_0xe4bc[861]]=function(){this[_0xe4bc[1128]]=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]];this[_0xe4bc[1127]]=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]];this[_0xe4bc[1124]]= !0};this[_0xe4bc[1143]]=function(_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){this[_0xe4bc[1124]]||this[_0xe4bc[861]]();this[_0xe4bc[360]]=_0x5d2ax2[_0xe4bc[526]][_0xe4bc[360]];this[_0xe4bc[190]]=_0x5d2ax2[_0xe4bc[526]][_0xe4bc[190]];_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:0;var _0x5d2ax12=_0x5d2ax2[_0xe4bc[526]];this[_0xe4bc[1126]]=_0x5d2ax4+(null!=_0x5d2ax9?_0x5d2ax9:0)-_0x5d2ax12[_0xe4bc[360]]-_0x5d2ax12[_0xe4bc[159]];0>this[_0xe4bc[1126]]&&Math[_0xe4bc[425]](this[_0xe4bc[1126]])this[_0xe4bc[1125]]&&Math[_0xe4bc[425]](this[_0xe4bc[1125]])(_0x5d2ax9[_0xe4bc[360]]||_0x5d2axa[_0xe4bc[360]])+(_0x5d2ax9[_0xe4bc[159]]||_0x5d2axa[_0xe4bc[159]])){_0x5d2ax3[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=_0x5d2ax2[_0xe4bc[485]][_0xe4bc[358]]-_0x5d2ax5+(mxClient[_0xe4bc[80]]?6:-6)+_0xe4bc[168]};mxUtils[_0xe4bc[933]](_0x5d2ax3[_0xe4bc[485]])}};mxPopupMenu[_0xe4bc[202]][_0xe4bc[1051]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2=_0x5d2ax2||this;if(this[_0xe4bc[1154]]&& !_0x5d2ax3){_0x5d2ax2[_0xe4bc[1159]]= !0}else {if(null!=_0x5d2ax2[_0xe4bc[120]]){_0x5d2ax2[_0xe4bc[1159]]= !1;var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[121]),_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]);_0x5d2ax5[_0xe4bc[926]]=_0xe4bc[1162];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[549]]=_0xe4bc[1172];_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[122]);_0x5d2ax5[_0xe4bc[124]][_0xe4bc[549]]=_0xe4bc[1172];_0x5d2ax5[_0xe4bc[57]](_0xe4bc[1173],_0xe4bc[1174]);var _0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[1054]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[803],_0xe4bc[500]);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5);_0x5d2ax2[_0xe4bc[120]][_0xe4bc[62]](_0x5d2ax4)}}};mxPopupMenu[_0xe4bc[202]][_0xe4bc[152]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=this[_0xe4bc[485]]&&null!=this[_0xe4bc[120]]&&null!=this[_0xe4bc[1033]]){this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=_0x5d2ax2+_0xe4bc[168];for(this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]=_0x5d2ax3+_0xe4bc[168];null!=this[_0xe4bc[120]][_0xe4bc[285]];){mxEvent[_0xe4bc[762]](this[_0xe4bc[120]][_0xe4bc[285]]),this[_0xe4bc[120]][_0xe4bc[266]](this[_0xe4bc[120]][_0xe4bc[285]])};this[_0xe4bc[1152]]=0;this[_0xe4bc[1033]](this,_0x5d2ax4,_0x5d2ax5);0this[_0xe4bc[1180]]||this[_0xe4bc[1183]]>=this[_0xe4bc[1182]]&&_0x5d2ax2>this[_0xe4bc[1181]]?(this[_0xe4bc[815]](),this[_0xe4bc[862]]()):this[_0xe4bc[1183]]++};mxAutoSaveManager[_0xe4bc[202]][_0xe4bc[862]]=function(){this[_0xe4bc[1184]]=( new Date)[_0xe4bc[178]]();this[_0xe4bc[1183]]=0};mxAutoSaveManager[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[1178]](null)};function mxAnimation(_0x5d2ax2){this[_0xe4bc[1140]]=null!=_0x5d2ax2?_0x5d2ax2:20}mxAnimation[_0xe4bc[202]]= new mxEventSource;mxAnimation[_0xe4bc[202]][_0xe4bc[196]]=mxAnimation;mxAnimation[_0xe4bc[202]][_0xe4bc[1140]]=null;mxAnimation[_0xe4bc[202]][_0xe4bc[1123]]=null;mxAnimation[_0xe4bc[202]][_0xe4bc[1185]]=function(){null==this[_0xe4bc[1123]]&&(this[_0xe4bc[1123]]=window[_0xe4bc[1141]](mxUtils[_0xe4bc[885]](this,this[_0xe4bc[1186]]),this[_0xe4bc[1140]]))};mxAnimation[_0xe4bc[202]][_0xe4bc[1186]]=function(){this[_0xe4bc[746]]( new mxEventObject(mxEvent.EXECUTE))};mxAnimation[_0xe4bc[202]][_0xe4bc[1187]]=function(){null!=this[_0xe4bc[1123]]&&(window[_0xe4bc[1146]](this[_0xe4bc[1123]]),this[_0xe4bc[1123]]=null,this[_0xe4bc[746]]( new mxEventObject(mxEvent.DONE)))};function mxMorphing(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxAnimation[_0xe4bc[239]](this,_0x5d2ax5);this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[1188]]=null!=_0x5d2ax3?_0x5d2ax3:6;this[_0xe4bc[1189]]=null!=_0x5d2ax4?_0x5d2ax4:1.5}mxMorphing[_0xe4bc[202]]= new mxAnimation;mxMorphing[_0xe4bc[202]][_0xe4bc[196]]=mxMorphing;mxMorphing[_0xe4bc[202]][_0xe4bc[1179]]=null;mxMorphing[_0xe4bc[202]][_0xe4bc[1188]]=null;mxMorphing[_0xe4bc[202]][_0xe4bc[1190]]=0;mxMorphing[_0xe4bc[202]][_0xe4bc[1189]]=null;mxMorphing[_0xe4bc[202]][_0xe4bc[895]]=null;mxMorphing[_0xe4bc[202]][_0xe4bc[1186]]=function(){var _0x5d2ax2= new mxCellStatePreview(this[_0xe4bc[1179]]);if(null!=this[_0xe4bc[895]]){for(var _0x5d2ax3=0;_0x5d2ax3=this[_0xe4bc[1188]])&&this[_0xe4bc[1187]]()};mxMorphing[_0xe4bc[202]][_0xe4bc[539]]=function(_0x5d2ax2){_0x5d2ax2[_0xe4bc[539]]()};mxMorphing[_0xe4bc[202]][_0xe4bc[1191]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax2),_0x5d2ax9=null;if(null!=_0x5d2ax5&&(_0x5d2ax9=this[_0xe4bc[1192]](_0x5d2ax5),this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1193]](_0x5d2ax2)&&(0!=_0x5d2ax9[_0xe4bc[235]]||0!=_0x5d2ax9[_0xe4bc[236]]))){var _0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[512]](),_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[518]]();_0x5d2ax9[_0xe4bc[235]]+=_0x5d2axa[_0xe4bc[235]]*_0x5d2ax12;_0x5d2ax9[_0xe4bc[236]]+=_0x5d2axa[_0xe4bc[236]]*_0x5d2ax12;_0x5d2ax3[_0xe4bc[1194]](_0x5d2ax5,-_0x5d2ax9[_0xe4bc[235]]/this[_0xe4bc[1189]],-_0x5d2ax9[_0xe4bc[236]]/this[_0xe4bc[1189]])};if(_0x5d2ax4&&!this[_0xe4bc[1195]](_0x5d2ax5,_0x5d2ax9)){_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[262]](_0x5d2ax2);for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5;_0x5d2ax9++){this[_0xe4bc[1191]](this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax9),_0x5d2ax3,_0x5d2ax4)}}};mxMorphing[_0xe4bc[202]][_0xe4bc[1195]]=function(_0x5d2ax2,_0x5d2ax3){return null!=_0x5d2ax3&&(0!=_0x5d2ax3[_0xe4bc[235]]||0!=_0x5d2ax3[_0xe4bc[236]])};mxMorphing[_0xe4bc[202]][_0xe4bc[1192]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1196]](_0x5d2ax2[_0xe4bc[246]]),_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[512]](),_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[518]]();_0x5d2ax2= new mxPoint(_0x5d2ax2[_0xe4bc[235]]/_0x5d2ax5-_0x5d2ax4[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]]/_0x5d2ax5-_0x5d2ax4[_0xe4bc[236]]);return new mxPoint((_0x5d2ax3[_0xe4bc[235]]-_0x5d2ax2[_0xe4bc[235]])*_0x5d2ax5,(_0x5d2ax3[_0xe4bc[236]]-_0x5d2ax2[_0xe4bc[236]])*_0x5d2ax5)};mxMorphing[_0xe4bc[202]][_0xe4bc[1196]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[1196]](this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1197]](_0x5d2ax2)),_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax2),null!=_0x5d2ax2&&(_0x5d2ax3[_0xe4bc[235]]+=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]]+=_0x5d2ax2[_0xe4bc[236]]));null==_0x5d2ax3&&(_0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[512]](),_0x5d2ax3= new mxPoint(-_0x5d2ax3[_0xe4bc[235]],-_0x5d2ax3[_0xe4bc[236]]));return _0x5d2ax3};function mxImageBundle(_0x5d2ax2){this[_0xe4bc[1199]]=[];this[_0xe4bc[1200]]=null!=_0x5d2ax2?_0x5d2ax2:!1}mxImageBundle[_0xe4bc[202]][_0xe4bc[1199]]=null;mxImageBundle[_0xe4bc[202]][_0xe4bc[1199]]=null;mxImageBundle[_0xe4bc[202]][_0xe4bc[1201]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[1199]][_0x5d2ax2]={value:_0x5d2ax3,fallback:_0x5d2ax4}};mxImageBundle[_0xe4bc[202]][_0xe4bc[1202]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[1199]][_0x5d2ax2],null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[1200]]?_0x5d2ax2[_0xe4bc[1203]]:_0x5d2ax2[_0xe4bc[131]]));return _0x5d2ax3};function mxImageExport(){}mxImageExport[_0xe4bc[202]][_0xe4bc[1204]]= !1;mxImageExport[_0xe4bc[202]][_0xe4bc[1205]]=function(_0x5d2ax2,_0x5d2ax3){null!=_0x5d2ax2&&(this[_0xe4bc[1207]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[1206]]),this[_0xe4bc[1204]]&&this[_0xe4bc[1207]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[1208]]))};mxImageExport[_0xe4bc[202]][_0xe4bc[1207]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(null!=_0x5d2ax2){_0x5d2ax4(_0x5d2ax2,_0x5d2ax3);for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[1179]],_0x5d2ax9=_0x5d2ax5[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax2[_0xe4bc[246]]),_0x5d2axa=0;_0x5d2axa<_0x5d2ax9;_0x5d2axa++){var _0x5d2ax12=_0x5d2ax5[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax5[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2[_0xe4bc[246]],_0x5d2axa));this[_0xe4bc[1207]](_0x5d2ax12,_0x5d2ax3,_0x5d2ax4)}}};mxImageExport[_0xe4bc[202]][_0xe4bc[1206]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2[_0xe4bc[253]] instanceof mxShape&&(_0x5d2ax3[_0xe4bc[815]](),_0x5d2ax2[_0xe4bc[253]][_0xe4bc[1209]](_0x5d2ax3),_0x5d2ax3[_0xe4bc[1210]]());null!=_0x5d2ax2[_0xe4bc[963]]&&(_0x5d2ax3[_0xe4bc[815]](),_0x5d2ax2[_0xe4bc[963]][_0xe4bc[1209]](_0x5d2ax3),_0x5d2ax3[_0xe4bc[1210]]())};mxImageExport[_0xe4bc[202]][_0xe4bc[1208]]=function(_0x5d2ax2,_0x5d2ax3){null!=_0x5d2ax2[_0xe4bc[1211]]&&_0x5d2ax2[_0xe4bc[1211]][_0xe4bc[209]](function(_0x5d2ax2,_0x5d2ax5){_0x5d2ax5 instanceof mxShape&&_0x5d2ax5[_0xe4bc[1209]](_0x5d2ax3)})};function mxAbstractCanvas2D(){this[_0xe4bc[1212]]=this[_0xe4bc[1213]]();this[_0xe4bc[862]]()}mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[724]]=null;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1214]]=null;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1215]]=null;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1216]]= !0;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1217]]=0;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1218]]=0;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1219]]=_0xe4bc[1220];mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1221]]=_0xe4bc[1222];mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1223]]=_0xe4bc[1224];mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1225]]=_0xe4bc[1226];mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1227]]=_0xe4bc[1228];mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1229]]= !1;mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1213]]=function(){return new mxUrlConverter};mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[862]]=function(){this[_0xe4bc[724]]=this[_0xe4bc[1230]]();this[_0xe4bc[1214]]=[]};mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1230]]=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:_0xe4bc[1231],lineCap:_0xe4bc[1232],lineJoin:_0xe4bc[1233],miterLimit:10,fontColor:_0xe4bc[1234],fontBackgroundColor:null,fontBorderColor:null,fontSize:mxConstants[_0xe4bc[483]],fontFamily:mxConstants[_0xe4bc[484]],fontStyle:0,shadow:!1,shadowColor:mxConstants[_0xe4bc[1235]],shadowAlpha:mxConstants[_0xe4bc[1236]],shadowDx:mxConstants[_0xe4bc[1237]],shadowDy:mxConstants[_0xe4bc[1238]],rotation:0,rotationCx:0,rotationCy:0}};mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1239]]=function(_0x5d2ax2){return Math[_0xe4bc[488]](parseFloat(_0x5d2ax2))};mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1240]]=function(){if(null!=this[_0xe4bc[1215]]&&(this[_0xe4bc[1215]][_0xe4bc[207]](arguments[0]),2_0x5d2ax4?_0xe4bc[1367]+_0x5d2ax4:_0xe4bc[110];_0x5d2ax9=this[_0xe4bc[55]](_0xe4bc[1076]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[1368],_0xe4bc[1366]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[124],_0xe4bc[1369]+_0x5d2ax2+_0x5d2ax4);_0x5d2axa[_0xe4bc[62]](_0x5d2ax9);_0x5d2ax4=1>_0x5d2ax5?_0xe4bc[1367]+_0x5d2ax5:_0xe4bc[110];_0x5d2ax9=this[_0xe4bc[55]](_0xe4bc[1076]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[1368],_0xe4bc[118]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[124],_0xe4bc[1369]+_0x5d2ax3+_0x5d2ax4);_0x5d2axa[_0xe4bc[62]](_0x5d2ax9);return _0x5d2axa};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1370]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[252]],_0x5d2ax5=this[_0xe4bc[724]];if(null!=_0x5d2ax4){if(_0xe4bc[1215]==_0x5d2ax4[_0xe4bc[301]]){if(null!=this[_0xe4bc[1215]]&&0_0x5d2ax2[_0xe4bc[1244]]&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1379],_0x5d2ax2[_0xe4bc[1244]]);null!=_0x5d2ax2[_0xe4bc[604]]&&(null!=_0x5d2ax2[_0xe4bc[606]]?(_0x5d2ax2=this[_0xe4bc[1361]](_0x5d2ax2[_0xe4bc[604]],_0x5d2ax2[_0xe4bc[606]],_0x5d2ax2[_0xe4bc[1247]],_0x5d2ax2[_0xe4bc[1248]],_0x5d2ax2[_0xe4bc[607]]),this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1334],_0xe4bc[1380]+_0x5d2ax2+_0xe4bc[460])):this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1334],_0x5d2ax2[_0xe4bc[604]][_0xe4bc[216]]()))};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1374]]=function(){var _0x5d2ax2=this[_0xe4bc[724]];this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1336],_0x5d2ax2[_0xe4bc[608]][_0xe4bc[216]]());1>_0x5d2ax2[_0xe4bc[1244]]&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1381],_0x5d2ax2[_0xe4bc[1244]]);var _0x5d2ax3=Math[_0xe4bc[160]](1,this[_0xe4bc[1239]](_0x5d2ax2[_0xe4bc[610]]*_0x5d2ax2[_0xe4bc[255]]));1!=_0x5d2ax3&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1382],_0x5d2ax3);_0xe4bc[1215]==this[_0xe4bc[252]][_0xe4bc[301]]&&this[_0xe4bc[1383]]();_0x5d2ax2[_0xe4bc[648]]&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1384],this[_0xe4bc[1385]](_0x5d2ax3))};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1383]]=function(){var _0x5d2ax2=this[_0xe4bc[724]];null!=_0x5d2ax2[_0xe4bc[1256]]&&_0xe4bc[1233]!=_0x5d2ax2[_0xe4bc[1256]]&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1386],_0x5d2ax2[_0xe4bc[1256]]);if(null!=_0x5d2ax2[_0xe4bc[1254]]){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[1254]];_0xe4bc[1232]==_0x5d2ax3&&(_0x5d2ax3=_0xe4bc[1387]);_0xe4bc[1387]!=_0x5d2ax3&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1388],_0x5d2ax3)};null!=_0x5d2ax2[_0xe4bc[1258]]&&(!this[_0xe4bc[1341]]||10!=_0x5d2ax2[_0xe4bc[1258]])&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1389],_0x5d2ax2[_0xe4bc[1258]])};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1385]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[724]][_0xe4bc[649]][_0xe4bc[224]](_0xe4bc[185]),_0x5d2ax4=[];if(0<_0x5d2ax3[_0xe4bc[67]]){for(var _0x5d2ax5=0;_0x5d2ax5<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax5++){_0x5d2ax4[_0x5d2ax5]=Number(_0x5d2ax3[_0x5d2ax5])*_0x5d2ax2}};return _0x5d2ax4[_0xe4bc[234]](_0xe4bc[185])};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1376]]=function(_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[511]](!0);var _0x5d2ax3=parseFloat(_0x5d2ax2[_0xe4bc[284]](_0xe4bc[1382])||1)+this[_0xe4bc[1345]];_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1377],_0xe4bc[1336]);_0x5d2ax2[_0xe4bc[57]](_0xe4bc[187],_0xe4bc[188]);_0x5d2ax2[_0xe4bc[1390]](_0xe4bc[1384]);_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1382],_0x5d2ax3);_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1334],_0xe4bc[130]);_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1336],mxClient[_0xe4bc[71]]?_0xe4bc[130]:_0xe4bc[1391]);return _0x5d2ax2};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1375]]=function(_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[511]](!0);var _0x5d2ax3=this[_0xe4bc[724]];_0xe4bc[130]!=_0x5d2ax2[_0xe4bc[284]](_0xe4bc[1334])&&_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1334],_0x5d2ax3[_0xe4bc[1269]]);_0xe4bc[130]!=_0x5d2ax2[_0xe4bc[284]](_0xe4bc[1336])&&_0x5d2ax2[_0xe4bc[57]](_0xe4bc[1336],_0x5d2ax3[_0xe4bc[1269]]);_0x5d2ax2[_0xe4bc[57]](_0xe4bc[535],_0xe4bc[536]+this[_0xe4bc[1239]](_0x5d2ax3[_0xe4bc[1273]]*_0x5d2ax3[_0xe4bc[255]])+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax3[_0xe4bc[1274]]*_0x5d2ax3[_0xe4bc[255]])+_0xe4bc[460]+(_0x5d2ax3[_0xe4bc[535]]||_0xe4bc[110]));_0x5d2ax2[_0xe4bc[57]](_0xe4bc[461],_0x5d2ax3[_0xe4bc[1271]]);return _0x5d2ax2};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1294]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(0!=_0x5d2ax2||_0x5d2ax3||_0x5d2ax4){var _0x5d2axa=this[_0xe4bc[724]];_0x5d2ax5+=_0x5d2axa[_0xe4bc[1126]];_0x5d2ax9+=_0x5d2axa[_0xe4bc[1125]];_0x5d2ax5*=_0x5d2axa[_0xe4bc[255]];_0x5d2ax9*=_0x5d2axa[_0xe4bc[255]];_0x5d2axa[_0xe4bc[535]]=_0x5d2axa[_0xe4bc[535]]||_0xe4bc[110];if(_0x5d2ax3&&_0x5d2ax4){_0x5d2ax2+=180}else {if(_0x5d2ax3^_0x5d2ax4){var _0x5d2ax12=_0x5d2ax3?_0x5d2ax5:0,_0x5d2ax13=_0x5d2ax3?-1:1,_0x5d2ax14=_0x5d2ax4?_0x5d2ax9:0,_0x5d2ax15=_0x5d2ax4?-1:1;_0x5d2axa[_0xe4bc[535]]+=_0xe4bc[536]+this[_0xe4bc[1239]](_0x5d2ax12)+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax14)+_0xe4bc[1392]+this[_0xe4bc[1239]](_0x5d2ax13)+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax15)+_0xe4bc[1393]+this[_0xe4bc[1239]](-_0x5d2ax12)+_0xe4bc[537]+this[_0xe4bc[1239]](-_0x5d2ax14)+_0xe4bc[460]}};if(_0x5d2ax3?!_0x5d2ax4:_0x5d2ax4){_0x5d2ax2*= -1};0!=_0x5d2ax2&&(_0x5d2axa[_0xe4bc[535]]+=_0xe4bc[1394]+this[_0xe4bc[1239]](_0x5d2ax2)+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax5)+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax9)+_0xe4bc[460]);_0x5d2axa[_0xe4bc[603]]+=_0x5d2ax2;_0x5d2axa[_0xe4bc[1395]]=_0x5d2ax5;_0x5d2axa[_0xe4bc[1396]]=_0x5d2ax9}};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1275]]=function(){mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1275]][_0xe4bc[183]](this,arguments);this[_0xe4bc[252]]=this[_0xe4bc[55]](_0xe4bc[1215])};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1319]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[724]],_0x5d2axa=this[_0xe4bc[55]](_0xe4bc[1319]);_0x5d2axa[_0xe4bc[57]](_0xe4bc[235],this[_0xe4bc[1239]]((_0x5d2ax2+_0x5d2ax9[_0xe4bc[1126]])*_0x5d2ax9[_0xe4bc[255]]));_0x5d2axa[_0xe4bc[57]](_0xe4bc[236],this[_0xe4bc[1239]]((_0x5d2ax3+_0x5d2ax9[_0xe4bc[1125]])*_0x5d2ax9[_0xe4bc[255]]));_0x5d2axa[_0xe4bc[57]](_0xe4bc[117],this[_0xe4bc[1239]](_0x5d2ax4*_0x5d2ax9[_0xe4bc[255]]));_0x5d2axa[_0xe4bc[57]](_0xe4bc[119],this[_0xe4bc[1239]](_0x5d2ax5*_0x5d2ax9[_0xe4bc[255]]));this[_0xe4bc[252]]=_0x5d2axa};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1320]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){this[_0xe4bc[1319]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5);0<_0x5d2ax9&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1397],this[_0xe4bc[1239]](_0x5d2ax9*this[_0xe4bc[724]][_0xe4bc[255]]));0<_0x5d2axa&&this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1398],this[_0xe4bc[1239]](_0x5d2axa*this[_0xe4bc[724]][_0xe4bc[255]]))};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[680]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[724]],_0x5d2axa=this[_0xe4bc[55]](_0xe4bc[680]);_0x5d2axa[_0xe4bc[57]](_0xe4bc[1296],Math[_0xe4bc[488]]((_0x5d2ax2+_0x5d2ax4/2+_0x5d2ax9[_0xe4bc[1126]])*_0x5d2ax9[_0xe4bc[255]]));_0x5d2axa[_0xe4bc[57]](_0xe4bc[1297],Math[_0xe4bc[488]]((_0x5d2ax3+_0x5d2ax5/2+_0x5d2ax9[_0xe4bc[1125]])*_0x5d2ax9[_0xe4bc[255]]));_0x5d2axa[_0xe4bc[57]](_0xe4bc[1397],_0x5d2ax4/2*_0x5d2ax9[_0xe4bc[255]]);_0x5d2axa[_0xe4bc[57]](_0xe4bc[1398],_0x5d2ax5/2*_0x5d2ax9[_0xe4bc[255]]);this[_0xe4bc[252]]=_0x5d2axa};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[618]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13){_0x5d2ax9=this[_0xe4bc[1212]][_0xe4bc[1321]](_0x5d2ax9);_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:!0;_0x5d2ax12=null!=_0x5d2ax12?_0x5d2ax12:!1;_0x5d2ax13=null!=_0x5d2ax13?_0x5d2ax13:!1;var _0x5d2ax14=this[_0xe4bc[724]];_0x5d2ax2+=_0x5d2ax14[_0xe4bc[1126]];_0x5d2ax3+=_0x5d2ax14[_0xe4bc[1125]];var _0x5d2ax15=this[_0xe4bc[55]](_0xe4bc[618]);_0x5d2ax15[_0xe4bc[57]](_0xe4bc[235],this[_0xe4bc[1239]](_0x5d2ax2*_0x5d2ax14[_0xe4bc[255]]));_0x5d2ax15[_0xe4bc[57]](_0xe4bc[236],this[_0xe4bc[1239]](_0x5d2ax3*_0x5d2ax14[_0xe4bc[255]]));_0x5d2ax15[_0xe4bc[57]](_0xe4bc[117],this[_0xe4bc[1239]](_0x5d2ax4*_0x5d2ax14[_0xe4bc[255]]));_0x5d2ax15[_0xe4bc[57]](_0xe4bc[119],this[_0xe4bc[1239]](_0x5d2ax5*_0x5d2ax14[_0xe4bc[255]]));null==_0x5d2ax15[_0xe4bc[1399]]?_0x5d2ax15[_0xe4bc[57]](_0xe4bc[1400],_0x5d2ax9):_0x5d2ax15[_0xe4bc[1399]](mxConstants.NS_XLINK,_0xe4bc[44],_0x5d2ax9);_0x5d2axa||_0x5d2ax15[_0xe4bc[57]](_0xe4bc[1401],_0xe4bc[130]);1>_0x5d2ax14[_0xe4bc[1244]]&&_0x5d2ax15[_0xe4bc[57]](_0xe4bc[461],_0x5d2ax14[_0xe4bc[1244]]);_0x5d2ax9=this[_0xe4bc[724]][_0xe4bc[535]]||_0xe4bc[110];if(_0x5d2ax12||_0x5d2ax13){var _0x5d2ax16=_0x5d2axa=1,_0x5d2ax17=0,_0x5d2ax18=0;_0x5d2ax12&&(_0x5d2axa= -1,_0x5d2ax17=-_0x5d2ax4-2*_0x5d2ax2);_0x5d2ax13&&(_0x5d2ax16= -1,_0x5d2ax18=-_0x5d2ax5-2*_0x5d2ax3);_0x5d2ax9+=_0xe4bc[1402]+_0x5d2axa+_0xe4bc[537]+_0x5d2ax16+_0xe4bc[1393]+_0x5d2ax17+_0xe4bc[537]+_0x5d2ax18+_0xe4bc[460]};0<_0x5d2ax9[_0xe4bc[67]]&&_0x5d2ax15[_0xe4bc[57]](_0xe4bc[535],_0x5d2ax9);this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax15);this[_0xe4bc[1347]]&&(_0x5d2ax15[_0xe4bc[57]](_0xe4bc[124],_0xe4bc[1403]),_0x5d2ax15=this[_0xe4bc[55]](_0xe4bc[1319]),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[187],_0xe4bc[188]),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[1377],_0xe4bc[1334]),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[235],this[_0xe4bc[1239]](_0x5d2ax2*_0x5d2ax14[_0xe4bc[255]])),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[236],this[_0xe4bc[1239]](_0x5d2ax3*_0x5d2ax14[_0xe4bc[255]])),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[117],this[_0xe4bc[1239]](_0x5d2ax4*_0x5d2ax14[_0xe4bc[255]])),_0x5d2ax15[_0xe4bc[57]](_0xe4bc[119],this[_0xe4bc[1239]](_0x5d2ax5*_0x5d2ax14[_0xe4bc[255]])),this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax15))};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1404]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax4=this[_0xe4bc[724]];_0x5d2ax5=_0xe4bc[1405]+Math[_0xe4bc[488]](_0x5d2ax4[_0xe4bc[487]])+_0xe4bc[1406]+_0x5d2ax4[_0xe4bc[486]]+_0xe4bc[1407]+_0x5d2ax4[_0xe4bc[665]]+_0xe4bc[1408]+Math[_0xe4bc[488]](_0x5d2ax4[_0xe4bc[487]]*mxConstants[_0xe4bc[490]])+_0xe4bc[1409]+_0x5d2ax5;(_0x5d2ax4[_0xe4bc[666]]&mxConstants[_0xe4bc[1410]])==mxConstants[_0xe4bc[1410]]&&(_0x5d2ax5+=_0xe4bc[1411]);(_0x5d2ax4[_0xe4bc[666]]&mxConstants[_0xe4bc[1412]])==mxConstants[_0xe4bc[1412]]&&(_0x5d2ax5+=_0xe4bc[1413]);(_0x5d2ax4[_0xe4bc[666]]&mxConstants[_0xe4bc[1414]])==mxConstants[_0xe4bc[1414]]&&(_0x5d2ax5+=_0xe4bc[1415]);_0x5d2ax3==mxConstants[_0xe4bc[479]]?_0x5d2ax5+=_0xe4bc[1416]:_0x5d2ax3==mxConstants[_0xe4bc[480]]&&(_0x5d2ax5+=_0xe4bc[1417]);_0x5d2ax3=_0xe4bc[110];null!=_0x5d2ax4[_0xe4bc[1261]]&&(_0x5d2ax3+=_0xe4bc[1418]+_0x5d2ax4[_0xe4bc[1261]]+_0xe4bc[471]);null!=_0x5d2ax4[_0xe4bc[1263]]&&(_0x5d2ax3+=_0xe4bc[1419]+_0x5d2ax4[_0xe4bc[1263]]+_0xe4bc[471]);mxUtils[_0xe4bc[1331]](_0x5d2ax2)||(_0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[126]),_0x5d2ax4[_0xe4bc[339]]=_0x5d2ax2[_0xe4bc[230]](/</g,_0xe4bc[1421])[_0xe4bc[230]](/>/g,_0xe4bc[1420])[_0xe4bc[230]](//g,_0xe4bc[335]),_0x5d2ax2=_0x5d2ax4[_0xe4bc[131]],_0x5d2ax9?_0x5d2ax5+=_0x5d2ax3:0<_0x5d2ax3[_0xe4bc[67]]&&(_0x5d2ax2=_0xe4bc[1422]+_0x5d2ax3+_0xe4bc[1423]+_0x5d2ax2+_0xe4bc[1424]));if(!mxClient[_0xe4bc[80]]&&document[_0xe4bc[509]]){return _0x5d2ax9=document[_0xe4bc[509]](_0xe4bc[577],_0xe4bc[485]),_0x5d2ax9[_0xe4bc[57]](_0xe4bc[124],_0x5d2ax5),mxUtils[_0xe4bc[1331]](_0x5d2ax2)?this[_0xe4bc[813]][_0xe4bc[295]]!=document?_0x5d2ax9[_0xe4bc[62]](_0x5d2ax2[_0xe4bc[511]](!0)):_0x5d2ax9[_0xe4bc[62]](_0x5d2ax2):_0x5d2ax9[_0xe4bc[339]]=_0x5d2ax2,_0x5d2ax9};mxUtils[_0xe4bc[1331]](_0x5d2ax2)&&this[_0xe4bc[813]][_0xe4bc[295]]!=document&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[342]]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[230]](/
/g,_0xe4bc[1426])[_0xe4bc[230]](/
/g,_0xe4bc[1425]);return mxUtils[_0xe4bc[877]](_0xe4bc[1427]+_0x5d2ax5+_0xe4bc[1423]+_0x5d2ax2+_0xe4bc[1424])[_0xe4bc[158]]};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[963]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17){if(this[_0xe4bc[1285]]&&null!=_0x5d2ax9){_0x5d2ax17=null!=_0x5d2ax17?_0x5d2ax17:0;var _0x5d2ax18=this[_0xe4bc[724]];_0x5d2ax2+=_0x5d2ax18[_0xe4bc[1126]];_0x5d2ax3+=_0x5d2ax18[_0xe4bc[1125]];if(this[_0xe4bc[1344]]&&_0xe4bc[1428]==_0x5d2ax14){var _0x5d2ax19=_0xe4bc[1429];_0x5d2ax16?(_0x5d2ax19+=_0xe4bc[1430],0<_0x5d2ax5&&(_0x5d2ax19+=_0xe4bc[1431]+Math[_0xe4bc[488]](_0x5d2ax5)+_0xe4bc[1409]),0<_0x5d2ax4&&(_0x5d2ax19+=_0xe4bc[1432]+Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[1409])):_0x5d2ax15&&(_0x5d2ax19+=_0xe4bc[1432]+Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[1409],0<_0x5d2ax5&&(_0x5d2ax19+=_0xe4bc[1431]+Math[_0xe4bc[488]](_0x5d2ax5)+_0xe4bc[1409]));_0x5d2ax13?(!_0x5d2ax16&&0<_0x5d2ax4&&(_0x5d2ax19+=_0xe4bc[1432]+Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[1409]),_0x5d2ax19+=_0xe4bc[1433]):_0x5d2ax19+=_0xe4bc[1434];_0x5d2ax13=this[_0xe4bc[55]](_0xe4bc[449]);1>_0x5d2ax18[_0xe4bc[1244]]&&_0x5d2ax13[_0xe4bc[57]](_0xe4bc[461],_0x5d2ax18[_0xe4bc[1244]]);_0x5d2ax14=this[_0xe4bc[55]](_0xe4bc[1435]);_0x5d2ax14[_0xe4bc[57]](_0xe4bc[1377],_0xe4bc[1378]);_0x5d2ax19=this[_0xe4bc[1404]](_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax19,_0x5d2ax15);if(null!=_0x5d2ax19){_0x5d2ax13[_0xe4bc[62]](_0x5d2ax14);this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax13);var _0x5d2ax1a=0;if(mxClient[_0xe4bc[80]]&&!mxClient[_0xe4bc[48]]){var _0x5d2ax1b=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[103]]=_0x5d2ax19[_0xe4bc[284]](_0xe4bc[124]);_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[495]]=mxClient[_0xe4bc[496]]?_0xe4bc[497]:_0xe4bc[498];_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];_0x5d2ax1b[_0xe4bc[339]]=mxUtils[_0xe4bc[1331]](_0x5d2ax9)?_0x5d2ax9[_0xe4bc[342]]:_0x5d2ax9;document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax1b);_0x5d2ax1a=_0x5d2ax1b[_0xe4bc[359]];_0x5d2ax5=mxClient[_0xe4bc[496]]&&0<_0x5d2ax5&&_0x5d2ax16?Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax1b[_0xe4bc[167]]+2):_0x5d2ax1b[_0xe4bc[167]];_0x5d2ax1b[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax1b);_0x5d2ax14[_0xe4bc[62]](_0x5d2ax19)}else {this[_0xe4bc[813]][_0xe4bc[295]]!=document?(_0x5d2ax19[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188],document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax19),_0x5d2ax1a=_0x5d2ax19[_0xe4bc[359]],_0x5d2ax5=_0x5d2ax19[_0xe4bc[167]],_0x5d2ax14[_0xe4bc[62]](_0x5d2ax19),_0x5d2ax19[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110]):(_0x5d2ax14[_0xe4bc[62]](_0x5d2ax19),_0x5d2ax1a=_0x5d2ax19[_0xe4bc[359]],_0x5d2ax5=_0x5d2ax19[_0xe4bc[167]])};_0x5d2ax4=_0x5d2ax15?Math[_0xe4bc[160]](_0x5d2ax4,_0x5d2ax1a):_0x5d2ax1a;1>_0x5d2ax18[_0xe4bc[1244]]&&_0x5d2ax13[_0xe4bc[57]](_0xe4bc[461],_0x5d2ax18[_0xe4bc[1244]]);_0x5d2ax15=_0x5d2ax9=0;_0x5d2axa==mxConstants[_0xe4bc[479]]?_0x5d2ax9-=_0x5d2ax4/2:_0x5d2axa==mxConstants[_0xe4bc[480]]&&(_0x5d2ax9-=_0x5d2ax4);_0x5d2ax2+=_0x5d2ax9;_0x5d2ax12==mxConstants[_0xe4bc[481]]?_0x5d2ax15-=_0x5d2ax5/2:_0x5d2ax12==mxConstants[_0xe4bc[482]]&&(_0x5d2ax15-=_0x5d2ax5);_0x5d2ax3+=_0x5d2ax15;_0x5d2axa=1!=_0x5d2ax18[_0xe4bc[255]]?_0xe4bc[1402]+_0x5d2ax18[_0xe4bc[255]]+_0xe4bc[460]:_0xe4bc[110];0!=_0x5d2ax18[_0xe4bc[603]]&&this[_0xe4bc[1216]]?(_0x5d2axa+=_0xe4bc[1394]+_0x5d2ax18[_0xe4bc[603]]+_0xe4bc[537]+_0x5d2ax4/2+_0xe4bc[537]+_0x5d2ax5/2+_0xe4bc[460],_0x5d2ax3=this[_0xe4bc[1241]]((_0x5d2ax2+_0x5d2ax4/2)*_0x5d2ax18[_0xe4bc[255]],(_0x5d2ax3+_0x5d2ax5/2)*_0x5d2ax18[_0xe4bc[255]],_0x5d2ax18[_0xe4bc[603]],_0x5d2ax18[_0xe4bc[1395]],_0x5d2ax18[_0xe4bc[1396]]),_0x5d2ax2=_0x5d2ax3[_0xe4bc[235]]-_0x5d2ax4*_0x5d2ax18[_0xe4bc[255]]/2,_0x5d2ax3=_0x5d2ax3[_0xe4bc[236]]-_0x5d2ax5*_0x5d2ax18[_0xe4bc[255]]/2):(_0x5d2ax2*=_0x5d2ax18[_0xe4bc[255]],_0x5d2ax3*=_0x5d2ax18[_0xe4bc[255]]);0!=_0x5d2ax17&&(_0x5d2axa+=_0xe4bc[1394]+_0x5d2ax17+_0xe4bc[537]+-_0x5d2ax9+_0xe4bc[537]+-_0x5d2ax15+_0xe4bc[460]);_0x5d2ax13[_0xe4bc[57]](_0xe4bc[535],_0xe4bc[536]+Math[_0xe4bc[488]](_0x5d2ax2)+_0xe4bc[537]+Math[_0xe4bc[488]](_0x5d2ax3)+_0xe4bc[460]+_0x5d2axa);_0x5d2ax14[_0xe4bc[57]](_0xe4bc[117],Math[_0xe4bc[488]](Math[_0xe4bc[160]](1,_0x5d2ax4)));_0x5d2ax14[_0xe4bc[57]](_0xe4bc[119],Math[_0xe4bc[488]](Math[_0xe4bc[160]](1,_0x5d2ax5)))}}else {this[_0xe4bc[1436]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17)}}};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1437]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax2=Math[_0xe4bc[488]](_0x5d2ax2);_0x5d2ax3=Math[_0xe4bc[488]](_0x5d2ax3);_0x5d2ax4=Math[_0xe4bc[488]](_0x5d2ax4);_0x5d2ax5=Math[_0xe4bc[488]](_0x5d2ax5);for(var _0x5d2ax9=_0xe4bc[1438]+_0x5d2ax2+_0xe4bc[213]+_0x5d2ax3+_0xe4bc[213]+_0x5d2ax4+_0xe4bc[213]+_0x5d2ax5,_0x5d2axa=0,_0x5d2ax12=_0x5d2ax9+_0xe4bc[213]+_0x5d2axa;null!=document[_0xe4bc[1362]](_0x5d2ax12);){_0x5d2ax12=_0x5d2ax9+_0xe4bc[213]+ ++_0x5d2axa};clip=this[_0xe4bc[55]](_0xe4bc[1439]);clip[_0xe4bc[57]](_0xe4bc[1363],_0x5d2ax12);_0x5d2ax9=this[_0xe4bc[55]](_0xe4bc[1319]);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[235],_0x5d2ax2);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[236],_0x5d2ax3);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[117],_0x5d2ax4);_0x5d2ax9[_0xe4bc[57]](_0xe4bc[119],_0x5d2ax5);clip[_0xe4bc[62]](_0x5d2ax9);return clip};mxSvgCanvas2D[_0xe4bc[202]][_0xe4bc[1436]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16){_0x5d2ax16=null!=_0x5d2ax16?_0x5d2ax16:0;_0x5d2ax13=this[_0xe4bc[724]];var _0x5d2ax17=Math[_0xe4bc[488]](_0x5d2ax13[_0xe4bc[487]]),_0x5d2ax18=this[_0xe4bc[55]](_0xe4bc[449]),_0x5d2ax19=_0x5d2ax13[_0xe4bc[535]]||_0xe4bc[110];0!=_0x5d2ax16&&(_0x5d2ax19+=_0xe4bc[1394]+_0x5d2ax16+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax2*_0x5d2ax13[_0xe4bc[255]])+_0xe4bc[537]+this[_0xe4bc[1239]](_0x5d2ax3*_0x5d2ax13[_0xe4bc[255]])+_0xe4bc[460]);if(_0x5d2ax15&&0<_0x5d2ax4&&0<_0x5d2ax5){var _0x5d2ax1a=_0x5d2ax2;_0x5d2ax16=_0x5d2ax3;_0x5d2axa==mxConstants[_0xe4bc[479]]?_0x5d2ax1a-=_0x5d2ax4/2:_0x5d2axa==mxConstants[_0xe4bc[480]]&&(_0x5d2ax1a-=_0x5d2ax4);_0x5d2ax12==mxConstants[_0xe4bc[481]]?_0x5d2ax16-=_0x5d2ax5/2:_0x5d2ax12==mxConstants[_0xe4bc[482]]&&(_0x5d2ax16-=_0x5d2ax5);_0x5d2ax16=this[_0xe4bc[1437]](_0x5d2ax1a*_0x5d2ax13[_0xe4bc[255]]-2,_0x5d2ax16*_0x5d2ax13[_0xe4bc[255]]-2,_0x5d2ax4*_0x5d2ax13[_0xe4bc[255]]+4,_0x5d2ax5*_0x5d2ax13[_0xe4bc[255]]+4);null!=this[_0xe4bc[1340]]?this[_0xe4bc[1340]][_0xe4bc[62]](_0x5d2ax16):this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax16);_0x5d2ax18[_0xe4bc[57]](_0xe4bc[1440],_0xe4bc[1380]+_0x5d2ax16[_0xe4bc[284]](_0xe4bc[1363])+_0xe4bc[460])};this[_0xe4bc[1441]](_0x5d2ax18,_0x5d2axa);_0x5d2ax16=_0x5d2axa==mxConstants[_0xe4bc[480]]?_0xe4bc[1282]:_0x5d2axa==mxConstants[_0xe4bc[479]]?_0xe4bc[554]:_0xe4bc[861];_0xe4bc[861]!=_0x5d2ax16&&_0x5d2ax18[_0xe4bc[57]](_0xe4bc[1442],_0x5d2ax16);(!this[_0xe4bc[1341]]||_0x5d2ax17!=mxConstants[_0xe4bc[483]])&&_0x5d2ax18[_0xe4bc[57]](_0xe4bc[1443],Math[_0xe4bc[488]](_0x5d2ax17*_0x5d2ax13[_0xe4bc[255]])+_0xe4bc[168]);0<_0x5d2ax19[_0xe4bc[67]]&&_0x5d2ax18[_0xe4bc[57]](_0xe4bc[535],_0x5d2ax19);1>_0x5d2ax13[_0xe4bc[1244]]&&_0x5d2ax18[_0xe4bc[57]](_0xe4bc[461],_0x5d2ax13[_0xe4bc[1244]]);var _0x5d2ax19=_0x5d2ax9[_0xe4bc[224]](_0xe4bc[192]),_0x5d2ax1a=Math[_0xe4bc[488]](_0x5d2ax17*mxConstants[_0xe4bc[490]]),_0x5d2ax1b=_0x5d2ax17+(_0x5d2ax19[_0xe4bc[67]]-1)*_0x5d2ax1a;_0x5d2ax16=_0x5d2ax3+_0x5d2ax17-1;_0x5d2ax12==mxConstants[_0xe4bc[481]]?(_0x5d2ax5=(this[_0xe4bc[1343]]&&_0x5d2ax15&&0<_0x5d2ax5?Math[_0xe4bc[243]](_0x5d2ax1b,_0x5d2ax5):_0x5d2ax1b)/2,_0x5d2ax16-=_0x5d2ax5+1):_0x5d2ax12==mxConstants[_0xe4bc[482]]&&(_0x5d2ax5=this[_0xe4bc[1343]]&&_0x5d2ax15&&0<_0x5d2ax5?Math[_0xe4bc[243]](_0x5d2ax1b,_0x5d2ax5):_0x5d2ax1b,_0x5d2ax16-=_0x5d2ax5+2);for(_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax19[_0xe4bc[67]];_0x5d2ax5++){0<_0x5d2ax19[_0x5d2ax5][_0xe4bc[67]]&&0_0x5d2ax2[_0xe4bc[1244]]&&(_0x5d2ax3[_0xe4bc[461]]=100*_0x5d2ax2[_0xe4bc[1244]]+_0xe4bc[229])};return _0x5d2ax3};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1465]]=function(){var _0x5d2ax2=this[_0xe4bc[724]],_0x5d2ax3=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1477]);_0x5d2ax3[_0xe4bc[1478]]=_0x5d2ax2[_0xe4bc[1254]]||_0xe4bc[1232];_0x5d2ax3[_0xe4bc[1479]]=_0x5d2ax2[_0xe4bc[1256]]||_0xe4bc[1233];_0x5d2ax3[_0xe4bc[1313]]=_0x5d2ax2[_0xe4bc[1258]]||_0xe4bc[1480];1>_0x5d2ax2[_0xe4bc[1244]]&&(_0x5d2ax3[_0xe4bc[461]]=100*_0x5d2ax2[_0xe4bc[1244]]+_0xe4bc[229]);_0x5d2ax2[_0xe4bc[648]]&&(_0x5d2ax3[_0xe4bc[1481]]=this[_0xe4bc[1482]]());return _0x5d2ax3};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1482]]=function(){var _0x5d2ax2=_0xe4bc[1483];if(null!=this[_0xe4bc[724]][_0xe4bc[649]]){var _0x5d2ax3=this[_0xe4bc[724]][_0xe4bc[649]][_0xe4bc[224]](_0xe4bc[185]);0<_0x5d2ax3[_0xe4bc[67]]&&1==_0x5d2ax3[0]&&(_0x5d2ax2=_0xe4bc[1484])};return _0x5d2ax2};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1375]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[724]],_0x5d2ax9=-_0x5d2ax5[_0xe4bc[603]]*(Math[_0xe4bc[424]]/180),_0x5d2axa=Math[_0xe4bc[426]](_0x5d2ax9),_0x5d2ax9=Math[_0xe4bc[427]](_0x5d2ax9),_0x5d2ax12=_0x5d2ax5[_0xe4bc[1273]]*_0x5d2ax5[_0xe4bc[255]],_0x5d2ax13=_0x5d2ax5[_0xe4bc[1274]]*_0x5d2ax5[_0xe4bc[255]];_0xe4bc[235]==this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[1473]]?_0x5d2ax12*= -1:_0xe4bc[236]==this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[1473]]&&(_0x5d2ax13*= -1);var _0x5d2ax14=_0x5d2ax2[_0xe4bc[511]](!0);_0x5d2ax14[_0xe4bc[124]][_0xe4bc[945]]=Math[_0xe4bc[488]](_0x5d2ax12*_0x5d2axa-_0x5d2ax13*_0x5d2ax9)+_0xe4bc[168];_0x5d2ax14[_0xe4bc[124]][_0xe4bc[953]]=Math[_0xe4bc[488]](_0x5d2ax12*_0x5d2ax9+_0x5d2ax13*_0x5d2axa)+_0xe4bc[168];8==document[_0xe4bc[5]]&&(_0x5d2ax14[_0xe4bc[1463]]=_0x5d2ax2[_0xe4bc[1463]],_0xe4bc[253]==_0x5d2ax2[_0xe4bc[301]]&&(_0x5d2ax14[_0xe4bc[1215]]=this[_0xe4bc[1215]][_0xe4bc[234]](_0xe4bc[185])+_0xe4bc[1461],_0x5d2ax14[_0xe4bc[124]][_0xe4bc[117]]=this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[117]],_0x5d2ax14[_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[119]],_0x5d2ax14[_0xe4bc[1462]]=parseInt(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[117]])+_0xe4bc[185]+parseInt(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[119]])));_0x5d2ax4?(_0x5d2ax14[_0xe4bc[1306]]=_0x5d2ax5[_0xe4bc[1269]],_0x5d2ax14[_0xe4bc[62]](this[_0xe4bc[1485]]())):_0x5d2ax14[_0xe4bc[1464]]=_0xe4bc[308];_0x5d2ax3?_0x5d2ax14[_0xe4bc[62]](this[_0xe4bc[1486]]()):_0x5d2ax14[_0xe4bc[1468]]=_0xe4bc[308];return _0x5d2ax14};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1486]]=function(){var _0x5d2ax2=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1469]);_0x5d2ax2[_0xe4bc[352]]=this[_0xe4bc[724]][_0xe4bc[1269]];_0x5d2ax2[_0xe4bc[461]]=100*this[_0xe4bc[724]][_0xe4bc[1244]]*this[_0xe4bc[724]][_0xe4bc[1271]]+_0xe4bc[229];return _0x5d2ax2};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1485]]=function(){var _0x5d2ax2=this[_0xe4bc[1465]]();_0x5d2ax2[_0xe4bc[461]]=100*this[_0xe4bc[724]][_0xe4bc[1244]]*this[_0xe4bc[724]][_0xe4bc[1271]]+_0xe4bc[229];return _0x5d2ax2};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1294]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax3&&_0x5d2ax4?_0x5d2ax2+=180:_0x5d2ax3?this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[1473]]=_0xe4bc[235]:_0x5d2ax4&&(this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[1473]]=_0xe4bc[236]);if(_0x5d2ax3?!_0x5d2ax4:_0x5d2ax4){_0x5d2ax2*= -1};this[_0xe4bc[813]][_0xe4bc[124]][_0xe4bc[603]]=_0x5d2ax2;this[_0xe4bc[724]][_0xe4bc[603]]+=_0x5d2ax2;this[_0xe4bc[724]][_0xe4bc[1395]]=_0x5d2ax5;this[_0xe4bc[724]][_0xe4bc[1396]]=_0x5d2ax9};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1275]]=function(){mxAbstractCanvas2D[_0xe4bc[202]][_0xe4bc[1275]][_0xe4bc[183]](this,arguments);this[_0xe4bc[252]]=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1487]);this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492]};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1278]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[724]],_0x5d2axa=(this[_0xe4bc[1217]]+_0x5d2ax9[_0xe4bc[1126]])*_0x5d2ax9[_0xe4bc[255]],_0x5d2ax12=(this[_0xe4bc[1218]]+_0x5d2ax9[_0xe4bc[1125]])*_0x5d2ax9[_0xe4bc[255]];_0x5d2ax2=(_0x5d2ax2+_0x5d2ax9[_0xe4bc[1126]])*_0x5d2ax9[_0xe4bc[255]];_0x5d2ax3=(_0x5d2ax3+_0x5d2ax9[_0xe4bc[1125]])*_0x5d2ax9[_0xe4bc[255]];_0x5d2ax4=(_0x5d2ax4+_0x5d2ax9[_0xe4bc[1126]])*_0x5d2ax9[_0xe4bc[255]];_0x5d2ax5=(_0x5d2ax5+_0x5d2ax9[_0xe4bc[1125]])*_0x5d2ax9[_0xe4bc[255]];var _0x5d2ax12=_0x5d2ax12+2/3*(_0x5d2ax3-_0x5d2ax12),_0x5d2ax13=_0x5d2ax4+2/3*(_0x5d2ax2-_0x5d2ax4);_0x5d2ax3=_0x5d2ax5+2/3*(_0x5d2ax3-_0x5d2ax5);this[_0xe4bc[1215]][_0xe4bc[207]](_0xe4bc[1488]+this[_0xe4bc[1239]](_0x5d2axa+2/3*(_0x5d2ax2-_0x5d2axa))+_0xe4bc[185]+this[_0xe4bc[1239]](_0x5d2ax12)+_0xe4bc[185]+this[_0xe4bc[1239]](_0x5d2ax13)+_0xe4bc[185]+this[_0xe4bc[1239]](_0x5d2ax3)+_0xe4bc[185]+this[_0xe4bc[1239]](_0x5d2ax4)+_0xe4bc[185]+this[_0xe4bc[1239]](_0x5d2ax5));this[_0xe4bc[1217]]=_0x5d2ax4/_0x5d2ax9[_0xe4bc[255]]-_0x5d2ax9[_0xe4bc[1126]];this[_0xe4bc[1218]]=_0x5d2ax5/_0x5d2ax9[_0xe4bc[255]]-_0x5d2ax9[_0xe4bc[1125]]};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1489]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=this[_0xe4bc[724]];_0x5d2ax2=document[_0xe4bc[55]](_0x5d2ax2);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]]((_0x5d2ax3+_0x5d2axa[_0xe4bc[1126]])*_0x5d2axa[_0xe4bc[255]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]]((_0x5d2ax4+_0x5d2axa[_0xe4bc[1125]])*_0x5d2axa[_0xe4bc[255]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[117]]=this[_0xe4bc[1239]](_0x5d2ax5*_0x5d2axa[_0xe4bc[255]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[1239]](_0x5d2ax9*_0x5d2axa[_0xe4bc[255]])+_0xe4bc[168];return _0x5d2ax2};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1319]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[252]]=this[_0xe4bc[1489]](mxClient[_0xe4bc[463]]+_0xe4bc[1490],_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1320]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){this[_0xe4bc[252]]=this[_0xe4bc[1489]](mxClient[_0xe4bc[463]]+_0xe4bc[1491],_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5);this[_0xe4bc[252]][_0xe4bc[57]](_0xe4bc[1492],Math[_0xe4bc[160]](100*_0x5d2ax9/_0x5d2ax4,100*_0x5d2axa/_0x5d2ax5)+_0xe4bc[229])};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[680]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[252]]=this[_0xe4bc[1489]](mxClient[_0xe4bc[463]]+_0xe4bc[1493],_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[618]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13){var _0x5d2ax14=null;_0x5d2axa?(_0x5d2ax14=this[_0xe4bc[1489]](mxClient[_0xe4bc[463]]+_0xe4bc[1490],_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5),_0x5d2ax14[_0xe4bc[1464]]=_0xe4bc[308],_0x5d2ax2=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1469]),_0x5d2ax2[_0xe4bc[1322]]=_0x5d2axa?_0xe4bc[1494]:_0xe4bc[1495],_0x5d2ax2[_0xe4bc[1294]]=_0xe4bc[128],_0x5d2ax2[_0xe4bc[60]]=_0xe4bc[1496],_0x5d2ax2[_0xe4bc[390]]=_0x5d2ax9,_0x5d2ax14[_0xe4bc[62]](_0x5d2ax2)):(_0x5d2ax14=this[_0xe4bc[1489]](mxClient[_0xe4bc[463]]+_0xe4bc[464],_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5),_0x5d2ax14[_0xe4bc[390]]=_0x5d2ax9);_0x5d2ax12&&_0x5d2ax13?_0x5d2ax14[_0xe4bc[124]][_0xe4bc[603]]=_0xe4bc[1497]:_0x5d2ax12?_0x5d2ax14[_0xe4bc[124]][_0xe4bc[1473]]=_0xe4bc[235]:_0x5d2ax13&&(_0x5d2ax14[_0xe4bc[124]][_0xe4bc[1473]]=_0xe4bc[236]);1>this[_0xe4bc[724]][_0xe4bc[1244]]&&(_0x5d2ax14[_0xe4bc[124]][_0xe4bc[347]]+=_0xe4bc[459]+100*this[_0xe4bc[724]][_0xe4bc[1244]]+_0xe4bc[460]);this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax14)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1404]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[485]);var _0x5d2ax9=this[_0xe4bc[724]],_0x5d2axa=_0xe4bc[110];null!=_0x5d2ax9[_0xe4bc[1261]]&&(_0x5d2axa+=_0xe4bc[1418]+_0x5d2ax9[_0xe4bc[1261]]+_0xe4bc[471]);null!=_0x5d2ax9[_0xe4bc[1263]]&&(_0x5d2axa+=_0xe4bc[1419]+_0x5d2ax9[_0xe4bc[1263]]+_0xe4bc[471]);mxUtils[_0xe4bc[1331]](_0x5d2ax2)?_0x5d2ax4[_0xe4bc[62]](_0x5d2ax2):0<_0x5d2axa[_0xe4bc[67]]&&!_0x5d2ax5?(_0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[485]),_0x5d2ax5[_0xe4bc[124]][_0xe4bc[103]]=_0x5d2axa,_0x5d2ax5[_0xe4bc[124]][_0xe4bc[495]]=mxClient[_0xe4bc[496]]?_0xe4bc[497]:_0xe4bc[498],_0x5d2ax5[_0xe4bc[124]][_0xe4bc[499]]=_0xe4bc[500],_0x5d2ax5[_0xe4bc[339]]=_0x5d2ax2,_0x5d2ax4[_0xe4bc[62]](_0x5d2ax5)):(_0x5d2ax4[_0xe4bc[124]][_0xe4bc[103]]=_0x5d2axa,_0x5d2ax4[_0xe4bc[339]]=_0x5d2ax2);_0x5d2ax2=_0x5d2ax4[_0xe4bc[124]];_0x5d2ax2[_0xe4bc[487]]=Math[_0xe4bc[488]](_0x5d2ax9[_0xe4bc[487]]/this[_0xe4bc[1460]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[486]]=_0x5d2ax9[_0xe4bc[486]];_0x5d2ax2[_0xe4bc[352]]=_0x5d2ax9[_0xe4bc[665]];_0x5d2ax2[_0xe4bc[123]]=_0xe4bc[125];_0x5d2ax2[_0xe4bc[1165]]=_0x5d2ax3||_0xe4bc[361];_0x5d2ax2[_0xe4bc[489]]=Math[_0xe4bc[488]](_0x5d2ax9[_0xe4bc[487]]*mxConstants[_0xe4bc[490]]/this[_0xe4bc[1460]])+_0xe4bc[168];(_0x5d2ax9[_0xe4bc[666]]&mxConstants[_0xe4bc[1410]])==mxConstants[_0xe4bc[1410]]&&(_0x5d2ax2[_0xe4bc[1452]]=_0xe4bc[1447]);(_0x5d2ax9[_0xe4bc[666]]&mxConstants[_0xe4bc[1412]])==mxConstants[_0xe4bc[1412]]&&(_0x5d2ax2[_0xe4bc[666]]=_0xe4bc[1449]);(_0x5d2ax9[_0xe4bc[666]]&mxConstants[_0xe4bc[1414]])==mxConstants[_0xe4bc[1414]]&&(_0x5d2ax2[_0xe4bc[1498]]=_0xe4bc[355]);return _0x5d2ax4};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[963]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17){if(this[_0xe4bc[1285]]&&null!=_0x5d2ax9){var _0x5d2ax18=this[_0xe4bc[724]];if(_0xe4bc[1428]==_0x5d2ax14){null!=_0x5d2ax18[_0xe4bc[603]]&&(_0x5d2ax3=this[_0xe4bc[1241]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax18[_0xe4bc[603]],_0x5d2ax18[_0xe4bc[1395]],_0x5d2ax18[_0xe4bc[1396]]),_0x5d2ax2=_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3=_0x5d2ax3[_0xe4bc[236]]);8==document[_0xe4bc[5]]?(_0x5d2ax2+=_0x5d2ax18[_0xe4bc[1126]],_0x5d2ax3+=_0x5d2ax18[_0xe4bc[1125]]):(_0x5d2ax2*=_0x5d2ax18[_0xe4bc[255]],_0x5d2ax3*=_0x5d2ax18[_0xe4bc[255]]);_0x5d2ax14=8==document[_0xe4bc[5]]?document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1499]):document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax14[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax14[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497];_0x5d2ax14[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]](_0x5d2ax2)+_0xe4bc[168];_0x5d2ax14[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]](_0x5d2ax3)+_0xe4bc[168];_0x5d2ax14[_0xe4bc[124]][_0xe4bc[499]]=_0x5d2ax18[_0xe4bc[255]];var _0x5d2ax19=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax19[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[1500];_0x5d2ax19[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497];var _0x5d2ax1a=mxUtils[_0xe4bc[1501]](_0x5d2axa,_0x5d2ax12),_0x5d2ax1b=_0x5d2ax1a[_0xe4bc[235]],_0x5d2ax1a=_0x5d2ax1a[_0xe4bc[236]];_0x5d2ax9=this[_0xe4bc[1404]](_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax15);_0x5d2axa=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax13?(!_0x5d2ax16&&0<_0x5d2ax4&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[168]),_0x5d2ax9[_0xe4bc[124]][_0xe4bc[493]]=_0xe4bc[1502]):_0x5d2ax9[_0xe4bc[124]][_0xe4bc[493]]=_0xe4bc[494];_0x5d2ax13=_0x5d2ax18[_0xe4bc[603]]+(_0x5d2ax17||0);this[_0xe4bc[1216]]&&0!=_0x5d2ax13?(_0x5d2axa[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497],_0x5d2axa[_0xe4bc[124]][_0xe4bc[499]]=_0xe4bc[500],_0x5d2axa[_0xe4bc[62]](_0x5d2ax9),8==document[_0xe4bc[5]]&&_0xe4bc[529]!=this[_0xe4bc[813]][_0xe4bc[301]]?(_0x5d2ax19[_0xe4bc[62]](_0x5d2axa),_0x5d2ax14[_0xe4bc[62]](_0x5d2ax19)):_0x5d2ax14[_0xe4bc[62]](_0x5d2axa)):8==document[_0xe4bc[5]]?(_0x5d2ax19[_0xe4bc[62]](_0x5d2ax9),_0x5d2ax14[_0xe4bc[62]](_0x5d2ax19)):(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497],_0x5d2ax14[_0xe4bc[62]](_0x5d2ax9));_0xe4bc[529]!=this[_0xe4bc[813]][_0xe4bc[301]]?(_0x5d2ax17=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1490]),_0x5d2ax17[_0xe4bc[1464]]=_0xe4bc[308],_0x5d2ax17[_0xe4bc[1468]]=_0xe4bc[308],_0x5d2ax17[_0xe4bc[62]](_0x5d2ax14),this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax17)):this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax14);_0x5d2ax16?(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[277]]=_0xe4bc[188],0<_0x5d2ax4&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[488]](_0x5d2ax4)+_0xe4bc[168]),0<_0x5d2ax5&&8==document[_0xe4bc[5]]&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[1503]]=Math[_0xe4bc[488]](_0x5d2ax5)+_0xe4bc[168])):_0x5d2ax15&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax4+_0xe4bc[168],0<_0x5d2ax5&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[1503]]=Math[_0xe4bc[488]](_0x5d2ax5)+_0xe4bc[168]));if(this[_0xe4bc[1216]]&&0!=_0x5d2ax13){_0x5d2ax4=_0x5d2ax13*(Math[_0xe4bc[424]]/180);_0x5d2ax13=parseFloat(parseFloat(Math[_0xe4bc[426]](_0x5d2ax4))[_0xe4bc[1293]](8));_0x5d2ax17=parseFloat(parseFloat(Math[_0xe4bc[427]](-_0x5d2ax4))[_0xe4bc[1293]](8));_0x5d2ax4%=2*Math[_0xe4bc[424]];0>_0x5d2ax4&&(_0x5d2ax4+=2*Math[_0xe4bc[424]]);_0x5d2ax4%=Math[_0xe4bc[424]];_0x5d2ax4>Math[_0xe4bc[424]]/2&&(_0x5d2ax4=Math[_0xe4bc[424]]-_0x5d2ax4);_0x5d2ax12=Math[_0xe4bc[426]](_0x5d2ax4);var _0x5d2ax1c=Math[_0xe4bc[427]](_0x5d2ax4);8==document[_0xe4bc[5]]&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[498],_0x5d2axa[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[498],_0x5d2ax19[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[498]);_0x5d2ax9[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax9);_0x5d2ax4=_0x5d2ax9[_0xe4bc[359]];_0x5d2ax19=_0x5d2ax9[_0xe4bc[167]];if(mxClient[_0xe4bc[496]]&&(_0x5d2ax16||_0x5d2ax15)&&_0x5d2ax19>_0x5d2ax5){_0x5d2ax19=_0x5d2ax5,_0x5d2ax9[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax19+_0xe4bc[168]};_0x5d2ax5=_0x5d2ax19;_0x5d2ax16=(_0x5d2ax5-_0x5d2ax5*_0x5d2ax12+_0x5d2ax4* -_0x5d2ax1c)/2-_0x5d2ax17*_0x5d2ax4*(_0x5d2ax1b+0.5)+_0x5d2ax13*_0x5d2ax5*(_0x5d2ax1a+0.5);_0x5d2ax15=(_0x5d2ax4-_0x5d2ax4*_0x5d2ax12+_0x5d2ax5* -_0x5d2ax1c)/2+_0x5d2ax13*_0x5d2ax4*(_0x5d2ax1b+0.5)+_0x5d2ax17*_0x5d2ax5*(_0x5d2ax1a+0.5);_0xe4bc[1504]==_0x5d2ax14[_0xe4bc[301]]&&_0xe4bc[529]==this[_0xe4bc[813]][_0xe4bc[301]]?(_0x5d2ax1b=document[_0xe4bc[55]](_0xe4bc[485]),_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[498],_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492],_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]](_0x5d2ax2+(_0x5d2ax15-_0x5d2ax4/2)*_0x5d2ax18[_0xe4bc[255]])+_0xe4bc[168],_0x5d2ax1b[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]](_0x5d2ax3+(_0x5d2ax16-_0x5d2ax5/2)*_0x5d2ax18[_0xe4bc[255]])+_0xe4bc[168],_0x5d2ax14[_0xe4bc[265]][_0xe4bc[62]](_0x5d2ax1b),_0x5d2ax1b[_0xe4bc[62]](_0x5d2ax14)):(_0x5d2ax18=8==document[_0xe4bc[5]]?1:_0x5d2ax18[_0xe4bc[255]],_0x5d2ax14[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]](_0x5d2ax2+(_0x5d2ax15-_0x5d2ax4/2)*_0x5d2ax18)+_0xe4bc[168],_0x5d2ax14[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]](_0x5d2ax3+(_0x5d2ax16-_0x5d2ax5/2)*_0x5d2ax18)+_0xe4bc[168]);_0x5d2axa[_0xe4bc[124]][_0xe4bc[347]]=_0xe4bc[1505]+_0x5d2ax13+_0xe4bc[1506]+_0x5d2ax17+_0xe4bc[1507]+-_0x5d2ax17+_0xe4bc[1508]+_0x5d2ax13+_0xe4bc[1509];_0x5d2axa[_0xe4bc[124]][_0xe4bc[1028]]=this[_0xe4bc[1459]];1>this[_0xe4bc[724]][_0xe4bc[1244]]&&(_0x5d2axa[_0xe4bc[124]][_0xe4bc[347]]+=_0xe4bc[459]+100*this[_0xe4bc[724]][_0xe4bc[1244]]+_0xe4bc[460]);_0x5d2ax9[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110];_0x5d2axa[_0xe4bc[62]](_0x5d2ax9)}else {8!=document[_0xe4bc[5]]?(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[123]]=_0xe4bc[125],1>this[_0xe4bc[724]][_0xe4bc[1244]]&&(_0x5d2ax14[_0xe4bc[124]][_0xe4bc[347]]=_0xe4bc[459]+100*this[_0xe4bc[724]][_0xe4bc[1244]]+_0xe4bc[460]),_0x5d2ax18=_0x5d2ax9[_0xe4bc[265]],_0x5d2ax9[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188],document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax9),_0x5d2ax4=_0x5d2ax9[_0xe4bc[359]],_0x5d2ax19=_0x5d2ax9[_0xe4bc[167]],mxClient[_0xe4bc[496]]&&(_0x5d2ax16&&_0x5d2ax19>_0x5d2ax5)&&(_0x5d2ax19=_0x5d2ax5,_0x5d2ax9[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax19+_0xe4bc[168]),_0x5d2ax5=_0x5d2ax19,_0x5d2ax9[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[110],_0x5d2ax18[_0xe4bc[62]](_0x5d2ax9),_0x5d2ax14[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]](_0x5d2ax2+_0x5d2ax4*_0x5d2ax1b*this[_0xe4bc[724]][_0xe4bc[255]])+_0xe4bc[168],_0x5d2ax14[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]](_0x5d2ax3+_0x5d2ax5*_0x5d2ax1a*this[_0xe4bc[724]][_0xe4bc[255]])+_0xe4bc[168]):(1>this[_0xe4bc[724]][_0xe4bc[1244]]&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[347]]=_0xe4bc[459]+100*this[_0xe4bc[724]][_0xe4bc[1244]]+_0xe4bc[460]),_0x5d2ax19[_0xe4bc[124]][_0xe4bc[361]]=100*_0x5d2ax1b+_0xe4bc[229],_0x5d2ax19[_0xe4bc[124]][_0xe4bc[125]]=100*_0x5d2ax1a+_0xe4bc[229])}}else {this[_0xe4bc[1436]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,mxUtils[_0xe4bc[321]](_0x5d2ax9,!1),_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17)}}};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1436]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17){_0x5d2ax5=this[_0xe4bc[724]];_0x5d2ax2=(_0x5d2ax2+_0x5d2ax5[_0xe4bc[1126]])*_0x5d2ax5[_0xe4bc[255]];_0x5d2ax3=(_0x5d2ax3+_0x5d2ax5[_0xe4bc[1125]])*_0x5d2ax5[_0xe4bc[255]];_0x5d2ax4=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1487]);_0x5d2ax4[_0xe4bc[124]][_0xe4bc[117]]=_0xe4bc[942];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[119]]=_0xe4bc[942];_0x5d2ax4[_0xe4bc[1464]]=_0xe4bc[308];_0x5d2ax15=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1469]);_0x5d2ax15[_0xe4bc[352]]=_0x5d2ax5[_0xe4bc[665]];_0x5d2ax15[_0xe4bc[461]]=100*_0x5d2ax5[_0xe4bc[1244]]+_0xe4bc[229];_0x5d2ax4[_0xe4bc[62]](_0x5d2ax15);_0x5d2ax15=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1510]);_0x5d2ax15[_0xe4bc[1511]]=_0xe4bc[128];_0x5d2ax15[_0xe4bc[6]]=_0xe4bc[1512]+this[_0xe4bc[1239]](0)+_0xe4bc[185]+this[_0xe4bc[1239]](0)+_0xe4bc[1513]+this[_0xe4bc[1239]](1)+_0xe4bc[185]+this[_0xe4bc[1239]](0);_0x5d2ax4[_0xe4bc[62]](_0x5d2ax15);_0x5d2ax15=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1514]);_0x5d2ax15[_0xe4bc[124]][_0xe4bc[103]]=_0xe4bc[1515]+_0x5d2axa;_0x5d2ax15[_0xe4bc[124]][_0xe4bc[611]]=_0x5d2axa;_0x5d2ax15[_0xe4bc[124]][_0xe4bc[486]]=_0x5d2ax5[_0xe4bc[486]];_0x5d2ax15[_0xe4bc[1516]]=_0x5d2ax9;_0x5d2ax15[_0xe4bc[747]]=_0xe4bc[128];_0x5d2axa=Math[_0xe4bc[488]](_0x5d2ax5[_0xe4bc[487]]*_0x5d2ax5[_0xe4bc[255]]/this[_0xe4bc[1460]]);_0x5d2ax15[_0xe4bc[124]][_0xe4bc[487]]=_0x5d2axa+_0xe4bc[168];(_0x5d2ax5[_0xe4bc[666]]&mxConstants[_0xe4bc[1410]])==mxConstants[_0xe4bc[1410]]&&(_0x5d2ax15[_0xe4bc[124]][_0xe4bc[1452]]=_0xe4bc[1447]);(_0x5d2ax5[_0xe4bc[666]]&mxConstants[_0xe4bc[1412]])==mxConstants[_0xe4bc[1412]]&&(_0x5d2ax15[_0xe4bc[124]][_0xe4bc[666]]=_0xe4bc[1449]);(_0x5d2ax5[_0xe4bc[666]]&mxConstants[_0xe4bc[1414]])==mxConstants[_0xe4bc[1414]]&&(_0x5d2ax15[_0xe4bc[124]][_0xe4bc[354]]=_0xe4bc[355]);_0x5d2ax9=_0x5d2ax9[_0xe4bc[224]](_0xe4bc[192]);_0x5d2ax5=_0x5d2axa+(_0x5d2ax9[_0xe4bc[67]]-1)*_0x5d2axa*mxConstants[_0xe4bc[490]];_0x5d2axa=_0x5d2ax9=0;_0x5d2ax12==mxConstants[_0xe4bc[482]]?_0x5d2axa=-_0x5d2ax5/2:_0x5d2ax12!=mxConstants[_0xe4bc[481]]&&(_0x5d2axa=_0x5d2ax5/2);null!=_0x5d2ax17&&(_0x5d2ax4[_0xe4bc[124]][_0xe4bc[603]]=_0x5d2ax17,_0x5d2ax12=_0x5d2ax17*(Math[_0xe4bc[424]]/180),_0x5d2ax9=Math[_0xe4bc[427]](_0x5d2ax12)*_0x5d2axa,_0x5d2axa*=Math[_0xe4bc[426]](_0x5d2ax12));_0x5d2ax4[_0xe4bc[62]](_0x5d2ax15);_0x5d2ax4[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[1239]](_0x5d2ax2-_0x5d2ax9)+_0xe4bc[168];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[1239]](_0x5d2ax3+_0x5d2axa)+_0xe4bc[168];this[_0xe4bc[813]][_0xe4bc[62]](_0x5d2ax4)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1336]]=function(){this[_0xe4bc[1370]](!1,!0)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1334]]=function(){this[_0xe4bc[1370]](!0,!1)};mxVmlCanvas2D[_0xe4bc[202]][_0xe4bc[1337]]=function(){this[_0xe4bc[1370]](!0,!0)};function mxGuide(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[1517]](_0x5d2ax3)}mxGuide[_0xe4bc[202]][_0xe4bc[1179]]=null;mxGuide[_0xe4bc[202]][_0xe4bc[1214]]=null;mxGuide[_0xe4bc[202]][_0xe4bc[662]]= !0;mxGuide[_0xe4bc[202]][_0xe4bc[704]]= !0;mxGuide[_0xe4bc[202]][_0xe4bc[1518]]=null;mxGuide[_0xe4bc[202]][_0xe4bc[1519]]=null;mxGuide[_0xe4bc[202]][_0xe4bc[1517]]=function(_0x5d2ax2){this[_0xe4bc[1214]]=_0x5d2ax2};mxGuide[_0xe4bc[202]][_0xe4bc[1019]]=function(_0x5d2ax2){return !0};mxGuide[_0xe4bc[202]][_0xe4bc[1520]]=function(){return this[_0xe4bc[1179]][_0xe4bc[1020]]*this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]]/2};mxGuide[_0xe4bc[202]][_0xe4bc[1521]]=function(_0x5d2ax2){_0x5d2ax2= new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH);_0x5d2ax2[_0xe4bc[1522]]= !0;return _0x5d2ax2};mxGuide[_0xe4bc[202]][_0xe4bc[582]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(null!=this[_0xe4bc[1214]]&&(this[_0xe4bc[662]]||this[_0xe4bc[704]])&&null!=_0x5d2ax2&&null!=_0x5d2ax3){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[513]],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2axa=_0x5d2ax3[_0xe4bc[235]],_0x5d2ax12=_0x5d2ax3[_0xe4bc[236]],_0x5d2ax13=!1,_0x5d2ax14=!1,_0x5d2ax15=this[_0xe4bc[1520]](),_0x5d2ax16=_0x5d2ax15,_0x5d2ax17=_0x5d2ax15,_0x5d2ax15=_0x5d2ax2[_0xe4bc[238]]();_0x5d2ax15[_0xe4bc[235]]+=_0x5d2ax3[_0xe4bc[235]];_0x5d2ax15[_0xe4bc[236]]+=_0x5d2ax3[_0xe4bc[236]];var _0x5d2ax18=_0x5d2ax15[_0xe4bc[235]],_0x5d2ax19=_0x5d2ax15[_0xe4bc[235]]+_0x5d2ax15[_0xe4bc[117]],_0x5d2ax1a=_0x5d2ax15[_0xe4bc[241]](),_0x5d2ax1b=_0x5d2ax15[_0xe4bc[236]],_0x5d2ax1c=_0x5d2ax15[_0xe4bc[236]]+_0x5d2ax15[_0xe4bc[119]],_0x5d2ax1d=_0x5d2ax15[_0xe4bc[242]]();_0x5d2ax3=function(_0x5d2ax3){_0x5d2ax3+=this[_0xe4bc[1179]][_0xe4bc[1136]];var _0x5d2ax4=!1;Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1a)<_0x5d2ax16?(_0x5d2axa=_0x5d2ax3-_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax16=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1a),_0x5d2ax4= !0):Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax18)<_0x5d2ax16?(_0x5d2axa=_0x5d2ax3-_0x5d2ax2[_0xe4bc[235]],_0x5d2ax16=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax18),_0x5d2ax4= !0):Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax19)<_0x5d2ax16&&(_0x5d2axa=_0x5d2ax3-_0x5d2ax2[_0xe4bc[235]]-_0x5d2ax2[_0xe4bc[117]],_0x5d2ax16=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax19),_0x5d2ax4= !0);if(_0x5d2ax4){null==this[_0xe4bc[1518]]&&(this[_0xe4bc[1518]]=this[_0xe4bc[1521]](!0),this[_0xe4bc[1518]][_0xe4bc[507]]=this[_0xe4bc[1179]][_0xe4bc[507]]!=mxConstants[_0xe4bc[508]]?mxConstants[_0xe4bc[1523]]:mxConstants[_0xe4bc[508]],this[_0xe4bc[1518]][_0xe4bc[1229]]= !1,this[_0xe4bc[1518]][_0xe4bc[176]](this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[1524]]()));var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[526]];_0x5d2ax3-=this[_0xe4bc[1179]][_0xe4bc[1136]];this[_0xe4bc[1518]][_0xe4bc[1525]]=[ new mxPoint(_0x5d2ax3,-this[_0xe4bc[1179]][_0xe4bc[1137]]), new mxPoint(_0x5d2ax3,_0x5d2ax5[_0xe4bc[191]]-3-this[_0xe4bc[1179]][_0xe4bc[1137]])]};_0x5d2ax13=_0x5d2ax13||_0x5d2ax4};for(var _0x5d2ax15=function(_0x5d2ax3){_0x5d2ax3+=this[_0xe4bc[1179]][_0xe4bc[1137]];var _0x5d2ax4=!1;Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1d)<_0x5d2ax17?(_0x5d2ax12=_0x5d2ax3-_0x5d2ax2[_0xe4bc[242]](),_0x5d2ax17=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1d),_0x5d2ax4= !0):Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1b)<_0x5d2ax17?(_0x5d2ax12=_0x5d2ax3-_0x5d2ax2[_0xe4bc[236]],_0x5d2ax17=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1b),_0x5d2ax4= !0):Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1c)<_0x5d2ax17&&(_0x5d2ax12=_0x5d2ax3-_0x5d2ax2[_0xe4bc[236]]-_0x5d2ax2[_0xe4bc[119]],_0x5d2ax17=Math[_0xe4bc[425]](_0x5d2ax3-_0x5d2ax1c),_0x5d2ax4= !0);if(_0x5d2ax4){null==this[_0xe4bc[1519]]&&(this[_0xe4bc[1519]]=this[_0xe4bc[1521]](!1),this[_0xe4bc[1519]][_0xe4bc[507]]=this[_0xe4bc[1179]][_0xe4bc[507]]!=mxConstants[_0xe4bc[508]]?mxConstants[_0xe4bc[1523]]:mxConstants[_0xe4bc[508]],this[_0xe4bc[1519]][_0xe4bc[1229]]= !1,this[_0xe4bc[1519]][_0xe4bc[176]](this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[1524]]()));var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[526]];_0x5d2ax3-=this[_0xe4bc[1179]][_0xe4bc[1137]];this[_0xe4bc[1519]][_0xe4bc[1525]]=[ new mxPoint(-this[_0xe4bc[1179]][_0xe4bc[1136]],_0x5d2ax3), new mxPoint(_0x5d2ax5[_0xe4bc[1526]]-3-this[_0xe4bc[1179]][_0xe4bc[1136]],_0x5d2ax3)]};_0x5d2ax14=_0x5d2ax14||_0x5d2ax4},_0x5d2ax1e=0;_0x5d2ax1ethis[_0xe4bc[461]]&&(_0x5d2ax3+=_0xe4bc[459]+this[_0xe4bc[461]]+_0xe4bc[460]);this[_0xe4bc[1596]]&&(_0x5d2ax3+=_0xe4bc[1632]+Math[_0xe4bc[488]](mxConstants[_0xe4bc[1237]]*this[_0xe4bc[255]])+_0xe4bc[1633]+Math[_0xe4bc[488]](mxConstants[_0xe4bc[1238]]*this[_0xe4bc[255]])+_0xe4bc[1634]+mxConstants[_0xe4bc[1235]]+_0xe4bc[1635]);if(this[_0xe4bc[1299]]){var _0x5d2ax4=this[_0xe4bc[1334]],_0x5d2ax5=this[_0xe4bc[1299]],_0x5d2ax9=_0xe4bc[468],_0x5d2axa={east:0,south:1,west:2,north:3},_0x5d2ax12=null!=this[_0xe4bc[663]]?_0x5d2axa[this[_0xe4bc[663]]]:0;null!=this[_0xe4bc[607]]&&(_0x5d2ax12=mxUtils[_0xe4bc[1454]](_0x5d2ax12+_0x5d2axa[this[_0xe4bc[607]]]-1,4));1==_0x5d2ax12?(_0x5d2ax9=_0xe4bc[500],_0x5d2axa=_0x5d2ax4,_0x5d2ax4=_0x5d2ax5,_0x5d2ax5=_0x5d2axa):2==_0x5d2ax12?(_0x5d2axa=_0x5d2ax4,_0x5d2ax4=_0x5d2ax5,_0x5d2ax5=_0x5d2axa):3==_0x5d2ax12&&(_0x5d2ax9=_0xe4bc[500]);_0x5d2ax3+=_0xe4bc[1636]+_0x5d2ax4+_0xe4bc[1637]+_0x5d2ax5+_0xe4bc[1638]+_0x5d2ax9+_0xe4bc[1635]};_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]=_0x5d2ax3};function mxEllipse(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1}mxUtils[_0xe4bc[1284]](mxEllipse,mxShape);mxEllipse[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[680]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[1337]]()};function mxDoubleEllipse(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1}mxUtils[_0xe4bc[1284]](mxDoubleEllipse,mxShape);mxDoubleEllipse[_0xe4bc[202]][_0xe4bc[1460]]=10;mxDoubleEllipse[_0xe4bc[202]][_0xe4bc[1601]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[680]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[1337]]()};mxDoubleEllipse[_0xe4bc[202]][_0xe4bc[1602]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=Math[_0xe4bc[243]](4,Math[_0xe4bc[243]](_0x5d2ax5/5,_0x5d2ax9/5));_0x5d2ax5-=2*_0x5d2axa;_0x5d2ax9-=2*_0x5d2axa;0<_0x5d2ax5&&0<_0x5d2ax9&&_0x5d2ax2[_0xe4bc[680]](_0x5d2ax3+_0x5d2axa,_0x5d2ax4+_0x5d2axa,_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[1336]]()};function mxRhombus(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1}mxUtils[_0xe4bc[1284]](mxRhombus,mxShape);mxRhombus[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=_0x5d2ax5/2,_0x5d2ax12=_0x5d2ax9/2;_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax3+_0x5d2axa,_0x5d2ax4);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax3+_0x5d2ax5,_0x5d2ax4+_0x5d2ax12);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax3+_0x5d2axa,_0x5d2ax4+_0x5d2ax9);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax3,_0x5d2ax4+_0x5d2ax12);_0x5d2ax2[_0xe4bc[268]]();_0x5d2ax2[_0xe4bc[1337]]()};function mxPolyline(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1525]]=_0x5d2ax2;this[_0xe4bc[1336]]=_0x5d2ax3;this[_0xe4bc[1307]]=null!=_0x5d2ax4?_0x5d2ax4:1}mxUtils[_0xe4bc[1284]](mxPolyline,mxShape);mxPolyline[_0xe4bc[202]][_0xe4bc[1614]]=function(){return 0};mxPolyline[_0xe4bc[202]][_0xe4bc[1594]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1639]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[1606]])};mxPolyline[_0xe4bc[202]][_0xe4bc[1639]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,_0x5d2ax9=_0x5d2ax3[0],_0x5d2axa=_0x5d2ax3[_0x5d2ax3[_0xe4bc[67]]-1];_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]]);for(var _0x5d2ax12=1;_0x5d2ax12<_0x5d2ax3[_0xe4bc[67]]-1;_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax3[_0x5d2ax12],_0x5d2ax14=_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax13[_0xe4bc[235]],_0x5d2ax9=_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax13[_0xe4bc[236]];if(_0x5d2ax4&&_0x5d2ax12<_0x5d2ax3[_0xe4bc[67]]-1&&(0!=_0x5d2ax14||0!=_0x5d2ax9)){var _0x5d2ax15=Math[_0xe4bc[428]](_0x5d2ax14*_0x5d2ax14+_0x5d2ax9*_0x5d2ax9),_0x5d2ax14=_0x5d2ax14*Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax15/2)/_0x5d2ax15,_0x5d2ax9=_0x5d2ax9*Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax15/2)/_0x5d2ax15;_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax14,_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax9);_0x5d2ax9=_0x5d2ax3[_0x5d2ax12+1];_0x5d2ax14=_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax13[_0xe4bc[235]];_0x5d2ax9=_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax13[_0xe4bc[236]];_0x5d2ax15=Math[_0xe4bc[160]](1,Math[_0xe4bc[428]](_0x5d2ax14*_0x5d2ax14+_0x5d2ax9*_0x5d2ax9));_0x5d2ax14=_0x5d2ax14*Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax15/2)/_0x5d2ax15;_0x5d2ax9=_0x5d2ax9*Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax15/2)/_0x5d2ax15;_0x5d2ax14=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax14;_0x5d2ax9=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax9;_0x5d2ax2[_0xe4bc[1278]](_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax14,_0x5d2ax9);_0x5d2ax13= new mxPoint(_0x5d2ax14,_0x5d2ax9)}else {_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]])};_0x5d2ax9=_0x5d2ax13};_0x5d2ax2[_0xe4bc[1277]](_0x5d2axa[_0xe4bc[235]],_0x5d2axa[_0xe4bc[236]]);_0x5d2ax2[_0xe4bc[1336]]()};function mxArrow(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1525]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1;this[_0xe4bc[1640]]=null!=_0x5d2ax9?_0x5d2ax9:mxConstants[_0xe4bc[1641]];this[_0xe4bc[657]]=null!=_0x5d2axa?_0x5d2axa:mxConstants[_0xe4bc[1642]];this[_0xe4bc[643]]=null!=_0x5d2ax12?_0x5d2ax12:mxConstants[_0xe4bc[1643]]}mxUtils[_0xe4bc[1284]](mxArrow,mxShape);mxArrow[_0xe4bc[202]][_0xe4bc[1594]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=mxConstants[_0xe4bc[1642]],_0x5d2ax5=mxConstants[_0xe4bc[1641]],_0x5d2ax9=mxConstants[_0xe4bc[1643]],_0x5d2axa=_0x5d2ax3[0],_0x5d2ax12=_0x5d2ax3[_0x5d2ax3[_0xe4bc[67]]-1],_0x5d2ax13=_0x5d2ax12[_0xe4bc[235]]-_0x5d2axa[_0xe4bc[235]],_0x5d2ax14=_0x5d2ax12[_0xe4bc[236]]-_0x5d2axa[_0xe4bc[236]],_0x5d2ax15=Math[_0xe4bc[428]](_0x5d2ax13*_0x5d2ax13+_0x5d2ax14*_0x5d2ax14),_0x5d2ax16=_0x5d2ax15-2*_0x5d2ax4-_0x5d2ax9,_0x5d2ax13=_0x5d2ax13/_0x5d2ax15,_0x5d2ax14=_0x5d2ax14/_0x5d2ax15,_0x5d2ax15=_0x5d2ax5*_0x5d2ax14/3,_0x5d2ax5=-_0x5d2ax5*_0x5d2ax13/3,_0x5d2ax9=_0x5d2axa[_0xe4bc[235]]-_0x5d2ax15/2+_0x5d2ax4*_0x5d2ax13,_0x5d2axa=_0x5d2axa[_0xe4bc[236]]-_0x5d2ax5/2+_0x5d2ax4*_0x5d2ax14,_0x5d2ax17=_0x5d2ax9+_0x5d2ax15,_0x5d2ax18=_0x5d2axa+_0x5d2ax5,_0x5d2ax19=_0x5d2ax17+_0x5d2ax16*_0x5d2ax13,_0x5d2ax16=_0x5d2ax18+_0x5d2ax16*_0x5d2ax14,_0x5d2ax1a=_0x5d2ax19+_0x5d2ax15,_0x5d2ax1b=_0x5d2ax16+_0x5d2ax5,_0x5d2ax1c=_0x5d2ax1a-3*_0x5d2ax15,_0x5d2ax1d=_0x5d2ax1b-3*_0x5d2ax5;_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax9,_0x5d2axa);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax17,_0x5d2ax18);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax19,_0x5d2ax16);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax1a,_0x5d2ax1b);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax12[_0xe4bc[235]]-_0x5d2ax4*_0x5d2ax13,_0x5d2ax12[_0xe4bc[236]]-_0x5d2ax4*_0x5d2ax14);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax1c,_0x5d2ax1d);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax1c+_0x5d2ax15,_0x5d2ax1d+_0x5d2ax5);_0x5d2ax2[_0xe4bc[268]]();_0x5d2ax2[_0xe4bc[1337]]()};function mxText(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14,_0x5d2ax15,_0x5d2ax16,_0x5d2ax17,_0x5d2ax18,_0x5d2ax19,_0x5d2ax1a,_0x5d2ax1b,_0x5d2ax1c,_0x5d2ax1d,_0x5d2ax1e,_0x5d2ax1f){mxShape[_0xe4bc[239]](this);this[_0xe4bc[131]]=_0x5d2ax2;this[_0xe4bc[1562]]=_0x5d2ax3;this[_0xe4bc[352]]=null!=_0x5d2ax9?_0x5d2ax9:_0xe4bc[586];this[_0xe4bc[611]]=null!=_0x5d2ax4?_0x5d2ax4:_0xe4bc[110];this[_0xe4bc[552]]=null!=_0x5d2ax5?_0x5d2ax5:_0xe4bc[110];this[_0xe4bc[1288]]=null!=_0x5d2axa?_0x5d2axa:mxConstants[_0xe4bc[484]];this[_0xe4bc[803]]=null!=_0x5d2ax12?_0x5d2ax12:mxConstants[_0xe4bc[483]];this[_0xe4bc[666]]=null!=_0x5d2ax13?_0x5d2ax13:mxConstants[_0xe4bc[1644]];this[_0xe4bc[657]]=parseInt(_0x5d2ax14||2);this[_0xe4bc[658]]=this[_0xe4bc[657]]+parseInt(_0x5d2ax15||0);this[_0xe4bc[661]]=this[_0xe4bc[657]]+parseInt(_0x5d2ax16||0);this[_0xe4bc[660]]=this[_0xe4bc[657]]+parseInt(_0x5d2ax17||0);this[_0xe4bc[659]]=this[_0xe4bc[657]]+parseInt(_0x5d2ax18||0);this[_0xe4bc[662]]=null!=_0x5d2ax19?_0x5d2ax19:!0;this[_0xe4bc[1537]]=_0x5d2ax1a;this[_0xe4bc[467]]=_0x5d2ax1b;this[_0xe4bc[1333]]=null!=_0x5d2ax1c?_0x5d2ax1c:!1;this[_0xe4bc[1645]]=null!=_0x5d2ax1d?_0x5d2ax1d:!1;this[_0xe4bc[277]]=null!=_0x5d2ax1e?_0x5d2ax1e:_0xe4bc[189];this[_0xe4bc[629]]=null!=_0x5d2ax1f?_0x5d2ax1f:0;this[_0xe4bc[603]]=0}mxUtils[_0xe4bc[1284]](mxText,mxShape);mxText[_0xe4bc[202]][_0xe4bc[1646]]=0;mxText[_0xe4bc[202]][_0xe4bc[1647]]=0;mxText[_0xe4bc[202]][_0xe4bc[1648]]=0;mxText[_0xe4bc[202]][_0xe4bc[1649]]=0;mxText[_0xe4bc[202]][_0xe4bc[1650]]= !0;mxText[_0xe4bc[202]][_0xe4bc[1616]]= -90;mxText[_0xe4bc[202]][_0xe4bc[1651]]= !0;mxText[_0xe4bc[202]][_0xe4bc[1652]]= !1;mxText[_0xe4bc[202]][_0xe4bc[1566]]=function(){return !1};mxText[_0xe4bc[202]][_0xe4bc[1567]]=function(){return 8!=document[_0xe4bc[5]]};mxText[_0xe4bc[202]][_0xe4bc[1568]]=function(){return 0};mxText[_0xe4bc[202]][_0xe4bc[1574]]=function(){return null!=this[_0xe4bc[1562]]&&!isNaN(this[_0xe4bc[1562]][_0xe4bc[235]])&&!isNaN(this[_0xe4bc[1562]][_0xe4bc[236]])&&!isNaN(this[_0xe4bc[1562]][_0xe4bc[117]])&&!isNaN(this[_0xe4bc[1562]][_0xe4bc[119]])};mxText[_0xe4bc[202]][_0xe4bc[1577]]=function(){var _0x5d2ax2=this[_0xe4bc[252]];8==document[_0xe4bc[5]]&&null!=_0x5d2ax2[_0xe4bc[285]]&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]],null!=_0x5d2ax2[_0xe4bc[285]]&&(_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]]));this[_0xe4bc[1563]]=this[_0xe4bc[1562]][_0xe4bc[238]]();var _0x5d2ax3=this[_0xe4bc[1615]]();if(!this[_0xe4bc[1652]]&&null!=_0x5d2ax2&&_0xe4bc[1334]!=this[_0xe4bc[277]]&&(!this[_0xe4bc[1645]]||!this[_0xe4bc[1651]])){var _0x5d2ax4=null,_0x5d2ax5=null;if(null!=_0x5d2ax2[_0xe4bc[538]]){if(null!=_0x5d2ax2[_0xe4bc[285]]&&null!=_0x5d2ax2[_0xe4bc[285]][_0xe4bc[285]]&&_0xe4bc[1435]==_0x5d2ax2[_0xe4bc[285]][_0xe4bc[285]][_0xe4bc[301]]){_0x5d2ax2=_0x5d2ax2[_0xe4bc[285]][_0xe4bc[285]],_0x5d2ax4=this[_0xe4bc[1333]]?this[_0xe4bc[1562]][_0xe4bc[117]]:parseInt(_0x5d2ax2[_0xe4bc[284]](_0xe4bc[117]))*this[_0xe4bc[255]],_0x5d2ax5=parseInt(_0x5d2ax2[_0xe4bc[284]](_0xe4bc[119]))*this[_0xe4bc[255]]}else {_0x5d2ax3=_0x5d2ax2[_0xe4bc[1451]]();if(0==_0x5d2ax3[_0xe4bc[117]]&&0==_0x5d2ax3[_0xe4bc[119]]){return};this[_0xe4bc[1563]]= new mxRectangle(_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]]);_0x5d2ax3=0}}else {_0x5d2ax5=this[_0xe4bc[724]][_0xe4bc[441]][_0xe4bc[1653]],null!=this[_0xe4bc[359]]&&null!=this[_0xe4bc[167]]?(_0x5d2ax4=this[_0xe4bc[1333]]?this[_0xe4bc[1562]][_0xe4bc[117]]:this[_0xe4bc[359]]*this[_0xe4bc[255]],_0x5d2ax5=this[_0xe4bc[167]]*this[_0xe4bc[255]]):null!=_0x5d2ax5?(this[_0xe4bc[1441]](_0x5d2ax5),this[_0xe4bc[1654]](_0x5d2ax5),mxUtils[_0xe4bc[1331]](this[_0xe4bc[131]])?_0x5d2ax5[_0xe4bc[339]]=this[_0xe4bc[131]][_0xe4bc[342]]:(_0x5d2ax4=this[_0xe4bc[1650]]?this[_0xe4bc[131]][_0xe4bc[230]](/\n/g,_0xe4bc[1453]):this[_0xe4bc[131]],_0x5d2ax5[_0xe4bc[339]]=_0x5d2ax4),_0x5d2ax4=this[_0xe4bc[1333]]?this[_0xe4bc[1562]][_0xe4bc[117]]:_0x5d2ax5[_0xe4bc[359]]*this[_0xe4bc[255]],_0x5d2ax5=_0x5d2ax5[_0xe4bc[167]]*this[_0xe4bc[255]]):(_0x5d2ax4=this[_0xe4bc[1333]]?this[_0xe4bc[1562]][_0xe4bc[117]]:_0x5d2ax2[_0xe4bc[359]]*this[_0xe4bc[255]],_0x5d2ax5=_0x5d2ax2[_0xe4bc[167]]*this[_0xe4bc[255]])};null!=_0x5d2ax4&&null!=_0x5d2ax5&&(this[_0xe4bc[1563]]= new mxRectangle(this[_0xe4bc[1562]][_0xe4bc[235]]+this[_0xe4bc[1655]][_0xe4bc[235]]*_0x5d2ax4,this[_0xe4bc[1562]][_0xe4bc[236]]+this[_0xe4bc[1655]][_0xe4bc[236]]*_0x5d2ax5,_0x5d2ax4,_0x5d2ax5))}else {this[_0xe4bc[1563]][_0xe4bc[235]]+=this[_0xe4bc[1655]][_0xe4bc[235]]*this[_0xe4bc[1563]][_0xe4bc[117]],this[_0xe4bc[1563]][_0xe4bc[236]]+=this[_0xe4bc[1655]][_0xe4bc[236]]*this[_0xe4bc[1563]][_0xe4bc[119]]};null!=this[_0xe4bc[1563]]&&(0!=_0x5d2ax3&&(_0x5d2ax3=mxUtils[_0xe4bc[1613]](this[_0xe4bc[1563]],_0x5d2ax3),this[_0xe4bc[1563]][_0xe4bc[235]]=_0x5d2ax3[_0xe4bc[235]],this[_0xe4bc[1563]][_0xe4bc[236]]=_0x5d2ax3[_0xe4bc[236]],mxClient[_0xe4bc[496]]||(this[_0xe4bc[1563]][_0xe4bc[117]]=_0x5d2ax3[_0xe4bc[117]],this[_0xe4bc[1563]][_0xe4bc[119]]=_0x5d2ax3[_0xe4bc[119]])),this[_0xe4bc[1563]][_0xe4bc[235]]=Math[_0xe4bc[519]](this[_0xe4bc[1563]][_0xe4bc[235]]),this[_0xe4bc[1563]][_0xe4bc[236]]=Math[_0xe4bc[519]](this[_0xe4bc[1563]][_0xe4bc[236]]),this[_0xe4bc[1563]][_0xe4bc[117]]=Math[_0xe4bc[430]](this[_0xe4bc[1563]][_0xe4bc[117]]),this[_0xe4bc[1563]][_0xe4bc[119]]=Math[_0xe4bc[430]](this[_0xe4bc[1563]][_0xe4bc[119]]))};mxText[_0xe4bc[202]][_0xe4bc[1598]]=function(){return 0};mxText[_0xe4bc[202]][_0xe4bc[1615]]=function(){return null!=this[_0xe4bc[724]]&&null!=this[_0xe4bc[724]][_0xe4bc[253]]?this[_0xe4bc[724]][_0xe4bc[253]][_0xe4bc[1615]]():0};mxText[_0xe4bc[202]][_0xe4bc[1590]]=function(){return !this[_0xe4bc[662]]&&null!=this[_0xe4bc[724]]&&this[_0xe4bc[724]][_0xe4bc[441]][_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1193]](this[_0xe4bc[724]][_0xe4bc[246]])};mxText[_0xe4bc[202]][_0xe4bc[1592]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){mxShape[_0xe4bc[202]][_0xe4bc[1592]][_0xe4bc[183]](this,arguments);_0x5d2ax2[_0xe4bc[1259]](this[_0xe4bc[352]]);_0x5d2ax2[_0xe4bc[1260]](this[_0xe4bc[1537]]);_0x5d2ax2[_0xe4bc[1262]](this[_0xe4bc[467]]);_0x5d2ax2[_0xe4bc[1265]](this[_0xe4bc[1288]]);_0x5d2ax2[_0xe4bc[1264]](this[_0xe4bc[803]]);_0x5d2ax2[_0xe4bc[1266]](this[_0xe4bc[666]])};mxText[_0xe4bc[202]][_0xe4bc[1586]]=function(){this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[361]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[235]])+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[125]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[236]])+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[117]]=_0xe4bc[942];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[119]]=_0xe4bc[942];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[277]]=_0xe4bc[189]};mxText[_0xe4bc[202]][_0xe4bc[1209]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[255]],_0x5d2ax4=this[_0xe4bc[1562]][_0xe4bc[235]]/_0x5d2ax3,_0x5d2ax5=this[_0xe4bc[1562]][_0xe4bc[236]]/_0x5d2ax3,_0x5d2ax9=this[_0xe4bc[1562]][_0xe4bc[117]]/_0x5d2ax3,_0x5d2ax3=this[_0xe4bc[1562]][_0xe4bc[119]]/_0x5d2ax3;this[_0xe4bc[1591]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2ax3);this[_0xe4bc[1592]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2ax3);var _0x5d2axa=mxUtils[_0xe4bc[1331]](this[_0xe4bc[131]])||this[_0xe4bc[507]]==mxConstants[_0xe4bc[1656]],_0x5d2ax12=_0x5d2axa||_0x5d2ax2 instanceof mxVmlCanvas2D?_0xe4bc[1428]:_0xe4bc[110],_0x5d2ax13=this[_0xe4bc[131]];!_0x5d2axa&&_0xe4bc[1428]==_0x5d2ax12&&(_0x5d2ax13=mxUtils[_0xe4bc[321]](_0x5d2ax13,!1));_0x5d2ax13=!mxUtils[_0xe4bc[1331]](this[_0xe4bc[131]])&&this[_0xe4bc[1650]]&&_0xe4bc[1428]==_0x5d2ax12?_0x5d2ax13[_0xe4bc[230]](/\n/g,_0xe4bc[1453]):_0x5d2ax13;_0x5d2ax2[_0xe4bc[963]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2ax3,_0x5d2ax13,this[_0xe4bc[611]],this[_0xe4bc[552]],this[_0xe4bc[1333]],_0x5d2ax12,_0xe4bc[1334]==this[_0xe4bc[277]],this[_0xe4bc[1645]],this[_0xe4bc[1615]]())};mxText[_0xe4bc[202]][_0xe4bc[1575]]=function(){var _0x5d2ax2=this[_0xe4bc[252]][_0xe4bc[124]];_0x5d2ax2[_0xe4bc[461]]=1>this[_0xe4bc[461]]?this[_0xe4bc[461]]:_0xe4bc[110];_0x5d2ax2[_0xe4bc[277]]=_0xe4bc[110];_0x5d2ax2[_0xe4bc[117]]=_0xe4bc[110];_0x5d2ax2[_0xe4bc[119]]=_0xe4bc[110];this[_0xe4bc[1441]](this[_0xe4bc[252]]);this[_0xe4bc[1654]](this[_0xe4bc[252]]);this[_0xe4bc[1657]]();this[_0xe4bc[167]]=this[_0xe4bc[359]]=null;null!=mxClient[_0xe4bc[73]]?this[_0xe4bc[1658]]():this[_0xe4bc[1659]]()};mxText[_0xe4bc[202]][_0xe4bc[1658]]=function(){var _0x5d2ax2=this[_0xe4bc[1615]](),_0x5d2ax3=this[_0xe4bc[252]][_0xe4bc[124]],_0x5d2ax4=this[_0xe4bc[1655]][_0xe4bc[235]],_0x5d2ax5=this[_0xe4bc[1655]][_0xe4bc[236]];0!=_0x5d2ax2?(_0x5d2ax3[mxClient[_0xe4bc[73]]+_0xe4bc[1660]]=100*-_0x5d2ax4+_0xe4bc[1661]+100*-_0x5d2ax5+_0xe4bc[229],_0x5d2ax3[mxClient[_0xe4bc[73]]+_0xe4bc[1662]]=_0xe4bc[536]+100*_0x5d2ax4+_0xe4bc[1663]+100*_0x5d2ax5+_0xe4bc[1664]+this[_0xe4bc[255]]+_0xe4bc[1665]+_0x5d2ax2+_0xe4bc[1666]):(_0x5d2ax3[mxClient[_0xe4bc[73]]+_0xe4bc[1660]]=_0xe4bc[1667],_0x5d2ax3[mxClient[_0xe4bc[73]]+_0xe4bc[1662]]=_0xe4bc[1402]+this[_0xe4bc[255]]+_0xe4bc[1393]+100*_0x5d2ax4+_0xe4bc[1663]+100*_0x5d2ax5+_0xe4bc[1668]);_0x5d2ax3[_0xe4bc[361]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[235]])+_0xe4bc[168];_0x5d2ax3[_0xe4bc[125]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[236]])+_0xe4bc[168]};mxText[_0xe4bc[202]][_0xe4bc[1659]]=function(){var _0x5d2ax2=this[_0xe4bc[252]][_0xe4bc[124]],_0x5d2ax3=this[_0xe4bc[1655]][_0xe4bc[235]],_0x5d2ax4=this[_0xe4bc[1655]][_0xe4bc[236]],_0x5d2ax5=this[_0xe4bc[255]];_0x5d2ax2[_0xe4bc[347]]=_0xe4bc[110];var _0x5d2ax9=0,_0x5d2axa=0,_0x5d2ax12=null!=this[_0xe4bc[724]]?this[_0xe4bc[724]][_0xe4bc[441]][_0xe4bc[1653]]:null;if(null!=_0x5d2ax12){_0x5d2ax12[_0xe4bc[124]][_0xe4bc[277]]=_0xe4bc[110];_0x5d2ax12[_0xe4bc[124]][_0xe4bc[119]]=_0xe4bc[110];_0x5d2ax12[_0xe4bc[124]][_0xe4bc[117]]=_0xe4bc[110];this[_0xe4bc[1441]](_0x5d2ax12);this[_0xe4bc[1654]](_0x5d2ax12);if(mxUtils[_0xe4bc[1331]](this[_0xe4bc[131]])){_0x5d2ax12[_0xe4bc[339]]=this[_0xe4bc[131]][_0xe4bc[342]]}else {var _0x5d2ax13=this[_0xe4bc[131]];this[_0xe4bc[507]]!=mxConstants[_0xe4bc[1656]]&&(_0x5d2ax13=mxUtils[_0xe4bc[321]](_0x5d2ax13,!1));_0x5d2ax13=this[_0xe4bc[1650]]?_0x5d2ax13[_0xe4bc[230]](/\n/g,_0xe4bc[1453]):_0x5d2ax13;_0x5d2ax12[_0xe4bc[339]]=_0x5d2ax13};_0x5d2ax9=_0x5d2ax12[_0xe4bc[359]]+2;_0x5d2axa=_0x5d2ax12[_0xe4bc[167]]+2}else {_0x5d2ax9=this[_0xe4bc[252]][_0xe4bc[359]],_0x5d2axa=this[_0xe4bc[252]][_0xe4bc[167]]+1};this[_0xe4bc[359]]=_0x5d2ax9;this[_0xe4bc[167]]=_0x5d2axa;_0x5d2ax12=this[_0xe4bc[1562]][_0xe4bc[117]]/_0x5d2ax5;_0x5d2ax13=this[_0xe4bc[1562]][_0xe4bc[119]]/_0x5d2ax5;mxClient[_0xe4bc[496]]&&(this[_0xe4bc[1645]]||_0xe4bc[1334]==this[_0xe4bc[277]])&&0<_0x5d2ax13?(_0x5d2ax13=Math[_0xe4bc[243]](_0x5d2ax13,_0x5d2axa),_0x5d2ax2[_0xe4bc[119]]=Math[_0xe4bc[488]](_0x5d2ax13+1)+_0xe4bc[168]):_0x5d2ax13=_0x5d2axa;_0xe4bc[1334]!=this[_0xe4bc[277]]&&(mxClient[_0xe4bc[496]]&&(this[_0xe4bc[1645]]||this[_0xe4bc[1333]])&&0<_0x5d2ax12?(_0x5d2ax12=Math[_0xe4bc[243]](_0x5d2ax12,_0x5d2ax9),_0x5d2ax2[_0xe4bc[117]]=Math[_0xe4bc[488]](_0x5d2ax12)+_0xe4bc[168]):_0x5d2ax12=_0x5d2ax9);var _0x5d2ax13=_0x5d2ax13*_0x5d2ax5,_0x5d2ax12=_0x5d2ax12*_0x5d2ax5,_0x5d2ax9=this[_0xe4bc[1615]]()*(Math[_0xe4bc[424]]/180),_0x5d2axa=parseFloat(parseFloat(Math[_0xe4bc[426]](_0x5d2ax9))[_0xe4bc[1293]](8)),_0x5d2ax14=parseFloat(parseFloat(Math[_0xe4bc[427]](-_0x5d2ax9))[_0xe4bc[1293]](8)),_0x5d2ax9=_0x5d2ax9%(2*Math[_0xe4bc[424]]);0>_0x5d2ax9&&(_0x5d2ax9+=2*Math[_0xe4bc[424]]);_0x5d2ax9%=Math[_0xe4bc[424]];_0x5d2ax9>Math[_0xe4bc[424]]/2&&(_0x5d2ax9=Math[_0xe4bc[424]]-_0x5d2ax9);var _0x5d2ax15=Math[_0xe4bc[426]](_0x5d2ax9),_0x5d2ax16=Math[_0xe4bc[427]](-_0x5d2ax9),_0x5d2ax3=_0x5d2ax12* -(_0x5d2ax3+0.5),_0x5d2ax4=_0x5d2ax13* -(_0x5d2ax4+0.5),_0x5d2ax17=(_0x5d2ax13-_0x5d2ax13*_0x5d2ax15+_0x5d2ax12*_0x5d2ax16)/2+_0x5d2ax14*_0x5d2ax3-_0x5d2axa*_0x5d2ax4;0!=_0x5d2ax9&&(_0x5d2ax2[_0xe4bc[347]]=_0xe4bc[1505]+_0x5d2axa+_0xe4bc[1506]+_0x5d2ax14+_0xe4bc[1507]+-_0x5d2ax14+_0xe4bc[1508]+_0x5d2axa+_0xe4bc[1509]);_0x5d2ax2[_0xe4bc[499]]=_0x5d2ax5;_0x5d2ax2[_0xe4bc[361]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[235]]+((_0x5d2ax12-_0x5d2ax12*_0x5d2ax15+_0x5d2ax13*_0x5d2ax16)/2-_0x5d2axa*_0x5d2ax3-_0x5d2ax14*_0x5d2ax4)-_0x5d2ax12/2)+_0xe4bc[168];_0x5d2ax2[_0xe4bc[125]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[236]]+_0x5d2ax17-_0x5d2ax13/2)+_0xe4bc[168]};mxText[_0xe4bc[202]][_0xe4bc[1657]]=function(){if(mxUtils[_0xe4bc[1331]](this[_0xe4bc[131]])){this[_0xe4bc[252]][_0xe4bc[339]]=_0xe4bc[110],this[_0xe4bc[252]][_0xe4bc[62]](this[_0xe4bc[131]])}else {var _0x5d2ax2=this[_0xe4bc[131]];this[_0xe4bc[507]]!=mxConstants[_0xe4bc[1656]]&&(_0x5d2ax2=mxUtils[_0xe4bc[321]](_0x5d2ax2,!1));var _0x5d2ax2=this[_0xe4bc[1650]]?_0x5d2ax2[_0xe4bc[230]](/\n/g,_0xe4bc[1453]):_0x5d2ax2,_0x5d2ax3=null!=this[_0xe4bc[1537]]&&this[_0xe4bc[1537]]!=mxConstants[_0xe4bc[217]]?this[_0xe4bc[1537]]:null,_0x5d2ax4=null!=this[_0xe4bc[467]]&&this[_0xe4bc[467]]!=mxConstants[_0xe4bc[217]]?this[_0xe4bc[467]]:null;if(null!=_0x5d2ax3||null!=_0x5d2ax4){if(_0xe4bc[1334]==this[_0xe4bc[277]]){null!=_0x5d2ax3&&(this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[1028]]=_0x5d2ax3),null!=_0x5d2ax4&&(this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[467]]=_0xe4bc[1669]+_0x5d2ax4)}else {var _0x5d2ax5=_0xe4bc[110];null!=_0x5d2ax3&&(_0x5d2ax5+=_0xe4bc[1418]+_0x5d2ax3+_0xe4bc[471]);null!=_0x5d2ax4&&(_0x5d2ax5+=_0xe4bc[1419]+_0x5d2ax4+_0xe4bc[471]);_0x5d2ax2=_0xe4bc[1670]+_0x5d2ax5+_0xe4bc[1671]+this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[489]]+_0xe4bc[1423]+_0x5d2ax2+_0xe4bc[1424];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[489]]=_0xe4bc[110]}};this[_0xe4bc[252]][_0xe4bc[339]]=_0x5d2ax2}};mxText[_0xe4bc[202]][_0xe4bc[1441]]=function(_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[124]];_0x5d2ax2[_0xe4bc[489]]=Math[_0xe4bc[488]](this[_0xe4bc[803]]*mxConstants[_0xe4bc[490]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[487]]=Math[_0xe4bc[488]](this[_0xe4bc[803]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[486]]=this[_0xe4bc[1288]];_0x5d2ax2[_0xe4bc[123]]=_0xe4bc[125];_0x5d2ax2[_0xe4bc[352]]=this[_0xe4bc[352]];_0x5d2ax2[_0xe4bc[1452]]=(this[_0xe4bc[666]]&mxConstants[_0xe4bc[1410]])==mxConstants[_0xe4bc[1410]]?_0xe4bc[1447]:_0xe4bc[110];_0x5d2ax2[_0xe4bc[666]]=(this[_0xe4bc[666]]&mxConstants[_0xe4bc[1412]])==mxConstants[_0xe4bc[1412]]?_0xe4bc[1449]:_0xe4bc[110];_0x5d2ax2[_0xe4bc[1498]]=(this[_0xe4bc[666]]&mxConstants[_0xe4bc[1414]])==mxConstants[_0xe4bc[1414]]?_0xe4bc[355]:_0xe4bc[110];_0x5d2ax2[_0xe4bc[1165]]=this[_0xe4bc[611]]==mxConstants[_0xe4bc[479]]?_0xe4bc[698]:this[_0xe4bc[611]]==mxConstants[_0xe4bc[480]]?_0xe4bc[699]:_0xe4bc[361]};mxText[_0xe4bc[202]][_0xe4bc[1654]]=function(_0x5d2ax2){var _0x5d2ax3=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[117]]/this[_0xe4bc[255]]),_0x5d2ax4=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[119]]/this[_0xe4bc[255]]);_0x5d2ax2=_0x5d2ax2[_0xe4bc[124]];this[_0xe4bc[1645]]?(_0x5d2ax2[_0xe4bc[277]]=_0xe4bc[188],0<_0x5d2ax4&&(_0x5d2ax2[_0xe4bc[1503]]=_0x5d2ax4+_0xe4bc[168]),0<_0x5d2ax3&&(_0x5d2ax2[_0xe4bc[117]]=_0x5d2ax3+_0xe4bc[168])):_0xe4bc[1334]==this[_0xe4bc[277]]&&(_0x5d2ax2[_0xe4bc[117]]=_0x5d2ax3+_0xe4bc[168],0<_0x5d2ax4&&(_0x5d2ax2[_0xe4bc[1503]]=_0x5d2ax4+_0xe4bc[168]));this[_0xe4bc[1333]]?(!this[_0xe4bc[1645]]&&0<_0x5d2ax3&&(_0x5d2ax2[_0xe4bc[117]]=_0x5d2ax3+_0xe4bc[168]),_0x5d2ax2[_0xe4bc[493]]=_0xe4bc[1502]):_0x5d2ax2[_0xe4bc[493]]=_0xe4bc[494]};mxText[_0xe4bc[202]][_0xe4bc[1672]]=function(){this[_0xe4bc[1655]]=mxUtils[_0xe4bc[1501]](this[_0xe4bc[611]],this[_0xe4bc[552]])};mxText[_0xe4bc[202]][_0xe4bc[1673]]=function(){var _0x5d2ax2=0,_0x5d2ax3=0,_0x5d2ax2=this[_0xe4bc[611]]==mxConstants[_0xe4bc[479]]?(this[_0xe4bc[659]]-this[_0xe4bc[661]])/2:this[_0xe4bc[611]]==mxConstants[_0xe4bc[480]]?-this[_0xe4bc[661]]-this[_0xe4bc[1649]]:this[_0xe4bc[659]]+this[_0xe4bc[1648]],_0x5d2ax3=this[_0xe4bc[552]]==mxConstants[_0xe4bc[481]]?(this[_0xe4bc[658]]-this[_0xe4bc[660]])/2:this[_0xe4bc[552]]==mxConstants[_0xe4bc[482]]?-this[_0xe4bc[660]]-this[_0xe4bc[1647]]:this[_0xe4bc[658]]+this[_0xe4bc[1646]];return new mxPoint(_0x5d2ax2,_0x5d2ax3)};function mxTriangle(){mxActor[_0xe4bc[239]](this)}mxUtils[_0xe4bc[1284]](mxTriangle,mxActor);mxTriangle[_0xe4bc[202]][_0xe4bc[1625]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[1276]](0,0);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,0.5*_0x5d2ax9);_0x5d2ax2[_0xe4bc[1277]](0,_0x5d2ax9);_0x5d2ax2[_0xe4bc[268]]()};function mxHexagon(){mxActor[_0xe4bc[239]](this)}mxUtils[_0xe4bc[1284]](mxHexagon,mxActor);mxHexagon[_0xe4bc[202]][_0xe4bc[1625]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[1276]](0.25*_0x5d2ax5,0);_0x5d2ax2[_0xe4bc[1277]](0.75*_0x5d2ax5,0);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,0.5*_0x5d2ax9);_0x5d2ax2[_0xe4bc[1277]](0.75*_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[1277]](0.25*_0x5d2ax5,_0x5d2ax9);_0x5d2ax2[_0xe4bc[1277]](0,0.5*_0x5d2ax9);_0x5d2ax2[_0xe4bc[268]]()};function mxLine(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1336]]=_0x5d2ax3;this[_0xe4bc[1307]]=null!=_0x5d2ax4?_0x5d2ax4:1}mxUtils[_0xe4bc[1284]](mxLine,mxShape);mxLine[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax4+=_0x5d2ax9/2;_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax3,_0x5d2ax4);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax3+_0x5d2ax5,_0x5d2ax4);_0x5d2ax2[_0xe4bc[1336]]()};function mxImageShape(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[618]]=_0x5d2ax3;this[_0xe4bc[1334]]=_0x5d2ax4;this[_0xe4bc[1336]]=_0x5d2ax5;this[_0xe4bc[1307]]=null!=_0x5d2ax9?_0x5d2ax9:1;this[_0xe4bc[639]]= !1}mxUtils[_0xe4bc[1284]](mxImageShape,mxRectangleShape);mxImageShape[_0xe4bc[202]][_0xe4bc[1674]]= !0;mxImageShape[_0xe4bc[202]][_0xe4bc[1568]]=function(){return !mxClient[_0xe4bc[80]]?0.5:0};mxImageShape[_0xe4bc[202]][_0xe4bc[183]]=function(_0x5d2ax2){mxShape[_0xe4bc[202]][_0xe4bc[183]][_0xe4bc[183]](this,arguments);this[_0xe4bc[1299]]=this[_0xe4bc[1336]]=this[_0xe4bc[1334]]=null;null!=this[_0xe4bc[124]]&&(this[_0xe4bc[1334]]=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_BACKGROUND),this[_0xe4bc[1336]]=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_BORDER),this[_0xe4bc[1674]]=1==mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_ASPECT,1),this[_0xe4bc[623]]=this[_0xe4bc[623]]||1==mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],_0xe4bc[1675],0),this[_0xe4bc[624]]=this[_0xe4bc[624]]||1==mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],_0xe4bc[1676],0))};mxImageShape[_0xe4bc[202]][_0xe4bc[1567]]=function(){return !this[_0xe4bc[1674]]};mxImageShape[_0xe4bc[202]][_0xe4bc[1570]]=function(){var _0x5d2ax2=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];return _0x5d2ax2};mxImageShape[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=this[_0xe4bc[618]]){var _0x5d2axa=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_BACKGROUND,null),_0x5d2ax12=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_BORDER,null);if(null!=_0x5d2axa||null!=_0x5d2ax12){_0x5d2ax2[_0xe4bc[1245]](_0x5d2axa),_0x5d2ax2[_0xe4bc[1249]](_0x5d2ax12),_0x5d2ax2[_0xe4bc[1319]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[1337]]()};_0x5d2ax2[_0xe4bc[618]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,this[_0xe4bc[618]],this[_0xe4bc[1674]],!1,!1)}else {mxRectangleShape[_0xe4bc[202]][_0xe4bc[1601]][_0xe4bc[183]](this,arguments)}};mxImageShape[_0xe4bc[202]][_0xe4bc[1575]]=function(){this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[361]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[235]])+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[125]]=Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[236]])+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[160]](0,Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[117]]))+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[119]]=Math[_0xe4bc[160]](0,Math[_0xe4bc[488]](this[_0xe4bc[1562]][_0xe4bc[119]]))+_0xe4bc[168];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[1028]]=this[_0xe4bc[1334]]||_0xe4bc[110];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[1630]]=this[_0xe4bc[1336]]||_0xe4bc[110];this[_0xe4bc[252]][_0xe4bc[339]]=_0xe4bc[110];if(null!=this[_0xe4bc[618]]){var _0x5d2ax2=document[_0xe4bc[55]](mxClient[_0xe4bc[49]]||null==mxClient[_0xe4bc[73]]&&0!=this[_0xe4bc[603]]?mxClient[_0xe4bc[463]]+_0xe4bc[464]:_0xe4bc[466]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax2[_0xe4bc[390]]=this[_0xe4bc[618]];var _0x5d2ax3=100>this[_0xe4bc[461]]?_0xe4bc[459]+this[_0xe4bc[461]]+_0xe4bc[460]:_0xe4bc[110];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[347]]=_0x5d2ax3;this[_0xe4bc[623]]&&this[_0xe4bc[624]]?_0x5d2ax3+=_0xe4bc[1677]:this[_0xe4bc[623]]?_0x5d2ax3+=_0xe4bc[1678]:this[_0xe4bc[624]]&&(_0x5d2ax3+=_0xe4bc[1679]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]!=_0x5d2ax3&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[347]]=_0x5d2ax3);_0xe4bc[618]==_0x5d2ax2[_0xe4bc[301]]?_0x5d2ax2[_0xe4bc[124]][_0xe4bc[603]]=this[_0xe4bc[603]]:_0x5d2ax2[_0xe4bc[124]][mxClient[_0xe4bc[73]]+_0xe4bc[1662]]=_0xe4bc[1394]+this[_0xe4bc[603]]+_0xe4bc[1666];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[117]]=this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[117]];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[119]]=this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[119]];this[_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[1617]]=_0xe4bc[110];this[_0xe4bc[252]][_0xe4bc[62]](_0x5d2ax2)}else {this[_0xe4bc[1600]](this[_0xe4bc[252]])}};function mxLabel(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxRectangleShape[_0xe4bc[239]](this,_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5)}mxUtils[_0xe4bc[1284]](mxLabel,mxRectangleShape);mxLabel[_0xe4bc[202]][_0xe4bc[1680]]=mxConstants[_0xe4bc[1681]];mxLabel[_0xe4bc[202]][_0xe4bc[657]]=2;mxLabel[_0xe4bc[202]][_0xe4bc[1682]]=10;mxLabel[_0xe4bc[202]][_0xe4bc[635]]=2;mxLabel[_0xe4bc[202]][_0xe4bc[176]]=function(_0x5d2ax2){mxShape[_0xe4bc[202]][_0xe4bc[176]][_0xe4bc[183]](this,arguments);null!=this[_0xe4bc[632]]&&null!=this[_0xe4bc[630]]&&(this[_0xe4bc[1683]]= new this[_0xe4bc[630]],this[_0xe4bc[1683]][_0xe4bc[507]]=this[_0xe4bc[507]],this[_0xe4bc[1683]][_0xe4bc[1562]]=this[_0xe4bc[1562]],this[_0xe4bc[1683]][_0xe4bc[1334]]=this[_0xe4bc[632]],this[_0xe4bc[1683]][_0xe4bc[1336]]=this[_0xe4bc[632]],this[_0xe4bc[1683]][_0xe4bc[1299]]=this[_0xe4bc[634]],this[_0xe4bc[1683]][_0xe4bc[663]]=this[_0xe4bc[638]],this[_0xe4bc[1683]][_0xe4bc[176]](this[_0xe4bc[252]]))};mxLabel[_0xe4bc[202]][_0xe4bc[258]]=function(){null!=this[_0xe4bc[1683]]&&(this[_0xe4bc[1683]][_0xe4bc[1334]]=this[_0xe4bc[632]],this[_0xe4bc[1683]][_0xe4bc[1336]]=this[_0xe4bc[632]],this[_0xe4bc[1683]][_0xe4bc[1299]]=this[_0xe4bc[634]],this[_0xe4bc[1683]][_0xe4bc[663]]=this[_0xe4bc[638]]);mxShape[_0xe4bc[202]][_0xe4bc[258]][_0xe4bc[183]](this,arguments)};mxLabel[_0xe4bc[202]][_0xe4bc[1567]]=function(){return mxRectangleShape[_0xe4bc[202]][_0xe4bc[1567]][_0xe4bc[183]](this,arguments)&&null==this[_0xe4bc[632]]&&null==this[_0xe4bc[630]]};mxLabel[_0xe4bc[202]][_0xe4bc[1602]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){this[_0xe4bc[1684]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);this[_0xe4bc[1685]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9);mxRectangleShape[_0xe4bc[202]][_0xe4bc[1602]][_0xe4bc[183]](this,arguments)};mxLabel[_0xe4bc[202]][_0xe4bc[1684]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){null!=this[_0xe4bc[618]]&&(_0x5d2ax3=this[_0xe4bc[1686]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[618]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]],this[_0xe4bc[618]],!1,!1,!1))};mxLabel[_0xe4bc[202]][_0xe4bc[1686]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),_0x5d2axa=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),_0x5d2ax12=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_WIDTH,mxConstants.DEFAULT_IMAGESIZE),_0x5d2ax13=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_HEIGHT,mxConstants.DEFAULT_IMAGESIZE),_0x5d2ax14=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_SPACING,this[_0xe4bc[657]])+5;_0x5d2ax2=_0x5d2ax9==mxConstants[_0xe4bc[479]]?_0x5d2ax2+(_0x5d2ax4-_0x5d2ax12)/2:_0x5d2ax9==mxConstants[_0xe4bc[480]]?_0x5d2ax2+(_0x5d2ax4-_0x5d2ax12-_0x5d2ax14):_0x5d2ax2+_0x5d2ax14;_0x5d2ax3=_0x5d2axa==mxConstants[_0xe4bc[1687]]?_0x5d2ax3+_0x5d2ax14:_0x5d2axa==mxConstants[_0xe4bc[482]]?_0x5d2ax3+(_0x5d2ax5-_0x5d2ax13-_0x5d2ax14):_0x5d2ax3+(_0x5d2ax5-_0x5d2ax13)/2;return new mxRectangle(_0x5d2ax2,_0x5d2ax3,_0x5d2ax12,_0x5d2ax13)};mxLabel[_0xe4bc[202]][_0xe4bc[1685]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){null!=this[_0xe4bc[1683]]?(this[_0xe4bc[1683]][_0xe4bc[1562]]=this[_0xe4bc[1688]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9),this[_0xe4bc[1683]][_0xe4bc[1209]](_0x5d2ax2)):null!=this[_0xe4bc[631]]&&(_0x5d2ax3=this[_0xe4bc[1688]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[618]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]],this[_0xe4bc[631]],!1,!1,!1))};mxLabel[_0xe4bc[202]][_0xe4bc[1688]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),_0x5d2axa=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),_0x5d2ax12=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_INDICATOR_WIDTH,this[_0xe4bc[1682]]),_0x5d2ax13=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_INDICATOR_HEIGHT,this[_0xe4bc[1682]]),_0x5d2ax14=this[_0xe4bc[657]]+5;_0x5d2ax2=_0x5d2ax9==mxConstants[_0xe4bc[480]]?_0x5d2ax2+(_0x5d2ax4-_0x5d2ax12-_0x5d2ax14):_0x5d2ax9==mxConstants[_0xe4bc[479]]?_0x5d2ax2+(_0x5d2ax4-_0x5d2ax12)/2:_0x5d2ax2+_0x5d2ax14;_0x5d2ax3=_0x5d2axa==mxConstants[_0xe4bc[482]]?_0x5d2ax3+(_0x5d2ax5-_0x5d2ax13-_0x5d2ax14):_0x5d2axa==mxConstants[_0xe4bc[1687]]?_0x5d2ax3+_0x5d2ax14:_0x5d2ax3+(_0x5d2ax5-_0x5d2ax13)/2;return new mxRectangle(_0x5d2ax2,_0x5d2ax3,_0x5d2ax12,_0x5d2ax13)};mxLabel[_0xe4bc[202]][_0xe4bc[1575]]=function(){for(mxRectangleShape[_0xe4bc[202]][_0xe4bc[1575]][_0xe4bc[183]](this,arguments);this[_0xe4bc[252]][_0xe4bc[1580]]();){this[_0xe4bc[252]][_0xe4bc[266]](this[_0xe4bc[252]][_0xe4bc[1581]])};if(null!=this[_0xe4bc[618]]){var _0x5d2ax2=document[_0xe4bc[55]](_0xe4bc[466]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[1500];_0x5d2ax2[_0xe4bc[57]](_0xe4bc[467],_0xe4bc[468]);var _0x5d2ax3=this[_0xe4bc[1686]](this[_0xe4bc[1562]][_0xe4bc[235]],this[_0xe4bc[1562]][_0xe4bc[236]],this[_0xe4bc[1562]][_0xe4bc[117]],this[_0xe4bc[1562]][_0xe4bc[119]]);_0x5d2ax3[_0xe4bc[235]]-=this[_0xe4bc[1562]][_0xe4bc[235]];_0x5d2ax3[_0xe4bc[236]]-=this[_0xe4bc[1562]][_0xe4bc[236]];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[361]]=Math[_0xe4bc[488]](_0x5d2ax3[_0xe4bc[235]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[125]]=Math[_0xe4bc[488]](_0x5d2ax3[_0xe4bc[236]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[488]](_0x5d2ax3[_0xe4bc[117]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[124]][_0xe4bc[119]]=Math[_0xe4bc[488]](_0x5d2ax3[_0xe4bc[119]])+_0xe4bc[168];_0x5d2ax2[_0xe4bc[390]]=this[_0xe4bc[618]];this[_0xe4bc[252]][_0xe4bc[62]](_0x5d2ax2)}};function mxCylinder(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1}mxUtils[_0xe4bc[1284]](mxCylinder,mxShape);mxCylinder[_0xe4bc[202]][_0xe4bc[1503]]=40;mxCylinder[_0xe4bc[202]][_0xe4bc[1564]]=0;mxCylinder[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[513]](_0x5d2ax3,_0x5d2ax4);_0x5d2ax2[_0xe4bc[1275]]();this[_0xe4bc[1625]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,!1);_0x5d2ax2[_0xe4bc[1337]]();_0x5d2ax2[_0xe4bc[1267]](!1);_0x5d2ax2[_0xe4bc[1275]]();this[_0xe4bc[1625]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,!0);_0x5d2ax2[_0xe4bc[1336]]()};mxCylinder[_0xe4bc[202]][_0xe4bc[1625]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax3=Math[_0xe4bc[243]](this[_0xe4bc[1503]],Math[_0xe4bc[488]](_0x5d2ax9/5));if(_0x5d2axa&&null!=this[_0xe4bc[1334]]||!_0x5d2axa&&null==this[_0xe4bc[1334]]){_0x5d2ax2[_0xe4bc[1276]](0,_0x5d2ax3),_0x5d2ax2[_0xe4bc[1279]](0,2*_0x5d2ax3,_0x5d2ax5,2*_0x5d2ax3,_0x5d2ax5,_0x5d2ax3),_0x5d2axa||(_0x5d2ax2[_0xe4bc[1336]](),_0x5d2ax2[_0xe4bc[1275]]())};_0x5d2axa||(_0x5d2ax2[_0xe4bc[1276]](0,_0x5d2ax3),_0x5d2ax2[_0xe4bc[1279]](0,-_0x5d2ax3/3,_0x5d2ax5,-_0x5d2ax3/3,_0x5d2ax5,_0x5d2ax3),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2ax9-_0x5d2ax3),_0x5d2ax2[_0xe4bc[1279]](_0x5d2ax5,_0x5d2ax9+_0x5d2ax3/3,0,_0x5d2ax9+_0x5d2ax3/3,0,_0x5d2ax9-_0x5d2ax3),_0x5d2ax2[_0xe4bc[268]]())};function mxConnector(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxPolyline[_0xe4bc[239]](this,_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)}mxUtils[_0xe4bc[1284]](mxConnector,mxPolyline);mxConnector[_0xe4bc[202]][_0xe4bc[1594]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1689]](_0x5d2ax2,_0x5d2ax3,!0),_0x5d2ax5=this[_0xe4bc[1689]](_0x5d2ax2,_0x5d2ax3,!1);null==this[_0xe4bc[124]]||1!=this[_0xe4bc[124]][mxConstants[_0xe4bc[1690]]]?this[_0xe4bc[1639]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[1606]]):this[_0xe4bc[1691]](_0x5d2ax2,_0x5d2ax3);_0x5d2ax2[_0xe4bc[1245]](this[_0xe4bc[1336]]);_0x5d2ax2[_0xe4bc[1267]](!1);_0x5d2ax2[_0xe4bc[1251]](!1);null!=_0x5d2ax4&&_0x5d2ax4();null!=_0x5d2ax5&&_0x5d2ax5()};mxConnector[_0xe4bc[202]][_0xe4bc[1691]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2[_0xe4bc[1275]]();var _0x5d2ax4=_0x5d2ax3[0],_0x5d2ax5=_0x5d2ax3[_0xe4bc[67]];_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]]);for(_0x5d2ax4=1;_0x5d2ax4<_0x5d2ax5-2;_0x5d2ax4++){var _0x5d2ax9=_0x5d2ax3[_0x5d2ax4],_0x5d2axa=_0x5d2ax3[_0x5d2ax4+1];_0x5d2ax2[_0xe4bc[1278]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],(_0x5d2ax9[_0xe4bc[235]]+_0x5d2axa[_0xe4bc[235]])/2,(_0x5d2ax9[_0xe4bc[236]]+_0x5d2axa[_0xe4bc[236]])/2)};_0x5d2ax9=_0x5d2ax3[_0x5d2ax5-2];_0x5d2axa=_0x5d2ax3[_0x5d2ax5-1];_0x5d2ax2[_0xe4bc[1278]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],_0x5d2axa[_0xe4bc[235]],_0x5d2axa[_0xe4bc[236]]);_0x5d2ax2[_0xe4bc[1336]]()};mxConnector[_0xe4bc[202]][_0xe4bc[1689]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[67]],_0x5d2ax9=_0x5d2ax4?_0x5d2ax3[1]:_0x5d2ax3[_0x5d2ax5-2];_0x5d2ax3=_0x5d2ax4?_0x5d2ax3[0]:_0x5d2ax3[_0x5d2ax5-1];var _0x5d2ax5=_0x5d2ax3[_0xe4bc[235]]-_0x5d2ax9[_0xe4bc[235]],_0x5d2axa=_0x5d2ax3[_0xe4bc[236]]-_0x5d2ax9[_0xe4bc[236]],_0x5d2ax12=Math[_0xe4bc[160]](1,Math[_0xe4bc[428]](_0x5d2ax5*_0x5d2ax5+_0x5d2axa*_0x5d2axa)),_0x5d2ax9=_0x5d2ax5/_0x5d2ax12,_0x5d2ax5=_0x5d2axa/_0x5d2ax12,_0x5d2axa=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],_0x5d2ax4?mxConstants[_0xe4bc[1692]]:mxConstants[_0xe4bc[1693]],mxConstants.DEFAULT_MARKERSIZE),_0x5d2ax12=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],_0x5d2ax4?mxConstants[_0xe4bc[1694]]:mxConstants[_0xe4bc[1695]]);return mxMarker[_0xe4bc[1689]](_0x5d2ax2,this,_0x5d2ax12,_0x5d2ax3,_0x5d2ax9,_0x5d2ax5,_0x5d2axa,_0x5d2ax4,this[_0xe4bc[1307]],0!=this[_0xe4bc[124]][_0x5d2ax4?mxConstants[_0xe4bc[1696]]:mxConstants[_0xe4bc[1697]]])};mxConnector[_0xe4bc[202]][_0xe4bc[1612]]=function(_0x5d2ax2){mxShape[_0xe4bc[202]][_0xe4bc[1612]][_0xe4bc[183]](this,arguments);var _0x5d2ax3=0;mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants[_0xe4bc[217]]&&(_0x5d2ax3=mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1);mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants[_0xe4bc[217]]&&(_0x5d2ax3=Math[_0xe4bc[160]](_0x5d2ax3,mxUtils[_0xe4bc[1550]](this[_0xe4bc[124]],mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1);_0x5d2ax2[_0xe4bc[244]](Math[_0xe4bc[430]](_0x5d2ax3*this[_0xe4bc[255]]))};function mxSwimlane(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxShape[_0xe4bc[239]](this);this[_0xe4bc[1562]]=_0x5d2ax2;this[_0xe4bc[1334]]=_0x5d2ax3;this[_0xe4bc[1336]]=_0x5d2ax4;this[_0xe4bc[1307]]=null!=_0x5d2ax5?_0x5d2ax5:1}mxUtils[_0xe4bc[1284]](mxSwimlane,mxShape);mxSwimlane[_0xe4bc[202]][_0xe4bc[1680]]=16;mxSwimlane[_0xe4bc[202]][_0xe4bc[1597]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2=Math[_0xe4bc[243]](_0x5d2ax9,mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE));return new mxRectangle(_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax2)};mxSwimlane[_0xe4bc[202]][_0xe4bc[1614]]=function(){var _0x5d2ax2=mxShape[_0xe4bc[202]][_0xe4bc[1614]][_0xe4bc[183]](this,arguments);1!=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_HORIZONTAL,1)&&(_0x5d2ax2+=mxText[_0xe4bc[202]][_0xe4bc[1616]]);return _0x5d2ax2};mxSwimlane[_0xe4bc[202]][_0xe4bc[1615]]=function(){return this[_0xe4bc[1614]]()};mxSwimlane[_0xe4bc[202]][_0xe4bc[1590]]=function(){return mxShape[_0xe4bc[202]][_0xe4bc[1590]][_0xe4bc[183]](this,arguments)||1!=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_HORIZONTAL,1)};mxSwimlane[_0xe4bc[202]][_0xe4bc[1603]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_ARCSIZE,100*mxConstants[_0xe4bc[1557]])/100;return 3*_0x5d2ax4*_0x5d2ax2};mxSwimlane[_0xe4bc[202]][_0xe4bc[1595]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=Math[_0xe4bc[243]](_0x5d2ax9,mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),_0x5d2ax12=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_SWIMLANE_FILLCOLOR,mxConstants.NONE),_0x5d2ax13=1==mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_SWIMLANE_LINE,1),_0x5d2ax14=0;_0x5d2ax2[_0xe4bc[513]](_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[1606]]?(_0x5d2ax14=this[_0xe4bc[1603]](_0x5d2ax5,_0x5d2ax9,_0x5d2axa),this[_0xe4bc[1698]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax14,_0x5d2ax12,_0x5d2ax13)):this[_0xe4bc[1699]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13);_0x5d2ax12=mxUtils[_0xe4bc[433]](this[_0xe4bc[124]],mxConstants.STYLE_SEPARATORCOLOR,mxConstants.NONE);this[_0xe4bc[1700]](_0x5d2ax2,_0x5d2ax5,_0x5d2axa,_0x5d2ax9,_0x5d2ax12);null!=this[_0xe4bc[618]]&&(_0x5d2ax9=this[_0xe4bc[1686]](_0x5d2ax3,_0x5d2axa,_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[618]](_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax3,_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax4,_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]],this[_0xe4bc[618]],!1,!1,!1));this[_0xe4bc[617]]&&(_0x5d2ax2[_0xe4bc[1267]](!1),this[_0xe4bc[1604]](_0x5d2ax2,0,0,_0x5d2ax5,_0x5d2axa,_0x5d2ax14))};mxSwimlane[_0xe4bc[202]][_0xe4bc[1699]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13){_0x5d2ax12!=mxConstants[_0xe4bc[217]]&&(_0x5d2ax2[_0xe4bc[815]](),_0x5d2ax2[_0xe4bc[1245]](_0x5d2ax12),_0x5d2ax2[_0xe4bc[1319]](0,0,_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[1337]](),_0x5d2ax2[_0xe4bc[1210]](),_0x5d2ax2[_0xe4bc[1267]](!1));_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](0,_0x5d2axa);_0x5d2ax2[_0xe4bc[1277]](0,0);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,0);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2axa);_0x5d2ax13&&_0x5d2ax2[_0xe4bc[268]]();_0x5d2ax2[_0xe4bc[1337]]();_0x5d2axa<_0x5d2ax9&&_0x5d2ax12==mxConstants[_0xe4bc[217]]&&(_0x5d2ax2[_0xe4bc[1229]]= !1,_0x5d2ax2[_0xe4bc[1275]](),_0x5d2ax2[_0xe4bc[1276]](0,_0x5d2axa),_0x5d2ax2[_0xe4bc[1277]](0,_0x5d2ax9),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2ax9),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2axa),_0x5d2ax2[_0xe4bc[1336]]())};mxSwimlane[_0xe4bc[202]][_0xe4bc[1698]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14){_0x5d2ax13!=mxConstants[_0xe4bc[217]]&&(_0x5d2ax2[_0xe4bc[815]](),_0x5d2ax2[_0xe4bc[1245]](_0x5d2ax13),_0x5d2ax2[_0xe4bc[1320]](0,0,_0x5d2ax5,_0x5d2ax9,_0x5d2ax12,_0x5d2ax12),_0x5d2ax2[_0xe4bc[1337]](),_0x5d2ax2[_0xe4bc[1210]](),_0x5d2ax2[_0xe4bc[1267]](!1));_0x5d2ax2[_0xe4bc[1275]]();_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax5,_0x5d2axa);_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2ax12);_0x5d2ax2[_0xe4bc[1278]](_0x5d2ax5,0,_0x5d2ax5-Math[_0xe4bc[243]](_0x5d2ax5/2,_0x5d2ax12),0);_0x5d2ax2[_0xe4bc[1277]](Math[_0xe4bc[243]](_0x5d2ax5/2,_0x5d2ax12),0);_0x5d2ax2[_0xe4bc[1278]](0,0,0,_0x5d2ax12);_0x5d2ax2[_0xe4bc[1277]](0,_0x5d2axa);_0x5d2ax14&&_0x5d2ax2[_0xe4bc[268]]();_0x5d2ax2[_0xe4bc[1337]]();_0x5d2axa<_0x5d2ax9&&_0x5d2ax13==mxConstants[_0xe4bc[217]]&&(_0x5d2ax2[_0xe4bc[1229]]= !1,_0x5d2ax2[_0xe4bc[1275]](),_0x5d2ax2[_0xe4bc[1276]](0,_0x5d2axa),_0x5d2ax2[_0xe4bc[1277]](0,_0x5d2ax9-_0x5d2ax12),_0x5d2ax2[_0xe4bc[1278]](0,_0x5d2ax9,Math[_0xe4bc[243]](_0x5d2ax5/2,_0x5d2ax12),_0x5d2ax9),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5-Math[_0xe4bc[243]](_0x5d2ax5/2,_0x5d2ax12),_0x5d2ax9),_0x5d2ax2[_0xe4bc[1278]](_0x5d2ax5,_0x5d2ax9,_0x5d2ax5,_0x5d2ax9-_0x5d2ax12),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax5,_0x5d2axa),_0x5d2ax2[_0xe4bc[1336]]())};mxSwimlane[_0xe4bc[202]][_0xe4bc[1700]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax9!=mxConstants[_0xe4bc[217]]&&(_0x5d2ax2[_0xe4bc[1249]](_0x5d2ax9),_0x5d2ax2[_0xe4bc[1251]](!0),_0x5d2ax2[_0xe4bc[1275]](),_0x5d2ax2[_0xe4bc[1276]](_0x5d2ax3,_0x5d2ax4),_0x5d2ax2[_0xe4bc[1277]](_0x5d2ax3,_0x5d2ax5),_0x5d2ax2[_0xe4bc[1336]](),_0x5d2ax2[_0xe4bc[1251]](!1))};mxSwimlane[_0xe4bc[202]][_0xe4bc[1686]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return new mxRectangle(_0x5d2ax2+_0x5d2ax4-this[_0xe4bc[1680]],_0x5d2ax3,this[_0xe4bc[1680]],this[_0xe4bc[1680]])};function mxGraphLayout(_0x5d2ax2){this[_0xe4bc[1179]]=_0x5d2ax2}mxGraphLayout[_0xe4bc[202]][_0xe4bc[1179]]=null;mxGraphLayout[_0xe4bc[202]][_0xe4bc[1701]]= !0;mxGraphLayout[_0xe4bc[202]][_0xe4bc[1101]]=null;mxGraphLayout[_0xe4bc[202]][_0xe4bc[1702]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){};mxGraphLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1703]]=function(){return this[_0xe4bc[1179]]};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1704]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax3);_0x5d2ax3=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[124]]:this[_0xe4bc[1179]][_0xe4bc[1705]](_0x5d2ax3);return null!=_0x5d2ax3?_0x5d2ax3[_0x5d2ax2]:null};mxGraphLayout[_0xe4bc[1706]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax4&&null!=_0x5d2ax2){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;_0x5d2ax9=_0x5d2ax9||[];var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2);if(null==_0x5d2ax9[_0x5d2axa]&&(_0x5d2ax9[_0x5d2axa]=_0x5d2ax2,_0x5d2ax5=_0x5d2ax4(_0x5d2ax2,_0x5d2ax5),null==_0x5d2ax5||_0x5d2ax5)){if(_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1707]](_0x5d2ax2),0<_0x5d2ax5){for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax5;_0x5d2axa++){var _0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1708]](_0x5d2ax2,_0x5d2axa),_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax12,!0)==_0x5d2ax2;if(!_0x5d2ax3||_0x5d2ax13){_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax12,!_0x5d2ax13),this[_0xe4bc[1706]](_0x5d2ax13,_0x5d2ax3,_0x5d2ax4,_0x5d2ax12,_0x5d2ax9)}}}}}};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1711]]=function(_0x5d2ax2){return this[_0xe4bc[1179]][_0xe4bc[1712]](_0x5d2ax2)};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1713]]=function(_0x5d2ax2){return !this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1193]](_0x5d2ax2)||!this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax2)};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1715]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]]();return !_0x5d2ax3[_0xe4bc[250]](_0x5d2ax2)||!this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax2)||null==_0x5d2ax3[_0xe4bc[1709]](_0x5d2ax2,!0)||null==_0x5d2ax3[_0xe4bc[1709]](_0x5d2ax2,!1)};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1716]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1179]][_0xe4bc[1717]](mxConstants.STYLE_NOEDGESTYLE,_0x5d2ax3?_0xe4bc[468]:_0xe4bc[500],[_0x5d2ax2])};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1718]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1179]][_0xe4bc[1717]](mxConstants.STYLE_ORTHOGONAL,_0x5d2ax3?_0xe4bc[500]:_0xe4bc[468],[_0x5d2ax2])};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1719]]=function(_0x5d2ax2){var _0x5d2ax3= new mxPoint;if(null!=_0x5d2ax2&&_0x5d2ax2!=this[_0xe4bc[1101]]){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]]();if(_0x5d2ax4[_0xe4bc[1720]](this[_0xe4bc[1101]],_0x5d2ax2)){for(var _0x5d2ax5=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax2);_0x5d2ax2!=this[_0xe4bc[1101]];){_0x5d2ax3[_0xe4bc[235]]+=_0x5d2ax5[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]]+=_0x5d2ax5[_0xe4bc[236]],_0x5d2ax2=_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax2),_0x5d2ax5=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax2)}}};return _0x5d2ax3};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1722]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[251]],_0x5d2ax5=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax2);null==_0x5d2ax5?(_0x5d2ax5= new mxGeometry,_0x5d2ax5[_0xe4bc[1723]](!0)):_0x5d2ax5=_0x5d2ax5[_0xe4bc[238]]();if(null!=this[_0xe4bc[1101]]&&null!=_0x5d2ax3){for(var _0x5d2ax9=_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax2),_0x5d2ax9=this[_0xe4bc[1719]](_0x5d2ax9),_0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[67]];_0x5d2axa++){_0x5d2ax3[_0x5d2axa][_0xe4bc[235]]-=_0x5d2ax9[_0xe4bc[235]],_0x5d2ax3[_0x5d2axa][_0xe4bc[236]]-=_0x5d2ax9[_0xe4bc[236]]}};_0x5d2ax5[_0xe4bc[1525]]=_0x5d2ax3;_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax5)}};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1725]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax9=_0x5d2ax5[_0xe4bc[1721]](_0x5d2ax2),_0x5d2axa=null;if(null!=_0x5d2ax9){_0x5d2axa= new mxRectangle(_0x5d2ax3,_0x5d2ax4,_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]]);if(this[_0xe4bc[1701]]){var _0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax2);if(null!=_0x5d2ax12&&null!=_0x5d2ax12[_0xe4bc[963]]&&null!=_0x5d2ax12[_0xe4bc[963]][_0xe4bc[1563]]){var _0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2ax14=_0x5d2ax12[_0xe4bc[963]][_0xe4bc[1563]];_0x5d2ax12[_0xe4bc[963]][_0xe4bc[1563]][_0xe4bc[235]]<_0x5d2ax12[_0xe4bc[235]]&&(_0x5d2ax3+=(_0x5d2ax12[_0xe4bc[235]]-_0x5d2ax14[_0xe4bc[235]])/_0x5d2ax13,_0x5d2axa[_0xe4bc[117]]=_0x5d2ax14[_0xe4bc[117]]);_0x5d2ax12[_0xe4bc[963]][_0xe4bc[1563]][_0xe4bc[236]]<_0x5d2ax12[_0xe4bc[236]]&&(_0x5d2ax4+=(_0x5d2ax12[_0xe4bc[236]]-_0x5d2ax14[_0xe4bc[236]])/_0x5d2ax13,_0x5d2axa[_0xe4bc[119]]=_0x5d2ax14[_0xe4bc[119]])}};null!=this[_0xe4bc[1101]]&&(_0x5d2ax12=_0x5d2ax5[_0xe4bc[1197]](_0x5d2ax2),null!=_0x5d2ax12&&_0x5d2ax12!=this[_0xe4bc[1101]]&&(_0x5d2ax12=this[_0xe4bc[1719]](_0x5d2ax12),_0x5d2ax3-=_0x5d2ax12[_0xe4bc[235]],_0x5d2ax4-=_0x5d2ax12[_0xe4bc[236]]));if(_0x5d2ax9[_0xe4bc[235]]!=_0x5d2ax3||_0x5d2ax9[_0xe4bc[236]]!=_0x5d2ax4){_0x5d2ax9=_0x5d2ax9[_0xe4bc[238]](),_0x5d2ax9[_0xe4bc[235]]=_0x5d2ax3,_0x5d2ax9[_0xe4bc[236]]=_0x5d2ax4,_0x5d2ax5[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax9)}};return _0x5d2axa};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1726]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1721]](_0x5d2ax2);if(this[_0xe4bc[1701]]){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax2);if(null!=_0x5d2ax4&&null!=_0x5d2ax4[_0xe4bc[963]]&&null!=_0x5d2ax4[_0xe4bc[963]][_0xe4bc[1563]]){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2ax9=_0x5d2ax4[_0xe4bc[963]][_0xe4bc[1563]],_0x5d2axa=Math[_0xe4bc[160]](_0x5d2ax4[_0xe4bc[235]]-_0x5d2ax9[_0xe4bc[235]],0)/_0x5d2ax5,_0x5d2ax12=Math[_0xe4bc[160]](_0x5d2ax4[_0xe4bc[236]]-_0x5d2ax9[_0xe4bc[236]],0)/_0x5d2ax5,_0x5d2ax13=Math[_0xe4bc[160]](_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax9[_0xe4bc[117]]-(_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]),0)/_0x5d2ax5,_0x5d2ax4=Math[_0xe4bc[160]](_0x5d2ax9[_0xe4bc[236]]+_0x5d2ax9[_0xe4bc[119]]-(_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]),0)/_0x5d2ax5,_0x5d2ax3= new mxRectangle(_0x5d2ax3[_0xe4bc[235]]-_0x5d2axa,_0x5d2ax3[_0xe4bc[236]]-_0x5d2ax12,_0x5d2ax3[_0xe4bc[117]]+_0x5d2axa+_0x5d2ax13,_0x5d2ax3[_0xe4bc[119]]+_0x5d2ax12+_0x5d2ax4)}};null!=this[_0xe4bc[1101]]&&(_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1197]](_0x5d2ax2),_0x5d2ax3=_0x5d2ax3[_0xe4bc[238]](),null!=_0x5d2ax2&&_0x5d2ax2!=this[_0xe4bc[1101]]&&(_0x5d2ax2=this[_0xe4bc[1719]](_0x5d2ax2),_0x5d2ax3[_0xe4bc[235]]+=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]]+=_0x5d2ax2[_0xe4bc[236]]));return new mxRectangle(_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]])};mxGraphLayout[_0xe4bc[202]][_0xe4bc[1727]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[473]]();try{for(var _0x5d2ax4=_0x5d2ax2[_0xe4bc[67]]-1;0<=_0x5d2ax4;_0x5d2ax4--){var _0x5d2ax5=_0x5d2ax2[_0x5d2ax4],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[1728]](_0x5d2ax5),_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[1729]](_0x5d2ax9),_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax5),_0x5d2ax13=0,_0x5d2ax14=0;if(this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax5)){var _0x5d2ax15=this[_0xe4bc[1179]][_0xe4bc[1731]](_0x5d2ax5),_0x5d2ax13=_0x5d2ax15[_0xe4bc[117]],_0x5d2ax14=_0x5d2ax15[_0xe4bc[119]]};null!=_0x5d2axa&&null!=_0x5d2ax12&&(_0x5d2ax12=_0x5d2ax12[_0xe4bc[238]](),_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax12[_0xe4bc[235]]+_0x5d2axa[_0xe4bc[235]]-_0x5d2ax3-_0x5d2ax13,_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax12[_0xe4bc[236]]+_0x5d2axa[_0xe4bc[236]]-_0x5d2ax3-_0x5d2ax14,_0x5d2ax12[_0xe4bc[117]]=_0x5d2axa[_0xe4bc[117]]+2*_0x5d2ax3+_0x5d2ax13,_0x5d2ax12[_0xe4bc[119]]=_0x5d2axa[_0xe4bc[119]]+2*_0x5d2ax3+_0x5d2ax14,this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1724]](_0x5d2ax5,_0x5d2ax12),this[_0xe4bc[1179]][_0xe4bc[834]](_0x5d2ax9,_0x5d2ax3+_0x5d2ax13-_0x5d2axa[_0xe4bc[235]],_0x5d2ax3+_0x5d2ax14-_0x5d2axa[_0xe4bc[236]]))}}finally{this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[476]]()}};function mxStackLayout(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2);this[_0xe4bc[662]]=null!=_0x5d2ax3?_0x5d2ax3:!0;this[_0xe4bc[657]]=null!=_0x5d2ax4?_0x5d2ax4:0;this[_0xe4bc[1732]]=null!=_0x5d2ax5?_0x5d2ax5:0;this[_0xe4bc[1733]]=null!=_0x5d2ax9?_0x5d2ax9:0;this[_0xe4bc[467]]=null!=_0x5d2axa?_0x5d2axa:0}mxStackLayout[_0xe4bc[202]]= new mxGraphLayout;mxStackLayout[_0xe4bc[202]][_0xe4bc[196]]=mxStackLayout;mxStackLayout[_0xe4bc[202]][_0xe4bc[662]]=null;mxStackLayout[_0xe4bc[202]][_0xe4bc[657]]=null;mxStackLayout[_0xe4bc[202]][_0xe4bc[1732]]=null;mxStackLayout[_0xe4bc[202]][_0xe4bc[1733]]=null;mxStackLayout[_0xe4bc[202]][_0xe4bc[467]]=0;mxStackLayout[_0xe4bc[202]][_0xe4bc[1734]]= !1;mxStackLayout[_0xe4bc[202]][_0xe4bc[1334]]= !1;mxStackLayout[_0xe4bc[202]][_0xe4bc[1735]]= !1;mxStackLayout[_0xe4bc[202]][_0xe4bc[1736]]= !1;mxStackLayout[_0xe4bc[202]][_0xe4bc[1333]]=null;mxStackLayout[_0xe4bc[202]][_0xe4bc[1737]]=function(){return this[_0xe4bc[662]]};mxStackLayout[_0xe4bc[202]][_0xe4bc[1702]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax9=_0x5d2ax5[_0xe4bc[1197]](_0x5d2ax2),_0x5d2axa=this[_0xe4bc[1737]]();if(null!=_0x5d2ax2&&null!=_0x5d2ax9){var _0x5d2ax12=0,_0x5d2ax13=0,_0x5d2ax14=_0x5d2ax5[_0xe4bc[262]](_0x5d2ax9);_0x5d2ax3=_0x5d2axa?_0x5d2ax3:_0x5d2ax4;_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax9);null!=_0x5d2ax12&&(_0x5d2ax3-=_0x5d2axa?_0x5d2ax12[_0xe4bc[235]]:_0x5d2ax12[_0xe4bc[236]]);for(_0x5d2ax12=0;_0x5d2ax12<_0x5d2ax14;_0x5d2ax12++){if(_0x5d2ax4=_0x5d2ax5[_0xe4bc[263]](_0x5d2ax9,_0x5d2ax12),_0x5d2ax4!=_0x5d2ax2&&(_0x5d2ax4=_0x5d2ax5[_0xe4bc[1721]](_0x5d2ax4),null!=_0x5d2ax4)){_0x5d2ax4=_0x5d2axa?_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]/2:_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]/2;if(_0x5d2ax13<_0x5d2ax3&&_0x5d2ax4>_0x5d2ax3){break};_0x5d2ax13=_0x5d2ax4}};_0x5d2axa=_0x5d2ax9[_0xe4bc[1738]](_0x5d2ax2);_0x5d2axa=Math[_0xe4bc[160]](0,_0x5d2ax12-(_0x5d2ax12>_0x5d2axa?1:0));_0x5d2ax5[_0xe4bc[99]](_0x5d2ax9,_0x5d2ax2,_0x5d2axa)}};mxStackLayout[_0xe4bc[202]][_0xe4bc[1739]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[1721]](_0x5d2ax2);if(null!=this[_0xe4bc[1179]][_0xe4bc[526]]&&(null==_0x5d2ax4&&_0x5d2ax3[_0xe4bc[1740]](_0x5d2ax2)||_0x5d2ax2==this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[1741]])){_0x5d2ax4= new mxRectangle(0,0,this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[359]]-1,this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[167]]-1)};return _0x5d2ax4};mxStackLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1737]](),_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=this[_0xe4bc[1739]](_0x5d2ax2),_0x5d2ax9=0;null!=_0x5d2ax5&&(_0x5d2ax9=_0x5d2ax3?_0x5d2ax5[_0xe4bc[119]]:_0x5d2ax5[_0xe4bc[117]]);var _0x5d2ax9=_0x5d2ax9-(2*this[_0xe4bc[657]]+2*this[_0xe4bc[467]]),_0x5d2axa=this[_0xe4bc[1732]]+this[_0xe4bc[467]],_0x5d2ax12=this[_0xe4bc[1733]]+this[_0xe4bc[467]];if(this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax2)){var _0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1705]](_0x5d2ax2),_0x5d2ax14=mxUtils[_0xe4bc[433]](_0x5d2ax13,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE),_0x5d2ax13=mxUtils[_0xe4bc[433]](_0x5d2ax13,mxConstants.STYLE_HORIZONTAL,!0);_0x5d2ax3==_0x5d2ax13&&(_0x5d2ax9-=_0x5d2ax14);_0x5d2ax3?_0x5d2ax12+=_0x5d2ax14:_0x5d2axa+=_0x5d2ax14};_0x5d2ax4[_0xe4bc[473]]();try{for(var _0x5d2ax14=0,_0x5d2ax13=null,_0x5d2ax15=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax2),_0x5d2ax16=0;_0x5d2ax16<_0x5d2ax15;_0x5d2ax16++){var _0x5d2ax17=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax16);if(!this[_0xe4bc[1713]](_0x5d2ax17)&&this[_0xe4bc[1711]](_0x5d2ax17)){var _0x5d2ax18=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax17);if(null!=_0x5d2ax18){_0x5d2ax18=_0x5d2ax18[_0xe4bc[238]]();if(null!=this[_0xe4bc[1333]]&&null!=_0x5d2ax13&&(_0x5d2ax3&&_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]]+_0x5d2ax18[_0xe4bc[117]]+2*this[_0xe4bc[657]]>this[_0xe4bc[1333]]||!_0x5d2ax3&&_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax13[_0xe4bc[119]]+_0x5d2ax18[_0xe4bc[119]]+2*this[_0xe4bc[657]]>this[_0xe4bc[1333]])){_0x5d2ax13=null,_0x5d2ax3?_0x5d2ax12+=_0x5d2ax14+this[_0xe4bc[657]]:_0x5d2axa+=_0x5d2ax14+this[_0xe4bc[657]],_0x5d2ax14=0};_0x5d2ax14=Math[_0xe4bc[160]](_0x5d2ax14,_0x5d2ax3?_0x5d2ax18[_0xe4bc[119]]:_0x5d2ax18[_0xe4bc[117]]);null!=_0x5d2ax13?_0x5d2ax3?_0x5d2ax18[_0xe4bc[235]]=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]]+this[_0xe4bc[657]]:_0x5d2ax18[_0xe4bc[236]]=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax13[_0xe4bc[119]]+this[_0xe4bc[657]]:this[_0xe4bc[1734]]||(_0x5d2ax3?_0x5d2ax18[_0xe4bc[235]]=_0x5d2axa:_0x5d2ax18[_0xe4bc[236]]=_0x5d2ax12);_0x5d2ax3?_0x5d2ax18[_0xe4bc[236]]=_0x5d2ax12:_0x5d2ax18[_0xe4bc[235]]=_0x5d2axa;this[_0xe4bc[1334]]&&0<_0x5d2ax9&&(_0x5d2ax3?_0x5d2ax18[_0xe4bc[119]]=_0x5d2ax9:_0x5d2ax18[_0xe4bc[117]]=_0x5d2ax9);_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax17,_0x5d2ax18);_0x5d2ax13=_0x5d2ax18}}};this[_0xe4bc[1735]]&&null!=_0x5d2ax5&&null!=_0x5d2ax13&&!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax2)?(_0x5d2ax5=_0x5d2ax5[_0xe4bc[238]](),_0x5d2ax3?_0x5d2ax5[_0xe4bc[117]]=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]]+this[_0xe4bc[657]]:_0x5d2ax5[_0xe4bc[119]]=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax13[_0xe4bc[119]]+this[_0xe4bc[657]],_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax5)):this[_0xe4bc[1736]]&&(null!=_0x5d2ax5&&null!=_0x5d2ax13)&&(_0x5d2ax3?_0x5d2ax13[_0xe4bc[117]]=_0x5d2ax5[_0xe4bc[117]]-_0x5d2ax13[_0xe4bc[235]]-this[_0xe4bc[657]]:_0x5d2ax13[_0xe4bc[119]]=_0x5d2ax5[_0xe4bc[119]]-_0x5d2ax13[_0xe4bc[236]]-this[_0xe4bc[657]])}finally{_0x5d2ax4[_0xe4bc[476]]()}}};function mxPartitionLayout(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2);this[_0xe4bc[662]]=null!=_0x5d2ax3?_0x5d2ax3:!0;this[_0xe4bc[657]]=_0x5d2ax4||0;this[_0xe4bc[467]]=_0x5d2ax5||0}mxPartitionLayout[_0xe4bc[202]]= new mxGraphLayout;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[196]]=mxPartitionLayout;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[662]]=null;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[657]]=null;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[467]]=null;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[1743]]= !0;mxPartitionLayout[_0xe4bc[202]][_0xe4bc[1737]]=function(){return this[_0xe4bc[662]]};mxPartitionLayout[_0xe4bc[202]][_0xe4bc[1702]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]]();var _0x5d2ax5=_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax2);if(null!=_0x5d2ax2&&null!=_0x5d2ax5){for(var _0x5d2ax9=0,_0x5d2axa=0,_0x5d2ax12=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax5),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax12;_0x5d2ax9++){var _0x5d2ax13=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax5,_0x5d2ax9),_0x5d2ax13=this[_0xe4bc[1726]](_0x5d2ax13);if(null!=_0x5d2ax13){_0x5d2ax13=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]]/2;if(_0x5d2axa<_0x5d2ax3&&_0x5d2ax13>_0x5d2ax3){break};_0x5d2axa=_0x5d2ax13}};_0x5d2ax3=_0x5d2ax5[_0xe4bc[1738]](_0x5d2ax2);_0x5d2ax3=Math[_0xe4bc[160]](0,_0x5d2ax9-(_0x5d2ax9>_0x5d2ax3?1:0));_0x5d2ax4[_0xe4bc[99]](_0x5d2ax5,_0x5d2ax2,_0x5d2ax3)}};mxPartitionLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1737]](),_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax2);if(null!=this[_0xe4bc[1179]][_0xe4bc[526]]&&(null==_0x5d2ax5&&_0x5d2ax4[_0xe4bc[1740]](_0x5d2ax2)||_0x5d2ax2==this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[1741]])){_0x5d2ax5= new mxRectangle(0,0,this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[359]]-1,this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[167]]-1)};if(null!=_0x5d2ax5){for(var _0x5d2ax9=[],_0x5d2axa=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax2),_0x5d2ax12=0;_0x5d2ax12<_0x5d2axa;_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax12);!this[_0xe4bc[1713]](_0x5d2ax13)&&this[_0xe4bc[1711]](_0x5d2ax13)&&_0x5d2ax9[_0xe4bc[207]](_0x5d2ax13)};_0x5d2axa=_0x5d2ax9[_0xe4bc[67]];if(0<_0x5d2axa){var _0x5d2ax14=this[_0xe4bc[467]],_0x5d2ax15=this[_0xe4bc[467]],_0x5d2ax16=_0x5d2ax3?_0x5d2ax5[_0xe4bc[119]]:_0x5d2ax5[_0xe4bc[117]],_0x5d2ax16=_0x5d2ax16-2*this[_0xe4bc[467]];_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax2)?this[_0xe4bc[1179]][_0xe4bc[1731]](_0x5d2ax2): new mxRectangle;_0x5d2ax16-=_0x5d2ax3?_0x5d2ax2[_0xe4bc[119]]:_0x5d2ax2[_0xe4bc[117]];_0x5d2ax14+=_0x5d2ax2[_0xe4bc[117]];_0x5d2ax15+=_0x5d2ax2[_0xe4bc[119]];_0x5d2ax2=this[_0xe4bc[467]]+(_0x5d2axa-1)*this[_0xe4bc[657]];_0x5d2ax5=_0x5d2ax3?(_0x5d2ax5[_0xe4bc[117]]-_0x5d2ax14-_0x5d2ax2)/_0x5d2axa:(_0x5d2ax5[_0xe4bc[119]]-_0x5d2ax15-_0x5d2ax2)/_0x5d2axa;if(0<_0x5d2ax5){_0x5d2ax4[_0xe4bc[473]]();try{for(_0x5d2ax12=0;_0x5d2ax12<_0x5d2axa;_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax9[_0x5d2ax12],_0x5d2ax17=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax13);null!=_0x5d2ax17&&(_0x5d2ax17=_0x5d2ax17[_0xe4bc[238]](),_0x5d2ax17[_0xe4bc[235]]=_0x5d2ax14,_0x5d2ax17[_0xe4bc[236]]=_0x5d2ax15,_0x5d2ax3?(this[_0xe4bc[1743]]&&(_0x5d2ax17[_0xe4bc[117]]=_0x5d2ax5,_0x5d2ax17[_0xe4bc[119]]=_0x5d2ax16),_0x5d2ax14+=_0x5d2ax5+this[_0xe4bc[657]]):(this[_0xe4bc[1743]]&&(_0x5d2ax17[_0xe4bc[119]]=_0x5d2ax5,_0x5d2ax17[_0xe4bc[117]]=_0x5d2ax16),_0x5d2ax15+=_0x5d2ax5+this[_0xe4bc[657]]),_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax13,_0x5d2ax17))}}finally{_0x5d2ax4[_0xe4bc[476]]()}}}}};function mxCompactTreeLayout(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2);this[_0xe4bc[662]]=null!=_0x5d2ax3?_0x5d2ax3:!0;this[_0xe4bc[1744]]=null!=_0x5d2ax4?_0x5d2ax4:!1}mxCompactTreeLayout[_0xe4bc[202]]= new mxGraphLayout;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[196]]=mxCompactTreeLayout;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[662]]=null;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1744]]=null;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1735]]= !0;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1745]]=10;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1746]]=null;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1747]]= !1;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1748]]=10;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1749]]=20;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1750]]= !0;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1751]]=5;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1752]]=4;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1753]]=8;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1754]]=4;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1755]]= !0;mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1713]]=function(_0x5d2ax2){return mxGraphLayout[_0xe4bc[202]][_0xe4bc[1713]][_0xe4bc[183]](this,arguments)||0==this[_0xe4bc[1179]][_0xe4bc[1756]](_0x5d2ax2)[_0xe4bc[67]]};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1737]]=function(){return this[_0xe4bc[662]]};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1101]]=_0x5d2ax2;var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]]();if(null==_0x5d2ax3){if(0_0x5d2ax13[_0xe4bc[235]]&&(_0x5d2ax9=Math[_0xe4bc[425]](_0x5d2ax12-_0x5d2ax13[_0xe4bc[235]]));0>_0x5d2ax13[_0xe4bc[236]]&&(_0x5d2ax14=Math[_0xe4bc[425]](_0x5d2ax5-_0x5d2ax13[_0xe4bc[236]]));(0!=_0x5d2ax9||0!=_0x5d2ax14)&&this[_0xe4bc[1762]](_0x5d2axa,_0x5d2ax9,_0x5d2ax14);this[_0xe4bc[1735]]&&this[_0xe4bc[1763]]();this[_0xe4bc[1755]]&&this[_0xe4bc[1764]](_0x5d2axa)}}}finally{_0x5d2ax4[_0xe4bc[476]]()}}};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1762]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2[_0xe4bc[235]]+=_0x5d2ax3;_0x5d2ax2[_0xe4bc[236]]+=_0x5d2ax4;this[_0xe4bc[183]](_0x5d2ax2);for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[247]];null!=_0x5d2ax2;){this[_0xe4bc[1762]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4),_0x5d2ax2=_0x5d2ax2[_0xe4bc[1765]]}};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1758]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:[];var _0x5d2ax5=mxCellPath[_0xe4bc[385]](_0x5d2ax2),_0x5d2ax9=null;if(null!=_0x5d2ax2&&null==_0x5d2ax4[_0x5d2ax5]&&!this[_0xe4bc[1713]](_0x5d2ax2)){_0x5d2ax4[_0x5d2ax5]=_0x5d2ax2;var _0x5d2ax9=this[_0xe4bc[1766]](_0x5d2ax2),_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2axa=null;_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[264]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[1744]],!this[_0xe4bc[1744]],!1,!0);for(var _0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[249]](),_0x5d2ax13=0;_0x5d2ax13<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax13++){var _0x5d2ax14=_0x5d2ax2[_0x5d2ax13];if(!this[_0xe4bc[1715]](_0x5d2ax14)){this[_0xe4bc[1750]]&&this[_0xe4bc[1722]](_0x5d2ax14,null);this[_0xe4bc[1755]]&&(this[_0xe4bc[1716]](_0x5d2ax14,!1),this[_0xe4bc[1722]](_0x5d2ax14,null));var _0x5d2ax15=_0x5d2ax12[_0xe4bc[248]](_0x5d2ax14),_0x5d2ax14=null!=_0x5d2ax15?_0x5d2ax15[_0xe4bc[1710]](this[_0xe4bc[1744]]):_0x5d2ax12[_0xe4bc[1710]](_0x5d2ax14,this[_0xe4bc[1744]]),_0x5d2ax15=this[_0xe4bc[1758]](_0x5d2ax14,_0x5d2ax3,_0x5d2ax4);null!=_0x5d2ax15&&null!=_0x5d2ax5[_0xe4bc[1721]](_0x5d2ax14)&&(null==_0x5d2axa?_0x5d2ax9[_0xe4bc[247]]=_0x5d2ax15:_0x5d2axa[_0xe4bc[1765]]=_0x5d2ax15,_0x5d2axa=_0x5d2ax15)}}};return _0x5d2ax9};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1759]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){for(var _0x5d2ax3=_0x5d2ax2[_0xe4bc[247]];null!=_0x5d2ax3;){this[_0xe4bc[1759]](_0x5d2ax3),_0x5d2ax3=_0x5d2ax3[_0xe4bc[1765]]};null!=_0x5d2ax2[_0xe4bc[247]]?this[_0xe4bc[1767]](_0x5d2ax2,this[_0xe4bc[234]](_0x5d2ax2)):this[_0xe4bc[1768]](_0x5d2ax2)}};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1760]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax2[_0xe4bc[235]]+=_0x5d2ax3+_0x5d2ax2[_0xe4bc[1769]];_0x5d2ax2[_0xe4bc[236]]+=_0x5d2ax4+_0x5d2ax2[_0xe4bc[1770]];_0x5d2ax5=this[_0xe4bc[183]](_0x5d2ax2,_0x5d2ax5);_0x5d2ax3=_0x5d2ax2[_0xe4bc[247]];if(null!=_0x5d2ax3){_0x5d2ax5=this[_0xe4bc[1760]](_0x5d2ax3,_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]],_0x5d2ax5);_0x5d2ax4=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[1770]];for(var _0x5d2ax9=_0x5d2ax3[_0xe4bc[1765]];null!=_0x5d2ax9;){_0x5d2ax5=this[_0xe4bc[1760]](_0x5d2ax9,_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[1769]],_0x5d2ax4,_0x5d2ax5),_0x5d2ax4+=_0x5d2ax9[_0xe4bc[1770]],_0x5d2ax9=_0x5d2ax9[_0xe4bc[1765]]}};return _0x5d2ax5};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1761]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2[_0xe4bc[235]]+=_0x5d2ax4+_0x5d2ax2[_0xe4bc[1770]];_0x5d2ax2[_0xe4bc[236]]+=_0x5d2ax5+_0x5d2ax2[_0xe4bc[1769]];_0x5d2ax9=this[_0xe4bc[183]](_0x5d2ax2,_0x5d2ax9);_0x5d2ax3=_0x5d2ax2[_0xe4bc[247]];if(null!=_0x5d2ax3){_0x5d2ax9=this[_0xe4bc[1761]](_0x5d2ax3,_0x5d2ax2,_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]],_0x5d2ax9);_0x5d2ax4=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[1770]];for(_0x5d2ax5=_0x5d2ax3[_0xe4bc[1765]];null!=_0x5d2ax5;){_0x5d2ax9=this[_0xe4bc[1761]](_0x5d2ax5,_0x5d2ax2,_0x5d2ax4,_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[1769]],_0x5d2ax9),_0x5d2ax4+=_0x5d2ax5[_0xe4bc[1770]],_0x5d2ax5=_0x5d2ax5[_0xe4bc[1765]]}};return _0x5d2ax9};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1767]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1749]]+this[_0xe4bc[1748]],_0x5d2ax5=(_0x5d2ax3-_0x5d2ax2[_0xe4bc[117]])/2-this[_0xe4bc[1749]],_0x5d2ax9=_0x5d2ax5+_0x5d2ax2[_0xe4bc[117]]+2*this[_0xe4bc[1749]]-_0x5d2ax3;_0x5d2ax2[_0xe4bc[247]][_0xe4bc[1769]]=_0x5d2ax4+_0x5d2ax2[_0xe4bc[119]];_0x5d2ax2[_0xe4bc[247]][_0xe4bc[1770]]=_0x5d2ax9;_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1771]]=this[_0xe4bc[1773]](_0x5d2ax2[_0xe4bc[119]],0,this[_0xe4bc[1773]](_0x5d2ax4,_0x5d2ax9,_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1771]]));_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1774]]=this[_0xe4bc[1773]](_0x5d2ax2[_0xe4bc[119]],0,this[_0xe4bc[1773]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1774]]))};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1768]]=function(_0x5d2ax2){var _0x5d2ax3=2*this[_0xe4bc[1749]];_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1775]]=this[_0xe4bc[1773]](_0x5d2ax2[_0xe4bc[119]]+_0x5d2ax3,0);_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1771]]=_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1775]];_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1776]]=this[_0xe4bc[1773]](0,-_0x5d2ax2[_0xe4bc[117]]-_0x5d2ax3);_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1774]]=this[_0xe4bc[1773]](_0x5d2ax2[_0xe4bc[119]]+_0x5d2ax3,0,_0x5d2ax2[_0xe4bc[1772]][_0xe4bc[1776]])};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[234]]=function(_0x5d2ax2){var _0x5d2ax3=2*this[_0xe4bc[1749]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[247]];_0x5d2ax2[_0xe4bc[1772]]=_0x5d2ax4[_0xe4bc[1772]];for(var _0x5d2ax5=_0x5d2ax4[_0xe4bc[117]]+_0x5d2ax3,_0x5d2ax9=_0x5d2ax5,_0x5d2ax4=_0x5d2ax4[_0xe4bc[1765]];null!=_0x5d2ax4;){var _0x5d2axa=this[_0xe4bc[1777]](_0x5d2ax2[_0xe4bc[1772]],_0x5d2ax4[_0xe4bc[1772]]);_0x5d2ax4[_0xe4bc[1770]]=_0x5d2axa+_0x5d2ax5;_0x5d2ax4[_0xe4bc[1769]]=0;_0x5d2ax5=_0x5d2ax4[_0xe4bc[117]]+_0x5d2ax3;_0x5d2ax9+=_0x5d2axa+_0x5d2ax5;_0x5d2ax4=_0x5d2ax4[_0xe4bc[1765]]};return _0x5d2ax9};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1777]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=0,_0x5d2ax5=0,_0x5d2ax9=0,_0x5d2axa=_0x5d2ax2[_0xe4bc[1774]],_0x5d2ax12=_0x5d2ax3[_0xe4bc[1771]];null!=_0x5d2ax12&&null!=_0x5d2axa;){var _0x5d2ax13=this[_0xe4bc[1368]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax12[_0xe4bc[1126]],_0x5d2ax12[_0xe4bc[1125]],_0x5d2axa[_0xe4bc[1126]],_0x5d2axa[_0xe4bc[1125]]),_0x5d2ax5=_0x5d2ax5+_0x5d2ax13,_0x5d2ax9=_0x5d2ax9+_0x5d2ax13;_0x5d2ax4+_0x5d2ax12[_0xe4bc[1126]]<=_0x5d2axa[_0xe4bc[1126]]?(_0x5d2ax4+=_0x5d2ax12[_0xe4bc[1126]],_0x5d2ax5+=_0x5d2ax12[_0xe4bc[1125]],_0x5d2ax12=_0x5d2ax12[_0xe4bc[1765]]):(_0x5d2ax4-=_0x5d2axa[_0xe4bc[1126]],_0x5d2ax5-=_0x5d2axa[_0xe4bc[1125]],_0x5d2axa=_0x5d2axa[_0xe4bc[1765]])};null!=_0x5d2ax12?(_0x5d2ax4=this[_0xe4bc[1778]](_0x5d2ax2[_0xe4bc[1775]],0,0,_0x5d2ax12,_0x5d2ax4,_0x5d2ax5),_0x5d2ax2[_0xe4bc[1775]]=null!=_0x5d2ax4[_0xe4bc[1765]]?_0x5d2ax3[_0xe4bc[1775]]:_0x5d2ax4,_0x5d2ax2[_0xe4bc[1776]]=_0x5d2ax3[_0xe4bc[1776]]):(_0x5d2ax4=this[_0xe4bc[1778]](_0x5d2ax3[_0xe4bc[1776]],_0x5d2ax4,_0x5d2ax5,_0x5d2axa,0,0),null==_0x5d2ax4[_0xe4bc[1765]]&&(_0x5d2ax2[_0xe4bc[1776]]=_0x5d2ax4));_0x5d2ax2[_0xe4bc[1774]]=_0x5d2ax3[_0xe4bc[1774]];return _0x5d2ax9};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1368]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){var _0x5d2ax12=0;if(_0x5d2ax9<=_0x5d2ax2||0>=_0x5d2ax2+_0x5d2ax4){return 0};_0x5d2ax12=0<_0x5d2ax9*_0x5d2ax5-_0x5d2ax4*_0x5d2axa?0>_0x5d2ax2?_0x5d2ax2*_0x5d2ax5/_0x5d2ax4-_0x5d2ax3:0<_0x5d2ax2?_0x5d2ax2*_0x5d2axa/_0x5d2ax9-_0x5d2ax3:-_0x5d2ax3:_0x5d2ax9<_0x5d2ax2+_0x5d2ax4?_0x5d2axa-(_0x5d2ax3+(_0x5d2ax9-_0x5d2ax2)*_0x5d2ax5/_0x5d2ax4):_0x5d2ax9>_0x5d2ax2+_0x5d2ax4?(_0x5d2ax4+_0x5d2ax2)*_0x5d2axa/_0x5d2ax9-(_0x5d2ax3+_0x5d2ax5):_0x5d2axa-(_0x5d2ax3+_0x5d2ax5);return 0<_0x5d2ax12?_0x5d2ax12:0};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1778]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax3=_0x5d2ax9+_0x5d2ax5[_0xe4bc[1126]]-_0x5d2ax3;_0x5d2ax9=_0x5d2ax9=0;0==_0x5d2ax5[_0xe4bc[1126]]?_0x5d2ax9=_0x5d2ax5[_0xe4bc[1125]]:(_0x5d2ax9=_0x5d2ax3*_0x5d2ax5[_0xe4bc[1125]],_0x5d2ax9/=_0x5d2ax5[_0xe4bc[1126]]);_0x5d2ax3=this[_0xe4bc[1773]](_0x5d2ax3,_0x5d2ax9,_0x5d2ax5[_0xe4bc[1765]]);_0x5d2ax2[_0xe4bc[1765]]=this[_0xe4bc[1773]](0,_0x5d2axa+_0x5d2ax5[_0xe4bc[1125]]-_0x5d2ax9-_0x5d2ax4,_0x5d2ax3);return _0x5d2ax3};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1766]]=function(_0x5d2ax2){var _0x5d2ax3={};_0x5d2ax3[_0xe4bc[246]]=_0x5d2ax2;_0x5d2ax3[_0xe4bc[235]]=0;_0x5d2ax3[_0xe4bc[236]]=0;_0x5d2ax3[_0xe4bc[117]]=0;_0x5d2ax3[_0xe4bc[119]]=0;_0x5d2ax2=this[_0xe4bc[1726]](_0x5d2ax2);null!=_0x5d2ax2&&(this[_0xe4bc[1737]]()?(_0x5d2ax3[_0xe4bc[117]]=_0x5d2ax2[_0xe4bc[119]],_0x5d2ax3[_0xe4bc[119]]=_0x5d2ax2[_0xe4bc[117]]):(_0x5d2ax3[_0xe4bc[117]]=_0x5d2ax2[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]]=_0x5d2ax2[_0xe4bc[119]]));_0x5d2ax3[_0xe4bc[1769]]=0;_0x5d2ax3[_0xe4bc[1770]]=0;_0x5d2ax3[_0xe4bc[1772]]={};return _0x5d2ax3};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[183]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=_0x5d2ax2[_0xe4bc[246]],_0x5d2ax9=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax5);null!=_0x5d2ax5&&null!=_0x5d2ax9&&(this[_0xe4bc[1711]](_0x5d2ax5)&&(_0x5d2ax9=this[_0xe4bc[1725]](_0x5d2ax5,_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]]),this[_0xe4bc[1735]]&&(_0x5d2ax4=_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax5),_0x5d2ax5=mxCellPath[_0xe4bc[385]](_0x5d2ax4),null==this[_0xe4bc[1746]][_0x5d2ax5]&&(this[_0xe4bc[1746]][_0x5d2ax5]=_0x5d2ax4))),_0x5d2ax3=null==_0x5d2ax3? new mxRectangle(_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]]): new mxRectangle(Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[235]]),Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[236]]),Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax9[_0xe4bc[117]]),Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]],_0x5d2ax9[_0xe4bc[236]]+_0x5d2ax9[_0xe4bc[119]])));return _0x5d2ax3};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1773]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5={};_0x5d2ax5[_0xe4bc[1126]]=_0x5d2ax2;_0x5d2ax5[_0xe4bc[1125]]=_0x5d2ax3;_0x5d2ax5[_0xe4bc[1765]]=_0x5d2ax4;return _0x5d2ax5};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1763]]=function(){var _0x5d2ax2=[],_0x5d2ax3;for(_0x5d2ax3 in this[_0xe4bc[1746]]){_0x5d2ax2[_0xe4bc[207]](this[_0xe4bc[1746]][_0x5d2ax3])};this[_0xe4bc[1727]](mxUtils[_0xe4bc[1779]](_0x5d2ax2,!0),this[_0xe4bc[1745]])};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1764]]=function(_0x5d2ax2){this[_0xe4bc[1780]](_0x5d2ax2);for(_0x5d2ax2=_0x5d2ax2[_0xe4bc[247]];null!=_0x5d2ax2;){this[_0xe4bc[1764]](_0x5d2ax2),_0x5d2ax2=_0x5d2ax2[_0xe4bc[1765]]}};mxCompactTreeLayout[_0xe4bc[202]][_0xe4bc[1780]]=function(_0x5d2ax2){for(var _0x5d2ax3=_0x5d2ax2[_0xe4bc[247]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[246]],_0x5d2ax5=0,_0x5d2ax9=[];null!=_0x5d2ax3;){_0x5d2ax5++;var _0x5d2axa=_0x5d2ax3[_0xe4bc[235]];this[_0xe4bc[662]]&&(_0x5d2axa=_0x5d2ax3[_0xe4bc[236]]);_0x5d2ax9[_0xe4bc[207]]( new WeightedCellSorter(_0x5d2ax3,_0x5d2axa));_0x5d2ax3=_0x5d2ax3[_0xe4bc[1765]]};_0x5d2ax9[_0xe4bc[470]](WeightedCellSorter[_0xe4bc[202]][_0xe4bc[469]]);var _0x5d2axa=_0x5d2ax2[_0xe4bc[117]],_0x5d2ax12=(_0x5d2ax5+1)*this[_0xe4bc[1751]];_0x5d2axa>_0x5d2ax12+2*this[_0xe4bc[1751]]&&(_0x5d2axa-=2*this[_0xe4bc[1751]]);_0x5d2ax2=_0x5d2axa/_0x5d2ax5;_0x5d2ax3=_0x5d2ax2/2;_0x5d2axa>_0x5d2ax12+2*this[_0xe4bc[1751]]&&(_0x5d2ax3+=this[_0xe4bc[1751]]);for(var _0x5d2axa=this[_0xe4bc[1753]]-this[_0xe4bc[1752]],_0x5d2ax12=0,_0x5d2ax13=this[_0xe4bc[1726]](_0x5d2ax4),_0x5d2ax14=0;_0x5d2ax14<_0x5d2ax9[_0xe4bc[67]];_0x5d2ax14++){for(var _0x5d2ax15=_0x5d2ax9[_0x5d2ax14][_0xe4bc[246]][_0xe4bc[246]],_0x5d2ax16=this[_0xe4bc[1726]](_0x5d2ax15),_0x5d2ax15=this[_0xe4bc[1179]][_0xe4bc[1781]](_0x5d2ax4,_0x5d2ax15,!1),_0x5d2ax17=[],_0x5d2ax18=0,_0x5d2ax19=0,_0x5d2ax1a=0;_0x5d2ax1a<_0x5d2ax15[_0xe4bc[67]];_0x5d2ax1a++){this[_0xe4bc[662]]?(_0x5d2ax18=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]],_0x5d2ax19=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax3,_0x5d2ax17[_0xe4bc[207]]( new mxPoint(_0x5d2ax18,_0x5d2ax19)),_0x5d2ax18=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax13[_0xe4bc[117]]+_0x5d2axa,_0x5d2ax17[_0xe4bc[207]]( new mxPoint(_0x5d2ax18,_0x5d2ax19)),_0x5d2ax19=_0x5d2ax16[_0xe4bc[236]]+_0x5d2ax16[_0xe4bc[119]]/2):(_0x5d2ax18=_0x5d2ax13[_0xe4bc[235]]+_0x5d2ax3,_0x5d2ax19=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax13[_0xe4bc[119]],_0x5d2ax17[_0xe4bc[207]]( new mxPoint(_0x5d2ax18,_0x5d2ax19)),_0x5d2ax19=_0x5d2ax13[_0xe4bc[236]]+_0x5d2ax13[_0xe4bc[119]]+_0x5d2axa,_0x5d2ax17[_0xe4bc[207]]( new mxPoint(_0x5d2ax18,_0x5d2ax19)),_0x5d2ax18=_0x5d2ax16[_0xe4bc[235]]+_0x5d2ax16[_0xe4bc[117]]/2),_0x5d2ax17[_0xe4bc[207]]( new mxPoint(_0x5d2ax18,_0x5d2ax19)),this[_0xe4bc[1722]](_0x5d2ax15[_0x5d2ax1a],_0x5d2ax17)};_0x5d2ax14<_0x5d2ax5/2?_0x5d2axa+=this[_0xe4bc[1752]]:_0x5d2ax14>_0x5d2ax5/2&&(_0x5d2axa-=this[_0xe4bc[1752]]);_0x5d2ax3+=_0x5d2ax2;_0x5d2ax12=Math[_0xe4bc[160]](_0x5d2ax12,_0x5d2axa)}};function WeightedCellSorter(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[246]]=_0x5d2ax2;this[_0xe4bc[1782]]=_0x5d2ax3}WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1782]]=0;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1783]]= !1;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1784]]= !1;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1785]]=null;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[246]]=null;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[469]]=function(_0x5d2ax2,_0x5d2ax3){return null!=_0x5d2ax2&&null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[1782]]>_0x5d2ax2[_0xe4bc[1782]]?1:_0x5d2ax3[_0xe4bc[1782]]<_0x5d2ax2[_0xe4bc[1782]]?-1:_0x5d2ax3[_0xe4bc[1783]]?1:-1:0};function mxFastOrganicLayout(_0x5d2ax2){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2)}mxFastOrganicLayout[_0xe4bc[202]]= new mxGraphLayout;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[196]]=mxFastOrganicLayout;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1786]]= !0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1750]]= !0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1787]]= !0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1788]]=50;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1789]]=0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1790]]=2;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1791]]=500;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1792]]=4;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1793]]=200;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1794]]=0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1795]]=0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1796]]=0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1797]]= !0;mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1713]]=function(_0x5d2ax2){return mxGraphLayout[_0xe4bc[202]][_0xe4bc[1713]][_0xe4bc[183]](this,arguments)||0==this[_0xe4bc[1179]][_0xe4bc[1756]](_0x5d2ax2)[_0xe4bc[67]]};mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]]();this[_0xe4bc[1798]]=[];for(var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[1728]](_0x5d2ax2),_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){this[_0xe4bc[1713]](_0x5d2ax4[_0x5d2ax5])||this[_0xe4bc[1798]][_0xe4bc[207]](_0x5d2ax4[_0x5d2ax5])};var _0x5d2ax9=this[_0xe4bc[1786]]?this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[1799]](this[_0xe4bc[1798]]):null,_0x5d2axa=this[_0xe4bc[1798]][_0xe4bc[67]];this[_0xe4bc[1800]]=[];this[_0xe4bc[1801]]=[];this[_0xe4bc[1802]]=[];this[_0xe4bc[1803]]=[];this[_0xe4bc[1804]]=[];this[_0xe4bc[1805]]=[];this[_0xe4bc[1806]]=[];this[_0xe4bc[1807]]=[];0.0010>this[_0xe4bc[1788]]&&(this[_0xe4bc[1788]]=0.0010);this[_0xe4bc[1789]]=this[_0xe4bc[1788]]*this[_0xe4bc[1788]];for(_0x5d2ax5=0;_0x5d2ax5_0x5d2ax3&&(_0x5d2ax3=0.0010);var _0x5d2ax4=this[_0xe4bc[1801]][_0x5d2ax2]/_0x5d2ax3*Math[_0xe4bc[243]](_0x5d2ax3,this[_0xe4bc[1794]]),_0x5d2ax3=this[_0xe4bc[1802]][_0x5d2ax2]/_0x5d2ax3*Math[_0xe4bc[243]](_0x5d2ax3,this[_0xe4bc[1794]]);this[_0xe4bc[1801]][_0x5d2ax2]=0;this[_0xe4bc[1802]][_0x5d2ax2]=0;this[_0xe4bc[1803]][_0x5d2ax2][0]+=_0x5d2ax4;this[_0xe4bc[1803]][_0x5d2ax2][1]+=_0x5d2ax3}}};mxFastOrganicLayout[_0xe4bc[202]][_0xe4bc[1811]]=function(){for(var _0x5d2ax2=0;_0x5d2ax2this[_0xe4bc[1791]]||(_0x5d2ax12_0x5d2ax2?_0x5d2ax2+_0xe4bc[213]+_0x5d2ax5:_0x5d2ax5+_0xe4bc[213]+_0x5d2ax2):null};mxParallelEdgeLayout[_0xe4bc[202]][_0xe4bc[1759]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[0],_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax4[_0xe4bc[1709]](_0x5d2ax3,!0)),_0x5d2ax9=_0x5d2ax4[_0xe4bc[1721]](_0x5d2ax4[_0xe4bc[1709]](_0x5d2ax3,!1));if(_0x5d2ax5==_0x5d2ax9){for(var _0x5d2ax3=_0x5d2ax5[_0xe4bc[235]]+_0x5d2ax5[_0xe4bc[117]]+this[_0xe4bc[657]],_0x5d2ax4=_0x5d2ax5[_0xe4bc[236]]+_0x5d2ax5[_0xe4bc[119]]/2,_0x5d2axa=0;_0x5d2axa<_0x5d2ax2[_0xe4bc[67]];_0x5d2axa++){this[_0xe4bc[1820]](_0x5d2ax2[_0x5d2axa],_0x5d2ax3,_0x5d2ax4),_0x5d2ax3+=this[_0xe4bc[657]]}}else {if(null!=_0x5d2ax5&&null!=_0x5d2ax9){for(var _0x5d2ax3=_0x5d2ax5[_0xe4bc[235]]+_0x5d2ax5[_0xe4bc[117]]/2,_0x5d2ax4=_0x5d2ax5[_0xe4bc[236]]+_0x5d2ax5[_0xe4bc[119]]/2,_0x5d2axa=_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax9[_0xe4bc[117]]/2-_0x5d2ax3,_0x5d2ax12=_0x5d2ax9[_0xe4bc[236]]+_0x5d2ax9[_0xe4bc[119]]/2-_0x5d2ax4,_0x5d2ax9=Math[_0xe4bc[428]](_0x5d2axa*_0x5d2axa+_0x5d2ax12*_0x5d2ax12),_0x5d2ax5=_0x5d2ax12*this[_0xe4bc[657]]/_0x5d2ax9,_0x5d2ax9=_0x5d2axa*this[_0xe4bc[657]]/_0x5d2ax9,_0x5d2ax3=_0x5d2ax3+_0x5d2axa/2+_0x5d2ax5*(_0x5d2ax2[_0xe4bc[67]]-1)/2,_0x5d2ax4=_0x5d2ax4+_0x5d2ax12/2-_0x5d2ax9*(_0x5d2ax2[_0xe4bc[67]]-1)/2,_0x5d2axa=0;_0x5d2axa<_0x5d2ax2[_0xe4bc[67]];_0x5d2axa++){this[_0xe4bc[1820]](_0x5d2ax2[_0x5d2axa],_0x5d2ax3,_0x5d2ax4),_0x5d2ax3-=_0x5d2ax5,_0x5d2ax4+=_0x5d2ax9}}}};mxParallelEdgeLayout[_0xe4bc[202]][_0xe4bc[1820]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[1179]][_0xe4bc[1712]](_0x5d2ax2)&&this[_0xe4bc[1722]](_0x5d2ax2,[ new mxPoint(_0x5d2ax3,_0x5d2ax4)])};function mxCompositeLayout(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2);this[_0xe4bc[1821]]=_0x5d2ax3;this[_0xe4bc[1822]]=_0x5d2ax4}mxCompositeLayout[_0xe4bc[202]]= new mxGraphLayout;mxCompositeLayout[_0xe4bc[202]][_0xe4bc[196]]=mxCompositeLayout;mxCompositeLayout[_0xe4bc[202]][_0xe4bc[1821]]=null;mxCompositeLayout[_0xe4bc[202]][_0xe4bc[1822]]=null;mxCompositeLayout[_0xe4bc[202]][_0xe4bc[1702]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){null!=this[_0xe4bc[1822]]?this[_0xe4bc[1822]][_0xe4bc[582]][_0xe4bc[183]](this[_0xe4bc[1822]],arguments):this[_0xe4bc[1821]][0][_0xe4bc[582]][_0xe4bc[183]](this[_0xe4bc[1821]][0],arguments)};mxCompositeLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]]();_0x5d2ax3[_0xe4bc[473]]();try{for(var _0x5d2ax4=0;_0x5d2ax4mxUtils[_0xe4bc[2]](_0x5d2ax14[_0xe4bc[1837]],_0x5d2ax12)&&_0x5d2ax14[_0xe4bc[1837]][_0xe4bc[207]](_0x5d2ax12))}};_0x5d2ax4[_0x5d2ax5][_0xe4bc[1826]][0]=1}}mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1827]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1846]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1847]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1850]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1845]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1101]]=null;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1851]]=0;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1848]]=1E8;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1844]]= !1;mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1849]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[1703]](),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax4[_0x5d2ax9]= new mxGraphHierarchyNode(_0x5d2ax3[_0x5d2ax9]);var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0x5d2ax9]);this[_0xe4bc[1846]][_0x5d2axa]=_0x5d2ax4[_0x5d2ax9];_0x5d2axa=_0x5d2ax2[_0xe4bc[264]](_0x5d2ax3[_0x5d2ax9]);_0x5d2ax4[_0x5d2ax9][_0xe4bc[1838]]=[];for(var _0x5d2ax12=0;_0x5d2ax12<_0x5d2axa[_0xe4bc[67]];_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax2[_0xe4bc[1710]](_0x5d2axa[_0x5d2ax12],!1);if(_0x5d2ax13!=_0x5d2ax3[_0x5d2ax9]&&_0x5d2ax13!=_0x5d2ax3[_0x5d2ax9]&&_0x5d2ax2[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1193]](_0x5d2ax13)&&!_0x5d2ax2[_0xe4bc[1713]](_0x5d2ax13)){var _0x5d2ax14=_0x5d2ax2[_0xe4bc[1781]](_0x5d2ax3[_0x5d2ax9],_0x5d2ax13,!1),_0x5d2ax15=_0x5d2ax2[_0xe4bc[1781]](_0x5d2ax3[_0x5d2ax9],_0x5d2ax13,!0),_0x5d2ax13=mxCellPath[_0xe4bc[385]](_0x5d2ax14[0]);if(null!=_0x5d2ax14&&0<_0x5d2ax14[_0xe4bc[67]]&&null==this[_0xe4bc[1847]][_0x5d2ax13]&&2*_0x5d2ax15[_0xe4bc[67]]>=_0x5d2ax14[_0xe4bc[67]]){for(var _0x5d2ax15= new mxGraphHierarchyEdge(_0x5d2ax14),_0x5d2ax16=0;_0x5d2ax16<_0x5d2ax14[_0xe4bc[67]];_0x5d2ax16++){var _0x5d2ax17=_0x5d2ax14[_0x5d2ax16],_0x5d2ax13=mxCellPath[_0xe4bc[385]](_0x5d2ax17);this[_0xe4bc[1847]][_0x5d2ax13]=_0x5d2ax15;_0x5d2ax5[_0xe4bc[1809]](_0x5d2ax17);_0x5d2ax2[_0xe4bc[1787]]&&(_0x5d2ax2[_0xe4bc[1716]](_0x5d2ax17,!1),_0x5d2ax2[_0xe4bc[1718]](_0x5d2ax17,!0))};_0x5d2ax15[_0xe4bc[1097]]=_0x5d2ax4[_0x5d2ax9];0>mxUtils[_0xe4bc[2]](_0x5d2ax4[_0x5d2ax9][_0xe4bc[1838]],_0x5d2ax15)&&_0x5d2ax4[_0x5d2ax9][_0xe4bc[1838]][_0xe4bc[207]](_0x5d2ax15)}}};_0x5d2ax4[_0x5d2ax9][_0xe4bc[1826]][0]=0}};mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1852]]=function(){var _0x5d2ax2=[];if(null!=this[_0xe4bc[1845]]){for(var _0x5d2ax3=0;_0x5d2ax3_0x5d2ax4[_0xe4bc[1827]]&&0>_0x5d2ax4[_0xe4bc[1828]])&&(_0x5d2ax2[_0x5d2ax4[_0xe4bc[1826]][0]][_0xe4bc[207]](_0x5d2ax4),_0x5d2ax4[_0xe4bc[1827]]=_0x5d2ax4[_0xe4bc[1826]][0],_0x5d2ax4[_0xe4bc[1828]]=_0x5d2ax4[_0xe4bc[1826]][0],_0x5d2ax4[_0xe4bc[1826]][0]=_0x5d2ax2[_0x5d2ax4[_0xe4bc[1827]]][_0xe4bc[67]]-1);if(null!=_0x5d2ax3&&null!=_0x5d2ax5&&1<_0x5d2ax3[_0xe4bc[1827]]-_0x5d2ax4[_0xe4bc[1827]]){_0x5d2ax5[_0xe4bc[1827]]=_0x5d2ax3[_0xe4bc[1827]];_0x5d2ax5[_0xe4bc[1828]]=_0x5d2ax4[_0xe4bc[1827]];_0x5d2ax5[_0xe4bc[1826]]=[];_0x5d2ax5[_0xe4bc[235]]=[];_0x5d2ax5[_0xe4bc[236]]=[];for(_0x5d2ax3=_0x5d2ax5[_0xe4bc[1828]]+1;_0x5d2ax3<_0x5d2ax5[_0xe4bc[1827]];_0x5d2ax3++){_0x5d2ax2[_0x5d2ax3][_0xe4bc[207]](_0x5d2ax5),_0x5d2ax5[_0xe4bc[1834]](_0x5d2ax3,_0x5d2ax2[_0x5d2ax3][_0xe4bc[67]]-1)}}},_0x5d2ax4,!1,null)};mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[209]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax3){for(var _0x5d2ax9=0;_0x5d2ax9<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax9++){var _0x5d2axa=_0x5d2ax3[_0x5d2ax9];null!=_0x5d2axa&&(null==_0x5d2ax5&&(_0x5d2ax5={}),_0x5d2ax4?(_0x5d2axa[_0xe4bc[1839]]=[],_0x5d2axa[_0xe4bc[1839]][0]=this[_0xe4bc[1851]],_0x5d2axa[_0xe4bc[1839]][1]=_0x5d2ax9,this[_0xe4bc[1855]](null,_0x5d2axa,null,_0x5d2ax2,_0x5d2ax5,_0x5d2axa[_0xe4bc[1839]],_0x5d2ax9,0)):this[_0xe4bc[1758]](null,_0x5d2axa,null,_0x5d2ax2,_0x5d2ax5,0))};this[_0xe4bc[1851]]++}};mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1758]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){if(null!=_0x5d2ax3){var _0x5d2ax12=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]);if(null==_0x5d2ax9[_0x5d2ax12]){_0x5d2ax9[_0x5d2ax12]=_0x5d2ax3;_0x5d2ax5(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2axa,0);_0x5d2ax2=_0x5d2ax3[_0xe4bc[1838]][_0xe4bc[1853]]();for(_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){_0x5d2ax12=_0x5d2ax2[_0x5d2ax4],this[_0xe4bc[1758]](_0x5d2ax3,_0x5d2ax12[_0xe4bc[772]],_0x5d2ax12,_0x5d2ax5,_0x5d2ax9,_0x5d2axa+1)}}else {_0x5d2ax5(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2axa,1)}}};mxGraphHierarchyModel[_0xe4bc[202]][_0xe4bc[1855]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13){if(null!=_0x5d2ax3){if(null!=_0x5d2ax2&&(null==_0x5d2ax3[_0xe4bc[1839]]||_0x5d2ax3[_0xe4bc[1839]][0]!=_0x5d2ax2[_0xe4bc[1839]][0])){_0x5d2axa=_0x5d2ax2[_0xe4bc[1839]][_0xe4bc[67]]+1,_0x5d2ax3[_0xe4bc[1839]]=_0x5d2ax2[_0xe4bc[1839]][_0xe4bc[1853]](),_0x5d2ax3[_0xe4bc[1839]][_0x5d2axa-1]=_0x5d2ax12};_0x5d2ax12=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]);if(null==_0x5d2ax9[_0x5d2ax12]){_0x5d2ax9[_0x5d2ax12]=_0x5d2ax3;_0x5d2ax5(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax13,0);_0x5d2ax2=_0x5d2ax3[_0xe4bc[1838]][_0xe4bc[1853]]();for(_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){_0x5d2ax12=_0x5d2ax2[_0x5d2ax4],this[_0xe4bc[1855]](_0x5d2ax3,_0x5d2ax12[_0xe4bc[772]],_0x5d2ax12,_0x5d2ax5,_0x5d2ax9,_0x5d2ax3[_0xe4bc[1839]],_0x5d2ax4,_0x5d2ax13+1)}}else {_0x5d2ax5(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax13,1)}}};function mxHierarchicalLayoutStage(){}mxHierarchicalLayoutStage[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){};function mxMedianHybridCrossingReduction(_0x5d2ax2){this[_0xe4bc[1759]]=_0x5d2ax2}mxMedianHybridCrossingReduction[_0xe4bc[202]]= new mxHierarchicalLayoutStage;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[196]]=mxMedianHybridCrossingReduction;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1759]]=null;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1795]]=24;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1856]]=null;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1857]]=0;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1858]]=0;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1859]]=2;mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){_0x5d2ax2=this[_0xe4bc[1759]][_0xe4bc[502]]();this[_0xe4bc[1856]]=[];for(var _0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[1850]][_0xe4bc[67]];_0x5d2ax3++){this[_0xe4bc[1856]][_0x5d2ax3]=_0x5d2ax2[_0xe4bc[1850]][_0x5d2ax3][_0xe4bc[1853]]()};for(var _0x5d2ax4=0,_0x5d2ax5=this[_0xe4bc[1860]](_0x5d2ax2),_0x5d2ax3=0;_0x5d2ax3_0x5d2ax5++;){for(var _0x5d2ax9=1==_0x5d2ax2%2&&1==_0x5d2ax5%2,_0x5d2ax4=!1,_0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[1850]][_0xe4bc[67]];_0x5d2axa++){for(var _0x5d2ax12=_0x5d2ax3[_0xe4bc[1850]][_0x5d2axa],_0x5d2ax13=[],_0x5d2ax14=0;_0x5d2ax14<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax14++){var _0x5d2ax15=_0x5d2ax12[_0x5d2ax14],_0x5d2ax16=_0x5d2ax15[_0xe4bc[1833]](_0x5d2axa);0>_0x5d2ax16&&(_0x5d2ax16=_0x5d2ax14);_0x5d2ax13[_0x5d2ax16]=_0x5d2ax15};for(var _0x5d2ax17=_0x5d2ax16=_0x5d2ax15=null,_0x5d2ax18=null,_0x5d2ax19=null,_0x5d2ax1a=null,_0x5d2ax1b=null,_0x5d2ax1c=null,_0x5d2ax1d=null,_0x5d2ax1e=null,_0x5d2ax14=0;_0x5d2ax14<_0x5d2ax12[_0xe4bc[67]]-1;_0x5d2ax14++){if(0==_0x5d2ax14){for(var _0x5d2ax1d=_0x5d2ax13[_0x5d2ax14],_0x5d2ax15=_0x5d2ax1d[_0xe4bc[1831]](_0x5d2axa),_0x5d2ax16=_0x5d2ax1d[_0xe4bc[1832]](_0x5d2axa),_0x5d2ax19=[],_0x5d2ax1a=[],_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax15[_0xe4bc[67]];_0x5d2ax1f++){_0x5d2ax19[_0x5d2ax1f]=_0x5d2ax15[_0x5d2ax1f][_0xe4bc[1833]](_0x5d2axa+1)};for(_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax16[_0xe4bc[67]];_0x5d2ax1f++){_0x5d2ax1a[_0x5d2ax1f]=_0x5d2ax16[_0x5d2ax1f][_0xe4bc[1833]](_0x5d2axa-1)}}else {_0x5d2ax15=_0x5d2ax17,_0x5d2ax16=_0x5d2ax18,_0x5d2ax19=_0x5d2ax1b,_0x5d2ax1a=_0x5d2ax1c,_0x5d2ax1d=_0x5d2ax1e};_0x5d2ax1e=_0x5d2ax13[_0x5d2ax14+1];_0x5d2ax17=_0x5d2ax1e[_0xe4bc[1831]](_0x5d2axa);_0x5d2ax18=_0x5d2ax1e[_0xe4bc[1832]](_0x5d2axa);_0x5d2ax1b=[];_0x5d2ax1c=[];for(_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax17[_0xe4bc[67]];_0x5d2ax1f++){_0x5d2ax1b[_0x5d2ax1f]=_0x5d2ax17[_0x5d2ax1f][_0xe4bc[1833]](_0x5d2axa+1)};for(_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax18[_0xe4bc[67]];_0x5d2ax1f++){_0x5d2ax1c[_0x5d2ax1f]=_0x5d2ax18[_0x5d2ax1f][_0xe4bc[1833]](_0x5d2axa-1)};for(var _0x5d2ax20=0,_0x5d2ax62=0,_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax19[_0xe4bc[67]];_0x5d2ax1f++){for(var _0x5d2ax63=0;_0x5d2ax63<_0x5d2ax1b[_0xe4bc[67]];_0x5d2ax63++){_0x5d2ax19[_0x5d2ax1f]>_0x5d2ax1b[_0x5d2ax63]&&_0x5d2ax20++,_0x5d2ax19[_0x5d2ax1f]<_0x5d2ax1b[_0x5d2ax63]&&_0x5d2ax62++}};for(_0x5d2ax1f=0;_0x5d2ax1f<_0x5d2ax1a[_0xe4bc[67]];_0x5d2ax1f++){for(_0x5d2ax63=0;_0x5d2ax63<_0x5d2ax1c[_0xe4bc[67]];_0x5d2ax63++){_0x5d2ax1a[_0x5d2ax1f]>_0x5d2ax1c[_0x5d2ax63]&&_0x5d2ax20++,_0x5d2ax1a[_0x5d2ax1f]<_0x5d2ax1c[_0x5d2ax63]&&_0x5d2ax62++}};if(_0x5d2ax62<_0x5d2ax20||_0x5d2ax62==_0x5d2ax20&&_0x5d2ax9){_0x5d2ax17=_0x5d2ax1d[_0xe4bc[1833]](_0x5d2axa),_0x5d2ax1d[_0xe4bc[1834]](_0x5d2axa,_0x5d2ax1e[_0xe4bc[1833]](_0x5d2axa)),_0x5d2ax1e[_0xe4bc[1834]](_0x5d2axa,_0x5d2ax17),_0x5d2ax17=_0x5d2ax15,_0x5d2ax18=_0x5d2ax16,_0x5d2ax1b=_0x5d2ax19,_0x5d2ax1c=_0x5d2ax1a,_0x5d2ax1e=_0x5d2ax1d,_0x5d2ax9||(_0x5d2ax4= !0)}}}}};mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1861]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=0==_0x5d2ax2%2;if(_0x5d2ax4){for(var _0x5d2ax5=_0x5d2ax3[_0xe4bc[1827]]-1;0<=_0x5d2ax5;_0x5d2ax5--){this[_0xe4bc[1864]](_0x5d2ax5,_0x5d2ax4)}}else {for(_0x5d2ax5=1;_0x5d2ax5<_0x5d2ax3[_0xe4bc[1827]];_0x5d2ax5++){this[_0xe4bc[1864]](_0x5d2ax5,_0x5d2ax4)}}};mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1864]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=this[_0xe4bc[1856]][_0x5d2ax2][_0xe4bc[67]],_0x5d2ax5=[],_0x5d2ax9=[],_0x5d2axa=0;_0x5d2axa<_0x5d2ax4;_0x5d2axa++){var _0x5d2ax12=this[_0xe4bc[1856]][_0x5d2ax2][_0x5d2axa],_0x5d2ax13= new MedianCellSorter;_0x5d2ax13[_0xe4bc[246]]=_0x5d2ax12;var _0x5d2ax14;_0x5d2ax14=_0x5d2ax3?_0x5d2ax12[_0xe4bc[1831]](_0x5d2ax2):_0x5d2ax12[_0xe4bc[1832]](_0x5d2ax2);var _0x5d2ax15;_0x5d2ax15=_0x5d2ax3?_0x5d2ax2+1:_0x5d2ax2-1;null!=_0x5d2ax14&&0!=_0x5d2ax14[_0xe4bc[67]]?(_0x5d2ax13[_0xe4bc[1865]]=this[_0xe4bc[1865]](_0x5d2ax14,_0x5d2ax15),_0x5d2ax5[_0xe4bc[207]](_0x5d2ax13)):_0x5d2ax9[_0x5d2ax12[_0xe4bc[1833]](_0x5d2ax2)]= !0};_0x5d2ax5[_0xe4bc[470]](MedianCellSorter[_0xe4bc[202]][_0xe4bc[469]]);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax4;_0x5d2axa++){null==_0x5d2ax9[_0x5d2axa]&&(_0x5d2ax12=_0x5d2ax5[_0xe4bc[1115]]()[_0xe4bc[246]],_0x5d2ax12[_0xe4bc[1834]](_0x5d2ax2,_0x5d2axa))}};mxMedianHybridCrossingReduction[_0xe4bc[202]][_0xe4bc[1865]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=[],_0x5d2ax5=0,_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax9++){var _0x5d2axa=_0x5d2ax2[_0x5d2ax9];_0x5d2ax4[_0x5d2ax5++]=_0x5d2axa[_0xe4bc[1833]](_0x5d2ax3)};_0x5d2ax4[_0xe4bc[470]](function(_0x5d2ax2,_0x5d2ax3){return _0x5d2ax2-_0x5d2ax3});if(1==_0x5d2ax5%2){return _0x5d2ax4[Math[_0xe4bc[519]](_0x5d2ax5/2)]};if(2==_0x5d2ax5){return (_0x5d2ax4[0]+_0x5d2ax4[1])/2};_0x5d2ax9=_0x5d2ax5/2;_0x5d2axa=_0x5d2ax4[_0x5d2ax9-1]-_0x5d2ax4[0];_0x5d2ax5=_0x5d2ax4[_0x5d2ax5-1]-_0x5d2ax4[_0x5d2ax9];return (_0x5d2ax4[_0x5d2ax9-1]*_0x5d2ax5+_0x5d2ax4[_0x5d2ax9]*_0x5d2axa)/(_0x5d2axa+_0x5d2ax5)};function MedianCellSorter(){}MedianCellSorter[_0xe4bc[202]][_0xe4bc[1865]]=0;MedianCellSorter[_0xe4bc[202]][_0xe4bc[246]]= !1;MedianCellSorter[_0xe4bc[202]][_0xe4bc[469]]=function(_0x5d2ax2,_0x5d2ax3){return null!=_0x5d2ax2&&null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[1865]]>_0x5d2ax2[_0xe4bc[1865]]?-1:_0x5d2ax3[_0xe4bc[1865]]<_0x5d2ax2[_0xe4bc[1865]]?1:0:0};function mxMinimumCycleRemover(_0x5d2ax2){this[_0xe4bc[1759]]=_0x5d2ax2}mxMinimumCycleRemover[_0xe4bc[202]]= new mxHierarchicalLayoutStage;mxMinimumCycleRemover[_0xe4bc[202]][_0xe4bc[196]]=mxMinimumCycleRemover;mxMinimumCycleRemover[_0xe4bc[202]][_0xe4bc[1759]]=null;mxMinimumCycleRemover[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1759]][_0xe4bc[502]](),_0x5d2ax4={},_0x5d2ax5=mxUtils[_0xe4bc[238]](_0x5d2ax3[_0xe4bc[1846]],null,!0),_0x5d2ax9=null;if(null!=_0x5d2ax3[_0xe4bc[1845]]){var _0x5d2axa=_0x5d2ax3[_0xe4bc[1845]],_0x5d2ax9=[];for(_0x5d2ax2=0;_0x5d2ax2<_0x5d2axa[_0xe4bc[67]];_0x5d2ax2++){var _0x5d2ax12=mxCellPath[_0xe4bc[385]](_0x5d2axa[_0x5d2ax2]);_0x5d2ax9[_0x5d2ax2]=_0x5d2ax3[_0xe4bc[1846]][_0x5d2ax12]}};_0x5d2ax3[_0xe4bc[209]](function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax9,_0x5d2axa,_0x5d2ax12){_0x5d2ax3[_0xe4bc[1720]](_0x5d2ax2)&&(_0x5d2ax9[_0xe4bc[1744]](),mxUtils[_0xe4bc[205]](_0x5d2ax9,_0x5d2ax2[_0xe4bc[1838]]),_0x5d2ax2[_0xe4bc[1837]][_0xe4bc[207]](_0x5d2ax9),mxUtils[_0xe4bc[205]](_0x5d2ax9,_0x5d2ax3[_0xe4bc[1837]]),_0x5d2ax3[_0xe4bc[1838]][_0xe4bc[207]](_0x5d2ax9));_0x5d2ax2=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]);_0x5d2ax4[_0x5d2ax2]=_0x5d2ax3;delete _0x5d2ax5[_0x5d2ax2]},_0x5d2ax9,!0,null);_0x5d2ax9=null;0<_0x5d2ax5[_0xe4bc[1866]]&&(_0x5d2ax9=mxUtils[_0xe4bc[238]](_0x5d2ax5,null,!0));_0x5d2ax2=mxUtils[_0xe4bc[238]](_0x5d2ax4,null,!0);_0x5d2ax3[_0xe4bc[209]](function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax9,_0x5d2axa,_0x5d2ax12){_0x5d2ax3[_0xe4bc[1720]](_0x5d2ax2)&&(_0x5d2ax9[_0xe4bc[1744]](),mxUtils[_0xe4bc[205]](_0x5d2ax9,_0x5d2ax2[_0xe4bc[1838]]),_0x5d2ax3[_0xe4bc[1838]][_0xe4bc[207]](_0x5d2ax9),_0x5d2ax2[_0xe4bc[1837]][_0xe4bc[207]](_0x5d2ax9),mxUtils[_0xe4bc[205]](_0x5d2ax9,_0x5d2ax3[_0xe4bc[1837]]));_0x5d2ax2=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]);_0x5d2ax4[_0x5d2ax2]=_0x5d2ax3;delete _0x5d2ax5[_0x5d2ax2]},_0x5d2ax5,!0,_0x5d2ax2);_0x5d2axa=this[_0xe4bc[1759]][_0xe4bc[1703]]();if(null!=_0x5d2ax9&&0<_0x5d2ax9[_0xe4bc[67]]){_0x5d2ax3=_0x5d2ax3[_0xe4bc[1845]];for(_0x5d2ax2=0;_0x5d2ax2<_0x5d2ax9[_0xe4bc[67]];_0x5d2ax2++){_0x5d2ax12=_0x5d2ax9[_0x5d2ax2][_0xe4bc[246]],0==_0x5d2axa[_0xe4bc[1867]](_0x5d2ax12)[_0xe4bc[67]]&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax12)}}};function mxCoordinateAssignment(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){this[_0xe4bc[1759]]=_0x5d2ax2;this[_0xe4bc[1868]]=_0x5d2ax3;this[_0xe4bc[1869]]=_0x5d2ax4;this[_0xe4bc[1870]]=_0x5d2ax5;this[_0xe4bc[1871]]=_0x5d2ax9;this[_0xe4bc[1872]]=_0x5d2axa}var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};mxCoordinateAssignment[_0xe4bc[202]]= new mxHierarchicalLayoutStage;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[196]]=mxCoordinateAssignment;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1759]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1868]]=30;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1869]]=100;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1872]]=10;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1795]]=8;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1751]]=5;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1752]]=2;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1753]]=12;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1754]]=4;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1873]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1870]]=mxConstants[_0xe4bc[1358]];mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1871]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1874]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1875]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1876]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1877]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1878]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1879]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1880]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1881]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1882]]= !0;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[675]]=mxHierarchicalEdgeStyle[_0xe4bc[1883]];mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1884]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1885]]=null;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1745]]=10;mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1886]]=function(){var _0x5d2ax2=this[_0xe4bc[1759]][_0xe4bc[502]]();mxLog[_0xe4bc[539]]();mxLog[_0xe4bc[171]](_0xe4bc[1887]);for(var _0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[1850]][_0xe4bc[67]];_0x5d2ax3++){mxLog[_0xe4bc[53]](_0xe4bc[1888],_0x5d2ax3,_0xe4bc[1889]);for(var _0x5d2ax4=_0x5d2ax2[_0xe4bc[1850]][_0x5d2ax3],_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){mxLog[_0xe4bc[53]](_0x5d2ax4[_0x5d2ax5][_0xe4bc[1833]](_0x5d2ax3),_0xe4bc[316])};mxLog[_0xe4bc[171]]()};mxLog[_0xe4bc[171]](_0xe4bc[1890])};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2){this[_0xe4bc[1873]]=[];_0x5d2ax2=this[_0xe4bc[1759]][_0xe4bc[502]]();this[_0xe4bc[1875]]=0;this[_0xe4bc[1891]](this[_0xe4bc[1759]][_0xe4bc[1703]](),_0x5d2ax2);this[_0xe4bc[1882]]&&this[_0xe4bc[1892]](_0x5d2ax2);var _0x5d2ax3=1E8;if(this[_0xe4bc[1882]]){for(var _0x5d2ax4=0;_0x5d2ax4_0x5d2ax1c+1&&(_0x5d2ax15==_0x5d2ax5[_0x5d2ax14][_0xe4bc[67]]-1?(_0x5d2ax9[_0xe4bc[1834]](_0x5d2ax14,_0x5d2ax1d),_0x5d2ax17= !0):(_0x5d2ax15=_0x5d2ax5[_0x5d2ax14][_0x5d2ax15+1],_0x5d2ax1c=_0x5d2ax15[_0xe4bc[1833]](_0x5d2ax14),_0x5d2ax1c=_0x5d2ax1c-_0x5d2ax15[_0xe4bc[117]]/2-this[_0xe4bc[1868]]-_0x5d2ax9[_0xe4bc[117]]/2,_0x5d2ax1c>_0x5d2ax1d?(_0x5d2ax9[_0xe4bc[1834]](_0x5d2ax14,_0x5d2ax1d),_0x5d2ax17= !0):_0x5d2ax1c>_0x5d2ax9[_0xe4bc[1833]](_0x5d2ax14)+1&&(_0x5d2ax9[_0xe4bc[1834]](_0x5d2ax14,_0x5d2ax1c),_0x5d2ax17= !0)));if(_0x5d2ax17){for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax14=_0x5d2ax12[_0x5d2ax9],_0x5d2ax14=mxCellPath[_0xe4bc[385]](_0x5d2ax14[_0xe4bc[1841]]()),_0x5d2ax14=_0x5d2ax4[_0x5d2ax14],null!=_0x5d2ax14&&!1==_0x5d2ax14[_0xe4bc[1784]]&&(_0x5d2ax14[_0xe4bc[1784]]= !0,_0x5d2ax3[_0xe4bc[207]](_0x5d2ax14))};for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax16[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax14=_0x5d2ax16[_0x5d2ax9],_0x5d2ax14=mxCellPath[_0xe4bc[385]](_0x5d2ax14[_0xe4bc[1841]]()),_0x5d2ax14=_0x5d2ax4[_0x5d2ax14],null!=_0x5d2ax14&&!1==_0x5d2ax14[_0xe4bc[1784]]&&(_0x5d2ax14[_0xe4bc[1784]]= !0,_0x5d2ax3[_0xe4bc[207]](_0x5d2ax14))}};_0x5d2ax13[_0xe4bc[1784]]= !1;_0x5d2axa++}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1893]]=function(_0x5d2ax2,_0x5d2ax3){if(0==_0x5d2ax2%2){for(var _0x5d2ax4=_0x5d2ax3[_0xe4bc[1827]];0<_0x5d2ax4;_0x5d2ax4--){this[_0xe4bc[1897]](_0x5d2ax4-1,_0x5d2ax3,_0x5d2ax4)}}else {for(_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3[_0xe4bc[1827]]-1;_0x5d2ax4++){this[_0xe4bc[1897]](_0x5d2ax4+1,_0x5d2ax3,_0x5d2ax4)}}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1897]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3=_0x5d2ax3[_0xe4bc[1850]][_0x5d2ax2];for(var _0x5d2ax5=[],_0x5d2ax9=[],_0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[67]];_0x5d2axa++){var _0x5d2ax12=_0x5d2ax3[_0x5d2axa];_0x5d2ax5[_0x5d2axa]= new WeightedCellSorter;_0x5d2ax5[_0x5d2axa][_0xe4bc[246]]=_0x5d2ax12;_0x5d2ax5[_0x5d2axa][_0xe4bc[1785]]=_0x5d2axa;var _0x5d2ax13=mxCellPath[_0xe4bc[385]](_0x5d2ax12[_0xe4bc[1841]]());_0x5d2ax9[_0x5d2ax13]=_0x5d2ax5[_0x5d2axa];var _0x5d2ax14=null,_0x5d2ax14=_0x5d2ax4<_0x5d2ax2?_0x5d2ax12[_0xe4bc[1832]](_0x5d2ax2):_0x5d2ax12[_0xe4bc[1831]](_0x5d2ax2);_0x5d2ax5[_0x5d2axa][_0xe4bc[1782]]=this[_0xe4bc[1898]](_0x5d2ax12,_0x5d2ax14)};_0x5d2ax5[_0xe4bc[470]](WeightedCellSorter[_0xe4bc[202]][_0xe4bc[469]]);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax5[_0xe4bc[67]];_0x5d2axa++){_0x5d2ax13=0;_0x5d2ax12=_0x5d2ax5[_0x5d2axa][_0xe4bc[246]];_0x5d2ax13=0;_0x5d2ax14=_0x5d2ax4<_0x5d2ax2?_0x5d2ax12[_0xe4bc[1832]](_0x5d2ax2)[_0xe4bc[1853]]():_0x5d2ax12[_0xe4bc[1831]](_0x5d2ax2)[_0xe4bc[1853]]();null!=_0x5d2ax14&&(_0x5d2ax13=_0x5d2ax14[_0xe4bc[67]],_0x5d2ax13=0<_0x5d2ax13?this[_0xe4bc[1896]](_0x5d2ax14,_0x5d2ax4):_0x5d2ax12[_0xe4bc[1833]](_0x5d2ax2));for(var _0x5d2ax15=0,_0x5d2ax14=-1E8,_0x5d2ax16=_0x5d2ax5[_0x5d2axa][_0xe4bc[1785]]-1;0<=_0x5d2ax16;){var _0x5d2ax17=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0x5d2ax16][_0xe4bc[1841]]()),_0x5d2ax17=_0x5d2ax9[_0x5d2ax17];if(null!=_0x5d2ax17){var _0x5d2ax18=_0x5d2ax17[_0xe4bc[246]];_0x5d2ax17[_0xe4bc[1784]]?(_0x5d2ax14=_0x5d2ax18[_0xe4bc[1833]](_0x5d2ax2)+_0x5d2ax18[_0xe4bc[117]]/2+this[_0xe4bc[1868]]+_0x5d2ax15+_0x5d2ax12[_0xe4bc[117]]/2,_0x5d2ax16= -1):(_0x5d2ax15+=_0x5d2ax18[_0xe4bc[117]]+this[_0xe4bc[1868]],_0x5d2ax16--)}};_0x5d2ax15=0;_0x5d2ax18=1E8;for(_0x5d2ax16=_0x5d2ax5[_0x5d2axa][_0xe4bc[1785]]+1;_0x5d2ax16<_0x5d2ax5[_0xe4bc[67]];){if(_0x5d2ax17=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0x5d2ax16][_0xe4bc[1841]]()),_0x5d2ax17=_0x5d2ax9[_0x5d2ax17],null!=_0x5d2ax17){var _0x5d2ax19=_0x5d2ax17[_0xe4bc[246]];_0x5d2ax17[_0xe4bc[1784]]?(_0x5d2ax18=_0x5d2ax19[_0xe4bc[1833]](_0x5d2ax2)-_0x5d2ax19[_0xe4bc[117]]/2-this[_0xe4bc[1868]]-_0x5d2ax15-_0x5d2ax12[_0xe4bc[117]]/2,_0x5d2ax16=_0x5d2ax5[_0xe4bc[67]]):(_0x5d2ax15+=_0x5d2ax19[_0xe4bc[117]]+this[_0xe4bc[1868]],_0x5d2ax16++)}};_0x5d2ax13>=_0x5d2ax14&&_0x5d2ax13<=_0x5d2ax18?_0x5d2ax12[_0xe4bc[1834]](_0x5d2ax2,_0x5d2ax13):_0x5d2ax13<_0x5d2ax14?(_0x5d2ax12[_0xe4bc[1834]](_0x5d2ax2,_0x5d2ax14),this[_0xe4bc[1875]]+=_0x5d2ax14-_0x5d2ax13):_0x5d2ax13>_0x5d2ax18&&(_0x5d2ax12[_0xe4bc[1834]](_0x5d2ax2,_0x5d2ax18),this[_0xe4bc[1875]]+=_0x5d2ax13-_0x5d2ax18);_0x5d2ax5[_0x5d2axa][_0xe4bc[1784]]= !0}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1898]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=0,_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax5++){var _0x5d2ax9=_0x5d2ax3[_0x5d2ax5];_0x5d2ax2[_0xe4bc[1193]]()&&_0x5d2ax9[_0xe4bc[1193]]()?_0x5d2ax4++:_0x5d2ax4=_0x5d2ax2[_0xe4bc[250]]()&&_0x5d2ax9[_0xe4bc[250]]()?_0x5d2ax4+8:_0x5d2ax4+2};return _0x5d2ax4};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1896]]=function(_0x5d2ax2,_0x5d2ax3){if(0==_0x5d2ax2[_0xe4bc[67]]){return 0};for(var _0x5d2ax4=[],_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax5++){_0x5d2ax4[_0x5d2ax5]=_0x5d2ax2[_0x5d2ax5][_0xe4bc[1833]](_0x5d2ax3)};_0x5d2ax4[_0xe4bc[470]](function(_0x5d2ax2,_0x5d2ax3){return _0x5d2ax2-_0x5d2ax3});if(1==_0x5d2ax2[_0xe4bc[67]]%2){return _0x5d2ax4[Math[_0xe4bc[519]](_0x5d2ax2[_0xe4bc[67]]/2)]};_0x5d2ax5=_0x5d2ax2[_0xe4bc[67]]/2;return (_0x5d2ax4[_0x5d2ax5-1]+_0x5d2ax4[_0x5d2ax5])/2};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1891]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1899]](_0x5d2ax2,_0x5d2ax3);for(var _0x5d2ax4=this[_0xe4bc[1876]];0<=_0x5d2ax4;_0x5d2ax4--){_0x5d2ax4<_0x5d2ax3[_0xe4bc[1827]]&&this[_0xe4bc[1900]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax3)};for(_0x5d2ax4=this[_0xe4bc[1876]]+1;_0x5d2ax4<=_0x5d2ax3[_0xe4bc[1827]];_0x5d2ax4++){0<_0x5d2ax4&&this[_0xe4bc[1900]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax3)}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1900]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3=_0x5d2ax4[_0xe4bc[1850]][_0x5d2ax2];_0x5d2ax4=0;for(var _0x5d2ax5=this[_0xe4bc[1871]]+(this[_0xe4bc[1879]]-this[_0xe4bc[1880]][_0x5d2ax2])/2,_0x5d2ax9=!1,_0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[67]];_0x5d2axa++){var _0x5d2ax12=_0x5d2ax3[_0x5d2axa];if(_0x5d2ax12[_0xe4bc[1193]]()){var _0x5d2ax13=this[_0xe4bc[1759]][_0xe4bc[1726]](_0x5d2ax12[_0xe4bc[246]]);null!=_0x5d2ax13?this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?(_0x5d2ax12[_0xe4bc[117]]=_0x5d2ax13[_0xe4bc[117]],_0x5d2ax12[_0xe4bc[119]]=_0x5d2ax13[_0xe4bc[119]]):(_0x5d2ax12[_0xe4bc[117]]=_0x5d2ax13[_0xe4bc[119]],_0x5d2ax12[_0xe4bc[119]]=_0x5d2ax13[_0xe4bc[117]]):_0x5d2ax9= !0;_0x5d2ax4=Math[_0xe4bc[160]](_0x5d2ax4,_0x5d2ax12[_0xe4bc[119]])}else {_0x5d2ax12[_0xe4bc[250]]()&&(_0x5d2ax13=1,null!=_0x5d2ax12[_0xe4bc[1842]]?_0x5d2ax13=_0x5d2ax12[_0xe4bc[1842]][_0xe4bc[67]]:mxLog[_0xe4bc[283]](_0xe4bc[1901]),_0x5d2ax12[_0xe4bc[117]]=(_0x5d2ax13-1)*this[_0xe4bc[1872]])};_0x5d2ax5+=_0x5d2ax12[_0xe4bc[117]]/2;_0x5d2ax12[_0xe4bc[1835]](_0x5d2ax2,_0x5d2ax5);_0x5d2ax12[_0xe4bc[1834]](_0x5d2ax2,_0x5d2ax5);_0x5d2ax5+=_0x5d2ax12[_0xe4bc[117]]/2;_0x5d2ax5+=this[_0xe4bc[1868]]};!0==_0x5d2ax9&&mxLog[_0xe4bc[283]](_0xe4bc[1902])};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1899]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=-this[_0xe4bc[1869]],_0x5d2ax5=0;this[_0xe4bc[1880]]=[];this[_0xe4bc[1881]]=[];for(var _0x5d2ax9=_0x5d2ax3[_0xe4bc[1827]];0<=_0x5d2ax9;_0x5d2ax9--){for(var _0x5d2axa=0,_0x5d2ax12=_0x5d2ax3[_0xe4bc[1850]][_0x5d2ax9],_0x5d2ax13=this[_0xe4bc[1871]],_0x5d2ax14=!1,_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax15++){var _0x5d2ax16=_0x5d2ax12[_0x5d2ax15];if(_0x5d2ax16[_0xe4bc[1193]]()){var _0x5d2ax17=this[_0xe4bc[1759]][_0xe4bc[1726]](_0x5d2ax16[_0xe4bc[246]]);null!=_0x5d2ax17?this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?(_0x5d2ax16[_0xe4bc[117]]=_0x5d2ax17[_0xe4bc[117]],_0x5d2ax16[_0xe4bc[119]]=_0x5d2ax17[_0xe4bc[119]]):(_0x5d2ax16[_0xe4bc[117]]=_0x5d2ax17[_0xe4bc[119]],_0x5d2ax16[_0xe4bc[119]]=_0x5d2ax17[_0xe4bc[117]]):_0x5d2ax14= !0;_0x5d2axa=Math[_0xe4bc[160]](_0x5d2axa,_0x5d2ax16[_0xe4bc[119]])}else {_0x5d2ax16[_0xe4bc[250]]()&&(_0x5d2ax17=1,null!=_0x5d2ax16[_0xe4bc[1842]]?_0x5d2ax17=_0x5d2ax16[_0xe4bc[1842]][_0xe4bc[67]]:mxLog[_0xe4bc[283]](_0xe4bc[1901]),_0x5d2ax16[_0xe4bc[117]]=(_0x5d2ax17-1)*this[_0xe4bc[1872]])};_0x5d2ax13+=_0x5d2ax16[_0xe4bc[117]]/2;_0x5d2ax16[_0xe4bc[1835]](_0x5d2ax9,_0x5d2ax13);_0x5d2ax16[_0xe4bc[1834]](_0x5d2ax9,_0x5d2ax13);_0x5d2ax13+=_0x5d2ax16[_0xe4bc[117]]/2;_0x5d2ax13+=this[_0xe4bc[1868]];_0x5d2ax13>this[_0xe4bc[1879]]&&(this[_0xe4bc[1879]]=_0x5d2ax13,this[_0xe4bc[1876]]=_0x5d2ax9);this[_0xe4bc[1880]][_0x5d2ax9]=_0x5d2ax13};!0==_0x5d2ax14&&mxLog[_0xe4bc[283]](_0xe4bc[1902]);this[_0xe4bc[1881]][_0x5d2ax9]=_0x5d2ax4;_0x5d2ax13=_0x5d2axa/2+_0x5d2ax5/2+this[_0xe4bc[1869]];_0x5d2ax5=_0x5d2axa;_0x5d2ax4=this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1359]]?_0x5d2ax4+_0x5d2ax13:_0x5d2ax4-_0x5d2ax13;for(_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax15++){_0x5d2ax12[_0x5d2ax15][_0xe4bc[1836]](_0x5d2ax9,_0x5d2ax4)}}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1894]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[1847]],_0x5d2ax5;for(_0x5d2ax5 in _0x5d2ax4){var _0x5d2ax9=_0x5d2ax4[_0x5d2ax5];if(!(1>_0x5d2ax9[_0xe4bc[1827]]-_0x5d2ax9[_0xe4bc[1828]]-1)){for(var _0x5d2axa=_0x5d2ax9[_0xe4bc[1833]](_0x5d2ax9[_0xe4bc[1828]]+1),_0x5d2ax12=!0,_0x5d2ax13=0,_0x5d2ax14=_0x5d2ax9[_0xe4bc[1828]]+2;_0x5d2ax14<_0x5d2ax9[_0xe4bc[1827]];_0x5d2ax14++){var _0x5d2ax15=_0x5d2ax9[_0xe4bc[1833]](_0x5d2ax14);_0x5d2axa!=_0x5d2ax15?(_0x5d2ax12= !1,_0x5d2axa=_0x5d2ax15):_0x5d2ax13++};if(!_0x5d2ax12){for(var _0x5d2ax12=_0x5d2axa=0,_0x5d2ax15=[],_0x5d2ax16=[],_0x5d2ax17=_0x5d2ax9[_0xe4bc[1833]](_0x5d2ax9[_0xe4bc[1828]]+1),_0x5d2ax14=_0x5d2ax9[_0xe4bc[1828]]+1;_0x5d2ax14<_0x5d2ax9[_0xe4bc[1827]]-1;_0x5d2ax14++){var _0x5d2ax18=_0x5d2ax9[_0xe4bc[730]](_0x5d2ax14+1);_0x5d2ax17==_0x5d2ax18?(_0x5d2ax15[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-1]=_0x5d2ax17,_0x5d2axa++):this[_0xe4bc[1903]](_0x5d2ax3,_0x5d2ax9,_0x5d2ax14+1,_0x5d2ax17)?(_0x5d2ax15[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-1]=_0x5d2ax17,_0x5d2axa++):_0x5d2ax17=_0x5d2ax15[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-1]=_0x5d2ax18};_0x5d2ax17=_0x5d2ax9[_0xe4bc[730]](_0x5d2ax14);for(_0x5d2ax14=_0x5d2ax9[_0xe4bc[1827]]-1;_0x5d2ax14>_0x5d2ax9[_0xe4bc[1828]]+1;_0x5d2ax14--){_0x5d2ax18=_0x5d2ax9[_0xe4bc[730]](_0x5d2ax14-1),_0x5d2ax17==_0x5d2ax18?(_0x5d2ax16[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-2]=_0x5d2ax17,_0x5d2ax12++):this[_0xe4bc[1903]](_0x5d2ax3,_0x5d2ax9,_0x5d2ax14-1,_0x5d2ax17)?(_0x5d2ax16[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-2]=_0x5d2ax17,_0x5d2ax12++):(_0x5d2ax16[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-2]=_0x5d2ax9[_0xe4bc[730]](_0x5d2ax14-1),_0x5d2ax17=_0x5d2ax18)};if(_0x5d2ax12>_0x5d2ax13||_0x5d2axa>_0x5d2ax13){if(_0x5d2ax12>=_0x5d2axa){for(_0x5d2ax14=_0x5d2ax9[_0xe4bc[1827]]-2;_0x5d2ax14>_0x5d2ax9[_0xe4bc[1828]];_0x5d2ax14--){_0x5d2ax9[_0xe4bc[1835]](_0x5d2ax14,_0x5d2ax16[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-1])}}else {if(_0x5d2axa>_0x5d2ax12){for(_0x5d2ax14=_0x5d2ax9[_0xe4bc[1828]]+2;_0x5d2ax14<_0x5d2ax9[_0xe4bc[1827]];_0x5d2ax14++){_0x5d2ax9[_0xe4bc[1835]](_0x5d2ax14,_0x5d2ax15[_0x5d2ax14-_0x5d2ax9[_0xe4bc[1828]]-2])}}}}}}}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1903]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax2=_0x5d2ax2[_0xe4bc[1850]][_0x5d2ax4];for(var _0x5d2ax9=-1,_0x5d2axa=0;_0x5d2axa<_0x5d2ax2[_0xe4bc[67]];_0x5d2axa++){if(_0x5d2ax3==_0x5d2ax2[_0x5d2axa]){_0x5d2ax9=_0x5d2axa;break}};if(0>_0x5d2ax9){return !1};_0x5d2axa=_0x5d2ax3[_0xe4bc[1833]](_0x5d2ax4);if(_0x5d2ax5<_0x5d2axa){if(0==_0x5d2ax9){return !0};_0x5d2ax2=_0x5d2ax2[_0x5d2ax9-1];_0x5d2ax4=_0x5d2ax2[_0xe4bc[1833]](_0x5d2ax4);_0x5d2ax4=_0x5d2ax4+_0x5d2ax2[_0xe4bc[117]]/2+this[_0xe4bc[1868]]+_0x5d2ax3[_0xe4bc[117]]/2;if(!(_0x5d2ax4<=_0x5d2ax5)){return !1}}else {if(_0x5d2ax5>_0x5d2axa){if(_0x5d2ax9==_0x5d2ax2[_0xe4bc[67]]-1){return !0};_0x5d2ax2=_0x5d2ax2[_0x5d2ax9+1];_0x5d2ax4=_0x5d2ax2[_0xe4bc[1833]](_0x5d2ax4);_0x5d2ax4=_0x5d2ax4-_0x5d2ax2[_0xe4bc[117]]/2-this[_0xe4bc[1868]]-_0x5d2ax3[_0xe4bc[117]]/2;if(!(_0x5d2ax4>=_0x5d2ax5)){return !1}}};return !0};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1895]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1877]]=[];this[_0xe4bc[1878]]=[];for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3[_0xe4bc[1850]][_0xe4bc[67]];_0x5d2ax4++){this[_0xe4bc[1877]][_0x5d2ax4]=Number[_0xe4bc[1904]],this[_0xe4bc[1878]][_0x5d2ax4]=0};_0x5d2ax4=null;this[_0xe4bc[1759]][_0xe4bc[1735]]&&(_0x5d2ax4={});var _0x5d2ax5=_0x5d2ax3[_0xe4bc[1847]],_0x5d2ax9=_0x5d2ax3[_0xe4bc[1846]],_0x5d2axa;for(_0x5d2axa in _0x5d2ax9){var _0x5d2ax12=_0x5d2ax9[_0x5d2axa];this[_0xe4bc[1725]](_0x5d2ax12);if(this[_0xe4bc[1759]][_0xe4bc[1735]]){var _0x5d2ax12=_0x5d2ax2[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax12[_0xe4bc[246]]),_0x5d2ax13=mxCellPath[_0xe4bc[385]](_0x5d2ax12);null==_0x5d2ax4[_0x5d2ax13]&&(_0x5d2ax4[_0x5d2ax13]=_0x5d2ax12)}};this[_0xe4bc[1759]][_0xe4bc[1735]]&&null!=_0x5d2ax4&&this[_0xe4bc[1763]](_0x5d2ax4);(this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1905]]||this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1883]]||this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1906]])&&this[_0xe4bc[1764]](_0x5d2ax3);for(_0x5d2axa in _0x5d2ax5){this[_0xe4bc[1907]](_0x5d2ax5[_0x5d2axa])}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1763]]=function(_0x5d2ax2){var _0x5d2ax3=[],_0x5d2ax4;for(_0x5d2ax4 in _0x5d2ax2){_0x5d2ax3[_0xe4bc[207]](_0x5d2ax2[_0x5d2ax4])};this[_0xe4bc[1759]][_0xe4bc[1727]](mxUtils[_0xe4bc[1779]](_0x5d2ax3,!0),this[_0xe4bc[1745]])};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1764]]=function(_0x5d2ax2){for(var _0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[1850]][_0xe4bc[67]];_0x5d2ax3++){for(var _0x5d2ax4=_0x5d2ax2[_0xe4bc[1850]][_0x5d2ax3],_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){var _0x5d2ax9=_0x5d2ax4[_0x5d2ax5];if(_0x5d2ax9[_0xe4bc[1193]]()){for(var _0x5d2axa=_0x5d2ax9[_0xe4bc[1832]](_0x5d2ax3),_0x5d2ax12=_0x5d2ax3-1,_0x5d2ax13=0;2>_0x5d2ax13;_0x5d2ax13++){if(-1<_0x5d2ax12&&_0x5d2ax12<_0x5d2ax2[_0xe4bc[1850]][_0xe4bc[67]]&&null!=_0x5d2axa&&0<_0x5d2axa[_0xe4bc[67]]){for(var _0x5d2ax14=[],_0x5d2ax15=0;_0x5d2ax15<_0x5d2axa[_0xe4bc[67]];_0x5d2ax15++){var _0x5d2ax16= new WeightedCellSorter(_0x5d2axa[_0x5d2ax15],_0x5d2axa[_0x5d2ax15][_0xe4bc[730]](_0x5d2ax12));_0x5d2ax14[_0xe4bc[207]](_0x5d2ax16)};_0x5d2ax14[_0xe4bc[470]](WeightedCellSorter[_0xe4bc[202]][_0xe4bc[469]]);for(var _0x5d2ax16=_0x5d2ax9[_0xe4bc[235]][0]-_0x5d2ax9[_0xe4bc[117]]/2,_0x5d2ax17=_0x5d2ax16+_0x5d2ax9[_0xe4bc[117]],_0x5d2ax18=_0x5d2axa=0,_0x5d2ax12=[],_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax14[_0xe4bc[67]];_0x5d2ax15++){var _0x5d2ax19=_0x5d2ax14[_0x5d2ax15][_0xe4bc[246]],_0x5d2ax1a;if(_0x5d2ax19[_0xe4bc[1193]]()){_0x5d2ax1a=0==_0x5d2ax13?_0x5d2ax9[_0xe4bc[1838]]:_0x5d2ax9[_0xe4bc[1837]];for(var _0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax1a[_0xe4bc[67]];_0x5d2ax1b++){if(_0x5d2ax1a[_0x5d2ax1b][_0xe4bc[1097]]==_0x5d2ax19||_0x5d2ax1a[_0x5d2ax1b][_0xe4bc[772]]==_0x5d2ax19){_0x5d2axa+=_0x5d2ax1a[_0x5d2ax1b][_0xe4bc[1842]][_0xe4bc[67]],_0x5d2ax18++,_0x5d2ax12[_0xe4bc[207]](_0x5d2ax1a[_0x5d2ax1b])}}}else {_0x5d2axa+=_0x5d2ax19[_0xe4bc[1842]][_0xe4bc[67]],_0x5d2ax18++,_0x5d2ax12[_0xe4bc[207]](_0x5d2ax19)}};_0x5d2ax9[_0xe4bc[117]]>(_0x5d2axa+1)*this[_0xe4bc[1751]]+2*this[_0xe4bc[1751]]&&(_0x5d2ax16+=this[_0xe4bc[1751]],_0x5d2ax17-=this[_0xe4bc[1751]]);_0x5d2ax14=(_0x5d2ax17-_0x5d2ax16)/_0x5d2axa;_0x5d2ax16+=_0x5d2ax14/2;_0x5d2ax17=this[_0xe4bc[1753]]-this[_0xe4bc[1752]];for(_0x5d2ax15=_0x5d2ax18=0;_0x5d2ax15<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax15++){_0x5d2ax19=_0x5d2ax12[_0x5d2ax15][_0xe4bc[1842]][_0xe4bc[67]];_0x5d2ax1b=mxCellPath[_0xe4bc[385]](_0x5d2ax12[_0x5d2ax15][_0xe4bc[1842]][0]);_0x5d2ax1a=this[_0xe4bc[1873]][_0x5d2ax1b];null==_0x5d2ax1a&&(_0x5d2ax1a=[],this[_0xe4bc[1873]][_0x5d2ax1b]=_0x5d2ax1a);_0x5d2ax15<_0x5d2axa/2?_0x5d2ax17+=this[_0xe4bc[1752]]:_0x5d2ax15>_0x5d2axa/2&&(_0x5d2ax17-=this[_0xe4bc[1752]]);for(_0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax19;_0x5d2ax1b++){_0x5d2ax1a[4*_0x5d2ax1b+2*_0x5d2ax13]=_0x5d2ax16,_0x5d2ax16+=_0x5d2ax14,_0x5d2ax1a[4*_0x5d2ax1b+2*_0x5d2ax13+1]=_0x5d2ax17};_0x5d2ax18=Math[_0xe4bc[160]](_0x5d2ax18,_0x5d2ax17)}};_0x5d2axa=_0x5d2ax9[_0xe4bc[1831]](_0x5d2ax3);_0x5d2ax12=_0x5d2ax3+1}}}}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1907]]=function(_0x5d2ax2){var _0x5d2ax3=0;if(101207!=_0x5d2ax2[_0xe4bc[1826]][0]){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[1827]],_0x5d2ax5=_0x5d2ax2[_0xe4bc[1828]];_0x5d2ax4==_0x5d2ax5&&(_0x5d2ax4=_0x5d2ax2[_0xe4bc[1097]][_0xe4bc[1827]],_0x5d2ax5=_0x5d2ax2[_0xe4bc[772]][_0xe4bc[1828]]);for(var _0x5d2ax9=0,_0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2[_0xe4bc[1842]][0]),_0x5d2axa=this[_0xe4bc[1873]][_0x5d2axa],_0x5d2ax12=_0x5d2ax2[_0xe4bc[1843]]?_0x5d2ax2[_0xe4bc[772]][_0xe4bc[246]]:_0x5d2ax2[_0xe4bc[1097]][_0xe4bc[246]],_0x5d2ax13=this[_0xe4bc[1759]][_0xe4bc[1179]],_0x5d2ax14=0;_0x5d2ax14<_0x5d2ax2[_0xe4bc[1842]][_0xe4bc[67]];_0x5d2ax14++){var _0x5d2ax15=_0x5d2ax2[_0xe4bc[1842]][_0x5d2ax14],_0x5d2ax16=this[_0xe4bc[1759]][_0xe4bc[1710]](_0x5d2ax15,!0),_0x5d2ax17=_0x5d2ax13[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax15,!0),_0x5d2ax18=[],_0x5d2ax19=_0x5d2ax2[_0xe4bc[1843]];_0x5d2ax16!=_0x5d2ax12&&(_0x5d2ax19= !_0x5d2ax19);if(null!=_0x5d2axa){var _0x5d2ax1a=_0x5d2ax19?2:0,_0x5d2ax1b=_0x5d2ax19?this[_0xe4bc[1877]][_0x5d2ax5]:this[_0xe4bc[1878]][_0x5d2ax4],_0x5d2ax1c=_0x5d2axa[4*_0x5d2ax9+1+_0x5d2ax1a];_0x5d2ax19&&(_0x5d2ax1c= -_0x5d2ax1c);_0x5d2ax1b+=_0x5d2ax1c;_0x5d2ax1a=_0x5d2axa[4*_0x5d2ax9+_0x5d2ax1a];_0x5d2ax17=_0x5d2ax13[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax15,!0);this[_0xe4bc[1759]][_0xe4bc[1908]](_0x5d2ax17)&&_0x5d2ax13[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax17)==_0x5d2ax16&&(_0x5d2ax1a=_0x5d2ax13[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax17),_0x5d2ax1a=null!=_0x5d2ax1a?_0x5d2ax1a[_0xe4bc[235]]:_0x5d2ax16[_0xe4bc[256]][_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[1097]][_0xe4bc[117]]*_0x5d2ax17[_0xe4bc[256]][_0xe4bc[235]]);this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?(_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1a,_0x5d2ax1b)),this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1906]]&&_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1a,_0x5d2ax1b+_0x5d2ax1c))):(_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1b,_0x5d2ax1a)),this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1906]]&&_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1b+_0x5d2ax1c,_0x5d2ax1a)))};_0x5d2ax1a=_0x5d2ax2[_0xe4bc[235]][_0xe4bc[67]]-1;_0x5d2ax1b=_0x5d2ax1c= -1;_0x5d2ax16=_0x5d2ax2[_0xe4bc[1827]]-1;_0x5d2ax19&&(_0x5d2ax1a=0,_0x5d2ax1c=_0x5d2ax2[_0xe4bc[235]][_0xe4bc[67]],_0x5d2ax1b=1,_0x5d2ax16=_0x5d2ax2[_0xe4bc[1828]]+1);for(;_0x5d2ax2[_0xe4bc[1827]]!=_0x5d2ax2[_0xe4bc[1828]]&&_0x5d2ax1a!=_0x5d2ax1c;_0x5d2ax1a+=_0x5d2ax1b){var _0x5d2ax17=_0x5d2ax2[_0xe4bc[235]][_0x5d2ax1a]+_0x5d2ax3,_0x5d2ax1d=(this[_0xe4bc[1877]][_0x5d2ax16]+this[_0xe4bc[1878]][_0x5d2ax16+1])/2,_0x5d2ax1e=(this[_0xe4bc[1877]][_0x5d2ax16-1]+this[_0xe4bc[1878]][_0x5d2ax16])/2;if(_0x5d2ax19){var _0x5d2ax1f=_0x5d2ax1d,_0x5d2ax1d=_0x5d2ax1e,_0x5d2ax1e=_0x5d2ax1f};this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?(_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax17,_0x5d2ax1d)),_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax17,_0x5d2ax1e))):(_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1d,_0x5d2ax17)),_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1e,_0x5d2ax17)));this[_0xe4bc[1874]]=Math[_0xe4bc[160]](this[_0xe4bc[1874]],_0x5d2ax17);_0x5d2ax16+=_0x5d2ax1b};null!=_0x5d2axa&&(_0x5d2ax1a=_0x5d2ax19?2:0,_0x5d2ax1b=_0x5d2ax19?this[_0xe4bc[1878]][_0x5d2ax4]:this[_0xe4bc[1877]][_0x5d2ax5],_0x5d2ax1c=_0x5d2axa[4*_0x5d2ax9+3-_0x5d2ax1a],_0x5d2ax19&&(_0x5d2ax1c= -_0x5d2ax1c),_0x5d2ax1b-=_0x5d2ax1c,_0x5d2ax1a=_0x5d2axa[4*_0x5d2ax9+2-_0x5d2ax1a],_0x5d2ax19=_0x5d2ax13[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax15,!1),_0x5d2ax16=this[_0xe4bc[1759]][_0xe4bc[1710]](_0x5d2ax15,!1),this[_0xe4bc[1759]][_0xe4bc[1908]](_0x5d2ax19)&&_0x5d2ax13[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax19)==_0x5d2ax16&&(_0x5d2ax1a=_0x5d2ax13[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax19),_0x5d2ax1a=null!=_0x5d2ax1a?_0x5d2ax1a[_0xe4bc[235]]:_0x5d2ax16[_0xe4bc[256]][_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[772]][_0xe4bc[117]]*_0x5d2ax19[_0xe4bc[256]][_0xe4bc[235]]),this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?(this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1906]]&&_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1a,_0x5d2ax1b-_0x5d2ax1c)),_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1a,_0x5d2ax1b))):(this[_0xe4bc[675]]==mxHierarchicalEdgeStyle[_0xe4bc[1906]]&&_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1b-_0x5d2ax1c,_0x5d2ax1a)),_0x5d2ax18[_0xe4bc[207]]( new mxPoint(_0x5d2ax1b,_0x5d2ax1a))));_0x5d2ax2[_0xe4bc[1843]]&&this[_0xe4bc[1909]](_0x5d2ax2,_0x5d2ax15);this[_0xe4bc[1759]][_0xe4bc[1722]](_0x5d2ax15,_0x5d2ax18);_0x5d2ax3=0==_0x5d2ax3?this[_0xe4bc[1872]]:0<_0x5d2ax3?-_0x5d2ax3:-_0x5d2ax3+this[_0xe4bc[1872]];_0x5d2ax9++};_0x5d2ax2[_0xe4bc[1826]][0]=101207}};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1725]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[246]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[235]][0]-_0x5d2ax2[_0xe4bc[117]]/2,_0x5d2ax5=_0x5d2ax2[_0xe4bc[236]][0]-_0x5d2ax2[_0xe4bc[119]]/2;this[_0xe4bc[1877]][_0x5d2ax2[_0xe4bc[1828]]]=Math[_0xe4bc[243]](this[_0xe4bc[1877]][_0x5d2ax2[_0xe4bc[1828]]],_0x5d2ax5);this[_0xe4bc[1878]][_0x5d2ax2[_0xe4bc[1828]]]=Math[_0xe4bc[160]](this[_0xe4bc[1878]][_0x5d2ax2[_0xe4bc[1828]]],_0x5d2ax5+_0x5d2ax2[_0xe4bc[119]]);this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1358]]||this[_0xe4bc[1870]]==mxConstants[_0xe4bc[1354]]?this[_0xe4bc[1759]][_0xe4bc[1725]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5):this[_0xe4bc[1759]][_0xe4bc[1725]](_0x5d2ax3,_0x5d2ax5,_0x5d2ax4);this[_0xe4bc[1874]]=Math[_0xe4bc[160]](this[_0xe4bc[1874]],_0x5d2ax4+_0x5d2ax2[_0xe4bc[117]])};mxCoordinateAssignment[_0xe4bc[202]][_0xe4bc[1909]]=function(_0x5d2ax2,_0x5d2ax3){};function WeightedCellSorter(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[246]]=_0x5d2ax2;this[_0xe4bc[1782]]=_0x5d2ax3}WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1782]]=0;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1783]]= !1;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1784]]= !1;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[1785]]=null;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[246]]=null;WeightedCellSorter[_0xe4bc[202]][_0xe4bc[469]]=function(_0x5d2ax2,_0x5d2ax3){return null!=_0x5d2ax2&&null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[1782]]>_0x5d2ax2[_0xe4bc[1782]]?-1:_0x5d2ax3[_0xe4bc[1782]]<_0x5d2ax2[_0xe4bc[1782]]?1:_0x5d2ax3[_0xe4bc[1783]]?-1:1:0};function mxHierarchicalLayout(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){mxGraphLayout[_0xe4bc[239]](this,_0x5d2ax2);this[_0xe4bc[1870]]=null!=_0x5d2ax3?_0x5d2ax3:mxConstants[_0xe4bc[1358]];this[_0xe4bc[1910]]=null!=_0x5d2ax4?_0x5d2ax4:!0}mxHierarchicalLayout[_0xe4bc[202]]= new mxGraphLayout;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[196]]=mxHierarchicalLayout;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1845]]=null;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1735]]= !1;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1911]]= !1;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1912]]=0;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1868]]=30;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1869]]=100;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1913]]=60;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1872]]=10;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1870]]=mxConstants[_0xe4bc[1358]];mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1882]]= !0;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1844]]= !0;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1787]]= !0;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1914]]= !0;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[251]]=null;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1915]]=null;mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[502]]=function(){return this[_0xe4bc[251]]};mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[350]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1101]]=_0x5d2ax2;var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[251]];this[_0xe4bc[1915]]={};if(!(null==_0x5d2ax3&&null==_0x5d2ax2)){if(null!=_0x5d2ax3&&null!=_0x5d2ax2){for(var _0x5d2ax5=[],_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax4[_0xe4bc[1720]](_0x5d2ax2,_0x5d2ax3[_0x5d2ax9])&&_0x5d2ax5[_0xe4bc[207]](_0x5d2ax3[_0x5d2ax9])};this[_0xe4bc[1845]]=_0x5d2ax5}else {this[_0xe4bc[1845]]=_0x5d2ax3};_0x5d2ax4[_0xe4bc[473]]();try{this[_0xe4bc[1916]](_0x5d2ax2),this[_0xe4bc[1735]]&&!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax2)&&this[_0xe4bc[1179]][_0xe4bc[1917]]([_0x5d2ax2],this[_0xe4bc[1912]],this[_0xe4bc[1911]])}finally{_0x5d2ax4[_0xe4bc[476]]()}}};mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1918]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=[];if(null!=_0x5d2ax2&&null!=_0x5d2ax3){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[251]],_0x5d2ax9=null,_0x5d2axa=-1E5,_0x5d2ax12;for(_0x5d2ax12 in _0x5d2ax3){var _0x5d2ax13=_0x5d2ax3[_0x5d2ax12];if(_0x5d2ax5[_0xe4bc[1193]](_0x5d2ax13)&&this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax13)){for(var _0x5d2ax14=this[_0xe4bc[264]](_0x5d2ax13),_0x5d2ax15=0,_0x5d2ax16=0,_0x5d2ax17=0;_0x5d2ax17<_0x5d2ax14[_0xe4bc[67]];_0x5d2ax17++){this[_0xe4bc[1710]](_0x5d2ax14[_0x5d2ax17],!0)==_0x5d2ax13?_0x5d2ax15++:_0x5d2ax16++};0==_0x5d2ax16&&0<_0x5d2ax15&&_0x5d2ax4[_0xe4bc[207]](_0x5d2ax13);_0x5d2ax14=_0x5d2ax15-_0x5d2ax16;_0x5d2ax14>_0x5d2axa&&(_0x5d2axa=_0x5d2ax14,_0x5d2ax9=_0x5d2ax13)}};0==_0x5d2ax4[_0xe4bc[67]]&&null!=_0x5d2ax9&&_0x5d2ax4[_0xe4bc[207]](_0x5d2ax9)};return _0x5d2ax4};mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[264]]=function(_0x5d2ax2){var _0x5d2ax3=mxCellPath[_0xe4bc[385]](_0x5d2ax2);if(null!=this[_0xe4bc[1915]][_0x5d2ax3]){return this[_0xe4bc[1915]][_0x5d2ax3]};for(var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[251]],_0x5d2ax5=[],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax2),_0x5d2axa=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax2),_0x5d2ax12=0;_0x5d2ax12<_0x5d2axa;_0x5d2ax12++){var _0x5d2ax13=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax12);if(this[_0xe4bc[1908]](_0x5d2ax13)){_0x5d2ax5=_0x5d2ax5[_0xe4bc[1919]](_0x5d2ax4[_0xe4bc[264]](_0x5d2ax13,!0,!0))}else {if(_0x5d2ax9||!this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax13)){_0x5d2ax5=_0x5d2ax5[_0xe4bc[1919]](_0x5d2ax4[_0xe4bc[264]](_0x5d2ax13,!0,!0))}}};_0x5d2ax5=_0x5d2ax5[_0xe4bc[1919]](_0x5d2ax4[_0xe4bc[264]](_0x5d2ax2,!0,!0));_0x5d2ax4=[];for(_0x5d2ax12=0;_0x5d2ax12<_0x5d2ax5[_0xe4bc[67]];_0x5d2ax12++){_0x5d2ax9=this[_0xe4bc[1710]](_0x5d2ax5[_0x5d2ax12],!0),_0x5d2axa=this[_0xe4bc[1710]](_0x5d2ax5[_0x5d2ax12],!1),(_0x5d2ax9==_0x5d2axa||_0x5d2ax9!=_0x5d2axa&&(_0x5d2axa==_0x5d2ax2&&(null==this[_0xe4bc[1101]]||this[_0xe4bc[1179]][_0xe4bc[1920]](_0x5d2ax9,this[_0xe4bc[1101]],this[_0xe4bc[1914]]))||_0x5d2ax9==_0x5d2ax2&&(null==this[_0xe4bc[1101]]||this[_0xe4bc[1179]][_0xe4bc[1920]](_0x5d2axa,this[_0xe4bc[1101]],this[_0xe4bc[1914]]))))&&_0x5d2ax4[_0xe4bc[207]](_0x5d2ax5[_0x5d2ax12])};return this[_0xe4bc[1915]][_0x5d2ax3]=_0x5d2ax4};mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1710]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2),_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[1710]](_0x5d2ax3):this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax2,_0x5d2ax3);this[_0xe4bc[1908]](_0x5d2ax4)&&(_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax4));return _0x5d2ax4};mxHierarchicalLayout[_0xe4bc[202]][_0xe4bc[1916]]=function(_0x5d2ax2){var _0x5d2ax3=[],_0x5d2ax4=[];if(null==this[_0xe4bc[1845]]&&null!=_0x5d2ax2){var _0x5d2ax5={};this[_0xe4bc[1921]](_0x5d2ax2,_0x5d2ax5);this[_0xe4bc[1845]]=[];var _0x5d2ax9=!0,_0x5d2axa;for(_0x5d2axa in _0x5d2ax5){if(null!=_0x5d2ax5[_0x5d2axa]){_0x5d2ax9= !1;break}};for(;!_0x5d2ax9;){for(var _0x5d2ax12=this[_0xe4bc[1918]](_0x5d2ax2,_0x5d2ax5),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax9++){var _0x5d2ax13=[];_0x5d2ax3[_0xe4bc[207]](_0x5d2ax13);this[_0xe4bc[1706]](_0x5d2ax12[_0x5d2ax9],!0,null,_0x5d2ax4,_0x5d2ax13,_0x5d2ax3,_0x5d2ax5)};for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax9++){this[_0xe4bc[1845]][_0xe4bc[207]](_0x5d2ax12[_0x5d2ax9])};_0x5d2ax9= !0;for(_0x5d2axa in _0x5d2ax5){if(null!=_0x5d2ax5[_0x5d2axa]){_0x5d2ax9= !1;break}}}}else {for(_0x5d2ax9=0;_0x5d2ax9mxUtils[_0xe4bc[2]](this[_0xe4bc[1842]],_0x5d2ax2))){null==this[_0xe4bc[1842]]&&(this[_0xe4bc[1842]]=[]),this[_0xe4bc[1842]][_0xe4bc[207]](_0x5d2ax2)};return _0x5d2ax2};mxCell[_0xe4bc[202]][_0xe4bc[1961]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2){if(_0x5d2ax2[_0xe4bc[1709]](!_0x5d2ax3)!=this&&null!=this[_0xe4bc[1842]]){var _0x5d2ax4=this[_0xe4bc[1998]](_0x5d2ax2);0<=_0x5d2ax4&&this[_0xe4bc[1842]][_0xe4bc[300]](_0x5d2ax4,1)};_0x5d2ax2[_0xe4bc[1957]](null,_0x5d2ax3)};return _0x5d2ax2};mxCell[_0xe4bc[202]][_0xe4bc[1999]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1709]](_0x5d2ax2);null!=_0x5d2ax3&&_0x5d2ax3[_0xe4bc[1961]](this,_0x5d2ax2)};mxCell[_0xe4bc[202]][_0xe4bc[284]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[433]]();return (null!=_0x5d2ax4&&_0x5d2ax4[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]?_0x5d2ax4[_0xe4bc[284]](_0x5d2ax2):null)||_0x5d2ax3};mxCell[_0xe4bc[202]][_0xe4bc[57]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[433]]();null!=_0x5d2ax4&&_0x5d2ax4[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]&&_0x5d2ax4[_0xe4bc[57]](_0x5d2ax2,_0x5d2ax3)};mxCell[_0xe4bc[202]][_0xe4bc[238]]=function(){var _0x5d2ax2=mxUtils[_0xe4bc[238]](this,this[_0xe4bc[1991]]);_0x5d2ax2[_0xe4bc[1966]](this[_0xe4bc[2000]]());return _0x5d2ax2};mxCell[_0xe4bc[202]][_0xe4bc[2000]]=function(){var _0x5d2ax2=this[_0xe4bc[433]]();null!=_0x5d2ax2&&(_0xe4bc[279]== typeof _0x5d2ax2[_0xe4bc[238]]?_0x5d2ax2=_0x5d2ax2[_0xe4bc[238]]():isNaN(_0x5d2ax2[_0xe4bc[288]])||(_0x5d2ax2=_0x5d2ax2[_0xe4bc[511]](!0)));return _0x5d2ax2};function mxGeometry(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){mxRectangle[_0xe4bc[239]](this,_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5)}mxGeometry[_0xe4bc[202]]= new mxRectangle;mxGeometry[_0xe4bc[202]][_0xe4bc[196]]=mxGeometry;mxGeometry[_0xe4bc[202]][_0xe4bc[2001]]= !0;mxGeometry[_0xe4bc[202]][_0xe4bc[2002]]=null;mxGeometry[_0xe4bc[202]][_0xe4bc[2003]]=null;mxGeometry[_0xe4bc[202]][_0xe4bc[2004]]=null;mxGeometry[_0xe4bc[202]][_0xe4bc[1525]]=null;mxGeometry[_0xe4bc[202]][_0xe4bc[1368]]=null;mxGeometry[_0xe4bc[202]][_0xe4bc[1500]]= !1;mxGeometry[_0xe4bc[202]][_0xe4bc[2005]]=function(){if(null!=this[_0xe4bc[2002]]){var _0x5d2ax2= new mxRectangle(this[_0xe4bc[235]],this[_0xe4bc[236]],this[_0xe4bc[117]],this[_0xe4bc[119]]);this[_0xe4bc[235]]=this[_0xe4bc[2002]][_0xe4bc[235]];this[_0xe4bc[236]]=this[_0xe4bc[2002]][_0xe4bc[236]];this[_0xe4bc[117]]=this[_0xe4bc[2002]][_0xe4bc[117]];this[_0xe4bc[119]]=this[_0xe4bc[2002]][_0xe4bc[119]];this[_0xe4bc[2002]]=_0x5d2ax2}};mxGeometry[_0xe4bc[202]][_0xe4bc[2006]]=function(_0x5d2ax2){return _0x5d2ax2?this[_0xe4bc[2003]]:this[_0xe4bc[2004]]};mxGeometry[_0xe4bc[202]][_0xe4bc[2007]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3?this[_0xe4bc[2003]]=_0x5d2ax2:this[_0xe4bc[2004]]=_0x5d2ax2;return _0x5d2ax2};mxGeometry[_0xe4bc[202]][_0xe4bc[513]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[238]]();this[_0xe4bc[1500]]||(this[_0xe4bc[235]]+=_0x5d2ax2,this[_0xe4bc[236]]+=_0x5d2ax3);null!=this[_0xe4bc[2003]]&&(this[_0xe4bc[2003]][_0xe4bc[235]]+=_0x5d2ax2,this[_0xe4bc[2003]][_0xe4bc[236]]+=_0x5d2ax3);null!=this[_0xe4bc[2004]]&&(this[_0xe4bc[2004]][_0xe4bc[235]]+=_0x5d2ax2,this[_0xe4bc[2004]][_0xe4bc[236]]+=_0x5d2ax3);if(this[_0xe4bc[2001]]&&null!=this[_0xe4bc[1525]]){for(var _0x5d2ax4=this[_0xe4bc[1525]][_0xe4bc[67]],_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4;_0x5d2ax5++){var _0x5d2ax9=this[_0xe4bc[1525]][_0x5d2ax5];null!=_0x5d2ax9&&(_0x5d2ax9[_0xe4bc[235]]+=_0x5d2ax2,_0x5d2ax9[_0xe4bc[236]]+=_0x5d2ax3)}}};var mxCellPath={PATH_SEPARATOR:_0xe4bc[87],create:function(_0x5d2ax2){var _0x5d2ax3=_0xe4bc[110];if(null!=_0x5d2ax2){for(var _0x5d2ax4=_0x5d2ax2[_0xe4bc[1197]]();null!=_0x5d2ax4;){_0x5d2ax3=_0x5d2ax4[_0xe4bc[1738]](_0x5d2ax2)+mxCellPath[_0xe4bc[1950]]+_0x5d2ax3,_0x5d2ax2=_0x5d2ax4,_0x5d2ax4=_0x5d2ax2[_0xe4bc[1197]]()}};_0x5d2ax2=_0x5d2ax3[_0xe4bc[67]];1<_0x5d2ax2&&(_0x5d2ax3=_0x5d2ax3[_0xe4bc[85]](0,_0x5d2ax2-1));return _0x5d2ax3},getParentPath:function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[1122]](mxCellPath.PATH_SEPARATOR);if(0<=_0x5d2ax3){return _0x5d2ax2[_0xe4bc[85]](0,_0x5d2ax3)};if(0<_0x5d2ax2[_0xe4bc[67]]){return _0xe4bc[110]}};return null},resolve:function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2;if(null!=_0x5d2ax3){for(var _0x5d2ax5=_0x5d2ax3[_0xe4bc[224]](mxCellPath.PATH_SEPARATOR),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5[_0xe4bc[67]];_0x5d2ax9++){_0x5d2ax4=_0x5d2ax4[_0xe4bc[263]](parseInt(_0x5d2ax5[_0x5d2ax9]))}};return _0x5d2ax4},compare:function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=Math[_0xe4bc[243]](_0x5d2ax2[_0xe4bc[67]],_0x5d2ax3[_0xe4bc[67]]),_0x5d2ax5=0,_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax4;_0x5d2ax9++){if(_0x5d2ax2[_0x5d2ax9]!=_0x5d2ax3[_0x5d2ax9]){0==_0x5d2ax2[_0x5d2ax9][_0xe4bc[67]]||0==_0x5d2ax3[_0x5d2ax9][_0xe4bc[67]]?_0x5d2ax5=_0x5d2ax2[_0x5d2ax9]==_0x5d2ax3[_0x5d2ax9]?0:_0x5d2ax2[_0x5d2ax9]>_0x5d2ax3[_0x5d2ax9]?1:-1:(_0x5d2ax4=parseInt(_0x5d2ax2[_0x5d2ax9]),_0x5d2ax9=parseInt(_0x5d2ax3[_0x5d2ax9]),_0x5d2ax5=_0x5d2ax4==_0x5d2ax9?0:_0x5d2ax4>_0x5d2ax9?1:-1);break}};0==_0x5d2ax5&&(_0x5d2ax4=_0x5d2ax2[_0xe4bc[67]],_0x5d2ax9=_0x5d2ax3[_0xe4bc[67]],_0x5d2ax4!=_0x5d2ax9&&(_0x5d2ax5=_0x5d2ax4>_0x5d2ax9?1:-1));return _0x5d2ax5}},mxPerimeter={RectanglePerimeter:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax3=_0x5d2ax2[_0xe4bc[241]]();var _0x5d2ax9=_0x5d2ax2[_0xe4bc[242]](),_0x5d2axa=Math[_0xe4bc[429]](_0x5d2ax4[_0xe4bc[236]]-_0x5d2ax9,_0x5d2ax4[_0xe4bc[235]]-_0x5d2ax3),_0x5d2ax12= new mxPoint(0,0),_0x5d2ax13=Math[_0xe4bc[424]],_0x5d2ax14=Math[_0xe4bc[424]]/2-_0x5d2axa,_0x5d2ax15=Math[_0xe4bc[429]](_0x5d2ax2[_0xe4bc[119]],_0x5d2ax2[_0xe4bc[117]]);_0x5d2axa<-_0x5d2ax13+_0x5d2ax15||_0x5d2axa>_0x5d2ax13-_0x5d2ax15?(_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax9-_0x5d2ax2[_0xe4bc[117]]*Math[_0xe4bc[2008]](_0x5d2axa)/2):_0x5d2axa<-_0x5d2ax15?(_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[236]],_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax3-_0x5d2ax2[_0xe4bc[119]]*Math[_0xe4bc[2008]](_0x5d2ax14)/2):_0x5d2axa<_0x5d2ax15?(_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]],_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax9+_0x5d2ax2[_0xe4bc[117]]*Math[_0xe4bc[2008]](_0x5d2axa)/2):(_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]],_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax3+_0x5d2ax2[_0xe4bc[119]]*Math[_0xe4bc[2008]](_0x5d2ax14)/2);_0x5d2ax5&&(_0x5d2ax4[_0xe4bc[235]]>=_0x5d2ax2[_0xe4bc[235]]&&_0x5d2ax4[_0xe4bc[235]]<=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]?_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax4[_0xe4bc[235]]:_0x5d2ax4[_0xe4bc[236]]>=_0x5d2ax2[_0xe4bc[236]]&&_0x5d2ax4[_0xe4bc[236]]<=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]&&(_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax4[_0xe4bc[235]]<_0x5d2ax2[_0xe4bc[235]]?_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[235]]:_0x5d2ax4[_0xe4bc[235]]>_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]&&(_0x5d2ax12[_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]),_0x5d2ax4[_0xe4bc[236]]<_0x5d2ax2[_0xe4bc[236]]?_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[236]]:_0x5d2ax4[_0xe4bc[236]]>_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]&&(_0x5d2ax12[_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]));return _0x5d2ax12},EllipsePerimeter:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=_0x5d2ax2[_0xe4bc[235]],_0x5d2axa=_0x5d2ax2[_0xe4bc[236]],_0x5d2ax12=_0x5d2ax2[_0xe4bc[117]]/2,_0x5d2ax13=_0x5d2ax2[_0xe4bc[119]]/2,_0x5d2ax14=_0x5d2ax9+_0x5d2ax12,_0x5d2ax15=_0x5d2axa+_0x5d2ax13;_0x5d2ax3=_0x5d2ax4[_0xe4bc[235]];_0x5d2ax4=_0x5d2ax4[_0xe4bc[236]];var _0x5d2ax16=parseInt(_0x5d2ax3-_0x5d2ax14),_0x5d2ax17=parseInt(_0x5d2ax4-_0x5d2ax15);if(0==_0x5d2ax16&&0!=_0x5d2ax17){return new mxPoint(_0x5d2ax14,_0x5d2ax15+_0x5d2ax13*_0x5d2ax17/Math[_0xe4bc[425]](_0x5d2ax17))};if(0==_0x5d2ax16&&0==_0x5d2ax17){return new mxPoint(_0x5d2ax3,_0x5d2ax4)};if(_0x5d2ax5){if(_0x5d2ax4>=_0x5d2axa&&_0x5d2ax4<=_0x5d2axa+_0x5d2ax2[_0xe4bc[119]]){return _0x5d2ax2=_0x5d2ax4-_0x5d2ax15,_0x5d2ax2=Math[_0xe4bc[428]](_0x5d2ax12*_0x5d2ax12*(1-_0x5d2ax2*_0x5d2ax2/(_0x5d2ax13*_0x5d2ax13)))||0,_0x5d2ax3<=_0x5d2ax9&&(_0x5d2ax2= -_0x5d2ax2), new mxPoint(_0x5d2ax14+_0x5d2ax2,_0x5d2ax4)};if(_0x5d2ax3>=_0x5d2ax9&&_0x5d2ax3<=_0x5d2ax9+_0x5d2ax2[_0xe4bc[117]]){return _0x5d2ax2=_0x5d2ax3-_0x5d2ax14,_0x5d2ax2=Math[_0xe4bc[428]](_0x5d2ax13*_0x5d2ax13*(1-_0x5d2ax2*_0x5d2ax2/(_0x5d2ax12*_0x5d2ax12)))||0,_0x5d2ax4<=_0x5d2axa&&(_0x5d2ax2= -_0x5d2ax2), new mxPoint(_0x5d2ax3,_0x5d2ax15+_0x5d2ax2)}};_0x5d2ax9=_0x5d2ax17/_0x5d2ax16;_0x5d2ax15-=_0x5d2ax9*_0x5d2ax14;_0x5d2axa=_0x5d2ax12*_0x5d2ax12*_0x5d2ax9*_0x5d2ax9+_0x5d2ax13*_0x5d2ax13;_0x5d2ax2=-2*_0x5d2ax14*_0x5d2axa;_0x5d2ax13=Math[_0xe4bc[428]](_0x5d2ax2*_0x5d2ax2-4*_0x5d2axa*(_0x5d2ax12*_0x5d2ax12*_0x5d2ax9*_0x5d2ax9*_0x5d2ax14*_0x5d2ax14+_0x5d2ax13*_0x5d2ax13*_0x5d2ax14*_0x5d2ax14-_0x5d2ax12*_0x5d2ax12*_0x5d2ax13*_0x5d2ax13));_0x5d2ax12=(-_0x5d2ax2+_0x5d2ax13)/(2*_0x5d2axa);_0x5d2ax13=(-_0x5d2ax2-_0x5d2ax13)/(2*_0x5d2axa);_0x5d2ax14=_0x5d2ax9*_0x5d2ax12+_0x5d2ax15;_0x5d2ax15=_0x5d2ax9*_0x5d2ax13+_0x5d2ax15;_0x5d2ax9=Math[_0xe4bc[428]](Math[_0xe4bc[2009]](_0x5d2ax12-_0x5d2ax3,2)+Math[_0xe4bc[2009]](_0x5d2ax14-_0x5d2ax4,2));_0x5d2ax3=Math[_0xe4bc[428]](Math[_0xe4bc[2009]](_0x5d2ax13-_0x5d2ax3,2)+Math[_0xe4bc[2009]](_0x5d2ax15-_0x5d2ax4,2));_0x5d2axa=_0x5d2ax4=0;_0x5d2ax9<_0x5d2ax3?(_0x5d2ax4=_0x5d2ax12,_0x5d2axa=_0x5d2ax14):(_0x5d2ax4=_0x5d2ax13,_0x5d2axa=_0x5d2ax15);return new mxPoint(_0x5d2ax4,_0x5d2axa)},RhombusPerimeter:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax3=_0x5d2ax2[_0xe4bc[235]];var _0x5d2ax9=_0x5d2ax2[_0xe4bc[236]],_0x5d2axa=_0x5d2ax2[_0xe4bc[117]];_0x5d2ax2=_0x5d2ax2[_0xe4bc[119]];var _0x5d2ax12=_0x5d2ax3+_0x5d2axa/2,_0x5d2ax13=_0x5d2ax9+_0x5d2ax2/2,_0x5d2ax14=_0x5d2ax4[_0xe4bc[235]];_0x5d2ax4=_0x5d2ax4[_0xe4bc[236]];if(_0x5d2ax12==_0x5d2ax14){return _0x5d2ax13>_0x5d2ax4? new mxPoint(_0x5d2ax12,_0x5d2ax9): new mxPoint(_0x5d2ax12,_0x5d2ax9+_0x5d2ax2)};if(_0x5d2ax13==_0x5d2ax4){return _0x5d2ax12>_0x5d2ax14? new mxPoint(_0x5d2ax3,_0x5d2ax13): new mxPoint(_0x5d2ax3+_0x5d2axa,_0x5d2ax13)};var _0x5d2ax15=_0x5d2ax12,_0x5d2ax16=_0x5d2ax13;_0x5d2ax5&&(_0x5d2ax14>=_0x5d2ax3&&_0x5d2ax14<=_0x5d2ax3+_0x5d2axa?_0x5d2ax15=_0x5d2ax14:_0x5d2ax4>=_0x5d2ax9&&_0x5d2ax4<=_0x5d2ax9+_0x5d2ax2&&(_0x5d2ax16=_0x5d2ax4));return _0x5d2ax14<_0x5d2ax12?_0x5d2ax4<_0x5d2ax13?mxUtils[_0xe4bc[2010]](_0x5d2ax14,_0x5d2ax4,_0x5d2ax15,_0x5d2ax16,_0x5d2ax12,_0x5d2ax9,_0x5d2ax3,_0x5d2ax13):mxUtils[_0xe4bc[2010]](_0x5d2ax14,_0x5d2ax4,_0x5d2ax15,_0x5d2ax16,_0x5d2ax12,_0x5d2ax9+_0x5d2ax2,_0x5d2ax3,_0x5d2ax13):_0x5d2ax4<_0x5d2ax13?mxUtils[_0xe4bc[2010]](_0x5d2ax14,_0x5d2ax4,_0x5d2ax15,_0x5d2ax16,_0x5d2ax12,_0x5d2ax9,_0x5d2ax3+_0x5d2axa,_0x5d2ax13):mxUtils[_0xe4bc[2010]](_0x5d2ax14,_0x5d2ax4,_0x5d2ax15,_0x5d2ax16,_0x5d2ax12,_0x5d2ax9+_0x5d2ax2,_0x5d2ax3+_0x5d2axa,_0x5d2ax13)},TrianglePerimeter:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[124]][mxConstants[_0xe4bc[2011]]]:null;var _0x5d2ax9=_0x5d2ax3==mxConstants[_0xe4bc[1358]]||_0x5d2ax3==mxConstants[_0xe4bc[1354]],_0x5d2axa=_0x5d2ax2[_0xe4bc[235]],_0x5d2ax12=_0x5d2ax2[_0xe4bc[236]],_0x5d2ax13=_0x5d2ax2[_0xe4bc[117]];_0x5d2ax2=_0x5d2ax2[_0xe4bc[119]];var _0x5d2ax14=_0x5d2axa+_0x5d2ax13/2,_0x5d2ax15=_0x5d2ax12+_0x5d2ax2/2,_0x5d2ax16= new mxPoint(_0x5d2axa,_0x5d2ax12),_0x5d2ax17= new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax15),_0x5d2ax18= new mxPoint(_0x5d2axa,_0x5d2ax12+_0x5d2ax2);_0x5d2ax3==mxConstants[_0xe4bc[1358]]?(_0x5d2ax16=_0x5d2ax18,_0x5d2ax17= new mxPoint(_0x5d2ax14,_0x5d2ax12),_0x5d2ax18= new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax12+_0x5d2ax2)):_0x5d2ax3==mxConstants[_0xe4bc[1354]]?(_0x5d2ax17= new mxPoint(_0x5d2ax14,_0x5d2ax12+_0x5d2ax2),_0x5d2ax18= new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax12)):_0x5d2ax3==mxConstants[_0xe4bc[1359]]&&(_0x5d2ax16= new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax12),_0x5d2ax17= new mxPoint(_0x5d2axa,_0x5d2ax15),_0x5d2ax18= new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax12+_0x5d2ax2));var _0x5d2ax19=_0x5d2ax4[_0xe4bc[235]]-_0x5d2ax14,_0x5d2ax1a=_0x5d2ax4[_0xe4bc[236]]-_0x5d2ax15,_0x5d2ax19=_0x5d2ax9?Math[_0xe4bc[429]](_0x5d2ax19,_0x5d2ax1a):Math[_0xe4bc[429]](_0x5d2ax1a,_0x5d2ax19),_0x5d2ax1b=_0x5d2ax9?Math[_0xe4bc[429]](_0x5d2ax13,_0x5d2ax2):Math[_0xe4bc[429]](_0x5d2ax2,_0x5d2ax13),_0x5d2ax1a=!1,_0x5d2ax1a=_0x5d2ax3==mxConstants[_0xe4bc[1358]]||_0x5d2ax3==mxConstants[_0xe4bc[1359]]?_0x5d2ax19>-_0x5d2ax1b&&_0x5d2ax19<_0x5d2ax1b:_0x5d2ax19<-Math[_0xe4bc[424]]+_0x5d2ax1b||_0x5d2ax19>Math[_0xe4bc[424]]-_0x5d2ax1b,_0x5d2ax1b=null;_0x5d2ax1a?_0x5d2ax1b=_0x5d2ax5&&(_0x5d2ax9&&_0x5d2ax4[_0xe4bc[235]]>=_0x5d2ax16[_0xe4bc[235]]&&_0x5d2ax4[_0xe4bc[235]]<=_0x5d2ax18[_0xe4bc[235]]||!_0x5d2ax9&&_0x5d2ax4[_0xe4bc[236]]>=_0x5d2ax16[_0xe4bc[236]]&&_0x5d2ax4[_0xe4bc[236]]<=_0x5d2ax18[_0xe4bc[236]])?_0x5d2ax9? new mxPoint(_0x5d2ax4[_0xe4bc[235]],_0x5d2ax16[_0xe4bc[236]]): new mxPoint(_0x5d2ax16[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]]):_0x5d2ax3==mxConstants[_0xe4bc[1358]]? new mxPoint(_0x5d2axa+_0x5d2ax13/2+_0x5d2ax2*Math[_0xe4bc[2008]](_0x5d2ax19)/2,_0x5d2ax12+_0x5d2ax2):_0x5d2ax3==mxConstants[_0xe4bc[1354]]? new mxPoint(_0x5d2axa+_0x5d2ax13/2-_0x5d2ax2*Math[_0xe4bc[2008]](_0x5d2ax19)/2,_0x5d2ax12):_0x5d2ax3==mxConstants[_0xe4bc[1359]]? new mxPoint(_0x5d2axa+_0x5d2ax13,_0x5d2ax12+_0x5d2ax2/2+_0x5d2ax13*Math[_0xe4bc[2008]](_0x5d2ax19)/2): new mxPoint(_0x5d2axa,_0x5d2ax12+_0x5d2ax2/2-_0x5d2ax13*Math[_0xe4bc[2008]](_0x5d2ax19)/2):(_0x5d2ax5&&(_0x5d2ax5= new mxPoint(_0x5d2ax14,_0x5d2ax15),_0x5d2ax4[_0xe4bc[236]]>=_0x5d2ax12&&_0x5d2ax4[_0xe4bc[236]]<=_0x5d2ax12+_0x5d2ax2?(_0x5d2ax5[_0xe4bc[235]]=_0x5d2ax9?_0x5d2ax14:_0x5d2ax3==mxConstants[_0xe4bc[1359]]?_0x5d2axa+_0x5d2ax13:_0x5d2axa,_0x5d2ax5[_0xe4bc[236]]=_0x5d2ax4[_0xe4bc[236]]):_0x5d2ax4[_0xe4bc[235]]>=_0x5d2axa&&_0x5d2ax4[_0xe4bc[235]]<=_0x5d2axa+_0x5d2ax13&&(_0x5d2ax5[_0xe4bc[235]]=_0x5d2ax4[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[236]]=!_0x5d2ax9?_0x5d2ax15:_0x5d2ax3==mxConstants[_0xe4bc[1358]]?_0x5d2ax12+_0x5d2ax2:_0x5d2ax12),_0x5d2ax14=_0x5d2ax5[_0xe4bc[235]],_0x5d2ax15=_0x5d2ax5[_0xe4bc[236]]),_0x5d2ax1b=_0x5d2ax9&&_0x5d2ax4[_0xe4bc[235]]<=_0x5d2axa+_0x5d2ax13/2||!_0x5d2ax9&&_0x5d2ax4[_0xe4bc[236]]<=_0x5d2ax12+_0x5d2ax2/2?mxUtils[_0xe4bc[2010]](_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]],_0x5d2ax14,_0x5d2ax15,_0x5d2ax16[_0xe4bc[235]],_0x5d2ax16[_0xe4bc[236]],_0x5d2ax17[_0xe4bc[235]],_0x5d2ax17[_0xe4bc[236]]):mxUtils[_0xe4bc[2010]](_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]],_0x5d2ax14,_0x5d2ax15,_0x5d2ax17[_0xe4bc[235]],_0x5d2ax17[_0xe4bc[236]],_0x5d2ax18[_0xe4bc[235]],_0x5d2ax18[_0xe4bc[236]]));null==_0x5d2ax1b&&(_0x5d2ax1b= new mxPoint(_0x5d2ax14,_0x5d2ax15));return _0x5d2ax1b}};function mxPrintPreview(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12,_0x5d2ax13,_0x5d2ax14){this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[255]]=null!=_0x5d2ax3?_0x5d2ax3:1/_0x5d2ax2[_0xe4bc[2012]];this[_0xe4bc[467]]=null!=_0x5d2ax5?_0x5d2ax5:0;this[_0xe4bc[2013]]=null!=_0x5d2ax4?_0x5d2ax4:_0x5d2ax2[_0xe4bc[2013]];this[_0xe4bc[924]]=null!=_0x5d2ax13?_0x5d2ax13:_0xe4bc[2014];this[_0xe4bc[1732]]=null!=_0x5d2ax9?_0x5d2ax9:0;this[_0xe4bc[1733]]=null!=_0x5d2axa?_0x5d2axa:0;this[_0xe4bc[1630]]=_0x5d2ax12;this[_0xe4bc[2015]]=null!=_0x5d2ax14?_0x5d2ax14:!0}mxPrintPreview[_0xe4bc[202]][_0xe4bc[1179]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2013]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[255]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[467]]=0;mxPrintPreview[_0xe4bc[202]][_0xe4bc[1732]]=0;mxPrintPreview[_0xe4bc[202]][_0xe4bc[1733]]=0;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2016]]= !0;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2017]]= !1;mxPrintPreview[_0xe4bc[202]][_0xe4bc[1630]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[924]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2015]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2018]]=null;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2019]]=0;mxPrintPreview[_0xe4bc[202]][_0xe4bc[2020]]=function(){return this[_0xe4bc[2018]]};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2021]]=function(){var _0x5d2ax2=_0xe4bc[110];8==document[_0xe4bc[5]]&&(_0x5d2ax2=_0xe4bc[2022]);return _0x5d2ax2};mxPrintPreview[_0xe4bc[202]][_0xe4bc[392]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[2023]],_0x5d2ax4=null;try{this[_0xe4bc[2017]]&&(this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[2023]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3[_0xe4bc[176]](_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2024]]())});if(null==this[_0xe4bc[2018]]){this[_0xe4bc[2018]]=window[_0xe4bc[392]]();var _0x5d2ax5=this[_0xe4bc[2018]][_0xe4bc[395]],_0x5d2ax9=this[_0xe4bc[2021]]();null!=_0x5d2ax9&&0<_0x5d2ax9[_0xe4bc[67]]&&_0x5d2ax5[_0xe4bc[171]](_0x5d2ax9);_0x5d2ax5[_0xe4bc[171]](_0xe4bc[528]);_0x5d2ax5[_0xe4bc[171]](_0xe4bc[531]);this[_0xe4bc[2025]](_0x5d2ax5,_0x5d2ax2);_0x5d2ax5[_0xe4bc[171]](_0xe4bc[533]);_0x5d2ax5[_0xe4bc[171]](_0xe4bc[2026]);mxClient[_0xe4bc[54]](_0xe4bc[94],mxClient[_0xe4bc[86]]+_0xe4bc[95],_0x5d2ax5);mxClient[_0xe4bc[47]]&&(_0x5d2ax5[_0xe4bc[100]][_0xe4bc[99]](_0xe4bc[6],_0xe4bc[97]),_0x5d2ax5[_0xe4bc[100]][_0xe4bc[99]](_0xe4bc[7],_0xe4bc[101]),_0x5d2ax5[_0xe4bc[102]]()[_0xe4bc[103]]=_0xe4bc[104],mxClient[_0xe4bc[54]](_0xe4bc[94],mxClient[_0xe4bc[86]]+_0xe4bc[105],_0x5d2ax5));var _0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[517]]()[_0xe4bc[238]](),_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[518]](),_0x5d2ax13=_0x5d2ax12/this[_0xe4bc[255]],_0x5d2ax14=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[512]]();this[_0xe4bc[2016]]||(this[_0xe4bc[1732]]=-_0x5d2ax14[_0xe4bc[235]]*this[_0xe4bc[255]],this[_0xe4bc[1733]]=-_0x5d2ax14[_0xe4bc[236]]*this[_0xe4bc[255]],_0x5d2axa[_0xe4bc[117]]+=_0x5d2axa[_0xe4bc[235]],_0x5d2axa[_0xe4bc[119]]+=_0x5d2axa[_0xe4bc[236]],_0x5d2axa[_0xe4bc[235]]=0,this[_0xe4bc[467]]=_0x5d2axa[_0xe4bc[236]]=0);_0x5d2axa[_0xe4bc[117]]/=_0x5d2ax13;_0x5d2axa[_0xe4bc[119]]/=_0x5d2ax13;var _0x5d2ax15=this[_0xe4bc[2013]][_0xe4bc[117]]-2*this[_0xe4bc[467]],_0x5d2ax16=this[_0xe4bc[2013]][_0xe4bc[119]]-2*this[_0xe4bc[467]],_0x5d2ax17=Math[_0xe4bc[160]](1,Math[_0xe4bc[430]]((_0x5d2axa[_0xe4bc[117]]+this[_0xe4bc[1732]])/_0x5d2ax15)),_0x5d2ax18=Math[_0xe4bc[160]](1,Math[_0xe4bc[430]]((_0x5d2axa[_0xe4bc[119]]+this[_0xe4bc[1733]])/_0x5d2ax16));this[_0xe4bc[2019]]=_0x5d2ax17*_0x5d2ax18;var _0x5d2ax19=mxUtils[_0xe4bc[885]](this,function(){if(this[_0xe4bc[2015]]&&(1<_0x5d2ax18||1<_0x5d2ax17)){var _0x5d2ax2=this[_0xe4bc[2027]](_0x5d2ax18,_0x5d2ax17);_0x5d2ax5[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax2);if(mxClient[_0xe4bc[80]]){_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];var _0x5d2ax3=function(){_0x5d2ax2[_0xe4bc[124]][_0xe4bc[125]]=_0x5d2ax5[_0xe4bc[112]][_0xe4bc[190]]+10+_0xe4bc[168]};mxEvent[_0xe4bc[169]](this[_0xe4bc[2018]],_0xe4bc[276],function(_0x5d2ax2){_0x5d2ax3()});mxEvent[_0xe4bc[169]](this[_0xe4bc[2018]],_0xe4bc[129],function(_0x5d2ax2){_0x5d2ax3()})}}});_0x5d2ax2=function(_0x5d2ax2,_0x5d2ax3){null!=this[_0xe4bc[1630]]&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[1630]]=this[_0xe4bc[1630]],_0x5d2ax2[_0xe4bc[124]][_0xe4bc[465]]=_0xe4bc[1631],_0x5d2ax2[_0xe4bc[124]][_0xe4bc[1629]]=_0xe4bc[942]);_0x5d2ax2[_0xe4bc[124]][_0xe4bc[1537]]=_0xe4bc[1391];_0x5d2ax3&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[2028]]=_0xe4bc[2029]);mxClient[_0xe4bc[80]]?(_0x5d2ax5[_0xe4bc[171]](_0x5d2ax2[_0xe4bc[342]]),_0x5d2ax2[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax2)):(_0x5d2ax2[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax2),_0x5d2ax5[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax2));if(_0x5d2ax3){var _0x5d2ax4=_0x5d2ax5[_0xe4bc[55]](_0xe4bc[1054]);_0x5d2ax4[_0xe4bc[926]]=_0xe4bc[2030];_0x5d2ax5[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax4)}};var _0x5d2ax1a=this[_0xe4bc[2031]](this[_0xe4bc[2013]][_0xe4bc[117]],this[_0xe4bc[2013]][_0xe4bc[119]]);if(null!=_0x5d2ax1a){for(var _0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax1a[_0xe4bc[67]];_0x5d2ax1b++){_0x5d2ax2(_0x5d2ax1a[_0x5d2ax1b],!0)}};for(var _0x5d2ax1c=this[_0xe4bc[2032]](this[_0xe4bc[2013]][_0xe4bc[117]],this[_0xe4bc[2013]][_0xe4bc[119]]),_0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax18;_0x5d2ax1b++){for(var _0x5d2ax1d=_0x5d2ax1b*_0x5d2ax16/this[_0xe4bc[255]]-this[_0xe4bc[1733]]/this[_0xe4bc[255]]+(_0x5d2axa[_0xe4bc[236]]-_0x5d2ax14[_0xe4bc[236]]*_0x5d2ax12)/_0x5d2ax12,_0x5d2ax1a=0;_0x5d2ax1a<_0x5d2ax17;_0x5d2ax1a++){if(null==this[_0xe4bc[2018]]){return null};var _0x5d2ax1e=_0x5d2ax1a*_0x5d2ax15/this[_0xe4bc[255]]-this[_0xe4bc[1732]]/this[_0xe4bc[255]]+(_0x5d2axa[_0xe4bc[235]]-_0x5d2ax14[_0xe4bc[235]]*_0x5d2ax12)/_0x5d2ax12,_0x5d2ax1f=_0x5d2ax1b*_0x5d2ax17+_0x5d2ax1a+1,_0x5d2ax4=this[_0xe4bc[2034]](this[_0xe4bc[2013]][_0xe4bc[117]],this[_0xe4bc[2013]][_0xe4bc[119]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[2033]](-_0x5d2ax1e,-_0x5d2ax1d,this[_0xe4bc[255]],_0x5d2ax1f,_0x5d2ax2)}));_0x5d2ax4[_0xe4bc[57]](_0xe4bc[1363],_0xe4bc[2035]+_0x5d2ax1f);_0x5d2ax2(_0x5d2ax4,null!=_0x5d2ax1c||_0x5d2ax1b<_0x5d2ax18-1||_0x5d2ax1a<_0x5d2ax17-1)}};if(null!=_0x5d2ax1c){for(_0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax1c[_0xe4bc[67]];_0x5d2ax1b++){_0x5d2ax2(_0x5d2ax1c[_0x5d2ax1b],_0x5d2ax1b<_0x5d2ax1c[_0xe4bc[67]])}};_0x5d2ax5[_0xe4bc[171]](_0xe4bc[527]);_0x5d2ax5[_0xe4bc[171]](_0xe4bc[534]);_0x5d2ax5[_0xe4bc[268]]();_0x5d2ax19();mxEvent[_0xe4bc[762]](_0x5d2ax5[_0xe4bc[112]])};this[_0xe4bc[2018]][_0xe4bc[393]]()}catch(y){null!=_0x5d2ax4&&null!=_0x5d2ax4[_0xe4bc[265]]&&_0x5d2ax4[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax4)}finally{this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[2023]]=_0x5d2ax3};return this[_0xe4bc[2018]]};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2025]]=function(_0x5d2ax2,_0x5d2ax3){null!=this[_0xe4bc[924]]&&_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2036]+this[_0xe4bc[924]]+_0xe4bc[2037]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2038]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2039]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2040]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2041]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[233]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2042]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2043]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2044]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2045]);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[233]);null!=_0x5d2ax3&&_0x5d2ax2[_0xe4bc[171]](_0x5d2ax3);_0x5d2ax2[_0xe4bc[171]](_0xe4bc[2046])};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2027]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[2018]][_0xe4bc[395]],_0x5d2ax5=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[116]);_0x5d2ax5[_0xe4bc[926]]=_0xe4bc[2047];_0x5d2ax5[_0xe4bc[57]](_0xe4bc[467],_0xe4bc[468]);for(var _0x5d2ax9=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[120]),_0x5d2axa=0;_0x5d2axa<_0x5d2ax2;_0x5d2axa++){for(var _0x5d2ax12=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[121]),_0x5d2ax13=0;_0x5d2ax13<_0x5d2ax3;_0x5d2ax13++){var _0x5d2ax14=_0x5d2axa*_0x5d2ax3+_0x5d2ax13+1,_0x5d2ax15=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[122]);if(!mxClient[_0xe4bc[133]]||mxClient[_0xe4bc[75]]||mxClient[_0xe4bc[76]]){var _0x5d2ax16=_0x5d2ax4[_0xe4bc[55]](_0xe4bc[2048]);_0x5d2ax16[_0xe4bc[57]](_0xe4bc[44],_0xe4bc[2049]+_0x5d2ax14);mxUtils[_0xe4bc[53]](_0x5d2ax16,_0x5d2ax14,_0x5d2ax4);_0x5d2ax15[_0xe4bc[62]](_0x5d2ax16)}else {mxUtils[_0xe4bc[53]](_0x5d2ax15,_0x5d2ax14,_0x5d2ax4)};_0x5d2ax12[_0xe4bc[62]](_0x5d2ax15)};_0x5d2ax9[_0xe4bc[62]](_0x5d2ax12)};_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);return _0x5d2ax5};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2034]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[485]);try{_0x5d2ax5[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2+_0xe4bc[168];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3+_0xe4bc[168];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[277]]=_0xe4bc[188];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[2050]]=_0xe4bc[1824];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[1500];var _0x5d2ax9=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax9[_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[467]]+_0xe4bc[168];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[467]]+_0xe4bc[168];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2-2*this[_0xe4bc[467]]+_0xe4bc[168];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3-2*this[_0xe4bc[467]]+_0xe4bc[168];_0x5d2ax9[_0xe4bc[124]][_0xe4bc[277]]=_0xe4bc[188];this[_0xe4bc[1179]][_0xe4bc[507]]==mxConstants[_0xe4bc[1523]]&&(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492]);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax5);_0x5d2ax4(_0x5d2ax9)}catch(f){throw _0x5d2ax5[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax5),f};return _0x5d2ax5};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2033]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[249]]();var _0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[526]];this[_0xe4bc[1179]][_0xe4bc[526]]=_0x5d2ax9;var _0x5d2ax12=_0x5d2ax5[_0xe4bc[2051]](),_0x5d2ax13=_0x5d2ax5[_0xe4bc[2052]](),_0x5d2ax14=_0x5d2ax5[_0xe4bc[2024]](),_0x5d2ax15=_0x5d2ax5[_0xe4bc[1524]]();this[_0xe4bc[1179]][_0xe4bc[507]]==mxConstants[_0xe4bc[508]]?_0x5d2ax5[_0xe4bc[1569]]():this[_0xe4bc[1179]][_0xe4bc[507]]==mxConstants[_0xe4bc[1523]]?_0x5d2ax5[_0xe4bc[1571]]():_0x5d2ax5[_0xe4bc[1570]]();var _0x5d2ax16=_0x5d2ax5[_0xe4bc[503]]();_0x5d2ax5[_0xe4bc[504]](!1);var _0x5d2ax17=this[_0xe4bc[1179]][_0xe4bc[994]]();this[_0xe4bc[1179]][_0xe4bc[995]](!1);var _0x5d2ax18=_0x5d2ax5[_0xe4bc[512]]();_0x5d2ax5[_0xe4bc[513]]= new mxPoint(_0x5d2ax2,_0x5d2ax3);_0x5d2ax2=null;try{var _0x5d2ax19=[this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[501]]()];_0x5d2ax2= new mxTemporaryCellStates(_0x5d2ax5,_0x5d2ax4,_0x5d2ax19)}finally{if(mxClient[_0xe4bc[80]]){_0x5d2ax5[_0xe4bc[506]][_0xe4bc[339]]=_0xe4bc[110]}else {for(_0x5d2ax4=_0x5d2ax9[_0xe4bc[285]];null!=_0x5d2ax4;){_0x5d2ax19=_0x5d2ax4[_0xe4bc[287]],_0x5d2ax3=_0x5d2ax4[_0xe4bc[301]][_0xe4bc[216]](),_0xe4bc[571]==_0x5d2ax3?(_0x5d2ax4[_0xe4bc[57]](_0xe4bc[117],parseInt(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[117]])),_0x5d2ax4[_0xe4bc[57]](_0xe4bc[119],parseInt(_0x5d2ax9[_0xe4bc[124]][_0xe4bc[119]]))):_0xe4bc[583]!=_0x5d2ax4[_0xe4bc[124]][_0xe4bc[270]]&&_0xe4bc[116]!=_0x5d2ax3&&_0x5d2ax4[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax4),_0x5d2ax4=_0x5d2ax19}};_0x5d2ax5[_0xe4bc[506]][_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax5[_0xe4bc[506]]);this[_0xe4bc[1179]][_0xe4bc[995]](_0x5d2ax17);this[_0xe4bc[1179]][_0xe4bc[526]]=_0x5d2axa;_0x5d2ax5[_0xe4bc[510]]=_0x5d2ax12;_0x5d2ax5[_0xe4bc[2053]]=_0x5d2ax13;_0x5d2ax5[_0xe4bc[505]]=_0x5d2ax14;_0x5d2ax5[_0xe4bc[506]]=_0x5d2ax15;_0x5d2ax5[_0xe4bc[513]]=_0x5d2ax18;_0x5d2ax2[_0xe4bc[515]]();_0x5d2ax5[_0xe4bc[504]](_0x5d2ax16)}};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2031]]=function(){return null};mxPrintPreview[_0xe4bc[202]][_0xe4bc[2032]]=function(){return null};mxPrintPreview[_0xe4bc[202]][_0xe4bc[540]]=function(){var _0x5d2ax2=this[_0xe4bc[392]]();null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[540]]()};mxPrintPreview[_0xe4bc[202]][_0xe4bc[268]]=function(){null!=this[_0xe4bc[2018]]&&(this[_0xe4bc[2018]][_0xe4bc[268]](),this[_0xe4bc[2018]]=null)};function mxStylesheet(){this[_0xe4bc[2054]]={};this[_0xe4bc[2056]](this[_0xe4bc[2055]]());this[_0xe4bc[2058]](this[_0xe4bc[2057]]())}mxStylesheet[_0xe4bc[202]][_0xe4bc[2055]]=function(){var _0x5d2ax2={};_0x5d2ax2[mxConstants[_0xe4bc[2059]]]=mxConstants[_0xe4bc[2060]];_0x5d2ax2[mxConstants[_0xe4bc[2061]]]=mxPerimeter[_0xe4bc[2062]];_0x5d2ax2[mxConstants[_0xe4bc[2063]]]=mxConstants[_0xe4bc[481]];_0x5d2ax2[mxConstants[_0xe4bc[2064]]]=mxConstants[_0xe4bc[479]];_0x5d2ax2[mxConstants[_0xe4bc[2065]]]=_0xe4bc[2066];_0x5d2ax2[mxConstants[_0xe4bc[2067]]]=_0xe4bc[2068];_0x5d2ax2[mxConstants[_0xe4bc[2069]]]=_0xe4bc[2070];return _0x5d2ax2};mxStylesheet[_0xe4bc[202]][_0xe4bc[2057]]=function(){var _0x5d2ax2={};_0x5d2ax2[mxConstants[_0xe4bc[2059]]]=mxConstants[_0xe4bc[2071]];_0x5d2ax2[mxConstants[_0xe4bc[1695]]]=mxConstants[_0xe4bc[1622]];_0x5d2ax2[mxConstants[_0xe4bc[2063]]]=mxConstants[_0xe4bc[481]];_0x5d2ax2[mxConstants[_0xe4bc[2064]]]=mxConstants[_0xe4bc[479]];_0x5d2ax2[mxConstants[_0xe4bc[2067]]]=_0xe4bc[2068];_0x5d2ax2[mxConstants[_0xe4bc[2069]]]=_0xe4bc[2072];return _0x5d2ax2};mxStylesheet[_0xe4bc[202]][_0xe4bc[2056]]=function(_0x5d2ax2){this[_0xe4bc[2074]](_0xe4bc[2073],_0x5d2ax2)};mxStylesheet[_0xe4bc[202]][_0xe4bc[2058]]=function(_0x5d2ax2){this[_0xe4bc[2074]](_0xe4bc[2075],_0x5d2ax2)};mxStylesheet[_0xe4bc[202]][_0xe4bc[2076]]=function(){return this[_0xe4bc[2054]][_0xe4bc[2073]]};mxStylesheet[_0xe4bc[202]][_0xe4bc[2077]]=function(){return this[_0xe4bc[2054]][_0xe4bc[2075]]};mxStylesheet[_0xe4bc[202]][_0xe4bc[2074]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[2054]][_0x5d2ax2]=_0x5d2ax3};mxStylesheet[_0xe4bc[202]][_0xe4bc[1705]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax3;if(null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[224]](_0xe4bc[471]),_0x5d2ax4=null!=_0x5d2ax4&&_0xe4bc[471]!=_0x5d2ax2[_0xe4bc[225]](0)?mxUtils[_0xe4bc[238]](_0x5d2ax4):{},_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5[_0xe4bc[67]];_0x5d2ax9++){var _0x5d2axa=_0x5d2ax5[_0x5d2ax9],_0x5d2ax12=_0x5d2axa[_0xe4bc[2]](_0xe4bc[226]);if(0<=_0x5d2ax12){var _0x5d2ax13=_0x5d2axa[_0xe4bc[85]](0,_0x5d2ax12),_0x5d2axa=_0x5d2axa[_0xe4bc[85]](_0x5d2ax12+1);_0x5d2axa==mxConstants[_0xe4bc[217]]? delete _0x5d2ax4[_0x5d2ax13]:mxUtils[_0xe4bc[1946]](_0x5d2axa)?_0x5d2ax4[_0x5d2ax13]=parseFloat(_0x5d2axa):_0x5d2ax4[_0x5d2ax13]=_0x5d2axa}else {if(_0x5d2axa=this[_0xe4bc[2054]][_0x5d2axa],null!=_0x5d2axa){for(_0x5d2ax13 in _0x5d2axa){_0x5d2ax4[_0x5d2ax13]=_0x5d2axa[_0x5d2ax13]}}}}};return _0x5d2ax4};function mxCellState(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[441]]=_0x5d2ax2;this[_0xe4bc[246]]=_0x5d2ax3;this[_0xe4bc[124]]=_0x5d2ax4;this[_0xe4bc[2078]]= new mxPoint;this[_0xe4bc[2079]]= new mxPoint}mxCellState[_0xe4bc[202]]= new mxRectangle;mxCellState[_0xe4bc[202]][_0xe4bc[196]]=mxCellState;mxCellState[_0xe4bc[202]][_0xe4bc[441]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[246]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[124]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2080]]= !0;mxCellState[_0xe4bc[202]][_0xe4bc[2081]]= !1;mxCellState[_0xe4bc[202]][_0xe4bc[2082]]= !1;mxCellState[_0xe4bc[202]][_0xe4bc[2078]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[439]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2079]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2083]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2084]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2085]]=0;mxCellState[_0xe4bc[202]][_0xe4bc[67]]=0;mxCellState[_0xe4bc[202]][_0xe4bc[2086]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[253]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[963]]=null;mxCellState[_0xe4bc[202]][_0xe4bc[2087]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2=_0x5d2ax2||0;_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3: new mxRectangle(this[_0xe4bc[235]],this[_0xe4bc[236]],this[_0xe4bc[117]],this[_0xe4bc[119]]);if(null!=this[_0xe4bc[253]]&&null!=this[_0xe4bc[253]][_0xe4bc[1561]]){var _0x5d2ax4=this[_0xe4bc[253]][_0xe4bc[1561]][_0xe4bc[1548]](this[_0xe4bc[124]],_0x5d2ax3[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]],_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3[_0xe4bc[119]]);_0x5d2ax3[_0xe4bc[235]]=_0x5d2ax4[_0xe4bc[235]];_0x5d2ax3[_0xe4bc[236]]=_0x5d2ax4[_0xe4bc[236]];_0x5d2ax3[_0xe4bc[117]]=this[_0xe4bc[253]][_0xe4bc[1561]][_0xe4bc[1532]]*_0x5d2ax4[_0xe4bc[117]];_0x5d2ax3[_0xe4bc[119]]=this[_0xe4bc[253]][_0xe4bc[1561]][_0xe4bc[1533]]*_0x5d2ax4[_0xe4bc[119]]};0!=_0x5d2ax2&&_0x5d2ax3[_0xe4bc[244]](_0x5d2ax2);return _0x5d2ax3};mxCellState[_0xe4bc[202]][_0xe4bc[2088]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3?(null==this[_0xe4bc[439]]&&(this[_0xe4bc[439]]=[]),0==this[_0xe4bc[439]][_0xe4bc[67]]?this[_0xe4bc[439]][_0xe4bc[207]](_0x5d2ax2):this[_0xe4bc[439]][0]=_0x5d2ax2):null==this[_0xe4bc[439]]?(this[_0xe4bc[439]]=[],this[_0xe4bc[439]][_0xe4bc[207]](null),this[_0xe4bc[439]][_0xe4bc[207]](_0x5d2ax2)):1==this[_0xe4bc[439]][_0xe4bc[67]]?this[_0xe4bc[439]][_0xe4bc[207]](_0x5d2ax2):this[_0xe4bc[439]][this[_0xe4bc[439]][_0xe4bc[67]]-1]=_0x5d2ax2};mxCellState[_0xe4bc[202]][_0xe4bc[1609]]=function(_0x5d2ax2){null!=this[_0xe4bc[253]]&&this[_0xe4bc[253]][_0xe4bc[1609]](_0x5d2ax2);null!=this[_0xe4bc[963]]&&this[_0xe4bc[963]][_0xe4bc[1609]](_0x5d2ax2)};mxCellState[_0xe4bc[202]][_0xe4bc[1710]]=function(_0x5d2ax2){_0x5d2ax2=this[_0xe4bc[2089]](_0x5d2ax2);return null!=_0x5d2ax2?_0x5d2ax2[_0xe4bc[246]]:null};mxCellState[_0xe4bc[202]][_0xe4bc[2089]]=function(_0x5d2ax2){return _0x5d2ax2?this[_0xe4bc[2083]]:this[_0xe4bc[2084]]};mxCellState[_0xe4bc[202]][_0xe4bc[2090]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3?this[_0xe4bc[2083]]=_0x5d2ax2:this[_0xe4bc[2084]]=_0x5d2ax2};mxCellState[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[441]][_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[515]](this)};mxCellState[_0xe4bc[202]][_0xe4bc[238]]=function(){var _0x5d2ax2= new mxCellState(this[_0xe4bc[441]],this[_0xe4bc[246]],this[_0xe4bc[124]]);if(null!=this[_0xe4bc[439]]){_0x5d2ax2[_0xe4bc[439]]=[];for(var _0x5d2ax3=0;_0x5d2ax3=_0x5d2ax14[_0xe4bc[235]]:null!=_0x5d2ax4&&(_0x5d2ax13=_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]<_0x5d2ax3[_0xe4bc[235]]))}else {return}};_0x5d2ax14= !0;null!=_0x5d2ax15?(_0x5d2ax4= new mxCellState,_0x5d2ax4[_0xe4bc[235]]=_0x5d2ax15[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]]=_0x5d2ax15[_0xe4bc[236]]):null!=_0x5d2ax4&&(_0x5d2ax16=mxUtils[_0xe4bc[2227]](_0x5d2ax4,_0x5d2ax2,!1,mxConstants.DIRECTION_MASK_NONE),_0x5d2ax16!=mxConstants[_0xe4bc[434]]?_0x5d2ax14=_0x5d2ax16==mxConstants[_0xe4bc[436]]:(_0x5d2ax2=_0x5d2ax12[_0xe4bc[1198]](_0x5d2ax4[_0xe4bc[246]]),_0x5d2ax2[_0xe4bc[1500]]?_0x5d2ax14=0.5>=_0x5d2ax2[_0xe4bc[235]]:null!=_0x5d2ax3&&(_0x5d2ax14=_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]]<_0x5d2ax4[_0xe4bc[235]])));null!=_0x5d2ax3&&null!=_0x5d2ax4&&(_0x5d2ax2=_0x5d2ax13?_0x5d2ax3[_0xe4bc[235]]:_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax3=_0x5d2axa[_0xe4bc[2228]](_0x5d2ax3),_0x5d2ax12=_0x5d2ax14?_0x5d2ax4[_0xe4bc[235]]:_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]],_0x5d2ax4=_0x5d2axa[_0xe4bc[2228]](_0x5d2ax4),_0x5d2axa= new mxPoint(_0x5d2ax2+(_0x5d2ax13?-_0x5d2ax5:_0x5d2ax5),_0x5d2ax3),_0x5d2ax15= new mxPoint(_0x5d2ax12+(_0x5d2ax14?-_0x5d2ax5:_0x5d2ax5),_0x5d2ax4),_0x5d2ax13==_0x5d2ax14?(_0x5d2ax5=_0x5d2ax13?Math[_0xe4bc[243]](_0x5d2ax2,_0x5d2ax12)-_0x5d2ax5:Math[_0xe4bc[160]](_0x5d2ax2,_0x5d2ax12)+_0x5d2ax5,_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax5,_0x5d2ax3)),_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax5,_0x5d2ax4))):(_0x5d2axa[_0xe4bc[235]]<_0x5d2ax15[_0xe4bc[235]]==_0x5d2ax13?(_0x5d2ax5=_0x5d2ax3+(_0x5d2ax4-_0x5d2ax3)/2,_0x5d2ax9[_0xe4bc[207]](_0x5d2axa),_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2axa[_0xe4bc[235]],_0x5d2ax5)),_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax15[_0xe4bc[235]],_0x5d2ax5))):_0x5d2ax9[_0xe4bc[207]](_0x5d2axa),_0x5d2ax9[_0xe4bc[207]](_0x5d2ax15)))},Loop:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax3){_0x5d2ax4=_0x5d2ax2[_0xe4bc[441]];var _0x5d2axa=_0x5d2ax4[_0xe4bc[1179]];_0x5d2ax5=null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]?_0x5d2ax5[0]:null;null!=_0x5d2ax5&&(_0x5d2ax5=_0x5d2ax4[_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5),mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax5[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[236]])&&(_0x5d2ax5=null));var _0x5d2ax12=0,_0x5d2ax13=0,_0x5d2ax14=0,_0x5d2ax15=0,_0x5d2axa=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_SEGMENT,_0x5d2axa[_0xe4bc[1020]])*_0x5d2ax4[_0xe4bc[255]];_0x5d2ax2=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST);_0x5d2ax2==mxConstants[_0xe4bc[1358]]||_0x5d2ax2==mxConstants[_0xe4bc[1354]]?(_0x5d2ax12=_0x5d2ax4[_0xe4bc[2230]](_0x5d2ax3),_0x5d2ax13=_0x5d2axa):(_0x5d2ax14=_0x5d2ax4[_0xe4bc[2228]](_0x5d2ax3),_0x5d2ax15=_0x5d2axa);null==_0x5d2ax5||_0x5d2ax5[_0xe4bc[235]]<_0x5d2ax3[_0xe4bc[235]]||_0x5d2ax5[_0xe4bc[235]]>_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]]?null!=_0x5d2ax5?(_0x5d2ax12=_0x5d2ax5[_0xe4bc[235]],_0x5d2ax15=Math[_0xe4bc[160]](Math[_0xe4bc[425]](_0x5d2ax14-_0x5d2ax5[_0xe4bc[236]]),_0x5d2ax15)):_0x5d2ax2==mxConstants[_0xe4bc[1358]]?_0x5d2ax14=_0x5d2ax3[_0xe4bc[236]]-2*_0x5d2ax13:_0x5d2ax2==mxConstants[_0xe4bc[1354]]?_0x5d2ax14=_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]]+2*_0x5d2ax13:_0x5d2ax12=_0x5d2ax2==mxConstants[_0xe4bc[1356]]?_0x5d2ax3[_0xe4bc[235]]-2*_0x5d2ax15:_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]]+2*_0x5d2ax15:null!=_0x5d2ax5&&(_0x5d2ax12=_0x5d2ax4[_0xe4bc[2230]](_0x5d2ax3),_0x5d2ax13=Math[_0xe4bc[160]](Math[_0xe4bc[425]](_0x5d2ax12-_0x5d2ax5[_0xe4bc[235]]),_0x5d2ax15),_0x5d2ax14=_0x5d2ax5[_0xe4bc[236]],_0x5d2ax15=0);_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax12-_0x5d2ax13,_0x5d2ax14-_0x5d2ax15));_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax12+_0x5d2ax13,_0x5d2ax14+_0x5d2ax15))}},ElbowConnector:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]?_0x5d2ax5[0]:null,_0x5d2ax12=!1,_0x5d2ax13=!1;if(null!=_0x5d2ax3&&null!=_0x5d2ax4){if(null!=_0x5d2axa){var _0x5d2ax14=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[235]]),_0x5d2ax15=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]),_0x5d2ax13=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[236]],_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax16=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]],_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]),_0x5d2axa=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2229]](_0x5d2ax2,_0x5d2axa),_0x5d2ax12=_0x5d2axa[_0xe4bc[236]]<_0x5d2ax13||_0x5d2axa[_0xe4bc[236]]>_0x5d2ax16,_0x5d2ax13=_0x5d2axa[_0xe4bc[235]]<_0x5d2ax14||_0x5d2axa[_0xe4bc[235]]>_0x5d2ax15}else {_0x5d2ax14=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[235]]),_0x5d2ax15=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]),_0x5d2ax12=_0x5d2ax14==_0x5d2ax15,_0x5d2ax12||(_0x5d2ax13=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[236]],_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax16=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]],_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]),_0x5d2ax13=_0x5d2ax13==_0x5d2ax16)}};!_0x5d2ax13&&(_0x5d2ax12||_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2231]]]==mxConstants[_0xe4bc[2232]])?mxEdgeStyle.TopToBottom(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9):mxEdgeStyle.SideToSide(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9)},SideToSide:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=_0x5d2ax2[_0xe4bc[441]];_0x5d2ax5=null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]?_0x5d2ax5[0]:null;var _0x5d2ax12=_0x5d2ax2[_0xe4bc[439]],_0x5d2ax13=_0x5d2ax12[0],_0x5d2ax12=_0x5d2ax12[_0x5d2ax12[_0xe4bc[67]]-1];null!=_0x5d2ax5&&(_0x5d2ax5=_0x5d2axa[_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5));null!=_0x5d2ax13&&(_0x5d2ax3= new mxCellState,_0x5d2ax3[_0xe4bc[235]]=_0x5d2ax13[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]]=_0x5d2ax13[_0xe4bc[236]]);null!=_0x5d2ax12&&(_0x5d2ax4= new mxCellState,_0x5d2ax4[_0xe4bc[235]]=_0x5d2ax12[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]]=_0x5d2ax12[_0xe4bc[236]]);null!=_0x5d2ax3&&null!=_0x5d2ax4&&(_0x5d2ax2=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[235]]),_0x5d2ax13=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]),_0x5d2ax2=null!=_0x5d2ax5?_0x5d2ax5[_0xe4bc[235]]:_0x5d2ax13+(_0x5d2ax2-_0x5d2ax13)/2,_0x5d2ax13=_0x5d2axa[_0xe4bc[2228]](_0x5d2ax3),_0x5d2axa=_0x5d2axa[_0xe4bc[2228]](_0x5d2ax4),null!=_0x5d2ax5&&(_0x5d2ax5[_0xe4bc[236]]>=_0x5d2ax3[_0xe4bc[236]]&&_0x5d2ax5[_0xe4bc[236]]<=_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]]&&(_0x5d2ax13=_0x5d2ax5[_0xe4bc[236]]),_0x5d2ax5[_0xe4bc[236]]>=_0x5d2ax4[_0xe4bc[236]]&&_0x5d2ax5[_0xe4bc[236]]<=_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]&&(_0x5d2axa=_0x5d2ax5[_0xe4bc[236]])),!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax13)&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax2,_0x5d2ax13)&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2ax13)),!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax2,_0x5d2axa)&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax2,_0x5d2axa)&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2axa)),1==_0x5d2ax9[_0xe4bc[67]]&&(null!=_0x5d2ax5?!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax5[_0xe4bc[236]])&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax2,_0x5d2ax5[_0xe4bc[236]])&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2ax5[_0xe4bc[236]])):(_0x5d2axa=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[236]],_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax3=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]],_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]),_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2axa+(_0x5d2ax3-_0x5d2axa)/2)))))},TopToBottom:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=_0x5d2ax2[_0xe4bc[441]];_0x5d2ax5=null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]?_0x5d2ax5[0]:null;var _0x5d2ax12=_0x5d2ax2[_0xe4bc[439]],_0x5d2ax13=_0x5d2ax12[0],_0x5d2ax12=_0x5d2ax12[_0x5d2ax12[_0xe4bc[67]]-1];null!=_0x5d2ax5&&(_0x5d2ax5=_0x5d2axa[_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5));null!=_0x5d2ax13&&(_0x5d2ax3= new mxCellState,_0x5d2ax3[_0xe4bc[235]]=_0x5d2ax13[_0xe4bc[235]],_0x5d2ax3[_0xe4bc[236]]=_0x5d2ax13[_0xe4bc[236]]);null!=_0x5d2ax12&&(_0x5d2ax4= new mxCellState,_0x5d2ax4[_0xe4bc[235]]=_0x5d2ax12[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]]=_0x5d2ax12[_0xe4bc[236]]);null!=_0x5d2ax3&&null!=_0x5d2ax4&&(_0x5d2ax13=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[236]],_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax12=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]],_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]),_0x5d2ax2=_0x5d2axa[_0xe4bc[2230]](_0x5d2ax3),null!=_0x5d2ax5&&(_0x5d2ax5[_0xe4bc[235]]>=_0x5d2ax3[_0xe4bc[235]]&&_0x5d2ax5[_0xe4bc[235]]<=_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]])&&(_0x5d2ax2=_0x5d2ax5[_0xe4bc[235]]),_0x5d2ax13=null!=_0x5d2ax5?_0x5d2ax5[_0xe4bc[236]]:_0x5d2ax12+(_0x5d2ax13-_0x5d2ax12)/2,!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax13)&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax2,_0x5d2ax13)&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2ax13)),_0x5d2ax2=null!=_0x5d2ax5&&_0x5d2ax5[_0xe4bc[235]]>=_0x5d2ax4[_0xe4bc[235]]&&_0x5d2ax5[_0xe4bc[235]]<=_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]?_0x5d2ax5[_0xe4bc[235]]:_0x5d2axa[_0xe4bc[2230]](_0x5d2ax4),!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax13)&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax2,_0x5d2ax13)&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax2,_0x5d2ax13)),1==_0x5d2ax9[_0xe4bc[67]]&&(null!=_0x5d2ax5&&1==_0x5d2ax9[_0xe4bc[67]]?!mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax5[_0xe4bc[235]],_0x5d2ax13)&&!mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax5[_0xe4bc[235]],_0x5d2ax13)&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax5[_0xe4bc[235]],_0x5d2ax13)):(_0x5d2axa=Math[_0xe4bc[160]](_0x5d2ax3[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[235]]),_0x5d2ax3=Math[_0xe4bc[243]](_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]),_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2axa+(_0x5d2ax3-_0x5d2axa)/2,_0x5d2ax13)))))},SegmentConnector:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=_0x5d2ax2[_0xe4bc[439]],_0x5d2ax12=!0,_0x5d2ax13=null,_0x5d2ax14=_0x5d2axa[0];null==_0x5d2ax14&&null!=_0x5d2ax3?_0x5d2ax14= new mxPoint(_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2230]](_0x5d2ax3),_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2228]](_0x5d2ax3)):null!=_0x5d2ax14&&(_0x5d2ax14=_0x5d2ax14[_0xe4bc[238]]());var _0x5d2ax15=_0x5d2axa[_0xe4bc[67]]-1;if(null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]){for(var _0x5d2ax13=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5[0]),_0x5d2ax16=_0x5d2ax3,_0x5d2ax17=_0x5d2axa[0],_0x5d2ax18=!1,_0x5d2ax19=!1,_0x5d2ax18=_0x5d2ax13,_0x5d2ax1a=_0x5d2ax5[_0xe4bc[67]],_0x5d2ax1b=0;2>_0x5d2ax1b;_0x5d2ax1b++){var _0x5d2ax1c=null!=_0x5d2ax17&&_0x5d2ax17[_0xe4bc[235]]==_0x5d2ax18[_0xe4bc[235]],_0x5d2ax1d=null!=_0x5d2ax17&&_0x5d2ax17[_0xe4bc[236]]==_0x5d2ax18[_0xe4bc[236]],_0x5d2ax1e=null!=_0x5d2ax16&&_0x5d2ax18[_0xe4bc[236]]>=_0x5d2ax16[_0xe4bc[236]]&&_0x5d2ax18[_0xe4bc[236]]<=_0x5d2ax16[_0xe4bc[236]]+_0x5d2ax16[_0xe4bc[119]],_0x5d2ax16=null!=_0x5d2ax16&&_0x5d2ax18[_0xe4bc[235]]>=_0x5d2ax16[_0xe4bc[235]]&&_0x5d2ax18[_0xe4bc[235]]<=_0x5d2ax16[_0xe4bc[235]]+_0x5d2ax16[_0xe4bc[117]],_0x5d2ax18=_0x5d2ax1d||null==_0x5d2ax17&&_0x5d2ax1e,_0x5d2ax19=_0x5d2ax1c||null==_0x5d2ax17&&_0x5d2ax16;if(null!=_0x5d2ax17&&!_0x5d2ax1d&&!_0x5d2ax1c&&(_0x5d2ax1e||_0x5d2ax16)){_0x5d2ax12=_0x5d2ax1e?!1:!0;break};if(_0x5d2ax19||_0x5d2ax18){_0x5d2ax12=_0x5d2ax18;1==_0x5d2ax1b&&(_0x5d2ax12=0==_0x5d2ax5[_0xe4bc[67]]%2?_0x5d2ax18:_0x5d2ax19);break};_0x5d2ax16=_0x5d2ax4;_0x5d2ax17=_0x5d2axa[_0x5d2ax15];_0x5d2ax18=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5[_0x5d2ax1a-1])};_0x5d2ax12&&(null!=_0x5d2axa[0]&&_0x5d2axa[0][_0xe4bc[236]]!=_0x5d2ax13[_0xe4bc[236]]||null==_0x5d2axa[0]&&null!=_0x5d2ax3&&(_0x5d2ax13[_0xe4bc[236]]<_0x5d2ax3[_0xe4bc[236]]||_0x5d2ax13[_0xe4bc[236]]>_0x5d2ax3[_0xe4bc[236]]+_0x5d2ax3[_0xe4bc[119]]))?_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax14[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]])):!_0x5d2ax12&&(null!=_0x5d2axa[0]&&_0x5d2axa[0][_0xe4bc[235]]!=_0x5d2ax13[_0xe4bc[235]]||null==_0x5d2axa[0]&&null!=_0x5d2ax3&&(_0x5d2ax13[_0xe4bc[235]]<_0x5d2ax3[_0xe4bc[235]]||_0x5d2ax13[_0xe4bc[235]]>_0x5d2ax3[_0xe4bc[235]]+_0x5d2ax3[_0xe4bc[117]]))&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax13[_0xe4bc[235]],_0x5d2ax14[_0xe4bc[236]]));_0x5d2ax12?_0x5d2ax14[_0xe4bc[236]]=_0x5d2ax13[_0xe4bc[236]]:_0x5d2ax14[_0xe4bc[235]]=_0x5d2ax13[_0xe4bc[235]];for(_0x5d2ax1b=0;_0x5d2ax1b<_0x5d2ax5[_0xe4bc[67]];_0x5d2ax1b++){_0x5d2ax12= !_0x5d2ax12,_0x5d2ax13=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5[_0x5d2ax1b]),_0x5d2ax12?_0x5d2ax14[_0xe4bc[236]]=_0x5d2ax13[_0xe4bc[236]]:_0x5d2ax14[_0xe4bc[235]]=_0x5d2ax13[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[207]](_0x5d2ax14[_0xe4bc[238]]())}}else {_0x5d2ax13=_0x5d2ax14,_0x5d2ax12= !0};_0x5d2ax14=_0x5d2axa[_0x5d2ax15];null==_0x5d2ax14&&null!=_0x5d2ax4&&(_0x5d2ax14= new mxPoint(_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2230]](_0x5d2ax4),_0x5d2ax2[_0xe4bc[441]][_0xe4bc[2228]](_0x5d2ax4)));_0x5d2ax12&&(null!=_0x5d2axa[_0x5d2ax15]&&_0x5d2axa[_0x5d2ax15][_0xe4bc[236]]!=_0x5d2ax13[_0xe4bc[236]]||null==_0x5d2axa[_0x5d2ax15]&&null!=_0x5d2ax4&&(_0x5d2ax13[_0xe4bc[236]]<_0x5d2ax4[_0xe4bc[236]]||_0x5d2ax13[_0xe4bc[236]]>_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]))?_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax14[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]])):!_0x5d2ax12&&(null!=_0x5d2axa[_0x5d2ax15]&&_0x5d2axa[_0x5d2ax15][_0xe4bc[235]]!=_0x5d2ax13[_0xe4bc[235]]||null==_0x5d2axa[_0x5d2ax15]&&null!=_0x5d2ax4&&(_0x5d2ax13[_0xe4bc[235]]<_0x5d2ax4[_0xe4bc[235]]||_0x5d2ax13[_0xe4bc[235]]>_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]))&&_0x5d2ax9[_0xe4bc[207]]( new mxPoint(_0x5d2ax13[_0xe4bc[235]],_0x5d2ax14[_0xe4bc[236]]));if(null==_0x5d2axa[0]&&null!=_0x5d2ax3){for(;1<_0x5d2ax9[_0xe4bc[67]]&&mxUtils[_0xe4bc[442]](_0x5d2ax3,_0x5d2ax9[1][_0xe4bc[235]],_0x5d2ax9[1][_0xe4bc[236]]);){_0x5d2ax9=_0x5d2ax9[_0xe4bc[300]](1,1)}};if(null==_0x5d2axa[_0x5d2ax15]&&null!=_0x5d2ax4){for(;1<_0x5d2ax9[_0xe4bc[67]]&&mxUtils[_0xe4bc[442]](_0x5d2ax4,_0x5d2ax9[_0x5d2ax9[_0xe4bc[67]]-1][_0xe4bc[235]],_0x5d2ax9[_0x5d2ax9[_0xe4bc[67]]-1][_0xe4bc[236]]);){_0x5d2ax9=_0x5d2ax9[_0xe4bc[300]](_0x5d2ax9[_0xe4bc[67]]-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(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[1179]],_0x5d2ax12=null==_0x5d2ax3?!1:_0x5d2axa[_0xe4bc[502]]()[_0xe4bc[250]](_0x5d2ax3[_0xe4bc[246]]),_0x5d2axa=null==_0x5d2ax4?!1:_0x5d2axa[_0xe4bc[502]]()[_0xe4bc[250]](_0x5d2ax4[_0xe4bc[246]]);if(null!=_0x5d2ax5&&0<_0x5d2ax5[_0xe4bc[67]]||_0x5d2ax12||_0x5d2axa){mxEdgeStyle.SegmentConnector(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9)}else {_0x5d2ax5=_0x5d2ax2[_0xe4bc[439]];var _0x5d2ax13=_0x5d2ax5[0],_0x5d2ax14=_0x5d2ax5[_0x5d2ax5[_0xe4bc[67]]-1];_0x5d2ax5=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[235]]:_0x5d2ax13[_0xe4bc[235]];var _0x5d2ax12=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[236]]:_0x5d2ax13[_0xe4bc[236]],_0x5d2ax15=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[117]]:1,_0x5d2ax16=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[119]]:1,_0x5d2ax17=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[235]]:_0x5d2ax14[_0xe4bc[235]],_0x5d2ax18=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[236]]:_0x5d2ax14[_0xe4bc[236]],_0x5d2ax19=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[117]]:1,_0x5d2ax1a=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[119]]:1,_0x5d2axa=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[255]]*mxEdgeStyle[_0xe4bc[2233]],_0x5d2ax1b=[mxConstants[_0xe4bc[2234]],mxConstants[_0xe4bc[2234]]];null!=_0x5d2ax3&&(_0x5d2ax1b[0]=mxUtils[_0xe4bc[2227]](_0x5d2ax3,_0x5d2ax2,!0,mxConstants.DIRECTION_MASK_ALL));null!=_0x5d2ax4&&(_0x5d2ax1b[1]=mxUtils[_0xe4bc[2227]](_0x5d2ax4,_0x5d2ax2,!1,mxConstants.DIRECTION_MASK_ALL));_0x5d2ax2=[0,0];_0x5d2ax5=[[_0x5d2ax5,_0x5d2ax12,_0x5d2ax15,_0x5d2ax16],[_0x5d2ax17,_0x5d2ax18,_0x5d2ax19,_0x5d2ax1a]];for(_0x5d2ax15=0;2>_0x5d2ax15;_0x5d2ax15++){mxEdgeStyle[_0xe4bc[2235]][_0x5d2ax15][1]=_0x5d2ax5[_0x5d2ax15][0]-_0x5d2axa,mxEdgeStyle[_0xe4bc[2235]][_0x5d2ax15][2]=_0x5d2ax5[_0x5d2ax15][1]-_0x5d2axa,mxEdgeStyle[_0xe4bc[2235]][_0x5d2ax15][4]=_0x5d2ax5[_0x5d2ax15][0]+_0x5d2ax5[_0x5d2ax15][2]+_0x5d2axa,mxEdgeStyle[_0xe4bc[2235]][_0x5d2ax15][8]=_0x5d2ax5[_0x5d2ax15][1]+_0x5d2ax5[_0x5d2ax15][3]+_0x5d2axa};_0x5d2ax15=_0x5d2ax5[0][0]+_0x5d2ax5[0][2]/2-(_0x5d2ax5[1][0]+_0x5d2ax5[1][2]/2);_0x5d2ax16=_0x5d2ax5[0][1]+_0x5d2ax5[0][3]/2-(_0x5d2ax5[1][1]+_0x5d2ax5[1][3]/2);_0x5d2ax12=0;0>_0x5d2ax15?_0x5d2ax12=0>_0x5d2ax16?2:1:0>=_0x5d2ax16&&(_0x5d2ax12=3,0==_0x5d2ax15&&(_0x5d2ax12=2));_0x5d2ax16=null;null!=_0x5d2ax3&&(_0x5d2ax16=_0x5d2ax13);_0x5d2ax3=[[0.5,0.5],[0.5,0.5]];for(_0x5d2ax15=0;2>_0x5d2ax15;_0x5d2ax15++){null!=_0x5d2ax16&&(_0x5d2ax3[_0x5d2ax15][0]=(_0x5d2ax16[_0xe4bc[235]]-_0x5d2ax5[_0x5d2ax15][0])/_0x5d2ax5[_0x5d2ax15][2],0.01>_0x5d2ax3[_0x5d2ax15][0]?_0x5d2ax2[_0x5d2ax15]=mxConstants[_0xe4bc[436]]:0.99<_0x5d2ax3[_0x5d2ax15][0]&&(_0x5d2ax2[_0x5d2ax15]=mxConstants[_0xe4bc[438]]),_0x5d2ax3[_0x5d2ax15][1]=(_0x5d2ax16[_0xe4bc[236]]-_0x5d2ax5[_0x5d2ax15][1])/_0x5d2ax5[_0x5d2ax15][3],0.01>_0x5d2ax3[_0x5d2ax15][1]?_0x5d2ax2[_0x5d2ax15]=mxConstants[_0xe4bc[435]]:0.99<_0x5d2ax3[_0x5d2ax15][1]&&(_0x5d2ax2[_0x5d2ax15]=mxConstants[_0xe4bc[437]])),_0x5d2ax16=null,null!=_0x5d2ax4&&(_0x5d2ax16=_0x5d2ax14)};_0x5d2ax15=_0x5d2ax5[0][1]-(_0x5d2ax5[1][1]+_0x5d2ax5[1][3]);_0x5d2ax16=_0x5d2ax5[0][0]-(_0x5d2ax5[1][0]+_0x5d2ax5[1][2]);_0x5d2ax17=_0x5d2ax5[1][1]-(_0x5d2ax5[0][1]+_0x5d2ax5[0][3]);_0x5d2ax18=_0x5d2ax5[1][0]-(_0x5d2ax5[0][0]+_0x5d2ax5[0][2]);mxEdgeStyle[_0xe4bc[2236]][1]=Math[_0xe4bc[160]](_0x5d2ax16-2*_0x5d2axa,0);mxEdgeStyle[_0xe4bc[2236]][2]=Math[_0xe4bc[160]](_0x5d2ax15-2*_0x5d2axa,0);mxEdgeStyle[_0xe4bc[2236]][4]=Math[_0xe4bc[160]](_0x5d2ax17-2*_0x5d2axa,0);mxEdgeStyle[_0xe4bc[2236]][3]=Math[_0xe4bc[160]](_0x5d2ax18-2*_0x5d2axa,0);_0x5d2ax4=[];_0x5d2ax13=[];_0x5d2ax14=[];_0x5d2ax13[0]=_0x5d2ax16>=_0x5d2ax18?mxConstants[_0xe4bc[436]]:mxConstants[_0xe4bc[438]];_0x5d2ax14[0]=_0x5d2ax15>=_0x5d2ax17?mxConstants[_0xe4bc[435]]:mxConstants[_0xe4bc[437]];_0x5d2ax13[1]=mxUtils[_0xe4bc[2237]](_0x5d2ax13[0]);_0x5d2ax14[1]=mxUtils[_0xe4bc[2237]](_0x5d2ax14[0]);_0x5d2ax16=_0x5d2ax16>=_0x5d2ax18?_0x5d2ax16:_0x5d2ax18;_0x5d2ax17=_0x5d2ax15>=_0x5d2ax17?_0x5d2ax15:_0x5d2ax17;_0x5d2ax18=[[0,0],[0,0]];_0x5d2ax19= !1;for(_0x5d2ax15=0;2>_0x5d2ax15;_0x5d2ax15++){0==_0x5d2ax2[_0x5d2ax15]&&(0==(_0x5d2ax13[_0x5d2ax15]&_0x5d2ax1b[_0x5d2ax15])&&(_0x5d2ax13[_0x5d2ax15]=mxUtils[_0xe4bc[2237]](_0x5d2ax13[_0x5d2ax15])),0==(_0x5d2ax14[_0x5d2ax15]&_0x5d2ax1b[_0x5d2ax15])&&(_0x5d2ax14[_0x5d2ax15]=mxUtils[_0xe4bc[2237]](_0x5d2ax14[_0x5d2ax15])),_0x5d2ax18[_0x5d2ax15][0]=_0x5d2ax14[_0x5d2ax15],_0x5d2ax18[_0x5d2ax15][1]=_0x5d2ax13[_0x5d2ax15])};_0x5d2ax17>2*_0x5d2axa&&_0x5d2ax16>2*_0x5d2axa&&(0<(_0x5d2ax13[0]&_0x5d2ax1b[0])&&0<(_0x5d2ax14[1]&_0x5d2ax1b[1])?(_0x5d2ax18[0][0]=_0x5d2ax13[0],_0x5d2ax18[0][1]=_0x5d2ax14[0],_0x5d2ax18[1][0]=_0x5d2ax14[1],_0x5d2ax18[1][1]=_0x5d2ax13[1],_0x5d2ax19= !0):0<(_0x5d2ax14[0]&_0x5d2ax1b[0])&&0<(_0x5d2ax13[1]&_0x5d2ax1b[1])&&(_0x5d2ax18[0][0]=_0x5d2ax14[0],_0x5d2ax18[0][1]=_0x5d2ax13[0],_0x5d2ax18[1][0]=_0x5d2ax13[1],_0x5d2ax18[1][1]=_0x5d2ax14[1],_0x5d2ax19= !0));_0x5d2ax17>2*_0x5d2axa&&!_0x5d2ax19&&(_0x5d2ax18[0][0]=_0x5d2ax14[0],_0x5d2ax18[0][1]=_0x5d2ax13[0],_0x5d2ax18[1][0]=_0x5d2ax14[1],_0x5d2ax18[1][1]=_0x5d2ax13[1],_0x5d2ax19= !0);_0x5d2ax16>2*_0x5d2axa&&!_0x5d2ax19&&(_0x5d2ax18[0][0]=_0x5d2ax13[0],_0x5d2ax18[0][1]=_0x5d2ax14[0],_0x5d2ax18[1][0]=_0x5d2ax13[1],_0x5d2ax18[1][1]=_0x5d2ax14[1]);for(_0x5d2ax15=0;2>_0x5d2ax15;_0x5d2ax15++){if(0==_0x5d2ax2[_0x5d2ax15]&&(0==(_0x5d2ax18[_0x5d2ax15][0]&_0x5d2ax1b[_0x5d2ax15])&&(_0x5d2ax18[_0x5d2ax15][0]=_0x5d2ax18[_0x5d2ax15][1]),_0x5d2ax4[_0x5d2ax15]=_0x5d2ax18[_0x5d2ax15][0]&_0x5d2ax1b[_0x5d2ax15],_0x5d2ax4[_0x5d2ax15]|=(_0x5d2ax18[_0x5d2ax15][1]&_0x5d2ax1b[_0x5d2ax15])<<8,_0x5d2ax4[_0x5d2ax15]|=(_0x5d2ax18[1-_0x5d2ax15][_0x5d2ax15]&_0x5d2ax1b[_0x5d2ax15])<<16,_0x5d2ax4[_0x5d2ax15]|=(_0x5d2ax18[1-_0x5d2ax15][1-_0x5d2ax15]&_0x5d2ax1b[_0x5d2ax15])<<24,0==(_0x5d2ax4[_0x5d2ax15]&15)&&(_0x5d2ax4[_0x5d2ax15]<<=8),0==(_0x5d2ax4[_0x5d2ax15]&3840)&&(_0x5d2ax4[_0x5d2ax15]=_0x5d2ax4[_0x5d2ax15]&15|_0x5d2ax4[_0x5d2ax15]>>8),0==(_0x5d2ax4[_0x5d2ax15]&983040)&&(_0x5d2ax4[_0x5d2ax15]=_0x5d2ax4[_0x5d2ax15]&65535|(_0x5d2ax4[_0x5d2ax15]&251658240)>>8),_0x5d2ax2[_0x5d2ax15]=_0x5d2ax4[_0x5d2ax15]&15,_0x5d2ax1b[_0x5d2ax15]==mxConstants[_0xe4bc[436]]||_0x5d2ax1b[_0x5d2ax15]==mxConstants[_0xe4bc[435]]||_0x5d2ax1b[_0x5d2ax15]==mxConstants[_0xe4bc[438]]||_0x5d2ax1b[_0x5d2ax15]==mxConstants[_0xe4bc[437]])){_0x5d2ax2[_0x5d2ax15]=_0x5d2ax1b[_0x5d2ax15]}};_0x5d2ax15=_0x5d2ax2[0]==mxConstants[_0xe4bc[438]]?3:_0x5d2ax2[0];_0x5d2ax1b=_0x5d2ax2[1]==mxConstants[_0xe4bc[438]]?3:_0x5d2ax2[1];_0x5d2ax15-=_0x5d2ax12;_0x5d2ax1b-=_0x5d2ax12;1>_0x5d2ax15&&(_0x5d2ax15+=4);1>_0x5d2ax1b&&(_0x5d2ax1b+=4);_0x5d2ax1b=mxEdgeStyle[_0xe4bc[2238]][_0x5d2ax15-1][_0x5d2ax1b-1];mxEdgeStyle[_0xe4bc[2239]][0][0]=_0x5d2ax5[0][0];mxEdgeStyle[_0xe4bc[2239]][0][1]=_0x5d2ax5[0][1];switch(_0x5d2ax2[0]){case mxConstants[_0xe4bc[436]]:mxEdgeStyle[_0xe4bc[2239]][0][0]-=_0x5d2axa;mxEdgeStyle[_0xe4bc[2239]][0][1]+=_0x5d2ax3[0][1]*_0x5d2ax5[0][3];break;case mxConstants[_0xe4bc[437]]:mxEdgeStyle[_0xe4bc[2239]][0][0]+=_0x5d2ax3[0][0]*_0x5d2ax5[0][2];mxEdgeStyle[_0xe4bc[2239]][0][1]+=_0x5d2ax5[0][3]+_0x5d2axa;break;case mxConstants[_0xe4bc[438]]:mxEdgeStyle[_0xe4bc[2239]][0][0]+=_0x5d2ax5[0][2]+_0x5d2axa;mxEdgeStyle[_0xe4bc[2239]][0][1]+=_0x5d2ax3[0][1]*_0x5d2ax5[0][3];break;case mxConstants[_0xe4bc[435]]:mxEdgeStyle[_0xe4bc[2239]][0][0]+=_0x5d2ax3[0][0]*_0x5d2ax5[0][2],mxEdgeStyle[_0xe4bc[2239]][0][1]-=_0x5d2axa};_0x5d2axa=0;_0x5d2ax13=_0x5d2ax4=0<(_0x5d2ax2[0]&(mxConstants[_0xe4bc[438]]|mxConstants[_0xe4bc[436]]))?0:1;for(_0x5d2ax15=_0x5d2ax14=0;_0x5d2ax15<_0x5d2ax1b[_0xe4bc[67]];_0x5d2ax15++){_0x5d2ax14=_0x5d2ax1b[_0x5d2ax15]&15;_0x5d2ax1a=_0x5d2ax14==mxConstants[_0xe4bc[438]]?3:_0x5d2ax14;_0x5d2ax1a+=_0x5d2ax12;4<_0x5d2ax1a&&(_0x5d2ax1a-=4);_0x5d2ax16=mxEdgeStyle[_0xe4bc[2240]][_0x5d2ax1a-1];_0x5d2ax14=0<_0x5d2ax1a%2?0:1;_0x5d2ax14!=_0x5d2ax4&&(_0x5d2axa++,mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][0]=mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa-1][0],mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][1]=mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa-1][1]);var _0x5d2ax1c=0<(_0x5d2ax1b[_0x5d2ax15]&mxEdgeStyle[_0xe4bc[2241]]),_0x5d2ax19=0<(_0x5d2ax1b[_0x5d2ax15]&mxEdgeStyle[_0xe4bc[2242]]),_0x5d2ax17=(_0x5d2ax1b[_0x5d2ax15]&mxEdgeStyle[_0xe4bc[2243]])>>5,_0x5d2ax17=_0x5d2ax17<<_0x5d2ax12;15<_0x5d2ax17&&(_0x5d2ax17>>=4);_0x5d2ax18=0<(_0x5d2ax1b[_0x5d2ax15]&mxEdgeStyle[_0xe4bc[2244]]);(_0x5d2ax19||_0x5d2ax1c)&&9>_0x5d2ax17?(_0x5d2ax1a=0,_0x5d2ax19=_0x5d2ax19?0:1,_0x5d2ax1a=_0x5d2ax18&&0==_0x5d2ax14?_0x5d2ax5[_0x5d2ax19][0]+_0x5d2ax3[_0x5d2ax19][0]*_0x5d2ax5[_0x5d2ax19][2]:_0x5d2ax18?_0x5d2ax5[_0x5d2ax19][1]+_0x5d2ax3[_0x5d2ax19][1]*_0x5d2ax5[_0x5d2ax19][3]:mxEdgeStyle[_0xe4bc[2235]][_0x5d2ax19][_0x5d2ax17],0==_0x5d2ax14?(_0x5d2ax17=(_0x5d2ax1a-mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][0])*_0x5d2ax16[0],0<_0x5d2ax17&&(mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][0]+=_0x5d2ax16[0]*_0x5d2ax17)):(_0x5d2ax17=(_0x5d2ax1a-mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][1])*_0x5d2ax16[1],0<_0x5d2ax17&&(mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][1]+=_0x5d2ax16[1]*_0x5d2ax17))):_0x5d2ax18&&(mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][0]+=_0x5d2ax16[0]*Math[_0xe4bc[425]](mxEdgeStyle[_0xe4bc[2236]][_0x5d2ax1a]/2),mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][1]+=_0x5d2ax16[1]*Math[_0xe4bc[425]](mxEdgeStyle[_0xe4bc[2236]][_0x5d2ax1a]/2));0<_0x5d2axa&&mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa][_0x5d2ax14]==mxEdgeStyle[_0xe4bc[2239]][_0x5d2axa-1][_0x5d2ax14]?_0x5d2axa--:_0x5d2ax4=_0x5d2ax14};for(_0x5d2ax15=0;_0x5d2ax15<=_0x5d2axa&& !(_0x5d2ax15==_0x5d2axa&&((0<(_0x5d2ax2[1]&(mxConstants[_0xe4bc[438]]|mxConstants[_0xe4bc[436]]))?0:1)==_0x5d2ax13?0:1)!=(_0x5d2axa+1)%2);_0x5d2ax15++){_0x5d2ax9[_0xe4bc[207]]( new mxPoint(mxEdgeStyle[_0xe4bc[2239]][_0x5d2ax15][0],mxEdgeStyle[_0xe4bc[2239]][_0x5d2ax15][1]))}}},getRoutePattern:function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=_0x5d2ax2[0]==mxConstants[_0xe4bc[438]]?3:_0x5d2ax2[0];_0x5d2ax2=_0x5d2ax2[1]==mxConstants[_0xe4bc[438]]?3:_0x5d2ax2[1];_0x5d2ax9-=_0x5d2ax3;_0x5d2ax2-=_0x5d2ax3;1>_0x5d2ax9&&(_0x5d2ax9+=4);1>_0x5d2ax2&&(_0x5d2ax2+=4);_0x5d2ax3=routePatterns[_0x5d2ax9-1][_0x5d2ax2-1];if(0==_0x5d2ax4||0==_0x5d2ax5){null!=inlineRoutePatterns[_0x5d2ax9-1][_0x5d2ax2-1]&&(_0x5d2ax3=inlineRoutePatterns[_0x5d2ax9-1][_0x5d2ax2-1])};return _0x5d2ax3}},mxStyleRegistry={values:[],putValue:function(_0x5d2ax2,_0x5d2ax3){mxStyleRegistry[_0xe4bc[2245]][_0x5d2ax2]=_0x5d2ax3},getValue:function(_0x5d2ax2){return mxStyleRegistry[_0xe4bc[2245]][_0x5d2ax2]},getName:function(_0x5d2ax2){for(var _0x5d2ax3 in mxStyleRegistry[_0xe4bc[2245]]){if(mxStyleRegistry[_0xe4bc[2245]][_0x5d2ax3]==_0x5d2ax2){return _0x5d2ax3}};return null}};mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_ELBOW,mxEdgeStyle.ElbowConnector);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_ENTITY_RELATION,mxEdgeStyle.EntityRelation);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_LOOP,mxEdgeStyle.Loop);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_SIDETOSIDE,mxEdgeStyle.SideToSide);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_TOPTOBOTTOM,mxEdgeStyle.TopToBottom);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_ORTHOGONAL,mxEdgeStyle.OrthConnector);mxStyleRegistry[_0xe4bc[2246]](mxConstants.EDGESTYLE_SEGMENT,mxEdgeStyle.SegmentConnector);mxStyleRegistry[_0xe4bc[2246]](mxConstants.PERIMETER_ELLIPSE,mxPerimeter.EllipsePerimeter);mxStyleRegistry[_0xe4bc[2246]](mxConstants.PERIMETER_RECTANGLE,mxPerimeter.RectanglePerimeter);mxStyleRegistry[_0xe4bc[2246]](mxConstants.PERIMETER_RHOMBUS,mxPerimeter.RhombusPerimeter);mxStyleRegistry[_0xe4bc[2246]](mxConstants.PERIMETER_TRIANGLE,mxPerimeter.TrianglePerimeter);function mxGraphView(_0x5d2ax2){this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[513]]= new mxPoint;this[_0xe4bc[2247]]= new mxRectangle;this[_0xe4bc[1214]]= new mxDictionary}mxGraphView[_0xe4bc[202]]= new mxEventSource;mxGraphView[_0xe4bc[202]][_0xe4bc[196]]=mxGraphView;mxGraphView[_0xe4bc[202]][_0xe4bc[2248]]= new mxPoint;mxGraphView[_0xe4bc[202]][_0xe4bc[2091]]=_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[819]:_0xe4bc[110];mxGraphView[_0xe4bc[202]][_0xe4bc[2249]]=_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[2250]:_0xe4bc[110];mxGraphView[_0xe4bc[202]][_0xe4bc[2251]]= !1;mxGraphView[_0xe4bc[202]][_0xe4bc[2252]]= !0;mxGraphView[_0xe4bc[202]][_0xe4bc[2253]]= !0;mxGraphView[_0xe4bc[202]][_0xe4bc[2254]]= !0;mxGraphView[_0xe4bc[202]][_0xe4bc[1179]]=null;mxGraphView[_0xe4bc[202]][_0xe4bc[1741]]=null;mxGraphView[_0xe4bc[202]][_0xe4bc[2247]]=null;mxGraphView[_0xe4bc[202]][_0xe4bc[255]]=1;mxGraphView[_0xe4bc[202]][_0xe4bc[513]]=null;mxGraphView[_0xe4bc[202]][_0xe4bc[2255]]= !1;mxGraphView[_0xe4bc[202]][_0xe4bc[517]]=function(){return this[_0xe4bc[2247]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2256]]=function(_0x5d2ax2){this[_0xe4bc[2247]]=_0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[1799]]=function(_0x5d2ax2){var _0x5d2ax3=null;if(null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]){for(var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax5++){if(_0x5d2ax4[_0xe4bc[1193]](_0x5d2ax2[_0x5d2ax5])||_0x5d2ax4[_0xe4bc[250]](_0x5d2ax2[_0x5d2ax5])){var _0x5d2ax9=this[_0xe4bc[248]](_0x5d2ax2[_0x5d2ax5]);null!=_0x5d2ax9&&(null==_0x5d2ax3?_0x5d2ax3= new mxRectangle(_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]]):_0x5d2ax3[_0xe4bc[99]](_0x5d2ax9))}}};return _0x5d2ax3};mxGraphView[_0xe4bc[202]][_0xe4bc[2257]]=function(_0x5d2ax2){if(this[_0xe4bc[1741]]!=_0x5d2ax2){var _0x5d2ax3= new mxCurrentRootChange(this,_0x5d2ax2);_0x5d2ax3[_0xe4bc[350]]();var _0x5d2ax4= new mxUndoableEdit(this,!1);_0x5d2ax4[_0xe4bc[99]](_0x5d2ax3);this[_0xe4bc[746]]( new mxEventObject(mxEvent.UNDO,_0xe4bc[1061],_0x5d2ax4));this[_0xe4bc[1179]][_0xe4bc[2258]]()};return _0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[829]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[255]],_0x5d2ax9= new mxPoint(this[_0xe4bc[513]][_0xe4bc[235]],this[_0xe4bc[513]][_0xe4bc[236]]);if(this[_0xe4bc[255]]!=_0x5d2ax2||this[_0xe4bc[513]][_0xe4bc[235]]!=_0x5d2ax3||this[_0xe4bc[513]][_0xe4bc[236]]!=_0x5d2ax4){this[_0xe4bc[255]]=_0x5d2ax2,this[_0xe4bc[513]][_0xe4bc[235]]=_0x5d2ax3,this[_0xe4bc[513]][_0xe4bc[236]]=_0x5d2ax4,this[_0xe4bc[503]]()&&(this[_0xe4bc[2259]](),this[_0xe4bc[1179]][_0xe4bc[2258]]())};this[_0xe4bc[746]]( new mxEventObject(mxEvent.SCALE_AND_TRANSLATE,_0xe4bc[255],_0x5d2ax2,_0xe4bc[2260],_0x5d2ax5,_0xe4bc[513],this[_0xe4bc[513]],_0xe4bc[2261],_0x5d2ax9))};mxGraphView[_0xe4bc[202]][_0xe4bc[518]]=function(){return this[_0xe4bc[255]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2262]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[255]];this[_0xe4bc[255]]!=_0x5d2ax2&&(this[_0xe4bc[255]]=_0x5d2ax2,this[_0xe4bc[503]]()&&(this[_0xe4bc[2259]](),this[_0xe4bc[1179]][_0xe4bc[2258]]()));this[_0xe4bc[746]]( new mxEventObject(mxEvent.SCALE,_0xe4bc[255],_0x5d2ax2,_0xe4bc[2260],_0x5d2ax3))};mxGraphView[_0xe4bc[202]][_0xe4bc[512]]=function(){return this[_0xe4bc[513]]};mxGraphView[_0xe4bc[202]][_0xe4bc[1147]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4= new mxPoint(this[_0xe4bc[513]][_0xe4bc[235]],this[_0xe4bc[513]][_0xe4bc[236]]);if(this[_0xe4bc[513]][_0xe4bc[235]]!=_0x5d2ax2||this[_0xe4bc[513]][_0xe4bc[236]]!=_0x5d2ax3){this[_0xe4bc[513]][_0xe4bc[235]]=_0x5d2ax2,this[_0xe4bc[513]][_0xe4bc[236]]=_0x5d2ax3,this[_0xe4bc[503]]()&&(this[_0xe4bc[2259]](),this[_0xe4bc[1179]][_0xe4bc[2258]]())};this[_0xe4bc[746]]( new mxEventObject(mxEvent.TRANSLATE,_0xe4bc[513],this[_0xe4bc[513]],_0xe4bc[2261],_0x5d2ax4))};mxGraphView[_0xe4bc[202]][_0xe4bc[802]]=function(){null!=this[_0xe4bc[1741]]&&this[_0xe4bc[200]]();this[_0xe4bc[2259]]()};mxGraphView[_0xe4bc[202]][_0xe4bc[2259]]=function(){this[_0xe4bc[2263]]();this[_0xe4bc[2264]]()};mxGraphView[_0xe4bc[202]][_0xe4bc[200]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]]();_0x5d2ax2=_0x5d2ax2||_0x5d2ax5[_0xe4bc[501]]();_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!1;_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!0;this[_0xe4bc[2265]](_0x5d2ax2);if(_0x5d2ax4&&(_0x5d2ax3||_0x5d2ax2!=this[_0xe4bc[1741]])){_0x5d2ax4=_0x5d2ax5[_0xe4bc[262]](_0x5d2ax2);for(var _0x5d2ax9=0;_0x5d2ax9<_0x5d2ax4;_0x5d2ax9++){this[_0xe4bc[200]](_0x5d2ax5[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax9),_0x5d2ax3)}}else {this[_0xe4bc[2263]](_0x5d2ax2)}};mxGraphView[_0xe4bc[202]][_0xe4bc[2263]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[502]]();_0x5d2ax2=_0x5d2ax2||_0x5d2ax9[_0xe4bc[501]]();_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!0;_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:!1;var _0x5d2axa=this[_0xe4bc[248]](_0x5d2ax2);null!=_0x5d2axa&&(_0x5d2axa[_0xe4bc[2080]]= !0,_0x5d2ax5&&(_0x5d2axa[_0xe4bc[2082]]= !0));if(_0x5d2ax3){for(var _0x5d2ax12=_0x5d2ax9[_0xe4bc[262]](_0x5d2ax2),_0x5d2axa=0;_0x5d2axa<_0x5d2ax12;_0x5d2axa++){var _0x5d2ax13=_0x5d2ax9[_0xe4bc[263]](_0x5d2ax2,_0x5d2axa);this[_0xe4bc[2263]](_0x5d2ax13,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5)}};if(_0x5d2ax4){_0x5d2ax5=_0x5d2ax9[_0xe4bc[1707]](_0x5d2ax2);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax5;_0x5d2axa++){this[_0xe4bc[2263]](_0x5d2ax9[_0xe4bc[1708]](_0x5d2ax2,_0x5d2axa),_0x5d2ax3,_0x5d2ax4)}}};mxGraphView[_0xe4bc[202]][_0xe4bc[2264]]=function(_0x5d2ax2){var _0x5d2ax3=mxLog[_0xe4bc[2109]](_0xe4bc[2266]);window[_0xe4bc[879]]=mxResources[_0xe4bc[203]](this[_0xe4bc[2249]])||this[_0xe4bc[2249]];var _0x5d2ax4=null;if(this[_0xe4bc[2253]]&&null!=this[_0xe4bc[510]]&&null==this[_0xe4bc[1653]]&&(8==document[_0xe4bc[5]]||mxClient[_0xe4bc[496]])){_0x5d2ax4=this[_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[495]];this[_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[130];var _0x5d2ax5=document[_0xe4bc[55]](_0xe4bc[485]);_0x5d2ax5[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[493]]=_0xe4bc[494];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[187]]=_0xe4bc[188];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[495]]=mxClient[_0xe4bc[496]]?_0xe4bc[497]:_0xe4bc[498];_0x5d2ax5[_0xe4bc[124]][_0xe4bc[499]]=_0xe4bc[500];document[_0xe4bc[112]][_0xe4bc[62]](_0x5d2ax5);this[_0xe4bc[1653]]=_0x5d2ax5};_0x5d2ax2=_0x5d2ax2||(null!=this[_0xe4bc[1741]]?this[_0xe4bc[1741]]:this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[501]]());this[_0xe4bc[2267]](null,_0x5d2ax2);_0x5d2ax2=this[_0xe4bc[2268]](null,_0x5d2ax2);null==_0x5d2ax2&&(_0x5d2ax2= new mxRectangle);this[_0xe4bc[2256]](_0x5d2ax2);this[_0xe4bc[2269]]();null!=_0x5d2ax4&&(this[_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[495]]=_0x5d2ax4,document[_0xe4bc[112]][_0xe4bc[266]](this[_0xe4bc[1653]]),this[_0xe4bc[1653]]=null);window[_0xe4bc[879]]=mxResources[_0xe4bc[203]](this[_0xe4bc[2091]])||this[_0xe4bc[2091]];mxLog[_0xe4bc[2110]](_0xe4bc[2266],_0x5d2ax3)};mxGraphView[_0xe4bc[202]][_0xe4bc[2270]]=function(_0x5d2ax2){return new mxRectangleShape(_0x5d2ax2,_0xe4bc[1391],_0xe4bc[586])};mxGraphView[_0xe4bc[202]][_0xe4bc[2269]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[2271]]();if(null!=_0x5d2ax2){if(null==this[_0xe4bc[1617]]||this[_0xe4bc[1617]][_0xe4bc[618]]!=_0x5d2ax2[_0xe4bc[390]]){null!=this[_0xe4bc[1617]]&&this[_0xe4bc[1617]][_0xe4bc[515]]();var _0x5d2ax3= new mxRectangle(0,0,1,1);this[_0xe4bc[1617]]= new mxImageShape(_0x5d2ax3,_0x5d2ax2[_0xe4bc[390]]);this[_0xe4bc[1617]][_0xe4bc[507]]=this[_0xe4bc[1179]][_0xe4bc[507]];this[_0xe4bc[1617]][_0xe4bc[176]](this[_0xe4bc[2053]]);this[_0xe4bc[1617]][_0xe4bc[258]]()};this[_0xe4bc[2272]](this[_0xe4bc[1617]],_0x5d2ax2)}else {null!=this[_0xe4bc[1617]]&&(this[_0xe4bc[1617]][_0xe4bc[515]](),this[_0xe4bc[1617]]=null)};this[_0xe4bc[1179]][_0xe4bc[2273]]?(_0x5d2ax3=this[_0xe4bc[2274]](),null==this[_0xe4bc[2275]]?(this[_0xe4bc[2275]]=this[_0xe4bc[2270]](_0x5d2ax3),this[_0xe4bc[2275]][_0xe4bc[255]]=this[_0xe4bc[255]],this[_0xe4bc[2275]][_0xe4bc[1596]]= !0,this[_0xe4bc[2275]][_0xe4bc[507]]=this[_0xe4bc[1179]][_0xe4bc[507]],this[_0xe4bc[2275]][_0xe4bc[176]](this[_0xe4bc[2053]]),this[_0xe4bc[2275]][_0xe4bc[258]](),mxEvent[_0xe4bc[169]](this[_0xe4bc[2275]][_0xe4bc[252]],_0xe4bc[760],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1179]][_0xe4bc[761]](_0x5d2ax2)})),mxEvent[_0xe4bc[759]](this[_0xe4bc[2275]][_0xe4bc[252]],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1179]][_0xe4bc[758]](mxEvent.MOUSE_DOWN, new mxMouseEvent(_0x5d2ax2))}),mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){null!=this[_0xe4bc[1179]][_0xe4bc[2276]]&&this[_0xe4bc[1179]][_0xe4bc[2276]][_0xe4bc[2277]]()&&this[_0xe4bc[1179]][_0xe4bc[2276]][_0xe4bc[801]]();this[_0xe4bc[1179]][_0xe4bc[1009]]&&!mxEvent[_0xe4bc[721]](_0x5d2ax2)&&this[_0xe4bc[1179]][_0xe4bc[758]](mxEvent.MOUSE_MOVE, new mxMouseEvent(_0x5d2ax2))}),mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1179]][_0xe4bc[758]](mxEvent.MOUSE_UP, new mxMouseEvent(_0x5d2ax2))}))):(this[_0xe4bc[2275]][_0xe4bc[255]]=this[_0xe4bc[255]],this[_0xe4bc[2275]][_0xe4bc[1562]]=_0x5d2ax3,this[_0xe4bc[2275]][_0xe4bc[258]]())):null!=this[_0xe4bc[2275]]&&(this[_0xe4bc[2275]][_0xe4bc[515]](),this[_0xe4bc[2275]]=null)};mxGraphView[_0xe4bc[202]][_0xe4bc[2274]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[2013]],_0x5d2ax3=this[_0xe4bc[255]]*this[_0xe4bc[1179]][_0xe4bc[2012]];return new mxRectangle(this[_0xe4bc[255]]*this[_0xe4bc[513]][_0xe4bc[235]],this[_0xe4bc[255]]*this[_0xe4bc[513]][_0xe4bc[236]],_0x5d2ax2[_0xe4bc[117]]*_0x5d2ax3,_0x5d2ax2[_0xe4bc[119]]*_0x5d2ax3)};mxGraphView[_0xe4bc[202]][_0xe4bc[2272]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax2[_0xe4bc[255]]=this[_0xe4bc[255]];_0x5d2ax2[_0xe4bc[1562]][_0xe4bc[235]]=this[_0xe4bc[255]]*this[_0xe4bc[513]][_0xe4bc[235]];_0x5d2ax2[_0xe4bc[1562]][_0xe4bc[236]]=this[_0xe4bc[255]]*this[_0xe4bc[513]][_0xe4bc[236]];_0x5d2ax2[_0xe4bc[1562]][_0xe4bc[117]]=this[_0xe4bc[255]]*_0x5d2ax3[_0xe4bc[117]];_0x5d2ax2[_0xe4bc[1562]][_0xe4bc[119]]=this[_0xe4bc[255]]*_0x5d2ax3[_0xe4bc[119]];_0x5d2ax2[_0xe4bc[258]]()};mxGraphView[_0xe4bc[202]][_0xe4bc[2267]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=this[_0xe4bc[248]](_0x5d2ax3,!0);if(null!=_0x5d2ax5&&_0x5d2ax5[_0xe4bc[2080]]){if(this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax3)){if(_0x5d2ax3!=this[_0xe4bc[1741]]&&null!=_0x5d2ax2){_0x5d2ax5[_0xe4bc[2079]][_0xe4bc[235]]=0;_0x5d2ax5[_0xe4bc[2079]][_0xe4bc[236]]=0;_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[2078]][_0xe4bc[235]];_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[2078]][_0xe4bc[236]];var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax3);if(null!=_0x5d2ax9){if(!_0x5d2ax4[_0xe4bc[250]](_0x5d2ax3)){var _0x5d2axa=_0x5d2ax9[_0xe4bc[1368]]||this[_0xe4bc[2248]];_0x5d2ax9[_0xe4bc[1500]]?(_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[235]]+=_0x5d2ax9[_0xe4bc[235]]*_0x5d2ax2[_0xe4bc[117]]/this[_0xe4bc[255]]+_0x5d2axa[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[236]]+=_0x5d2ax9[_0xe4bc[236]]*_0x5d2ax2[_0xe4bc[119]]/this[_0xe4bc[255]]+_0x5d2axa[_0xe4bc[236]]):(_0x5d2ax5[_0xe4bc[2079]][_0xe4bc[235]]=this[_0xe4bc[255]]*_0x5d2axa[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[2079]][_0xe4bc[236]]=this[_0xe4bc[255]]*_0x5d2axa[_0xe4bc[236]],_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[235]]+=_0x5d2ax9[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[236]]+=_0x5d2ax9[_0xe4bc[236]])};_0x5d2ax5[_0xe4bc[235]]=this[_0xe4bc[255]]*(this[_0xe4bc[513]][_0xe4bc[235]]+_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[235]]);_0x5d2ax5[_0xe4bc[236]]=this[_0xe4bc[255]]*(this[_0xe4bc[513]][_0xe4bc[236]]+_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[236]]);_0x5d2ax5[_0xe4bc[117]]=this[_0xe4bc[255]]*_0x5d2ax9[_0xe4bc[117]];_0x5d2ax5[_0xe4bc[119]]=this[_0xe4bc[255]]*_0x5d2ax9[_0xe4bc[119]];if(_0x5d2ax4[_0xe4bc[1193]](_0x5d2ax3)){if(_0x5d2ax9[_0xe4bc[1500]]&&(_0x5d2axa=mxUtils[_0xe4bc[431]](_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]),0!=_0x5d2axa)){var _0x5d2ax9=Math[_0xe4bc[426]](_0x5d2axa),_0x5d2axa=Math[_0xe4bc[427]](_0x5d2axa),_0x5d2ax12= new mxPoint(_0x5d2ax5[_0xe4bc[241]](),_0x5d2ax5[_0xe4bc[242]]()),_0x5d2ax13= new mxPoint(_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax2[_0xe4bc[242]]()),_0x5d2ax9=mxUtils[_0xe4bc[432]](_0x5d2ax12,_0x5d2ax9,_0x5d2axa,_0x5d2ax13);_0x5d2ax5[_0xe4bc[235]]=_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax5[_0xe4bc[117]]/2;_0x5d2ax5[_0xe4bc[236]]=_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax5[_0xe4bc[119]]/2};this[_0xe4bc[2279]](_0x5d2ax5)}}}}else {this[_0xe4bc[2265]](_0x5d2ax3)};_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[2280]](_0x5d2ax3);null!=_0x5d2axa&&(_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[235]]+=_0x5d2axa[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[2078]][_0xe4bc[236]]+=_0x5d2axa[_0xe4bc[236]])};if(null!=_0x5d2ax5&&(!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax3)||_0x5d2ax3==this[_0xe4bc[1741]])){_0x5d2ax9=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax3);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax9;_0x5d2axa++){_0x5d2ax12=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax3,_0x5d2axa),this[_0xe4bc[2267]](_0x5d2ax5,_0x5d2ax12)}}};mxGraphView[_0xe4bc[202]][_0xe4bc[2279]]=function(_0x5d2ax2){var _0x5d2ax3=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);_0x5d2ax3==mxConstants[_0xe4bc[2132]]?_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[235]]-=_0x5d2ax2[_0xe4bc[117]]:_0x5d2ax3==mxConstants[_0xe4bc[480]]&&(_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[235]]+=_0x5d2ax2[_0xe4bc[117]]);_0x5d2ax3=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE);_0x5d2ax3==mxConstants[_0xe4bc[1687]]?_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[236]]-=_0x5d2ax2[_0xe4bc[119]]:_0x5d2ax3==mxConstants[_0xe4bc[482]]&&(_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[236]]+=_0x5d2ax2[_0xe4bc[119]])};mxGraphView[_0xe4bc[202]][_0xe4bc[2268]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=this[_0xe4bc[248]](_0x5d2ax3),_0x5d2ax9=null;if(null!=_0x5d2ax5){if(_0x5d2ax5[_0xe4bc[2080]]){var _0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax3);if(null!=_0x5d2axa&&_0x5d2ax4[_0xe4bc[250]](_0x5d2ax3)){var _0x5d2ax12=this[_0xe4bc[248]](this[_0xe4bc[1710]](_0x5d2ax3,!0));_0x5d2ax5[_0xe4bc[2090]](_0x5d2ax12,!0);if(null!=_0x5d2ax12&&_0x5d2ax4[_0xe4bc[250]](_0x5d2ax12[_0xe4bc[246]])&&!_0x5d2ax4[_0xe4bc[1720]](_0x5d2ax12[_0xe4bc[246]],_0x5d2ax3)){var _0x5d2ax13=this[_0xe4bc[248]](_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax12[_0xe4bc[246]]));this[_0xe4bc[2268]](_0x5d2ax13,_0x5d2ax12[_0xe4bc[246]])};var _0x5d2ax14=this[_0xe4bc[248]](this[_0xe4bc[1710]](_0x5d2ax3,!1));_0x5d2ax5[_0xe4bc[2090]](_0x5d2ax14,!1);null!=_0x5d2ax14&&(_0x5d2ax4[_0xe4bc[250]](_0x5d2ax14[_0xe4bc[246]])&&!_0x5d2ax4[_0xe4bc[1720]](_0x5d2ax14[_0xe4bc[246]],_0x5d2ax3))&&(_0x5d2ax13=this[_0xe4bc[248]](_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax14[_0xe4bc[246]])),this[_0xe4bc[2268]](_0x5d2ax13,_0x5d2ax14[_0xe4bc[246]]));this[_0xe4bc[2281]](_0x5d2ax5,_0x5d2ax12,_0x5d2ax14);this[_0xe4bc[2282]](_0x5d2ax5,_0x5d2axa[_0xe4bc[1525]],_0x5d2ax12,_0x5d2ax14);this[_0xe4bc[2283]](_0x5d2ax5,_0x5d2ax12,_0x5d2ax14);this[_0xe4bc[2284]](_0x5d2ax5);this[_0xe4bc[2285]](_0x5d2ax5)}else {null!=_0x5d2axa&&(_0x5d2axa[_0xe4bc[1500]]&&null!=_0x5d2ax2&&_0x5d2ax4[_0xe4bc[250]](_0x5d2ax2[_0xe4bc[246]]))&&(_0x5d2axa=this[_0xe4bc[245]](_0x5d2ax2,_0x5d2axa),null!=_0x5d2axa&&(_0x5d2ax5[_0xe4bc[235]]=_0x5d2axa[_0xe4bc[235]],_0x5d2ax5[_0xe4bc[236]]=_0x5d2axa[_0xe4bc[236]],_0x5d2axa[_0xe4bc[235]]=_0x5d2axa[_0xe4bc[235]]/this[_0xe4bc[255]]-this[_0xe4bc[513]][_0xe4bc[235]],_0x5d2axa[_0xe4bc[236]]=_0x5d2axa[_0xe4bc[236]]/this[_0xe4bc[255]]-this[_0xe4bc[513]][_0xe4bc[236]],_0x5d2ax5[_0xe4bc[2078]]=_0x5d2axa,this[_0xe4bc[2286]](_0x5d2ax2,_0x5d2ax5)))};_0x5d2ax5[_0xe4bc[2080]]= !1;_0x5d2ax3!=this[_0xe4bc[1741]]&&this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[258]](_0x5d2ax5,!1,this[_0xe4bc[2287]]())};if(_0x5d2ax4[_0xe4bc[250]](_0x5d2ax3)||_0x5d2ax4[_0xe4bc[1193]](_0x5d2ax3)){null!=_0x5d2ax5[_0xe4bc[253]]&&null!=_0x5d2ax5[_0xe4bc[253]][_0xe4bc[1563]]&&(_0x5d2ax9=_0x5d2ax5[_0xe4bc[253]][_0xe4bc[1563]][_0xe4bc[238]]()),null!=_0x5d2ax5[_0xe4bc[963]]&&!this[_0xe4bc[1179]][_0xe4bc[2130]](_0x5d2ax5[_0xe4bc[246]])&&null!=_0x5d2ax5[_0xe4bc[963]][_0xe4bc[1563]]&&(null!=_0x5d2ax9?_0x5d2ax9[_0xe4bc[99]](_0x5d2ax5[_0xe4bc[963]][_0xe4bc[1563]]):_0x5d2ax9=_0x5d2ax5[_0xe4bc[963]][_0xe4bc[1563]][_0xe4bc[238]]())}};if(null!=_0x5d2ax5&&(!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax3)||_0x5d2ax3==this[_0xe4bc[1741]])){_0x5d2axa=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax3);for(_0x5d2ax12=0;_0x5d2ax12<_0x5d2axa;_0x5d2ax12++){_0x5d2ax13=_0x5d2ax4[_0xe4bc[263]](_0x5d2ax3,_0x5d2ax12),_0x5d2ax13=this[_0xe4bc[2268]](_0x5d2ax5,_0x5d2ax13),null!=_0x5d2ax13&&(null==_0x5d2ax9?_0x5d2ax9=_0x5d2ax13:_0x5d2ax9[_0xe4bc[99]](_0x5d2ax13))}};return _0x5d2ax9};mxGraphView[_0xe4bc[202]][_0xe4bc[2286]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[246]];if(!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax4)||_0x5d2ax4==this[_0xe4bc[1741]]){for(var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax9=_0x5d2ax5[_0xe4bc[262]](_0x5d2ax4),_0x5d2axa=0;_0x5d2axa<_0x5d2ax9;_0x5d2axa++){this[_0xe4bc[2267]](_0x5d2ax3,_0x5d2ax5[_0xe4bc[263]](_0x5d2ax4,_0x5d2axa))}}};mxGraphView[_0xe4bc[202]][_0xe4bc[2281]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[2289]](_0x5d2ax2,_0x5d2ax3,!0,this[_0xe4bc[1179]][_0xe4bc[2288]](_0x5d2ax2,_0x5d2ax3,!0));this[_0xe4bc[2289]](_0x5d2ax2,_0x5d2ax4,!1,this[_0xe4bc[1179]][_0xe4bc[2288]](_0x5d2ax2,_0x5d2ax4,!1))};mxGraphView[_0xe4bc[202]][_0xe4bc[2289]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=null;null!=_0x5d2ax5&&(_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[2290]](_0x5d2ax3,_0x5d2ax5));if(null==_0x5d2ax9&&null==_0x5d2ax3){_0x5d2ax3=this[_0xe4bc[255]];_0x5d2ax5=this[_0xe4bc[513]];var _0x5d2axa=_0x5d2ax2[_0xe4bc[2078]],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax2[_0xe4bc[246]])[_0xe4bc[2006]](_0x5d2ax4);null!=_0x5d2ax9&&(_0x5d2ax9= new mxPoint(_0x5d2ax3*(_0x5d2ax5[_0xe4bc[235]]+_0x5d2ax9[_0xe4bc[235]]+_0x5d2axa[_0xe4bc[235]]),_0x5d2ax3*(_0x5d2ax5[_0xe4bc[236]]+_0x5d2ax9[_0xe4bc[236]]+_0x5d2axa[_0xe4bc[236]])))};_0x5d2ax2[_0xe4bc[2088]](_0x5d2ax9,_0x5d2ax4)};mxGraphView[_0xe4bc[202]][_0xe4bc[2282]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax2){var _0x5d2ax9=[];_0x5d2ax9[_0xe4bc[207]](_0x5d2ax2[_0xe4bc[439]][0]);var _0x5d2axa=this[_0xe4bc[2291]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5);if(null!=_0x5d2axa){_0x5d2ax4=this[_0xe4bc[2292]](_0x5d2ax2,_0x5d2ax4,!0),_0x5d2ax5=this[_0xe4bc[2292]](_0x5d2ax2,_0x5d2ax5,!1),_0x5d2axa(_0x5d2ax2,_0x5d2ax4,_0x5d2ax5,_0x5d2ax3,_0x5d2ax9)}else {if(null!=_0x5d2ax3){for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax3[_0xe4bc[67]];_0x5d2axa++){null!=_0x5d2ax3[_0x5d2axa]&&(_0x5d2ax5=mxUtils[_0xe4bc[238]](_0x5d2ax3[_0x5d2axa]),_0x5d2ax9[_0xe4bc[207]](this[_0xe4bc[2229]](_0x5d2ax2,_0x5d2ax5)))}}};_0x5d2ax3=_0x5d2ax2[_0xe4bc[439]];_0x5d2ax9[_0xe4bc[207]](_0x5d2ax3[_0x5d2ax3[_0xe4bc[67]]-1]);_0x5d2ax2[_0xe4bc[439]]=_0x5d2ax9}};mxGraphView[_0xe4bc[202]][_0xe4bc[2229]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[2078]];return new mxPoint(this[_0xe4bc[255]]*(_0x5d2ax3[_0xe4bc[235]]+this[_0xe4bc[513]][_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[235]]),this[_0xe4bc[255]]*(_0x5d2ax3[_0xe4bc[236]]+this[_0xe4bc[513]][_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[236]]))};mxGraphView[_0xe4bc[202]][_0xe4bc[2291]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax2=null!=_0x5d2ax4&&_0x5d2ax4==_0x5d2ax5?mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_LOOP,this[_0xe4bc[1179]][_0xe4bc[2293]]):!mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_NOEDGESTYLE,!1)?_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2294]]]:null;_0xe4bc[1516]== typeof _0x5d2ax2&&(_0x5d2ax3=mxStyleRegistry[_0xe4bc[433]](_0x5d2ax2),null==_0x5d2ax3&&this[_0xe4bc[2295]]()&&(_0x5d2ax3=mxUtils[_0xe4bc[1545]](_0x5d2ax2)),_0x5d2ax2=_0x5d2ax3);return _0xe4bc[279]== typeof _0x5d2ax2?_0x5d2ax2:null};mxGraphView[_0xe4bc[202]][_0xe4bc[2283]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax2[_0xe4bc[439]],_0x5d2ax9=_0x5d2ax5[0];null==_0x5d2ax5[_0x5d2ax5[_0xe4bc[67]]-1]&&null!=_0x5d2ax4&&this[_0xe4bc[2296]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax3,!1);null==_0x5d2ax9&&null!=_0x5d2ax3&&this[_0xe4bc[2296]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,!0)};mxGraphView[_0xe4bc[202]][_0xe4bc[2296]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax3=this[_0xe4bc[2292]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax5);var _0x5d2ax9=this[_0xe4bc[2297]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax5),_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[2298]](_0x5d2ax2);_0x5d2ax4=mxUtils[_0xe4bc[431]](Number(_0x5d2ax3[_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]));var _0x5d2ax12= new mxPoint(_0x5d2ax3[_0xe4bc[241]](),_0x5d2ax3[_0xe4bc[242]]());if(0!=_0x5d2ax4){var _0x5d2ax13=Math[_0xe4bc[426]](-_0x5d2ax4),_0x5d2ax14=Math[_0xe4bc[427]](-_0x5d2ax4),_0x5d2ax9=mxUtils[_0xe4bc[432]](_0x5d2ax9,_0x5d2ax13,_0x5d2ax14,_0x5d2ax12)};_0x5d2ax13=parseFloat(_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2299]]]||0);_0x5d2ax13+=parseFloat(_0x5d2ax2[_0xe4bc[124]][_0x5d2ax5?mxConstants[_0xe4bc[2300]]:mxConstants[_0xe4bc[2301]]]||0);_0x5d2ax3=this[_0xe4bc[2302]](_0x5d2ax3,_0x5d2ax9,0==_0x5d2ax4&&_0x5d2axa,_0x5d2ax13);0!=_0x5d2ax4&&(_0x5d2ax13=Math[_0xe4bc[426]](_0x5d2ax4),_0x5d2ax14=Math[_0xe4bc[427]](_0x5d2ax4),_0x5d2ax3=mxUtils[_0xe4bc[432]](_0x5d2ax3,_0x5d2ax13,_0x5d2ax14,_0x5d2ax12));_0x5d2ax2[_0xe4bc[2088]](_0x5d2ax3,_0x5d2ax5)};mxGraphView[_0xe4bc[202]][_0xe4bc[2292]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],_0x5d2ax4?mxConstants[_0xe4bc[2303]]:mxConstants[_0xe4bc[2304]]);null!=_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[248]](this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[736]](_0x5d2ax2)),null!=_0x5d2ax2&&(_0x5d2ax3=_0x5d2ax2));return _0x5d2ax3};mxGraphView[_0xe4bc[202]][_0xe4bc[2302]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=null;if(null!=_0x5d2ax2){var _0x5d2axa=this[_0xe4bc[2305]](_0x5d2ax2);if(null!=_0x5d2axa&&null!=_0x5d2ax3&&(_0x5d2ax5=this[_0xe4bc[2087]](_0x5d2ax2,_0x5d2ax5),0<_0x5d2ax5[_0xe4bc[117]]||0<_0x5d2ax5[_0xe4bc[119]])){_0x5d2ax9=_0x5d2axa(_0x5d2ax5,_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)};null==_0x5d2ax9&&(_0x5d2ax9=this[_0xe4bc[245]](_0x5d2ax2))};return _0x5d2ax9};mxGraphView[_0xe4bc[202]][_0xe4bc[2230]]=function(_0x5d2ax2){var _0x5d2ax3=null!=_0x5d2ax2[_0xe4bc[124]]?parseFloat(_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2306]]])||0:0;return _0x5d2ax2[_0xe4bc[241]]()+_0x5d2ax3*_0x5d2ax2[_0xe4bc[117]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2228]]=function(_0x5d2ax2){var _0x5d2ax3=null!=_0x5d2ax2[_0xe4bc[124]]?parseFloat(_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2307]]])||0:0;return _0x5d2ax2[_0xe4bc[242]]()+_0x5d2ax3*_0x5d2ax2[_0xe4bc[119]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2087]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:0;null!=_0x5d2ax2&&(_0x5d2ax3+=parseFloat(_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2299]]]||0));return _0x5d2ax2[_0xe4bc[2087]](_0x5d2ax3*this[_0xe4bc[255]])};mxGraphView[_0xe4bc[202]][_0xe4bc[2305]]=function(_0x5d2ax2){_0x5d2ax2=_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2061]]];if(_0xe4bc[1516]== typeof _0x5d2ax2){var _0x5d2ax3=mxStyleRegistry[_0xe4bc[433]](_0x5d2ax2);null==_0x5d2ax3&&this[_0xe4bc[2295]]()&&(_0x5d2ax3=mxUtils[_0xe4bc[1545]](_0x5d2ax2));_0x5d2ax2=_0x5d2ax3};return _0xe4bc[279]== typeof _0x5d2ax2?_0x5d2ax2:null};mxGraphView[_0xe4bc[202]][_0xe4bc[2297]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=_0x5d2ax2[_0xe4bc[439]];var _0x5d2ax5=null;if(null!=_0x5d2ax2&&(_0x5d2ax4||2<_0x5d2ax2[_0xe4bc[67]]||null==_0x5d2ax3)){_0x5d2ax5=_0x5d2ax2[_0xe4bc[67]],_0x5d2ax5=_0x5d2ax2[_0x5d2ax4?Math[_0xe4bc[243]](1,_0x5d2ax5-1):Math[_0xe4bc[160]](0,_0x5d2ax5-2)]};null==_0x5d2ax5&&null!=_0x5d2ax3&&(_0x5d2ax5= new mxPoint(_0x5d2ax3[_0xe4bc[241]](),_0x5d2ax3[_0xe4bc[242]]()));return _0x5d2ax5};mxGraphView[_0xe4bc[202]][_0xe4bc[1710]]=function(_0x5d2ax2,_0x5d2ax3){for(var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=_0x5d2ax4[_0xe4bc[1709]](_0x5d2ax2,_0x5d2ax3),_0x5d2ax9=_0x5d2ax5;null!=_0x5d2ax5&&_0x5d2ax5!=this[_0xe4bc[1741]];){if(!this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax9)||this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax5)){_0x5d2ax9=_0x5d2ax5};_0x5d2ax5=_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax5)};_0x5d2ax4[_0xe4bc[1197]](_0x5d2ax9)==_0x5d2ax4[_0xe4bc[501]]()&&(_0x5d2ax9=null);return _0x5d2ax9};mxGraphView[_0xe4bc[202]][_0xe4bc[2284]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[439]];_0x5d2ax2[_0xe4bc[67]]=0;if(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]){var _0x5d2ax4=_0x5d2ax3[0],_0x5d2ax5=_0x5d2ax3[_0x5d2ax3[_0xe4bc[67]]-1];if(null==_0x5d2ax4||null==_0x5d2ax5){_0x5d2ax2[_0xe4bc[246]]!=this[_0xe4bc[1741]]&&this[_0xe4bc[200]](_0x5d2ax2[_0xe4bc[246]],!0)}else {if(_0x5d2ax4[_0xe4bc[235]]!=_0x5d2ax5[_0xe4bc[235]]||_0x5d2ax4[_0xe4bc[236]]!=_0x5d2ax5[_0xe4bc[236]]){var _0x5d2ax9=_0x5d2ax5[_0xe4bc[235]]-_0x5d2ax4[_0xe4bc[235]],_0x5d2axa=_0x5d2ax5[_0xe4bc[236]]-_0x5d2ax4[_0xe4bc[236]];_0x5d2ax2[_0xe4bc[2085]]=Math[_0xe4bc[428]](_0x5d2ax9*_0x5d2ax9+_0x5d2axa*_0x5d2axa)}else {_0x5d2ax2[_0xe4bc[2085]]=0};var _0x5d2ax5=0,_0x5d2ax12=[],_0x5d2axa=_0x5d2ax4;if(null!=_0x5d2axa){for(var _0x5d2ax4=_0x5d2axa[_0xe4bc[235]],_0x5d2ax13=_0x5d2axa[_0xe4bc[236]],_0x5d2ax14=_0x5d2ax4,_0x5d2ax15=_0x5d2ax13,_0x5d2ax16=1;_0x5d2ax16<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax16++){var _0x5d2ax17=_0x5d2ax3[_0x5d2ax16];null!=_0x5d2ax17&&(_0x5d2ax9=_0x5d2axa[_0xe4bc[235]]-_0x5d2ax17[_0xe4bc[235]],_0x5d2axa=_0x5d2axa[_0xe4bc[236]]-_0x5d2ax17[_0xe4bc[236]],_0x5d2ax9=Math[_0xe4bc[428]](_0x5d2ax9*_0x5d2ax9+_0x5d2axa*_0x5d2axa),_0x5d2ax12[_0xe4bc[207]](_0x5d2ax9),_0x5d2ax5+=_0x5d2ax9,_0x5d2axa=_0x5d2ax17,_0x5d2ax4=Math[_0xe4bc[243]](_0x5d2axa[_0xe4bc[235]],_0x5d2ax4),_0x5d2ax13=Math[_0xe4bc[243]](_0x5d2axa[_0xe4bc[236]],_0x5d2ax13),_0x5d2ax14=Math[_0xe4bc[160]](_0x5d2axa[_0xe4bc[235]],_0x5d2ax14),_0x5d2ax15=Math[_0xe4bc[160]](_0x5d2axa[_0xe4bc[236]],_0x5d2ax15))};_0x5d2ax2[_0xe4bc[67]]=_0x5d2ax5;_0x5d2ax2[_0xe4bc[2086]]=_0x5d2ax12;_0x5d2ax2[_0xe4bc[235]]=_0x5d2ax4;_0x5d2ax2[_0xe4bc[236]]=_0x5d2ax13;_0x5d2ax2[_0xe4bc[117]]=Math[_0xe4bc[160]](1,_0x5d2ax14-_0x5d2ax4);_0x5d2ax2[_0xe4bc[119]]=Math[_0xe4bc[160]](1,_0x5d2ax15-_0x5d2ax13)}}}};mxGraphView[_0xe4bc[202]][_0xe4bc[245]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax5=_0x5d2ax2[_0xe4bc[242]]();if(null!=_0x5d2ax2[_0xe4bc[2086]]&&(null==_0x5d2ax3||_0x5d2ax3[_0xe4bc[1500]])){for(var _0x5d2ax9=_0x5d2ax2[_0xe4bc[439]][_0xe4bc[67]],_0x5d2axa=((null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[235]]/2:0)+0.5)*_0x5d2ax2[_0xe4bc[67]],_0x5d2ax12=_0x5d2ax2[_0xe4bc[2086]][0],_0x5d2ax13=0,_0x5d2ax14=1;_0x5d2axa>_0x5d2ax13+_0x5d2ax12&&_0x5d2ax14<_0x5d2ax9-1;){_0x5d2ax13+=_0x5d2ax12,_0x5d2ax12=_0x5d2ax2[_0xe4bc[2086]][_0x5d2ax14++]};_0x5d2ax9=0==_0x5d2ax12?0:(_0x5d2axa-_0x5d2ax13)/_0x5d2ax12;_0x5d2axa=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax14-1];_0x5d2ax14=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax14];if(null!=_0x5d2axa&&null!=_0x5d2ax14){_0x5d2ax13=_0x5d2ax4=_0x5d2ax5=0;if(null!=_0x5d2ax3){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[236]],_0x5d2ax15=_0x5d2ax3[_0xe4bc[1368]];null!=_0x5d2ax15&&(_0x5d2ax4=_0x5d2ax15[_0xe4bc[235]],_0x5d2ax13=_0x5d2ax15[_0xe4bc[236]])};_0x5d2ax15=_0x5d2ax14[_0xe4bc[235]]-_0x5d2axa[_0xe4bc[235]];_0x5d2ax14=_0x5d2ax14[_0xe4bc[236]]-_0x5d2axa[_0xe4bc[236]];_0x5d2ax4=_0x5d2axa[_0xe4bc[235]]+_0x5d2ax15*_0x5d2ax9+((0==_0x5d2ax12?0:_0x5d2ax14/_0x5d2ax12)*_0x5d2ax5+_0x5d2ax4)*this[_0xe4bc[255]];_0x5d2ax5=_0x5d2axa[_0xe4bc[236]]+_0x5d2ax14*_0x5d2ax9-((0==_0x5d2ax12?0:_0x5d2ax15/_0x5d2ax12)*_0x5d2ax5-_0x5d2ax13)*this[_0xe4bc[255]]}}else {null!=_0x5d2ax3&&(_0x5d2ax15=_0x5d2ax3[_0xe4bc[1368]],null!=_0x5d2ax15&&(_0x5d2ax4+=_0x5d2ax15[_0xe4bc[235]],_0x5d2ax5+=_0x5d2ax15[_0xe4bc[236]]))};return new mxPoint(_0x5d2ax4,_0x5d2ax5)};mxGraphView[_0xe4bc[202]][_0xe4bc[2308]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1721]](_0x5d2ax2[_0xe4bc[246]]);if(null!=_0x5d2ax5){var _0x5d2ax9=_0x5d2ax2[_0xe4bc[439]][_0xe4bc[67]];if(_0x5d2ax5[_0xe4bc[1500]]&&1<_0x5d2ax9){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[67]],_0x5d2axa=_0x5d2ax2[_0xe4bc[2086]],_0x5d2ax12=_0x5d2ax2[_0xe4bc[439]][0],_0x5d2ax13=_0x5d2ax2[_0xe4bc[439]][1],_0x5d2ax14=mxUtils[_0xe4bc[440]](_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4),_0x5d2ax15=0,_0x5d2ax16=0,_0x5d2ax17=0,_0x5d2ax18=2;_0x5d2ax18<_0x5d2ax9;_0x5d2ax18++){_0x5d2ax16+=_0x5d2axa[_0x5d2ax18-2],_0x5d2ax13=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax18],_0x5d2ax12=mxUtils[_0xe4bc[440]](_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4),_0x5d2ax12<=_0x5d2ax14&&(_0x5d2ax14=_0x5d2ax12,_0x5d2ax15=_0x5d2ax18-1,_0x5d2ax17=_0x5d2ax16),_0x5d2ax12=_0x5d2ax13};_0x5d2ax9=_0x5d2axa[_0x5d2ax15];_0x5d2ax12=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax15];_0x5d2ax13=_0x5d2ax2[_0xe4bc[439]][_0x5d2ax15+1];_0x5d2ax14=_0x5d2ax13[_0xe4bc[235]];_0x5d2axa=_0x5d2ax13[_0xe4bc[236]];_0x5d2ax2=_0x5d2ax12[_0xe4bc[235]]-_0x5d2ax14;_0x5d2ax15=_0x5d2ax12[_0xe4bc[236]]-_0x5d2axa;_0x5d2ax14=_0x5d2ax3-_0x5d2ax14;_0x5d2axa=_0x5d2ax4-_0x5d2axa;_0x5d2ax14=_0x5d2ax2-_0x5d2ax14;_0x5d2axa=_0x5d2ax15-_0x5d2axa;_0x5d2axa=_0x5d2ax14*_0x5d2ax2+_0x5d2axa*_0x5d2ax15;_0x5d2ax2=Math[_0xe4bc[428]](0>=_0x5d2axa?0:_0x5d2axa*_0x5d2axa/(_0x5d2ax2*_0x5d2ax2+_0x5d2ax15*_0x5d2ax15));_0x5d2ax2>_0x5d2ax9&&(_0x5d2ax2=_0x5d2ax9);_0x5d2ax9=Math[_0xe4bc[428]](mxUtils[_0xe4bc[440]](_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4));-1==mxUtils[_0xe4bc[2309]](_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax13[_0xe4bc[235]],_0x5d2ax13[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4)&&(_0x5d2ax9= -_0x5d2ax9);return new mxPoint(-2*((_0x5d2ax5/2-_0x5d2ax17-_0x5d2ax2)/_0x5d2ax5),_0x5d2ax9/this[_0xe4bc[255]])}};return new mxPoint};mxGraphView[_0xe4bc[202]][_0xe4bc[2285]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[439]];_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[235]]=_0x5d2ax2[_0xe4bc[241]]();_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[236]]=_0x5d2ax2[_0xe4bc[242]]();if(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]&&null!=_0x5d2ax2[_0xe4bc[2086]]){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax2[_0xe4bc[246]]);if(_0x5d2ax4[_0xe4bc[1500]]){var _0x5d2ax5=this[_0xe4bc[245]](_0x5d2ax2,_0x5d2ax4);null!=_0x5d2ax5&&(_0x5d2ax2[_0xe4bc[2079]]=_0x5d2ax5)}else {var _0x5d2ax5=_0x5d2ax3[0],_0x5d2ax9=_0x5d2ax3[_0x5d2ax3[_0xe4bc[67]]-1];if(null!=_0x5d2ax5&&null!=_0x5d2ax9){var _0x5d2ax3=_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax5[_0xe4bc[235]],_0x5d2axa=_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax5[_0xe4bc[236]],_0x5d2ax12=_0x5d2ax9=0,_0x5d2ax4=_0x5d2ax4[_0xe4bc[1368]];null!=_0x5d2ax4&&(_0x5d2ax9=_0x5d2ax4[_0xe4bc[235]],_0x5d2ax12=_0x5d2ax4[_0xe4bc[236]]);_0x5d2ax4=_0x5d2ax5[_0xe4bc[236]]+_0x5d2axa/2+_0x5d2ax12*this[_0xe4bc[255]];_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[235]]=_0x5d2ax5[_0xe4bc[235]]+_0x5d2ax3/2+_0x5d2ax9*this[_0xe4bc[255]];_0x5d2ax2[_0xe4bc[2079]][_0xe4bc[236]]=_0x5d2ax4}}}};mxGraphView[_0xe4bc[202]][_0xe4bc[248]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=_0x5d2ax3|| !1;var _0x5d2ax4=null;null!=_0x5d2ax2&&(_0x5d2ax4=this[_0xe4bc[1214]][_0xe4bc[203]](_0x5d2ax2),this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax2)&&(null==_0x5d2ax4&&_0x5d2ax3&&this[_0xe4bc[1179]][_0xe4bc[1714]](_0x5d2ax2)?(_0x5d2ax4=this[_0xe4bc[1230]](_0x5d2ax2),this[_0xe4bc[1214]][_0xe4bc[204]](_0x5d2ax2,_0x5d2ax4)):_0x5d2ax3&&(null!=_0x5d2ax4&&this[_0xe4bc[2255]])&&(_0x5d2ax4[_0xe4bc[124]]=this[_0xe4bc[1179]][_0xe4bc[1705]](_0x5d2ax2))));return _0x5d2ax4};mxGraphView[_0xe4bc[202]][_0xe4bc[2287]]=function(){return this[_0xe4bc[2254]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2310]]=function(_0x5d2ax2){this[_0xe4bc[2254]]=_0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[2295]]=function(){return this[_0xe4bc[2251]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2311]]=function(_0x5d2ax2){this[_0xe4bc[2251]]=_0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[2312]]=function(){return this[_0xe4bc[1214]]};mxGraphView[_0xe4bc[202]][_0xe4bc[1517]]=function(_0x5d2ax2){this[_0xe4bc[1214]]=_0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[2313]]=function(_0x5d2ax2){if(null==_0x5d2ax2){return this[_0xe4bc[1214]]};for(var _0x5d2ax3=[],_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){var _0x5d2ax5=this[_0xe4bc[248]](_0x5d2ax2[_0x5d2ax4]);null!=_0x5d2ax5&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax5)};return _0x5d2ax3};mxGraphView[_0xe4bc[202]][_0xe4bc[2265]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[1214]][_0xe4bc[205]](_0x5d2ax2),null!=_0x5d2ax3&&(this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[515]](_0x5d2ax3),_0x5d2ax3[_0xe4bc[515]]()));return _0x5d2ax3};mxGraphView[_0xe4bc[202]][_0xe4bc[1230]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[1705]](_0x5d2ax2);_0x5d2ax2= new mxCellState(this,_0x5d2ax2,_0x5d2ax3);this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[2155]](_0x5d2ax2,this[_0xe4bc[2287]]());return _0x5d2ax2};mxGraphView[_0xe4bc[202]][_0xe4bc[2051]]=function(){return this[_0xe4bc[510]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2052]]=function(){return this[_0xe4bc[2053]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2024]]=function(){return this[_0xe4bc[505]]};mxGraphView[_0xe4bc[202]][_0xe4bc[1524]]=function(){return this[_0xe4bc[506]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2314]]=function(_0x5d2ax2){_0x5d2ax2=mxEvent[_0xe4bc[728]](_0x5d2ax2);return _0x5d2ax2==this[_0xe4bc[1179]][_0xe4bc[526]]||_0x5d2ax2[_0xe4bc[265]]==this[_0xe4bc[2053]]||null!=_0x5d2ax2[_0xe4bc[265]]&&_0x5d2ax2[_0xe4bc[265]][_0xe4bc[265]]==this[_0xe4bc[2053]]||_0x5d2ax2==this[_0xe4bc[510]][_0xe4bc[265]]||_0x5d2ax2==this[_0xe4bc[510]]||_0x5d2ax2==this[_0xe4bc[2053]]||_0x5d2ax2==this[_0xe4bc[505]]||_0x5d2ax2==this[_0xe4bc[506]]};mxGraphView[_0xe4bc[202]][_0xe4bc[2315]]=function(_0x5d2ax2){var _0x5d2ax3=mxUtils[_0xe4bc[445]](this[_0xe4bc[1179]][_0xe4bc[526]]);_0x5d2ax2= new mxPoint(_0x5d2ax2[_0xe4bc[782]]-_0x5d2ax3[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[784]]-_0x5d2ax3[_0xe4bc[236]]);var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[359]],_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[159]];if(_0x5d2ax3>_0x5d2ax4&&_0x5d2ax2[_0xe4bc[235]]>_0x5d2ax4+2&&_0x5d2ax2[_0xe4bc[235]]<=_0x5d2ax3){return !0};_0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[167]];_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[157]];return _0x5d2ax3>_0x5d2ax4&&_0x5d2ax2[_0xe4bc[236]]>_0x5d2ax4+2&&_0x5d2ax2[_0xe4bc[236]]<=_0x5d2ax3?!0:!1};mxGraphView[_0xe4bc[202]][_0xe4bc[176]]=function(){this[_0xe4bc[2163]]();var _0x5d2ax2=this[_0xe4bc[1179]];_0x5d2ax2[_0xe4bc[507]]==mxConstants[_0xe4bc[508]]?this[_0xe4bc[1569]]():_0x5d2ax2[_0xe4bc[507]]==mxConstants[_0xe4bc[1523]]?this[_0xe4bc[1571]]():this[_0xe4bc[1570]]()};mxGraphView[_0xe4bc[202]][_0xe4bc[2163]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]],_0x5d2ax3=_0x5d2ax2[_0xe4bc[526]];if(null!=_0x5d2ax3){mxEvent[_0xe4bc[759]](_0x5d2ax3,mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){mxClient[_0xe4bc[754]]&&_0x5d2ax2[_0xe4bc[2203]]()&&_0x5d2ax2[_0xe4bc[2126]](!_0x5d2ax2[_0xe4bc[2134]]());this[_0xe4bc[2314]](_0x5d2ax3)&&(!mxClient[_0xe4bc[80]]&&!mxClient[_0xe4bc[76]]&&!mxClient[_0xe4bc[71]]&&!mxClient[_0xe4bc[75]]||!this[_0xe4bc[2315]](_0x5d2ax3))&&_0x5d2ax2[_0xe4bc[758]](mxEvent.MOUSE_DOWN, new mxMouseEvent(_0x5d2ax3))}),mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){this[_0xe4bc[2314]](_0x5d2ax3)&&_0x5d2ax2[_0xe4bc[758]](mxEvent.MOUSE_MOVE, new mxMouseEvent(_0x5d2ax3))}),mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){this[_0xe4bc[2314]](_0x5d2ax3)&&_0x5d2ax2[_0xe4bc[758]](mxEvent.MOUSE_UP, new mxMouseEvent(_0x5d2ax3))}));mxEvent[_0xe4bc[169]](_0x5d2ax3,_0xe4bc[760],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){_0x5d2ax2[_0xe4bc[761]](_0x5d2ax3)}));var _0x5d2ax4=function(_0x5d2ax4){var _0x5d2ax9=null;mxClient[_0xe4bc[754]]&&(_0x5d2ax9=mxEvent[_0xe4bc[731]](_0x5d2ax4),_0x5d2ax4=mxEvent[_0xe4bc[733]](_0x5d2ax4),_0x5d2ax4=mxUtils[_0xe4bc[2196]](_0x5d2ax3,_0x5d2ax9,_0x5d2ax4),_0x5d2ax9=_0x5d2ax2[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2[_0xe4bc[999]](_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]])));return _0x5d2ax9};_0x5d2ax2[_0xe4bc[1133]]({mouseDown:function(_0x5d2ax3,_0x5d2ax4){_0x5d2ax2[_0xe4bc[2316]][_0xe4bc[1032]]()},mouseMove:function(){},mouseUp:function(){}});this[_0xe4bc[2317]]=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){null!=_0x5d2ax2[_0xe4bc[2276]]&&_0x5d2ax2[_0xe4bc[2276]][_0xe4bc[2277]]()&&_0x5d2ax2[_0xe4bc[2276]][_0xe4bc[801]]();this[_0xe4bc[2252]]&&(_0x5d2ax2[_0xe4bc[1009]]&&!mxEvent[_0xe4bc[721]](_0x5d2ax3))&&_0x5d2ax2[_0xe4bc[758]](mxEvent.MOUSE_MOVE, new mxMouseEvent(_0x5d2ax3,_0x5d2ax4(_0x5d2ax3)))});this[_0xe4bc[2318]]=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3){this[_0xe4bc[2252]]&&_0x5d2ax2[_0xe4bc[758]](mxEvent.MOUSE_UP, new mxMouseEvent(_0x5d2ax3))});mxEvent[_0xe4bc[759]](document,null,this[_0xe4bc[2317]],this[_0xe4bc[2318]])}};mxGraphView[_0xe4bc[202]][_0xe4bc[1570]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[526]];null!=_0x5d2ax2&&(this[_0xe4bc[510]]=this[_0xe4bc[2319]](_0xe4bc[118],_0xe4bc[118]),this[_0xe4bc[2053]]=this[_0xe4bc[2319]](_0xe4bc[942],_0xe4bc[942]),this[_0xe4bc[505]]=this[_0xe4bc[2319]](_0xe4bc[942],_0xe4bc[942]),this[_0xe4bc[506]]=this[_0xe4bc[2319]](_0xe4bc[942],_0xe4bc[942]),this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[2053]]),this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[505]]),this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[506]]),_0x5d2ax2[_0xe4bc[62]](this[_0xe4bc[510]]),mxClient[_0xe4bc[496]]&&(_0x5d2ax2=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){_0x5d2ax2=this[_0xe4bc[517]]();this[_0xe4bc[2320]](_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]+this[_0xe4bc[1179]][_0xe4bc[467]],_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]+this[_0xe4bc[1179]][_0xe4bc[467]])}),mxEvent[_0xe4bc[169]](window,_0xe4bc[129],_0x5d2ax2)))};mxGraphView[_0xe4bc[202]][_0xe4bc[2320]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=this[_0xe4bc[1179]][_0xe4bc[526]]){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[167]];this[_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[117]]=this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[359]]<_0x5d2ax2?_0x5d2ax2+_0xe4bc[168]:_0xe4bc[118];this[_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax4<_0x5d2ax3?_0x5d2ax3+_0xe4bc[168]:_0xe4bc[118]}};mxGraphView[_0xe4bc[202]][_0xe4bc[2319]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](_0xe4bc[529]);null!=_0x5d2ax2&&null!=_0x5d2ax3?(_0x5d2ax4[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492],_0x5d2ax4[_0xe4bc[124]][_0xe4bc[361]]=_0xe4bc[946],_0x5d2ax4[_0xe4bc[124]][_0xe4bc[125]]=_0xe4bc[946],_0x5d2ax4[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2,_0x5d2ax4[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3):_0x5d2ax4[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[1500];return _0x5d2ax4};mxGraphView[_0xe4bc[202]][_0xe4bc[1571]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[526]];if(null!=_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[359]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[167]];this[_0xe4bc[510]]=this[_0xe4bc[2321]](_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[2053]]=this[_0xe4bc[2321]](_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[505]]=this[_0xe4bc[2321]](_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[506]]=this[_0xe4bc[2321]](_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[2053]]);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[505]]);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[506]]);_0x5d2ax2[_0xe4bc[62]](this[_0xe4bc[510]])}};mxGraphView[_0xe4bc[202]][_0xe4bc[2321]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=document[_0xe4bc[55]](mxClient[_0xe4bc[463]]+_0xe4bc[1499]);_0x5d2ax4[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[492];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[361]]=_0xe4bc[946];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[125]]=_0xe4bc[946];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax2+_0xe4bc[168];_0x5d2ax4[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3+_0xe4bc[168];_0x5d2ax4[_0xe4bc[57]](_0xe4bc[1462],_0x5d2ax2+_0xe4bc[537]+_0x5d2ax3);_0x5d2ax4[_0xe4bc[57]](_0xe4bc[2322],_0xe4bc[2323]);return _0x5d2ax4};mxGraphView[_0xe4bc[202]][_0xe4bc[1569]]=function(){var _0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[526]];this[_0xe4bc[510]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449]);this[_0xe4bc[2053]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449]);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[2053]]);this[_0xe4bc[505]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449]);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[505]]);this[_0xe4bc[506]]=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[449]);this[_0xe4bc[510]][_0xe4bc[62]](this[_0xe4bc[506]]);var _0x5d2ax3=document[_0xe4bc[509]](mxConstants.NS_SVG,_0xe4bc[571]);_0x5d2ax3[_0xe4bc[124]][_0xe4bc[117]]=_0xe4bc[118];_0x5d2ax3[_0xe4bc[124]][_0xe4bc[119]]=_0xe4bc[118];_0x5d2ax3[_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[694];_0x5d2ax3[_0xe4bc[62]](this[_0xe4bc[510]]);null!=_0x5d2ax2&&(_0x5d2ax2[_0xe4bc[62]](_0x5d2ax3),_0xe4bc[2324]==mxUtils[_0xe4bc[275]](_0x5d2ax2)[_0xe4bc[491]]&&(_0x5d2ax2[_0xe4bc[124]][_0xe4bc[491]]=_0xe4bc[1500]))};mxGraphView[_0xe4bc[202]][_0xe4bc[515]]=function(){var _0x5d2ax2=null!=this[_0xe4bc[510]]?this[_0xe4bc[510]][_0xe4bc[538]]:null;null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[510]]);null!=_0x5d2ax2&&null!=_0x5d2ax2[_0xe4bc[265]]&&(this[_0xe4bc[200]](this[_0xe4bc[1741]],!0),mxEvent[_0xe4bc[938]](document,null,this[_0xe4bc[2317]],this[_0xe4bc[2318]]),mxEvent[_0xe4bc[762]](this[_0xe4bc[1179]][_0xe4bc[526]]),_0x5d2ax2[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax2),this[_0xe4bc[506]]=this[_0xe4bc[505]]=this[_0xe4bc[2053]]=this[_0xe4bc[510]]=this[_0xe4bc[2318]]=this[_0xe4bc[2317]]=null)};function mxCurrentRootChange(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[441]]=_0x5d2ax2;this[_0xe4bc[257]]=this[_0xe4bc[813]]=_0x5d2ax3;this[_0xe4bc[2325]]=null==_0x5d2ax3;if(!this[_0xe4bc[2325]]){for(var _0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[1741]],_0x5d2ax5=this[_0xe4bc[441]][_0xe4bc[1179]][_0xe4bc[502]]();null!=_0x5d2ax4;){if(_0x5d2ax4==_0x5d2ax3){this[_0xe4bc[2325]]= !0;break};_0x5d2ax4=_0x5d2ax5[_0xe4bc[1197]](_0x5d2ax4)}}}mxCurrentRootChange[_0xe4bc[202]][_0xe4bc[350]]=function(){var _0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[1741]];this[_0xe4bc[441]][_0xe4bc[1741]]=this[_0xe4bc[257]];this[_0xe4bc[257]]=_0x5d2ax2;_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[1179]][_0xe4bc[2326]](this[_0xe4bc[441]][_0xe4bc[1741]]);null!=_0x5d2ax2&&(this[_0xe4bc[441]][_0xe4bc[513]]= new mxPoint(-_0x5d2ax2[_0xe4bc[235]],-_0x5d2ax2[_0xe4bc[236]]));this[_0xe4bc[441]][_0xe4bc[746]]( new mxEventObject(this[_0xe4bc[2325]]?mxEvent[_0xe4bc[2327]]:mxEvent[_0xe4bc[2328]],_0xe4bc[813],this[_0xe4bc[441]][_0xe4bc[1741]],_0xe4bc[257],this[_0xe4bc[257]]));this[_0xe4bc[2325]]?(this[_0xe4bc[441]][_0xe4bc[200]](this[_0xe4bc[441]][_0xe4bc[1741]],!0),this[_0xe4bc[441]][_0xe4bc[2264]]()):this[_0xe4bc[441]][_0xe4bc[802]]();this[_0xe4bc[2325]]=!this[_0xe4bc[2325]]};function mxGraph(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[2329]]=null;this[_0xe4bc[2330]]=_0x5d2ax4;this[_0xe4bc[507]]=mxClient[_0xe4bc[48]]?mxConstants[_0xe4bc[508]]:_0x5d2ax4==mxConstants[_0xe4bc[2331]]&&mxClient[_0xe4bc[47]]?mxConstants[_0xe4bc[1523]]:_0x5d2ax4==mxConstants[_0xe4bc[2332]]?mxConstants[_0xe4bc[1656]]:_0x5d2ax4==mxConstants[_0xe4bc[2333]]?mxConstants[_0xe4bc[2209]]:mxConstants[_0xe4bc[2334]];this[_0xe4bc[251]]=null!=_0x5d2ax3?_0x5d2ax3: new mxGraphModel;this[_0xe4bc[2335]]=[];this[_0xe4bc[2336]]=[];this[_0xe4bc[259]]=this[_0xe4bc[2337]]();this[_0xe4bc[2339]](this[_0xe4bc[2338]]());this[_0xe4bc[2341]](null!=_0x5d2ax5?_0x5d2ax5:this[_0xe4bc[2340]]());this[_0xe4bc[441]]=this[_0xe4bc[2342]]();this[_0xe4bc[2343]]=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[1177]](_0x5d2ax3[_0xe4bc[720]](_0xe4bc[1061])[_0xe4bc[1065]])});this[_0xe4bc[251]][_0xe4bc[169]](mxEvent.CHANGE,this[_0xe4bc[2343]]);this[_0xe4bc[2344]]();null!=_0x5d2ax2&&this[_0xe4bc[176]](_0x5d2ax2);this[_0xe4bc[441]][_0xe4bc[2259]]()}mxLoadResources&&mxResources[_0xe4bc[99]](mxClient[_0xe4bc[86]]+_0xe4bc[2345]);mxGraph[_0xe4bc[202]]= new mxEventSource;mxGraph[_0xe4bc[202]][_0xe4bc[196]]=mxGraph;mxGraph[_0xe4bc[202]][_0xe4bc[2346]]=[];mxGraph[_0xe4bc[202]][_0xe4bc[2329]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[1009]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[251]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[441]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[94]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2105]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2347]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[259]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2335]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2330]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[507]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[1020]]=10;mxGraph[_0xe4bc[202]][_0xe4bc[991]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2348]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2349]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2350]]=700;mxGraph[_0xe4bc[202]][_0xe4bc[2351]]=25;mxGraph[_0xe4bc[202]][_0xe4bc[2352]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[2352]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[2213]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[2215]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2353]]=4;mxGraph[_0xe4bc[202]][_0xe4bc[2354]]=0.5;mxGraph[_0xe4bc[202]][_0xe4bc[2355]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2356]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[1617]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2273]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2357]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2358]]=_0xe4bc[579];mxGraph[_0xe4bc[202]][_0xe4bc[2359]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2360]]=20;mxGraph[_0xe4bc[202]][_0xe4bc[2361]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2013]]=mxConstants[_0xe4bc[516]];mxGraph[_0xe4bc[202]][_0xe4bc[2012]]=1.5;mxGraph[_0xe4bc[202]][_0xe4bc[984]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2362]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2363]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2364]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2365]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2366]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2367]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2368]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2369]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2206]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2370]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2371]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2372]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2373]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2374]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2375]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2376]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2377]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2378]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2379]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2380]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2381]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[1012]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2382]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2383]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2384]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[1013]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2385]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2386]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2387]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2388]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2389]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[467]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[2158]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2159]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2168]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2390]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2391]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2392]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2393]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2394]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2395]]=1.2;mxGraph[_0xe4bc[202]][_0xe4bc[2396]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2397]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2398]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2399]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2400]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2401]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2402]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2293]]=mxEdgeStyle[_0xe4bc[2403]];mxGraph[_0xe4bc[202]][_0xe4bc[2404]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2405]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2406]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2407]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2408]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2409]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2410]]= !1;mxGraph[_0xe4bc[202]][_0xe4bc[2411]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2412]]= !0;mxGraph[_0xe4bc[202]][_0xe4bc[2180]]=mxConstants[_0xe4bc[2065]];mxGraph[_0xe4bc[202]][_0xe4bc[2336]]=null;mxGraph[_0xe4bc[202]][_0xe4bc[2413]]=0.1;mxGraph[_0xe4bc[202]][_0xe4bc[2414]]=8;mxGraph[_0xe4bc[202]][_0xe4bc[1136]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[1137]]=0;mxGraph[_0xe4bc[202]][_0xe4bc[2415]]= new mxImage(mxClient[_0xe4bc[88]]+_0xe4bc[2416],9,9);mxGraph[_0xe4bc[202]][_0xe4bc[2417]]= new mxImage(mxClient[_0xe4bc[88]]+_0xe4bc[2418],9,9);mxGraph[_0xe4bc[202]][_0xe4bc[2419]]= new mxImage(_0xe4bc[2420],16,16);mxGraph[_0xe4bc[202]][_0xe4bc[2421]]=_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[2422]:_0xe4bc[110];mxGraph[_0xe4bc[202]][_0xe4bc[2423]]=_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[2424]:_0xe4bc[110];mxGraph[_0xe4bc[202]][_0xe4bc[2425]]=_0xe4bc[130]!=mxClient[_0xe4bc[90]]?_0xe4bc[2426]:_0xe4bc[110];mxGraph[_0xe4bc[202]][_0xe4bc[176]]=function(_0x5d2ax2){this[_0xe4bc[526]]=_0x5d2ax2;this[_0xe4bc[2347]]=this[_0xe4bc[2427]]();this[_0xe4bc[441]][_0xe4bc[176]]();this[_0xe4bc[2258]]();mxClient[_0xe4bc[80]]&&(mxEvent[_0xe4bc[169]](window,_0xe4bc[2428],mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[515]]()})),mxEvent[_0xe4bc[169]](_0x5d2ax2,_0xe4bc[2429],mxUtils[_0xe4bc[885]](this,function(){return this[_0xe4bc[2203]]()})));8==document[_0xe4bc[5]]&&_0x5d2ax2[_0xe4bc[1583]](_0xe4bc[1582],_0xe4bc[2430])};mxGraph[_0xe4bc[202]][_0xe4bc[2344]]=function(_0x5d2ax2){this[_0xe4bc[2276]]= new mxTooltipHandler(this);this[_0xe4bc[2276]][_0xe4bc[995]](!1);this[_0xe4bc[2316]]= new mxPanningHandler(this);this[_0xe4bc[2316]][_0xe4bc[2431]]= !1;this[_0xe4bc[2432]]= new mxSelectionCellsHandler(this);this[_0xe4bc[2433]]= new mxConnectionHandler(this);this[_0xe4bc[2433]][_0xe4bc[995]](!1);this[_0xe4bc[1011]]= new mxGraphHandler(this)};mxGraph[_0xe4bc[202]][_0xe4bc[2338]]=function(){return new mxGraphSelectionModel(this)};mxGraph[_0xe4bc[202]][_0xe4bc[2340]]=function(){return new mxStylesheet};mxGraph[_0xe4bc[202]][_0xe4bc[2342]]=function(){return new mxGraphView(this)};mxGraph[_0xe4bc[202]][_0xe4bc[2337]]=function(){return new mxCellRenderer};mxGraph[_0xe4bc[202]][_0xe4bc[2427]]=function(){return new mxCellEditor(this)};mxGraph[_0xe4bc[202]][_0xe4bc[502]]=function(){return this[_0xe4bc[251]]};mxGraph[_0xe4bc[202]][_0xe4bc[249]]=function(){return this[_0xe4bc[441]]};mxGraph[_0xe4bc[202]][_0xe4bc[2434]]=function(){return this[_0xe4bc[94]]};mxGraph[_0xe4bc[202]][_0xe4bc[2341]]=function(_0x5d2ax2){this[_0xe4bc[94]]=_0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2435]]=function(){return this[_0xe4bc[2105]]};mxGraph[_0xe4bc[202]][_0xe4bc[2339]]=function(_0x5d2ax2){this[_0xe4bc[2105]]=_0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2436]]=function(_0x5d2ax2){for(var _0x5d2ax3=[],_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){var _0x5d2ax5=_0x5d2ax2[_0x5d2ax4];if(_0x5d2ax5[_0xe4bc[196]]!=mxRootChange){var _0x5d2ax9=null;_0x5d2ax5 instanceof mxChildChange&&null==_0x5d2ax5[_0xe4bc[257]]?_0x5d2ax9=_0x5d2ax5[_0xe4bc[247]]:null!=_0x5d2ax5[_0xe4bc[246]]&&_0x5d2ax5[_0xe4bc[246]] instanceof mxCell&&(_0x5d2ax9=_0x5d2ax5[_0xe4bc[246]]);null!=_0x5d2ax9&&0>mxUtils[_0xe4bc[2]](_0x5d2ax3,_0x5d2ax9)&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax9)}};return this[_0xe4bc[502]]()[_0xe4bc[1964]](_0x5d2ax3)};mxGraph[_0xe4bc[202]][_0xe4bc[1177]]=function(_0x5d2ax2){for(var _0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax3++){this[_0xe4bc[2437]](_0x5d2ax2[_0x5d2ax3])};this[_0xe4bc[2439]](this[_0xe4bc[2438]](_0x5d2ax2));this[_0xe4bc[441]][_0xe4bc[2264]]();this[_0xe4bc[2258]]()};mxGraph[_0xe4bc[202]][_0xe4bc[2438]]=function(_0x5d2ax2){for(var _0x5d2ax3=[],_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){var _0x5d2ax5=_0x5d2ax2[_0x5d2ax4];if(_0x5d2ax5 instanceof mxRootChange){break}else {_0x5d2ax5 instanceof mxChildChange?null!=_0x5d2ax5[_0xe4bc[257]]&&null==_0x5d2ax5[_0xe4bc[1101]]&&(_0x5d2ax3=_0x5d2ax3[_0xe4bc[1919]](this[_0xe4bc[251]][_0xe4bc[1939]](_0x5d2ax5[_0xe4bc[247]]))):_0x5d2ax5 instanceof mxVisibleChange&&(_0x5d2ax3=_0x5d2ax3[_0xe4bc[1919]](this[_0xe4bc[251]][_0xe4bc[1939]](_0x5d2ax5[_0xe4bc[246]])))}};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[2437]]=function(_0x5d2ax2){if(_0x5d2ax2 instanceof mxRootChange){this[_0xe4bc[2440]](),this[_0xe4bc[2441]](_0x5d2ax2[_0xe4bc[257]]),this[_0xe4bc[2398]]&&(this[_0xe4bc[441]][_0xe4bc[255]]=1,this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]]=0,this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]=0),this[_0xe4bc[746]]( new mxEventObject(mxEvent.ROOT))}else {if(_0x5d2ax2 instanceof mxChildChange){var _0x5d2ax3=this[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax2[_0xe4bc[247]]);null!=_0x5d2ax3?this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax2[_0xe4bc[247]],!0,!1,null!=_0x5d2ax2[_0xe4bc[257]]):(this[_0xe4bc[2441]](_0x5d2ax2[_0xe4bc[247]]),this[_0xe4bc[441]][_0xe4bc[1741]]==_0x5d2ax2[_0xe4bc[247]]&&this[_0xe4bc[2442]]());_0x5d2ax3!=_0x5d2ax2[_0xe4bc[257]]&&(null!=_0x5d2ax3&&this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax3,!1,!1),null!=_0x5d2ax2[_0xe4bc[257]]&&this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax2[_0xe4bc[257]],!1,!1))}else {_0x5d2ax2 instanceof mxTerminalChange||_0x5d2ax2 instanceof mxGeometryChange?this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax2[_0xe4bc[246]]):_0x5d2ax2 instanceof mxValueChange?this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax2[_0xe4bc[246]],!1,!1):_0x5d2ax2 instanceof mxStyleChange?(this[_0xe4bc[441]][_0xe4bc[2263]](_0x5d2ax2[_0xe4bc[246]],!0,!0,!1),this[_0xe4bc[441]][_0xe4bc[2265]](_0x5d2ax2[_0xe4bc[246]])):null!=_0x5d2ax2[_0xe4bc[246]]&&_0x5d2ax2[_0xe4bc[246]] instanceof mxCell&&this[_0xe4bc[2441]](_0x5d2ax2[_0xe4bc[246]])}}};mxGraph[_0xe4bc[202]][_0xe4bc[2441]]=function(_0x5d2ax2){for(var _0x5d2ax3=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax2),_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3;_0x5d2ax4++){this[_0xe4bc[2441]](this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2,_0x5d2ax4))};this[_0xe4bc[441]][_0xe4bc[2265]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2443]]=function(_0x5d2ax2,_0x5d2ax3){null==_0x5d2ax2[_0xe4bc[1211]]&&(_0x5d2ax2[_0xe4bc[1211]]=[]);_0x5d2ax2[_0xe4bc[1211]][_0xe4bc[207]](_0x5d2ax3);var _0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);null!=_0x5d2ax4&&this[_0xe4bc[259]][_0xe4bc[258]](_0x5d2ax4);this[_0xe4bc[746]]( new mxEventObject(mxEvent.ADD_OVERLAY,_0xe4bc[246],_0x5d2ax2,_0xe4bc[2201],_0x5d2ax3));return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[2200]]=function(_0x5d2ax2){return _0x5d2ax2[_0xe4bc[1211]]};mxGraph[_0xe4bc[202]][_0xe4bc[2444]]=function(_0x5d2ax2,_0x5d2ax3){if(null==_0x5d2ax3){this[_0xe4bc[2445]](_0x5d2ax2)}else {var _0x5d2ax4=mxUtils[_0xe4bc[2]](_0x5d2ax2[_0xe4bc[1211]],_0x5d2ax3);0<=_0x5d2ax4?(_0x5d2ax2[_0xe4bc[1211]][_0xe4bc[300]](_0x5d2ax4,1),0==_0x5d2ax2[_0xe4bc[1211]][_0xe4bc[67]]&&(_0x5d2ax2[_0xe4bc[1211]]=null),_0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2),null!=_0x5d2ax4&&this[_0xe4bc[259]][_0xe4bc[258]](_0x5d2ax4),this[_0xe4bc[746]]( new mxEventObject(mxEvent.REMOVE_OVERLAY,_0xe4bc[246],_0x5d2ax2,_0xe4bc[2201],_0x5d2ax3))):_0x5d2ax3=null};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[2445]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[1211]];if(null!=_0x5d2ax3){_0x5d2ax2[_0xe4bc[1211]]=null;var _0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);null!=_0x5d2ax4&&this[_0xe4bc[259]][_0xe4bc[258]](_0x5d2ax4);for(_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax4++){this[_0xe4bc[746]]( new mxEventObject(mxEvent.REMOVE_OVERLAY,_0xe4bc[246],_0x5d2ax2,_0xe4bc[2201],_0x5d2ax3[_0x5d2ax4]))}};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[2446]]=function(_0x5d2ax2){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2:this[_0xe4bc[251]][_0xe4bc[501]]();this[_0xe4bc[2445]](_0x5d2ax2);for(var _0x5d2ax3=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax2),_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax3;_0x5d2ax4++){var _0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2,_0x5d2ax4);this[_0xe4bc[2446]](_0x5d2ax5)}};mxGraph[_0xe4bc[202]][_0xe4bc[2447]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]){return _0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:this[_0xe4bc[2419]],_0x5d2ax3= new mxCellOverlay(_0x5d2ax4,_0xe4bc[2448]+_0x5d2ax3+_0xe4bc[2449]),_0x5d2ax5&&_0x5d2ax3[_0xe4bc[169]](mxEvent.CLICK,mxUtils[_0xe4bc[885]](this,function(_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[994]]()&&this[_0xe4bc[2450]](_0x5d2ax2)})),this[_0xe4bc[2443]](_0x5d2ax2,_0x5d2ax3)};this[_0xe4bc[2445]](_0x5d2ax2);return null};mxGraph[_0xe4bc[202]][_0xe4bc[855]]=function(_0x5d2ax2){this[_0xe4bc[2451]](null,_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2451]]=function(_0x5d2ax2,_0x5d2ax3){null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[2452]](),null!=_0x5d2ax2&&!this[_0xe4bc[2453]](_0x5d2ax2)&&(_0x5d2ax2=null));null!=_0x5d2ax2&&(this[_0xe4bc[746]]( new mxEventObject(mxEvent.START_EDITING,_0xe4bc[246],_0x5d2ax2,_0xe4bc[763],_0x5d2ax3)),this[_0xe4bc[2347]][_0xe4bc[855]](_0x5d2ax2,_0x5d2ax3))};mxGraph[_0xe4bc[202]][_0xe4bc[2142]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[2454]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2126]]=function(_0x5d2ax2){this[_0xe4bc[2347]][_0xe4bc[2126]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[850]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[2456]](_0x5d2ax2,_0x5d2ax3,this[_0xe4bc[2455]](_0x5d2ax2)),this[_0xe4bc[746]]( new mxEventObject(mxEvent.LABEL_CHANGED,_0xe4bc[246],_0x5d2ax2,_0xe4bc[131],_0x5d2ax3,_0xe4bc[763],_0x5d2ax4))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2456]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[251]][_0xe4bc[1966]](_0x5d2ax2,_0x5d2ax3),_0x5d2ax4&&this[_0xe4bc[2457]](_0x5d2ax2,!1)}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}};mxGraph[_0xe4bc[202]][_0xe4bc[859]]=function(_0x5d2ax2){this[_0xe4bc[2126]](!0);this[_0xe4bc[2433]][_0xe4bc[862]]();this[_0xe4bc[1011]][_0xe4bc[862]]();_0x5d2ax2=this[_0xe4bc[897]]();for(var _0x5d2ax3=0;_0x5d2ax3<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax3++){var _0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2[_0x5d2ax3]);null!=_0x5d2ax4&&null!=_0x5d2ax4[_0xe4bc[2458]]&&_0x5d2ax4[_0xe4bc[2458]][_0xe4bc[862]]()}};mxGraph[_0xe4bc[202]][_0xe4bc[173]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[727]](),_0x5d2ax4=_0x5d2ax2[_0xe4bc[736]](),_0x5d2ax5= new mxEventObject(mxEvent.CLICK,_0xe4bc[763],_0x5d2ax3,_0xe4bc[246],_0x5d2ax4);_0x5d2ax2[_0xe4bc[721]]()&&_0x5d2ax5[_0xe4bc[722]]();this[_0xe4bc[746]](_0x5d2ax5);this[_0xe4bc[994]]()&&(!mxEvent[_0xe4bc[721]](_0x5d2ax3)&&!_0x5d2ax5[_0xe4bc[721]]())&&(null!=_0x5d2ax4?this[_0xe4bc[2459]](_0x5d2ax4,_0x5d2ax3):(_0x5d2ax4=null,this[_0xe4bc[2460]]()&&(_0x5d2ax4=this[_0xe4bc[2461]](_0x5d2ax2[_0xe4bc[734]](),_0x5d2ax2[_0xe4bc[735]]())),null!=_0x5d2ax4?this[_0xe4bc[2459]](_0x5d2ax4,_0x5d2ax3):this[_0xe4bc[2462]](_0x5d2ax3)||this[_0xe4bc[2440]]()))};mxGraph[_0xe4bc[202]][_0xe4bc[761]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4= new mxEventObject(mxEvent.DOUBLE_CLICK,_0xe4bc[763],_0x5d2ax2,_0xe4bc[246],_0x5d2ax3);this[_0xe4bc[746]](_0x5d2ax4);this[_0xe4bc[994]]()&&(!mxEvent[_0xe4bc[721]](_0x5d2ax2)&&!_0x5d2ax4[_0xe4bc[721]]()&&null!=_0x5d2ax3&&this[_0xe4bc[2453]](_0x5d2ax3))&&this[_0xe4bc[2451]](_0x5d2ax3,_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[1014]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(!this[_0xe4bc[2382]]&&(this[_0xe4bc[2384]]||mxUtils[_0xe4bc[1134]](this[_0xe4bc[526]]))){var _0x5d2ax9=this[_0xe4bc[526]];_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:20;if(_0x5d2ax2>=_0x5d2ax9[_0xe4bc[360]]&&_0x5d2ax3>=_0x5d2ax9[_0xe4bc[190]]&&_0x5d2ax2<=_0x5d2ax9[_0xe4bc[360]]+_0x5d2ax9[_0xe4bc[159]]&&_0x5d2ax3<=_0x5d2ax9[_0xe4bc[190]]+_0x5d2ax9[_0xe4bc[157]]){var _0x5d2axa=_0x5d2ax9[_0xe4bc[360]]+_0x5d2ax9[_0xe4bc[159]]-_0x5d2ax2;if(_0x5d2axa<_0x5d2ax5){if(_0x5d2ax2=_0x5d2ax9[_0xe4bc[360]],_0x5d2ax9[_0xe4bc[360]]+=_0x5d2ax5-_0x5d2axa,_0x5d2ax4&&_0x5d2ax2==_0x5d2ax9[_0xe4bc[360]]){if(this[_0xe4bc[507]]==mxConstants[_0xe4bc[508]]){_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[2024]]()[_0xe4bc[538]];var _0x5d2ax12=this[_0xe4bc[526]][_0xe4bc[1526]]+_0x5d2ax5-_0x5d2axa}else {_0x5d2ax12=Math[_0xe4bc[160]](_0x5d2ax9[_0xe4bc[159]],_0x5d2ax9[_0xe4bc[1526]])+_0x5d2ax5-_0x5d2axa,_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[2051]]()};_0x5d2ax2[_0xe4bc[124]][_0xe4bc[117]]=_0x5d2ax12+_0xe4bc[168];_0x5d2ax9[_0xe4bc[360]]+=_0x5d2ax5-_0x5d2axa}}else {_0x5d2axa=_0x5d2ax2-_0x5d2ax9[_0xe4bc[360]],_0x5d2axa<_0x5d2ax5&&(_0x5d2ax9[_0xe4bc[360]]-=_0x5d2ax5-_0x5d2axa)};_0x5d2axa=_0x5d2ax9[_0xe4bc[190]]+_0x5d2ax9[_0xe4bc[157]]-_0x5d2ax3;_0x5d2axa<_0x5d2ax5?(_0x5d2ax2=_0x5d2ax9[_0xe4bc[190]],_0x5d2ax9[_0xe4bc[190]]+=_0x5d2ax5-_0x5d2axa,_0x5d2ax2==_0x5d2ax9[_0xe4bc[190]]&&_0x5d2ax4&&(this[_0xe4bc[507]]==mxConstants[_0xe4bc[508]]?(_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[2024]]()[_0xe4bc[538]],_0x5d2ax3=this[_0xe4bc[526]][_0xe4bc[191]]+_0x5d2ax5-_0x5d2axa):(_0x5d2ax3=Math[_0xe4bc[160]](_0x5d2ax9[_0xe4bc[157]],_0x5d2ax9[_0xe4bc[191]])+_0x5d2ax5-_0x5d2axa,_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[2051]]()),_0x5d2ax2[_0xe4bc[124]][_0xe4bc[119]]=_0x5d2ax3+_0xe4bc[168],_0x5d2ax9[_0xe4bc[190]]+=_0x5d2ax5-_0x5d2axa)):(_0x5d2axa=_0x5d2ax3-_0x5d2ax9[_0xe4bc[190]],_0x5d2axa<_0x5d2ax5&&(_0x5d2ax9[_0xe4bc[190]]-=_0x5d2ax5-_0x5d2axa))}}else {this[_0xe4bc[2383]]&&!this[_0xe4bc[2316]][_0xe4bc[1124]]&&(null==this[_0xe4bc[2463]]&&(this[_0xe4bc[2463]]=this[_0xe4bc[2464]]()),this[_0xe4bc[2463]][_0xe4bc[1143]](_0x5d2ax2+this[_0xe4bc[1136]],_0x5d2ax3+this[_0xe4bc[1137]]))}};mxGraph[_0xe4bc[202]][_0xe4bc[2464]]=function(){return new mxPanningManager(this)};mxGraph[_0xe4bc[202]][_0xe4bc[2465]]=function(){function _0x5d2ax2(_0x5d2ax2){var _0x5d2ax3=0,_0x5d2ax3=_0xe4bc[2466]==_0x5d2ax2?2:_0xe4bc[2467]==_0x5d2ax2?4:_0xe4bc[2468]==_0x5d2ax2?6:parseInt(_0x5d2ax2);isNaN(_0x5d2ax3)&&(_0x5d2ax3=0);return _0x5d2ax3}var _0x5d2ax3=mxUtils[_0xe4bc[275]](this[_0xe4bc[526]]),_0x5d2ax4= new mxRectangle;_0x5d2ax4[_0xe4bc[235]]=_0x5d2ax2(_0x5d2ax3[_0xe4bc[2469]])+parseInt(_0x5d2ax3[_0xe4bc[357]]||0);_0x5d2ax4[_0xe4bc[236]]=_0x5d2ax2(_0x5d2ax3[_0xe4bc[2470]])+parseInt(_0x5d2ax3[_0xe4bc[2471]]||0);_0x5d2ax4[_0xe4bc[117]]=_0x5d2ax2(_0x5d2ax3[_0xe4bc[2472]])+parseInt(_0x5d2ax3[_0xe4bc[1164]]||0);_0x5d2ax4[_0xe4bc[119]]=_0x5d2ax2(_0x5d2ax3[_0xe4bc[2473]])+parseInt(_0x5d2ax3[_0xe4bc[2474]]||0);return _0x5d2ax4};mxGraph[_0xe4bc[202]][_0xe4bc[2475]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[255]];var _0x5d2ax5=this[_0xe4bc[441]][_0xe4bc[513]],_0x5d2ax9=this[_0xe4bc[2013]],_0x5d2axa=_0x5d2ax2*this[_0xe4bc[2012]],_0x5d2ax9= new mxRectangle(0,0,_0x5d2ax9[_0xe4bc[117]]*_0x5d2axa,_0x5d2ax9[_0xe4bc[119]]*_0x5d2axa);_0x5d2ax3=this[_0xe4bc[2357]]?Math[_0xe4bc[430]](_0x5d2ax3/_0x5d2ax9[_0xe4bc[117]]):1;_0x5d2ax4=this[_0xe4bc[2357]]?Math[_0xe4bc[430]](_0x5d2ax4/_0x5d2ax9[_0xe4bc[119]]):1;return new mxRectangle(0,0,_0x5d2ax3*_0x5d2ax9[_0xe4bc[117]]+2+_0x5d2ax5[_0xe4bc[235]]/_0x5d2ax2,_0x5d2ax4*_0x5d2ax9[_0xe4bc[119]]+2+_0x5d2ax5[_0xe4bc[236]]/_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2258]]=function(){var _0x5d2ax2=this[_0xe4bc[517]]();if(null!=this[_0xe4bc[526]]){var _0x5d2ax3=this[_0xe4bc[2476]](),_0x5d2ax4=Math[_0xe4bc[160]](0,_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]+1+_0x5d2ax3),_0x5d2ax3=Math[_0xe4bc[160]](0,_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]+1+_0x5d2ax3);null!=this[_0xe4bc[2387]]&&(_0x5d2ax4=Math[_0xe4bc[160]](_0x5d2ax4,this[_0xe4bc[2387]][_0xe4bc[117]]),_0x5d2ax3=Math[_0xe4bc[160]](_0x5d2ax3,this[_0xe4bc[2387]][_0xe4bc[119]]));this[_0xe4bc[2389]]&&this[_0xe4bc[2477]](_0x5d2ax4,_0x5d2ax3);if(this[_0xe4bc[2361]]||!mxClient[_0xe4bc[80]]&&this[_0xe4bc[2273]]){var _0x5d2ax5=this[_0xe4bc[2475]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax3);null!=_0x5d2ax5&&(_0x5d2ax4=_0x5d2ax5[_0xe4bc[117]],_0x5d2ax3=_0x5d2ax5[_0xe4bc[119]])};null!=this[_0xe4bc[2386]]&&(_0x5d2ax4=Math[_0xe4bc[160]](_0x5d2ax4,this[_0xe4bc[2386]][_0xe4bc[117]]*this[_0xe4bc[441]][_0xe4bc[255]]),_0x5d2ax3=Math[_0xe4bc[160]](_0x5d2ax3,this[_0xe4bc[2386]][_0xe4bc[119]]*this[_0xe4bc[441]][_0xe4bc[255]]));_0x5d2ax4=Math[_0xe4bc[430]](_0x5d2ax4-1);_0x5d2ax3=Math[_0xe4bc[430]](_0x5d2ax3-1);this[_0xe4bc[507]]==mxConstants[_0xe4bc[508]]?(_0x5d2ax5=this[_0xe4bc[441]][_0xe4bc[2024]]()[_0xe4bc[538]],_0x5d2ax5[_0xe4bc[124]][_0xe4bc[2478]]=Math[_0xe4bc[160]](1,_0x5d2ax4)+_0xe4bc[168],_0x5d2ax5[_0xe4bc[124]][_0xe4bc[2479]]=Math[_0xe4bc[160]](1,_0x5d2ax3)+_0xe4bc[168],_0x5d2ax5[_0xe4bc[124]][_0xe4bc[117]]=_0xe4bc[118],_0x5d2ax5[_0xe4bc[124]][_0xe4bc[119]]=_0xe4bc[118]):mxClient[_0xe4bc[496]]?this[_0xe4bc[441]][_0xe4bc[2320]](Math[_0xe4bc[160]](1,_0x5d2ax4),Math[_0xe4bc[160]](1,_0x5d2ax3)):(this[_0xe4bc[441]][_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[2478]]=Math[_0xe4bc[160]](1,_0x5d2ax4)+_0xe4bc[168],this[_0xe4bc[441]][_0xe4bc[510]][_0xe4bc[124]][_0xe4bc[2479]]=Math[_0xe4bc[160]](1,_0x5d2ax3)+_0xe4bc[168]);this[_0xe4bc[2480]](this[_0xe4bc[2357]],_0x5d2ax4-1,_0x5d2ax3-1)};this[_0xe4bc[746]]( new mxEventObject(mxEvent.SIZE,_0xe4bc[1562],_0x5d2ax2))};mxGraph[_0xe4bc[202]][_0xe4bc[2477]]=function(_0x5d2ax2,_0x5d2ax3){if(mxClient[_0xe4bc[80]]){if(mxClient[_0xe4bc[496]]){var _0x5d2ax4=this[_0xe4bc[2465]]();_0x5d2ax2+=Math[_0xe4bc[160]](2,_0x5d2ax4[_0xe4bc[235]]+_0x5d2ax4[_0xe4bc[117]]+1);_0x5d2ax3+=Math[_0xe4bc[160]](2,_0x5d2ax4[_0xe4bc[236]]+_0x5d2ax4[_0xe4bc[119]]+1)}else {9<=document[_0xe4bc[5]]?(_0x5d2ax2+=3,_0x5d2ax3+=5):(_0x5d2ax2+=1,_0x5d2ax3+=1)}}else {_0x5d2ax3+=1};null!=this[_0xe4bc[2388]]&&(_0x5d2ax2=Math[_0xe4bc[243]](this[_0xe4bc[2388]][_0xe4bc[117]],_0x5d2ax2),_0x5d2ax3=Math[_0xe4bc[243]](this[_0xe4bc[2388]][_0xe4bc[119]],_0x5d2ax3));this[_0xe4bc[526]][_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[430]](_0x5d2ax2)+_0xe4bc[168];this[_0xe4bc[526]][_0xe4bc[124]][_0xe4bc[119]]=Math[_0xe4bc[430]](_0x5d2ax3)+_0xe4bc[168]};mxGraph[_0xe4bc[202]][_0xe4bc[2480]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax9=this[_0xe4bc[441]][_0xe4bc[513]],_0x5d2axa=this[_0xe4bc[2013]],_0x5d2ax12=_0x5d2ax5*this[_0xe4bc[2012]],_0x5d2ax9= new mxRectangle(_0x5d2ax5*_0x5d2ax9[_0xe4bc[235]],_0x5d2ax5*_0x5d2ax9[_0xe4bc[236]],_0x5d2axa[_0xe4bc[117]]*_0x5d2ax12,_0x5d2axa[_0xe4bc[119]]*_0x5d2ax12);_0x5d2ax2=_0x5d2ax2&&Math[_0xe4bc[243]](_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]])>this[_0xe4bc[2360]];_0x5d2ax9[_0xe4bc[235]]=mxUtils[_0xe4bc[1454]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[117]]);_0x5d2ax9[_0xe4bc[236]]=mxUtils[_0xe4bc[1454]](_0x5d2ax9[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[119]]);_0x5d2axa=_0x5d2ax2?Math[_0xe4bc[430]]((_0x5d2ax3-_0x5d2ax9[_0xe4bc[235]])/_0x5d2ax9[_0xe4bc[117]]):0;_0x5d2ax2=_0x5d2ax2?Math[_0xe4bc[430]]((_0x5d2ax4-_0x5d2ax9[_0xe4bc[236]])/_0x5d2ax9[_0xe4bc[119]]):0;null==this[_0xe4bc[2481]]&&0<_0x5d2axa&&(this[_0xe4bc[2481]]=[]);if(null!=this[_0xe4bc[2481]]){for(_0x5d2ax12=0;_0x5d2ax12<=_0x5d2axa;_0x5d2ax12++){var _0x5d2ax13=[ new mxPoint(_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax12*_0x5d2ax9[_0xe4bc[117]],1), new mxPoint(_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax12*_0x5d2ax9[_0xe4bc[117]],_0x5d2ax4)];null!=this[_0xe4bc[2481]][_0x5d2ax12]?(this[_0xe4bc[2481]][_0x5d2ax12][_0xe4bc[255]]=1,this[_0xe4bc[2481]][_0x5d2ax12][_0xe4bc[1525]]=_0x5d2ax13,this[_0xe4bc[2481]][_0x5d2ax12][_0xe4bc[258]]()):(_0x5d2ax13= new mxPolyline(_0x5d2ax13,this[_0xe4bc[2358]],this[_0xe4bc[255]]),_0x5d2ax13[_0xe4bc[507]]=this[_0xe4bc[507]],_0x5d2ax13[_0xe4bc[1522]]=this[_0xe4bc[2359]],_0x5d2ax13[_0xe4bc[255]]=_0x5d2ax5,_0x5d2ax13[_0xe4bc[176]](this[_0xe4bc[441]][_0xe4bc[2053]]),_0x5d2ax13[_0xe4bc[258]](),this[_0xe4bc[2481]][_0x5d2ax12]=_0x5d2ax13)};for(_0x5d2ax12=_0x5d2axa;_0x5d2ax12this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax3)&&_0x5d2ax4--;this[_0xe4bc[251]][_0xe4bc[99]](_0x5d2ax3,_0x5d2ax2[_0x5d2ax13],_0x5d2ax4+_0x5d2ax13);this[_0xe4bc[2506]]()&&this[_0xe4bc[2507]](_0x5d2ax2[_0x5d2ax13])&&this[_0xe4bc[2508]](_0x5d2ax2[_0x5d2ax13]);(null==_0x5d2ax12||_0x5d2ax12)&&this[_0xe4bc[2509]](_0x5d2ax2[_0x5d2ax13]);null!=_0x5d2ax5&&this[_0xe4bc[852]](_0x5d2ax2[_0x5d2ax13],_0x5d2ax5,!0);null!=_0x5d2ax9&&this[_0xe4bc[852]](_0x5d2ax2[_0x5d2ax13],_0x5d2ax9,!1)}};this[_0xe4bc[746]]( new mxEventObject(mxEvent.CELLS_ADDED,_0xe4bc[895],_0x5d2ax2,_0xe4bc[1101],_0x5d2ax3,_0xe4bc[1983],_0x5d2ax4,_0xe4bc[1097],_0x5d2ax5,_0xe4bc[772],_0x5d2ax9,_0xe4bc[492],_0x5d2axa))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}}};mxGraph[_0xe4bc[202]][_0xe4bc[842]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[2510]](this[_0xe4bc[897]]()));_0x5d2ax3&&(_0x5d2ax2=this[_0xe4bc[2510]](this[_0xe4bc[2499]](_0x5d2ax2)));this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[843]](_0x5d2ax2),this[_0xe4bc[746]]( new mxEventObject(mxEvent.REMOVE_CELLS,_0xe4bc[895],_0x5d2ax2,_0xe4bc[2511],_0x5d2ax3))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[843]]=function(_0x5d2ax2){if(null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]){var _0x5d2ax3=this[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[513]];this[_0xe4bc[251]][_0xe4bc[473]]();try{for(var _0x5d2ax5={},_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax9++){var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2[_0x5d2ax9]);_0x5d2ax5[_0x5d2axa]=_0x5d2ax2[_0x5d2ax9]};for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax9++){for(var _0x5d2ax12=this[_0xe4bc[1756]](_0x5d2ax2[_0x5d2ax9]),_0x5d2ax13=0;_0x5d2ax13<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax13++){if(_0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax12[_0x5d2ax13]),null==_0x5d2ax5[_0x5d2axa]){var _0x5d2ax14=this[_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax12[_0x5d2ax13]);if(null!=_0x5d2ax14){var _0x5d2ax15=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax12[_0x5d2ax13]);if(null!=_0x5d2ax15){var _0x5d2ax14=_0x5d2ax14[_0xe4bc[238]](),_0x5d2ax16=_0x5d2ax15[_0xe4bc[1710]](!0)==_0x5d2ax2[_0x5d2ax9],_0x5d2ax17=_0x5d2ax15[_0xe4bc[439]],_0x5d2ax18=_0x5d2ax16?0:_0x5d2ax17[_0xe4bc[67]]-1;_0x5d2ax14[_0xe4bc[2007]]( new mxPoint(_0x5d2ax17[_0x5d2ax18][_0xe4bc[235]]/_0x5d2ax3-_0x5d2ax4[_0xe4bc[235]],_0x5d2ax17[_0x5d2ax18][_0xe4bc[236]]/_0x5d2ax3-_0x5d2ax4[_0xe4bc[236]]),_0x5d2ax16);this[_0xe4bc[251]][_0xe4bc[1957]](_0x5d2ax12[_0x5d2ax13],null,_0x5d2ax16);this[_0xe4bc[251]][_0xe4bc[1724]](_0x5d2ax12[_0x5d2ax13],_0x5d2ax14)}}}};this[_0xe4bc[251]][_0xe4bc[205]](_0x5d2ax2[_0x5d2ax9])};this[_0xe4bc[746]]( new mxEventObject(mxEvent.CELLS_REMOVED,_0xe4bc[895],_0x5d2ax2))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}}};mxGraph[_0xe4bc[202]][_0xe4bc[853]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=_0x5d2ax5||0;_0x5d2ax9=_0x5d2ax9||0;null==_0x5d2ax4&&(_0x5d2ax4=this[_0xe4bc[899]]([_0x5d2ax2])[0]);var _0x5d2axa=this[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax2),_0x5d2ax12=this[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax2,!0);this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[835]](_0x5d2ax3,_0x5d2ax5,_0x5d2ax9,!1,!1),this[_0xe4bc[833]](_0x5d2ax3,_0x5d2axa,this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2axa),null,null,!0),this[_0xe4bc[833]]([_0x5d2ax4],_0x5d2axa,this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2axa),_0x5d2ax12,_0x5d2ax3[0],!1),this[_0xe4bc[852]](_0x5d2ax2,_0x5d2ax3[0],!0),this[_0xe4bc[746]]( new mxEventObject(mxEvent.SPLIT_EDGE,_0xe4bc[1989],_0x5d2ax2,_0xe4bc[895],_0x5d2ax3,_0xe4bc[2512],_0x5d2ax4,_0xe4bc[1126],_0x5d2ax5,_0xe4bc[1125],_0x5d2ax9))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax4};mxGraph[_0xe4bc[202]][_0xe4bc[838]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){null==_0x5d2ax3&&(_0x5d2ax3=this[_0xe4bc[897]]());_0x5d2ax4&&(_0x5d2ax3=this[_0xe4bc[2499]](_0x5d2ax3));this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[839]](_0x5d2ax3,_0x5d2ax2),this[_0xe4bc[746]]( new mxEventObject(mxEvent.TOGGLE_CELLS,_0xe4bc[539],_0x5d2ax2,_0xe4bc[895],_0x5d2ax3,_0xe4bc[2511],_0x5d2ax4))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[839]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]){this[_0xe4bc[251]][_0xe4bc[473]]();try{for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){this[_0xe4bc[251]][_0xe4bc[175]](_0x5d2ax2[_0x5d2ax4],_0x5d2ax3)}}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}}};mxGraph[_0xe4bc[202]][_0xe4bc[847]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!1;null==_0x5d2ax4&&(_0x5d2ax4=this[_0xe4bc[2513]](this[_0xe4bc[897]](),_0x5d2ax2));this[_0xe4bc[2126]](!1);this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[848]](_0x5d2ax4,_0x5d2ax2,_0x5d2ax3,_0x5d2ax5),this[_0xe4bc[746]]( new mxEventObject(mxEvent.FOLD_CELLS,_0xe4bc[2514],_0x5d2ax2,_0xe4bc[2515],_0x5d2ax3,_0xe4bc[895],_0x5d2ax4))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax4};mxGraph[_0xe4bc[202]][_0xe4bc[848]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax2&&0<_0x5d2ax2[_0xe4bc[67]]){this[_0xe4bc[251]][_0xe4bc[473]]();try{for(var _0x5d2ax9=0;_0x5d2ax9<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax9++){if((!_0x5d2ax5||this[_0xe4bc[2516]](_0x5d2ax2[_0x5d2ax9],_0x5d2ax3))&&_0x5d2ax3!=this[_0xe4bc[1742]](_0x5d2ax2[_0x5d2ax9])){if(this[_0xe4bc[251]][_0xe4bc[1972]](_0x5d2ax2[_0x5d2ax9],_0x5d2ax3),this[_0xe4bc[2517]](_0x5d2ax2[_0x5d2ax9],_0x5d2ax3),this[_0xe4bc[2507]](_0x5d2ax2[_0x5d2ax9])&&this[_0xe4bc[2508]](_0x5d2ax2[_0x5d2ax9]),_0x5d2ax4){var _0x5d2axa=this[_0xe4bc[251]][_0xe4bc[1953]](_0x5d2ax2[_0x5d2ax9]);this[_0xe4bc[847]](_0x5d2axa,_0x5d2ax3,_0x5d2ax4)}}};this[_0xe4bc[746]]( new mxEventObject(mxEvent.CELLS_FOLDED,_0xe4bc[895],_0x5d2ax2,_0xe4bc[2514],_0x5d2ax3,_0xe4bc[2515],_0x5d2ax4))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}}};mxGraph[_0xe4bc[202]][_0xe4bc[2517]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2){var _0x5d2ax4=this[_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax2);null!=_0x5d2ax4&&(_0x5d2ax4=_0x5d2ax4[_0xe4bc[238]](),this[_0xe4bc[2518]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax3),_0x5d2ax4[_0xe4bc[2005]](),this[_0xe4bc[251]][_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax4))}};mxGraph[_0xe4bc[202]][_0xe4bc[2518]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(null!=_0x5d2ax2&&null!=_0x5d2ax3){_0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[124]]:this[_0xe4bc[1705]](_0x5d2ax2);if(null==_0x5d2ax3[_0xe4bc[2002]]){var _0x5d2ax5=_0x5d2ax3;this[_0xe4bc[2394]]&&(_0x5d2ax2=this[_0xe4bc[2519]](_0x5d2ax2),null!=_0x5d2ax2&&(_0x5d2ax5=_0x5d2ax2,_0x5d2ax2=mxUtils[_0xe4bc[433]](_0x5d2ax4,mxConstants.STYLE_STARTSIZE),0<_0x5d2ax2&&(_0x5d2ax5[_0xe4bc[119]]=Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[119]],_0x5d2ax2))));_0x5d2ax3[_0xe4bc[2002]]= new mxRectangle(0,0,_0x5d2ax5[_0xe4bc[117]],_0x5d2ax5[_0xe4bc[119]])};if(null!=_0x5d2ax3[_0xe4bc[2002]]){_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[235]]=_0x5d2ax3[_0xe4bc[235]];_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[236]]=_0x5d2ax3[_0xe4bc[236]];var _0x5d2ax9=mxUtils[_0xe4bc[431]](_0x5d2ax4[mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]);0!=_0x5d2ax9&&(_0x5d2ax2=_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[241]]()-_0x5d2ax3[_0xe4bc[241]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[242]]()-_0x5d2ax3[_0xe4bc[242]](),_0x5d2ax5=Math[_0xe4bc[426]](_0x5d2ax9),_0x5d2ax9=Math[_0xe4bc[427]](_0x5d2ax9),_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[235]]+=_0x5d2ax5*_0x5d2ax2-_0x5d2ax9*_0x5d2ax4-_0x5d2ax2,_0x5d2ax3[_0xe4bc[2002]][_0xe4bc[236]]+=_0x5d2ax9*_0x5d2ax2+_0x5d2ax5*_0x5d2ax4-_0x5d2ax4)}}};mxGraph[_0xe4bc[202]][_0xe4bc[2499]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[1853]]();return _0x5d2ax3=_0x5d2ax3[_0xe4bc[1919]](this[_0xe4bc[2520]](_0x5d2ax2))};mxGraph[_0xe4bc[202]][_0xe4bc[2520]]=function(_0x5d2ax2){var _0x5d2ax3=[];if(null!=_0x5d2ax2){for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){for(var _0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[1707]](_0x5d2ax2[_0x5d2ax4]),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5;_0x5d2ax9++){_0x5d2ax3[_0xe4bc[207]](this[_0xe4bc[251]][_0xe4bc[1708]](_0x5d2ax2[_0x5d2ax4],_0x5d2ax9))};_0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[1953]](_0x5d2ax2[_0x5d2ax4]);_0x5d2ax3=_0x5d2ax3[_0xe4bc[1919]](this[_0xe4bc[2520]](_0x5d2ax5))}};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[858]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!1;this[_0xe4bc[251]][_0xe4bc[473]]();try{this[_0xe4bc[2457]](_0x5d2ax2,_0x5d2ax3),this[_0xe4bc[746]]( new mxEventObject(mxEvent.UPDATE_CELL_SIZE,_0xe4bc[246],_0x5d2ax2,_0xe4bc[2521],_0x5d2ax3))}finally{this[_0xe4bc[251]][_0xe4bc[476]]()};return _0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2457]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=_0x5d2ax2){this[_0xe4bc[251]][_0xe4bc[473]]();try{var _0x5d2ax4=this[_0xe4bc[2519]](_0x5d2ax2),_0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax2);if(null!=_0x5d2ax4&&null!=_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[1742]](_0x5d2ax2),_0x5d2ax5=_0x5d2ax5[_0xe4bc[238]]();if(this[_0xe4bc[1730]](_0x5d2ax2)){var _0x5d2axa=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2),_0x5d2ax12=null!=_0x5d2axa?_0x5d2axa[_0xe4bc[124]]:this[_0xe4bc[1705]](_0x5d2ax2),_0x5d2ax13=this[_0xe4bc[251]][_0xe4bc[474]](_0x5d2ax2);null==_0x5d2ax13&&(_0x5d2ax13=_0xe4bc[110]);mxUtils[_0xe4bc[433]](_0x5d2ax12,mxConstants.STYLE_HORIZONTAL,!0)?(_0x5d2ax13=mxUtils[_0xe4bc[475]](_0x5d2ax13,mxConstants.STYLE_STARTSIZE,_0x5d2ax4[_0xe4bc[119]]+8),_0x5d2ax9&&(_0x5d2ax5[_0xe4bc[119]]=_0x5d2ax4[_0xe4bc[119]]+8),_0x5d2ax5[_0xe4bc[117]]=_0x5d2ax4[_0xe4bc[117]]):(_0x5d2ax13=mxUtils[_0xe4bc[475]](_0x5d2ax13,mxConstants.STYLE_STARTSIZE,_0x5d2ax4[_0xe4bc[117]]+8),_0x5d2ax9&&(_0x5d2ax5[_0xe4bc[117]]=_0x5d2ax4[_0xe4bc[117]]+8),_0x5d2ax5[_0xe4bc[119]]=_0x5d2ax4[_0xe4bc[119]]);this[_0xe4bc[251]][_0xe4bc[475]](_0x5d2ax2,_0x5d2ax13)}else {_0x5d2ax5[_0xe4bc[117]]=_0x5d2ax4[_0xe4bc[117]],_0x5d2ax5[_0xe4bc[119]]=_0x5d2ax4[_0xe4bc[119]]};if(!_0x5d2ax3&& !_0x5d2ax9){var _0x5d2ax14=this[_0xe4bc[441]][_0xe4bc[1799]](this[_0xe4bc[251]][_0xe4bc[1953]](_0x5d2ax2));if(null!=_0x5d2ax14){var _0x5d2ax15=this[_0xe4bc[441]][_0xe4bc[513]],_0x5d2ax16=this[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax17=(_0x5d2ax14[_0xe4bc[236]]+_0x5d2ax14[_0xe4bc[119]])/_0x5d2ax16-_0x5d2ax5[_0xe4bc[236]]-_0x5d2ax15[_0xe4bc[236]];_0x5d2ax5[_0xe4bc[117]]=Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[117]],(_0x5d2ax14[_0xe4bc[235]]+_0x5d2ax14[_0xe4bc[117]])/_0x5d2ax16-_0x5d2ax5[_0xe4bc[235]]-_0x5d2ax15[_0xe4bc[235]]);_0x5d2ax5[_0xe4bc[119]]=Math[_0xe4bc[160]](_0x5d2ax5[_0xe4bc[119]],_0x5d2ax17)}};this[_0xe4bc[837]]([_0x5d2ax2],[_0x5d2ax5])}}finally{this[_0xe4bc[251]][_0xe4bc[476]]()}}};mxGraph[_0xe4bc[202]][_0xe4bc[2519]]=function(_0x5d2ax2){var _0x5d2ax3=null;if(null!=_0x5d2ax2){var _0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2),_0x5d2ax5=null!=_0x5d2ax4?_0x5d2ax4[_0xe4bc[124]]:this[_0xe4bc[1705]](_0x5d2ax2);if(null!=_0x5d2ax5&&!this[_0xe4bc[251]][_0xe4bc[250]](_0x5d2ax2)){var _0x5d2ax9=_0x5d2ax5[mxConstants[_0xe4bc[2185]]]||mxConstants[_0xe4bc[483]],_0x5d2axa=0,_0x5d2ax3=0;if((null!=this[_0xe4bc[1202]](_0x5d2ax4)||null!=_0x5d2ax5[mxConstants[_0xe4bc[2484]]])&&_0x5d2ax5[mxConstants[_0xe4bc[2059]]]==mxConstants[_0xe4bc[2522]]){_0x5d2ax5[mxConstants[_0xe4bc[2063]]]==mxConstants[_0xe4bc[481]]&&(_0x5d2axa+=parseFloat(_0x5d2ax5[mxConstants[_0xe4bc[2523]]])||mxLabel[_0xe4bc[202]][_0xe4bc[1680]]),_0x5d2ax5[mxConstants[_0xe4bc[2064]]]!=mxConstants[_0xe4bc[479]]&&(_0x5d2ax3+=parseFloat(_0x5d2ax5[mxConstants[_0xe4bc[2524]]])||mxLabel[_0xe4bc[202]][_0xe4bc[1680]])};_0x5d2axa+=2*(_0x5d2ax5[mxConstants[_0xe4bc[2143]]]||0);_0x5d2axa+=_0x5d2ax5[mxConstants[_0xe4bc[2147]]]||0;_0x5d2axa+=_0x5d2ax5[mxConstants[_0xe4bc[2145]]]||0;_0x5d2ax3+=2*(_0x5d2ax5[mxConstants[_0xe4bc[2143]]]||0);_0x5d2ax3+=_0x5d2ax5[mxConstants[_0xe4bc[2144]]]||0;_0x5d2ax3+=_0x5d2ax5[mxConstants[_0xe4bc[2146]]]||0;_0x5d2ax4=this[_0xe4bc[2205]](_0x5d2ax4);null!=_0x5d2ax4&&(_0x5d2axa+=_0x5d2ax4[_0xe4bc[117]]+8);_0x5d2ax4=this[_0xe4bc[2183]](_0x5d2ax2);null!=_0x5d2ax4&&0<_0x5d2ax4[_0xe4bc[67]]?(this[_0xe4bc[2186]](_0x5d2ax2)||(_0x5d2ax4=_0x5d2ax4[_0xe4bc[230]](/\n/g,_0xe4bc[545])),_0x5d2ax9=mxUtils[_0xe4bc[2525]](_0x5d2ax4,_0x5d2ax9,_0x5d2ax5[mxConstants[_0xe4bc[2188]]]),_0x5d2ax2=_0x5d2ax9[_0xe4bc[117]]+_0x5d2axa,_0x5d2ax3=_0x5d2ax9[_0xe4bc[119]]+_0x5d2ax3,mxUtils[_0xe4bc[433]](_0x5d2ax5,mxConstants.STYLE_HORIZONTAL,!0)||(_0x5d2ax5=_0x5d2ax3,_0x5d2ax3=_0x5d2ax2,_0x5d2ax2=_0x5d2ax5),this[_0xe4bc[991]]&&(_0x5d2ax2=this[_0xe4bc[1021]](_0x5d2ax2+this[_0xe4bc[1020]]/2),_0x5d2ax3=this[_0xe4bc[1021]](_0x5d2ax3+this[_0xe4bc[1020]]/2)),_0x5d2ax3= new mxRectangle(0,0,_0x5d2ax2,_0x5d2ax3)):(_0x5d2ax5=4*this[_0xe4bc[1020]],_0x5d2ax3= new mxRectangle(0,0,_0x5d2ax5,_0x5d2ax5))}};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[2216]]=function(_0x5d2ax2,_0x5d2ax3){if(0.2_0x5d2ax3?(_0x5d2ax3=_0x5d2ax2[_0xe4bc[119]]/_0x5d2ax3,_0x5d2ax4=(_0x5d2ax3-_0x5d2ax2[_0xe4bc[119]])/2,_0x5d2ax2[_0xe4bc[119]]=_0x5d2ax3,_0x5d2ax3=Math[_0xe4bc[243]](_0x5d2ax2[_0xe4bc[236]],_0x5d2ax4),_0x5d2ax2[_0xe4bc[236]]-=_0x5d2ax3,_0x5d2ax5=Math[_0xe4bc[243]](this[_0xe4bc[526]][_0xe4bc[191]],_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]),_0x5d2ax2[_0xe4bc[119]]=_0x5d2ax5-_0x5d2ax2[_0xe4bc[236]]):(_0x5d2ax3*=_0x5d2ax2[_0xe4bc[117]],_0x5d2ax4=(_0x5d2ax3-_0x5d2ax2[_0xe4bc[117]])/2,_0x5d2ax2[_0xe4bc[117]]=_0x5d2ax3,_0x5d2ax3=Math[_0xe4bc[243]](_0x5d2ax2[_0xe4bc[235]],_0x5d2ax4),_0x5d2ax2[_0xe4bc[235]]-=_0x5d2ax3,_0x5d2ax4=Math[_0xe4bc[243]](this[_0xe4bc[526]][_0xe4bc[1526]],_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]),_0x5d2ax2[_0xe4bc[117]]=_0x5d2ax4-_0x5d2ax2[_0xe4bc[235]]);_0x5d2ax3=this[_0xe4bc[526]][_0xe4bc[159]]/_0x5d2ax2[_0xe4bc[117]];_0x5d2ax4=this[_0xe4bc[441]][_0xe4bc[255]]*_0x5d2ax3;mxUtils[_0xe4bc[1134]](this[_0xe4bc[526]])?(this[_0xe4bc[441]][_0xe4bc[2262]](_0x5d2ax4),this[_0xe4bc[526]][_0xe4bc[360]]=Math[_0xe4bc[488]](_0x5d2ax2[_0xe4bc[235]]*_0x5d2ax3),this[_0xe4bc[526]][_0xe4bc[190]]=Math[_0xe4bc[488]](_0x5d2ax2[_0xe4bc[236]]*_0x5d2ax3)):this[_0xe4bc[441]][_0xe4bc[829]](_0x5d2ax4,this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]]-_0x5d2ax2[_0xe4bc[235]]/this[_0xe4bc[441]][_0xe4bc[255]],this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]-_0x5d2ax2[_0xe4bc[236]]/this[_0xe4bc[441]][_0xe4bc[255]])};mxGraph[_0xe4bc[202]][_0xe4bc[933]]=function(_0x5d2ax2,_0x5d2ax3){if(null!=this[_0xe4bc[526]]){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2:0;_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!1;var _0x5d2ax4=this[_0xe4bc[526]][_0xe4bc[159]],_0x5d2ax5=this[_0xe4bc[526]][_0xe4bc[157]],_0x5d2ax9=this[_0xe4bc[441]][_0xe4bc[517]]();_0x5d2ax3&&(null!=_0x5d2ax9[_0xe4bc[235]]&&null!=_0x5d2ax9[_0xe4bc[236]])&&(_0x5d2ax9[_0xe4bc[117]]+=_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[119]]+=_0x5d2ax9[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[235]]=0,_0x5d2ax9[_0xe4bc[236]]=0);var _0x5d2axa=this[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax12=_0x5d2ax9[_0xe4bc[117]]/_0x5d2axa,_0x5d2ax13=_0x5d2ax9[_0xe4bc[119]]/_0x5d2axa;null!=this[_0xe4bc[1617]]&&(_0x5d2ax12=Math[_0xe4bc[160]](_0x5d2ax12,this[_0xe4bc[1617]][_0xe4bc[117]]-_0x5d2ax9[_0xe4bc[235]]/_0x5d2axa),_0x5d2ax13=Math[_0xe4bc[160]](_0x5d2ax13,this[_0xe4bc[1617]][_0xe4bc[119]]-_0x5d2ax9[_0xe4bc[236]]/_0x5d2axa));var _0x5d2ax14=_0x5d2ax3?_0x5d2ax2:2*_0x5d2ax2,_0x5d2ax4=Math[_0xe4bc[519]](100*Math[_0xe4bc[243]](_0x5d2ax4/(_0x5d2ax12+_0x5d2ax14),_0x5d2ax5/(_0x5d2ax13+_0x5d2ax14)))/100;null!=this[_0xe4bc[2413]]&&(_0x5d2ax4=Math[_0xe4bc[160]](_0x5d2ax4,this[_0xe4bc[2413]]));null!=this[_0xe4bc[2414]]&&(_0x5d2ax4=Math[_0xe4bc[243]](_0x5d2ax4,this[_0xe4bc[2414]]));_0x5d2ax3?this[_0xe4bc[441]][_0xe4bc[255]]!=_0x5d2ax4&&this[_0xe4bc[441]][_0xe4bc[2262]](_0x5d2ax4):mxUtils[_0xe4bc[1134]](this[_0xe4bc[526]])?(this[_0xe4bc[441]][_0xe4bc[2262]](_0x5d2ax4),null!=_0x5d2ax9[_0xe4bc[235]]&&(this[_0xe4bc[526]][_0xe4bc[360]]=Math[_0xe4bc[488]](_0x5d2ax9[_0xe4bc[235]]/_0x5d2axa)*_0x5d2ax4-_0x5d2ax2-Math[_0xe4bc[160]](0,(this[_0xe4bc[526]][_0xe4bc[159]]-_0x5d2ax12*_0x5d2ax4)/2)),null!=_0x5d2ax9[_0xe4bc[236]]&&(this[_0xe4bc[526]][_0xe4bc[190]]=Math[_0xe4bc[488]](_0x5d2ax9[_0xe4bc[236]]/_0x5d2axa)*_0x5d2ax4-_0x5d2ax2-Math[_0xe4bc[160]](0,(this[_0xe4bc[526]][_0xe4bc[157]]-_0x5d2ax13*_0x5d2ax4)/2))):this[_0xe4bc[441]][_0xe4bc[829]](_0x5d2ax4,null!=_0x5d2ax9[_0xe4bc[235]]?Math[_0xe4bc[519]](this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]]-_0x5d2ax9[_0xe4bc[235]]/_0x5d2axa+_0x5d2ax2+1):_0x5d2ax2,null!=_0x5d2ax9[_0xe4bc[236]]?Math[_0xe4bc[519]](this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]-_0x5d2ax9[_0xe4bc[236]]/_0x5d2axa+_0x5d2ax2+1):_0x5d2ax2)};return this[_0xe4bc[441]][_0xe4bc[255]]};mxGraph[_0xe4bc[202]][_0xe4bc[2564]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=-this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]],_0x5d2ax5=-this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]],_0x5d2ax9=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);null!=_0x5d2ax9&&(_0x5d2ax4= new mxRectangle(_0x5d2ax4+_0x5d2ax9[_0xe4bc[235]],_0x5d2ax5+_0x5d2ax9[_0xe4bc[236]],_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]]),_0x5d2ax3&&null!=this[_0xe4bc[526]]&&(_0x5d2ax5=this[_0xe4bc[526]][_0xe4bc[159]],_0x5d2ax9=this[_0xe4bc[526]][_0xe4bc[157]],_0x5d2ax4[_0xe4bc[235]]=_0x5d2ax4[_0xe4bc[241]]()-_0x5d2ax5/2,_0x5d2ax4[_0xe4bc[117]]=_0x5d2ax5,_0x5d2ax4[_0xe4bc[236]]=_0x5d2ax4[_0xe4bc[242]]()-_0x5d2ax9/2,_0x5d2ax4[_0xe4bc[119]]=_0x5d2ax9),this[_0xe4bc[2562]](_0x5d2ax4)&&this[_0xe4bc[441]][_0xe4bc[1147]](this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]],this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]))};mxGraph[_0xe4bc[202]][_0xe4bc[2562]]=function(_0x5d2ax2){var _0x5d2ax3=!1;if(null!=_0x5d2ax2){var _0x5d2ax4=this[_0xe4bc[526]][_0xe4bc[359]],_0x5d2ax5=this[_0xe4bc[526]][_0xe4bc[167]],_0x5d2ax9=Math[_0xe4bc[243]](_0x5d2ax4,_0x5d2ax2[_0xe4bc[117]]),_0x5d2axa=Math[_0xe4bc[243]](_0x5d2ax5,_0x5d2ax2[_0xe4bc[119]]);if(mxUtils[_0xe4bc[1134]](this[_0xe4bc[526]])){_0x5d2ax4=this[_0xe4bc[526]];_0x5d2ax2[_0xe4bc[235]]+=this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]];_0x5d2ax2[_0xe4bc[236]]+=this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]];var _0x5d2ax12=_0x5d2ax4[_0xe4bc[360]]-_0x5d2ax2[_0xe4bc[235]],_0x5d2ax5=Math[_0xe4bc[160]](_0x5d2ax12-_0x5d2ax4[_0xe4bc[360]],0);0<_0x5d2ax12?_0x5d2ax4[_0xe4bc[360]]-=_0x5d2ax12+2:(_0x5d2ax12=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax9-_0x5d2ax4[_0xe4bc[360]]-_0x5d2ax4[_0xe4bc[159]],0<_0x5d2ax12&&(_0x5d2ax4[_0xe4bc[360]]+=_0x5d2ax12+2));_0x5d2ax9=_0x5d2ax4[_0xe4bc[190]]-_0x5d2ax2[_0xe4bc[236]];_0x5d2ax12=Math[_0xe4bc[160]](0,_0x5d2ax9-_0x5d2ax4[_0xe4bc[190]]);0<_0x5d2ax9?_0x5d2ax4[_0xe4bc[190]]-=_0x5d2ax9+2:(_0x5d2ax9=_0x5d2ax2[_0xe4bc[236]]+_0x5d2axa-_0x5d2ax4[_0xe4bc[190]]-_0x5d2ax4[_0xe4bc[157]],0<_0x5d2ax9&&(_0x5d2ax4[_0xe4bc[190]]+=_0x5d2ax9+2));!this[_0xe4bc[2365]]&&(0!=_0x5d2ax5||0!=_0x5d2ax12)&&this[_0xe4bc[441]][_0xe4bc[1147]](_0x5d2ax5,_0x5d2ax12)}else {var _0x5d2ax12=-this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]],_0x5d2ax13=-this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]],_0x5d2ax14=this[_0xe4bc[441]][_0xe4bc[255]];_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax9>_0x5d2ax12+_0x5d2ax4&&(this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]]-=(_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax9-_0x5d2ax4-_0x5d2ax12)/_0x5d2ax14,_0x5d2ax3= !0);_0x5d2ax2[_0xe4bc[236]]+_0x5d2axa>_0x5d2ax13+_0x5d2ax5&&(this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]-=(_0x5d2ax2[_0xe4bc[236]]+_0x5d2axa-_0x5d2ax5-_0x5d2ax13)/_0x5d2ax14,_0x5d2ax3= !0);_0x5d2ax2[_0xe4bc[235]]<_0x5d2ax12&&(this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[235]]+=(_0x5d2ax12-_0x5d2ax2[_0xe4bc[235]])/_0x5d2ax14,_0x5d2ax3= !0);_0x5d2ax2[_0xe4bc[236]]<_0x5d2ax13&&(this[_0xe4bc[441]][_0xe4bc[513]][_0xe4bc[236]]+=(_0x5d2ax13-_0x5d2ax2[_0xe4bc[236]])/_0x5d2ax14,_0x5d2ax3= !0);_0x5d2ax3&&(this[_0xe4bc[441]][_0xe4bc[802]](),null!=this[_0xe4bc[2432]]&&this[_0xe4bc[2432]][_0xe4bc[802]]())}};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[1198]]=function(_0x5d2ax2){return this[_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[1714]]=function(_0x5d2ax2){return this[_0xe4bc[251]][_0xe4bc[174]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[1742]]=function(_0x5d2ax2){return this[_0xe4bc[251]][_0xe4bc[1971]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2565]]=function(_0x5d2ax2){return this[_0xe4bc[251]][_0xe4bc[1965]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2298]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[124]][mxConstants[_0xe4bc[2566]]];if(null!=_0x5d2ax3){return _0x5d2ax3};_0x5d2ax2=this[_0xe4bc[441]][_0xe4bc[2291]](_0x5d2ax2);return _0x5d2ax2==mxEdgeStyle[_0xe4bc[2567]]||_0x5d2ax2==mxEdgeStyle[_0xe4bc[2568]]||_0x5d2ax2==mxEdgeStyle[_0xe4bc[2569]]||_0x5d2ax2==mxEdgeStyle[_0xe4bc[2570]]||_0x5d2ax2==mxEdgeStyle[_0xe4bc[2571]]||_0x5d2ax2==mxEdgeStyle[_0xe4bc[2572]]};mxGraph[_0xe4bc[202]][_0xe4bc[2573]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[2089]](!0);_0x5d2ax2=_0x5d2ax2[_0xe4bc[2089]](!1);return null!=_0x5d2ax3&&_0x5d2ax3==_0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2574]]=function(_0x5d2ax2){return mxEvent[_0xe4bc[775]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2462]]=function(_0x5d2ax2){return mxClient[_0xe4bc[2575]]?mxEvent[_0xe4bc[2576]](_0x5d2ax2):mxEvent[_0xe4bc[775]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[1018]]=function(_0x5d2ax2){return null!=_0x5d2ax2&&!mxEvent[_0xe4bc[2577]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2578]]=function(_0x5d2ax2){return mxEvent[_0xe4bc[774]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2579]]=function(_0x5d2ax2){return mxEvent[_0xe4bc[2577]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2580]]=function(_0x5d2ax2){mxUtils[_0xe4bc[150]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2581]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return null==this[_0xe4bc[2500]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)};mxGraph[_0xe4bc[202]][_0xe4bc[2500]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(null!=_0x5d2ax2&&!this[_0xe4bc[2530]]()&&(null==_0x5d2ax3||null==_0x5d2ax4)){return _0xe4bc[110]};if(null!=_0x5d2ax2&&null==this[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax2,!0)&&null==this[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax2,!1)){return null};if(!this[_0xe4bc[2402]]&&_0x5d2ax3==_0x5d2ax4&&null!=_0x5d2ax3||!this[_0xe4bc[2582]](_0x5d2ax3,_0x5d2ax4)){return _0xe4bc[110]};if(null!=_0x5d2ax3&&null!=_0x5d2ax4){var _0x5d2ax5=_0xe4bc[110];if(!this[_0xe4bc[2404]]){var _0x5d2ax9=this[_0xe4bc[251]][_0xe4bc[1781]](_0x5d2ax3,_0x5d2ax4,!0);if(1<_0x5d2ax9[_0xe4bc[67]]||1==_0x5d2ax9[_0xe4bc[67]]&&_0x5d2ax9[0]!=_0x5d2ax2){_0x5d2ax5+=(mxResources[_0xe4bc[203]](this[_0xe4bc[2421]])||this[_0xe4bc[2421]])+_0xe4bc[192]}};var _0x5d2ax9=this[_0xe4bc[251]][_0xe4bc[1962]](_0x5d2ax3,!0,_0x5d2ax2),_0x5d2axa=this[_0xe4bc[251]][_0xe4bc[1962]](_0x5d2ax4,!1,_0x5d2ax2);if(null!=this[_0xe4bc[2335]]){for(var _0x5d2ax12=0;_0x5d2ax12mxUtils[_0xe4bc[2]](_0x5d2ax2,_0x5d2ax4)?_0x5d2ax4:null};mxGraph[_0xe4bc[202]][_0xe4bc[902]]=function(){var _0x5d2ax2=this[_0xe4bc[2355]];null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[2534]](),null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[501]](),_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2,0)));return _0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2687]]=function(_0x5d2ax2){this[_0xe4bc[2355]]=_0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2179]]=function(_0x5d2ax2){for(;null!=_0x5d2ax2&&!this[_0xe4bc[1730]](_0x5d2ax2);){_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax2)};return _0x5d2ax2};mxGraph[_0xe4bc[202]][_0xe4bc[2461]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=_0x5d2ax4||this[_0xe4bc[902]]();if(null!=_0x5d2ax4){for(var _0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax4),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5;_0x5d2ax9++){var _0x5d2axa=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax4,_0x5d2ax9),_0x5d2ax12=this[_0xe4bc[2461]](_0x5d2ax2,_0x5d2ax3,_0x5d2axa);if(null!=_0x5d2ax12){return _0x5d2ax12};if(this[_0xe4bc[1730]](_0x5d2axa)&&(_0x5d2ax12=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2axa),this[_0xe4bc[1825]](_0x5d2ax12,_0x5d2ax2,_0x5d2ax3))){return _0x5d2axa}}};return null};mxGraph[_0xe4bc[202]][_0xe4bc[999]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:!0;_0x5d2ax9=null!=_0x5d2ax9?_0x5d2ax9:!0;_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:this[_0xe4bc[902]]();if(null!=_0x5d2ax4){for(var _0x5d2axa=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax4)-1;0<=_0x5d2axa;_0x5d2axa--){var _0x5d2ax12=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax4,_0x5d2axa),_0x5d2ax13=this[_0xe4bc[999]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax12,_0x5d2ax5,_0x5d2ax9);if(null!=_0x5d2ax13){return _0x5d2ax13};if(this[_0xe4bc[1714]](_0x5d2ax12)&&(_0x5d2ax9&&this[_0xe4bc[251]][_0xe4bc[250]](_0x5d2ax12)||_0x5d2ax5&&this[_0xe4bc[251]][_0xe4bc[1193]](_0x5d2ax12))){if(_0x5d2ax13=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax12),this[_0xe4bc[1825]](_0x5d2ax13,_0x5d2ax2,_0x5d2ax3)){return _0x5d2ax12}}}};return null};mxGraph[_0xe4bc[202]][_0xe4bc[1825]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(null!=_0x5d2ax2){var _0x5d2ax5=_0x5d2ax2[_0xe4bc[439]];if(null!=_0x5d2ax5){_0x5d2ax2=this[_0xe4bc[2353]]*this[_0xe4bc[2353]];for(var _0x5d2ax9=_0x5d2ax5[0],_0x5d2axa=1;_0x5d2axa<_0x5d2ax5[_0xe4bc[67]];_0x5d2axa++){var _0x5d2ax12=_0x5d2ax5[_0x5d2axa];if(mxUtils[_0xe4bc[440]](_0x5d2ax9[_0xe4bc[235]],_0x5d2ax9[_0xe4bc[236]],_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax3,_0x5d2ax4)<=_0x5d2ax2){return !0};_0x5d2ax9=_0x5d2ax12}}else {if(_0x5d2ax9=mxUtils[_0xe4bc[431]](mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_ROTATION)||0),0!=_0x5d2ax9&&(_0x5d2ax5=Math[_0xe4bc[426]](-_0x5d2ax9),_0x5d2ax9=Math[_0xe4bc[427]](-_0x5d2ax9),_0x5d2axa= new mxPoint(_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax2[_0xe4bc[242]]()),_0x5d2ax9=mxUtils[_0xe4bc[432]]( new mxPoint(_0x5d2ax3,_0x5d2ax4),_0x5d2ax5,_0x5d2ax9,_0x5d2axa),_0x5d2ax3=_0x5d2ax9[_0xe4bc[235]],_0x5d2ax4=_0x5d2ax9[_0xe4bc[236]]),mxUtils[_0xe4bc[442]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)){return !0}}};return !1};mxGraph[_0xe4bc[202]][_0xe4bc[2688]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax2);_0x5d2ax2=this[_0xe4bc[1731]](_0x5d2ax2);if(null!=_0x5d2ax5){var _0x5d2ax9=this[_0xe4bc[249]]()[_0xe4bc[518]]();_0x5d2ax3-=_0x5d2ax5[_0xe4bc[235]];_0x5d2ax4-=_0x5d2ax5[_0xe4bc[236]];if(0<_0x5d2ax2[_0xe4bc[117]]&&0<_0x5d2ax3&&_0x5d2ax3>_0x5d2ax2[_0xe4bc[117]]*_0x5d2ax9||0<_0x5d2ax2[_0xe4bc[119]]&&0<_0x5d2ax4&&_0x5d2ax4>_0x5d2ax2[_0xe4bc[119]]*_0x5d2ax9){return !0}};return !1};mxGraph[_0xe4bc[202]][_0xe4bc[1728]]=function(_0x5d2ax2){return this[_0xe4bc[1955]](_0x5d2ax2,!0,!1)};mxGraph[_0xe4bc[202]][_0xe4bc[1956]]=function(_0x5d2ax2){return this[_0xe4bc[1955]](_0x5d2ax2,!1,!0)};mxGraph[_0xe4bc[202]][_0xe4bc[1955]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=null!=_0x5d2ax2?_0x5d2ax2:this[_0xe4bc[902]]();_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[1955]](_0x5d2ax2,null!=_0x5d2ax3?_0x5d2ax3:!1,null!=_0x5d2ax4?_0x5d2ax4:!1);_0x5d2ax3=[];for(_0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){this[_0xe4bc[1714]](_0x5d2ax2[_0x5d2ax4])&&_0x5d2ax3[_0xe4bc[207]](_0x5d2ax2[_0x5d2ax4])};return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[1756]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[264]](_0x5d2ax2,_0x5d2ax3,!0,!0,!1)};mxGraph[_0xe4bc[202]][_0xe4bc[1867]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[264]](_0x5d2ax2,_0x5d2ax3,!0,!1,!1)};mxGraph[_0xe4bc[202]][_0xe4bc[1963]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[264]](_0x5d2ax2,_0x5d2ax3,!1,!0,!1)};mxGraph[_0xe4bc[202]][_0xe4bc[264]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!0;_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:!0;_0x5d2ax9=null!=_0x5d2ax9?_0x5d2ax9:!0;_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:!1;for(var _0x5d2ax12=[],_0x5d2ax13=this[_0xe4bc[1742]](_0x5d2ax2),_0x5d2ax14=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax2),_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax14;_0x5d2ax15++){var _0x5d2ax16=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax2,_0x5d2ax15);if(_0x5d2ax13||!this[_0xe4bc[1714]](_0x5d2ax16)){_0x5d2ax12=_0x5d2ax12[_0xe4bc[1919]](this[_0xe4bc[251]][_0xe4bc[264]](_0x5d2ax16,_0x5d2ax4,_0x5d2ax5))}};_0x5d2ax12=_0x5d2ax12[_0xe4bc[1919]](this[_0xe4bc[251]][_0xe4bc[264]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax5));_0x5d2ax13=[];for(_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax12[_0xe4bc[67]];_0x5d2ax15++){_0x5d2ax16=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax12[_0x5d2ax15]),_0x5d2ax14=null!=_0x5d2ax16?_0x5d2ax16[_0xe4bc[1710]](!0):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax12[_0x5d2ax15],!0),_0x5d2ax16=null!=_0x5d2ax16?_0x5d2ax16[_0xe4bc[1710]](!1):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax12[_0x5d2ax15],!1),(_0x5d2ax9&&_0x5d2ax14==_0x5d2ax16||_0x5d2ax14!=_0x5d2ax16&&(_0x5d2ax4&&_0x5d2ax16==_0x5d2ax2&&(null==_0x5d2ax3||this[_0xe4bc[1920]](_0x5d2ax14,_0x5d2ax3,_0x5d2axa))||_0x5d2ax5&&_0x5d2ax14==_0x5d2ax2&&(null==_0x5d2ax3||this[_0xe4bc[1920]](_0x5d2ax16,_0x5d2ax3,_0x5d2axa))))&&_0x5d2ax13[_0xe4bc[207]](_0x5d2ax12[_0x5d2ax15])};return _0x5d2ax13};mxGraph[_0xe4bc[202]][_0xe4bc[1920]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax4?this[_0xe4bc[251]][_0xe4bc[1720]](_0x5d2ax3,_0x5d2ax2):this[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax2)==_0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[1808]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!0;_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:!0;var _0x5d2ax9=[],_0x5d2axa={};if(null!=_0x5d2ax2){for(var _0x5d2ax12=0;_0x5d2ax12<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax12++){var _0x5d2ax13=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2[_0x5d2ax12]),_0x5d2ax14=null!=_0x5d2ax13?_0x5d2ax13[_0xe4bc[1710]](!0):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax2[_0x5d2ax12],!0),_0x5d2ax13=null!=_0x5d2ax13?_0x5d2ax13[_0xe4bc[1710]](!1):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax2[_0x5d2ax12],!1);if(_0x5d2ax14==_0x5d2ax3&&null!=_0x5d2ax13&&_0x5d2ax13!=_0x5d2ax3&&_0x5d2ax5){var _0x5d2ax15=mxCellPath[_0xe4bc[385]](_0x5d2ax13);null==_0x5d2axa[_0x5d2ax15]&&(_0x5d2axa[_0x5d2ax15]=_0x5d2ax13,_0x5d2ax9[_0xe4bc[207]](_0x5d2ax13))}else {_0x5d2ax13==_0x5d2ax3&&(null!=_0x5d2ax14&&_0x5d2ax14!=_0x5d2ax3&&_0x5d2ax4)&&(_0x5d2ax15=mxCellPath[_0xe4bc[385]](_0x5d2ax14),null==_0x5d2axa[_0x5d2ax15]&&(_0x5d2axa[_0x5d2ax15]=_0x5d2ax14,_0x5d2ax9[_0xe4bc[207]](_0x5d2ax14)))}}};return _0x5d2ax9};mxGraph[_0xe4bc[202]][_0xe4bc[1781]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!1;for(var _0x5d2ax5=this[_0xe4bc[264]](_0x5d2ax2),_0x5d2ax9=[],_0x5d2axa=0;_0x5d2axa<_0x5d2ax5[_0xe4bc[67]];_0x5d2axa++){var _0x5d2ax12=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax5[_0x5d2axa]),_0x5d2ax13=null!=_0x5d2ax12?_0x5d2ax12[_0xe4bc[1710]](!0):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax5[_0x5d2axa],!0),_0x5d2ax12=null!=_0x5d2ax12?_0x5d2ax12[_0xe4bc[1710]](!1):this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax5[_0x5d2axa],!1);(_0x5d2ax13==_0x5d2ax2&&_0x5d2ax12==_0x5d2ax3||!_0x5d2ax4&&_0x5d2ax13==_0x5d2ax3&&_0x5d2ax12==_0x5d2ax2)&&_0x5d2ax9[_0xe4bc[207]](_0x5d2ax5[_0x5d2axa])};return _0x5d2ax9};mxGraph[_0xe4bc[202]][_0xe4bc[2689]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=mxUtils[_0xe4bc[2196]](this[_0xe4bc[526]],mxEvent[_0xe4bc[731]](_0x5d2ax2),mxEvent[_0xe4bc[733]](_0x5d2ax2)),_0x5d2ax5=this[_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax9=this[_0xe4bc[441]][_0xe4bc[513]],_0x5d2axa=!1!=_0x5d2ax3?this[_0xe4bc[1020]]/2:0;_0x5d2ax4[_0xe4bc[235]]=this[_0xe4bc[1021]](_0x5d2ax4[_0xe4bc[235]]/_0x5d2ax5-_0x5d2ax9[_0xe4bc[235]]-_0x5d2axa);_0x5d2ax4[_0xe4bc[236]]=this[_0xe4bc[1021]](_0x5d2ax4[_0xe4bc[236]]/_0x5d2ax5-_0x5d2ax9[_0xe4bc[236]]-_0x5d2axa);return _0x5d2ax4};mxGraph[_0xe4bc[202]][_0xe4bc[2690]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2axa=null!=_0x5d2axa?_0x5d2axa:[];if(0<_0x5d2ax4||0<_0x5d2ax5){var _0x5d2ax12=_0x5d2ax2+_0x5d2ax4,_0x5d2ax13=_0x5d2ax3+_0x5d2ax5;_0x5d2ax9=_0x5d2ax9||this[_0xe4bc[902]]();if(null!=_0x5d2ax9){for(var _0x5d2ax14=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax9),_0x5d2ax15=0;_0x5d2ax15<_0x5d2ax14;_0x5d2ax15++){var _0x5d2ax16=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax9,_0x5d2ax15),_0x5d2ax17=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax16);if(this[_0xe4bc[1714]](_0x5d2ax16)&&null!=_0x5d2ax17){var _0x5d2ax18=_0x5d2ax17,_0x5d2ax17=mxUtils[_0xe4bc[433]](_0x5d2ax17[_0xe4bc[124]],mxConstants.STYLE_ROTATION)||0;0!=_0x5d2ax17&&(_0x5d2ax18=mxUtils[_0xe4bc[1613]](_0x5d2ax18,_0x5d2ax17));_0x5d2ax18[_0xe4bc[235]]>=_0x5d2ax2&&_0x5d2ax18[_0xe4bc[236]]+_0x5d2ax18[_0xe4bc[119]]<=_0x5d2ax13&&_0x5d2ax18[_0xe4bc[236]]>=_0x5d2ax3&&_0x5d2ax18[_0xe4bc[235]]+_0x5d2ax18[_0xe4bc[117]]<=_0x5d2ax12?_0x5d2axa[_0xe4bc[207]](_0x5d2ax16):this[_0xe4bc[2690]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax16,_0x5d2axa)}}}};return _0x5d2axa};mxGraph[_0xe4bc[202]][_0xe4bc[2691]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=[];if(_0x5d2ax5||_0x5d2ax9){if(null==_0x5d2ax4&&(_0x5d2ax4=this[_0xe4bc[902]]()),null!=_0x5d2ax4){for(var _0x5d2ax12=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax4),_0x5d2ax13=0;_0x5d2ax13<_0x5d2ax12;_0x5d2ax13++){var _0x5d2ax14=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax4,_0x5d2ax13),_0x5d2ax15=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax14);this[_0xe4bc[1714]](_0x5d2ax14)&&null!=_0x5d2ax15&&(!_0x5d2ax5||_0x5d2ax15[_0xe4bc[235]]>=_0x5d2ax2)&&(!_0x5d2ax9||_0x5d2ax15[_0xe4bc[236]]>=_0x5d2ax3)&&_0x5d2axa[_0xe4bc[207]](_0x5d2ax14)}}};return _0x5d2axa};mxGraph[_0xe4bc[202]][_0xe4bc[1757]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!1;_0x5d2ax4=null!=_0x5d2ax4?_0x5d2ax4:!1;var _0x5d2ax5=[];if(null!=_0x5d2ax2){for(var _0x5d2ax9=this[_0xe4bc[502]](),_0x5d2axa=_0x5d2ax9[_0xe4bc[262]](_0x5d2ax2),_0x5d2ax12=null,_0x5d2ax13=0,_0x5d2ax14=0;_0x5d2ax14<_0x5d2axa;_0x5d2ax14++){var _0x5d2ax15=_0x5d2ax9[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax14);if(this[_0xe4bc[251]][_0xe4bc[1193]](_0x5d2ax15)&&this[_0xe4bc[1714]](_0x5d2ax15)){for(var _0x5d2ax16=this[_0xe4bc[1756]](_0x5d2ax15,_0x5d2ax3?_0x5d2ax2:null),_0x5d2ax17=0,_0x5d2ax18=0,_0x5d2ax19=0;_0x5d2ax19<_0x5d2ax16[_0xe4bc[67]];_0x5d2ax19++){this[_0xe4bc[441]][_0xe4bc[1710]](_0x5d2ax16[_0x5d2ax19],!0)==_0x5d2ax15?_0x5d2ax17++:_0x5d2ax18++};(_0x5d2ax4&&0==_0x5d2ax17&&0<_0x5d2ax18||!_0x5d2ax4&&0==_0x5d2ax18&&0<_0x5d2ax17)&&_0x5d2ax5[_0xe4bc[207]](_0x5d2ax15);_0x5d2ax16=_0x5d2ax4?_0x5d2ax18-_0x5d2ax17:_0x5d2ax17-_0x5d2ax18;_0x5d2ax16>_0x5d2ax13&&(_0x5d2ax13=_0x5d2ax16,_0x5d2ax12=_0x5d2ax15)}};0==_0x5d2ax5[_0xe4bc[67]]&&null!=_0x5d2ax12&&_0x5d2ax5[_0xe4bc[207]](_0x5d2ax12)};return _0x5d2ax5};mxGraph[_0xe4bc[202]][_0xe4bc[1706]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax4&&null!=_0x5d2ax2){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;_0x5d2ax9=_0x5d2ax9||[];var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2);if(null==_0x5d2ax9[_0x5d2axa]&&(_0x5d2ax9[_0x5d2axa]=_0x5d2ax2,_0x5d2ax5=_0x5d2ax4(_0x5d2ax2,_0x5d2ax5),null==_0x5d2ax5||_0x5d2ax5)){if(_0x5d2ax5=this[_0xe4bc[251]][_0xe4bc[1707]](_0x5d2ax2),0<_0x5d2ax5){for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax5;_0x5d2axa++){var _0x5d2ax12=this[_0xe4bc[251]][_0xe4bc[1708]](_0x5d2ax2,_0x5d2axa),_0x5d2ax13=this[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax12,!0)==_0x5d2ax2;if(!_0x5d2ax3||_0x5d2ax13){_0x5d2ax13=this[_0xe4bc[251]][_0xe4bc[1709]](_0x5d2ax12,!_0x5d2ax13),this[_0xe4bc[1706]](_0x5d2ax13,_0x5d2ax3,_0x5d2ax4,_0x5d2ax12,_0x5d2ax9)}}}}}};mxGraph[_0xe4bc[202]][_0xe4bc[2692]]=function(_0x5d2ax2){return this[_0xe4bc[2435]]()[_0xe4bc[2097]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2693]]=function(){return this[_0xe4bc[2435]]()[_0xe4bc[1107]]()};mxGraph[_0xe4bc[202]][_0xe4bc[2440]]=function(){return this[_0xe4bc[2435]]()[_0xe4bc[200]]()};mxGraph[_0xe4bc[202]][_0xe4bc[2694]]=function(){return this[_0xe4bc[2435]]()[_0xe4bc[895]][_0xe4bc[67]]};mxGraph[_0xe4bc[202]][_0xe4bc[2452]]=function(){return this[_0xe4bc[2435]]()[_0xe4bc[895]][0]};mxGraph[_0xe4bc[202]][_0xe4bc[897]]=function(){return this[_0xe4bc[2435]]()[_0xe4bc[895]][_0xe4bc[1853]]()};mxGraph[_0xe4bc[202]][_0xe4bc[2450]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[2099]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[904]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[2100]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2695]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[2103]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2696]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[832]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2697]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[2104]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2439]]=function(_0x5d2ax2){this[_0xe4bc[2435]]()[_0xe4bc[842]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2698]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[2690]](_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]],_0x5d2ax2[_0xe4bc[117]],_0x5d2ax2[_0xe4bc[119]]);this[_0xe4bc[2699]](_0x5d2ax4,_0x5d2ax3);return _0x5d2ax4};mxGraph[_0xe4bc[202]][_0xe4bc[2700]]=function(){this[_0xe4bc[2701]](!0)};mxGraph[_0xe4bc[202]][_0xe4bc[2702]]=function(){this[_0xe4bc[2701]]()};mxGraph[_0xe4bc[202]][_0xe4bc[2703]]=function(){this[_0xe4bc[2701]](!1,!0)};mxGraph[_0xe4bc[202]][_0xe4bc[2704]]=function(){this[_0xe4bc[2701]](!1,!1,!0)};mxGraph[_0xe4bc[202]][_0xe4bc[2701]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[2105]],_0x5d2ax9=0<_0x5d2ax5[_0xe4bc[895]][_0xe4bc[67]]?_0x5d2ax5[_0xe4bc[895]][0]:null;1<_0x5d2ax5[_0xe4bc[895]][_0xe4bc[67]]&&_0x5d2ax5[_0xe4bc[200]]();var _0x5d2ax5=null!=_0x5d2ax9?this[_0xe4bc[251]][_0xe4bc[1197]](_0x5d2ax9):this[_0xe4bc[902]](),_0x5d2axa=this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax5);null==_0x5d2ax9&&0<_0x5d2axa?(_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[263]](_0x5d2ax5,0),this[_0xe4bc[2450]](_0x5d2ax2)):(null==_0x5d2ax9||_0x5d2ax3)&&null!=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax5)&&null!=this[_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax5)?this[_0xe4bc[2534]]()!=_0x5d2ax5&&this[_0xe4bc[2450]](_0x5d2ax5):null!=_0x5d2ax9&&_0x5d2ax4?0_0x5d2ax3?_0x5d2axa-1:_0x5d2ax3)),this[_0xe4bc[2450]](_0x5d2ax2))};mxGraph[_0xe4bc[202]][_0xe4bc[2705]]=function(_0x5d2ax2){_0x5d2ax2=_0x5d2ax2||this[_0xe4bc[902]]();_0x5d2ax2=this[_0xe4bc[251]][_0xe4bc[1953]](_0x5d2ax2);null!=_0x5d2ax2&&this[_0xe4bc[904]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2706]]=function(_0x5d2ax2){this[_0xe4bc[2707]](!0,!1,_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2708]]=function(_0x5d2ax2){this[_0xe4bc[2707]](!1,!0,_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2707]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax4=_0x5d2ax4||this[_0xe4bc[902]]();var _0x5d2ax5=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax4){return null!=this[_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax4)&&0==this[_0xe4bc[251]][_0xe4bc[262]](_0x5d2ax4)&&(this[_0xe4bc[251]][_0xe4bc[1193]](_0x5d2ax4)&&_0x5d2ax2||this[_0xe4bc[251]][_0xe4bc[250]](_0x5d2ax4)&&_0x5d2ax3)});_0x5d2ax4=this[_0xe4bc[251]][_0xe4bc[1921]](_0x5d2ax5,_0x5d2ax4);this[_0xe4bc[904]](_0x5d2ax4)};mxGraph[_0xe4bc[202]][_0xe4bc[2459]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[2692]](_0x5d2ax2);this[_0xe4bc[2462]](_0x5d2ax3)?_0x5d2ax4?this[_0xe4bc[2697]](_0x5d2ax2):this[_0xe4bc[2695]](_0x5d2ax2):(!_0x5d2ax4||1!=this[_0xe4bc[2694]]())&&this[_0xe4bc[2450]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2699]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[2462]](_0x5d2ax3)?this[_0xe4bc[2696]](_0x5d2ax2):this[_0xe4bc[904]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[2709]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(this[_0xe4bc[251]][_0xe4bc[250]](_0x5d2ax2[_0xe4bc[246]])?(_0x5d2ax3=this[_0xe4bc[441]][_0xe4bc[2291]](_0x5d2ax2),_0x5d2ax3=this[_0xe4bc[2573]](_0x5d2ax2)||_0x5d2ax3==mxEdgeStyle[_0xe4bc[2568]]||_0x5d2ax3==mxEdgeStyle[_0xe4bc[2569]]||_0x5d2ax3==mxEdgeStyle[_0xe4bc[2570]]? new mxElbowEdgeHandler(_0x5d2ax2):_0x5d2ax3==mxEdgeStyle[_0xe4bc[2567]]||_0x5d2ax3==mxEdgeStyle[_0xe4bc[2572]]? new mxEdgeSegmentHandler(_0x5d2ax2): new mxEdgeHandler(_0x5d2ax2)):_0x5d2ax3= new mxVertexHandler(_0x5d2ax2));return _0x5d2ax3};mxGraph[_0xe4bc[202]][_0xe4bc[1133]]=function(_0x5d2ax2){null==this[_0xe4bc[2329]]&&(this[_0xe4bc[2329]]=[]);this[_0xe4bc[2329]][_0xe4bc[207]](_0x5d2ax2)};mxGraph[_0xe4bc[202]][_0xe4bc[1148]]=function(_0x5d2ax2){if(null!=this[_0xe4bc[2329]]){for(var _0x5d2ax3=0;_0x5d2ax3this[_0xe4bc[2351]]||null!=this[_0xe4bc[2714]]&&Math[_0xe4bc[425]](this[_0xe4bc[2714]]-_0x5d2ax3[_0xe4bc[732]]())>this[_0xe4bc[2351]]){_0x5d2ax5= !0};_0x5d2ax2==mxEvent[_0xe4bc[2715]]&&(this[_0xe4bc[2713]]=_0x5d2ax3[_0xe4bc[730]](),this[_0xe4bc[2714]]=_0x5d2ax3[_0xe4bc[732]]())};if((_0x5d2ax2!=mxEvent[_0xe4bc[2715]]||this[_0xe4bc[1009]])&&_0x5d2ax5){if(_0x5d2ax2==mxEvent[_0xe4bc[2715]]&&(this[_0xe4bc[1009]]= !1),!this[_0xe4bc[2203]]()&&(mxClient[_0xe4bc[71]]||mxClient[_0xe4bc[75]]||mxClient[_0xe4bc[76]]||mxClient[_0xe4bc[80]]&&mxClient[_0xe4bc[48]]||_0x5d2ax3[_0xe4bc[727]]()[_0xe4bc[772]]!=this[_0xe4bc[526]])){_0x5d2ax2==mxEvent[_0xe4bc[2716]]&&(this[_0xe4bc[1009]]&&this[_0xe4bc[1012]])&&this[_0xe4bc[1014]](_0x5d2ax3[_0xe4bc[734]](),_0x5d2ax3[_0xe4bc[735]](),this[_0xe4bc[1013]]);if(null!=this[_0xe4bc[2329]]){_0x5d2ax4=[_0x5d2ax4,_0x5d2ax3];_0x5d2ax3[_0xe4bc[727]]()[_0xe4bc[739]]= !0;for(_0x5d2ax5=0;_0x5d2ax5_0x5d2ax4[_0xe4bc[235]]&&(_0x5d2axa-=_0x5d2ax4[_0xe4bc[235]]);0>_0x5d2ax4[_0xe4bc[236]]&&(_0x5d2ax12-=_0x5d2ax4[_0xe4bc[236]]);if(_0x5d2ax5[_0xe4bc[513]][_0xe4bc[235]]!=_0x5d2axa||_0x5d2ax5[_0xe4bc[513]][_0xe4bc[236]]!=_0x5d2ax12){_0x5d2ax5[_0xe4bc[513]][_0xe4bc[235]]=_0x5d2axa,_0x5d2ax5[_0xe4bc[513]][_0xe4bc[236]]=_0x5d2ax12,_0x5d2ax2= !0};var _0x5d2ax4=_0x5d2ax5[_0xe4bc[513]],_0x5d2ax9=this[_0xe4bc[1097]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2axa=_0x5d2ax9/_0x5d2ax5[_0xe4bc[255]],_0x5d2ax12=1/_0x5d2ax5[_0xe4bc[255]],_0x5d2ax13=this[_0xe4bc[1097]][_0xe4bc[526]];this[_0xe4bc[1562]]= new mxRectangle((_0x5d2ax4[_0xe4bc[235]]-_0x5d2ax3[_0xe4bc[235]]-this[_0xe4bc[1097]][_0xe4bc[1136]])/_0x5d2ax12,(_0x5d2ax4[_0xe4bc[236]]-_0x5d2ax3[_0xe4bc[236]]-this[_0xe4bc[1097]][_0xe4bc[1137]])/_0x5d2ax12,_0x5d2ax13[_0xe4bc[159]]/_0x5d2axa,_0x5d2ax13[_0xe4bc[157]]/_0x5d2axa);this[_0xe4bc[1562]][_0xe4bc[235]]+=this[_0xe4bc[1097]][_0xe4bc[526]][_0xe4bc[360]]*_0x5d2ax5[_0xe4bc[255]]/_0x5d2ax9;this[_0xe4bc[1562]][_0xe4bc[236]]+=this[_0xe4bc[1097]][_0xe4bc[526]][_0xe4bc[190]]*_0x5d2ax5[_0xe4bc[255]]/_0x5d2ax9;_0x5d2ax4=this[_0xe4bc[2732]][_0xe4bc[1562]];if(_0x5d2ax4[_0xe4bc[235]]!=this[_0xe4bc[1562]][_0xe4bc[235]]||_0x5d2ax4[_0xe4bc[236]]!=this[_0xe4bc[1562]][_0xe4bc[236]]||_0x5d2ax4[_0xe4bc[117]]!=this[_0xe4bc[1562]][_0xe4bc[117]]||_0x5d2ax4[_0xe4bc[119]]!=this[_0xe4bc[1562]][_0xe4bc[119]]){this[_0xe4bc[2732]][_0xe4bc[1562]]=this[_0xe4bc[1562]],this[_0xe4bc[2732]][_0xe4bc[258]]()};_0x5d2ax4=this[_0xe4bc[2734]][_0xe4bc[1562]];_0x5d2ax5= new mxRectangle(this[_0xe4bc[1562]][_0xe4bc[235]]+this[_0xe4bc[1562]][_0xe4bc[117]]-_0x5d2ax4[_0xe4bc[117]]/2,this[_0xe4bc[1562]][_0xe4bc[236]]+this[_0xe4bc[1562]][_0xe4bc[119]]-_0x5d2ax4[_0xe4bc[119]]/2,_0x5d2ax4[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[119]]);if(_0x5d2ax4[_0xe4bc[235]]!=_0x5d2ax5[_0xe4bc[235]]||_0x5d2ax4[_0xe4bc[236]]!=_0x5d2ax5[_0xe4bc[236]]||_0x5d2ax4[_0xe4bc[117]]!=_0x5d2ax5[_0xe4bc[117]]||_0x5d2ax4[_0xe4bc[119]]!=_0x5d2ax5[_0xe4bc[119]]){this[_0xe4bc[2734]][_0xe4bc[1562]]=_0x5d2ax5,_0xe4bc[188]!=this[_0xe4bc[2734]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[187]]&&this[_0xe4bc[2734]][_0xe4bc[258]]()};_0x5d2ax2&&this[_0xe4bc[2136]][_0xe4bc[441]][_0xe4bc[2259]]()}}};mxOutline[_0xe4bc[202]][_0xe4bc[787]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[984]]&&this[_0xe4bc[2721]]&&(this[_0xe4bc[499]]=_0x5d2ax3[_0xe4bc[729]](this[_0xe4bc[2734]]),this[_0xe4bc[2739]]=_0x5d2ax3[_0xe4bc[730]](),this[_0xe4bc[2740]]=_0x5d2ax3[_0xe4bc[732]](),this[_0xe4bc[1124]]= !0,this[_0xe4bc[1097]][_0xe4bc[2365]]&&mxUtils[_0xe4bc[1134]](this[_0xe4bc[1097]][_0xe4bc[526]])?(this[_0xe4bc[2741]]=this[_0xe4bc[1097]][_0xe4bc[526]][_0xe4bc[360]],this[_0xe4bc[2742]]=this[_0xe4bc[1097]][_0xe4bc[526]][_0xe4bc[190]]):this[_0xe4bc[2742]]=this[_0xe4bc[2741]]=0);_0x5d2ax3[_0xe4bc[722]]()};mxOutline[_0xe4bc[202]][_0xe4bc[788]]=function(_0x5d2ax2,_0x5d2ax3){if(this[_0xe4bc[1124]]){this[_0xe4bc[2732]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[495]]=this[_0xe4bc[2721]]?_0xe4bc[110]:_0xe4bc[130];this[_0xe4bc[2734]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[495]]=this[_0xe4bc[2732]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[495]];var _0x5d2ax4=_0x5d2ax3[_0xe4bc[730]]()-this[_0xe4bc[2739]],_0x5d2ax5=_0x5d2ax3[_0xe4bc[732]]()-this[_0xe4bc[2740]],_0x5d2ax9=null;if(this[_0xe4bc[499]]){_0x5d2ax9=this[_0xe4bc[1097]][_0xe4bc[526]],_0x5d2ax5=_0x5d2ax4/(_0x5d2ax9[_0xe4bc[159]]/_0x5d2ax9[_0xe4bc[157]]),_0x5d2ax9= new mxRectangle(this[_0xe4bc[1562]][_0xe4bc[235]],this[_0xe4bc[1562]][_0xe4bc[236]],Math[_0xe4bc[160]](1,this[_0xe4bc[1562]][_0xe4bc[117]]+_0x5d2ax4),Math[_0xe4bc[160]](1,this[_0xe4bc[1562]][_0xe4bc[119]]+_0x5d2ax5)),this[_0xe4bc[2732]][_0xe4bc[1562]]=_0x5d2ax9,this[_0xe4bc[2732]][_0xe4bc[258]]()}else {var _0x5d2axa=this[_0xe4bc[2136]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2ax9= new mxRectangle(this[_0xe4bc[1562]][_0xe4bc[235]]+_0x5d2ax4,this[_0xe4bc[1562]][_0xe4bc[236]]+_0x5d2ax5,this[_0xe4bc[1562]][_0xe4bc[117]],this[_0xe4bc[1562]][_0xe4bc[119]]);this[_0xe4bc[2732]][_0xe4bc[1562]]=_0x5d2ax9;this[_0xe4bc[2732]][_0xe4bc[258]]();_0x5d2ax4=_0x5d2ax4/_0x5d2axa*this[_0xe4bc[1097]][_0xe4bc[249]]()[_0xe4bc[255]];_0x5d2ax5=_0x5d2ax5/_0x5d2axa*this[_0xe4bc[1097]][_0xe4bc[249]]()[_0xe4bc[255]];this[_0xe4bc[1097]][_0xe4bc[1135]](-_0x5d2ax4-this[_0xe4bc[2741]],-_0x5d2ax5-this[_0xe4bc[2742]])};_0x5d2ax4=this[_0xe4bc[2734]][_0xe4bc[1562]];this[_0xe4bc[2734]][_0xe4bc[1562]]= new mxRectangle(_0x5d2ax9[_0xe4bc[235]]+_0x5d2ax9[_0xe4bc[117]]-_0x5d2ax4[_0xe4bc[117]]/2,_0x5d2ax9[_0xe4bc[236]]+_0x5d2ax9[_0xe4bc[119]]-_0x5d2ax4[_0xe4bc[119]]/2,_0x5d2ax4[_0xe4bc[117]],_0x5d2ax4[_0xe4bc[119]]);_0xe4bc[188]!=this[_0xe4bc[2734]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[187]]&&this[_0xe4bc[2734]][_0xe4bc[258]]();_0x5d2ax3[_0xe4bc[722]]()}};mxOutline[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){if(this[_0xe4bc[1124]]){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[730]]()-this[_0xe4bc[2739]],_0x5d2ax5=_0x5d2ax3[_0xe4bc[732]]()-this[_0xe4bc[2740]];if(0=this[_0xe4bc[160]])||!this[_0xe4bc[1097]]&&(0==this[_0xe4bc[160]]||_0x5d2axa>=this[_0xe4bc[160]]))){_0x5d2ax12+=this[_0xe4bc[2589]]+_0xe4bc[192]};null!=this[_0xe4bc[2744]]&&(null!=this[_0xe4bc[2745]]&&0=_0x5d2axa){_0x5d2ax18=_0x5d2ax18[_0xe4bc[238]](),_0x5d2ax18[_0xe4bc[513]](-_0x5d2ax3,0)}else {var _0x5d2ax19=Math[_0xe4bc[160]](0,_0x5d2ax16[_0xe4bc[235]]-x0),_0x5d2ax18=_0x5d2ax18[_0xe4bc[238]]();_0x5d2ax18[_0xe4bc[513]](-_0x5d2ax13*_0x5d2ax19,0)}};if(this[_0xe4bc[2766]]()){if(_0x5d2ax16[_0xe4bc[236]]>=_0x5d2ax12){_0x5d2ax18=_0x5d2ax18[_0xe4bc[238]](),_0x5d2ax18[_0xe4bc[513]](0,-_0x5d2ax4)}else {var _0x5d2ax1a=Math[_0xe4bc[160]](0,_0x5d2ax16[_0xe4bc[236]]-_0x5d2ax9),_0x5d2ax18=_0x5d2ax18[_0xe4bc[238]]();_0x5d2ax18[_0xe4bc[513]](0,-_0x5d2ax14*_0x5d2ax1a)}};_0x5d2ax18!=_0x5d2ax17[_0xe4bc[1721]](_0x5d2ax2)&&(_0x5d2ax17[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax18),_0x5d2ax15&&_0x5d2ax5[_0xe4bc[2508]](_0x5d2ax2))}finally{_0x5d2ax17[_0xe4bc[476]]()}}}};mxSpaceManager[_0xe4bc[202]][_0xe4bc[2769]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1703]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[502]]()[_0xe4bc[1197]](_0x5d2ax2[_0xe4bc[246]]),_0x5d2ax5=this[_0xe4bc[2766]](),_0x5d2ax9=this[_0xe4bc[2764]]();return _0x5d2ax3[_0xe4bc[2691]](_0x5d2ax2[_0xe4bc[235]]+(_0x5d2ax5?0:_0x5d2ax2[_0xe4bc[117]]),_0x5d2ax2[_0xe4bc[236]]+(_0x5d2ax5&&_0x5d2ax9?0:_0x5d2ax2[_0xe4bc[119]]),_0x5d2ax4,_0x5d2ax9,_0x5d2ax5)};mxSpaceManager[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[1178]](null)};function mxSwimlaneManager(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[662]]=null!=_0x5d2ax3?_0x5d2ax3:!0;this[_0xe4bc[2771]]=null!=_0x5d2ax4?_0x5d2ax4:!0;this[_0xe4bc[2772]]=null!=_0x5d2ax5?_0x5d2ax5:!0;this[_0xe4bc[2773]]=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[994]]()&&this[_0xe4bc[2774]]()&&this[_0xe4bc[833]](_0x5d2ax3[_0xe4bc[720]](_0xe4bc[895]))});this[_0xe4bc[2758]]=mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[994]]()&&this[_0xe4bc[2775]]()&&this[_0xe4bc[837]](_0x5d2ax3[_0xe4bc[720]](_0xe4bc[895]))});this[_0xe4bc[1178]](_0x5d2ax2)}mxSwimlaneManager[_0xe4bc[202]]= new mxEventSource;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[196]]=mxSwimlaneManager;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[1179]]=null;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[984]]= !0;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[662]]= !0;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2771]]= !0;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2772]]= !0;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2773]]=null;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2758]]=null;mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[994]]=function(){return this[_0xe4bc[984]]};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[995]]=function(_0x5d2ax2){this[_0xe4bc[984]]=_0x5d2ax2};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[1737]]=function(){return this[_0xe4bc[662]]};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2776]]=function(_0x5d2ax2){this[_0xe4bc[662]]=_0x5d2ax2};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2774]]=function(){return this[_0xe4bc[2771]]};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2777]]=function(_0x5d2ax2){this[_0xe4bc[2771]]=_0x5d2ax2};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2775]]=function(){return this[_0xe4bc[2772]]};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2778]]=function(_0x5d2ax2){this[_0xe4bc[2772]]=_0x5d2ax2};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[1703]]=function(){return this[_0xe4bc[1179]]};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[1178]]=function(_0x5d2ax2){null!=this[_0xe4bc[1179]]&&(this[_0xe4bc[1179]][_0xe4bc[745]](this[_0xe4bc[2773]]),this[_0xe4bc[1179]][_0xe4bc[745]](this[_0xe4bc[2758]]));this[_0xe4bc[1179]]=_0x5d2ax2;null!=this[_0xe4bc[1179]]&&(this[_0xe4bc[1179]][_0xe4bc[169]](mxEvent.ADD_CELLS,this[_0xe4bc[2773]]),this[_0xe4bc[1179]][_0xe4bc[169]](mxEvent.CELLS_RESIZED,this[_0xe4bc[2758]]))};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2779]]=function(_0x5d2ax2){return !this[_0xe4bc[1703]]()[_0xe4bc[1730]](_0x5d2ax2)};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2780]]=function(_0x5d2ax2){if(this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax2)){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);_0x5d2ax2=null!=_0x5d2ax3?_0x5d2ax3[_0xe4bc[124]]:this[_0xe4bc[1179]][_0xe4bc[1705]](_0x5d2ax2);return 1==mxUtils[_0xe4bc[433]](_0x5d2ax2,mxConstants.STYLE_HORIZONTAL,1)};return !this[_0xe4bc[1737]]()};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[833]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1703]]()[_0xe4bc[502]]();_0x5d2ax3[_0xe4bc[473]]();try{for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){this[_0xe4bc[2779]](_0x5d2ax2[_0x5d2ax4])||this[_0xe4bc[2781]](_0x5d2ax2[_0x5d2ax4])}}finally{_0x5d2ax3[_0xe4bc[476]]()}}};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2781]]=function(_0x5d2ax2){for(var _0x5d2ax3=this[_0xe4bc[1703]]()[_0xe4bc[502]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[1197]](_0x5d2ax2),_0x5d2ax5=_0x5d2ax3[_0xe4bc[262]](_0x5d2ax4),_0x5d2ax9=null,_0x5d2axa=0;_0x5d2axa<_0x5d2ax5;_0x5d2axa++){var _0x5d2ax12=_0x5d2ax3[_0xe4bc[263]](_0x5d2ax4,_0x5d2axa);if(_0x5d2ax12!=_0x5d2ax2&&!this[_0xe4bc[2779]](_0x5d2ax12)&&(_0x5d2ax9=_0x5d2ax3[_0xe4bc[1721]](_0x5d2ax12),null!=_0x5d2ax9)){break}};null!=_0x5d2ax9&&this[_0xe4bc[2782]](_0x5d2ax2,_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]])};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[837]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1703]]()[_0xe4bc[502]]();_0x5d2ax3[_0xe4bc[473]]();try{for(var _0x5d2ax4=0;_0x5d2ax4<_0x5d2ax2[_0xe4bc[67]];_0x5d2ax4++){if(!this[_0xe4bc[2779]](_0x5d2ax2[_0x5d2ax4])){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[1721]](_0x5d2ax2[_0x5d2ax4]);if(null!=_0x5d2ax5){for(var _0x5d2ax9= new mxRectangle(0,0,_0x5d2ax5[_0xe4bc[117]],_0x5d2ax5[_0xe4bc[119]]),_0x5d2axa=_0x5d2ax2[_0x5d2ax4],_0x5d2ax12=_0x5d2axa;null!=_0x5d2ax12;){var _0x5d2axa=_0x5d2ax12,_0x5d2ax12=_0x5d2ax3[_0xe4bc[1197]](_0x5d2ax12),_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax12)?this[_0xe4bc[1179]][_0xe4bc[1731]](_0x5d2ax12): new mxRectangle;_0x5d2ax9[_0xe4bc[117]]+=_0x5d2ax13[_0xe4bc[117]];_0x5d2ax9[_0xe4bc[119]]+=_0x5d2ax13[_0xe4bc[119]]};this[_0xe4bc[2782]](_0x5d2axa,_0x5d2ax9[_0xe4bc[117]],_0x5d2ax9[_0xe4bc[119]])}}}}finally{_0x5d2ax3[_0xe4bc[476]]()}}};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[2782]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[1703]]()[_0xe4bc[502]]();_0x5d2ax5[_0xe4bc[473]]();try{if(!this[_0xe4bc[2779]](_0x5d2ax2)){var _0x5d2ax9=_0x5d2ax5[_0xe4bc[1721]](_0x5d2ax2);if(null!=_0x5d2ax9){var _0x5d2axa=this[_0xe4bc[2780]](_0x5d2ax2);if(_0x5d2axa&&_0x5d2ax9[_0xe4bc[119]]!=_0x5d2ax4||!_0x5d2axa&&_0x5d2ax9[_0xe4bc[117]]!=_0x5d2ax3){_0x5d2ax9=_0x5d2ax9[_0xe4bc[238]](),_0x5d2axa?_0x5d2ax9[_0xe4bc[119]]=_0x5d2ax4:_0x5d2ax9[_0xe4bc[117]]=_0x5d2ax3,_0x5d2ax5[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax9)}}};var _0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[1730]](_0x5d2ax2)?this[_0xe4bc[1179]][_0xe4bc[1731]](_0x5d2ax2): new mxRectangle;_0x5d2ax3-=_0x5d2ax12[_0xe4bc[117]];_0x5d2ax4-=_0x5d2ax12[_0xe4bc[119]];for(var _0x5d2ax13=_0x5d2ax5[_0xe4bc[262]](_0x5d2ax2),_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax13;_0x5d2ax9++){var _0x5d2ax14=_0x5d2ax5[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax9);this[_0xe4bc[2782]](_0x5d2ax14,_0x5d2ax3,_0x5d2ax4)}}finally{_0x5d2ax5[_0xe4bc[476]]()}};mxSwimlaneManager[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[1178]](null)};function mxTemporaryCellStates(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){this[_0xe4bc[441]]=_0x5d2ax2;_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:1;this[_0xe4bc[2783]]=_0x5d2ax2[_0xe4bc[517]]();this[_0xe4bc[2784]]=_0x5d2ax2[_0xe4bc[2312]]();this[_0xe4bc[2785]]=_0x5d2ax2[_0xe4bc[518]]();_0x5d2ax2[_0xe4bc[1517]]( new mxDictionary);_0x5d2ax2[_0xe4bc[2262]](_0x5d2ax3);if(null!=_0x5d2ax4){_0x5d2ax3=_0x5d2ax2[_0xe4bc[1230]]( new mxCell);for(var _0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){_0x5d2ax2[_0xe4bc[2267]](_0x5d2ax3,_0x5d2ax4[_0x5d2ax5])};for(var _0x5d2ax9=null,_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4[_0xe4bc[67]];_0x5d2ax5++){var _0x5d2axa=_0x5d2ax2[_0xe4bc[2268]](_0x5d2ax3,_0x5d2ax4[_0x5d2ax5]);null==_0x5d2ax9?_0x5d2ax9=_0x5d2axa:_0x5d2ax9[_0xe4bc[99]](_0x5d2axa)};null==_0x5d2ax9&&(_0x5d2ax9= new mxRectangle);_0x5d2ax2[_0xe4bc[2256]](_0x5d2ax9)}}mxTemporaryCellStates[_0xe4bc[202]][_0xe4bc[441]]=null;mxTemporaryCellStates[_0xe4bc[202]][_0xe4bc[2784]]=null;mxTemporaryCellStates[_0xe4bc[202]][_0xe4bc[2783]]=null;mxTemporaryCellStates[_0xe4bc[202]][_0xe4bc[2785]]=null;mxTemporaryCellStates[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[441]][_0xe4bc[2262]](this[_0xe4bc[2785]]);this[_0xe4bc[441]][_0xe4bc[1517]](this[_0xe4bc[2784]]);this[_0xe4bc[441]][_0xe4bc[2256]](this[_0xe4bc[2783]])};function mxCellStatePreview(_0x5d2ax2){this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[2786]]={}}mxCellStatePreview[_0xe4bc[202]][_0xe4bc[1179]]=null;mxCellStatePreview[_0xe4bc[202]][_0xe4bc[2786]]=null;mxCellStatePreview[_0xe4bc[202]][_0xe4bc[2787]]=0;mxCellStatePreview[_0xe4bc[202]][_0xe4bc[1107]]=function(){return 0==this[_0xe4bc[2787]]};mxCellStatePreview[_0xe4bc[202]][_0xe4bc[1194]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5:!0;_0x5d2ax9=null!=_0x5d2ax9?_0x5d2ax9:!0;var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax2[_0xe4bc[246]]),_0x5d2ax12=this[_0xe4bc[2786]][_0x5d2axa];null==_0x5d2ax12?(_0x5d2ax12= new mxPoint(_0x5d2ax3,_0x5d2ax4),this[_0xe4bc[2786]][_0x5d2axa]=_0x5d2ax12,this[_0xe4bc[2787]]++):_0x5d2ax5?(_0x5d2ax12[_0xe4bc[2788]]+=_0x5d2ax3,_0x5d2ax12[_0xe4bc[2789]]+=_0x5d2ax4):(_0x5d2ax12[_0xe4bc[2788]]=_0x5d2ax3,_0x5d2ax12[_0xe4bc[2789]]=_0x5d2ax4);_0x5d2ax9&&this[_0xe4bc[2790]](_0x5d2ax2);return _0x5d2ax12};mxCellStatePreview[_0xe4bc[202]][_0xe4bc[539]]=function(_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[501]](),_0x5d2ax5;for(_0x5d2ax5 in this[_0xe4bc[2786]]){var _0x5d2ax9=mxCellPath[_0xe4bc[2791]](_0x5d2ax4,_0x5d2ax5),_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax9),_0x5d2ax12=this[_0xe4bc[2786]][_0x5d2ax5],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax3[_0xe4bc[1197]](_0x5d2ax9));this[_0xe4bc[2792]](_0x5d2ax9,_0x5d2axa,_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]])};for(_0x5d2ax5 in this[_0xe4bc[2786]]){_0x5d2ax9=mxCellPath[_0xe4bc[2791]](_0x5d2ax4,_0x5d2ax5),_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax9),_0x5d2ax12=this[_0xe4bc[2786]][_0x5d2ax5],_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax3[_0xe4bc[1197]](_0x5d2ax9)),this[_0xe4bc[2793]](_0x5d2ax9,_0x5d2axa,_0x5d2ax12[_0xe4bc[235]],_0x5d2ax12[_0xe4bc[236]],_0x5d2ax2)}};mxCellStatePreview[_0xe4bc[202]][_0xe4bc[2792]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax3){var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[502]]();if(_0x5d2ax9[_0xe4bc[1193]](_0x5d2ax3[_0xe4bc[246]])){_0x5d2ax3[_0xe4bc[2080]]= !0;this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[2267]](_0x5d2ax2,_0x5d2ax3[_0xe4bc[246]]);_0x5d2ax2=_0x5d2ax9[_0xe4bc[1721]](_0x5d2ax3[_0xe4bc[246]]);var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]);if((0!=_0x5d2ax4||0!=_0x5d2ax5)&&null!=_0x5d2ax2&&(!_0x5d2ax2[_0xe4bc[1500]]||null!=this[_0xe4bc[2786]][_0x5d2axa])){_0x5d2ax3[_0xe4bc[235]]+=_0x5d2ax4,_0x5d2ax3[_0xe4bc[236]]+=_0x5d2ax5}};_0x5d2ax2=_0x5d2ax9[_0xe4bc[262]](_0x5d2ax3[_0xe4bc[246]]);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax2;_0x5d2axa++){this[_0xe4bc[2792]](_0x5d2ax3,this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax9[_0xe4bc[263]](_0x5d2ax3[_0xe4bc[246]],_0x5d2axa)),_0x5d2ax4,_0x5d2ax5)}}};mxCellStatePreview[_0xe4bc[202]][_0xe4bc[2793]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax3){_0x5d2ax3[_0xe4bc[2080]]= !0;this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[2268]](_0x5d2ax2,_0x5d2ax3[_0xe4bc[246]]);var _0x5d2axa=mxCellPath[_0xe4bc[385]](_0x5d2ax3[_0xe4bc[246]]),_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax3[_0xe4bc[246]]);if((0!=_0x5d2ax4||0!=_0x5d2ax5)&&null!=_0x5d2ax13&&_0x5d2ax13[_0xe4bc[1500]]&&_0x5d2ax12[_0xe4bc[1193]](_0x5d2ax3[_0xe4bc[246]])&&(null==_0x5d2ax2||_0x5d2ax12[_0xe4bc[1193]](_0x5d2ax2[_0xe4bc[246]])||null!=this[_0xe4bc[2786]][_0x5d2axa])){_0x5d2ax3[_0xe4bc[235]]+=_0x5d2ax4,_0x5d2ax3[_0xe4bc[236]]+=_0x5d2ax5,this[_0xe4bc[1179]][_0xe4bc[259]][_0xe4bc[258]](_0x5d2ax3)};null!=_0x5d2ax9&&_0x5d2ax9(_0x5d2ax3);_0x5d2ax2=_0x5d2ax12[_0xe4bc[262]](_0x5d2ax3[_0xe4bc[246]]);for(_0x5d2axa=0;_0x5d2axa<_0x5d2ax2;_0x5d2axa++){this[_0xe4bc[2793]](_0x5d2ax3,this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax12[_0xe4bc[263]](_0x5d2ax3[_0xe4bc[246]],_0x5d2axa)),_0x5d2ax4,_0x5d2ax5,_0x5d2ax9)}}};mxCellStatePreview[_0xe4bc[202]][_0xe4bc[2790]]=function(_0x5d2ax2){for(var _0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax4=_0x5d2ax3[_0xe4bc[1707]](_0x5d2ax2[_0xe4bc[246]]),_0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4;_0x5d2ax5++){var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax3[_0xe4bc[1708]](_0x5d2ax2[_0xe4bc[246]],_0x5d2ax5));null!=_0x5d2ax9&&this[_0xe4bc[1194]](_0x5d2ax9,0,0)}};function mxConnectionConstraint(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[2546]]=_0x5d2ax2;this[_0xe4bc[591]]=null!=_0x5d2ax3?_0x5d2ax3:!0}mxConnectionConstraint[_0xe4bc[202]][_0xe4bc[2546]]=null;mxConnectionConstraint[_0xe4bc[202]][_0xe4bc[591]]=null;function mxGraphHandler(_0x5d2ax2){this[_0xe4bc[1179]]=_0x5d2ax2;this[_0xe4bc[1179]][_0xe4bc[1133]](this);this[_0xe4bc[2730]]=mxUtils[_0xe4bc[885]](this,function(){this[_0xe4bc[2794]]()});this[_0xe4bc[1179]][_0xe4bc[169]](mxEvent.PAN,this[_0xe4bc[2730]])}mxGraphHandler[_0xe4bc[202]][_0xe4bc[1179]]=null;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2795]]=mxClient[_0xe4bc[80]]?20:50;mxGraphHandler[_0xe4bc[202]][_0xe4bc[984]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2796]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2797]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2798]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[990]]= !1;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2799]]=null;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2800]]=null;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2801]]=null;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2802]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2803]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[846]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2804]]= !1;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2805]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[923]]=6;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2806]]=_0xe4bc[586];mxGraphHandler[_0xe4bc[202]][_0xe4bc[2807]]= !1;mxGraphHandler[_0xe4bc[202]][_0xe4bc[253]]=null;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2808]]= !1;mxGraphHandler[_0xe4bc[202]][_0xe4bc[2809]]= !0;mxGraphHandler[_0xe4bc[202]][_0xe4bc[994]]=function(){return this[_0xe4bc[984]]};mxGraphHandler[_0xe4bc[202]][_0xe4bc[995]]=function(_0x5d2ax2){this[_0xe4bc[984]]=_0x5d2ax2};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2810]]=function(){return this[_0xe4bc[2797]]};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2811]]=function(_0x5d2ax2){this[_0xe4bc[2797]]=_0x5d2ax2};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2812]]=function(){return this[_0xe4bc[2798]]};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2813]]=function(_0x5d2ax2){this[_0xe4bc[2798]]=_0x5d2ax2};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2814]]=function(){return this[_0xe4bc[2803]]};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2815]]=function(_0x5d2ax2){this[_0xe4bc[2803]]=_0x5d2ax2};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2816]]=function(){return this[_0xe4bc[846]]};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2817]]=function(_0x5d2ax2){this[_0xe4bc[846]]=_0x5d2ax2};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2818]]=function(_0x5d2ax2){return _0x5d2ax2[_0xe4bc[736]]()};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2819]]=function(_0x5d2ax2){return this[_0xe4bc[1179]][_0xe4bc[2692]](_0x5d2ax2)};mxGraphHandler[_0xe4bc[202]][_0xe4bc[787]]=function(_0x5d2ax2,_0x5d2ax3){if(!_0x5d2ax3[_0xe4bc[721]]()&&this[_0xe4bc[994]]()&&this[_0xe4bc[1179]][_0xe4bc[994]]()&&!this[_0xe4bc[1179]][_0xe4bc[2579]](_0x5d2ax3[_0xe4bc[727]]())&&null!=_0x5d2ax3[_0xe4bc[248]]()){var _0x5d2ax4=this[_0xe4bc[2818]](_0x5d2ax3);this[_0xe4bc[246]]=null;this[_0xe4bc[2820]]=this[_0xe4bc[2819]](_0x5d2ax4);this[_0xe4bc[2814]]()&&!this[_0xe4bc[2820]]&&this[_0xe4bc[1179]][_0xe4bc[2459]](_0x5d2ax4,_0x5d2ax3[_0xe4bc[727]]());if(this[_0xe4bc[2812]]()){var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[251]],_0x5d2ax9=_0x5d2ax5[_0xe4bc[1721]](_0x5d2ax4);this[_0xe4bc[1179]][_0xe4bc[1712]](_0x5d2ax4)&&(!_0x5d2ax5[_0xe4bc[250]](_0x5d2ax4)||1_0x5d2ax5||Math[_0xe4bc[425]](_0x5d2axa)>_0x5d2ax5){null==this[_0xe4bc[1016]]&&(this[_0xe4bc[1016]]= new mxCellHighlight(this[_0xe4bc[1179]],mxConstants.DROP_TARGET_COLOR,3));null==this[_0xe4bc[253]]&&(this[_0xe4bc[253]]=this[_0xe4bc[2825]](this[_0xe4bc[1562]]));var _0x5d2ax12=_0x5d2ax4[_0xe4bc[1018]](_0x5d2ax3[_0xe4bc[727]]()),_0x5d2ax5=!0;if(null!=this[_0xe4bc[2799]]&&this[_0xe4bc[2827]](_0x5d2ax3)){_0x5d2axa=this[_0xe4bc[2799]][_0xe4bc[582]](this[_0xe4bc[1562]], new mxPoint(_0x5d2ax9,_0x5d2axa),_0x5d2ax12),_0x5d2ax5= !1,_0x5d2ax9=_0x5d2axa[_0xe4bc[235]],_0x5d2axa=_0x5d2axa[_0xe4bc[236]]}else {if(_0x5d2ax12){var _0x5d2ax13=_0x5d2ax4[_0xe4bc[249]]()[_0xe4bc[513]],_0x5d2ax14=_0x5d2ax4[_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2ax12=this[_0xe4bc[1562]][_0xe4bc[235]]-(_0x5d2ax4[_0xe4bc[1021]](this[_0xe4bc[1562]][_0xe4bc[235]]/_0x5d2ax14-_0x5d2ax13[_0xe4bc[235]])+_0x5d2ax13[_0xe4bc[235]])*_0x5d2ax14,_0x5d2ax13=this[_0xe4bc[1562]][_0xe4bc[236]]-(_0x5d2ax4[_0xe4bc[1021]](this[_0xe4bc[1562]][_0xe4bc[236]]/_0x5d2ax14-_0x5d2ax13[_0xe4bc[236]])+_0x5d2ax13[_0xe4bc[236]])*_0x5d2ax14,_0x5d2axa=this[_0xe4bc[1021]]( new mxPoint(_0x5d2ax9,_0x5d2axa)),_0x5d2ax9=_0x5d2axa[_0xe4bc[235]]-_0x5d2ax12,_0x5d2axa=_0x5d2axa[_0xe4bc[236]]-_0x5d2ax13}};null!=this[_0xe4bc[2799]]&&_0x5d2ax5&&this[_0xe4bc[2799]][_0xe4bc[801]]();_0x5d2ax4[_0xe4bc[2578]](_0x5d2ax3[_0xe4bc[727]]())&&(Math[_0xe4bc[425]](_0x5d2ax9)>Math[_0xe4bc[425]](_0x5d2axa)?_0x5d2axa=0:_0x5d2ax9=0);this[_0xe4bc[2800]]=_0x5d2ax9;this[_0xe4bc[2801]]=_0x5d2axa;this[_0xe4bc[2794]]();_0x5d2ax5=null;_0x5d2axa=_0x5d2ax3[_0xe4bc[736]]();_0x5d2ax4[_0xe4bc[1015]]()&&this[_0xe4bc[2796]]&&(_0x5d2ax5=_0x5d2ax4[_0xe4bc[564]](this[_0xe4bc[895]],_0x5d2ax3[_0xe4bc[727]](),_0x5d2axa));_0x5d2ax12=_0x5d2ax5;for(_0x5d2ax13=_0x5d2ax4[_0xe4bc[502]]();null!=_0x5d2ax12&&_0x5d2ax12!=this[_0xe4bc[895]][0];){_0x5d2ax12=_0x5d2ax13[_0xe4bc[1197]](_0x5d2ax12)};var _0x5d2ax14=_0x5d2ax4[_0xe4bc[2574]](_0x5d2ax3[_0xe4bc[727]]())&&_0x5d2ax4[_0xe4bc[2617]]()&&this[_0xe4bc[2810]](),_0x5d2ax9=_0x5d2ax4[_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax5),_0x5d2ax15=!1;null!=_0x5d2ax9&&null==_0x5d2ax12&&(_0x5d2ax13[_0xe4bc[1197]](this[_0xe4bc[246]])!=_0x5d2ax5||_0x5d2ax14)?(this[_0xe4bc[772]]!=_0x5d2ax5&&(this[_0xe4bc[772]]=_0x5d2ax5,this[_0xe4bc[2828]](mxConstants.DROP_TARGET_COLOR)),_0x5d2ax15= !0):(this[_0xe4bc[772]]=null,this[_0xe4bc[2804]]&&(null!=_0x5d2axa&&1==this[_0xe4bc[895]][_0xe4bc[67]]&&_0x5d2ax4[_0xe4bc[502]]()[_0xe4bc[1193]](_0x5d2axa)&&_0x5d2ax4[_0xe4bc[2565]](_0x5d2axa))&&(_0x5d2ax9=_0x5d2ax4[_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2axa),null!=_0x5d2ax9&&(_0x5d2ax4=null==_0x5d2ax4[_0xe4bc[2500]](null,this[_0xe4bc[246]],_0x5d2axa)?mxConstants[_0xe4bc[2829]]:mxConstants[_0xe4bc[2830]],this[_0xe4bc[2828]](_0x5d2ax4),_0x5d2ax15= !0)));null!=_0x5d2ax9&&_0x5d2ax15?this[_0xe4bc[1016]][_0xe4bc[1016]](_0x5d2ax9):this[_0xe4bc[1016]][_0xe4bc[801]]()};_0x5d2ax3[_0xe4bc[722]]();mxEvent[_0xe4bc[722]](_0x5d2ax3[_0xe4bc[727]]())}else {if((this[_0xe4bc[2812]]()||this[_0xe4bc[2810]]())&&this[_0xe4bc[2802]]&&!_0x5d2ax3[_0xe4bc[721]]()&&null!=_0x5d2ax3[_0xe4bc[248]]()&&!_0x5d2ax4[_0xe4bc[1009]]){_0x5d2ax9=_0x5d2ax4[_0xe4bc[2599]](_0x5d2ax3[_0xe4bc[736]]()),null==_0x5d2ax9&&(_0x5d2ax4[_0xe4bc[994]]()&&_0x5d2ax4[_0xe4bc[1712]](_0x5d2ax3[_0xe4bc[736]]()))&&(_0x5d2ax9=_0x5d2ax4[_0xe4bc[502]]()[_0xe4bc[250]](_0x5d2ax3[_0xe4bc[736]]())?mxConstants[_0xe4bc[2831]]:mxConstants[_0xe4bc[2832]]),_0x5d2ax3[_0xe4bc[248]]()[_0xe4bc[1609]](_0x5d2ax9),_0x5d2ax3[_0xe4bc[722]]()}}};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2794]]=function(){null!=this[_0xe4bc[253]]&&(this[_0xe4bc[253]][_0xe4bc[1562]]= new mxRectangle(Math[_0xe4bc[488]](this[_0xe4bc[2826]][_0xe4bc[235]]+this[_0xe4bc[2800]]-this[_0xe4bc[1179]][_0xe4bc[1136]]),Math[_0xe4bc[488]](this[_0xe4bc[2826]][_0xe4bc[236]]+this[_0xe4bc[2801]]-this[_0xe4bc[1179]][_0xe4bc[1137]]),this[_0xe4bc[2826]][_0xe4bc[117]],this[_0xe4bc[2826]][_0xe4bc[119]]),this[_0xe4bc[253]][_0xe4bc[258]]())};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2828]]=function(_0x5d2ax2){null!=this[_0xe4bc[1016]]&&this[_0xe4bc[1016]][_0xe4bc[2828]](_0x5d2ax2)};mxGraphHandler[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){if(!_0x5d2ax3[_0xe4bc[721]]()){var _0x5d2ax4=this[_0xe4bc[1179]];if(null!=this[_0xe4bc[246]]&&null!=this[_0xe4bc[2823]]&&null!=this[_0xe4bc[253]]&&null!=this[_0xe4bc[2800]]&&null!=this[_0xe4bc[2801]]){var _0x5d2ax5=_0x5d2ax4[_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2ax9=_0x5d2ax4[_0xe4bc[2574]](_0x5d2ax3[_0xe4bc[727]]())&&_0x5d2ax4[_0xe4bc[2617]]()&&this[_0xe4bc[2810]](),_0x5d2axa=this[_0xe4bc[2800]]/_0x5d2ax5,_0x5d2ax5=this[_0xe4bc[2801]]/_0x5d2ax5,_0x5d2ax12=_0x5d2ax3[_0xe4bc[736]]();this[_0xe4bc[2804]]&&null==this[_0xe4bc[772]]&&null!=_0x5d2ax12&&_0x5d2ax4[_0xe4bc[502]]()[_0xe4bc[1193]](_0x5d2ax12)&&_0x5d2ax4[_0xe4bc[2565]](_0x5d2ax12)&&_0x5d2ax4[_0xe4bc[2581]](null,this[_0xe4bc[246]],_0x5d2ax12)?_0x5d2ax4[_0xe4bc[2433]][_0xe4bc[807]](this[_0xe4bc[246]],_0x5d2ax12,_0x5d2ax3[_0xe4bc[727]]()):(_0x5d2ax12=this[_0xe4bc[772]],_0x5d2ax4[_0xe4bc[2655]]()&&_0x5d2ax4[_0xe4bc[2686]](_0x5d2ax12,this[_0xe4bc[895]],_0x5d2ax3[_0xe4bc[727]]())?_0x5d2ax4[_0xe4bc[853]](_0x5d2ax12,this[_0xe4bc[895]],null,_0x5d2axa,_0x5d2ax5):this[_0xe4bc[834]](this[_0xe4bc[895]],_0x5d2axa,_0x5d2ax5,_0x5d2ax9,this[_0xe4bc[772]],_0x5d2ax3[_0xe4bc[727]]()))}else {this[_0xe4bc[2814]]()&&(this[_0xe4bc[2820]]&&null!=this[_0xe4bc[246]])&&this[_0xe4bc[2833]](_0x5d2ax3)}};this[_0xe4bc[2821]]&&_0x5d2ax3[_0xe4bc[722]]();this[_0xe4bc[862]]()};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2833]]=function(_0x5d2ax2){this[_0xe4bc[1179]][_0xe4bc[2459]](this[_0xe4bc[246]],_0x5d2ax2[_0xe4bc[727]]())};mxGraphHandler[_0xe4bc[202]][_0xe4bc[862]]=function(){this[_0xe4bc[2834]]();this[_0xe4bc[2820]]=this[_0xe4bc[2821]]= !1;this[_0xe4bc[772]]=this[_0xe4bc[246]]=this[_0xe4bc[2823]]=this[_0xe4bc[2835]]=this[_0xe4bc[2801]]=this[_0xe4bc[2800]]=null};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2836]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1193]](_0x5d2ax2)){_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[248]](_0x5d2ax2);_0x5d2ax4=mxUtils[_0xe4bc[2196]](this[_0xe4bc[1179]][_0xe4bc[526]],mxEvent[_0xe4bc[731]](_0x5d2ax4),mxEvent[_0xe4bc[733]](_0x5d2ax4));var _0x5d2ax5=mxUtils[_0xe4bc[431]](mxUtils[_0xe4bc[433]](_0x5d2ax2[_0xe4bc[124]],mxConstants.STYLE_ROTATION)||0);if(0!=_0x5d2ax5){_0x5d2ax3=Math[_0xe4bc[426]](-_0x5d2ax5);var _0x5d2ax5=Math[_0xe4bc[427]](-_0x5d2ax5),_0x5d2ax9= new mxPoint(_0x5d2ax2[_0xe4bc[241]](),_0x5d2ax2[_0xe4bc[242]]());_0x5d2ax4=mxUtils[_0xe4bc[432]](_0x5d2ax4,_0x5d2ax3,_0x5d2ax5,_0x5d2ax9)};return null!=_0x5d2ax2&&!mxUtils[_0xe4bc[442]](_0x5d2ax2,_0x5d2ax4[_0xe4bc[235]],_0x5d2ax4[_0xe4bc[236]])};return !1};mxGraphHandler[_0xe4bc[202]][_0xe4bc[834]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa){_0x5d2ax5&&(_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[2615]](_0x5d2ax2));null==_0x5d2ax9&&(this[_0xe4bc[2816]]()&&this[_0xe4bc[2836]](this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1197]](this[_0xe4bc[246]]),_0x5d2ax2,_0x5d2axa))&&(_0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[902]]());_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[834]](_0x5d2ax2,_0x5d2ax3-this[_0xe4bc[1179]][_0xe4bc[1136]]/this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax4-this[_0xe4bc[1179]][_0xe4bc[1137]]/this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax5,_0x5d2ax9,_0x5d2axa);this[_0xe4bc[2814]]()&&this[_0xe4bc[2805]]&&this[_0xe4bc[1179]][_0xe4bc[2564]](_0x5d2ax2[0]);_0x5d2ax5&&this[_0xe4bc[1179]][_0xe4bc[904]](_0x5d2ax2)};mxGraphHandler[_0xe4bc[202]][_0xe4bc[2834]]=function(){null!=this[_0xe4bc[253]]&&(this[_0xe4bc[253]][_0xe4bc[515]](),this[_0xe4bc[253]]=null);null!=this[_0xe4bc[2799]]&&(this[_0xe4bc[2799]][_0xe4bc[515]](),this[_0xe4bc[2799]]=null);null!=this[_0xe4bc[1016]]&&(this[_0xe4bc[1016]][_0xe4bc[515]](),this[_0xe4bc[1016]]=null)};mxGraphHandler[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[1179]][_0xe4bc[1148]](this);this[_0xe4bc[1179]][_0xe4bc[745]](this[_0xe4bc[2730]]);this[_0xe4bc[2834]]()};function mxPanningHandler(_0x5d2ax2,_0x5d2ax3){null!=_0x5d2ax2&&(this[_0xe4bc[1179]]=_0x5d2ax2,this[_0xe4bc[1033]]=_0x5d2ax3,this[_0xe4bc[1179]][_0xe4bc[1133]](this),this[_0xe4bc[176]]())}mxPanningHandler[_0xe4bc[202]]= new mxPopupMenu;mxPanningHandler[_0xe4bc[202]][_0xe4bc[196]]=mxPanningHandler;mxPanningHandler[_0xe4bc[202]][_0xe4bc[1179]]=null;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2837]]=null;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2838]]=null;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2839]]= !0;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2840]]= !1;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2841]]= !0;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2842]]= !0;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2843]]= !1;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2844]]= !0;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2845]]= !1;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2431]]= !0;mxPanningHandler[_0xe4bc[202]][_0xe4bc[2846]]=function(){return this[_0xe4bc[2431]]};mxPanningHandler[_0xe4bc[202]][_0xe4bc[2847]]=function(_0x5d2ax2){this[_0xe4bc[2431]]=_0x5d2ax2};mxPanningHandler[_0xe4bc[202]][_0xe4bc[176]]=function(){mxPopupMenu[_0xe4bc[202]][_0xe4bc[176]][_0xe4bc[183]](this);mxEvent[_0xe4bc[169]](this[_0xe4bc[485]],mxClient[_0xe4bc[754]]?_0xe4bc[756]:_0xe4bc[752],mxUtils[_0xe4bc[885]](this,function(_0x5d2ax2){this[_0xe4bc[1179]][_0xe4bc[2276]][_0xe4bc[801]]()}))};mxPanningHandler[_0xe4bc[202]][_0xe4bc[2848]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[727]]();return this[_0xe4bc[2840]]&&(this[_0xe4bc[2843]]||null==_0x5d2ax2[_0xe4bc[248]]())&&mxEvent[_0xe4bc[1158]](_0x5d2ax3)||mxEvent[_0xe4bc[775]](_0x5d2ax3)&&mxEvent[_0xe4bc[774]](_0x5d2ax3)||this[_0xe4bc[2839]]&&mxEvent[_0xe4bc[737]](_0x5d2ax3)};mxPanningHandler[_0xe4bc[202]][_0xe4bc[787]]=function(_0x5d2ax2,_0x5d2ax3){if(!_0x5d2ax3[_0xe4bc[721]]()&&this[_0xe4bc[994]]()){this[_0xe4bc[1032]]();this[_0xe4bc[2741]]=-this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[360]];this[_0xe4bc[2742]]=-this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[190]];var _0x5d2ax4=mxUtils[_0xe4bc[2196]](this[_0xe4bc[1179]][_0xe4bc[526]],_0x5d2ax3[_0xe4bc[730]](),_0x5d2ax3[_0xe4bc[732]]());this[_0xe4bc[2837]]=_0x5d2ax4[_0xe4bc[235]];this[_0xe4bc[2838]]=_0x5d2ax4[_0xe4bc[236]];this[_0xe4bc[2849]]=this[_0xe4bc[737]](_0x5d2ax3);this[_0xe4bc[2850]]=this[_0xe4bc[2846]]()&&this[_0xe4bc[2848]](_0x5d2ax3);this[_0xe4bc[2739]]=_0x5d2ax3[_0xe4bc[730]]();this[_0xe4bc[2740]]=_0x5d2ax3[_0xe4bc[732]]();this[_0xe4bc[2850]]&&this[_0xe4bc[2851]](_0x5d2ax3)}};mxPanningHandler[_0xe4bc[202]][_0xe4bc[2851]]=function(_0x5d2ax2){_0x5d2ax2[_0xe4bc[722]]()};mxPanningHandler[_0xe4bc[202]][_0xe4bc[788]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax3[_0xe4bc[730]]()-this[_0xe4bc[2739]],_0x5d2ax5=_0x5d2ax3[_0xe4bc[732]]()-this[_0xe4bc[2740]];if(this[_0xe4bc[1124]]){this[_0xe4bc[2844]]&&(this[_0xe4bc[2845]]&&(_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax4),_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax5)),this[_0xe4bc[1179]][_0xe4bc[1135]](_0x5d2ax4+this[_0xe4bc[2741]],_0x5d2ax5+this[_0xe4bc[2742]])),this[_0xe4bc[746]]( new mxEventObject(mxEvent.PAN,_0xe4bc[763],_0x5d2ax3)),_0x5d2ax3[_0xe4bc[722]]()}else {if(this[_0xe4bc[2850]]){var _0x5d2ax9=this[_0xe4bc[1124]];this[_0xe4bc[1124]]=Math[_0xe4bc[425]](_0x5d2ax4)>this[_0xe4bc[1179]][_0xe4bc[2353]]||Math[_0xe4bc[425]](_0x5d2ax5)>this[_0xe4bc[1179]][_0xe4bc[2353]];!_0x5d2ax9&&this[_0xe4bc[1124]]&&this[_0xe4bc[746]]( new mxEventObject(mxEvent.PAN_START,_0xe4bc[763],_0x5d2ax3))}}};mxPanningHandler[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=Math[_0xe4bc[425]](_0x5d2ax3[_0xe4bc[730]]()-this[_0xe4bc[2739]]),_0x5d2ax5=Math[_0xe4bc[425]](_0x5d2ax3[_0xe4bc[732]]()-this[_0xe4bc[2740]]);if(this[_0xe4bc[1124]]){if(!this[_0xe4bc[1179]][_0xe4bc[2365]]||!mxUtils[_0xe4bc[1134]](this[_0xe4bc[1179]][_0xe4bc[526]])){_0x5d2ax4=_0x5d2ax3[_0xe4bc[730]]()-this[_0xe4bc[2739]];_0x5d2ax5=_0x5d2ax3[_0xe4bc[732]]()-this[_0xe4bc[2740]];this[_0xe4bc[2845]]&&(_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax4),_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax5));var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[255]],_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[513]];this[_0xe4bc[1179]][_0xe4bc[1135]](0,0);this[_0xe4bc[1135]](_0x5d2axa[_0xe4bc[235]]+_0x5d2ax4/_0x5d2ax9,_0x5d2axa[_0xe4bc[236]]+_0x5d2ax5/_0x5d2ax9)};this[_0xe4bc[1124]]= !1;this[_0xe4bc[746]]( new mxEventObject(mxEvent.PAN_END,_0xe4bc[763],_0x5d2ax3));_0x5d2ax3[_0xe4bc[722]]()}else {this[_0xe4bc[2849]]&&(_0x5d2ax4this[_0xe4bc[1179]][_0xe4bc[2353]]||_0x5d2ax12>this[_0xe4bc[1179]][_0xe4bc[2353]])){this[_0xe4bc[253]]=this[_0xe4bc[2156]](),this[_0xe4bc[2928]](_0x5d2ax3)};null!=this[_0xe4bc[253]]&&(null!=this[_0xe4bc[2897]]?this[_0xe4bc[253]][_0xe4bc[1525]]=this[_0xe4bc[2897]][_0xe4bc[439]]:(_0x5d2ax4=[_0x5d2axa],null!=this[_0xe4bc[2922]]&&(_0x5d2ax4=_0x5d2ax4[_0xe4bc[1919]](this[_0xe4bc[2922]])),_0x5d2ax4[_0xe4bc[207]](_0x5d2ax9),this[_0xe4bc[253]][_0xe4bc[1525]]=_0x5d2ax4),this[_0xe4bc[2932]]());mxEvent[_0xe4bc[722]](_0x5d2ax3[_0xe4bc[727]]());_0x5d2ax3[_0xe4bc[722]]()}else {!this[_0xe4bc[994]]()||!this[_0xe4bc[1179]][_0xe4bc[994]]()?this[_0xe4bc[2886]][_0xe4bc[862]]():this[_0xe4bc[257]]!=this[_0xe4bc[2915]]&&null==this[_0xe4bc[2897]]?(this[_0xe4bc[2906]](this[_0xe4bc[2904]]),this[_0xe4bc[2904]]=null,null!=this[_0xe4bc[2915]]&&null==this[_0xe4bc[267]]&&(this[_0xe4bc[2904]]=this[_0xe4bc[2913]](this[_0xe4bc[2915]]),null==this[_0xe4bc[2904]]&&(this[_0xe4bc[2915]][_0xe4bc[1609]](mxConstants.CURSOR_CONNECT),_0x5d2ax3[_0xe4bc[722]]())),this[_0xe4bc[257]]=this[_0xe4bc[2915]]):this[_0xe4bc[257]]==this[_0xe4bc[2915]]&&(null!=this[_0xe4bc[2915]]&&null==this[_0xe4bc[2904]]&&!this[_0xe4bc[1179]][_0xe4bc[1009]])&&_0x5d2ax3[_0xe4bc[722]]()};null!=this[_0xe4bc[2886]][_0xe4bc[2920]]&&this[_0xe4bc[2885]][_0xe4bc[862]]();if(!this[_0xe4bc[1179]][_0xe4bc[1009]]&&null!=this[_0xe4bc[2915]]&&null!=this[_0xe4bc[2904]]){_0x5d2ax4= !1;_0x5d2axa=_0x5d2ax3[_0xe4bc[728]]();for(_0x5d2ax9=0;_0x5d2ax9this[_0xe4bc[1179]][_0xe4bc[2353]]||_0x5d2ax3>this[_0xe4bc[1179]][_0xe4bc[2353]])){null==this[_0xe4bc[2922]]&&(this[_0xe4bc[2922]]=[]),_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax3= new mxPoint(this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax2[_0xe4bc[734]]()/_0x5d2ax4)*_0x5d2ax4,this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax2[_0xe4bc[735]]()/_0x5d2ax4)*_0x5d2ax4),this[_0xe4bc[2922]][_0xe4bc[207]](_0x5d2ax3)}};mxConnectionHandler[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){if(!_0x5d2ax3[_0xe4bc[721]]()&&this[_0xe4bc[2908]]()){if(this[_0xe4bc[2887]]&&!this[_0xe4bc[2934]](_0x5d2ax3)){this[_0xe4bc[2935]](_0x5d2ax3);_0x5d2ax3[_0xe4bc[722]]();return};if(null==this[_0xe4bc[267]]){var _0x5d2ax4=null!=this[_0xe4bc[257]]?this[_0xe4bc[257]][_0xe4bc[246]]:null,_0x5d2ax5=null;null!=this[_0xe4bc[2886]][_0xe4bc[2920]]&&null!=this[_0xe4bc[2886]][_0xe4bc[2919]]&&(_0x5d2ax5=this[_0xe4bc[2886]][_0xe4bc[2919]][_0xe4bc[246]]);null==_0x5d2ax5&&this[_0xe4bc[2885]][_0xe4bc[2867]]()&&(_0x5d2ax5=this[_0xe4bc[2885]][_0xe4bc[2861]][_0xe4bc[246]]);this[_0xe4bc[807]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax3[_0xe4bc[727]](),_0x5d2ax3[_0xe4bc[736]]())}else {null!=this[_0xe4bc[257]]&&(null!=this[_0xe4bc[2885]][_0xe4bc[2861]]&&this[_0xe4bc[257]][_0xe4bc[246]]==this[_0xe4bc[2885]][_0xe4bc[2861]][_0xe4bc[246]])&&this[_0xe4bc[1179]][_0xe4bc[2459]](this[_0xe4bc[2885]][_0xe4bc[1097]],evt),0_0x5d2ax12||Math[_0xe4bc[425]](_0x5d2axa)>_0x5d2ax12){null==this[_0xe4bc[485]]&&(this[_0xe4bc[485]]=this[_0xe4bc[2156]]()),mxUtils[_0xe4bc[2440]](),this[_0xe4bc[2729]](_0x5d2ax5,_0x5d2ax4),_0x5d2ax3[_0xe4bc[722]]()}}};mxRubberband[_0xe4bc[202]][_0xe4bc[2156]]=function(){null==this[_0xe4bc[2952]]&&(this[_0xe4bc[2952]]=document[_0xe4bc[55]](_0xe4bc[485]),this[_0xe4bc[2952]][_0xe4bc[926]]=_0xe4bc[2956],mxUtils[_0xe4bc[254]](this[_0xe4bc[2952]],this[_0xe4bc[2951]]));this[_0xe4bc[1179]][_0xe4bc[526]][_0xe4bc[62]](this[_0xe4bc[2952]]);return this[_0xe4bc[2952]]};mxRubberband[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=null!=this[_0xe4bc[485]];this[_0xe4bc[862]]();_0x5d2ax4&&(_0x5d2ax4= new mxRectangle(this[_0xe4bc[235]],this[_0xe4bc[236]],this[_0xe4bc[117]],this[_0xe4bc[119]]),this[_0xe4bc[1179]][_0xe4bc[2698]](_0x5d2ax4,_0x5d2ax3[_0xe4bc[727]]()),_0x5d2ax3[_0xe4bc[722]]())};mxRubberband[_0xe4bc[202]][_0xe4bc[862]]=function(){null!=this[_0xe4bc[485]]&&this[_0xe4bc[485]][_0xe4bc[265]][_0xe4bc[266]](this[_0xe4bc[485]]);null!=this[_0xe4bc[2955]]&&(mxEvent[_0xe4bc[745]](document,_0xe4bc[752],this[_0xe4bc[2955]]),this[_0xe4bc[2955]]=null);null!=this[_0xe4bc[981]]&&(mxEvent[_0xe4bc[745]](document,_0xe4bc[753],this[_0xe4bc[981]]),this[_0xe4bc[981]]=null);this[_0xe4bc[2954]]=this[_0xe4bc[2953]]=0;this[_0xe4bc[485]]=this[_0xe4bc[2823]]=null};mxRubberband[_0xe4bc[202]][_0xe4bc[2729]]=function(_0x5d2ax2,_0x5d2ax3){this[_0xe4bc[2953]]=_0x5d2ax2;this[_0xe4bc[2954]]=_0x5d2ax3;this[_0xe4bc[2950]]()};mxRubberband[_0xe4bc[202]][_0xe4bc[2950]]=function(){if(null!=this[_0xe4bc[485]]){var _0x5d2ax2=this[_0xe4bc[2953]]-this[_0xe4bc[1179]][_0xe4bc[1136]],_0x5d2ax3=this[_0xe4bc[2954]]-this[_0xe4bc[1179]][_0xe4bc[1137]];this[_0xe4bc[235]]=Math[_0xe4bc[243]](this[_0xe4bc[2823]][_0xe4bc[235]],_0x5d2ax2);this[_0xe4bc[236]]=Math[_0xe4bc[243]](this[_0xe4bc[2823]][_0xe4bc[236]],_0x5d2ax3);this[_0xe4bc[117]]=Math[_0xe4bc[160]](this[_0xe4bc[2823]][_0xe4bc[235]],_0x5d2ax2)-this[_0xe4bc[235]];this[_0xe4bc[119]]=Math[_0xe4bc[160]](this[_0xe4bc[2823]][_0xe4bc[236]],_0x5d2ax3)-this[_0xe4bc[236]];_0x5d2ax2=mxClient[_0xe4bc[47]]?this[_0xe4bc[1179]][_0xe4bc[1137]]:0;this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[361]]=this[_0xe4bc[235]]+(mxClient[_0xe4bc[47]]?this[_0xe4bc[1179]][_0xe4bc[1136]]:0)+_0xe4bc[168];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[125]]=this[_0xe4bc[236]]+_0x5d2ax2+_0xe4bc[168];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[117]]=Math[_0xe4bc[160]](1,this[_0xe4bc[117]])+_0xe4bc[168];this[_0xe4bc[485]][_0xe4bc[124]][_0xe4bc[119]]=Math[_0xe4bc[160]](1,this[_0xe4bc[119]])+_0xe4bc[168]}};mxRubberband[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[2717]]||(this[_0xe4bc[2717]]= !0,this[_0xe4bc[1179]][_0xe4bc[1148]](this),this[_0xe4bc[1179]][_0xe4bc[745]](this[_0xe4bc[2730]]),this[_0xe4bc[862]](),null!=this[_0xe4bc[2952]]&&(this[_0xe4bc[2952]]=null))};function mxVertexHandler(_0x5d2ax2){null!=_0x5d2ax2&&(this[_0xe4bc[724]]=_0x5d2ax2,this[_0xe4bc[176]]())}mxVertexHandler[_0xe4bc[202]][_0xe4bc[1179]]=null;mxVertexHandler[_0xe4bc[202]][_0xe4bc[724]]=null;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2957]]= !1;mxVertexHandler[_0xe4bc[202]][_0xe4bc[1983]]=null;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2958]]= !0;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2959]]=null;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2353]]=0;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2809]]= !1;mxVertexHandler[_0xe4bc[202]][_0xe4bc[2960]]= !0;mxVertexHandler[_0xe4bc[202]][_0xe4bc[176]]=function(){this[_0xe4bc[1179]]=this[_0xe4bc[724]][_0xe4bc[441]][_0xe4bc[1179]];this[_0xe4bc[2961]]=this[_0xe4bc[2962]](this[_0xe4bc[724]]);this[_0xe4bc[1562]]= new mxRectangle(this[_0xe4bc[2961]][_0xe4bc[235]],this[_0xe4bc[2961]][_0xe4bc[236]],this[_0xe4bc[2961]][_0xe4bc[117]],this[_0xe4bc[2961]][_0xe4bc[119]]);this[_0xe4bc[2732]]=this[_0xe4bc[2963]](this[_0xe4bc[1562]]);this[_0xe4bc[2732]][_0xe4bc[507]]=this[_0xe4bc[1179]][_0xe4bc[507]]!=mxConstants[_0xe4bc[508]]?mxConstants[_0xe4bc[1523]]:mxConstants[_0xe4bc[508]];this[_0xe4bc[2732]][_0xe4bc[1229]]= !1;this[_0xe4bc[2732]][_0xe4bc[176]](this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[1524]]());this[_0xe4bc[1179]][_0xe4bc[1712]](this[_0xe4bc[724]][_0xe4bc[246]])&&(this[_0xe4bc[2732]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[270]]=mxConstants[_0xe4bc[2832]]);mxEvent[_0xe4bc[2733]](this[_0xe4bc[2732]][_0xe4bc[252]],this[_0xe4bc[1179]],this[_0xe4bc[724]]);if(0>=mxGraphHandler[_0xe4bc[202]][_0xe4bc[2795]]||this[_0xe4bc[1179]][_0xe4bc[2694]]()this[_0xe4bc[724]][_0xe4bc[117]]&&2>this[_0xe4bc[724]][_0xe4bc[119]])&&(this[_0xe4bc[2972]]=this[_0xe4bc[2735]](mxConstants.CURSOR_MOVABLE_VERTEX,null,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this[_0xe4bc[2964]][_0xe4bc[207]](this[_0xe4bc[2972]]))}};if(this[_0xe4bc[2809]]&&(0>=mxGraphHandler[_0xe4bc[202]][_0xe4bc[2795]]||this[_0xe4bc[1179]][_0xe4bc[2694]]()_0x5d2ax12?180:0;0<_0x5d2axa&&(this[_0xe4bc[2989]]-=180);this[_0xe4bc[2960]]&&(_0x5d2axa=_0x5d2ax4[_0xe4bc[235]]-this[_0xe4bc[724]][_0xe4bc[241]](),_0x5d2ax12=_0x5d2ax4[_0xe4bc[236]]-this[_0xe4bc[724]][_0xe4bc[242]](),_0x5d2axa=Math[_0xe4bc[425]](Math[_0xe4bc[428]](_0x5d2axa*_0x5d2axa+_0x5d2ax12*_0x5d2ax12)-this[_0xe4bc[724]][_0xe4bc[119]]/2-20),_0x5d2axa=Math[_0xe4bc[160]](1,5*Math[_0xe4bc[243]](3,Math[_0xe4bc[160]](0,Math[_0xe4bc[488]](80/Math[_0xe4bc[425]](_0x5d2axa))))),this[_0xe4bc[2989]]=Math[_0xe4bc[488]](this[_0xe4bc[2989]]/_0x5d2axa)*_0x5d2axa);this[_0xe4bc[2732]][_0xe4bc[603]]=this[_0xe4bc[2989]];this[_0xe4bc[2732]][_0xe4bc[258]]()}else {var _0x5d2ax13=mxUtils[_0xe4bc[431]](this[_0xe4bc[724]][_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]),_0x5d2ax14=Math[_0xe4bc[426]](-_0x5d2ax13),_0x5d2ax15=Math[_0xe4bc[427]](-_0x5d2ax13),_0x5d2ax16= new mxPoint(this[_0xe4bc[724]][_0xe4bc[241]](),this[_0xe4bc[724]][_0xe4bc[242]]()),_0x5d2axa=_0x5d2ax4[_0xe4bc[235]]-this[_0xe4bc[2739]],_0x5d2ax12=_0x5d2ax4[_0xe4bc[236]]-this[_0xe4bc[2740]],_0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[513]],_0x5d2ax17=_0x5d2ax15*_0x5d2axa+_0x5d2ax14*_0x5d2ax12,_0x5d2axa=_0x5d2ax14*_0x5d2axa-_0x5d2ax15*_0x5d2ax12;this[_0xe4bc[1562]]=this[_0xe4bc[2991]](this[_0xe4bc[2961]],_0x5d2axa,_0x5d2ax17,this[_0xe4bc[1983]],_0x5d2ax5,_0x5d2ax9,_0x5d2ax4);_0x5d2ax14=Math[_0xe4bc[426]](_0x5d2ax13);_0x5d2ax15=Math[_0xe4bc[427]](_0x5d2ax13);_0x5d2ax12= new mxPoint(this[_0xe4bc[1562]][_0xe4bc[241]](),this[_0xe4bc[1562]][_0xe4bc[242]]());_0x5d2axa=_0x5d2ax12[_0xe4bc[235]]-_0x5d2ax16[_0xe4bc[235]];_0x5d2ax12=_0x5d2ax12[_0xe4bc[236]]-_0x5d2ax16[_0xe4bc[236]];_0x5d2ax16=_0x5d2ax15*_0x5d2axa+_0x5d2ax14*_0x5d2ax12-_0x5d2ax12;this[_0xe4bc[1562]][_0xe4bc[235]]+=_0x5d2ax14*_0x5d2axa-_0x5d2ax15*_0x5d2ax12-_0x5d2axa;this[_0xe4bc[1562]][_0xe4bc[236]]+=_0x5d2ax16;this[_0xe4bc[2932]]()}};_0x5d2ax3[_0xe4bc[722]]()}else {null!=this[_0xe4bc[2986]](_0x5d2ax3)&&_0x5d2ax3[_0xe4bc[722]](!1)}};mxVertexHandler[_0xe4bc[202]][_0xe4bc[789]]=function(_0x5d2ax2,_0x5d2ax3){if(!_0x5d2ax3[_0xe4bc[721]]()&&null!=this[_0xe4bc[1983]]&&null!=this[_0xe4bc[724]]){var _0x5d2ax4= new mxPoint(_0x5d2ax3[_0xe4bc[734]](),_0x5d2ax3[_0xe4bc[735]]());this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[473]]();try{if(this[_0xe4bc[1983]]==mxEvent[_0xe4bc[2983]]){null!=this[_0xe4bc[2989]]&&this[_0xe4bc[2992]](this[_0xe4bc[724]][_0xe4bc[246]],this[_0xe4bc[2989]]-(this[_0xe4bc[724]][_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||0))}else {var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[1018]](_0x5d2ax3[_0xe4bc[727]]()),_0x5d2ax9=mxUtils[_0xe4bc[431]](this[_0xe4bc[724]][_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]),_0x5d2axa=Math[_0xe4bc[426]](-_0x5d2ax9),_0x5d2ax12=Math[_0xe4bc[427]](-_0x5d2ax9),_0x5d2ax13=_0x5d2ax4[_0xe4bc[235]]-this[_0xe4bc[2739]],_0x5d2ax14=_0x5d2ax4[_0xe4bc[236]]-this[_0xe4bc[2740]],_0x5d2ax4=_0x5d2ax12*_0x5d2ax13+_0x5d2axa*_0x5d2ax14,_0x5d2ax13=_0x5d2axa*_0x5d2ax13-_0x5d2ax12*_0x5d2ax14,_0x5d2ax14=_0x5d2ax4,_0x5d2ax15=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]];this[_0xe4bc[2526]](this[_0xe4bc[724]][_0xe4bc[246]],_0x5d2ax13/_0x5d2ax15,_0x5d2ax14/_0x5d2ax15,this[_0xe4bc[1983]],_0x5d2ax5)}}finally{this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[476]]()};this[_0xe4bc[862]]();_0x5d2ax3[_0xe4bc[722]]()}};mxVertexHandler[_0xe4bc[202]][_0xe4bc[2992]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=this[_0xe4bc[1179]][_0xe4bc[502]]();if(_0x5d2ax4[_0xe4bc[1193]](_0x5d2ax2)){var _0x5d2ax5=_0x5d2ax2==this[_0xe4bc[724]]?this[_0xe4bc[724]]:this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax2);null!=_0x5d2ax5&&this[_0xe4bc[1179]][_0xe4bc[1717]](mxConstants.STYLE_ROTATION,(_0x5d2ax5[_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||0)+_0x5d2ax3,[_0x5d2ax2]);if(this[_0xe4bc[724]][_0xe4bc[246]]!=_0x5d2ax2&&(_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax2),null!=_0x5d2ax5&&!_0x5d2ax5[_0xe4bc[1500]])){if(0!=_0x5d2ax3){var _0x5d2ax9=this[_0xe4bc[1179]][_0xe4bc[502]]()[_0xe4bc[1197]](_0x5d2ax2),_0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax9);if(!_0x5d2ax5[_0xe4bc[1500]]&&null!=_0x5d2axa){var _0x5d2ax12=mxUtils[_0xe4bc[431]](_0x5d2ax3),_0x5d2ax9=Math[_0xe4bc[426]](_0x5d2ax12),_0x5d2ax12=Math[_0xe4bc[427]](_0x5d2ax12),_0x5d2ax13= new mxPoint(_0x5d2ax5[_0xe4bc[241]](),_0x5d2ax5[_0xe4bc[242]]()),_0x5d2axa= new mxPoint(_0x5d2axa[_0xe4bc[117]]/2,_0x5d2axa[_0xe4bc[119]]/2),_0x5d2ax9=mxUtils[_0xe4bc[432]](_0x5d2ax13,_0x5d2ax9,_0x5d2ax12,_0x5d2axa),_0x5d2ax5=_0x5d2ax5[_0xe4bc[238]]();_0x5d2ax5[_0xe4bc[235]]=_0x5d2ax9[_0xe4bc[235]]-_0x5d2ax5[_0xe4bc[117]]/2;_0x5d2ax5[_0xe4bc[236]]=_0x5d2ax9[_0xe4bc[236]]-_0x5d2ax5[_0xe4bc[119]]/2;_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax5)}}else {_0x5d2ax5=_0x5d2ax5[_0xe4bc[238]](),_0x5d2ax5[_0xe4bc[235]]+=dx,_0x5d2ax5[_0xe4bc[236]]+=dy,_0x5d2ax4[_0xe4bc[1724]](_0x5d2ax2,_0x5d2ax5)}};_0x5d2ax5=_0x5d2ax4[_0xe4bc[262]](_0x5d2ax2);for(_0x5d2ax9=0;_0x5d2ax9<_0x5d2ax5;_0x5d2ax9++){this[_0xe4bc[2992]](_0x5d2ax4[_0xe4bc[263]](_0x5d2ax2,_0x5d2ax9),_0x5d2ax3)}}};mxVertexHandler[_0xe4bc[202]][_0xe4bc[862]]=function(){this[_0xe4bc[1983]]=this[_0xe4bc[2989]]=null;null!=this[_0xe4bc[2988]]&&(this[_0xe4bc[2988]][_0xe4bc[515]](),this[_0xe4bc[2988]]=null);null!=this[_0xe4bc[2732]]&&(this[_0xe4bc[2732]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[495]]=_0xe4bc[497],this[_0xe4bc[2961]]=this[_0xe4bc[2962]](this[_0xe4bc[724]]),this[_0xe4bc[1562]]= new mxRectangle(this[_0xe4bc[2961]][_0xe4bc[235]],this[_0xe4bc[2961]][_0xe4bc[236]],this[_0xe4bc[2961]][_0xe4bc[117]],this[_0xe4bc[2961]][_0xe4bc[119]]),this[_0xe4bc[2932]]())};mxVertexHandler[_0xe4bc[202]][_0xe4bc[2526]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){var _0x5d2axa=this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1721]](_0x5d2ax2);if(null!=_0x5d2axa){if(_0x5d2ax5==mxEvent[_0xe4bc[2987]]){_0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[255]],_0x5d2ax3=(this[_0xe4bc[2972]][_0xe4bc[1562]][_0xe4bc[241]]()-this[_0xe4bc[2739]])/_0x5d2ax5,_0x5d2ax4=(this[_0xe4bc[2972]][_0xe4bc[1562]][_0xe4bc[242]]()-this[_0xe4bc[2740]])/_0x5d2ax5,_0x5d2axa=_0x5d2axa[_0xe4bc[238]](),null==_0x5d2axa[_0xe4bc[1368]]?_0x5d2axa[_0xe4bc[1368]]= new mxPoint(_0x5d2ax3,_0x5d2ax4):(_0x5d2axa[_0xe4bc[1368]][_0xe4bc[235]]+=_0x5d2ax3,_0x5d2axa[_0xe4bc[1368]][_0xe4bc[236]]+=_0x5d2ax4),this[_0xe4bc[1179]][_0xe4bc[251]][_0xe4bc[1724]](_0x5d2ax2,_0x5d2axa)}else {_0x5d2ax5=this[_0xe4bc[2991]](_0x5d2axa,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,1, new mxPoint(0,0));var _0x5d2ax12=mxUtils[_0xe4bc[431]](this[_0xe4bc[724]][_0xe4bc[124]][mxConstants[_0xe4bc[2278]]]||_0xe4bc[468]);if(0!=_0x5d2ax12){_0x5d2ax3=_0x5d2ax5[_0xe4bc[241]]()-_0x5d2axa[_0xe4bc[241]]();_0x5d2ax4=_0x5d2ax5[_0xe4bc[242]]()-_0x5d2axa[_0xe4bc[242]]();_0x5d2ax9=Math[_0xe4bc[426]](_0x5d2ax12);var _0x5d2ax13=Math[_0xe4bc[427]](_0x5d2ax12),_0x5d2ax12=_0x5d2ax9*_0x5d2ax3-_0x5d2ax13*_0x5d2ax4-_0x5d2ax3;_0x5d2ax3=_0x5d2ax13*_0x5d2ax3+_0x5d2ax9*_0x5d2ax4-_0x5d2ax4;_0x5d2ax4=_0x5d2ax5[_0xe4bc[235]]-_0x5d2axa[_0xe4bc[235]];var _0x5d2ax14=_0x5d2ax5[_0xe4bc[236]]-_0x5d2axa[_0xe4bc[236]],_0x5d2ax15=_0x5d2ax9*_0x5d2ax4-_0x5d2ax13*_0x5d2ax14;_0x5d2ax9=_0x5d2ax13*_0x5d2ax4+_0x5d2ax9*_0x5d2ax14;_0x5d2ax5[_0xe4bc[235]]+=_0x5d2ax12;_0x5d2ax5[_0xe4bc[236]]+=_0x5d2ax3;if(!this[_0xe4bc[1179]][_0xe4bc[1742]](_0x5d2ax2)&&(0!=_0x5d2ax12||0!=_0x5d2ax3)){_0x5d2ax4=_0x5d2axa[_0xe4bc[235]]-_0x5d2ax5[_0xe4bc[235]]+_0x5d2ax15,_0x5d2ax14=_0x5d2axa[_0xe4bc[236]]-_0x5d2ax5[_0xe4bc[236]]+_0x5d2ax9,this[_0xe4bc[2993]](_0x5d2ax2,_0x5d2ax4,_0x5d2ax14)}};this[_0xe4bc[1179]][_0xe4bc[2526]](_0x5d2ax2,_0x5d2ax5)}}};mxVertexHandler[_0xe4bc[202]][_0xe4bc[2993]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){for(var _0x5d2ax5=this[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax9=_0x5d2ax5[_0xe4bc[262]](_0x5d2ax2),_0x5d2axa=0;_0x5d2axa<_0x5d2ax9;_0x5d2axa++){var _0x5d2ax12=_0x5d2ax5[_0xe4bc[263]](_0x5d2ax2,_0x5d2axa);if(_0x5d2ax5[_0xe4bc[1193]](_0x5d2ax12)){var _0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1198]](_0x5d2ax12);null!=_0x5d2ax13&&!_0x5d2ax13[_0xe4bc[1500]]&&(_0x5d2ax13=_0x5d2ax13[_0xe4bc[238]](),_0x5d2ax13[_0xe4bc[235]]+=_0x5d2ax3,_0x5d2ax13[_0xe4bc[236]]+=_0x5d2ax4,_0x5d2ax5[_0xe4bc[1724]](_0x5d2ax12,_0x5d2ax13))}}};mxVertexHandler[_0xe4bc[202]][_0xe4bc[2991]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9,_0x5d2axa,_0x5d2ax12){if(this[_0xe4bc[2957]]){_0x5d2ax12=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]+_0x5d2ax3;var _0x5d2ax13=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]+_0x5d2ax4;_0x5d2ax9&&(_0x5d2ax12=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax12/_0x5d2axa)*_0x5d2axa,_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax13/_0x5d2axa)*_0x5d2axa);_0x5d2axa= new mxRectangle(_0x5d2ax2[_0xe4bc[235]],_0x5d2ax2[_0xe4bc[236]],0,0);_0x5d2axa[_0xe4bc[99]]( new mxRectangle(_0x5d2ax12,_0x5d2ax13,0,0));return _0x5d2axa};var _0x5d2ax13=_0x5d2ax2[_0xe4bc[235]]-_0x5d2ax12[_0xe4bc[235]]*_0x5d2axa,_0x5d2ax14=_0x5d2ax13+_0x5d2ax2[_0xe4bc[117]],_0x5d2ax15=_0x5d2ax2[_0xe4bc[236]]-_0x5d2ax12[_0xe4bc[236]]*_0x5d2axa;_0x5d2ax2=_0x5d2ax15+_0x5d2ax2[_0xe4bc[119]];4<_0x5d2ax5?(_0x5d2ax2+=_0x5d2ax4,_0x5d2ax9&&(_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax2/_0x5d2axa)*_0x5d2axa)):3>_0x5d2ax5&&(_0x5d2ax15+=_0x5d2ax4,_0x5d2ax9&&(_0x5d2ax15=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax15/_0x5d2axa)*_0x5d2axa));if(0==_0x5d2ax5||3==_0x5d2ax5||5==_0x5d2ax5){_0x5d2ax13+=_0x5d2ax3,_0x5d2ax9&&(_0x5d2ax13=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax13/_0x5d2axa)*_0x5d2axa)}else {if(2==_0x5d2ax5||4==_0x5d2ax5||7==_0x5d2ax5){_0x5d2ax14+=_0x5d2ax3,_0x5d2ax9&&(_0x5d2ax14=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax14/_0x5d2axa)*_0x5d2axa)}};_0x5d2ax9=_0x5d2ax14-_0x5d2ax13;_0x5d2ax2-=_0x5d2ax15;0>_0x5d2ax9&&(_0x5d2ax13+=_0x5d2ax9,_0x5d2ax9=Math[_0xe4bc[425]](_0x5d2ax9));0>_0x5d2ax2&&(_0x5d2ax15+=_0x5d2ax2,_0x5d2ax2=Math[_0xe4bc[425]](_0x5d2ax2));return new mxRectangle(_0x5d2ax13+_0x5d2ax12[_0xe4bc[235]]*_0x5d2axa,_0x5d2ax15+_0x5d2ax12[_0xe4bc[236]]*_0x5d2axa,_0x5d2ax9,_0x5d2ax2)};mxVertexHandler[_0xe4bc[202]][_0xe4bc[258]]=function(){this[_0xe4bc[2961]]=this[_0xe4bc[2962]](this[_0xe4bc[724]]);this[_0xe4bc[1562]]= new mxRectangle(this[_0xe4bc[724]][_0xe4bc[235]],this[_0xe4bc[724]][_0xe4bc[236]],this[_0xe4bc[724]][_0xe4bc[117]],this[_0xe4bc[724]][_0xe4bc[119]]);var _0x5d2ax2=this[_0xe4bc[724]];if(null!=this[_0xe4bc[2964]]){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]];if(this[_0xe4bc[2957]]){this[_0xe4bc[2985]](this[_0xe4bc[2964]][0],_0x5d2ax3,_0x5d2ax4)}else {var _0x5d2ax5=_0x5d2ax2[_0xe4bc[235]]+_0x5d2ax2[_0xe4bc[117]]/2,_0x5d2ax9=_0x5d2ax2[_0xe4bc[236]]+_0x5d2ax2[_0xe4bc[119]]/2;if(1=mxGraphHandler[_0xe4bc[202]][_0xe4bc[2795]]){this[_0xe4bc[2994]]=this[_0xe4bc[3001]]()};this[_0xe4bc[685]]= new mxPoint(this[_0xe4bc[724]][_0xe4bc[2079]][_0xe4bc[235]],this[_0xe4bc[724]][_0xe4bc[2079]][_0xe4bc[236]]);this[_0xe4bc[2972]]= new mxRectangleShape( new mxRectangle,mxConstants.LABEL_HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR);this[_0xe4bc[2972]][_0xe4bc[1229]]= !1;this[_0xe4bc[3002]](this[_0xe4bc[2972]]);this[_0xe4bc[2972]][_0xe4bc[252]][_0xe4bc[124]][_0xe4bc[270]]=mxConstants[_0xe4bc[3003]];mxEvent[_0xe4bc[2733]](this[_0xe4bc[2972]][_0xe4bc[252]],this[_0xe4bc[1179]],this[_0xe4bc[724]]);this[_0xe4bc[258]]()};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2999]]=function(_0x5d2ax2){return mxEvent[_0xe4bc[774]](_0x5d2ax2)};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[3004]]=function(_0x5d2ax2){return mxEvent[_0xe4bc[774]](_0x5d2ax2)};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2998]]=function(_0x5d2ax2){return _0x5d2ax2[_0xe4bc[439]]};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2963]]=function(_0x5d2ax2){_0x5d2ax2= new mxPolyline(_0x5d2ax2,this[_0xe4bc[2975]]());_0x5d2ax2[_0xe4bc[1307]]=this[_0xe4bc[2976]]();_0x5d2ax2[_0xe4bc[1522]]=this[_0xe4bc[2977]]();return _0x5d2ax2};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2975]]=function(){return mxConstants[_0xe4bc[3005]]};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2976]]=function(){return mxConstants[_0xe4bc[3006]]};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2977]]=function(){return mxConstants[_0xe4bc[3007]]};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2907]]=function(_0x5d2ax2){return !0};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[1689]]=function(){var _0x5d2ax2= new mxCellMarker(this[_0xe4bc[1179]]),_0x5d2ax3=this;_0x5d2ax2[_0xe4bc[736]]=function(_0x5d2ax2){var _0x5d2ax5=mxCellMarker[_0xe4bc[202]][_0xe4bc[736]][_0xe4bc[183]](this,arguments);if(!_0x5d2ax3[_0xe4bc[2907]](_0x5d2ax5)){return null};var _0x5d2ax9=_0x5d2ax3[_0xe4bc[1179]][_0xe4bc[502]]();if(_0x5d2ax5==_0x5d2ax3[_0xe4bc[724]][_0xe4bc[246]]||null!=_0x5d2ax5&&!_0x5d2ax3[_0xe4bc[1179]][_0xe4bc[2405]]&&_0x5d2ax9[_0xe4bc[250]](_0x5d2ax5)){_0x5d2ax5=null};return _0x5d2ax5};_0x5d2ax2[_0xe4bc[2872]]=function(_0x5d2ax2){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[1179]][_0xe4bc[502]](),_0x5d2ax5=_0x5d2ax3[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[2292]](_0x5d2ax2,_0x5d2ax3[_0xe4bc[1179]][_0xe4bc[441]][_0xe4bc[248]](_0x5d2ax5[_0xe4bc[1709]](_0x5d2ax3[_0xe4bc[724]][_0xe4bc[246]],!_0x5d2ax3[_0xe4bc[729]])),!_0x5d2ax3[_0xe4bc[729]]),_0x5d2ax5=null!=_0x5d2ax5?_0x5d2ax5[_0xe4bc[246]]:null;_0x5d2ax3[_0xe4bc[267]]=_0x5d2ax3[_0xe4bc[2909]](_0x5d2ax3[_0xe4bc[729]]?_0x5d2ax2[_0xe4bc[246]]:_0x5d2ax5,_0x5d2ax3[_0xe4bc[729]]?_0x5d2ax5:_0x5d2ax2[_0xe4bc[246]]);return null==_0x5d2ax3[_0xe4bc[267]]};return _0x5d2ax2};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[2909]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[1179]][_0xe4bc[2500]](this[_0xe4bc[724]][_0xe4bc[246]],_0x5d2ax2,_0x5d2ax3)};mxEdgeHandler[_0xe4bc[202]][_0xe4bc[3001]]=function(){for(var _0x5d2ax2=this[_0xe4bc[724]][_0xe4bc[246]],_0x5d2ax3=[],_0x5d2ax4=0;_0x5d2ax4_0x5d2ax16&&(_0x5d2ax4-=_0x5d2ax4+_0x5d2ax13-_0x5d2ax16);_0x5d2ax16=_0x5d2ax14[_0xe4bc[236]]+_0x5d2ax14[_0xe4bc[119]];_0x5d2ax5+_0x5d2ax15>_0x5d2ax16&&(_0x5d2ax5-=_0x5d2ax5+_0x5d2ax15-_0x5d2ax16)}}else {null!=_0x5d2ax13&&(_0x5d2ax4-=_0x5d2ax13[_0xe4bc[235]]*_0x5d2axa,_0x5d2ax5-=_0x5d2ax13[_0xe4bc[236]]*_0x5d2axa)}}};_0x5d2ax12=_0x5d2ax12[_0xe4bc[238]]();_0x5d2ax12[_0xe4bc[235]]=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax4/_0x5d2axa-this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[513]][_0xe4bc[235]]-this[_0xe4bc[1179]][_0xe4bc[1020]]/2);_0x5d2ax12[_0xe4bc[236]]=this[_0xe4bc[1179]][_0xe4bc[1021]](_0x5d2ax5/_0x5d2axa-this[_0xe4bc[1179]][_0xe4bc[249]]()[_0xe4bc[513]][_0xe4bc[236]]-this[_0xe4bc[1179]][_0xe4bc[1020]]/2);_0x5d2ax3[_0xe4bc[1724]](_0x5d2ax12);null==_0x5d2ax2&&(_0x5d2ax2=this[_0xe4bc[1179]][_0xe4bc[902]]());this[_0xe4bc[3228]](_0x5d2ax3);this[_0xe4bc[746]]( new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,_0xe4bc[1988],_0x5d2ax3,_0xe4bc[1101],_0x5d2ax2));_0x5d2ax9[_0xe4bc[473]]();try{_0x5d2ax3=this[_0xe4bc[1179]][_0xe4bc[2103]](_0x5d2ax3,_0x5d2ax2),null!=_0x5d2ax3&&(this[_0xe4bc[1179]][_0xe4bc[2509]](_0x5d2ax3),this[_0xe4bc[746]]( new mxEventObject(mxEvent.ADD_VERTEX,_0xe4bc[1988],_0x5d2ax3)))}finally{_0x5d2ax9[_0xe4bc[476]]()};null!=_0x5d2ax3&&(this[_0xe4bc[1179]][_0xe4bc[2450]](_0x5d2ax3),this[_0xe4bc[1179]][_0xe4bc[2564]](_0x5d2ax3),this[_0xe4bc[746]]( new mxEventObject(mxEvent.AFTER_ADD_VERTEX,_0xe4bc[1988],_0x5d2ax3)));return _0x5d2ax3};mxEditor[_0xe4bc[202]][_0xe4bc[515]]=function(){this[_0xe4bc[2717]]||(this[_0xe4bc[2717]]= !0,null!=this[_0xe4bc[3112]]&&this[_0xe4bc[3112]][_0xe4bc[515]](),null!=this[_0xe4bc[2136]]&&this[_0xe4bc[2136]][_0xe4bc[515]](),null!=this[_0xe4bc[716]]&&this[_0xe4bc[716]][_0xe4bc[515]](),null!=this[_0xe4bc[3098]]&&this[_0xe4bc[3098]][_0xe4bc[515]](),null!=this[_0xe4bc[3203]]&&this[_0xe4bc[3203]][_0xe4bc[515]](),null!=this[_0xe4bc[3082]]&&this[_0xe4bc[3082]][_0xe4bc[515]](),null!=this[_0xe4bc[1179]]&&this[_0xe4bc[1179]][_0xe4bc[515]](),this[_0xe4bc[3118]]=this[_0xe4bc[879]]=null)};var mxCodecRegistry={codecs:[],aliases:[],register:function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[718]]();mxCodecRegistry[_0xe4bc[3230]][_0x5d2ax3]=_0x5d2ax2;var _0x5d2ax4=mxUtils[_0xe4bc[197]](_0x5d2ax2[_0xe4bc[3231]][_0xe4bc[196]]);_0x5d2ax4!=_0x5d2ax3&&mxCodecRegistry[_0xe4bc[3232]](_0x5d2ax4,_0x5d2ax3)};return _0x5d2ax2},addAlias:function(_0x5d2ax2,_0x5d2ax3){mxCodecRegistry[_0xe4bc[3233]][_0x5d2ax2]=_0x5d2ax3},getCodec:function(_0x5d2ax2){var _0x5d2ax3=null;if(null!=_0x5d2ax2){var _0x5d2ax3=mxUtils[_0xe4bc[197]](_0x5d2ax2),_0x5d2ax4=mxCodecRegistry[_0xe4bc[3233]][_0x5d2ax3];null!=_0x5d2ax4&&(_0x5d2ax3=_0x5d2ax4);_0x5d2ax3=mxCodecRegistry[_0xe4bc[3230]][_0x5d2ax3];if(null==_0x5d2ax3){try{_0x5d2ax3= new mxObjectCodec( new _0x5d2ax2),mxCodecRegistry[_0xe4bc[3234]](_0x5d2ax3)}catch(d){}}};return _0x5d2ax3}};function mxCodec(_0x5d2ax2){this[_0xe4bc[395]]=_0x5d2ax2||mxUtils[_0xe4bc[306]]();this[_0xe4bc[68]]=[]}mxCodec[_0xe4bc[202]][_0xe4bc[395]]=null;mxCodec[_0xe4bc[202]][_0xe4bc[68]]=null;mxCodec[_0xe4bc[202]][_0xe4bc[3235]]= !1;mxCodec[_0xe4bc[202]][_0xe4bc[1104]]=function(_0x5d2ax2,_0x5d2ax3){return this[_0xe4bc[68]][_0x5d2ax2]=_0x5d2ax3};mxCodec[_0xe4bc[202]][_0xe4bc[3236]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[68]][_0x5d2ax2],null==_0x5d2ax3&&(_0x5d2ax3=this[_0xe4bc[1060]](_0x5d2ax2),null==_0x5d2ax3&&(_0x5d2ax2=this[_0xe4bc[1362]](_0x5d2ax2),null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[1093]](_0x5d2ax2)))));return _0x5d2ax3};mxCodec[_0xe4bc[202]][_0xe4bc[1060]]=function(_0x5d2ax2){return null};mxCodec[_0xe4bc[202]][_0xe4bc[1362]]=function(_0x5d2ax2,_0x5d2ax3){return mxUtils[_0xe4bc[290]](this[_0xe4bc[395]][_0xe4bc[158]],null!=_0x5d2ax3?_0x5d2ax3:_0xe4bc[1363],_0x5d2ax2)};mxCodec[_0xe4bc[202]][_0xe4bc[1103]]=function(_0x5d2ax2){var _0x5d2ax3=null;null!=_0x5d2ax2&&(_0x5d2ax3=this[_0xe4bc[3237]](_0x5d2ax2),null==_0x5d2ax3&&_0x5d2ax2 instanceof mxCell&&(_0x5d2ax3=_0x5d2ax2[_0xe4bc[1103]](),null==_0x5d2ax3&&(_0x5d2ax3=mxCellPath[_0xe4bc[385]](_0x5d2ax2),0==_0x5d2ax3[_0xe4bc[67]]&&(_0x5d2ax3=_0xe4bc[813]))));return _0x5d2ax3};mxCodec[_0xe4bc[202]][_0xe4bc[3237]]=function(_0x5d2ax2){return null};mxCodec[_0xe4bc[202]][_0xe4bc[514]]=function(_0x5d2ax2){var _0x5d2ax3=null;if(null!=_0x5d2ax2&&null!=_0x5d2ax2[_0xe4bc[196]]){var _0x5d2ax4=mxCodecRegistry[_0xe4bc[3238]](_0x5d2ax2[_0xe4bc[196]]);null!=_0x5d2ax4?_0x5d2ax3=_0x5d2ax4[_0xe4bc[514]](this,_0x5d2ax2):mxUtils[_0xe4bc[1331]](_0x5d2ax2)?_0x5d2ax3=mxClient[_0xe4bc[80]]?_0x5d2ax2[_0xe4bc[511]](!0):this[_0xe4bc[395]][_0xe4bc[3239]](_0x5d2ax2,!0):mxLog[_0xe4bc[283]](_0xe4bc[3240]+mxUtils[_0xe4bc[197]](_0x5d2ax2[_0xe4bc[196]]))};return _0x5d2ax3};mxCodec[_0xe4bc[202]][_0xe4bc[1093]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=null;if(null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]){var _0x5d2ax5=null;try{_0x5d2ax5=eval(_0x5d2ax2[_0xe4bc[301]])}catch(e){};try{var _0x5d2axa=mxCodecRegistry[_0xe4bc[3238]](_0x5d2ax5);null!=_0x5d2axa?_0x5d2ax4=_0x5d2axa[_0xe4bc[1093]](this,_0x5d2ax2,_0x5d2ax3):(_0x5d2ax4=_0x5d2ax2[_0xe4bc[511]](!0),_0x5d2ax4[_0xe4bc[1390]](_0xe4bc[3069]))}catch(g){mxLog[_0xe4bc[143]](_0xe4bc[3241]+_0x5d2ax2[_0xe4bc[301]]+_0xe4bc[3186]+g[_0xe4bc[281]])}};return _0x5d2ax4};mxCodec[_0xe4bc[202]][_0xe4bc[3242]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3[_0xe4bc[62]](this[_0xe4bc[514]](_0x5d2ax2));if(null==_0x5d2ax4||_0x5d2ax4){_0x5d2ax4=_0x5d2ax2[_0xe4bc[262]]();for(var _0x5d2ax5=0;_0x5d2ax5<_0x5d2ax4;_0x5d2ax5++){this[_0xe4bc[3242]](_0x5d2ax2[_0xe4bc[263]](_0x5d2ax5),_0x5d2ax3)}}};mxCodec[_0xe4bc[202]][_0xe4bc[3243]]=function(_0x5d2ax2){return null!=_0x5d2ax2&&_0xe4bc[279]== typeof _0x5d2ax2[_0xe4bc[3243]]?_0x5d2ax2[_0xe4bc[3243]]():!1};mxCodec[_0xe4bc[202]][_0xe4bc[3244]]=function(_0x5d2ax2,_0x5d2ax3){_0x5d2ax3=null!=_0x5d2ax3?_0x5d2ax3:!0;var _0x5d2ax4=null;if(null!=_0x5d2ax2&&_0x5d2ax2[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]){_0x5d2ax4=mxCodecRegistry[_0xe4bc[3238]](_0x5d2ax2[_0xe4bc[301]]);if(!this[_0xe4bc[3243]](_0x5d2ax4)){for(var _0x5d2ax5=_0x5d2ax2[_0xe4bc[285]];null!=_0x5d2ax5&&!this[_0xe4bc[3243]](_0x5d2ax4);){_0x5d2ax4=mxCodecRegistry[_0xe4bc[3238]](_0x5d2ax5[_0xe4bc[301]]),_0x5d2ax5=_0x5d2ax5[_0xe4bc[287]]}};this[_0xe4bc[3243]](_0x5d2ax4)||(_0x5d2ax4=mxCodecRegistry[_0xe4bc[3238]](mxCell));_0x5d2ax4=_0x5d2ax4[_0xe4bc[1093]](this,_0x5d2ax2);_0x5d2ax3&&this[_0xe4bc[3245]](_0x5d2ax4)};return _0x5d2ax4};mxCodec[_0xe4bc[202]][_0xe4bc[3245]]=function(_0x5d2ax2){var _0x5d2ax3=_0x5d2ax2[_0xe4bc[1101]],_0x5d2ax4=_0x5d2ax2[_0xe4bc[1709]](!0),_0x5d2ax5=_0x5d2ax2[_0xe4bc[1709]](!1);_0x5d2ax2[_0xe4bc[1957]](null,!1);_0x5d2ax2[_0xe4bc[1957]](null,!0);_0x5d2ax2[_0xe4bc[1101]]=null;null!=_0x5d2ax3&&_0x5d2ax3[_0xe4bc[1937]](_0x5d2ax2);null!=_0x5d2ax4&&_0x5d2ax4[_0xe4bc[1960]](_0x5d2ax2,!0);null!=_0x5d2ax5&&_0x5d2ax5[_0xe4bc[1960]](_0x5d2ax2,!1)};mxCodec[_0xe4bc[202]][_0xe4bc[57]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){null!=_0x5d2ax3&&null!=_0x5d2ax4&&_0x5d2ax2[_0xe4bc[57]](_0x5d2ax3,_0x5d2ax4)};function mxObjectCodec(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){this[_0xe4bc[3231]]=_0x5d2ax2;this[_0xe4bc[3246]]=null!=_0x5d2ax3?_0x5d2ax3:[];this[_0xe4bc[3247]]=null!=_0x5d2ax4?_0x5d2ax4:[];this[_0xe4bc[3248]]=null!=_0x5d2ax5?_0x5d2ax5:[];this[_0xe4bc[3249]]={};for(var _0x5d2ax9 in this[_0xe4bc[3248]]){this[_0xe4bc[3249]][this[_0xe4bc[3248]][_0x5d2ax9]]=_0x5d2ax9}}mxObjectCodec[_0xe4bc[202]][_0xe4bc[3231]]=null;mxObjectCodec[_0xe4bc[202]][_0xe4bc[3246]]=null;mxObjectCodec[_0xe4bc[202]][_0xe4bc[3247]]=null;mxObjectCodec[_0xe4bc[202]][_0xe4bc[3248]]=null;mxObjectCodec[_0xe4bc[202]][_0xe4bc[3249]]=null;mxObjectCodec[_0xe4bc[202]][_0xe4bc[718]]=function(){return mxUtils[_0xe4bc[197]](this[_0xe4bc[3231]][_0xe4bc[196]])};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3250]]=function(){return new this[_0xe4bc[3231]][_0xe4bc[196]]};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3251]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[3249]][_0x5d2ax2];null!=_0x5d2ax3&&(_0x5d2ax2=_0x5d2ax3)};return _0x5d2ax2};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3252]]=function(_0x5d2ax2){if(null!=_0x5d2ax2){var _0x5d2ax3=this[_0xe4bc[3248]][_0x5d2ax2];null!=_0x5d2ax3&&(_0x5d2ax2=_0x5d2ax3)};return _0x5d2ax2};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3253]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return _0x5d2ax3==mxObjectIdentity[_0xe4bc[195]]||0<=mxUtils[_0xe4bc[2]](this[_0xe4bc[3246]],_0x5d2ax3)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3254]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){return 0<=mxUtils[_0xe4bc[2]](this[_0xe4bc[3247]],_0x5d2ax3)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[514]]=function(_0x5d2ax2,_0x5d2ax3){var _0x5d2ax4=_0x5d2ax2[_0xe4bc[395]][_0xe4bc[55]](this[_0xe4bc[718]]());_0x5d2ax3=this[_0xe4bc[3255]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4);this[_0xe4bc[3256]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4);return this[_0xe4bc[3257]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3256]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2[_0xe4bc[57]](_0x5d2ax4,_0xe4bc[1363],_0x5d2ax2[_0xe4bc[1103]](_0x5d2ax3));for(var _0x5d2ax5 in _0x5d2ax3){var _0x5d2ax9=_0x5d2ax5,_0x5d2axa=_0x5d2ax3[_0x5d2ax9];null!=_0x5d2axa&&!this[_0xe4bc[3253]](_0x5d2ax3,_0x5d2ax9,_0x5d2axa,!0)&&(mxUtils[_0xe4bc[1946]](_0x5d2ax9)&&(_0x5d2ax9=null),this[_0xe4bc[3258]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax9,_0x5d2axa,_0x5d2ax4))}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3258]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){if(null!=_0x5d2ax5){if(this[_0xe4bc[3254]](_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,!0)){var _0x5d2axa=_0x5d2ax2[_0xe4bc[1103]](_0x5d2ax5);if(null==_0x5d2axa){mxLog[_0xe4bc[283]](_0xe4bc[3259]+this[_0xe4bc[718]]()+_0xe4bc[87]+_0x5d2ax4+_0xe4bc[226]+_0x5d2ax5);return};_0x5d2ax5=_0x5d2axa};_0x5d2axa=this[_0xe4bc[3231]][_0x5d2ax4];if(null==_0x5d2ax4||_0x5d2ax2[_0xe4bc[3235]]||_0x5d2axa!=_0x5d2ax5){_0x5d2ax4=this[_0xe4bc[3252]](_0x5d2ax4),this[_0xe4bc[3260]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9)}}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3260]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0xe4bc[194]!= typeof _0x5d2ax5?this[_0xe4bc[3261]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9):this[_0xe4bc[3262]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3261]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax5=this[_0xe4bc[3263]](_0x5d2ax5);null==_0x5d2ax4?(_0x5d2ax3=_0x5d2ax2[_0xe4bc[395]][_0xe4bc[55]](_0xe4bc[99]),_0xe4bc[279]== typeof _0x5d2ax5?_0x5d2ax3[_0xe4bc[62]](_0x5d2ax2[_0xe4bc[395]][_0xe4bc[344]](_0x5d2ax5)):_0x5d2ax2[_0xe4bc[57]](_0x5d2ax3,_0xe4bc[131],_0x5d2ax5),_0x5d2ax9[_0xe4bc[62]](_0x5d2ax3)):_0xe4bc[279]!= typeof _0x5d2ax5&&_0x5d2ax2[_0xe4bc[57]](_0x5d2ax9,_0x5d2ax4,_0x5d2ax5)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3262]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){_0x5d2ax2=_0x5d2ax2[_0xe4bc[514]](_0x5d2ax5);null!=_0x5d2ax2?(null!=_0x5d2ax4&&_0x5d2ax2[_0xe4bc[57]](_0xe4bc[3069],_0x5d2ax4),_0x5d2ax9[_0xe4bc[62]](_0x5d2ax2)):mxLog[_0xe4bc[283]](_0xe4bc[3264]+this[_0xe4bc[718]]()+_0xe4bc[87]+_0x5d2ax4+_0xe4bc[3186]+_0x5d2ax5)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3263]]=function(_0x5d2ax2){if(_0xe4bc[82]== typeof _0x5d2ax2[_0xe4bc[67]]&&(!0==_0x5d2ax2||!1==_0x5d2ax2)){_0x5d2ax2=!0==_0x5d2ax2?_0xe4bc[500]:_0xe4bc[468]};return _0x5d2ax2};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3265]]=function(_0x5d2ax2){mxUtils[_0xe4bc[1946]](_0x5d2ax2)&&(_0x5d2ax2=parseFloat(_0x5d2ax2));return _0x5d2ax2};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3255]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax3};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3257]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax4};mxObjectCodec[_0xe4bc[202]][_0xe4bc[1093]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[284]](_0xe4bc[1363]),_0x5d2ax9=_0x5d2ax2[_0xe4bc[68]][_0x5d2ax5];null==_0x5d2ax9&&(_0x5d2ax9=_0x5d2ax4||this[_0xe4bc[3250]](),null!=_0x5d2ax5&&_0x5d2ax2[_0xe4bc[1104]](_0x5d2ax5,_0x5d2ax9));_0x5d2ax3=this[_0xe4bc[3266]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax9);this[_0xe4bc[3267]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax9);return this[_0xe4bc[3268]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax9)};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3267]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){null!=_0x5d2ax3&&(this[_0xe4bc[3269]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4),this[_0xe4bc[3270]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4))};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3269]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax3=_0x5d2ax3[_0xe4bc[320]];if(null!=_0x5d2ax3){for(var _0x5d2ax5=0;_0x5d2ax5<_0x5d2ax3[_0xe4bc[67]];_0x5d2ax5++){this[_0xe4bc[3271]](_0x5d2ax2,_0x5d2ax3[_0x5d2ax5],_0x5d2ax4)}}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3271]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[301]];if(_0xe4bc[3069]!=_0x5d2ax5&&_0xe4bc[1363]!=_0x5d2ax5){_0x5d2ax3=this[_0xe4bc[3265]](_0x5d2ax3[_0xe4bc[318]]);var _0x5d2ax9=this[_0xe4bc[3251]](_0x5d2ax5);if(this[_0xe4bc[3254]](_0x5d2ax4,_0x5d2ax9,_0x5d2ax3,!1)){_0x5d2ax2=_0x5d2ax2[_0xe4bc[3236]](_0x5d2ax3);if(null==_0x5d2ax2){mxLog[_0xe4bc[283]](_0xe4bc[3272]+this[_0xe4bc[718]]()+_0xe4bc[87]+_0x5d2ax5+_0xe4bc[226]+_0x5d2ax3);return};_0x5d2ax3=_0x5d2ax2};this[_0xe4bc[3253]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax3,!1)||(_0x5d2ax4[_0x5d2ax5]=_0x5d2ax3)}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3270]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){for(_0x5d2ax3=_0x5d2ax3[_0xe4bc[285]];null!=_0x5d2ax3;){var _0x5d2ax5=_0x5d2ax3[_0xe4bc[287]];_0x5d2ax3[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]&&!this[_0xe4bc[3273]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4)&&this[_0xe4bc[3274]](_0x5d2ax2,_0x5d2ax3,_0x5d2ax4);_0x5d2ax3=_0x5d2ax5}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3274]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){var _0x5d2ax5=this[_0xe4bc[3251]](_0x5d2ax3[_0xe4bc[284]](_0xe4bc[3069]));if(null==_0x5d2ax5||!this[_0xe4bc[3253]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax3,!1)){var _0x5d2ax9=this[_0xe4bc[3275]](_0x5d2ax4,_0x5d2ax5,_0x5d2ax3),_0x5d2axa=null;_0xe4bc[99]==_0x5d2ax3[_0xe4bc[301]]?(_0x5d2axa=_0x5d2ax3[_0xe4bc[284]](_0xe4bc[131]),null==_0x5d2axa&&(_0x5d2axa=mxUtils[_0xe4bc[1545]](mxUtils[_0xe4bc[329]](_0x5d2ax3)))):_0x5d2axa=_0x5d2ax2[_0xe4bc[1093]](_0x5d2ax3,_0x5d2ax9);this[_0xe4bc[3276]](_0x5d2ax4,_0x5d2ax5,_0x5d2axa,_0x5d2ax9)}};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3275]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){_0x5d2ax2=_0x5d2ax2[_0x5d2ax3];_0x5d2ax2 instanceof Array&&0<_0x5d2ax2[_0xe4bc[67]]&&(_0x5d2ax2=null);return _0x5d2ax2};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3276]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4,_0x5d2ax5){null!=_0x5d2ax4&&_0x5d2ax4!=_0x5d2ax5&&(null!=_0x5d2ax3&&0<_0x5d2ax3[_0xe4bc[67]]?_0x5d2ax2[_0x5d2ax3]=_0x5d2ax4:_0x5d2ax2[_0xe4bc[207]](_0x5d2ax4))};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3273]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){if(_0xe4bc[3277]==_0x5d2ax3[_0xe4bc[301]]){_0x5d2ax3=_0x5d2ax3[_0xe4bc[284]](_0xe4bc[298]);if(null!=_0x5d2ax3){try{var _0x5d2ax5=mxUtils[_0xe4bc[219]](_0x5d2ax3)[_0xe4bc[874]]();null!=_0x5d2ax5&&_0x5d2ax2[_0xe4bc[1093]](_0x5d2ax5,_0x5d2ax4)}catch(e){}};return !0};return !1};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3266]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax3};mxObjectCodec[_0xe4bc[202]][_0xe4bc[3268]]=function(_0x5d2ax2,_0x5d2ax3,_0x5d2ax4){return _0x5d2ax4};mxCodecRegistry[_0xe4bc[3234]](function(){var _0x5d2ax2= new mxObjectCodec( new mxCell,[_0xe4bc[1954],_0xe4bc[1842],_0xe4bc[1211],_0xe4bc[1991]],[_0xe4bc[1101],_0xe4bc[1097],_0xe4bc[772]]);_0x5d2ax2[_0xe4bc[3243]]=function(){return !0};_0x5d2ax2[_0xe4bc[3253]]=function(_0x5d2ax2,_0x5d2ax4,_0x5d2ax5,_0x5d2ax9){return mxObjectCodec[_0xe4bc[202]][_0xe4bc[3253]][_0xe4bc[183]](this,arguments)||_0x5d2ax9&&_0xe4bc[131]==_0x5d2ax4&&_0x5d2ax5[_0xe4bc[288]]==mxConstants[_0xe4bc[289]]};_0x5d2ax2[_0xe4bc[3257]]=function(_0x5d2ax2,_0x5d2ax4,_0x5d2ax5){if(null!=_0x5d2ax4[_0xe4bc[131]]&&_0x5d2ax4[_0xe4bc[131]][_0xe4bc[288]]==mxConstants[_0xe4bc[289]]){var _0x5d2ax9=_0x5d2ax5;_0x5d2ax5=mxClient[_0xe4bc[80]]?_0x5d2ax4[_0xe4bc[131]][_0xe4bc[511]](!0):_0x5d2ax2[_0xe4bc[395]][_0xe4bc[3239]](_0x5d2ax4[_0xe4bc[131]],!0);_0x5d2ax5[_0xe4bc[62]](_0x5d2ax9);_0x5d2ax2=_0x5d2ax9[_0xe4bc[284]](_0xe4bc[1363]);_0x5d2ax5[_0xe4bc[57]](_0xe4bc[1363],_0x5d2ax2);_0x5d2ax9[_0xe4bc[1390]](_0xe4bc[1363])};return _0x5d2ax5};_0x5d2ax2[_0xe4bc[3266]]=function(_0x5d2ax2,_0x5d2ax4,_0x5d2ax5){var _0x5d2ax9=_0x5d2ax4,_0x5d2axa=this[_0xe4bc[718]]();_0x5d2ax4[_0xe4bc[301]]!=_0x5d2axa?(_0x5d2ax9=_0x5d2ax4[_0xe4bc[64]](_0x5d2axa)[0],null!=_0x5d2ax9&&_0x5d2ax9[_0xe4bc[265]]==_0x5d2ax4?(mxUtils[_0xe4bc[3278]](_0x5d2ax9,!0),mxUtils[_0xe4bc[3278]](_0x5d2ax9,!1),_0x5d2ax9[_0xe4bc[265]][_0xe4bc[266]](_0x5d2ax9)):_0x5d2ax9=null,_0x5d2ax5[_0xe4bc[131]]=_0x5d2ax4[_0xe4bc[511]](!0),_0x5d2ax4=_0x5d2ax5[_0xe4bc[131]][_0xe4bc[284]](_0xe4bc[1363]),null!=_0x5d2ax4&&(_0x5d2ax5[_0xe4bc[1945]](_0x5d2ax4),_0x5d2ax5[_0xe4bc[131]][_0xe4bc[1390]](_0xe4bc[1363]))):_0x5d2ax5[_0xe4bc[1945]](_0x5d2ax4[_0xe4bc[284]](_0xe4bc[1363]));if(null!=_0x5d2ax9){for(_0x5d2ax4=0;_0x5d2ax4 navigator.userAgent.indexOf("MSIE"), + IS_OP: 0 <= navigator.userAgent.indexOf("Opera/"), + IS_OT: 0 > 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."), + IS_SF: 0 <= navigator.userAgent.indexOf("AppleWebKit/") && 0 > navigator.userAgent.indexOf("Chrome/"), + IS_GC: 0 <= navigator.userAgent.indexOf("Chrome/"), + IS_MT: 0 <= navigator.userAgent.indexOf("Firefox/") && 0 > navigator.userAgent.indexOf("Firefox/1.") && 0 > navigator.userAgent.indexOf("Firefox/2.") || 0 <= navigator.userAgent.indexOf( + "Iceweasel/") && 0 > navigator.userAgent.indexOf("Iceweasel/1.") && + 0 > navigator.userAgent.indexOf("Iceweasel/2.") || 0 <= navigator.userAgent.indexOf("SeaMonkey/") && 0 > navigator.userAgent.indexOf("SeaMonkey/1.") || 0 <= navigator.userAgent.indexOf( + "Iceape/") && 0 > navigator.userAgent.indexOf("Iceape/1."), + 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: 0 > document.location.href.indexOf("http://") && + 0 > document.location.href.indexOf("https://"), + isBrowserSupported: function() { + return mxClient.IS_VML || mxClient.IS_SVG + }, + link: function(a, b, c) { + c = c || document; + if (mxClient.IS_IE6) c.write('\x3clink rel\x3d"' + a + '" href\x3d"' + b + '" charset\x3d"ISO-8859-1" type\x3d"text/css"/\x3e'); + else { + var d = c.createElement("link"); + d.setAttribute("rel", a); + d.setAttribute("href", b); + d.setAttribute("charset", "ISO-8859-1"); + d.setAttribute("type", "text/css"); + c.getElementsByTagName("head")[0].appendChild(d) + } + }, + include: function(a) { + document.write('\x3cscript src\x3d"' + + a + '"\x3e\x3c/script\x3e') + }, + dispose: function() { + for (var a = 0; a < mxEvent.objects.length; a++) null != mxEvent.objects[a].mxListenerList && mxEvent.removeAllListeners(mxEvent.objects[a]) + } +}; +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"); +"undefined" == typeof mxLoadResources && (mxLoadResources = !0); +"undefined" == typeof mxResourceExtension && (mxResourceExtension = ".txt"); +"undefined" == typeof mxLoadStylesheets && (mxLoadStylesheets = !0); +"undefined" != typeof 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 = "undefined" != typeof 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"); +"undefined" != typeof mxLanguages && (mxClient.languages = mxLanguages); +if (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 a = mxLog.consoleName + " - mxGraph " + mxClient.VERSION, + b = document.createElement("table"); + b.setAttribute("width", "100%"); + b.setAttribute("height", "100%"); + var c = document.createElement("tbody"), + d = document.createElement("tr"), + e = document.createElement("td"); + e.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%"; + e.appendChild(mxLog.textarea); + d.appendChild(e); + c.appendChild(d); + d = document.createElement("tr"); + mxLog.td = document.createElement("td"); + mxLog.td.style.verticalAlign = "top"; + mxLog.td.setAttribute("height", "30px"); + d.appendChild(mxLog.td); + c.appendChild(d); + b.appendChild(c); + mxLog.addButton("Info", function(a) { + mxLog.info() + }); + mxLog.addButton("DOM", function(a) { + a = mxUtils.getInnerHtml(document.body); + mxLog.debug(a) + }); + mxLog.addButton("Trace", function(a) { + mxLog.TRACE = !mxLog.TRACE; + mxLog.TRACE ? mxLog.debug("Tracing enabled") : mxLog.debug("Tracing disabled") + }); + mxLog.addButton("Copy", function(a) { + try { + mxUtils.copy(mxLog.textarea.value) + } catch (b) { + mxUtils.alert(b) + } + }); + mxLog.addButton("Show", function(a) { + try { + mxUtils.popup(mxLog.textarea.value) + } catch (b) { + mxUtils.alert(b) + } + }); + mxLog.addButton("Clear", function(a) { + mxLog.textarea.value = "" + }); + d = c = 0; + "number" === typeof window.innerWidth ? (c = window.innerHeight, d = window.innerWidth) : (c = document.documentElement.clientHeight || document.body.clientHeight, d = document.body.clientWidth); + mxLog.window = new mxWindow(a, b, Math.max(0, d - 320), Math.max(0, c - 210), 300, 160); + mxLog.window.setMaximizable(!0); + mxLog.window.setScrollable(!1); + mxLog.window.setResizable(!0); + mxLog.window.setClosable(!0); + mxLog.window.destroyOnClose = !1; + if ((mxClient.IS_NS || mxClient.IS_IE) && !mxClient.IS_GC && !mxClient.IS_SF && "BackCompat" != document.compatMode) { + var f = + mxLog.window.getElement(), + a = function(a, b) { + mxLog.textarea.style.height = Math.max(0, f.offsetHeight - 70) + "px" + }; + mxLog.window.addListener(mxEvent.RESIZE_END, a); + mxLog.window.addListener(mxEvent.MAXIMIZE, a); + mxLog.window.addListener(mxEvent.NORMALIZE, a); + mxLog.textarea.style.height = "92px" + } + } + }, + info: function() { + mxLog.writeln(mxUtils.toString(navigator)) + }, + addButton: function(a, b) { + var c = document.createElement("button"); + mxUtils.write(c, a); + mxEvent.addListener(c, "click", b); + mxLog.td.appendChild(c) + }, + isVisible: function() { + return null != + mxLog.window ? mxLog.window.isVisible() : !1 + }, + show: function() { + mxLog.setVisible(!0) + }, + setVisible: function(a) { + null == mxLog.window && mxLog.init(); + null != mxLog.window && mxLog.window.setVisible(a) + }, + enter: function(a) { + if (mxLog.TRACE) return mxLog.writeln("Entering " + a), (new Date).getTime() + }, + leave: function(a, b) { + if (mxLog.TRACE) { + var c = 0 != b ? " (" + ((new Date).getTime() - b) + " ms)" : ""; + mxLog.writeln("Leaving " + a + c) + } + }, + debug: function() { + mxLog.DEBUG && mxLog.writeln.apply(this, arguments) + }, + warn: function() { + mxLog.WARN && mxLog.writeln.apply(this, + arguments) + }, + write: function() { + for (var a = "", b = 0; b < arguments.length; b++) a += arguments[b], b < arguments.length - 1 && (a += " "); + null != mxLog.textarea ? (mxLog.textarea.value += a, 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 += a + }, + writeln: function() { + for (var a = "", b = 0; b < arguments.length; b++) a += arguments[b], b < arguments.length - 1 && (a += " "); + mxLog.write(a + "\n") + } + }, + mxObjectIdentity = { + FIELD_NAME: "mxObjectId", + counter: 0, + get: function(a) { + if ("object" == typeof a && null == a[mxObjectIdentity.FIELD_NAME]) { + var b = mxUtils.getFunctionName(a.constructor); + a[mxObjectIdentity.FIELD_NAME] = b + "#" + mxObjectIdentity.counter++ + } + return a[mxObjectIdentity.FIELD_NAME] + }, + clear: function(a) { + "object" == typeof a && delete a[mxObjectIdentity.FIELD_NAME] + } + }; + +function mxDictionary() { + this.clear() +} +mxDictionary.prototype.map = null; +mxDictionary.prototype.clear = function() { + this.map = {} +}; +mxDictionary.prototype.get = function(a) { + a = mxObjectIdentity.get(a); + return this.map[a] +}; +mxDictionary.prototype.put = function(a, b) { + var c = mxObjectIdentity.get(a), + d = this.map[c]; + this.map[c] = b; + return d +}; +mxDictionary.prototype.remove = function(a) { + a = mxObjectIdentity.get(a); + var b = this.map[a]; + delete this.map[a]; + return b +}; +mxDictionary.prototype.getKeys = function() { + var a = [], + b; + for (b in this.map) a.push(b); + return a +}; +mxDictionary.prototype.getValues = function() { + var a = [], + b; + for (b in this.map) a.push(this.map[b]); + return a +}; +mxDictionary.prototype.visit = function(a) { + for (var b in this.map) a(b, this.map[b]) +}; +var mxResources = { + resources: [], + extension: mxResourceExtension, + resourcesEncoded: !1, + loadDefaultBundle: !0, + loadSpecialBundle: !0, + isLanguageSupported: function(a) { + return null != mxClient.languages ? 0 <= mxUtils.indexOf(mxClient.languages, a) : !0 + }, + getDefaultBundle: function(a, b) { + return mxResources.loadDefaultBundle || !mxResources.isLanguageSupported(b) ? a + mxResources.extension : null + }, + getSpecialBundle: function(a, b) { + if (null == mxClient.languages || !this.isLanguageSupported(b)) { + var c = b.indexOf("-"); + 0 < c && (b = b.substring(0, c)) + } + return mxResources.loadSpecialBundle && + mxResources.isLanguageSupported(b) && b != mxClient.defaultLanguage ? a + "_" + b + mxResources.extension : null + }, + add: function(a, b) { + b = null != b ? b : mxClient.language.toLowerCase(); + if (b != mxConstants.NONE) { + var c = mxResources.getDefaultBundle(a, b); + if (null != c) try { + var d = mxUtils.load(c); + d.isReady() && mxResources.parse(d.getText()) + } catch (e) {} + c = mxResources.getSpecialBundle(a, b); + if (null != c) try { + d = mxUtils.load(c), d.isReady() && mxResources.parse(d.getText()) + } catch (f) {} + } + }, + parse: function(a) { + if (null != a) { + a = a.split("\n"); + for (var b = 0; b < + a.length; b++) + if ("#" != a[b].charAt(0)) { + var c = a[b].indexOf("\x3d"); + if (0 < c) { + var d = a[b].substring(0, c), + e = a[b].length; + 13 == a[b].charCodeAt(e - 1) && e--; + c = a[b].substring(c + 1, e); + this.resourcesEncoded ? (c = c.replace(/\\(?=u[a-fA-F\d]{4})/g, "%"), mxResources.resources[d] = unescape(c)) : mxResources.resources[d] = c + } + } + } + }, + get: function(a, b, c) { + a = mxResources.resources[a]; + null == a && (a = c); + if (null != a && null != b) { + c = []; + for (var d = null, e = 0; e < a.length; e++) { + var f = a.charAt(e); + "{" == f ? d = "" : null != d && "}" == f ? (d = parseInt(d) - 1, 0 <= d && d < b.length && + c.push(b[d]), d = null) : null != d ? d += f : c.push(f) + } + a = c.join("") + } + return a + } +}; + +function mxPoint(a, b) { + this.x = null != a ? a : 0; + this.y = null != b ? b : 0 +} +mxPoint.prototype.x = null; +mxPoint.prototype.y = null; +mxPoint.prototype.equals = function(a) { + return a.x == this.x && a.y == this.y +}; +mxPoint.prototype.clone = function() { + return mxUtils.clone(this) +}; + +function mxRectangle(a, b, c, d) { + mxPoint.call(this, a, b); + this.width = null != c ? c : 0; + this.height = null != d ? d : 0 +} +mxRectangle.prototype = new mxPoint; +mxRectangle.prototype.constructor = mxRectangle; +mxRectangle.prototype.width = null; +mxRectangle.prototype.height = null; +mxRectangle.prototype.setRect = function(a, b, c, d) { + this.x = a; + this.y = b; + this.width = c; + this.height = d +}; +mxRectangle.prototype.getCenterX = function() { + return this.x + this.width / 2 +}; +mxRectangle.prototype.getCenterY = function() { + return this.y + this.height / 2 +}; +mxRectangle.prototype.add = function(a) { + if (null != a) { + var b = Math.min(this.x, a.x), + c = Math.min(this.y, a.y), + d = Math.max(this.x + this.width, a.x + a.width); + a = Math.max(this.y + this.height, a.y + a.height); + this.x = b; + this.y = c; + this.width = d - b; + this.height = a - c + } +}; +mxRectangle.prototype.grow = function(a) { + this.x -= a; + this.y -= a; + this.width += 2 * a; + this.height += 2 * a +}; +mxRectangle.prototype.getPoint = function() { + return new mxPoint(this.x, this.y) +}; +mxRectangle.prototype.equals = function(a) { + return a.x == this.x && a.y == this.y && a.width == this.width && a.height == this.height +}; +var mxEffects = { + animateChanges: function(a, b, c) { + var d = 0, + e = function() { + for (var g = !1, h = 0; h < b.length; h++) { + var k = b[h]; + if (k instanceof mxGeometryChange || k instanceof mxTerminalChange || k instanceof mxValueChange || k instanceof mxChildChange || k instanceof mxStyleChange) { + var l = a.getView().getState(k.cell || k.child, !1); + if (null != l) + if (g = !0, k.constructor != mxGeometryChange || a.model.isEdge(k.cell)) mxUtils.setOpacity(l.shape.node, 100 * d / 10); + else { + var m = a.getView().scale, + n = (k.geometry.x - k.previous.x) * m, + p = (k.geometry.y - + k.previous.y) * m, + q = (k.geometry.width - k.previous.width) * m, + m = (k.geometry.height - k.previous.height) * m; + 0 == d ? (l.x -= n, l.y -= p, l.width -= q, l.height -= m) : (l.x += n / 10, l.y += p / 10, l.width += q / 10, l.height += m / 10); + a.cellRenderer.redraw(l); + mxEffects.cascadeOpacity(a, k.cell, 100 * d / 10) + } + } + } + 10 > d && g ? (d++, window.setTimeout(e, f)) : null != c && c() + }, + f = 30; + e() + }, + cascadeOpacity: function(a, b, c) { + for (var d = a.model.getChildCount(b), e = 0; e < d; e++) { + var f = a.model.getChildAt(b, e), + g = a.getView().getState(f); + null != g && (mxUtils.setOpacity(g.shape.node, + c), mxEffects.cascadeOpacity(a, f, c)) + } + b = a.model.getEdges(b); + if (null != b) + for (e = 0; e < b.length; e++) d = a.getView().getState(b[e]), null != d && mxUtils.setOpacity(d.shape.node, c) + }, + fadeOut: function(a, b, c, d, e, f) { + d = d || 40; + e = e || 30; + var g = b || 100; + mxUtils.setOpacity(a, g); + if (f || null == f) { + var h = function() { + g = Math.max(g - d, 0); + mxUtils.setOpacity(a, g); + 0 < g ? window.setTimeout(h, e) : (a.style.visibility = "hidden", c && a.parentNode && a.parentNode.removeChild(a)) + }; + window.setTimeout(h, e) + } else a.style.visibility = "hidden", c && a.parentNode && a.parentNode.removeChild(a) + } + }, + mxUtils = { + errorResource: "none" != mxClient.language ? "error" : "", + closeResource: "none" != mxClient.language ? "close" : "", + errorImage: mxClient.imageBasePath + "/error.gif", + removeCursors: function(a) { + null != a.style && (a.style.cursor = ""); + a = a.childNodes; + if (null != a) + for (var b = a.length, c = 0; c < b; c += 1) mxUtils.removeCursors(a[c]) + }, + getCurrentStyle: function() { + return mxClient.IS_IE ? function(a) { + return null != a ? a.currentStyle : null + } : function(a) { + return null != a ? window.getComputedStyle(a, "") : null + } + }(), + hasScrollbars: function(a) { + a = mxUtils.getCurrentStyle(a); + return null != a && ("scroll" == a.overflow || "auto" == a.overflow) + }, + bind: function(a, b) { + return function() { + return b.apply(a, arguments) + } + }, + eval: function(a) { + var b = null; + if (0 <= a.indexOf("function")) try { + eval("var _mxJavaScriptExpression\x3d" + a), b = _mxJavaScriptExpression, _mxJavaScriptExpression = null + } catch (c) { + mxLog.warn(c.message + " while evaluating " + a) + } else try { + b = eval(a) + } catch (d) { + mxLog.warn(d.message + " while evaluating " + a) + } + return b + }, + findNode: function(a, b, c) { + var d = a.getAttribute(b); + if (null != d && d == c) return a; + for (a = + a.firstChild; null != a;) { + d = mxUtils.findNode(a, b, c); + if (null != d) return d; + a = a.nextSibling + } + return null + }, + findNodeByAttribute: function() { + return 9 <= document.documentMode ? function(a, b, c) { + var d = null; + if (null != a) + if (a.nodeType == mxConstants.NODETYPE_ELEMENT && a.getAttribute(b) == c) d = a; + else + for (a = a.firstChild; null != a && null == d;) d = mxUtils.findNodeByAttribute(a, b, c), a = a.nextSibling; + return d + } : mxClient.IS_IE ? function(a, b, c) { + return null == a ? null : a.ownerDocument.selectSingleNode("//*[@" + b + "\x3d'" + c + "']") + } : function(a, b, c) { + return null == + a ? null : a.ownerDocument.evaluate("//*[@" + b + "\x3d'" + c + "']", a.ownerDocument, null, XPathResult.ANY_TYPE, null).iterateNext() + } + }(), + getFunctionName: function(a) { + var b = null; + if (null != a) + if (null != a.name) b = a.name; + else { + a = a.toString(); + for (b = 9; + " " == a.charAt(b);) b++; + var c = a.indexOf("(", b), + b = a.substring(b, c) + } + return b + }, + indexOf: function(a, b) { + if (null != a && null != b) + for (var c = 0; c < a.length; c++) + if (a[c] == b) return c; + return -1 + }, + remove: function(a, b) { + var c = null; + if ("object" == typeof b) + for (var d = mxUtils.indexOf(b, a); 0 <= d;) b.splice(d, + 1), c = a, d = mxUtils.indexOf(b, a); + for (var e in b) b[e] == a && (delete b[e], c = a); + return c + }, + isNode: function(a, b, c, d) { + return null != a && !isNaN(a.nodeType) && (null == b || a.nodeName.toLowerCase() == b.toLowerCase()) ? null == c || a.getAttribute(c) == d : !1 + }, + getChildNodes: function(a, b) { + b = b || mxConstants.NODETYPE_ELEMENT; + for (var c = [], d = a.firstChild; null != d;) d.nodeType == b && c.push(d), d = d.nextSibling; + return c + }, + createXmlDocument: function() { + var a = null; + document.implementation && document.implementation.createDocument ? a = document.implementation.createDocument("", + "", null) : window.ActiveXObject && (a = new ActiveXObject("Microsoft.XMLDOM")); + return a + }, + parseXml: function() { + return mxClient.IS_IE && ("undefined" === typeof document.documentMode || 9 > document.documentMode) ? function(a) { + var b = mxUtils.createXmlDocument(); + b.async = "false"; + b.loadXML(a); + return b + } : function(a) { + return (new DOMParser).parseFromString(a, "text/xml") + } + }(), + clearSelection: function() { + if (document.selection) return function() { + document.selection.empty() + }; + if (window.getSelection) return function() { + window.getSelection().removeAllRanges() + } + }(), + getPrettyXml: function(a, b, c) { + var d = []; + if (null != a) + if (b = b || " ", c = c || "", a.nodeType == mxConstants.NODETYPE_TEXT) d.push(a.nodeValue); + else { + d.push(c + "\x3c" + a.nodeName); + var e = a.attributes; + if (null != e) + for (var f = 0; f < e.length; f++) { + var g = mxUtils.htmlEntities(e[f].nodeValue); + d.push(" " + e[f].nodeName + '\x3d"' + g + '"') + } + e = a.firstChild; + if (null != e) { + for (d.push("\x3e\n"); null != e;) d.push(mxUtils.getPrettyXml(e, b, c + b)), e = e.nextSibling; + d.push(c + "\x3c/" + a.nodeName + "\x3e\n") + } else d.push("/\x3e\n") + } + return d.join("") + }, + removeWhitespace: function(a, + b) { + for (var c = b ? a.previousSibling : a.nextSibling; null != c && c.nodeType == mxConstants.NODETYPE_TEXT;) { + var d = b ? c.previousSibling : c.nextSibling, + e = mxUtils.getTextContent(c); + 0 == mxUtils.trim(e).length && c.parentNode.removeChild(c); + c = d + } + }, + htmlEntities: function(a, b) { + a = (a || "").replace(/&/g, "\x26amp;"); + a = a.replace(/"/g, "\x26quot;"); + a = a.replace(/\'/g, "\x26#39;"); + a = a.replace(//g, "\x26gt;"); + if (null == b || b) a = a.replace(/\n/g, "\x26#xa;"); + return a + }, + isVml: function(a) { + return null != a && "urn:schemas-microsoft-com:vml" == + a.tagUrn + }, + getXml: function(a, b) { + var c = ""; + null != a && (c = a.xml, c = null == c ? a.innerHTML ? a.innerHTML : (new XMLSerializer).serializeToString(a) : c.replace(/\r\n\t[\t]*/g, "").replace(/>\r\n/g, "\x3e").replace(/\r\n/g, "\n")); + return c = c.replace(/\n/g, b || "\x26#xa;") + }, + getTextContent: function(a) { + var b = ""; + null != a && (null != a.firstChild && (a = a.firstChild), b = a.nodeValue || ""); + return b + }, + getInnerHtml: function() { + return mxClient.IS_IE ? function(a) { + return null != a ? a.innerHTML : "" + } : function(a) { + return null != a ? (new XMLSerializer).serializeToString(a) : + "" + } + }(), + getOuterHtml: function() { + return mxClient.IS_IE ? function(a) { + if (null != a) { + if (null != a.outerHTML) return a.outerHTML; + var b = []; + b.push("\x3c" + a.nodeName); + var c = a.attributes; + if (null != c) + for (var d = 0; d < c.length; d++) { + var e = c[d].nodeValue; + null != e && 0 < e.length && (b.push(" "), b.push(c[d].nodeName), b.push('\x3d"'), b.push(e), b.push('"')) + } + 0 == a.innerHTML.length ? b.push("/\x3e") : (b.push("\x3e"), b.push(a.innerHTML), b.push("\x3c/" + a.nodeName + "\x3e")); + return b.join("") + } + return "" + } : function(a) { + return null != a ? (new XMLSerializer).serializeToString(a) : + "" + } + }(), + write: function(a, b) { + var c = a.ownerDocument.createTextNode(b); + null != a && a.appendChild(c); + return c + }, + writeln: function(a, b) { + var c = a.ownerDocument.createTextNode(b); + null != a && (a.appendChild(c), a.appendChild(document.createElement("br"))); + return c + }, + br: function(a, b) { + b = b || 1; + for (var c = null, d = 0; d < b; d++) null != a && (c = a.ownerDocument.createElement("br"), a.appendChild(c)); + return c + }, + button: function(a, b, c) { + c = null != c ? c : document; + c = c.createElement("button"); + mxUtils.write(c, a); + mxEvent.addListener(c, "click", function(a) { + b(a) + }); + return c + }, + para: function(a, b) { + var c = document.createElement("p"); + mxUtils.write(c, b); + null != a && a.appendChild(c); + return c + }, + addTransparentBackgroundFilter: function(a) { + a.style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src\x3d'" + mxClient.imageBasePath + "/transparent.gif', sizingMethod\x3d'scale')" + }, + linkAction: function(a, b, c, d, e) { + return mxUtils.link(a, b, function() { + c.execute(d) + }, e) + }, + linkInvoke: function(a, b, c, d, e, f) { + return mxUtils.link(a, b, function() { + c[d](e) + }, f) + }, + link: function(a, b, c, d) { + var e = + document.createElement("span"); + e.style.color = "blue"; + e.style.textDecoration = "underline"; + e.style.cursor = "pointer"; + null != d && (e.style.paddingLeft = d + "px"); + mxEvent.addListener(e, "click", c); + mxUtils.write(e, b); + null != a && a.appendChild(e); + return e + }, + fit: function(a) { + var b = parseInt(a.offsetLeft), + c = parseInt(a.offsetWidth), + d = document.body, + e = document.documentElement, + f = (d.scrollLeft || e.scrollLeft) + (d.clientWidth || e.clientWidth); + b + c > f && (a.style.left = Math.max(d.scrollLeft || e.scrollLeft, f - c) + "px"); + b = parseInt(a.offsetTop); + c = parseInt(a.offsetHeight); + f = (d.scrollTop || e.scrollTop) + Math.max(d.clientHeight || 0, e.clientHeight); + b + c > f && (a.style.top = Math.max(d.scrollTop || e.scrollTop, f - c) + "px") + }, + open: function(a) { + if (mxClient.IS_NS) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") + } catch (b) { + return mxUtils.alert("Permission to read file denied."), "" + } + var c = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); + c.initWithPath(a); + if (!c.exists()) return mxUtils.alert("File not found."), + ""; + a = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); + a.init(c, 1, 4, null); + c = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); + c.init(a); + return c.read(c.available()) + } + c = (new ActiveXObject("Scripting.FileSystemObject")).OpenTextFile(a, 1); + a = c.readAll(); + c.close(); + return a + }, + save: function(a, b) { + if (mxClient.IS_NS) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") + } catch (c) { + mxUtils.alert("Permission to write file denied."); + return + } + var d = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); + d.initWithPath(a); + d.exists() || d.create(0, 420); + var e = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); + e.init(d, 34, 4, null); + e.write(b, b.length); + e.flush(); + e.close() + } else d = (new ActiveXObject("Scripting.FileSystemObject")).CreateTextFile(a, !0), d.Write(b), d.Close() + }, + saveAs: function(a) { + var b = document.createElement("iframe"); + b.setAttribute("src", ""); + b.style.visibility = "hidden"; + document.body.appendChild(b); + try { + if (mxClient.IS_NS) { + var c = b.contentDocument; + c.open(); + c.write(a); + c.close(); + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"), b.focus(), saveDocument(c) + } catch (d) { + mxUtils.alert("Permission to save document denied.") + } + } else c = b.contentWindow.document, c.write(a), c.execCommand("SaveAs", !1, document.location) + } finally { + document.body.removeChild(b) + } + }, + copy: function(a) { + if (window.clipboardData) window.clipboardData.setData("Text", + a); + else { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var b = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard); + if (b) { + var c = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable); + if (c) { + c.addDataFlavor("text/unicode"); + var d = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); + d.data = a; + c.setTransferData("text/unicode", + d, 2 * a.length); + b.setData(c, null, Components.interfaces.nsIClipboard.kGlobalClipboard) + } + } + } + }, + load: function(a) { + a = new mxXmlRequest(a, null, "GET", !1); + a.send(); + return a + }, + get: function(a, b, c) { + return (new mxXmlRequest(a, null, "GET")).send(b, c) + }, + post: function(a, b, c, d) { + return (new mxXmlRequest(a, b)).send(c, d) + }, + submit: function(a, b, c, d) { + return (new mxXmlRequest(a, b)).simulate(c, d) + }, + loadInto: function(a, b, c) { + mxClient.IS_IE ? b.onreadystatechange = function() { + 4 == b.readyState && c() + } : b.addEventListener("load", c, !1); + b.load(a) + }, + getValue: function(a, b, c) { + a = null != a ? a[b] : null; + null == a && (a = c); + return a + }, + getNumber: function(a, b, c) { + a = null != a ? a[b] : null; + null == a && (a = c || 0); + return Number(a) + }, + getColor: function(a, b, c) { + a = null != a ? a[b] : null; + null == a ? a = c : a == mxConstants.NONE && (a = null); + return a + }, + clone: function(a, b, c) { + c = null != c ? c : !1; + var d = null; + if (null != a && "function" == typeof a.constructor) { + var d = new a.constructor, + e; + for (e in a) + if (e != mxObjectIdentity.FIELD_NAME && (null == b || 0 > mxUtils.indexOf(b, e))) d[e] = !c && "object" == typeof a[e] ? mxUtils.clone(a[e]) : a[e] + } + return d + }, + equalPoints: function(a, b) { + if (null == a && null != b || null != a && null == b || null != a && null != b && a.length != b.length) return !1; + if (null != a && null != b) + for (var c = 0; c < a.length; c++) + if (a[c] == b[c] || null != a[c] && !a[c].equals(b[c])) return !1; + return !0 + }, + equalEntries: function(a, b) { + if (null == a && null != b || null != a && null == b || null != a && null != b && a.length != b.length) return !1; + if (null != a && null != b) + for (var c in a) + if (a[c] != b[c]) return !1; + return !0 + }, + extend: function(a, b) { + var c = function() {}; + c.prototype = b.prototype; + a.prototype = new c; + a.prototype.constructor = + a + }, + toString: function(a) { + var b = "", + c; + for (c in a) try { + if (null == a[c]) b += c + " \x3d [null]\n"; + else if ("function" == typeof a[c]) b += c + " \x3d\x3e [Function]\n"; + else if ("object" == typeof a[c]) var d = mxUtils.getFunctionName(a[c].constructor), + b = b + (c + " \x3d\x3e [" + d + "]\n"); + else b += c + " \x3d " + a[c] + "\n" + } catch (e) { + b += c + "\x3d" + e.message + } + return b + }, + toRadians: function(a) { + return Math.PI * a / 180 + }, + arcToCurves: function(a, b, c, d, e, f, g, h, k) { + h -= a; + k -= b; + if (0 === c || 0 === d) return p; + c = Math.abs(c); + d = Math.abs(d); + var l = -h / 2, + m = -k / 2, + n = Math.cos(e * + Math.PI / 180), + p = Math.sin(e * Math.PI / 180); + e = n * l + p * m; + var l = -1 * p * l + n * m, + m = e * e, + q = l * l, + s = c * c, + r = d * d, + t = m / s + q / r; + 1 < t ? (c *= Math.sqrt(t), d *= Math.sqrt(t), f = 0) : (t = 1, f === g && (t = -1), f = t * Math.sqrt((s * r - s * q - r * m) / (s * q + r * m))); + m = f * c * l / d; + q = -1 * f * d * e / c; + h = n * m - p * q + h / 2; + k = p * m + n * q + k / 2; + s = Math.atan2((l - q) / d, (e - m) / c) - Math.atan2(0, 1); + f = 0 <= s ? s : 2 * Math.PI + s; + s = Math.atan2((-l - q) / d, (-e - m) / c) - Math.atan2((l - q) / d, (e - m) / c); + e = 0 <= s ? s : 2 * Math.PI + s; + 0 == g && 0 < e ? e -= 2 * Math.PI : 0 != g && 0 > e && (e += 2 * Math.PI); + g = 2 * e / Math.PI; + g = Math.ceil(0 > g ? -1 * g : g); + e /= g; + l = 8 / 3 * Math.sin(e / + 4) * Math.sin(e / 4) / Math.sin(e / 2); + m = n * c; + n *= d; + c *= p; + d *= p; + for (var v = Math.cos(f), w = Math.sin(f), q = -l * (m * w + d * v), s = -l * (c * w - n * v), t = r = 0, p = [], u = 0; u < g; ++u) { + f += e; + var v = Math.cos(f), + w = Math.sin(f), + r = m * v - d * w + h, + t = c * v + n * w + k, + y = -l * (m * w + d * v), + v = -l * (c * w - n * v), + w = 6 * u; + p[w] = Number(q + a); + p[w + 1] = Number(s + b); + p[w + 2] = Number(r - y + a); + p[w + 3] = Number(t - v + b); + p[w + 4] = Number(r + a); + p[w + 5] = Number(t + b); + q = r + y; + s = t + v + } + return p + }, + getBoundingBox: function(a, b) { + var c = null; + if (null != a && null != b && 0 != b) { + var d = mxUtils.toRadians(b), + c = Math.cos(d), + e = Math.sin(d), + f = + new mxPoint(a.x + a.width / 2, a.y + a.height / 2), + g = new mxPoint(a.x, a.y), + d = new mxPoint(a.x + a.width, a.y), + h = new mxPoint(d.x, a.y + a.height), + k = new mxPoint(a.x, h.y), + g = mxUtils.getRotatedPoint(g, c, e, f), + d = mxUtils.getRotatedPoint(d, c, e, f), + h = mxUtils.getRotatedPoint(h, c, e, f), + k = mxUtils.getRotatedPoint(k, c, e, f), + c = new mxRectangle(g.x, g.y, 0, 0); + c.add(new mxRectangle(d.x, d.y, 0, 0)); + c.add(new mxRectangle(h.x, h.y, 0, 0)); + c.add(new mxRectangle(k.x, k.y, 0, 0)) + } + return c + }, + getRotatedPoint: function(a, b, c, d) { + d = null != d ? d : new mxPoint; + var e = + a.x - d.x; + a = a.y - d.y; + return new mxPoint(e * b - a * c + d.x, a * b + e * c + d.y) + }, + getPortConstraints: function(a, b, c, d) { + a = mxUtils.getValue(a.style, mxConstants.STYLE_PORT_CONSTRAINT, null); + if (null == a) return d; + d = a.toString(); + a = mxConstants.DIRECTION_MASK_NONE; + 0 <= d.indexOf(mxConstants.DIRECTION_NORTH) && (a |= mxConstants.DIRECTION_MASK_NORTH); + 0 <= d.indexOf(mxConstants.DIRECTION_WEST) && (a |= mxConstants.DIRECTION_MASK_WEST); + 0 <= d.indexOf(mxConstants.DIRECTION_SOUTH) && (a |= mxConstants.DIRECTION_MASK_SOUTH); + 0 <= d.indexOf(mxConstants.DIRECTION_EAST) && + (a |= mxConstants.DIRECTION_MASK_EAST); + return a + }, + reversePortConstraints: function(a) { + var b = 0, + b = (a & mxConstants.DIRECTION_MASK_WEST) << 3, + b = b | (a & mxConstants.DIRECTION_MASK_NORTH) << 1, + b = b | (a & mxConstants.DIRECTION_MASK_SOUTH) >> 1; + return b |= (a & mxConstants.DIRECTION_MASK_EAST) >> 3 + }, + findNearestSegment: function(a, b, c) { + var d = -1; + if (0 < a.absolutePoints.length) + for (var e = a.absolutePoints[0], f = null, g = 1; g < a.absolutePoints.length; g++) { + var h = a.absolutePoints[g], + e = mxUtils.ptSegDistSq(e.x, e.y, h.x, h.y, b, c); + if (null == f || e < f) f = + e, d = g - 1; + e = h + } + return d + }, + rectangleIntersectsSegment: function(a, b, c) { + var d = a.y, + e = a.x, + f = d + a.height, + g = e + a.width; + a = b.x; + var h = c.x; + b.x > c.x && (a = c.x, h = b.x); + h > g && (h = g); + a < e && (a = e); + if (a > h) return !1; + var e = b.y, + g = c.y, + k = c.x - b.x; + 1E-7 < Math.abs(k) && (c = (c.y - b.y) / k, b = b.y - c * b.x, e = c * a + b, g = c * h + b); + e > g && (b = g, g = e, e = b); + g > f && (g = f); + e < d && (e = d); + return e > g ? !1 : !0 + }, + contains: function(a, b, c) { + return a.x <= b && a.x + a.width >= b && a.y <= c && a.y + a.height >= c + }, + intersects: function(a, b) { + var c = a.width, + d = a.height, + e = b.width, + f = b.height; + if (0 >= e || 0 >= f || 0 >= c || + 0 >= d) return !1; + var g = a.x, + h = a.y, + k = b.x, + l = b.y, + e = e + k, + f = f + l, + c = c + g, + d = d + h; + return (e < k || e > g) && (f < l || f > h) && (c < g || c > k) && (d < h || d > l) + }, + intersectsHotspot: function(a, b, c, d, e, f) { + d = null != d ? d : 1; + e = null != e ? e : 0; + f = null != f ? f : 0; + if (0 < d) { + var g = a.getCenterX(), + h = a.getCenterY(), + k = a.width, + l = a.height, + m = mxUtils.getValue(a.style, mxConstants.STYLE_STARTSIZE) * a.view.scale; + 0 < m && (mxUtils.getValue(a.style, mxConstants.STYLE_HORIZONTAL, !0) ? (h = a.y + m / 2, l = m) : (g = a.x + m / 2, k = m)); + k = Math.max(e, k * d); + l = Math.max(e, l * d); + 0 < f && (k = Math.min(k, f), l = Math.min(l, + f)); + d = new mxRectangle(g - k / 2, h - l / 2, k, l); + g = mxUtils.toRadians(mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION) || 0); + 0 != g && (e = Math.cos(-g), f = Math.sin(-g), g = new mxPoint(a.getCenterX(), a.getCenterY()), a = mxUtils.getRotatedPoint(new mxPoint(b, c), e, f, g), b = a.x, c = a.y); + return mxUtils.contains(d, b, c) + } + return !0 + }, + getOffset: function(a, b) { + var c = 0, + d = 0; + if (null != b && b) var e = document.body, + f = document.documentElement, + c = c + (e.scrollLeft || f.scrollLeft), + d = d + (e.scrollTop || f.scrollTop); + for (; a.offsetParent;) c += a.offsetLeft, d += + a.offsetTop, a = a.offsetParent; + return new mxPoint(c, d) + }, + getScrollOrigin: function(a) { + for (var b = document.body, c = document.documentElement, d = new mxPoint(b.scrollLeft || c.scrollLeft, b.scrollTop || c.scrollTop); null != a && a != b && a != c;) !isNaN(a.scrollLeft) && ! + isNaN(a.scrollTop) && (d.x += a.scrollLeft, d.y += a.scrollTop), a = a.parentNode; + return d + }, + convertPoint: function(a, b, c) { + var d = mxUtils.getScrollOrigin(a); + a = mxUtils.getOffset(a); + a.x -= d.x; + a.y -= d.y; + return new mxPoint(b - a.x, c - a.y) + }, + ltrim: function(a, b) { + return a.replace(RegExp("^[" + + (b || "\\s") + "]+", "g"), "") + }, + rtrim: function(a, b) { + return a.replace(RegExp("[" + (b || "\\s") + "]+$", "g"), "") + }, + trim: function(a, b) { + return mxUtils.ltrim(mxUtils.rtrim(a, b), b) + }, + isNumeric: function(a) { + return null != a && (null == a.length || 0 < a.length && 0 > a.indexOf("0x") && 0 > a.indexOf("0X")) && !isNaN(a) + }, + mod: function(a, b) { + return (a % b + b) % b + }, + intersection: function(a, b, c, d, e, f, g, h) { + var k = (h - f) * (c - a) - (g - e) * (d - b); + g = ((g - e) * (b - f) - (h - f) * (a - e)) / k; + e = ((c - a) * (b - f) - (d - b) * (a - e)) / k; + return 0 <= g && 1 >= g && 0 <= e && 1 >= e ? new mxPoint(a + g * (c - a), b + g * + (d - b)) : null + }, + ptSegDistSq: function(a, b, c, d, e, f) { + c -= a; + d -= b; + e -= a; + f -= b; + 0 >= e * c + f * d ? c = 0 : (e = c - e, f = d - f, a = e * c + f * d, c = 0 >= a ? 0 : a * a / (c * c + d * d)); + e = e * e + f * f - c; + 0 > e && (e = 0); + return e + }, + relativeCcw: function(a, b, c, d, e, f) { + c -= a; + d -= b; + e -= a; + f -= b; + a = e * d - f * c; + 0 == a && (a = e * c + f * d, 0 < a && (a = (e - c) * c + (f - d) * d, 0 > a && (a = 0))); + return 0 > a ? -1 : 0 < a ? 1 : 0 + }, + animateChanges: function(a, b) { + mxEffects.animateChanges.apply(this, arguments) + }, + cascadeOpacity: function(a, b, c) { + mxEffects.cascadeOpacity.apply(this, arguments) + }, + fadeOut: function(a, b, c, d, e, f) { + mxEffects.fadeOut.apply(this, + arguments) + }, + setOpacity: function(a, b) { + mxUtils.isVml(a) ? a.style.filter = 100 <= b ? null : "alpha(opacity\x3d" + b / 5 + ")" : mxClient.IS_IE && ("undefined" === typeof document.documentMode || 9 > document.documentMode) ? a.style + .filter = 100 <= b ? null : "alpha(opacity\x3d" + b + ")" : a.style.opacity = b / 100 + }, + createImage: function(a) { + var b = null; + mxClient.IS_IE6 && "CSS1Compat" != document.compatMode ? (b = document.createElement(mxClient.VML_PREFIX + ":image"), b.setAttribute("src", a), b.style.borderStyle = "none") : (b = document.createElement( + "img"), b.setAttribute("src", + a), b.setAttribute("border", "0")); + return b + }, + sortCells: function(a, b) { + b = null != b ? b : !0; + var c = new mxDictionary; + a.sort(function(a, e) { + var f = c.get(a); + null == f && (f = mxCellPath.create(a).split(mxCellPath.PATH_SEPARATOR), c.put(a, f)); + var g = c.get(e); + null == g && (g = mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR), c.put(e, g)); + f = mxCellPath.compare(f, g); + return 0 == f ? 0 : 0 < f == b ? 1 : -1 + }); + return a + }, + getStylename: function(a) { + return null != a && (a = a.split(";")[0], 0 > a.indexOf("\x3d")) ? a : "" + }, + getStylenames: function(a) { + var b = []; + if (null != + a) { + a = a.split(";"); + for (var c = 0; c < a.length; c++) 0 > a[c].indexOf("\x3d") && b.push(a[c]) + } + return b + }, + indexOfStylename: function(a, b) { + if (null != a && null != b) + for (var c = a.split(";"), d = 0, e = 0; e < c.length; e++) { + if (c[e] == b) return d; + d += c[e].length + 1 + } + return -1 + }, + addStylename: function(a, b) { + 0 > mxUtils.indexOfStylename(a, b) && (null == a ? a = "" : 0 < a.length && ";" != a.charAt(a.length - 1) && (a += ";"), a += b); + return a + }, + removeStylename: function(a, b) { + var c = []; + if (null != a) + for (var d = a.split(";"), e = 0; e < d.length; e++) d[e] != b && c.push(d[e]); + return c.join(";") + }, + removeAllStylenames: function(a) { + var b = []; + if (null != a) { + a = a.split(";"); + for (var c = 0; c < a.length; c++) 0 <= a[c].indexOf("\x3d") && b.push(a[c]) + } + return b.join(";") + }, + setCellStyles: function(a, b, c, d) { + if (null != b && 0 < b.length) { + a.beginUpdate(); + try { + for (var e = 0; e < b.length; e++) + if (null != b[e]) { + var f = mxUtils.setStyle(a.getStyle(b[e]), c, d); + a.setStyle(b[e], f) + } + } finally { + a.endUpdate() + } + } + }, + setStyle: function(a, b, c) { + var d = null != c && ("undefined" == typeof c.length || 0 < c.length); + if (null == a || 0 == a.length) d && (a = b + "\x3d" + c); + else { + var e = a.indexOf(b + + "\x3d"); + 0 > e ? d && (d = ";" == a.charAt(a.length - 1) ? "" : ";", a = a + d + b + "\x3d" + c) : (b = d ? b + "\x3d" + c : "", c = a.indexOf(";", e), d || c++, a = a.substring(0, e) + b + (c > e ? + a.substring(c) : "")) + } + return a + }, + setCellStyleFlags: function(a, b, c, d, e) { + if (null != b && 0 < b.length) { + a.beginUpdate(); + try { + for (var f = 0; f < b.length; f++) + if (null != b[f]) { + var g = mxUtils.setStyleFlag(a.getStyle(b[f]), c, d, e); + a.setStyle(b[f], g) + } + } finally { + a.endUpdate() + } + } + }, + setStyleFlag: function(a, b, c, d) { + if (null == a || 0 == a.length) a = d || null == d ? b + "\x3d" + c : b + "\x3d0"; + else { + var e = a.indexOf(b + + "\x3d"); + if (0 > e) e = ";" == a.charAt(a.length - 1) ? "" : ";", a = d || null == d ? a + e + b + "\x3d" + c : a + e + b + "\x3d0"; + else { + var f = a.indexOf(";", e), + g = "", + g = 0 > f ? a.substring(e + b.length + 1) : a.substring(e + b.length + 1, f), + g = null == d ? parseInt(g) ^ c : d ? parseInt(g) | c : parseInt(g) & ~c; + a = a.substring(0, e) + b + "\x3d" + g + (0 <= f ? a.substring(f) : "") + } + } + return a + }, + getAlignmentAsPoint: function(a, b) { + var c = 0, + d = 0; + a == mxConstants.ALIGN_CENTER ? c = -0.5 : a == mxConstants.ALIGN_RIGHT && (c = -1); + b == mxConstants.ALIGN_MIDDLE ? d = -0.5 : b == mxConstants.ALIGN_BOTTOM && (d = -1); + return new mxPoint(c, + d) + }, + getSizeForString: function(a, b, c) { + b = null != b ? b : mxConstants.DEFAULT_FONTSIZE; + c = null != c ? c : mxConstants.DEFAULT_FONTFAMILY; + var d = document.createElement("div"); + d.style.fontFamily = c; + d.style.fontSize = Math.round(b) + "px"; + d.style.lineHeight = Math.round(b * mxConstants.LINE_HEIGHT) + "px"; + d.style.position = "absolute"; + d.style.whiteSpace = "nowrap"; + d.style.visibility = "hidden"; + d.style.display = mxClient.IS_QUIRKS ? "inline" : "inline-block"; + d.style.zoom = "1"; + d.innerHTML = a; + document.body.appendChild(d); + a = new mxRectangle(0, 0, + d.offsetWidth, d.offsetHeight); + document.body.removeChild(d); + return a + }, + getViewXml: function(a, b, c, d, e) { + d = null != d ? d : 0; + e = null != e ? e : 0; + b = null != b ? b : 1; + null == c && (c = [a.getModel().getRoot()]); + var f = a.getView(), + g = null, + h = f.isEventsEnabled(); + f.setEventsEnabled(!1); + var k = f.drawPane, + l = f.overlayPane; + a.dialect == mxConstants.DIALECT_SVG ? (f.drawPane = document.createElementNS(mxConstants.NS_SVG, "g"), f.canvas.appendChild(f.drawPane), f.overlayPane = document.createElementNS(mxConstants.NS_SVG, + "g")) : (f.drawPane = f.drawPane.cloneNode(!1), + f.canvas.appendChild(f.drawPane), f.overlayPane = f.overlayPane.cloneNode(!1)); + f.canvas.appendChild(f.overlayPane); + var m = f.getTranslate(); + f.translate = new mxPoint(d, e); + b = new mxTemporaryCellStates(a.getView(), b, c); + try { + g = (new mxCodec).encode(a.getView()) + } finally { + b.destroy(), f.translate = m, f.canvas.removeChild(f.drawPane), f.canvas.removeChild(f.overlayPane), f.drawPane = k, f.overlayPane = l, f.setEventsEnabled(h) + } + return g + }, + getScaleForPageCount: function(a, b, c, d) { + if (1 > a) return 1; + c = null != c ? c : mxConstants.PAGE_FORMAT_A4_PORTRAIT; + d = null != d ? d : 0; + var e = c.width - 2 * d; + c = c.height - 2 * d; + d = b.getGraphBounds().clone(); + b = b.getView().getScale(); + d.width /= b; + d.height /= b; + b = d.width; + c = b / d.height / (e / c); + d = Math.sqrt(a); + var f = Math.sqrt(c); + c = d * f; + d /= f; + if (1 > c && d > a) { + var g = d / a; + d = a; + c /= g + } + 1 > d && c > a && (g = c / a, c = a, d /= g); + g = Math.ceil(c) * Math.ceil(d); + for (f = 0; g > a;) { + var g = Math.floor(c) / c, + h = Math.floor(d) / d; + 1 == g && (g = Math.floor(c - 1) / c); + 1 == h && (h = Math.floor(d - 1) / d); + g = g > h ? g : h; + c *= g; + d *= g; + g = Math.ceil(c) * Math.ceil(d); + f++; + if (10 < f) break + } + return 0.99999 * (e * c / b) + }, + show: function(a, + b, c, d) { + c = null != c ? c : 0; + d = null != d ? d : 0; + null == b ? b = window.open().document : b.open(); + var e = a.getGraphBounds(); + c = -e.x + c; + d = -e.y + d; + if (mxClient.IS_IE) { + for (var e = "\x3chtml\x3e\x3chead\x3e", f = document.getElementsByTagName("base"), g = 0; g < f.length; g++) e += f[g].outerHTML; + e += "\x3cstyle\x3e"; + for (g = 0; g < document.styleSheets.length; g++) try { + e += document.styleSheets(g).cssText + } catch (h) {} + e += "\x3c/style\x3e\x3c/head\x3e"; + e += "\x3cbody\x3e"; + e += a.container.innerHTML; + e += "\x3c/body\x3e"; + e += "\x3chtml\x3e"; + b.writeln(e); + b.close(); + a = + b.body.getElementsByTagName("DIV")[0]; + null != a && (a.style.position = "absolute", a.style.left = c + "px", a.style.top = d + "px") + } else { + b.writeln("\x3chtml"); + b.writeln("\x3chead\x3e"); + f = document.getElementsByTagName("base"); + for (g = 0; g < f.length; g++) b.writeln(mxUtils.getOuterHtml(f[g])); + f = document.getElementsByTagName("link"); + for (g = 0; g < f.length; g++) b.writeln(mxUtils.getOuterHtml(f[g])); + f = document.getElementsByTagName("style"); + for (g = 0; g < f.length; g++) b.writeln(mxUtils.getOuterHtml(f[g])); + b.writeln("\x3c/head\x3e"); + b.writeln("\x3c/html\x3e"); + b.close(); + null == b.body && b.documentElement.appendChild(b.createElement("body")); + b.body.style.overflow = "auto"; + for (a = a.container.firstChild; null != a;) g = a.cloneNode(!0), b.body.appendChild(g), a = a.nextSibling; + a = b.getElementsByTagName("g")[0]; + null != a && (a.setAttribute("transform", "translate(" + c + "," + d + ")"), c = a.ownerSVGElement, c.setAttribute("width", e.width + Math.max(e.x, 0) + 3), c.setAttribute("height", e.height + + Math.max(e.y, 0) + 3)) + } + mxUtils.removeCursors(b.body); + return b + }, + printScreen: function(a) { + var b = window.open(); + mxUtils.show(a, b.document); + a = function() { + b.focus(); + b.print(); + b.close() + }; + mxClient.IS_GC ? b.setTimeout(a, 500) : a() + }, + popup: function(a, b) { + if (b) { + var c = document.createElement("div"); + c.style.overflow = "scroll"; + c.style.width = "636px"; + c.style.height = "460px"; + var d = document.createElement("pre"); + d.innerHTML = mxUtils.htmlEntities(a, !1).replace(/\n/g, "\x3cbr\x3e").replace(/ /g, "\x26nbsp;"); + c.appendChild(d); + c = new mxWindow("Popup Window", c, document.body.clientWidth / 2 - 320, (document.body.clientHeight || document.documentElement.clientHeight) / + 2 - 240, 640, 480, !1, !0); + c.setClosable(!0); + c.setVisible(!0) + } else mxClient.IS_NS ? (c = window.open(), c.document.writeln("\x3cpre\x3e" + mxUtils.htmlEntities(a) + "\x3c/pre"), c.document.close()) : (c = window.open(), d = c.document.createElement( + "pre"), d.innerHTML = mxUtils.htmlEntities(a, !1).replace(/\n/g, "\x3cbr\x3e").replace(/ /g, "\x26nbsp;"), c.document.body.appendChild(d)) + }, + alert: function(a) { + alert(a) + }, + prompt: function(a, b) { + return prompt(a, b) + }, + confirm: function(a) { + return confirm(a) + }, + error: function(a, b, c, d) { + var e = document.createElement("div"); + e.style.padding = "20px"; + var f = document.createElement("img"); + f.setAttribute("src", d || mxUtils.errorImage); + f.setAttribute("valign", "bottom"); + f.style.verticalAlign = "middle"; + e.appendChild(f); + e.appendChild(document.createTextNode("\u00a0")); + e.appendChild(document.createTextNode("\u00a0")); + e.appendChild(document.createTextNode("\u00a0")); + mxUtils.write(e, a); + a = document.body.clientWidth; + d = document.body.clientHeight || document.documentElement.clientHeight; + var g = new mxWindow(mxResources.get(mxUtils.errorResource) || + mxUtils.errorResource, e, (a - b) / 2, d / 4, b, null, !1, !0); + c && (mxUtils.br(e), b = document.createElement("p"), c = document.createElement("button"), mxClient.IS_IE ? c.style.cssText = "float:right" : c.setAttribute("style", "float:right"), mxEvent.addListener( + c, "click", + function(a) { + g.destroy() + }), mxUtils.write(c, mxResources.get(mxUtils.closeResource) || mxUtils.closeResource), b.appendChild(c), e.appendChild(b), mxUtils.br(e), g.setClosable(!0)); + g.setVisible(!0); + return g + }, + makeDraggable: function(a, b, c, d, e, f, g, h, k, l) { + a = new mxDragSource(a, + c); + a.dragOffset = new mxPoint(null != e ? e : 0, null != f ? f : mxConstants.TOOLTIP_VERTICAL_OFFSET); + a.autoscroll = g; + a.setGuidesEnabled(!1); + null != k && (a.highlightDropTargets = k); + null != l && (a.getDropTarget = l); + a.getGraphForEvent = function(a) { + return "function" == typeof b ? b(a) : b + }; + null != d && (a.createDragElement = function() { + return d.cloneNode(!0) + }, h && (a.createPreviewElement = function(a) { + var b = d.cloneNode(!0), + c = parseInt(b.style.width), + e = parseInt(b.style.height); + b.style.width = Math.round(c * a.view.scale) + "px"; + b.style.height = Math.round(e * + a.view.scale) + "px"; + return b + })); + return a + } + }, + mxConstants = { + DEFAULT_HOTSPOT: 0.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: 0.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(a) { + this.name = a; + this.properties = []; + for (var b = 1; b < arguments.length; b += 2) null != arguments[b + 1] && (this.properties[arguments[b]] = arguments[b + 1]) +} +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(a) { + return this.properties[a] +}; +mxEventObject.prototype.isConsumed = function() { + return this.consumed +}; +mxEventObject.prototype.consume = function() { + this.consumed = !0 +}; + +function mxMouseEvent(a, b) { + this.evt = a; + this.state = b +} +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(a) { + if (null != a) + for (var b = this.getSource(); null != b;) { + if (b == a.node) return !0; + b = b.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 a = this.getState(); + return null != a ? a.cell : null +}; +mxMouseEvent.prototype.isPopupTrigger = function() { + return mxEvent.isPopupTrigger(this.getEvent()) +}; +mxMouseEvent.prototype.isConsumed = function() { + return this.consumed +}; +mxMouseEvent.prototype.consume = function(a) { + (null != a ? a : 1) && this.evt.preventDefault && this.evt.preventDefault(); + this.evt.returnValue = !1; + this.consumed = !0 +}; + +function mxEventSource(a) { + this.setEventSource(a) +} +mxEventSource.prototype.eventListeners = null; +mxEventSource.prototype.eventsEnabled = !0; +mxEventSource.prototype.eventSource = null; +mxEventSource.prototype.isEventsEnabled = function() { + return this.eventsEnabled +}; +mxEventSource.prototype.setEventsEnabled = function(a) { + this.eventsEnabled = a +}; +mxEventSource.prototype.getEventSource = function() { + return this.eventSource +}; +mxEventSource.prototype.setEventSource = function(a) { + this.eventSource = a +}; +mxEventSource.prototype.addListener = function(a, b) { + null == this.eventListeners && (this.eventListeners = []); + this.eventListeners.push(a); + this.eventListeners.push(b) +}; +mxEventSource.prototype.removeListener = function(a) { + if (null != this.eventListeners) + for (var b = 0; b < this.eventListeners.length;) this.eventListeners[b + 1] == a ? this.eventListeners.splice(b, 2) : b += 2 +}; +mxEventSource.prototype.fireEvent = function(a, b) { + if (null != this.eventListeners && this.isEventsEnabled()) { + null == a && (a = new mxEventObject); + null == b && (b = this.getEventSource()); + null == b && (b = this); + for (var c = [b, a], d = 0; d < this.eventListeners.length; d += 2) { + var e = this.eventListeners[d]; + (null == e || e == a.getName()) && this.eventListeners[d + 1].apply(this, c) + } + } +}; +var mxEvent = { + objects: [], + addListener: function() { + var a = function(a, c, d) { + null == a.mxListenerList && (a.mxListenerList = [], mxEvent.objects.push(a)); + a.mxListenerList.push({ + name: c, + f: d + }) + }; + return window.addEventListener ? function(b, c, d) { + b.addEventListener(c, d, !1); + a(b, c, d) + } : function(b, c, d) { + b.attachEvent("on" + c, d); + a(b, c, d) + } + }(), + removeListener: function() { + var a = function(a, c, d) { + if (null != a.mxListenerList) { + c = a.mxListenerList.length; + for (var e = 0; e < c; e++) + if (a.mxListenerList[e].f == d) { + a.mxListenerList.splice(e, 1); + break + } + 0 == + a.mxListenerList.length && (a.mxListenerList = null) + } + }; + return window.removeEventListener ? function(b, c, d) { + b.removeEventListener(c, d, !1); + a(b, c, d) + } : function(b, c, d) { + b.detachEvent("on" + c, d); + a(b, c, d) + } + }(), + removeAllListeners: function(a) { + var b = a.mxListenerList; + if (null != b) + for (; 0 < b.length;) { + var c = b[0]; + mxEvent.removeListener(a, c.name, c.f) + } + }, + addGestureListeners: function(a, b, c, d) { + null != b && mxEvent.addListener(a, "mousedown", b); + null != c && mxEvent.addListener(a, "mousemove", c); + null != d && mxEvent.addListener(a, "mouseup", d); + mxClient.IS_TOUCH && (null != b && mxEvent.addListener(a, "touchstart", b), null != c && mxEvent.addListener(a, "touchmove", c), null != d && mxEvent.addListener(a, "touchend", d)) + }, + removeGestureListeners: function(a, b, c, d) { + null != b && mxEvent.removeListener(a, "mousedown", b); + null != c && mxEvent.removeListener(a, "mousemove", c); + null != d && mxEvent.removeListener(a, "mouseup", d); + mxClient.IS_TOUCH && (null != b && mxEvent.removeListener(a, "touchstart", b), null != c && mxEvent.removeListener(a, "touchmove", c), null != d && mxEvent.removeListener(a, "touchend", + d)) + }, + redirectMouseEvents: function(a, b, c, d, e, f, g) { + var h = function(a) { + return "function" == typeof c ? c(a) : c + }; + mxEvent.addGestureListeners(a, function(a) { + null != d ? d(a) : mxEvent.isConsumed(a) || b.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(a, h(a))) + }, function(a) { + null != e ? e(a) : mxEvent.isConsumed(a) || b.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(a, h(a))) + }, function(a) { + null != f ? f(a) : mxEvent.isConsumed(a) || b.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(a, h(a))) + }); + mxEvent.addListener(a, "dblclick", function(a) { + if (null != + g) g(a); + else if (!mxEvent.isConsumed(a)) { + var c = h(a); + b.dblClick(a, null != c ? c.cell : null) + } + }) + }, + release: function(a) { + if (null != a && (mxEvent.removeAllListeners(a), a = a.childNodes, null != a)) + for (var b = a.length, c = 0; c < b; c += 1) mxEvent.release(a[c]) + }, + addMouseWheelListener: function(a) { + if (null != a) { + var b = function(b) { + null == b && (b = window.event); + var d = 0, + d = mxClient.IS_NS && !mxClient.IS_SF && !mxClient.IS_GC ? -b.detail / 2 : b.wheelDelta / 120; + 0 != d && a(b, 0 < d) + }; + mxClient.IS_NS ? mxEvent.addListener(window, mxClient.IS_SF || mxClient.IS_GC ? "mousewheel" : + "DOMMouseScroll", b) : mxEvent.addListener(document, "mousewheel", b) + } + }, + disableContextMenu: function() { + return mxClient.IS_IE && ("undefined" === typeof document.documentMode || 9 > document.documentMode) ? function(a) { + mxEvent.addListener(a, "contextmenu", function() { + return !1 + }) + } : function(a) { + a.setAttribute("oncontextmenu", "return false;") + } + }(), + getSource: function(a) { + return null != a.srcElement ? a.srcElement : a.target + }, + isConsumed: function(a) { + return null != a.isConsumed && a.isConsumed + }, + isLeftMouseButton: function(a) { + return a.button == + (mxClient.IS_IE && ("undefined" === typeof document.documentMode || 9 > document.documentMode) ? 1 : 0) + }, + isRightMouseButton: function(a) { + return 2 == a.button + }, + isPopupTrigger: function(a) { + return mxEvent.isRightMouseButton(a) || mxEvent.isShiftDown(a) && !mxEvent.isControlDown(a) + }, + isShiftDown: function(a) { + return null != a ? a.shiftKey : !1 + }, + isAltDown: function(a) { + return null != a ? a.altKey : !1 + }, + isControlDown: function(a) { + return null != a ? a.ctrlKey : !1 + }, + isMetaDown: function(a) { + return null != a ? a.metaKey : !1 + }, + getMainEvent: function(a) { + ("touchstart" == + a.type || "touchmove" == a.type) && null != a.touches && null != a.touches[0] ? a = a.touches[0] : "touchend" == a.type && (null != a.changedTouches && null != a.changedTouches[0]) && (a = + a.changedTouches[0]); + return a + }, + getClientX: function(a) { + return mxEvent.getMainEvent(a).clientX + }, + getClientY: function(a) { + return mxEvent.getMainEvent(a).clientY + }, + consume: function(a, b, c) { + c = null != c ? c : !0; + if (null != b ? b : 1) a.preventDefault ? (c && a.stopPropagation(), a.preventDefault()) : c && (a.cancelBubble = !0); + a.isConsumed = !0; + a.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(a, b, c, d, e, f) { + this.url = a; + this.params = b; + this.method = c || "POST"; + this.async = null != d ? d : !0; + this.username = e; + this.password = f +} +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(a) { + this.binary = a +}; +mxXmlRequest.prototype.getText = function() { + return this.request.responseText +}; +mxXmlRequest.prototype.isReady = function() { + return 4 == this.request.readyState +}; +mxXmlRequest.prototype.getDocumentElement = function() { + var a = this.getXml(); + return null != a ? a.documentElement : null +}; +mxXmlRequest.prototype.getXml = function() { + var a = this.request.responseXML; + if (9 <= document.documentMode || null == a || null == a.documentElement) a = mxUtils.parseXml(this.request.responseText); + return a +}; +mxXmlRequest.prototype.getText = function() { + return this.request.responseText +}; +mxXmlRequest.prototype.getStatus = function() { + return this.request.status +}; +mxXmlRequest.prototype.create = function() { + if (window.XMLHttpRequest) return function() { + var a = new XMLHttpRequest; + this.isBinary() && a.overrideMimeType && a.overrideMimeType("text/plain; charset\x3dx-user-defined"); + return a + }; + if ("undefined" != typeof ActiveXObject) return function() { + return new ActiveXObject("Microsoft.XMLHTTP") + } +}(); +mxXmlRequest.prototype.send = function(a, b) { + this.request = this.create(); + null != this.request && (null != a && (this.request.onreadystatechange = mxUtils.bind(this, function() { + this.isReady() && (a(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(a, b) { + null != b && a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") +}; +mxXmlRequest.prototype.simulate = function(a, b) { + a = a || document; + var c = null; + a == document && (c = window.onbeforeunload, window.onbeforeunload = null); + var d = a.createElement("form"); + d.setAttribute("method", this.method); + d.setAttribute("action", this.url); + null != b && d.setAttribute("target", b); + d.style.display = "none"; + d.style.visibility = "hidden"; + for (var e = 0 < this.params.indexOf("\x26") ? this.params.split("\x26") : this.params.split(), f = 0; f < e.length; f++) { + var g = e[f].indexOf("\x3d"); + if (0 < g) { + var h = e[f].substring(0, g), + k = e[f].substring(g + + 1), + g = a.createElement("textarea"); + g.setAttribute("name", h); + k = k.replace(/\n/g, "\x26#xa;"); + h = a.createTextNode(k); + g.appendChild(h); + d.appendChild(g) + } + } + a.body.appendChild(d); + d.submit(); + a.body.removeChild(d); + null != c && (window.onbeforeunload = c) +}; +var mxClipboard = { + STEPSIZE: 10, + insertCount: 1, + cells: null, + isEmpty: function() { + return null == mxClipboard.cells + }, + cut: function(a, b) { + b = mxClipboard.copy(a, b); + mxClipboard.insertCount = 0; + mxClipboard.removeCells(a, b); + return b + }, + removeCells: function(a, b) { + a.removeCells(b) + }, + copy: function(a, b) { + b = b || a.getSelectionCells(); + var c = a.getExportableCells(b); + mxClipboard.insertCount = 1; + mxClipboard.cells = a.cloneCells(c); + return c + }, + paste: function(a) { + if (null != mxClipboard.cells) { + var b = a.getImportableCells(mxClipboard.cells), + c = mxClipboard.insertCount * + mxClipboard.STEPSIZE, + d = a.getDefaultParent(), + b = a.importCells(b, c, c, d); + mxClipboard.insertCount++; + a.setSelectionCells(b) + } + } +}; + +function mxWindow(a, b, c, d, e, f, g, h, k, l) { + null != b && (g = null != g ? g : !0, this.content = b, this.init(c, d, e, f, l), this.installMaximizeHandler(), this.installMinimizeHandler(), this.installCloseHandler(), this.setMinimizable(g), + this.setTitle(a), (null == h || h) && this.installMoveHandler(), null != k && null != k.parentNode ? k.parentNode.replaceChild(this.div, k) : document.body.appendChild(this.div)) +} +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(a, b, c, d, e) { + e = null != e ? e : "mxWindow"; + this.div = document.createElement("div"); + this.div.className = e; + this.div.style.left = a + "px"; + this.div.style.top = b + "px"; + this.table = document.createElement("table"); + this.table.className = e; + null != c && (mxClient.IS_IE || (this.div.style.width = c + "px"), this.table.style.width = c + "px"); + null != d && (mxClient.IS_IE || (this.div.style.height = d + "px"), this.table.style.height = d + "px"); + a = document.createElement("tbody"); + b = document.createElement("tr"); + this.title = document.createElement("td"); + this.title.className = e + "Title"; + b.appendChild(this.title); + a.appendChild(b); + b = document.createElement("tr"); + this.td = document.createElement("td"); + this.td.className = e + "Pane"; + this.contentWrapper = document.createElement("div"); + this.contentWrapper.className = e + "Pane"; + this.contentWrapper.style.width = "100%"; + this.contentWrapper.appendChild(this.content); + if (mxClient.IS_IE || "DIV" != this.content.nodeName.toUpperCase()) this.contentWrapper.style.height = "100%"; + this.td.appendChild(this.contentWrapper); + b.appendChild(this.td); + a.appendChild(b); + this.table.appendChild(a); + this.div.appendChild(this.table); + e = mxUtils.bind(this, function(a) { + this.activate() + }); + mxEvent.addListener(this.title, "mousedown", e); + mxEvent.addListener(this.table, "mousedown", e); + mxClient.IS_TOUCH && (mxEvent.addListener(this.title, "touchstart", e), mxEvent.addListener(this.table, "touchstart", e)); + this.hide() +}; +mxWindow.prototype.setTitle = function(a) { + for (var b = this.title.firstChild; null != b;) { + var c = b.nextSibling; + b.nodeType == mxConstants.NODETYPE_TEXT && b.parentNode.removeChild(b); + b = c + } + mxUtils.write(this.title, a || "") +}; +mxWindow.prototype.setScrollable = function(a) { + 0 > navigator.userAgent.indexOf("Presto/2.5") && (this.contentWrapper.style.overflow = a ? "auto" : "hidden") +}; +mxWindow.prototype.activate = function() { + if (mxWindow.activeWindow != this) { + var a = mxUtils.getCurrentStyle(this.getElement()), + a = null != a ? a.zIndex : 3; + if (mxWindow.activeWindow) { + var b = mxWindow.activeWindow.getElement(); + null != b && null != b.style && (b.style.zIndex = a) + } + b = mxWindow.activeWindow; + this.getElement().style.zIndex = parseInt(a) + 1; + mxWindow.activeWindow = this; + this.fireEvent(new mxEventObject(mxEvent.ACTIVATE, "previousWindow", b)) + } +}; +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 : !1 +}; +mxWindow.prototype.setResizable = function(a) { + a ? 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(a) { + this.activate(); + var c = mxEvent.getClientX(a), + d = mxEvent.getClientY(a), + e = this.div.offsetWidth, + f = this.div.offsetHeight, + g = mxUtils.bind(this, + function(a) { + var b = mxEvent.getClientX(a) - c, + g = mxEvent.getClientY(a) - d; + this.setSize(e + b, f + g); + this.fireEvent(new mxEventObject(mxEvent.RESIZE, "event", a)); + mxEvent.consume(a) + }), + h = mxUtils.bind(this, function(a) { + mxEvent.removeGestureListeners(document, null, g, h); + this.fireEvent(new mxEventObject(mxEvent.RESIZE_END, "event", a)); + mxEvent.consume(a) + }); + mxEvent.addGestureListeners(document, null, g, h); + this.fireEvent(new mxEventObject(mxEvent.RESIZE_START, "event", a)); + mxEvent.consume(a) + }), null, null), this.div.appendChild(this.resize)) : + this.resize.style.display = "inline" : null != this.resize && (this.resize.style.display = "none") +}; +mxWindow.prototype.setSize = function(a, b) { + a = Math.max(this.minimumSize.width, a); + b = Math.max(this.minimumSize.height, b); + mxClient.IS_IE || (this.div.style.width = a + "px", this.div.style.height = b + "px"); + this.table.style.width = a + "px"; + this.table.style.height = b + "px"; + mxClient.IS_IE || (this.contentWrapper.style.height = this.div.offsetHeight - this.title.offsetHeight - 2 + "px") +}; +mxWindow.prototype.setMinimizable = function(a) { + this.minimize.style.display = a ? "" : "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 a = !1, + b = null, + c = null, + d = mxUtils.bind(this, function(d) { + this.activate(); + if (a) a = !1, this.minimize.setAttribute("src", + this.minimizeImage), this.minimize.setAttribute("title", "Minimize"), this.contentWrapper.style.display = "", this.maximize.style.display = b, mxClient.IS_IE || (this.div.style.height = + c), this.table.style.height = c, null != this.resize && (this.resize.style.visibility = ""), this.fireEvent(new mxEventObject(mxEvent.NORMALIZE, "event", d)); + else { + a = !0; + this.minimize.setAttribute("src", this.normalizeImage); + this.minimize.setAttribute("title", "Normalize"); + this.contentWrapper.style.display = "none"; + b = this.maximize.style.display; + this.maximize.style.display = "none"; + c = this.table.style.height; + var f = this.getMinimumSize(); + 0 < f.height && (mxClient.IS_IE || (this.div.style.height = f.height + "px"), this.table.style.height = f.height + "px"); + 0 < f.width && (mxClient.IS_IE || (this.div.style.width = f.width + "px"), this.table.style.width = f.width + "px"); + null != this.resize && (this.resize.style.visibility = "hidden"); + this.fireEvent(new mxEventObject(mxEvent.MINIMIZE, "event", d)) + } + mxEvent.consume(d) + }); + mxEvent.addListener(this.minimize, "mousedown", d); + mxClient.IS_TOUCH && + mxEvent.addListener(this.minimize, "touchstart", d) +}; +mxWindow.prototype.setMaximizable = function(a) { + this.maximize.style.display = a ? "" : "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 a = !1, + b = null, + c = null, + d = null, + e = null, + f = mxUtils.bind(this, function(f) { + this.activate(); + if ("none" != this.maximize.style.display) { + if (a) { + a = !1; + this.maximize.setAttribute("src", this.maximizeImage); + this.maximize.setAttribute("title", "Maximize"); + this.contentWrapper.style.display = ""; + this.minimize.style.visibility = ""; + this.div.style.left = b + "px"; + this.div.style.top = c + "px"; + if (!mxClient.IS_IE && (this.div.style.height = d, this.div.style.width = e, h = mxUtils.getCurrentStyle(this.contentWrapper), "auto" == h.overflow || null != this.resize)) this.contentWrapper + .style.height = this.div.offsetHeight - this.title.offsetHeight - + 2 + "px"; + this.table.style.height = d; + this.table.style.width = e; + null != this.resize && (this.resize.style.visibility = ""); + this.fireEvent(new mxEventObject(mxEvent.NORMALIZE, "event", f)) + } else { + a = !0; + this.maximize.setAttribute("src", this.normalizeImage); + this.maximize.setAttribute("title", "Normalize"); + this.contentWrapper.style.display = ""; + this.minimize.style.visibility = "hidden"; + b = parseInt(this.div.style.left); + c = parseInt(this.div.style.top); + d = this.table.style.height; + e = 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"); + if (!mxClient.IS_IE) { + var h = mxUtils.getCurrentStyle(this.contentWrapper); + if ("auto" == h.overflow || null != this.resize) this.contentWrapper.style.height = this.div.offsetHeight - this.title.offsetHeight - + 2 + "px" + } + this.fireEvent(new mxEventObject(mxEvent.MAXIMIZE, "event", f)) + } + mxEvent.consume(f) + } + }); + mxEvent.addGestureListeners(this.maximize, f); + mxEvent.addListener(this.title, "dblclick", f) +}; +mxWindow.prototype.installMoveHandler = function() { + this.title.style.cursor = "move"; + mxEvent.addGestureListeners(this.title, mxUtils.bind(this, function(a) { + var b = mxEvent.getClientX(a), + c = mxEvent.getClientY(a), + d = this.getX(), + e = this.getY(), + f = mxUtils.bind(this, function(a) { + var f = mxEvent.getClientX(a) - b, + g = mxEvent.getClientY(a) - c; + this.setLocation(d + f, e + g); + this.fireEvent(new mxEventObject(mxEvent.MOVE, "event", a)); + mxEvent.consume(a) + }), + g = mxUtils.bind(this, function(a) { + mxEvent.removeGestureListeners(document, null, f, + g); + this.fireEvent(new mxEventObject(mxEvent.MOVE_END, "event", a)); + mxEvent.consume(a) + }); + mxEvent.addGestureListeners(document, null, f, g); + this.fireEvent(new mxEventObject(mxEvent.MOVE_START, "event", a)); + mxEvent.consume(a) + })) +}; +mxWindow.prototype.setLocation = function(a, b) { + this.div.style.left = a + "px"; + this.div.style.top = b + "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(a) { + this.fireEvent(new mxEventObject(mxEvent.CLOSE, + "event", a)); + this.destroyOnClose ? this.destroy() : this.setVisible(!1); + mxEvent.consume(a) + })) +}; +mxWindow.prototype.setImage = function(a) { + this.image = document.createElement("img"); + this.image.setAttribute("src", a); + 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(a) { + this.closeImg.style.display = a ? "" : "none" +}; +mxWindow.prototype.isVisible = function() { + return null != this.div ? "hidden" != this.div.style.visibility : !1 +}; +mxWindow.prototype.setVisible = function(a) { + null != this.div && this.isVisible() != a && (a ? this.show() : this.hide()) +}; +mxWindow.prototype.show = function() { + this.div.style.visibility = ""; + this.activate(); + var a = mxUtils.getCurrentStyle(this.contentWrapper); + if (!mxClient.IS_IE && ("auto" == a.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 +}; + +function mxForm(a) { + this.table = document.createElement("table"); + this.table.className = a; + this.body = document.createElement("tbody"); + this.table.appendChild(this.body) +} +mxForm.prototype.table = null; +mxForm.prototype.body = !1; +mxForm.prototype.getTable = function() { + return this.table +}; +mxForm.prototype.addButtons = function(a, b) { + var c = document.createElement("tr"), + d = document.createElement("td"); + c.appendChild(d); + var d = document.createElement("td"), + e = document.createElement("button"); + mxUtils.write(e, mxResources.get("ok") || "OK"); + d.appendChild(e); + mxEvent.addListener(e, "click", function() { + a() + }); + e = document.createElement("button"); + mxUtils.write(e, mxResources.get("cancel") || "Cancel"); + d.appendChild(e); + mxEvent.addListener(e, "click", function() { + b() + }); + c.appendChild(d); + this.body.appendChild(c) +}; +mxForm.prototype.addText = function(a, b) { + var c = document.createElement("input"); + c.setAttribute("type", "text"); + c.value = b; + return this.addField(a, c) +}; +mxForm.prototype.addCheckbox = function(a, b) { + var c = document.createElement("input"); + c.setAttribute("type", "checkbox"); + this.addField(a, c); + b && (c.checked = !0); + return c +}; +mxForm.prototype.addTextarea = function(a, b, c) { + var d = document.createElement("textarea"); + mxClient.IS_NS && c--; + d.setAttribute("rows", c || 2); + d.value = b; + return this.addField(a, d) +}; +mxForm.prototype.addCombo = function(a, b, c) { + var d = document.createElement("select"); + null != c && d.setAttribute("size", c); + b && d.setAttribute("multiple", "true"); + return this.addField(a, d) +}; +mxForm.prototype.addOption = function(a, b, c, d) { + var e = document.createElement("option"); + mxUtils.writeln(e, b); + e.setAttribute("value", c); + d && e.setAttribute("selected", d); + a.appendChild(e) +}; +mxForm.prototype.addField = function(a, b) { + var c = document.createElement("tr"), + d = document.createElement("td"); + mxUtils.write(d, a); + c.appendChild(d); + d = document.createElement("td"); + d.appendChild(b); + c.appendChild(d); + this.body.appendChild(c); + return b +}; + +function mxImage(a, b, c) { + this.src = a; + this.width = b; + this.height = c +} +mxImage.prototype.src = null; +mxImage.prototype.width = null; +mxImage.prototype.height = null; + +function mxDivResizer(a, b) { + if ("div" == a.nodeName.toLowerCase()) { + null == b && (b = window); + this.div = a; + var c = mxUtils.getCurrentStyle(a); + null != c && (this.resizeWidth = "auto" == c.width, this.resizeHeight = "auto" == c.height); + mxEvent.addListener(b, "resize", mxUtils.bind(this, function(a) { + this.handlingResize || (this.handlingResize = !0, this.resize(), this.handlingResize = !1) + })); + this.resize() + } +} +mxDivResizer.prototype.resizeWidth = !0; +mxDivResizer.prototype.resizeHeight = !0; +mxDivResizer.prototype.handlingResize = !1; +mxDivResizer.prototype.resize = function() { + var a = this.getDocumentWidth(), + b = this.getDocumentHeight(), + c = parseInt(this.div.style.left), + d = parseInt(this.div.style.right), + e = parseInt(this.div.style.top), + f = parseInt(this.div.style.bottom); + this.resizeWidth && (!isNaN(c) && !isNaN(d) && 0 <= c && 0 <= d && 0 < a - d - c) && (this.div.style.width = a - d - c + "px"); + this.resizeHeight && (!isNaN(e) && !isNaN(f) && 0 <= e && 0 <= f && 0 < b - e - f) && (this.div.style.height = b - e - f + "px") +}; +mxDivResizer.prototype.getDocumentWidth = function() { + return document.body.clientWidth +}; +mxDivResizer.prototype.getDocumentHeight = function() { + return document.body.clientHeight +}; + +function mxDragSource(a, b) { + this.element = a; + this.dropHandler = b; + mxEvent.addGestureListeners(a, mxUtils.bind(this, this.mouseDown)) +} +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(a) { + this.enabled = a +}; +mxDragSource.prototype.isGuidesEnabled = function() { + return this.guidesEnabled +}; +mxDragSource.prototype.setGuidesEnabled = function(a) { + this.guidesEnabled = a +}; +mxDragSource.prototype.isGridEnabled = function() { + return this.gridEnabled +}; +mxDragSource.prototype.setGridEnabled = function(a) { + this.gridEnabled = a +}; +mxDragSource.prototype.getGraphForEvent = function(a) { + return null +}; +mxDragSource.prototype.getDropTarget = function(a, b, c) { + return a.getCellAt(b, c) +}; +mxDragSource.prototype.createDragElement = function(a) { + return this.element.cloneNode(!0) +}; +mxDragSource.prototype.createPreviewElement = function(a) { + return null +}; +mxDragSource.prototype.mouseDown = function(a) { + this.enabled && (!mxEvent.isConsumed(a) && null == this.mouseMoveHandler) && (this.startDrag(a), this.mouseMoveHandler = mxUtils.bind(this, this.mouseMove), this.mouseUpHandler = mxUtils.bind( + this, this.mouseUp), mxEvent.addGestureListeners(document, null, this.mouseMoveHandler, this.mouseUpHandler), mxEvent.consume(a, !0, !1)) +}; +mxDragSource.prototype.startDrag = function(a) { + this.dragElement = this.createDragElement(a); + this.dragElement.style.position = "absolute"; + this.dragElement.style.zIndex = this.dragElementZIndex; + mxUtils.setOpacity(this.dragElement, this.dragElementOpacity) +}; +mxDragSource.prototype.stopDrag = function(a) { + null != this.dragElement && (null != this.dragElement.parentNode && this.dragElement.parentNode.removeChild(this.dragElement), this.dragElement = null) +}; +mxDragSource.prototype.graphContainsEvent = function(a, b) { + var c = mxEvent.getClientX(b), + d = mxEvent.getClientY(b), + e = mxUtils.getOffset(a.container), + f = mxUtils.getScrollOrigin(); + return c >= e.x - f.x && d >= e.y - f.y && c <= e.x - f.x + a.container.offsetWidth && d <= e.y - f.y + a.container.offsetHeight +}; +mxDragSource.prototype.mouseMove = function(a) { + var b = this.getGraphForEvent(a); + null != b && !this.graphContainsEvent(b, a) && (b = null); + b != this.currentGraph && (null != this.currentGraph && this.dragExit(this.currentGraph), this.currentGraph = b, null != this.currentGraph && this.dragEnter(this.currentGraph)); + null != this.currentGraph && this.dragOver(this.currentGraph, a); + if (null != this.dragElement && (null == this.previewElement || "visible" != this.previewElement.style.visibility)) { + var b = mxEvent.getClientX(a), + c = mxEvent.getClientY(a); + null == this.dragElement.parentNode && document.body.appendChild(this.dragElement); + this.dragElement.style.visibility = "visible"; + null != this.dragOffset && (b += this.dragOffset.x, c += this.dragOffset.y); + b += document.body.scrollLeft || document.documentElement.scrollLeft; + c += document.body.scrollTop || document.documentElement.scrollTop; + this.dragElement.style.left = b + "px"; + this.dragElement.style.top = c + "px" + } else null != this.dragElement && (this.dragElement.style.visibility = "hidden"); + mxEvent.consume(a) +}; +mxDragSource.prototype.mouseUp = function(a) { + if (null != this.currentGraph) { + if (null != this.currentPoint && (null == this.previewElement || "hidden" != this.previewElement.style.visibility)) { + var b = this.currentGraph.view.scale, + c = this.currentGraph.view.translate; + this.drop(this.currentGraph, a, this.currentDropTarget, this.currentPoint.x / b - c.x, this.currentPoint.y / b - c.y) + } + this.dragExit(this.currentGraph) + } + this.stopDrag(a); + mxEvent.removeGestureListeners(document, null, this.mouseMoveHandler, this.mouseUpHandler); + this.currentGraph = + this.mouseUpHandler = this.mouseMoveHandler = null; + mxEvent.consume(a) +}; +mxDragSource.prototype.dragEnter = function(a) { + a.isMouseDown = !0; + this.previewElement = this.createPreviewElement(a); + this.isGuidesEnabled() && null != this.previewElement && (this.currentGuide = new mxGuide(a, a.graphHandler.getGuideStates())); + this.highlightDropTargets && (this.currentHighlight = new mxCellHighlight(a, mxConstants.DROP_TARGET_COLOR)) +}; +mxDragSource.prototype.dragExit = function(a) { + this.currentPoint = this.currentDropTarget = null; + a.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(a, b) { + var c = mxUtils.getOffset(a.container), + d = mxUtils.getScrollOrigin(a.container), + e = mxEvent.getClientX(b) - c.x + d.x, + c = mxEvent.getClientY(b) - c.y + d.y; + a.autoScroll && (null == this.autoscroll || this.autoscroll) && a.scrollPointToVisible(e, c, a.autoExtend); + null != this.currentHighlight && a.isDropEnabled() && (this.currentDropTarget = this.getDropTarget(a, e, c), d = a.getView().getState(this.currentDropTarget), this.currentHighlight.highlight(d)); + if (null != this.previewElement) { + null == this.previewElement.parentNode && + (a.container.appendChild(this.previewElement), this.previewElement.style.zIndex = "3", this.previewElement.style.position = "absolute"); + var d = this.isGridEnabled() && a.isGridEnabledEvent(b), + f = !0; + if (null != this.currentGuide && this.currentGuide.isEnabledForEvent(b)) var f = parseInt(this.previewElement.style.width), + g = parseInt(this.previewElement.style.height), + f = new mxRectangle(0, 0, f, g), + c = new mxPoint(e, c), + c = this.currentGuide.move(f, c, d), + f = !1, + e = c.x, + c = c.y; + else if (d) var d = a.view.scale, + g = a.view.translate, + h = a.gridSize / + 2, + e = (a.snap(e / d - g.x - h) + g.x) * d, + c = (a.snap(c / d - g.y - h) + g.y) * d; + null != this.currentGuide && f && this.currentGuide.hide(); + null != this.previewOffset && (e += this.previewOffset.x, c += this.previewOffset.y); + this.previewElement.style.left = Math.round(e) + "px"; + this.previewElement.style.top = Math.round(c) + "px"; + this.previewElement.style.visibility = "visible" + } + this.currentPoint = new mxPoint(e, c) +}; +mxDragSource.prototype.drop = function(a, b, c, d, e) { + this.dropHandler(a, b, c, d, e); + a.container.focus() +}; + +function mxToolbar(a) { + this.container = a +} +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(a, b, c, d, e, f) { + var g = document.createElement(null != b ? "img" : "button"), + h = e || (null != f ? "mxToolbarMode" : "mxToolbarItem"); + g.className = h; + g.setAttribute("src", b); + null != a && (null != b ? g.setAttribute("title", a) : mxUtils.write(g, a)); + this.container.appendChild(g); + null != c && (mxEvent.addListener(g, "click", c), mxClient.IS_TOUCH && mxEvent.addListener(g, "touchend", c)); + a = mxUtils.bind(this, function(a) { + null != d ? g.setAttribute("src", b) : g.style.backgroundColor = "" + }); + mxEvent.addGestureListeners(g, + mxUtils.bind(this, function(a) { + null != d ? g.setAttribute("src", d) : g.style.backgroundColor = "gray"; + if (null != f) { + null == this.menu && (this.menu = new mxPopupMenu, this.menu.init()); + var b = this.currentImg; + this.menu.isMenuShowing() && this.menu.hideMenu(); + b != g && (this.currentImg = g, this.menu.factoryMethod = f, b = new mxPoint(g.offsetLeft, g.offsetTop + g.offsetHeight), this.menu.popup(b.x, b.y, null, a), this.menu.isMenuShowing() && + (g.className = h + "Selected", this.menu.hideMenu = function() { + mxPopupMenu.prototype.hideMenu.apply(this); + g.className = h; + this.currentImg = null + })) + } + }), null, a); + mxEvent.addListener(g, "mouseout", a); + return g +}; +mxToolbar.prototype.addCombo = function(a) { + var b = document.createElement("div"); + b.style.display = "inline"; + b.className = "mxToolbarComboContainer"; + var c = document.createElement("select"); + c.className = a || "mxToolbarCombo"; + b.appendChild(c); + this.container.appendChild(b); + return c +}; +mxToolbar.prototype.addActionCombo = function(a, b) { + var c = document.createElement("select"); + c.className = b || "mxToolbarCombo"; + this.addOption(c, a, null); + mxEvent.addListener(c, "change", function(a) { + var b = c.options[c.selectedIndex]; + c.selectedIndex = 0; + null != b.funct && b.funct(a) + }); + this.container.appendChild(c); + return c +}; +mxToolbar.prototype.addOption = function(a, b, c) { + var d = document.createElement("option"); + mxUtils.writeln(d, b); + "function" == typeof c ? d.funct = c : d.setAttribute("value", c); + a.appendChild(d); + return d +}; +mxToolbar.prototype.addSwitchMode = function(a, b, c, d, e) { + var f = document.createElement("img"); + f.initialClassName = e || "mxToolbarMode"; + f.className = f.initialClassName; + f.setAttribute("src", b); + f.altIcon = d; + null != a && f.setAttribute("title", a); + mxEvent.addListener(f, "click", mxUtils.bind(this, function(a) { + a = this.selectedMode.altIcon; + null != a ? (this.selectedMode.altIcon = this.selectedMode.getAttribute("src"), this.selectedMode.setAttribute("src", a)) : this.selectedMode.className = this.selectedMode.initialClassName; + this.updateDefaultMode && + (this.defaultMode = f); + this.selectedMode = f; + a = f.altIcon; + null != a ? (f.altIcon = f.getAttribute("src"), f.setAttribute("src", a)) : f.className = f.initialClassName + "Selected"; + this.fireEvent(new mxEventObject(mxEvent.SELECT)); + c() + })); + this.container.appendChild(f); + null == this.defaultMode && (this.defaultMode = f, this.selectMode(f), c()); + return f +}; +mxToolbar.prototype.addMode = function(a, b, c, d, e, f) { + f = null != f ? f : !0; + var g = document.createElement(null != b ? "img" : "button"); + g.initialClassName = e || "mxToolbarMode"; + g.className = g.initialClassName; + g.setAttribute("src", b); + g.altIcon = d; + null != a && g.setAttribute("title", a); + this.enabled && f && (mxEvent.addListener(g, "click", mxUtils.bind(this, function(a) { + this.selectMode(g, c); + this.noReset = !1 + })), mxEvent.addListener(g, "dblclick", mxUtils.bind(this, function(a) { + this.selectMode(g, c); + this.noReset = !0 + })), null == this.defaultMode && + (this.defaultMode = g, this.defaultFunction = c, this.selectMode(g, c))); + this.container.appendChild(g); + return g +}; +mxToolbar.prototype.selectMode = function(a, b) { + if (this.selectedMode != a) { + if (null != this.selectedMode) { + var c = this.selectedMode.altIcon; + null != c ? (this.selectedMode.altIcon = this.selectedMode.getAttribute("src"), this.selectedMode.setAttribute("src", c)) : this.selectedMode.className = this.selectedMode.initialClassName + } + this.selectedMode = a; + c = this.selectedMode.altIcon; + null != c ? (this.selectedMode.altIcon = this.selectedMode.getAttribute("src"), this.selectedMode.setAttribute("src", c)) : this.selectedMode.className = this.selectedMode.initialClassName + + "Selected"; + this.fireEvent(new mxEventObject(mxEvent.SELECT, "function", b)) + } +}; +mxToolbar.prototype.resetMode = function(a) { + (a || !this.noReset) && this.selectedMode != this.defaultMode && this.selectMode(this.defaultMode, this.defaultFunction) +}; +mxToolbar.prototype.addSeparator = function(a) { + return this.addItem(null, a, null) +}; +mxToolbar.prototype.addBreak = function() { + mxUtils.br(this.container) +}; +mxToolbar.prototype.addLine = function() { + var a = document.createElement("hr"); + a.style.marginRight = "6px"; + a.setAttribute("size", "1"); + this.container.appendChild(a) +}; +mxToolbar.prototype.destroy = function() { + mxEvent.release(this.container); + this.selectedMode = this.defaultFunction = this.defaultMode = this.container = null; + null != this.menu && this.menu.destroy() +}; + +function mxSession(a, b, c, d) { + this.model = a; + this.urlInit = b; + this.urlPoll = c; + this.urlNotify = d; + null != a && (this.codec = new mxCodec, this.codec.lookup = function(b) { + return a.getCell(b) + }); + a.addListener(mxEvent.NOTIFY, mxUtils.bind(this, function(a, b) { + var c = b.getProperty("edit"); + (null != c && this.debug || this.connected && !this.suspended) && this.notify("\x3cedit\x3e" + this.encodeChanges(c.changes, c.undone) + "\x3c/edit\x3e") + })) +} +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 = "\x26#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(a) { + 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(a, b, c) { + this.connected && this.suspended && (this.suspended = !1, this.fireEvent(new mxEventObject(mxEvent.RESUME)), this.polling || this.poll()) +}; +mxSession.prototype.stop = function(a) { + this.connected && (this.connected = !1); + this.fireEvent(new mxEventObject(mxEvent.DISCONNECT, "reason", a)) +}; +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(a, b, c) { + null != a && 0 < a.length && (null != this.urlNotify && (this.debug ? (mxLog.show(), mxLog.debug("mxSession.notify: " + this.urlNotify + " xml\x3d" + a)) : (a = "\x3cmessage\x3e\x3cdelta\x3e" + a + + "\x3c/delta\x3e\x3c/message\x3e", this.escapePostData && (a = encodeURIComponent(a)), mxUtils.post(this.urlNotify, "xml\x3d" + a, b, c))), this.sent += a.length, this.fireEvent(new mxEventObject( + mxEvent.NOTIFY, "url", this.urlNotify, "xml", a))) +}; +mxSession.prototype.get = function(a, b, c) { + if ("undefined" != typeof mxUtils) { + var d = mxUtils.bind(this, function(a) { + null != c ? c(a) : this.stop(a) + }); + mxUtils.get(a, mxUtils.bind(this, function(c) { + if ("undefined" != typeof mxUtils) + if (c.isReady() && 404 != c.getStatus()) { + if (this.received += c.getText().length, this.fireEvent(new mxEventObject(mxEvent.GET, "url", a, "request", c)), this.isValidResponse(c)) { + if (0 < c.getText().length) { + var f = c.getDocumentElement(); + null == f ? d("Invalid response: " + c.getText()) : this.receive(f) + } + null != b && b(c) + } + } else d("Response not ready") + }), + function(a) { + d("Transmission error") + }) + } +}; +mxSession.prototype.isValidResponse = function(a) { + return 0 > a.getText().indexOf("\x3c?php") +}; +mxSession.prototype.encodeChanges = function(a, b) { + for (var c = "", d = b ? -1 : 1, e = b ? a.length - 1 : 0; 0 <= e && e < a.length; e += d) var f = this.codec.encode(a[e]), + c = c + mxUtils.getXml(f, this.linefeed); + return c +}; +mxSession.prototype.receive = function(a) { + if (null != a && a.nodeType == mxConstants.NODETYPE_ELEMENT) { + var b = a.getAttribute("namespace"); + null != b && (this.model.prefix = b + "-"); + for (b = a.firstChild; null != b;) { + var c = b.nodeName.toLowerCase(); + "state" == c ? this.processState(b) : "delta" == c && this.processDelta(b); + b = b.nextSibling + } + this.fireEvent(new mxEventObject(mxEvent.RECEIVE, "node", a)) + } +}; +mxSession.prototype.processState = function(a) { + (new mxCodec(a.ownerDocument)).decode(a.firstChild, this.model) +}; +mxSession.prototype.processDelta = function(a) { + for (a = a.firstChild; null != a;) "edit" == a.nodeName && this.processEdit(a), a = a.nextSibling +}; +mxSession.prototype.processEdit = function(a) { + a = this.decodeChanges(a); + if (0 < a.length) { + var b = this.createUndoableEdit(a); + this.model.fireEvent(new mxEventObject(mxEvent.CHANGE, "edit", b, "changes", a)); + this.model.fireEvent(new mxEventObject(mxEvent.UNDO, "edit", b)); + this.fireEvent(new mxEventObject(mxEvent.FIRED, "edit", b)) + } +}; +mxSession.prototype.createUndoableEdit = function(a) { + var b = new mxUndoableEdit(this.model, this.significantRemoteChanges); + b.changes = a; + b.notify = function() { + b.source.fireEvent(new mxEventObject(mxEvent.CHANGE, "edit", b, "changes", b.changes)); + b.source.fireEvent(new mxEventObject(mxEvent.NOTIFY, "edit", b, "changes", b.changes)) + }; + return b +}; +mxSession.prototype.decodeChanges = function(a) { + this.codec.document = a.ownerDocument; + var b = []; + for (a = a.firstChild; null != a;) { + var c = this.decodeChange(a); + null != c && b.push(c); + a = a.nextSibling + } + return b +}; +mxSession.prototype.decodeChange = function(a) { + var b = null; + a.nodeType == mxConstants.NODETYPE_ELEMENT && (b = "mxRootChange" == a.nodeName ? (new mxCodec(a.ownerDocument)).decode(a) : this.codec.decode(a), null != b && (b.model = this.model, b.execute(), + "mxChildChange" == a.nodeName && null == b.parent && this.cellRemoved(b.child))); + return b +}; +mxSession.prototype.cellRemoved = function(a, b) { + this.codec.putObject(a.getId(), a); + for (var c = this.model.getChildCount(a), d = 0; d < c; d++) this.cellRemoved(this.model.getChildAt(a, d)) +}; + +function mxUndoableEdit(a, b) { + this.source = a; + this.changes = []; + this.significant = null != b ? b : !0 +} +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(a) { + this.changes.push(a) +}; +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 a = this.changes.length - 1; 0 <= a; a--) { + var b = this.changes[a]; + null != b.execute ? b.execute() : null != b.undo && b.undo(); + this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED, "change", b)) + } + 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 a = this.changes.length, b = 0; b < a; b++) { + var c = this.changes[b]; + null != c.execute ? c.execute() : null != c.redo && c.redo(); + this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED, "change", c)) + } + this.undone = !1; + this.redone = !0; + this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT)) + } + this.notify() +}; + +function mxUndoManager(a) { + this.size = null != a ? a : 100; + this.clear() +} +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 a = this.history[--this.indexOfNextAdd]; + a.undo(); + if (a.isSignificant()) { + this.fireEvent(new mxEventObject(mxEvent.UNDO, "edit", a)); + break + } + } +}; +mxUndoManager.prototype.canRedo = function() { + return this.indexOfNextAdd < this.history.length +}; +mxUndoManager.prototype.redo = function() { + for (var a = this.history.length; this.indexOfNextAdd < a;) { + var b = this.history[this.indexOfNextAdd++]; + b.redo(); + if (b.isSignificant()) { + this.fireEvent(new mxEventObject(mxEvent.REDO, "edit", b)); + break + } + } +}; +mxUndoManager.prototype.undoableEditHappened = function(a) { + this.trim(); + 0 < this.size && this.size == this.history.length && this.history.shift(); + this.history.push(a); + this.indexOfNextAdd = this.history.length; + this.fireEvent(new mxEventObject(mxEvent.ADD, "edit", a)) +}; +mxUndoManager.prototype.trim = function() { + if (this.history.length > this.indexOfNextAdd) + for (var a = this.history.splice(this.indexOfNextAdd, this.history.length - this.indexOfNextAdd), b = 0; b < a.length; b++) a[b].die() +}; +var mxUrlConverter = function(a) { + var b = !0, + c = null, + d = null; + return { + isEnabled: function() { + return b + }, + setEnabled: function(a) { + b = a + }, + getBaseUrl: function() { + return c + }, + setBaseUrl: function(a) { + c = a + }, + getBaseDomain: function() { + return c + }, + setBaseDomain: function(a) { + c = a + }, + isRelativeUrl: function(a) { + return "http://" != a.substring(0, 7) && "https://" != a.substring(0, 8) && "data:image" != a.substring(0, 10) + }, + convert: function(a) { + if (b && this.isRelativeUrl(a)) { + if (null == c) { + d = location.protocol + "//" + location.host; + c = d + location.pathname; + var f = c.lastIndexOf("/"); + 0 < f && (c = c.substring(0, f + 1)) + } + a = "/" == a.charAt(0) ? d + a : c + a + } + return a + } + } +}; + +function mxPanningManager(a) { + 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(a, b) {}, + mouseMove: function(a, b) {}, + mouseUp: mxUtils.bind(this, function(a, b) { + this.active && this.stop() + }) + }; + a.addMouseListener(this.mouseListener); + mxEvent.addListener(document, "mouseup", mxUtils.bind(this, function() { + this.active && this.stop() + })); + var b = mxUtils.bind(this, function() { + this.scrollbars = mxUtils.hasScrollbars(a.container); + this.scrollLeft = a.container.scrollLeft; + this.scrollTop = a.container.scrollTop; + return window.setInterval(mxUtils.bind(this, function() { + this.tdx -= this.dx; + this.tdy -= this.dy; + if (this.scrollbars) { + var b = -a.container.scrollLeft - Math.ceil(this.dx), + d = -a.container.scrollTop - Math.ceil(this.dy); + a.panGraph(b, d); + a.panDx = this.scrollLeft - a.container.scrollLeft; + a.panDy = this.scrollTop - a.container.scrollTop; + a.fireEvent(new mxEventObject(mxEvent.PAN)) + } else a.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 = a.view.translate.x; + this.t0y = a.view.translate.y; + this.active = !0 + }; + this.panTo = function(c, d, e, f) { + this.active || this.start(); + this.scrollLeft = a.container.scrollLeft; + this.scrollTop = a.container.scrollTop; + f = null != f ? f : 0; + var g = a.container; + this.dx = c + (null != e ? e : 0) - g.scrollLeft - g.clientWidth; + 0 > this.dx && 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 = c - g.scrollLeft, this.dx = 0 < this.dx && this.dx < this.border ? this.dx - this.border : this.handleMouseOut ? Math.min(0, this.dx) : 0); + this.dy = d + f - g.scrollTop - g.clientHeight; + 0 > this.dy && 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 = d - g.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 = b())) : 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) a.panDx = 0, a.panDy = 0, a.fireEvent(new mxEventObject( + mxEvent.PAN)); + else { + var b = a.panDx, + d = a.panDy; + if (0 != b || 0 != d) a.panGraph(0, 0), a.view.setTranslate(this.t0x + b / a.view.scale, this.t0y + d / a.view.scale) + } + }; + this.destroy = function() { + a.removeMouseListener(this.mouseListener) + } +} +mxPanningManager.prototype.damper = 1 / 6; +mxPanningManager.prototype.delay = 10; +mxPanningManager.prototype.handleMouseOut = !0; +mxPanningManager.prototype.border = 0; + +function mxPopupMenu(a) { + this.factoryMethod = a; + null != a && this.init() +} +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(a) { + this.enabled = a +}; +mxPopupMenu.prototype.isPopupTrigger = function(a) { + return a.isPopupTrigger() || this.useLeftButtonForPopup && mxEvent.isLeftMouseButton(a.getEvent()) +}; +mxPopupMenu.prototype.addItem = function(a, b, c, d, e, f) { + d = d || this; + this.itemCount++; + d.willAddSeparator && (d.containsItems && this.addSeparator(d, !0), d.willAddSeparator = !1); + d.containsItems = !0; + var g = document.createElement("tr"); + g.className = "mxPopupMenuItem"; + var h = document.createElement("td"); + h.className = "mxPopupMenuIcon"; + null != b ? (e = document.createElement("img"), e.src = b, h.appendChild(e)) : null != e && (b = document.createElement("div"), b.className = e, h.appendChild(b)); + g.appendChild(h); + this.labels && (h = document.createElement("td"), + h.className = "mxPopupMenuItem" + (null != f && !f ? " disabled" : ""), mxUtils.write(h, a), h.align = "left", g.appendChild(h), a = document.createElement("td"), a.className = + "mxPopupMenuItem" + (null != f && !f ? " disabled" : ""), a.style.paddingRight = "6px", a.style.textAlign = "right", g.appendChild(a), null == d.div && this.createSubmenu(d)); + d.tbody.appendChild(g); + if (null == f || f) mxEvent.addGestureListeners(g, mxUtils.bind(this, function(a) { + this.eventReceiver = g; + d.activeRow != g && d.activeRow != d && (null != d.activeRow && null != d.activeRow.div.parentNode && + this.hideSubmenu(d), null != g.div && (this.showSubmenu(d, g), d.activeRow = g)); + mxEvent.consume(a) + }), mxUtils.bind(this, function(a) { + d.activeRow != g && d.activeRow != d && (null != d.activeRow && null != d.activeRow.div.parentNode && this.hideSubmenu(d), this.autoExpand && null != g.div && (this.showSubmenu(d, g), d.activeRow = + g)); + g.className = "mxPopupMenuItemHover" + }), mxUtils.bind(this, function(a) { + this.eventReceiver == g && (d.activeRow != g && this.hideMenu(), null != c && c(a)); + this.eventReceiver = null; + mxEvent.consume(a) + })), mxEvent.addListener(g, + "mouseout", mxUtils.bind(this, function(a) { + g.className = "mxPopupMenuItem" + })); + return g +}; +mxPopupMenu.prototype.createSubmenu = function(a) { + a.table = document.createElement("table"); + a.table.className = "mxPopupMenu"; + a.tbody = document.createElement("tbody"); + a.table.appendChild(a.tbody); + a.div = document.createElement("div"); + a.div.className = "mxPopupMenu"; + a.div.style.position = "absolute"; + a.div.style.display = "inline"; + a.div.style.zIndex = this.zIndex; + a.div.appendChild(a.table); + var b = document.createElement("img"); + b.setAttribute("src", this.submenuImage); + td = a.firstChild.nextSibling.nextSibling; + td.appendChild(b) +}; +mxPopupMenu.prototype.showSubmenu = function(a, b) { + if (null != b.div) { + b.div.style.left = a.div.offsetLeft + b.offsetLeft + b.offsetWidth - 1 + "px"; + b.div.style.top = a.div.offsetTop + b.offsetTop + "px"; + document.body.appendChild(b.div); + var c = parseInt(b.div.offsetLeft), + d = parseInt(b.div.offsetWidth), + e = document.body, + f = document.documentElement; + if (c + d > (e.scrollLeft || f.scrollLeft) + (e.clientWidth || f.clientWidth)) b.div.style.left = a.div.offsetLeft - d + (mxClient.IS_IE ? 6 : -6) + "px"; + mxUtils.fit(b.div) + } +}; +mxPopupMenu.prototype.addSeparator = function(a, b) { + a = a || this; + if (this.smartSeparators && !b) a.willAddSeparator = !0; + else if (null != a.tbody) { + a.willAddSeparator = !1; + var c = document.createElement("tr"), + d = document.createElement("td"); + d.className = "mxPopupMenuIcon"; + d.style.padding = "0 0 0 0px"; + c.appendChild(d); + d = document.createElement("td"); + d.style.padding = "0 0 0 0px"; + d.setAttribute("colSpan", "2"); + var e = document.createElement("hr"); + e.setAttribute("size", "1"); + d.appendChild(e); + c.appendChild(d); + a.tbody.appendChild(c) + } +}; +mxPopupMenu.prototype.popup = function(a, b, c, d) { + if (null != this.div && null != this.tbody && null != this.factoryMethod) { + this.div.style.left = a + "px"; + for (this.div.style.top = b + "px"; null != this.tbody.firstChild;) mxEvent.release(this.tbody.firstChild), this.tbody.removeChild(this.tbody.firstChild); + this.itemCount = 0; + this.factoryMethod(this, c, d); + 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(a) { + null != a.activeRow && (this.hideSubmenu(a.activeRow), null != a.activeRow.div.parentNode && a.activeRow.div.parentNode.removeChild(a.activeRow.div), a.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) +}; + +function mxAutoSaveManager(a) { + this.changeHandler = mxUtils.bind(this, function(a, c) { + this.isEnabled() && this.graphModelChanged(c.getProperty("edit").changes) + }); + this.setGraph(a) +} +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(a) { + this.enabled = a +}; +mxAutoSaveManager.prototype.setGraph = function(a) { + null != this.graph && this.graph.getModel().removeListener(this.changeHandler); + this.graph = a; + null != this.graph && this.graph.getModel().addListener(mxEvent.CHANGE, this.changeHandler) +}; +mxAutoSaveManager.prototype.save = function() {}; +mxAutoSaveManager.prototype.graphModelChanged = function(a) { + a = ((new Date).getTime() - this.lastSnapshot) / 1E3; + a > this.autoSaveDelay || this.ignoredChanges >= this.autoSaveThreshold && a > 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) +}; + +function mxAnimation(a) { + this.delay = null != a ? a : 20 +} +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))) +}; + +function mxMorphing(a, b, c, d) { + mxAnimation.call(this, d); + this.graph = a; + this.steps = null != b ? b : 6; + this.ease = null != c ? c : 1.5 +} +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 a = new mxCellStatePreview(this.graph); + if (null != this.cells) + for (var b = 0; b < this.cells.length; b++) this.animateCell(cells[b], a, !1); + else this.animateCell(this.graph.getModel().getRoot(), a, !0); + this.show(a); + (a.isEmpty() || this.step++ >= this.steps) && this.stopAnimation() +}; +mxMorphing.prototype.show = function(a) { + a.show() +}; +mxMorphing.prototype.animateCell = function(a, b, c) { + var d = this.graph.getView().getState(a), + e = null; + if (null != d && (e = this.getDelta(d), this.graph.getModel().isVertex(a) && (0 != e.x || 0 != e.y))) { + var f = this.graph.view.getTranslate(), + g = this.graph.view.getScale(); + e.x += f.x * g; + e.y += f.y * g; + b.moveState(d, -e.x / this.ease, -e.y / this.ease) + } + if (c && !this.stopRecursion(d, e)) { + d = this.graph.getModel().getChildCount(a); + for (e = 0; e < d; e++) this.animateCell(this.graph.getModel().getChildAt(a, e), b, c) + } +}; +mxMorphing.prototype.stopRecursion = function(a, b) { + return null != b && (0 != b.x || 0 != b.y) +}; +mxMorphing.prototype.getDelta = function(a) { + var b = this.getOriginForCell(a.cell), + c = this.graph.getView().getTranslate(), + d = this.graph.getView().getScale(); + a = new mxPoint(a.x / d - c.x, a.y / d - c.y); + return new mxPoint((b.x - a.x) * d, (b.y - a.y) * d) +}; +mxMorphing.prototype.getOriginForCell = function(a) { + var b = null; + null != a && (b = this.getOriginForCell(this.graph.getModel().getParent(a)), a = this.graph.getCellGeometry(a), null != a && (b.x += a.x, b.y += a.y)); + null == b && (b = this.graph.view.getTranslate(), b = new mxPoint(-b.x, -b.y)); + return b +}; + +function mxImageBundle(a) { + this.images = []; + this.alt = null != a ? a : !1 +} +mxImageBundle.prototype.images = null; +mxImageBundle.prototype.images = null; +mxImageBundle.prototype.putImage = function(a, b, c) { + this.images[a] = { + value: b, + fallback: c + } +}; +mxImageBundle.prototype.getImage = function(a) { + var b = null; + null != a && (a = this.images[a], null != a && (b = this.alt ? a.fallback : a.value)); + return b +}; + +function mxImageExport() {} +mxImageExport.prototype.includeOverlays = !1; +mxImageExport.prototype.drawState = function(a, b) { + null != a && (this.visitStatesRecursive(a, b, this.drawCellState), this.includeOverlays && this.visitStatesRecursive(a, b, this.drawOverlays)) +}; +mxImageExport.prototype.visitStatesRecursive = function(a, b, c) { + if (null != a) { + c(a, b); + for (var d = a.view.graph, e = d.model.getChildCount(a.cell), f = 0; f < e; f++) { + var g = d.view.getState(d.model.getChildAt(a.cell, f)); + this.visitStatesRecursive(g, b, c) + } + } +}; +mxImageExport.prototype.drawCellState = function(a, b) { + a.shape instanceof mxShape && (b.save(), a.shape.paint(b), b.restore()); + null != a.text && (b.save(), a.text.paint(b), b.restore()) +}; +mxImageExport.prototype.drawOverlays = function(a, b) { + null != a.overlays && a.overlays.visit(function(a, d) { + d instanceof mxShape && d.paint(b) + }) +}; + +function mxAbstractCanvas2D() { + this.converter = this.createUrlConverter(); + this.reset() +} +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(a) { + return Math.round(parseFloat(a)) +}; +mxAbstractCanvas2D.prototype.addOp = function() { + if (null != this.path && (this.path.push(arguments[0]), 2 < arguments.length)) + for (var a = this.state, b = 2; b < arguments.length; b += 2) this.lastX = arguments[b - 1], this.lastY = arguments[b], this.path.push(this.format((this.lastX + a.dx) * a.scale)), this.path.push( + this.format((this.lastY + a.dy) * a.scale)) +}; +mxAbstractCanvas2D.prototype.rotatePoint = function(a, b, c, d, e) { + c *= Math.PI / 180; + return mxUtils.getRotatedPoint(new mxPoint(a, b), Math.cos(c), Math.sin(c), new mxPoint(d, e)) +}; +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(a) { + this.state.scale *= a; + this.state.strokeWidth *= a +}; +mxAbstractCanvas2D.prototype.translate = function(a, b) { + this.state.dx += a; + this.state.dy += b +}; +mxAbstractCanvas2D.prototype.setAlpha = function(a) { + this.state.alpha = a +}; +mxAbstractCanvas2D.prototype.setFillColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.fillColor = a; + this.state.gradientColor = null +}; +mxAbstractCanvas2D.prototype.setGradient = function(a, b, c, d, e, f, g, h, k) { + c = this.state; + c.fillColor = a; + c.fillAlpha = null != h ? h : 1; + c.gradientColor = b; + c.gradientAlpha = null != k ? k : 1; + c.gradientDirection = g +}; +mxAbstractCanvas2D.prototype.setStrokeColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.strokeColor = a +}; +mxAbstractCanvas2D.prototype.setStrokeWidth = function(a) { + this.state.strokeWidth = a +}; +mxAbstractCanvas2D.prototype.setDashed = function(a) { + this.state.dashed = a +}; +mxAbstractCanvas2D.prototype.setDashPattern = function(a) { + this.state.dashPattern = a +}; +mxAbstractCanvas2D.prototype.setLineCap = function(a) { + this.state.lineCap = a +}; +mxAbstractCanvas2D.prototype.setLineJoin = function(a) { + this.state.lineJoin = a +}; +mxAbstractCanvas2D.prototype.setMiterLimit = function(a) { + this.state.miterLimit = a +}; +mxAbstractCanvas2D.prototype.setFontColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.fontColor = a +}; +mxAbstractCanvas2D.prototype.setFontBackgroundColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.fontBackgroundColor = a +}; +mxAbstractCanvas2D.prototype.setFontBorderColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.fontBorderColor = a +}; +mxAbstractCanvas2D.prototype.setFontSize = function(a) { + this.state.fontSize = a +}; +mxAbstractCanvas2D.prototype.setFontFamily = function(a) { + this.state.fontFamily = a +}; +mxAbstractCanvas2D.prototype.setFontStyle = function(a) { + null == a && (a = 0); + this.state.fontStyle = a +}; +mxAbstractCanvas2D.prototype.setShadow = function(a) { + this.state.shadow = a +}; +mxAbstractCanvas2D.prototype.setShadowColor = function(a) { + a == mxConstants.NONE && (a = null); + this.state.shadowColor = a +}; +mxAbstractCanvas2D.prototype.setShadowAlpha = function(a) { + this.state.shadowAlpha = a +}; +mxAbstractCanvas2D.prototype.setShadowOffset = function(a, b) { + this.state.shadowDx = a; + this.state.shadowDy = b +}; +mxAbstractCanvas2D.prototype.begin = function() { + this.lastY = this.lastX = 0; + this.path = [] +}; +mxAbstractCanvas2D.prototype.moveTo = function(a, b) { + this.addOp(this.moveOp, a, b) +}; +mxAbstractCanvas2D.prototype.lineTo = function(a, b) { + this.addOp(this.lineOp, a, b) +}; +mxAbstractCanvas2D.prototype.quadTo = function(a, b, c, d) { + this.addOp(this.quadOp, a, b, c, d) +}; +mxAbstractCanvas2D.prototype.curveTo = function(a, b, c, d, e, f) { + this.addOp(this.curveOp, a, b, c, d, e, f) +}; +mxAbstractCanvas2D.prototype.arcTo = function(a, b, c, d, e, f, g) { + a = mxUtils.arcToCurves(this.lastX, this.lastY, a, b, c, d, e, f, g); + for (b = 0; b < a.length; b += 6) this.curveTo(a[b], a[b + 1], a[b + 2], a[b + 3], a[b + 4], a[b + 5]) +}; +mxAbstractCanvas2D.prototype.close = function(a, b, c, d, e, f) { + this.addOp(this.closeOp) +}; +mxAbstractCanvas2D.prototype.end = function() {}; + +function mxXmlCanvas2D(a) { + mxAbstractCanvas2D.call(this); + this.root = a; + this.writeDefaults() +} +mxUtils.extend(mxXmlCanvas2D, mxAbstractCanvas2D); +mxXmlCanvas2D.prototype.textEnabled = !0; +mxXmlCanvas2D.prototype.compressed = !0; +mxXmlCanvas2D.prototype.writeDefaults = function() { + var a; + a = this.createElement("fontfamily"); + a.setAttribute("family", mxConstants.DEFAULT_FONTFAMILY); + this.root.appendChild(a); + a = this.createElement("fontsize"); + a.setAttribute("size", mxConstants.DEFAULT_FONTSIZE); + this.root.appendChild(a); + a = this.createElement("shadowcolor"); + a.setAttribute("color", mxConstants.SHADOWCOLOR); + this.root.appendChild(a); + a = this.createElement("shadowalpha"); + a.setAttribute("alpha", mxConstants.SHADOW_OPACITY); + this.root.appendChild(a); + a = this.createElement("shadowoffset"); + a.setAttribute("dx", mxConstants.SHADOW_OFFSET_X); + a.setAttribute("dy", mxConstants.SHADOW_OFFSET_Y); + this.root.appendChild(a) +}; +mxXmlCanvas2D.prototype.format = function(a) { + return parseFloat(parseFloat(a).toFixed(2)) +}; +mxXmlCanvas2D.prototype.createElement = function(a) { + return this.root.ownerDocument.createElement(a) +}; +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(a) { + if (this.compressed) { + if (this.state.scale == a) return; + mxAbstractCanvas2D.prototype.setAlpha.apply(this, arguments) + } + var b = this.createElement("scale"); + b.setAttribute("scale", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.translate = function(a, b) { + var c = this.createElement("translate"); + c.setAttribute("dx", this.format(a)); + c.setAttribute("dy", this.format(b)); + this.root.appendChild(c) +}; +mxXmlCanvas2D.prototype.rotate = function(a, b, c, d, e) { + var f = this.createElement("rotate"); + if (0 != a || b || c) f.setAttribute("theta", this.format(a)), f.setAttribute("flipH", b ? "1" : "0"), f.setAttribute("flipV", c ? "1" : "0"), f.setAttribute("cx", this.format(d)), f.setAttribute( + "cy", this.format(e)), this.root.appendChild(f) +}; +mxXmlCanvas2D.prototype.setAlpha = function(a) { + if (this.compressed) { + if (this.state.alpha == a) return; + mxAbstractCanvas2D.prototype.setAlpha.apply(this, arguments) + } + var b = this.createElement("alpha"); + b.setAttribute("alpha", this.format(a)); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setFillColor = function(a) { + a == mxConstants.NONE && (a = null); + if (this.compressed) { + if (this.state.fillColor == a) return; + mxAbstractCanvas2D.prototype.setFillColor.apply(this, arguments) + } + var b = this.createElement("fillcolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setGradient = function(a, b, c, d, e, f, g, h, k) { + if (null != a && null != b) { + mxAbstractCanvas2D.prototype.setGradient.apply(this, arguments); + var l = this.createElement("gradient"); + l.setAttribute("c1", a); + l.setAttribute("c2", b); + l.setAttribute("x", this.format(c)); + l.setAttribute("y", this.format(d)); + l.setAttribute("w", this.format(e)); + l.setAttribute("h", this.format(f)); + null != g && l.setAttribute("direction", g); + null != h && l.setAttribute("alpha1", h); + null != k && l.setAttribute("alpha2", k); + this.root.appendChild(l) + } +}; +mxXmlCanvas2D.prototype.setStrokeColor = function(a) { + a == mxConstants.NONE && (a = null); + if (this.compressed) { + if (this.state.strokeColor == a) return; + mxAbstractCanvas2D.prototype.setStrokeColor.apply(this, arguments) + } + var b = this.createElement("strokecolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setStrokeWidth = function(a) { + if (this.compressed) { + if (this.state.strokeWidth == a) return; + mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this, arguments) + } + var b = this.createElement("strokewidth"); + b.setAttribute("width", this.format(a)); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setDashed = function(a) { + if (this.compressed) { + if (this.state.dashed == a) return; + mxAbstractCanvas2D.prototype.setDashed.apply(this, arguments) + } + var b = this.createElement("dashed"); + b.setAttribute("dashed", a ? "1" : "0"); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setDashPattern = function(a) { + if (this.compressed) { + if (this.state.dashPattern == a) return; + mxAbstractCanvas2D.prototype.setDashPattern.apply(this, arguments) + } + var b = this.createElement("dashpattern"); + b.setAttribute("pattern", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setLineCap = function(a) { + if (this.compressed) { + if (this.state.lineCap == a) return; + mxAbstractCanvas2D.prototype.setLineCap.apply(this, arguments) + } + var b = this.createElement("linecap"); + b.setAttribute("cap", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setLineJoin = function(a) { + if (this.compressed) { + if (this.state.lineJoin == a) return; + mxAbstractCanvas2D.prototype.setLineJoin.apply(this, arguments) + } + var b = this.createElement("linejoin"); + b.setAttribute("join", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setMiterLimit = function(a) { + if (this.compressed) { + if (this.state.miterLimit == a) return; + mxAbstractCanvas2D.prototype.setMiterLimit.apply(this, arguments) + } + var b = this.createElement("miterlimit"); + b.setAttribute("limit", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setFontColor = function(a) { + if (this.textEnabled) { + a == mxConstants.NONE && (a = null); + if (this.compressed) { + if (this.state.fontColor == a) return; + mxAbstractCanvas2D.prototype.setFontColor.apply(this, arguments) + } + var b = this.createElement("fontcolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setFontBackgroundColor = function(a) { + if (this.textEnabled) { + a == mxConstants.NONE && (a = null); + if (this.compressed) { + if (this.state.fontBackgroundColor == a) return; + mxAbstractCanvas2D.prototype.setFontBackgroundColor.apply(this, arguments) + } + var b = this.createElement("fontbackgroundcolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setFontBorderColor = function(a) { + if (this.textEnabled) { + a == mxConstants.NONE && (a = null); + if (this.compressed) { + if (this.state.fontBorderColor == a) return; + mxAbstractCanvas2D.prototype.setFontBorderColor.apply(this, arguments) + } + var b = this.createElement("fontbordercolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setFontSize = function(a) { + if (this.textEnabled) { + if (this.compressed) { + if (this.state.fontSize == a) return; + mxAbstractCanvas2D.prototype.setFontSize.apply(this, arguments) + } + var b = this.createElement("fontsize"); + b.setAttribute("size", a); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setFontFamily = function(a) { + if (this.textEnabled) { + if (this.compressed) { + if (this.state.fontFamily == a) return; + mxAbstractCanvas2D.prototype.setFontFamily.apply(this, arguments) + } + var b = this.createElement("fontfamily"); + b.setAttribute("family", a); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setFontStyle = function(a) { + if (this.textEnabled) { + null == a && (a = 0); + if (this.compressed) { + if (this.state.fontStyle == a) return; + mxAbstractCanvas2D.prototype.setFontStyle.apply(this, arguments) + } + var b = this.createElement("fontstyle"); + b.setAttribute("style", a); + this.root.appendChild(b) + } +}; +mxXmlCanvas2D.prototype.setShadow = function(a) { + if (this.compressed) { + if (this.state.shadow == a) return; + mxAbstractCanvas2D.prototype.setShadow.apply(this, arguments) + } + var b = this.createElement("shadow"); + b.setAttribute("enabled", a ? "1" : "0"); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setShadowColor = function(a) { + if (this.compressed) { + a == mxConstants.NONE && (a = null); + if (this.state.shadowColor == a) return; + mxAbstractCanvas2D.prototype.setShadowColor.apply(this, arguments) + } + var b = this.createElement("shadowcolor"); + b.setAttribute("color", null != a ? a : mxConstants.NONE); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setShadowAlpha = function(a) { + if (this.compressed) { + if (this.state.shadowAlpha == a) return; + mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this, arguments) + } + var b = this.createElement("shadowalpha"); + b.setAttribute("alpha", a); + this.root.appendChild(b) +}; +mxXmlCanvas2D.prototype.setShadowOffset = function(a, b) { + if (this.compressed) { + if (this.state.shadowDx == a && this.state.shadowDy == b) return; + mxAbstractCanvas2D.prototype.setShadowOffset.apply(this, arguments) + } + var c = this.createElement("shadowoffset"); + c.setAttribute("dx", a); + c.setAttribute("dy", b); + this.root.appendChild(c) +}; +mxXmlCanvas2D.prototype.rect = function(a, b, c, d) { + var e = this.createElement("rect"); + e.setAttribute("x", this.format(a)); + e.setAttribute("y", this.format(b)); + e.setAttribute("w", this.format(c)); + e.setAttribute("h", this.format(d)); + this.root.appendChild(e) +}; +mxXmlCanvas2D.prototype.roundrect = function(a, b, c, d, e, f) { + var g = this.createElement("roundrect"); + g.setAttribute("x", this.format(a)); + g.setAttribute("y", this.format(b)); + g.setAttribute("w", this.format(c)); + g.setAttribute("h", this.format(d)); + g.setAttribute("dx", this.format(e)); + g.setAttribute("dy", this.format(f)); + this.root.appendChild(g) +}; +mxXmlCanvas2D.prototype.ellipse = function(a, b, c, d) { + var e = this.createElement("ellipse"); + e.setAttribute("x", this.format(a)); + e.setAttribute("y", this.format(b)); + e.setAttribute("w", this.format(c)); + e.setAttribute("h", this.format(d)); + this.root.appendChild(e) +}; +mxXmlCanvas2D.prototype.image = function(a, b, c, d, e, f, g, h) { + e = this.converter.convert(e); + var k = this.createElement("image"); + k.setAttribute("x", this.format(a)); + k.setAttribute("y", this.format(b)); + k.setAttribute("w", this.format(c)); + k.setAttribute("h", this.format(d)); + k.setAttribute("src", e); + k.setAttribute("aspect", f ? "1" : "0"); + k.setAttribute("flipH", g ? "1" : "0"); + k.setAttribute("flipV", h ? "1" : "0"); + this.root.appendChild(k) +}; +mxXmlCanvas2D.prototype.begin = function() { + this.root.appendChild(this.createElement("begin")); + this.lastY = this.lastX = 0 +}; +mxXmlCanvas2D.prototype.moveTo = function(a, b) { + var c = this.createElement("move"); + c.setAttribute("x", this.format(a)); + c.setAttribute("y", this.format(b)); + this.root.appendChild(c); + this.lastX = a; + this.lastY = b +}; +mxXmlCanvas2D.prototype.lineTo = function(a, b) { + var c = this.createElement("line"); + c.setAttribute("x", this.format(a)); + c.setAttribute("y", this.format(b)); + this.root.appendChild(c); + this.lastX = a; + this.lastY = b +}; +mxXmlCanvas2D.prototype.quadTo = function(a, b, c, d) { + var e = this.createElement("quad"); + e.setAttribute("x1", this.format(a)); + e.setAttribute("y1", this.format(b)); + e.setAttribute("x2", this.format(c)); + e.setAttribute("y2", this.format(d)); + this.root.appendChild(e); + this.lastX = c; + this.lastY = d +}; +mxXmlCanvas2D.prototype.curveTo = function(a, b, c, d, e, f) { + var g = this.createElement("curve"); + g.setAttribute("x1", this.format(a)); + g.setAttribute("y1", this.format(b)); + g.setAttribute("x2", this.format(c)); + g.setAttribute("y2", this.format(d)); + g.setAttribute("x3", this.format(e)); + g.setAttribute("y3", this.format(f)); + this.root.appendChild(g); + this.lastX = e; + this.lastY = f +}; +mxXmlCanvas2D.prototype.close = function() { + this.root.appendChild(this.createElement("close")) +}; +mxXmlCanvas2D.prototype.text = function(a, b, c, d, e, f, g, h, k, l, m, n) { + if (this.textEnabled && null != e) { + mxUtils.isNode(e) && (e = mxUtils.getOuterHtml(e)); + var p = this.createElement("text"); + p.setAttribute("x", this.format(a)); + p.setAttribute("y", this.format(b)); + p.setAttribute("w", this.format(c)); + p.setAttribute("h", this.format(d)); + p.setAttribute("str", e); + null != f && p.setAttribute("align", f); + null != g && p.setAttribute("valign", g); + p.setAttribute("wrap", h ? "1" : "0"); + null == k && (k = ""); + p.setAttribute("format", k); + null != l && p.setAttribute("fill", + l ? "1" : "0"); + null != m && p.setAttribute("clip", m ? "1" : "0"); + null != n && p.setAttribute("rotation", n); + this.root.appendChild(p) + } +}; +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")) +}; + +function mxSvgCanvas2D(a, b) { + mxAbstractCanvas2D.call(this); + this.root = a; + this.gradients = []; + this.defs = null; + this.styleEnabled = null != b ? b : !1; + var c = null; + if (a.ownerDocument != document) + for (c = a; null != c && "svg" != c.nodeName;) c = c.parentNode; + null != c && (0 < c.getElementsByTagName("defs").length && (this.defs = c.getElementsByTagName("defs")[0]), null == this.defs && (this.defs = this.createElement("defs"), null != c.firstChild ? c.insertBefore( + this.defs, c.firstChild) : c.appendChild(this.defs)), this.styleEnabled && this.defs.appendChild(this.createStyle())) +} +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(a) { + a = this.createElement("style"); + a.setAttribute("type", "text/css"); + mxUtils.write(a, "svg{font-family:" + mxConstants.DEFAULT_FONTFAMILY + ";font-size:" + mxConstants.DEFAULT_FONTSIZE + ";fill:none;stroke-miterlimit:10}"); + return a +}; +mxSvgCanvas2D.prototype.createElement = function(a, b) { + if (null != this.root.ownerDocument.createElementNS) return this.root.ownerDocument.createElementNS(b || mxConstants.NS_SVG, a); + var c = this.root.ownerDocument.createElement(a); + null != b && c.setAttribute("xmlns", b); + return c +}; +mxSvgCanvas2D.prototype.createGradientId = function(a, b, c, d, e) { + "#" == a.charAt(0) && (a = a.substring(1)); + "#" == b.charAt(0) && (b = b.substring(1)); + a = a.toLowerCase() + "-" + c; + b = b.toLowerCase() + "-" + d; + c = null; + null == e || e == mxConstants.DIRECTION_SOUTH ? c = "s" : e == mxConstants.DIRECTION_EAST ? c = "e" : (d = a, a = b, b = d, e == mxConstants.DIRECTION_NORTH ? c = "s" : e == mxConstants.DIRECTION_WEST && + (c = "e")); + return "mx-gradient-" + a + "-" + b + "-" + c +}; +mxSvgCanvas2D.prototype.getSvgGradient = function(a, b, c, d, e) { + var f = this.createGradientId(a, b, c, d, e), + g = this.gradients[f]; + if (null == g) { + var h = this.root.ownerSVGElement, + k = 0, + l = f + "-" + k; + if (null != h) + for (g = h.ownerDocument.getElementById(l); null != g && g.ownerSVGElement != h;) l = f + "-" + k++, g = h.ownerDocument.getElementById(l); + else l = "id" + ++this.refCount; + null == g && (g = this.createSvgGradient(a, b, c, d, e), g.setAttribute("id", l), null != this.defs ? this.defs.appendChild(g) : h.appendChild(g)); + this.gradients[f] = g + } + return g.getAttribute("id") +}; +mxSvgCanvas2D.prototype.createSvgGradient = function(a, b, c, d, e) { + var f = this.createElement("linearGradient"); + f.setAttribute("x1", "0%"); + f.setAttribute("y1", "0%"); + f.setAttribute("x2", "0%"); + f.setAttribute("y2", "0%"); + null == e || e == mxConstants.DIRECTION_SOUTH ? f.setAttribute("y2", "100%") : e == mxConstants.DIRECTION_EAST ? f.setAttribute("x2", "100%") : e == mxConstants.DIRECTION_NORTH ? f.setAttribute( + "y1", "100%") : e == mxConstants.DIRECTION_WEST && f.setAttribute("x1", "100%"); + c = 1 > c ? ";stop-opacity:" + c : ""; + e = this.createElement("stop"); + e.setAttribute("offset", "0%"); + e.setAttribute("style", "stop-color:" + a + c); + f.appendChild(e); + c = 1 > d ? ";stop-opacity:" + d : ""; + e = this.createElement("stop"); + e.setAttribute("offset", "100%"); + e.setAttribute("style", "stop-color:" + b + c); + f.appendChild(e); + return f +}; +mxSvgCanvas2D.prototype.addNode = function(a, b) { + var c = this.node, + d = this.state; + if (null != c) { + if ("path" == c.nodeName) + if (null != this.path && 0 < this.path.length) c.setAttribute("d", this.path.join(" ")); + else return; + a && null != d.fillColor ? this.updateFill() : this.styleEnabled || ("ellipse" == c.nodeName && mxClient.IS_NS && !mxClient.IS_GC && !mxClient.IS_SF ? c.setAttribute("fill", "transparent") : c.setAttribute( + "fill", "none"), a = !1); + b && null != d.strokeColor ? this.updateStroke() : this.styleEnabled || c.setAttribute("stroke", "none"); + null != + d.transform && 0 < d.transform.length && c.setAttribute("transform", d.transform); + d.shadow && this.root.appendChild(this.createShadow(c)); + 0 < this.strokeTolerance && !a && this.root.appendChild(this.createTolerance(c)); + this.pointerEvents && ("path" != c.nodeName || this.path[this.path.length - 1] == this.closeOp) && c.setAttribute("pointer-events", "all"); + this.root.appendChild(c) + } +}; +mxSvgCanvas2D.prototype.updateFill = function() { + var a = this.state; + 1 > a.alpha && this.node.setAttribute("fill-opacity", a.alpha); + null != a.fillColor && (null != a.gradientColor ? (a = this.getSvgGradient(a.fillColor, a.gradientColor, a.fillAlpha, a.gradientAlpha, a.gradientDirection), this.node.setAttribute("fill", "url(#" + + a + ")")) : this.node.setAttribute("fill", a.fillColor.toLowerCase())) +}; +mxSvgCanvas2D.prototype.updateStroke = function() { + var a = this.state; + this.node.setAttribute("stroke", a.strokeColor.toLowerCase()); + 1 > a.alpha && this.node.setAttribute("stroke-opacity", a.alpha); + var b = Math.max(1, this.format(a.strokeWidth * a.scale)); + 1 != b && this.node.setAttribute("stroke-width", b); + "path" == this.node.nodeName && this.updateStrokeAttributes(); + a.dashed && this.node.setAttribute("stroke-dasharray", this.createDashPattern(b)) +}; +mxSvgCanvas2D.prototype.updateStrokeAttributes = function() { + var a = this.state; + null != a.lineJoin && "miter" != a.lineJoin && this.node.setAttribute("stroke-linejoin", a.lineJoin); + if (null != a.lineCap) { + var b = a.lineCap; + "flat" == b && (b = "butt"); + "butt" != b && this.node.setAttribute("stroke-linecap", b) + } + null != a.miterLimit && (!this.styleEnabled || 10 != a.miterLimit) && this.node.setAttribute("stroke-miterlimit", a.miterLimit) +}; +mxSvgCanvas2D.prototype.createDashPattern = function(a) { + var b = this.state.dashPattern.split(" "), + c = []; + if (0 < b.length) + for (var d = 0; d < b.length; d++) c[d] = Number(b[d]) * a; + return c.join(" ") +}; +mxSvgCanvas2D.prototype.createTolerance = function(a) { + a = a.cloneNode(!0); + var b = parseFloat(a.getAttribute("stroke-width") || 1) + this.strokeTolerance; + a.setAttribute("pointer-events", "stroke"); + a.setAttribute("visibility", "hidden"); + a.removeAttribute("stroke-dasharray"); + a.setAttribute("stroke-width", b); + a.setAttribute("fill", "none"); + a.setAttribute("stroke", mxClient.IS_OP ? "none" : "white"); + return a +}; +mxSvgCanvas2D.prototype.createShadow = function(a) { + a = a.cloneNode(!0); + var b = this.state; + "none" != a.getAttribute("fill") && a.setAttribute("fill", b.shadowColor); + "none" != a.getAttribute("stroke") && a.setAttribute("stroke", b.shadowColor); + a.setAttribute("transform", "translate(" + this.format(b.shadowDx * b.scale) + "," + this.format(b.shadowDy * b.scale) + ")" + (b.transform || "")); + a.setAttribute("opacity", b.shadowAlpha); + return a +}; +mxSvgCanvas2D.prototype.rotate = function(a, b, c, d, e) { + if (0 != a || b || c) { + var f = this.state; + d += f.dx; + e += f.dy; + d *= f.scale; + e *= f.scale; + f.transform = f.transform || ""; + if (b && c) a += 180; + else if (b ^ c) { + var g = b ? d : 0, + h = b ? -1 : 1, + k = c ? e : 0, + l = c ? -1 : 1; + f.transform += "translate(" + this.format(g) + "," + this.format(k) + ")scale(" + this.format(h) + "," + this.format(l) + ")translate(" + this.format(-g) + "," + this.format(-k) + ")" + } + if (b ? !c : c) a *= -1; + 0 != a && (f.transform += "rotate(" + this.format(a) + "," + this.format(d) + "," + this.format(e) + ")"); + f.rotation += a; + f.rotationCx = + d; + f.rotationCy = e + } +}; +mxSvgCanvas2D.prototype.begin = function() { + mxAbstractCanvas2D.prototype.begin.apply(this, arguments); + this.node = this.createElement("path") +}; +mxSvgCanvas2D.prototype.rect = function(a, b, c, d) { + var e = this.state, + f = this.createElement("rect"); + f.setAttribute("x", this.format((a + e.dx) * e.scale)); + f.setAttribute("y", this.format((b + e.dy) * e.scale)); + f.setAttribute("width", this.format(c * e.scale)); + f.setAttribute("height", this.format(d * e.scale)); + this.node = f +}; +mxSvgCanvas2D.prototype.roundrect = function(a, b, c, d, e, f) { + this.rect(a, b, c, d); + 0 < e && this.node.setAttribute("rx", this.format(e * this.state.scale)); + 0 < f && this.node.setAttribute("ry", this.format(f * this.state.scale)) +}; +mxSvgCanvas2D.prototype.ellipse = function(a, b, c, d) { + var e = this.state, + f = this.createElement("ellipse"); + f.setAttribute("cx", Math.round((a + c / 2 + e.dx) * e.scale)); + f.setAttribute("cy", Math.round((b + d / 2 + e.dy) * e.scale)); + f.setAttribute("rx", c / 2 * e.scale); + f.setAttribute("ry", d / 2 * e.scale); + this.node = f +}; +mxSvgCanvas2D.prototype.image = function(a, b, c, d, e, f, g, h) { + e = this.converter.convert(e); + f = null != f ? f : !0; + g = null != g ? g : !1; + h = null != h ? h : !1; + var k = this.state; + a += k.dx; + b += k.dy; + var l = this.createElement("image"); + l.setAttribute("x", this.format(a * k.scale)); + l.setAttribute("y", this.format(b * k.scale)); + l.setAttribute("width", this.format(c * k.scale)); + l.setAttribute("height", this.format(d * k.scale)); + null == l.setAttributeNS ? l.setAttribute("xlink:href", e) : l.setAttributeNS(mxConstants.NS_XLINK, "href", e); + f || l.setAttribute("preserveAspectRatio", + "none"); + 1 > k.alpha && l.setAttribute("opacity", k.alpha); + e = this.state.transform || ""; + if (g || h) { + var m = f = 1, + n = 0, + p = 0; + g && (f = -1, n = -c - 2 * a); + h && (m = -1, p = -d - 2 * b); + e += "scale(" + f + "," + m + ")translate(" + n + "," + p + ")" + } + 0 < e.length && l.setAttribute("transform", e); + this.root.appendChild(l); + this.blockImagePointerEvents && (l.setAttribute("style", "pointer-events:none"), l = this.createElement("rect"), l.setAttribute("visibility", "hidden"), l.setAttribute("pointer-events", "fill"), + l.setAttribute("x", this.format(a * k.scale)), l.setAttribute("y", + this.format(b * k.scale)), l.setAttribute("width", this.format(c * k.scale)), l.setAttribute("height", this.format(d * k.scale)), this.root.appendChild(l)) +}; +mxSvgCanvas2D.prototype.createDiv = function(a, b, c, d, e) { + c = this.state; + d = "display:inline-block;font-size:" + Math.round(c.fontSize) + "px;font-family:" + c.fontFamily + ";color:" + c.fontColor + ";line-height:" + Math.round(c.fontSize * mxConstants.LINE_HEIGHT) + + "px;" + d; + (c.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD && (d += "font-weight:bold;"); + (c.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC && (d += "font-style:italic;"); + (c.fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE && (d += "font-decoration:underline;"); + b == mxConstants.ALIGN_CENTER ? d += "text-align:center;" : b == mxConstants.ALIGN_RIGHT && (d += "text-align:right;"); + b = ""; + null != c.fontBackgroundColor && (b += "background-color:" + c.fontBackgroundColor + ";"); + null != c.fontBorderColor && (b += "border:1px solid " + c.fontBorderColor + ";"); + mxUtils.isNode(a) || (c = document.createElement("textarea"), c.innerHTML = a.replace(/</g, "\x26amp;lt;").replace(/>/g, "\x26amp;gt;").replace(//g, "\x26gt;"), a = + c.value, e ? d += b : 0 < b.length && (a = '\x3cdiv xmlns\x3d"http://www.w3.org/1999/xhtml" style\x3d"display:inline-block;' + + b + '"\x3e' + a + "\x3c/div\x3e")); + if (!mxClient.IS_IE && document.createElementNS) return e = document.createElementNS("http://www.w3.org/1999/xhtml", "div"), e.setAttribute("style", d), mxUtils.isNode(a) ? this.root.ownerDocument != + document ? e.appendChild(a.cloneNode(!0)) : e.appendChild(a) : e.innerHTML = a, e; + mxUtils.isNode(a) && this.root.ownerDocument != document && (a = a.outerHTML); + a = a.replace(/
/g, "\x3cbr /\x3e").replace(/
/g, "\x3chr /\x3e"); + return mxUtils.parseXml('\x3cdiv xmlns\x3d"http://www.w3.org/1999/xhtml" style\x3d"' + + d + '"\x3e' + a + "\x3c/div\x3e").documentElement +}; +mxSvgCanvas2D.prototype.text = function(a, b, c, d, e, f, g, h, k, l, m, n) { + if (this.textEnabled && null != e) { + n = null != n ? n : 0; + var p = this.state; + a += p.dx; + b += p.dy; + if (this.foEnabled && "html" == k) { + var q = "vertical-align:top;"; + m ? (q += "overflow:hidden;", 0 < d && (q += "max-height:" + Math.round(d) + "px;"), 0 < c && (q += "width:" + Math.round(c) + "px;")) : l && (q += "width:" + Math.round(c) + "px;", 0 < d && + (q += "max-height:" + Math.round(d) + "px;")); + h ? (!m && 0 < c && (q += "width:" + Math.round(c) + "px;"), q += "white-space:normal;") : q += "white-space:nowrap;"; + h = this.createElement("g"); + 1 > p.alpha && h.setAttribute("opacity", p.alpha); + k = this.createElement("foreignObject"); + k.setAttribute("pointer-events", "all"); + q = this.createDiv(e, f, g, q, l); + if (null != q) { + h.appendChild(k); + this.root.appendChild(h); + var s = 0; + if (mxClient.IS_IE && !mxClient.IS_SVG) { + var r = document.createElement("div"); + r.style.cssText = q.getAttribute("style"); + r.style.display = mxClient.IS_QUIRKS ? "inline" : "inline-block"; + r.style.visibility = "hidden"; + r.innerHTML = mxUtils.isNode(e) ? e.outerHTML : e; + document.body.appendChild(r); + s = r.offsetWidth; + d = mxClient.IS_QUIRKS && 0 < d && m ? Math.min(d, r.offsetHeight + 2) : r.offsetHeight; + r.parentNode.removeChild(r); + k.appendChild(q) + } else this.root.ownerDocument != document ? (q.style.visibility = "hidden", document.body.appendChild(q), s = q.offsetWidth, d = q.offsetHeight, k.appendChild(q), q.style.visibility = "") : + (k.appendChild(q), s = q.offsetWidth, d = q.offsetHeight); + c = l ? Math.max(c, s) : s; + 1 > p.alpha && h.setAttribute("opacity", p.alpha); + l = e = 0; + f == mxConstants.ALIGN_CENTER ? e -= c / 2 : f == mxConstants.ALIGN_RIGHT && (e -= c); + a += e; + g == mxConstants.ALIGN_MIDDLE ? + l -= d / 2 : g == mxConstants.ALIGN_BOTTOM && (l -= d); + b += l; + f = 1 != p.scale ? "scale(" + p.scale + ")" : ""; + 0 != p.rotation && this.rotateHtml ? (f += "rotate(" + p.rotation + "," + c / 2 + "," + d / 2 + ")", b = this.rotatePoint((a + c / 2) * p.scale, (b + d / 2) * p.scale, p.rotation, p.rotationCx, + p.rotationCy), a = b.x - c * p.scale / 2, b = b.y - d * p.scale / 2) : (a *= p.scale, b *= p.scale); + 0 != n && (f += "rotate(" + n + "," + -e + "," + -l + ")"); + h.setAttribute("transform", "translate(" + Math.round(a) + "," + Math.round(b) + ")" + f); + k.setAttribute("width", Math.round(Math.max(1, c))); + k.setAttribute("height", + Math.round(Math.max(1, d))) + } + } else this.plainText(a, b, c, d, e, f, g, h, l, m, n) + } +}; +mxSvgCanvas2D.prototype.createClip = function(a, b, c, d) { + a = Math.round(a); + b = Math.round(b); + c = Math.round(c); + d = Math.round(d); + for (var e = "mx-clip-" + a + "-" + b + "-" + c + "-" + d, f = 0, g = e + "-" + f; null != document.getElementById(g);) g = e + "-" + ++f; + clip = this.createElement("clipPath"); + clip.setAttribute("id", g); + e = this.createElement("rect"); + e.setAttribute("x", a); + e.setAttribute("y", b); + e.setAttribute("width", c); + e.setAttribute("height", d); + clip.appendChild(e); + return clip +}; +mxSvgCanvas2D.prototype.plainText = function(a, b, c, d, e, f, g, h, k, l, m) { + m = null != m ? m : 0; + h = this.state; + var n = Math.round(h.fontSize), + p = this.createElement("g"), + q = h.transform || ""; + 0 != m && (q += "rotate(" + m + "," + this.format(a * h.scale) + "," + this.format(b * h.scale) + ")"); + if (l && 0 < c && 0 < d) { + var s = a; + m = b; + f == mxConstants.ALIGN_CENTER ? s -= c / 2 : f == mxConstants.ALIGN_RIGHT && (s -= c); + g == mxConstants.ALIGN_MIDDLE ? m -= d / 2 : g == mxConstants.ALIGN_BOTTOM && (m -= d); + m = this.createClip(s * h.scale - 2, m * h.scale - 2, c * h.scale + 4, d * h.scale + 4); + null != this.defs ? this.defs.appendChild(m) : + this.root.appendChild(m); + p.setAttribute("clip-path", "url(#" + m.getAttribute("id") + ")") + } + this.updateFont(p, f); + m = f == mxConstants.ALIGN_RIGHT ? "end" : f == mxConstants.ALIGN_CENTER ? "middle" : "start"; + "start" != m && p.setAttribute("text-anchor", m); + (!this.styleEnabled || n != mxConstants.DEFAULT_FONTSIZE) && p.setAttribute("font-size", Math.round(n * h.scale) + "px"); + 0 < q.length && p.setAttribute("transform", q); + 1 > h.alpha && p.setAttribute("opacity", h.alpha); + var q = e.split("\n"), + s = Math.round(n * mxConstants.LINE_HEIGHT), + r = n + (q.length - + 1) * s; + m = b + n - 1; + g == mxConstants.ALIGN_MIDDLE ? (d = (this.matchHtmlAlignment && l && 0 < d ? Math.min(r, d) : r) / 2, m -= d + 1) : g == mxConstants.ALIGN_BOTTOM && (d = this.matchHtmlAlignment && l && 0 < d ? + Math.min(r, d) : r, m -= d + 2); + for (d = 0; d < q.length; d++) 0 < q[d].length && 0 < mxUtils.trim(q[d]).length && (l = this.createElement("text"), l.setAttribute("x", this.format(a * h.scale)), l.setAttribute("y", this.format( + m * h.scale)), mxUtils.write(l, q[d]), p.appendChild(l)), m += s; + this.root.appendChild(p); + this.addTextBackground(p, e, a, b, c, r, f, g, k) +}; +mxSvgCanvas2D.prototype.updateFont = function(a) { + var b = this.state; + a.setAttribute("fill", b.fontColor); + (!this.styleEnabled || b.fontFamily != mxConstants.DEFAULT_FONTFAMILY) && a.setAttribute("font-family", b.fontFamily); + (b.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD && a.setAttribute("font-weight", "bold"); + (b.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC && a.setAttribute("font-style", "italic"); + (b.fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE && a.setAttribute("text-decoration", + "underline") +}; +mxSvgCanvas2D.prototype.addTextBackground = function(a, b, c, d, e, f, g, h, k) { + var l = this.state; + if (null != l.fontBackgroundColor || null != l.fontBorderColor) { + var m = null; + k ? (g == mxConstants.ALIGN_CENTER ? c -= e / 2 : g == mxConstants.ALIGN_RIGHT && (c -= e), h == mxConstants.ALIGN_MIDDLE ? d -= f / 2 : h == mxConstants.ALIGN_BOTTOM && (d -= f), m = new mxRectangle( + (c + 1) * l.scale, d * l.scale, (e - 2) * l.scale, (f + 2) * l.scale)) : null != a.getBBox && this.root.ownerDocument == document ? (m = a.getBBox(), b = mxClient.IS_IE && mxClient.IS_SVG, + m = new mxRectangle(m.x, m.y + (b ? 0 : + 1), m.width, m.height + (b ? 1 : 0))) : (m = document.createElement("div"), m.style.lineHeight = Math.round(l.fontSize * mxConstants.LINE_HEIGHT) + "px", m.style.fontSize = Math.round(l.fontSize) + + "px", m.style.fontFamily = l.fontFamily, m.style.whiteSpace = "nowrap", m.style.position = "absolute", m.style.visibility = "hidden", m.style.display = mxClient.IS_QUIRKS ? "inline" : + "inline-block", m.style.zoom = "1", (l.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD && (m.style.fontWeight = "bold"), (l.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC && + (m.style.fontStyle = "italic"), b = mxUtils.htmlEntities(b, !1), m.innerHTML = b.replace(/\n/g, "\x3cbr/\x3e"), document.body.appendChild(m), e = m.offsetWidth, f = m.offsetHeight, m.parentNode + .removeChild(m), g == mxConstants.ALIGN_CENTER ? c -= e / 2 : g == mxConstants.ALIGN_RIGHT && (c -= e), h == mxConstants.ALIGN_MIDDLE ? d -= f / 2 : h == mxConstants.ALIGN_BOTTOM && (d -= f), + m = new mxRectangle((c + 1) * l.scale, (d + 2) * l.scale, e * l.scale, (f + 1) * l.scale)); + null != m && (b = this.createElement("rect"), b.setAttribute("fill", l.fontBackgroundColor || "none"), b.setAttribute("stroke", + l.fontBorderColor || "none"), b.setAttribute("x", Math.floor(m.x - 1)), b.setAttribute("y", Math.floor(m.y - 1)), b.setAttribute("width", Math.ceil(m.width + 2)), b.setAttribute("height", + Math.ceil(m.height)), l = null != l.fontBorderColor ? Math.max(1, this.format(l.scale)) : 0, b.setAttribute("stroke-width", l), this.root.ownerDocument == document && 1 == mxUtils.mod(l, + 2) && b.setAttribute("transform", "translate(0.5, 0.5)"), a.insertBefore(b, a.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(a) { + mxAbstractCanvas2D.call(this); + this.root = a +}; +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(a, b) { + var c = this.node, + d = this.state; + if (null != c) { + if ("shape" == c.nodeName) + if (null != this.path && 0 < this.path.length) c.path = this.path.join(" ") + " e", c.style.width = this.root.style.width, c.style.height = this.root.style.height, c.coordsize = parseInt(c.style + .width) + " " + parseInt(c.style.height); + else return; + c.strokeweight = this.format(Math.max(1, d.strokeWidth * d.scale / this.vmlScale)) + "px"; + d.shadow && this.root.appendChild(this.createShadow(c, a && null != d.fillColor, b && null != d.strokeColor)); + b && null != d.strokeColor ? (c.stroked = "true", c.strokecolor = d.strokeColor) : c.stroked = "false"; + c.appendChild(this.createStroke()); + a && null != d.fillColor ? c.appendChild(this.createFill()) : this.pointerEvents && ("shape" != c.nodeName || this.path[this.path.length - 1] == this.closeOp) ? c.appendChild(this.createTransparentFill()) : + c.filled = "false"; + this.root.appendChild(c) + } +}; +mxVmlCanvas2D.prototype.createTransparentFill = function() { + var a = document.createElement(mxClient.VML_PREFIX + ":fill"); + a.src = mxClient.imageBasePath + "/transparent.gif"; + a.type = "tile"; + return a +}; +mxVmlCanvas2D.prototype.createFill = function() { + var a = this.state, + b = document.createElement(mxClient.VML_PREFIX + ":fill"); + b.color = a.fillColor; + if (null != a.gradientColor) { + b.type = "gradient"; + b.method = "none"; + b.color2 = a.gradientColor; + var c = 180 - a.rotation, + c = a.gradientDirection == mxConstants.DIRECTION_WEST ? c - (90 + ("x" == this.root.style.flip ? 180 : 0)) : a.gradientDirection == mxConstants.DIRECTION_EAST ? c + (90 + ("x" == this.root.style + .flip ? 180 : 0)) : a.gradientDirection == mxConstants.DIRECTION_NORTH ? c - (180 + ("y" == this.root.style.flip ? + -180 : 0)) : c + ("y" == this.root.style.flip ? -180 : 0); + if ("x" == this.root.style.flip || "y" == this.root.style.flip) c *= -1; + b.angle = mxUtils.mod(c, 360); + b.opacity = 100 * a.alpha * a.fillAlpha + "%"; + b.setAttribute(mxClient.OFFICE_PREFIX + ":opacity2", 100 * a.alpha * a.gradientAlpha + "%") + } else 1 > a.alpha && (b.opacity = 100 * a.alpha + "%"); + return b +}; +mxVmlCanvas2D.prototype.createStroke = function() { + var a = this.state, + b = document.createElement(mxClient.VML_PREFIX + ":stroke"); + b.endcap = a.lineCap || "flat"; + b.joinstyle = a.lineJoin || "miter"; + b.miterlimit = a.miterLimit || "10"; + 1 > a.alpha && (b.opacity = 100 * a.alpha + "%"); + a.dashed && (b.dashstyle = this.getVmlDashStyle()); + return b +}; +mxVmlCanvas2D.prototype.getVmlDashStyle = function() { + var a = "dash"; + if (null != this.state.dashPattern) { + var b = this.state.dashPattern.split(" "); + 0 < b.length && 1 == b[0] && (a = "0 2") + } + return a +}; +mxVmlCanvas2D.prototype.createShadow = function(a, b, c) { + var d = this.state, + e = -d.rotation * (Math.PI / 180), + f = Math.cos(e), + e = Math.sin(e), + g = d.shadowDx * d.scale, + h = d.shadowDy * d.scale; + "x" == this.root.style.flip ? g *= -1 : "y" == this.root.style.flip && (h *= -1); + var k = a.cloneNode(!0); + k.style.marginLeft = Math.round(g * f - h * e) + "px"; + k.style.marginTop = Math.round(g * e + h * f) + "px"; + 8 == document.documentMode && (k.strokeweight = a.strokeweight, "shape" == a.nodeName && (k.path = this.path.join(" ") + " e", k.style.width = this.root.style.width, k.style.height = + this.root.style.height, k.coordsize = parseInt(a.style.width) + " " + parseInt(a.style.height))); + c ? (k.strokecolor = d.shadowColor, k.appendChild(this.createShadowStroke())) : k.stroked = "false"; + b ? k.appendChild(this.createShadowFill()) : k.filled = "false"; + return k +}; +mxVmlCanvas2D.prototype.createShadowFill = function() { + var a = document.createElement(mxClient.VML_PREFIX + ":fill"); + a.color = this.state.shadowColor; + a.opacity = 100 * this.state.alpha * this.state.shadowAlpha + "%"; + return a +}; +mxVmlCanvas2D.prototype.createShadowStroke = function() { + var a = this.createStroke(); + a.opacity = 100 * this.state.alpha * this.state.shadowAlpha + "%"; + return a +}; +mxVmlCanvas2D.prototype.rotate = function(a, b, c, d, e) { + b && c ? a += 180 : b ? this.root.style.flip = "x" : c && (this.root.style.flip = "y"); + if (b ? !c : c) a *= -1; + this.root.style.rotation = a; + this.state.rotation += a; + this.state.rotationCx = d; + this.state.rotationCy = e +}; +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(a, b, c, d) { + var e = this.state, + f = (this.lastX + e.dx) * e.scale, + g = (this.lastY + e.dy) * e.scale; + a = (a + e.dx) * e.scale; + b = (b + e.dy) * e.scale; + c = (c + e.dx) * e.scale; + d = (d + e.dy) * e.scale; + var g = g + 2 / 3 * (b - g), + h = c + 2 / 3 * (a - c); + b = d + 2 / 3 * (b - d); + this.path.push("c " + this.format(f + 2 / 3 * (a - f)) + " " + this.format(g) + " " + this.format(h) + " " + this.format(b) + " " + this.format(c) + " " + this.format(d)); + this.lastX = c / e.scale - e.dx; + this.lastY = d / e.scale - e.dy +}; +mxVmlCanvas2D.prototype.createRect = function(a, b, c, d, e) { + var f = this.state; + a = document.createElement(a); + a.style.position = "absolute"; + a.style.left = this.format((b + f.dx) * f.scale) + "px"; + a.style.top = this.format((c + f.dy) * f.scale) + "px"; + a.style.width = this.format(d * f.scale) + "px"; + a.style.height = this.format(e * f.scale) + "px"; + return a +}; +mxVmlCanvas2D.prototype.rect = function(a, b, c, d) { + this.node = this.createRect(mxClient.VML_PREFIX + ":rect", a, b, c, d) +}; +mxVmlCanvas2D.prototype.roundrect = function(a, b, c, d, e, f) { + this.node = this.createRect(mxClient.VML_PREFIX + ":roundrect", a, b, c, d); + this.node.setAttribute("arcsize", Math.max(100 * e / c, 100 * f / d) + "%") +}; +mxVmlCanvas2D.prototype.ellipse = function(a, b, c, d) { + this.node = this.createRect(mxClient.VML_PREFIX + ":oval", a, b, c, d) +}; +mxVmlCanvas2D.prototype.image = function(a, b, c, d, e, f, g, h) { + var k = null; + f ? (k = this.createRect(mxClient.VML_PREFIX + ":rect", a, b, c, d), k.stroked = "false", a = document.createElement(mxClient.VML_PREFIX + ":fill"), a.aspect = f ? "atmost" : "ignore", a.rotate = + "true", a.type = "frame", a.src = e, k.appendChild(a)) : (k = this.createRect(mxClient.VML_PREFIX + ":image", a, b, c, d), k.src = e); + g && h ? k.style.rotation = "180" : g ? k.style.flip = "x" : h && (k.style.flip = "y"); + 1 > this.state.alpha && (k.style.filter += "alpha(opacity\x3d" + 100 * this.state.alpha + ")"); + this.root.appendChild(k) +}; +mxVmlCanvas2D.prototype.createDiv = function(a, b, c, d) { + c = document.createElement("div"); + var e = this.state, + f = ""; + null != e.fontBackgroundColor && (f += "background-color:" + e.fontBackgroundColor + ";"); + null != e.fontBorderColor && (f += "border:1px solid " + e.fontBorderColor + ";"); + mxUtils.isNode(a) ? c.appendChild(a) : 0 < f.length && !d ? (d = document.createElement("div"), d.style.cssText = f, d.style.display = mxClient.IS_QUIRKS ? "inline" : "inline-block", d.style.zoom = + "1", d.innerHTML = a, c.appendChild(d)) : (c.style.cssText = f, c.innerHTML = a); + a = c.style; + a.fontSize = Math.round(e.fontSize / this.vmlScale) + "px"; + a.fontFamily = e.fontFamily; + a.color = e.fontColor; + a.verticalAlign = "top"; + a.textAlign = b || "left"; + a.lineHeight = Math.round(e.fontSize * mxConstants.LINE_HEIGHT / this.vmlScale) + "px"; + (e.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD && (a.fontWeight = "bold"); + (e.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC && (a.fontStyle = "italic"); + (e.fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE && (a.fontDecoration = "underline"); + return c +}; +mxVmlCanvas2D.prototype.text = function(a, b, c, d, e, f, g, h, k, l, m, n) { + if (this.textEnabled && null != e) { + var p = this.state; + if ("html" == k) { + null != p.rotation && (b = this.rotatePoint(a, b, p.rotation, p.rotationCx, p.rotationCy), a = b.x, b = b.y); + 8 == document.documentMode ? (a += p.dx, b += p.dy) : (a *= p.scale, b *= p.scale); + k = 8 == document.documentMode ? document.createElement(mxClient.VML_PREFIX + ":group") : document.createElement("div"); + k.style.position = "absolute"; + k.style.display = "inline"; + k.style.left = this.format(a) + "px"; + k.style.top = this.format(b) + + "px"; + k.style.zoom = p.scale; + var q = document.createElement("div"); + q.style.position = "relative"; + q.style.display = "inline"; + var s = mxUtils.getAlignmentAsPoint(f, g), + r = s.x, + s = s.y; + e = this.createDiv(e, f, g, l); + f = document.createElement("div"); + h ? (!m && 0 < c && (e.style.width = Math.round(c) + "px"), e.style.whiteSpace = "normal") : e.style.whiteSpace = "nowrap"; + h = p.rotation + (n || 0); + this.rotateHtml && 0 != h ? (f.style.display = "inline", f.style.zoom = "1", f.appendChild(e), 8 == document.documentMode && "DIV" != this.root.nodeName ? (q.appendChild(f), k.appendChild(q)) : + k.appendChild(f)) : 8 == document.documentMode ? (q.appendChild(e), k.appendChild(q)) : (e.style.display = "inline", k.appendChild(e)); + "DIV" != this.root.nodeName ? (n = document.createElement(mxClient.VML_PREFIX + ":rect"), n.stroked = "false", n.filled = "false", n.appendChild(k), this.root.appendChild(n)) : this.root.appendChild( + k); + m ? (e.style.overflow = "hidden", 0 < c && (e.style.width = Math.round(c) + "px"), 0 < d && 8 == document.documentMode && (e.style.maxHeight = Math.round(d) + "px")) : l && (e.style.width = c + + "px", 0 < d && (e.style.maxHeight = Math.round(d) + + "px")); + if (this.rotateHtml && 0 != h) { + c = h * (Math.PI / 180); + h = parseFloat(parseFloat(Math.cos(c)).toFixed(8)); + n = parseFloat(parseFloat(Math.sin(-c)).toFixed(8)); + c %= 2 * Math.PI; + 0 > c && (c += 2 * Math.PI); + c %= Math.PI; + c > Math.PI / 2 && (c = Math.PI - c); + g = Math.cos(c); + var t = Math.sin(c); + 8 == document.documentMode && (e.style.display = "inline-block", f.style.display = "inline-block", q.style.display = "inline-block"); + e.style.visibility = "hidden"; + document.body.appendChild(e); + c = e.offsetWidth; + q = e.offsetHeight; + if (mxClient.IS_QUIRKS && (m || l) && q > d) q = + d, e.style.height = q + "px"; + d = q; + m = (d - d * g + c * -t) / 2 - n * c * (r + 0.5) + h * d * (s + 0.5); + l = (c - c * g + d * -t) / 2 + h * c * (r + 0.5) + n * d * (s + 0.5); + "group" == k.nodeName && "DIV" == this.root.nodeName ? (r = document.createElement("div"), r.style.display = "inline-block", r.style.position = "absolute", r.style.left = this.format(a + (l - + c / 2) * p.scale) + "px", r.style.top = this.format(b + (m - d / 2) * p.scale) + "px", k.parentNode.appendChild(r), r.appendChild(k)) : (p = 8 == document.documentMode ? 1 : p.scale, k.style + .left = this.format(a + (l - c / 2) * p) + "px", k.style.top = this.format(b + (m - + d / 2) * p) + "px"); + f.style.filter = "progid:DXImageTransform.Microsoft.Matrix(M11\x3d" + h + ", M12\x3d" + n + ", M21\x3d" + -n + ", M22\x3d" + h + ", sizingMethod\x3d'auto expand')"; + f.style.backgroundColor = this.rotatedHtmlBackground; + 1 > this.state.alpha && (f.style.filter += "alpha(opacity\x3d" + 100 * this.state.alpha + ")"); + e.style.visibility = ""; + f.appendChild(e) + } else 8 != document.documentMode ? (e.style.verticalAlign = "top", 1 > this.state.alpha && (k.style.filter = "alpha(opacity\x3d" + 100 * this.state.alpha + ")"), p = e.parentNode, e.style.visibility = + "hidden", document.body.appendChild(e), c = e.offsetWidth, q = e.offsetHeight, mxClient.IS_QUIRKS && (m && q > d) && (q = d, e.style.height = q + "px"), d = q, e.style.visibility = "", p.appendChild( + e), k.style.left = this.format(a + c * r * this.state.scale) + "px", k.style.top = this.format(b + d * s * this.state.scale) + "px") : (1 > this.state.alpha && (e.style.filter = + "alpha(opacity\x3d" + 100 * this.state.alpha + ")"), q.style.left = 100 * r + "%", q.style.top = 100 * s + "%") + } else this.plainText(a, b, c, d, mxUtils.htmlEntities(e, !1), f, g, h, k, l, m, n) + } +}; +mxVmlCanvas2D.prototype.plainText = function(a, b, c, d, e, f, g, h, k, l, m, n) { + d = this.state; + a = (a + d.dx) * d.scale; + b = (b + d.dy) * d.scale; + c = document.createElement(mxClient.VML_PREFIX + ":shape"); + c.style.width = "1px"; + c.style.height = "1px"; + c.stroked = "false"; + l = document.createElement(mxClient.VML_PREFIX + ":fill"); + l.color = d.fontColor; + l.opacity = 100 * d.alpha + "%"; + c.appendChild(l); + l = document.createElement(mxClient.VML_PREFIX + ":path"); + l.textpathok = "true"; + l.v = "m " + this.format(0) + " " + this.format(0) + " l " + this.format(1) + " " + this.format(0); + c.appendChild(l); + l = document.createElement(mxClient.VML_PREFIX + ":textpath"); + l.style.cssText = "v-text-align:" + f; + l.style.align = f; + l.style.fontFamily = d.fontFamily; + l.string = e; + l.on = "true"; + f = Math.round(d.fontSize * d.scale / this.vmlScale); + l.style.fontSize = f + "px"; + (d.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD && (l.style.fontWeight = "bold"); + (d.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC && (l.style.fontStyle = "italic"); + (d.fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE && + (l.style.textDecoration = "underline"); + e = e.split("\n"); + d = f + (e.length - 1) * f * mxConstants.LINE_HEIGHT; + f = e = 0; + g == mxConstants.ALIGN_BOTTOM ? f = -d / 2 : g != mxConstants.ALIGN_MIDDLE && (f = d / 2); + null != n && (c.style.rotation = n, g = n * (Math.PI / 180), e = Math.sin(g) * f, f *= Math.cos(g)); + c.appendChild(l); + c.style.left = this.format(a - e) + "px"; + c.style.top = this.format(b + f) + "px"; + this.root.appendChild(c) +}; +mxVmlCanvas2D.prototype.stroke = function() { + this.addNode(!1, !0) +}; +mxVmlCanvas2D.prototype.fill = function() { + this.addNode(!0, !1) +}; +mxVmlCanvas2D.prototype.fillAndStroke = function() { + this.addNode(!0, !0) +}; + +function mxGuide(a, b) { + this.graph = a; + this.setStates(b) +} +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(a) { + this.states = a +}; +mxGuide.prototype.isEnabledForEvent = function(a) { + return !0 +}; +mxGuide.prototype.getGuideTolerance = function() { + return this.graph.gridSize * this.graph.view.scale / 2 +}; +mxGuide.prototype.createGuideShape = function(a) { + a = new mxPolyline([], mxConstants.GUIDE_COLOR, mxConstants.GUIDE_STROKEWIDTH); + a.isDashed = !0; + return a +}; +mxGuide.prototype.move = function(a, b, c) { + if (null != this.states && (this.horizontal || this.vertical) && null != a && null != b) { + var d = this.graph.getView().translate, + e = this.graph.getView().scale, + f = b.x, + g = b.y, + h = !1, + k = !1, + l = this.getGuideTolerance(), + m = l, + n = l, + l = a.clone(); + l.x += b.x; + l.y += b.y; + var p = l.x, + q = l.x + l.width, + s = l.getCenterX(), + r = l.y, + t = l.y + l.height, + v = l.getCenterY(); + b = function(b) { + b += this.graph.panDx; + var c = !1; + Math.abs(b - s) < m ? (f = b - a.getCenterX(), m = Math.abs(b - s), c = !0) : Math.abs(b - p) < m ? (f = b - a.x, m = Math.abs(b - p), c = !0) : Math.abs(b - + q) < m && (f = b - a.x - a.width, m = Math.abs(b - q), c = !0); + if (c) { + 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 d = this.graph.container; + b -= this.graph.panDx; + this.guideX.points = [new mxPoint(b, -this.graph.panDy), new mxPoint(b, d.scrollHeight - 3 - this.graph.panDy)] + } + h = h || c + }; + for (var l = function(b) { + b += this.graph.panDy; + var c = !1; + Math.abs(b - v) < n ? (g = b - a.getCenterY(), n = Math.abs(b - v), c = !0) : Math.abs(b - r) < n ? (g = b - a.y, n = Math.abs(b - r), c = !0) : Math.abs(b - t) < n && (g = b - a.y - a.height, + n = Math.abs(b - t), c = !0); + if (c) { + 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 d = this.graph.container; + b -= this.graph.panDy; + this.guideY.points = [new mxPoint(-this.graph.panDx, + b), new mxPoint(d.scrollWidth - 3 - this.graph.panDx, b)] + } + k = k || c + }, w = 0; w < this.states.length; w++) { + var u = this.states[w]; + null != u && (this.horizontal && (b.call(this, u.getCenterX()), b.call(this, u.x), b.call(this, u.x + u.width)), this.vertical && (l.call(this, u.getCenterY()), l.call(this, u.y), l.call(this, + u.y + u.height))) + }!h && null != this.guideX ? this.guideX.node.style.visibility = "hidden" : null != this.guideX && (this.guideX.node.style.visibility = "visible", this.guideX.redraw()); + !k && null != this.guideY ? this.guideY.node.style.visibility = + "hidden" : null != this.guideY && (this.guideY.node.style.visibility = "visible", this.guideY.redraw()); + c && (h || (c = a.x - (this.graph.snap(a.x / e - d.x) + d.x) * e, f = this.graph.snap(f / e) * e - c), k || (d = a.y - (this.graph.snap(a.y / e - d.y) + d.y) * e, g = this.graph.snap(g / e) * e - + d)); + b = new mxPoint(f, g) + } + return b +}; +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) +}; + +function mxStencil(a) { + this.desc = a; + this.parseDescription(); + this.parseConstraints() +} +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 a = this.desc.getAttribute("aspect"); + this.aspect = null != a ? a : "variable"; + a = this.desc.getAttribute("strokewidth"); + this.strokewidth = null != a ? a : "1" +}; +mxStencil.prototype.parseConstraints = function() { + var a = this.desc.getElementsByTagName("connections")[0]; + if (null != a && (a = mxUtils.getChildNodes(a), null != a && 0 < a.length)) { + this.constraints = []; + for (var b = 0; b < a.length; b++) this.constraints.push(this.parseConstraint(a[b])) + } +}; +mxStencil.prototype.parseConstraint = function(a) { + var b = Number(a.getAttribute("x")), + c = Number(a.getAttribute("y")); + a = "1" == a.getAttribute("perimeter"); + return new mxConnectionConstraint(new mxPoint(b, c), a) +}; +mxStencil.prototype.evaluateTextAttribute = function(a, b, c) { + b = this.evaluateAttribute(a, b, c); + a = a.getAttribute("localized"); + if (mxStencil.defaultLocalized && null == a || "1" == a) b = mxResources.get(b); + return b +}; +mxStencil.prototype.evaluateAttribute = function(a, b, c) { + b = a.getAttribute(b); + null == b && (a = mxUtils.getTextContent(a), null != a && (a = mxUtils.eval(a), "function" == typeof a && (b = a(c)))); + return b +}; +mxStencil.prototype.drawShape = function(a, b, c, d, e, f) { + this.drawChildren(a, b, c, d, e, f, this.bgNode, !1); + this.drawChildren(a, b, c, d, e, f, this.fgNode, !0) +}; +mxStencil.prototype.drawChildren = function(a, b, c, d, e, f, g, h) { + if (null != g) { + var k = mxUtils.getValue(b.style, mxConstants.STYLE_DIRECTION, null); + c = this.computeAspect(b.style, c, d, e, f, k); + d = Math.min(c.width, c.height); + d = "inherit" == this.strokewidth ? Number(mxUtils.getNumber(b.style, mxConstants.STYLE_STROKEWIDTH, 1)) : Number(this.strokewidth) * d; + a.setStrokeWidth(d); + for (g = g.firstChild; null != g;) g.nodeType == mxConstants.NODETYPE_ELEMENT && this.drawNode(a, b, g, c, h), g = g.nextSibling + } +}; +mxStencil.prototype.computeAspect = function(a, b, c, d, e, f) { + a = b; + b = d / this.w0; + var g = e / this.h0; + if (f = "north" == f || "south" == f) { + g = d / this.h0; + b = e / this.w0; + var h = (d - e) / 2; + a += h; + c -= h + } + "fixed" == this.aspect && (b = g = Math.min(b, g), f ? (a += (e - this.w0 * b) / 2, c += (d - this.h0 * g) / 2) : (a += (d - this.w0 * b) / 2, c += (e - this.h0 * g) / 2)); + return new mxRectangle(a, c, b, g) +}; +mxStencil.prototype.drawNode = function(a, b, c, d, e) { + var f = c.nodeName, + g = d.x, + h = d.y, + k = d.width, + l = d.height, + m = Math.min(k, l); + if ("save" == f) a.save(); + else if ("restore" == f) a.restore(); + else if ("path" == f) { + a.begin(); + for (c = c.firstChild; null != c;) c.nodeType == mxConstants.NODETYPE_ELEMENT && this.drawNode(a, b, c, d, e), c = c.nextSibling + } else if ("close" == f) a.close(); + else if ("move" == f) a.moveTo(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l); + else if ("line" == f) a.lineTo(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * + l); + else if ("quad" == f) a.quadTo(g + Number(c.getAttribute("x1")) * k, h + Number(c.getAttribute("y1")) * l, g + Number(c.getAttribute("x2")) * k, h + Number(c.getAttribute("y2")) * l); + else if ("curve" == f) a.curveTo(g + Number(c.getAttribute("x1")) * k, h + Number(c.getAttribute("y1")) * l, g + Number(c.getAttribute("x2")) * k, h + Number(c.getAttribute("y2")) * l, g + Number( + c.getAttribute("x3")) * k, h + Number(c.getAttribute("y3")) * l); + else if ("arc" == f) a.arcTo(Number(c.getAttribute("rx")) * k, Number(c.getAttribute("ry")) * l, Number(c.getAttribute("x-axis-rotation")), + Number(c.getAttribute("large-arc-flag")), Number(c.getAttribute("sweep-flag")), g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l); + else if ("rect" == f) a.rect(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l, Number(c.getAttribute("w")) * k, Number(c.getAttribute("h")) * l); + else if ("roundrect" == f) b = c.getAttribute("arcsize"), 0 == b && (b = 100 * mxConstants.RECTANGLE_ROUNDING_FACTOR), m = Number(c.getAttribute("w")) * k, d = Number(c.getAttribute("h")) * l, b = + Number(b) / 100, b = Math.min(m * b, d * b), a.roundrect(g + + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l, m, d, b, b); + else if ("ellipse" == f) a.ellipse(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l, Number(c.getAttribute("w")) * k, Number(c.getAttribute("h")) * l); + else if ("image" == f) b = this.evaluateAttribute(c, "src", b), a.image(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l, Number(c.getAttribute("w")) * k, Number(c.getAttribute( + "h")) * l, b, !1, "1" == c.getAttribute("flipH"), "1" == c.getAttribute("flipV")); + else if ("text" == f) { + m = this.evaluateTextAttribute(c, + "str", b); + d = "1" == c.getAttribute("vertical") ? -90 : 0; + if ("0" == c.getAttribute("align-shape")) { + var n = b.rotation, + p = 1 == mxUtils.getValue(b.style, mxConstants.STYLE_FLIPH, 0); + b = 1 == mxUtils.getValue(b.style, mxConstants.STYLE_FLIPV, 0); + d = p && b ? d - n : p || b ? d + n : d - n + } + d -= c.getAttribute("rotation"); + a.text(g + Number(c.getAttribute("x")) * k, h + Number(c.getAttribute("y")) * l, 0, 0, m, c.getAttribute("align") || "left", c.getAttribute("valign") || "top", !1, "", !1, !1, d) + } else if ("include-shape" == f) n = mxStencilRegistry.getStencil(c.getAttribute("name")), + null != n && (g += Number(c.getAttribute("x")) * k, h += Number(c.getAttribute("y")) * l, m = Number(c.getAttribute("w")) * k, d = Number(c.getAttribute("h")) * l, n.drawShape(a, b, g, h, m, d)); + else if ("fillstroke" == f) a.fillAndStroke(); + else if ("fill" == f) a.fill(); + else if ("stroke" == f) a.stroke(); + else if ("strokewidth" == f) a.setStrokeWidth(Number(c.getAttribute("width")) * m); + else if ("dashed" == f) a.setDashed("1" == c.getAttribute("dashed")); + else if ("dashpattern" == f) { + if (c = c.getAttribute("pattern"), null != c) { + c = c.split(" "); + k = []; + for (l = 0; l < + c.length; l++) 0 < c[l].length && k.push(Number(c[l]) * m); + c = k.join(" "); + a.setDashPattern(c) + } + } else "strokecolor" == f ? a.setStrokeColor(c.getAttribute("color")) : "linecap" == f ? a.setLineCap(c.getAttribute("cap")) : "linejoin" == f ? a.setLineJoin(c.getAttribute("join")) : + "miterlimit" == f ? a.setMiterLimit(Number(c.getAttribute("limit"))) : "fillcolor" == f ? a.setFillColor(c.getAttribute("color")) : "alpha" == f ? a.setAlpha(c.getAttribute("alpha")) : + "fontcolor" == f ? a.setFontColor(c.getAttribute("color")) : "fontstyle" == f ? a.setFontStyle(c.getAttribute("style")) : + "fontfamily" == f ? a.setFontFamily(c.getAttribute("family")) : "fontsize" == f && a.setFontSize(Number(c.getAttribute("size")) * m); + e && ("fillstroke" == f || "fill" == f || "stroke" == f) && a.setShadow(!1) +}; + +function mxShape(a) { + this.stencil = a; + this.strokewidth = 1; + this.rotation = 0; + this.opacity = 100; + this.flipV = this.flipH = !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(a) { + null == this.node && (this.node = this.create(a), null != a && a.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) ? 0.5 : 0 +}; +mxShape.prototype.create = function(a) { + var b = null; + return b = null != a.ownerSVGElement ? this.createSvg(a) : 8 == document.documentMode || this.dialect == mxConstants.DIALECT_SVG || this.dialect != mxConstants.DIALECT_VML && this.isHtmlAllowed() ? + this.createHtml(a) : this.createVml(a) +}; +mxShape.prototype.createSvg = function() { + return document.createElementNS(mxConstants.NS_SVG, "g") +}; +mxShape.prototype.createVml = function() { + var a = document.createElement(mxClient.VML_PREFIX + ":group"); + a.style.position = "absolute"; + return a +}; +mxShape.prototype.createHtml = function() { + var a = document.createElement("div"); + a.style.position = "absolute"; + return a +}; +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 a = this.points; + if (null != a && 0 < a.length && null != a[0]) { + this.bounds = new mxRectangle(Number(a[0].x), Number(a[0].y), 1, 1); + for (var b = 1; b < this.points.length; b++) null != a[b] && this.bounds.add(new mxRectangle(Number(a[b].x), Number(a[b].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 a = document.createElement(mxClient.VML_PREFIX + ":group"); + a.style.position = "absolute"; + a.style.width = this.node.style.width; + a.style.height = this.node.style.height; + return a +}; +mxShape.prototype.redrawShape = function() { + var a = this.createCanvas(); + for (a.pointerEvents = this.pointerEvents; this.node.hasChildNodes();) this.node.removeChild(this.node.lastChild); + this.paint(a); + this.node != a.root && this.node.insertAdjacentHTML("beforeend", a.root.outerHTML); + "DIV" == this.node.nodeName && 8 == document.documentMode && (this.node.style.filter = "", (null == this.stencil || !this.stencilPointerEvents) && mxUtils.addTransparentBackgroundFilter(this.node)); + this.destroyCanvas(a) +}; +mxShape.prototype.createCanvas = function() { + var a = null, + b = null; + if (null != this.node.ownerSVGElement) a = new mxSvgCanvas2D(this.node, !1), a.strokeTolerance = this.svgStrokeTolerance, a.blockImagePointerEvents = mxClient.IS_NS && !mxClient.IS_SF && ! + mxClient.IS_GC, b = this.getSvgScreenOffset(), 0 != b ? this.node.setAttribute("transform", "translate(" + b + "," + b + ")") : this.node.removeAttribute("transform"); + else { + this.updateVmlContainer(); + var c = Math.max(1, Math.round(this.bounds.width)), + d = Math.max(1, Math.round(this.bounds.height)), + b = 8 == document.documentMode && this.isParseVml() ? this.createVmlGroup() : this.node, + a = new mxVmlCanvas2D(b, !1); + "" != b.tagUrn && (b.coordsize = c * this.vmlScale + "," + d * this.vmlScale, a.scale(this.vmlScale), a.vmlScale = this.vmlScale); + b = this.scale; + a.translate(-Math.round(this.bounds.x / b), -Math.round(this.bounds.y / b)) + } + return a +}; +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 a = Math.max(1, Math.round(this.bounds.width)), + b = Math.max(1, Math.round(this.bounds.height)); + this.node.style.width = a + "px"; + this.node.style.height = b + "px"; + this.node.style.overflow = "visible" +}; +mxShape.prototype.destroyCanvas = function(a) { + if (a instanceof mxSvgCanvas2D) { + for (var b in a.gradients) { + var c = a.gradients[b]; + c.mxRefCount = (c.mxRefCount || 0) + 1 + } + this.releaseSvgGradients(this.oldGradients); + this.oldGradients = a.gradients + } +}; +mxShape.prototype.paint = function(a) { + var b = this.scale, + c = this.bounds.x / b, + d = this.bounds.y / b, + e = this.bounds.width / b, + f = this.bounds.height / b; + if (this.isPaintBoundsInverted()) var g = (e - f) / 2, + c = c + g, + d = d - g, + g = e, + e = f, + f = g; + this.updateTransform(a, c, d, e, f); + this.configureCanvas(a, c, d, e, f); + if (null != this.stencil) this.paintStencilShape(a, c, d, e, f); + else if (a.setStrokeWidth(this.strokewidth), null != this.points) { + c = []; + for (d = 0; d < this.points.length; d++) c.push(new mxPoint(this.points[d].x / b, this.points[d].y / b)); + this.paintEdgeShape(a, + c) + } else this.paintVertexShape(a, c, d, e, f) +}; +mxShape.prototype.configureCanvas = function(a, b, c, d, e) { + var f = null; + null != this.style && (f = this.style.dashPattern); + a.setAlpha(this.opacity / 100); + null != this.isShadow && a.setShadow(this.isShadow); + null != this.isDashed && a.setDashed(this.isDashed); + null != f && a.setDashPattern(f); + null != this.gradient ? (b = this.getGradientBounds(a, b, c, d, e), a.setGradient(this.fill, this.gradient, b.x, b.y, b.width, b.height, this.gradientDirection)) : a.setFillColor(this.fill); + a.setStrokeColor(this.stroke) +}; +mxShape.prototype.getGradientBounds = function(a, b, c, d, e) { + return new mxRectangle(b, c, d, e) +}; +mxShape.prototype.updateTransform = function(a, b, c, d, e) { + a.scale(this.scale); + a.rotate(this.getShapeRotation(), this.flipH, this.flipV, b + d / 2, c + e / 2) +}; +mxShape.prototype.paintStencilShape = function(a, b, c, d, e) { + this.stencilPointerEvents && (this.dialect == mxConstants.DIALECT_SVG ? this.addTransparentBackgroundRectangle(this.node, b, c, d, e) : 8 != document.documentMode && this.setTransparentBackgroundImage( + this.node)); + this.stencil.drawShape(a, this, b, c, d, e) +}; +mxShape.prototype.paintVertexShape = function(a, b, c, d, e) { + this.paintBackground(a, b, c, d, e); + a.setShadow(!1); + this.paintForeground(a, b, c, d, e) +}; +mxShape.prototype.paintBackground = function(a, b, c, d, e) {}; +mxShape.prototype.paintForeground = function(a, b, c, d, e) {}; +mxShape.prototype.paintEdgeShape = function(a, b) {}; +mxShape.prototype.getArcSize = function(a, b) { + var c = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, 100 * mxConstants.RECTANGLE_ROUNDING_FACTOR) / 100; + return Math.min(a * c, b * c) +}; +mxShape.prototype.paintGlassEffect = function(a, b, c, d, e, f) { + var g = Math.ceil(this.strokewidth / 2); + a.setGradient("#ffffff", "#ffffff", b, c, d, 0.6 * e, "south", 0.9, 0.1); + a.begin(); + f += 2 * g; + this.isRounded ? (a.moveTo(b - g + f, c - g), a.quadTo(b - g, c - g, b - g, c - g + f), a.lineTo(b - g, c + 0.4 * e), a.quadTo(b + 0.5 * d, c + 0.7 * e, b + d + g, c + 0.4 * e), a.lineTo(b + d + + g, c - g + f), a.quadTo(b + d + g, c - g, b + d + g - f, c - g)) : (a.moveTo(b - g, c - g), a.lineTo(b - g, c + 0.4 * e), a.quadTo(b + 0.5 * d, c + 0.7 * e, b + d + g, c + 0.4 * e), a.lineTo( + b + d + g, c - g)); + a.close(); + a.fill() +}; +mxShape.prototype.apply = function(a) { + this.state = a; + this.style = a.style; + if (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); + if ("north" == + this.direction || "south" == this.direction) a = this.flipH, this.flipH = this.flipV, this.flipV = a; + 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(a) { + null == a && (a = ""); + this.cursor = a; + null != this.node && (this.node.style.cursor = a) +}; +mxShape.prototype.getCursor = function() { + return this.cursor +}; +mxShape.prototype.updateBoundingBox = function() { + if (null != this.bounds) { + var a = this.createBoundingBox(); + if (null != a) { + this.augmentBoundingBox(a); + var b = this.getShapeRotation(); + 0 != b && (a = mxUtils.getBoundingBox(a, b)); + a.x = Math.floor(a.x); + a.y = Math.floor(a.y); + a.width = Math.ceil(a.width); + a.height = Math.ceil(a.height) + } + this.boundingBox = a + } +}; +mxShape.prototype.createBoundingBox = function() { + var a = this.bounds.clone(); + if (this.isPaintBoundsInverted()) { + var b = (a.width - a.height) / 2; + a.x += b; + a.y -= b; + b = a.width; + a.width = a.height; + a.height = b + } + return a +}; +mxShape.prototype.augmentBoundingBox = function(a) { + this.isShadow && (a.width += Math.ceil(mxConstants.SHADOW_OFFSET_X * this.scale), a.height += Math.ceil(mxConstants.SHADOW_OFFSET_Y * this.scale)); + var b = Math.ceil(this.strokewidth * this.scale); + a.grow(Math.ceil(b / 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 a = this.getRotation(); + 1 != mxUtils.getValue(this.style, mxConstants.STYLE_HORIZONTAL, 1) && (a += mxText.prototype.verticalTextRotation); + return a +}; +mxShape.prototype.getShapeRotation = function() { + var a = this.getRotation(); + null != this.direction && ("north" == this.direction ? a += 270 : "west" == this.direction ? a += 180 : "south" == this.direction && (a += 90)); + return a +}; +mxShape.prototype.addTransparentBackgroundRectangle = function(a, b, c, d, e) { + a = document.createElementNS(mxConstants.NS_SVG, "rect"); + a.setAttribute("x", b); + a.setAttribute("y", c); + a.setAttribute("width", d); + a.setAttribute("height", e); + a.setAttribute("fill", "none"); + a.setAttribute("stroke", "none"); + a.setAttribute("pointer-events", "all"); + this.node.appendChild(a) +}; +mxShape.prototype.setTransparentBackgroundImage = function(a) { + a.style.backgroundImage = "url('" + mxClient.imageBasePath + "/transparent.gif')" +}; +mxShape.prototype.releaseSvgGradients = function(a) { + if (null != a) + for (var b in a) { + var c = a[b]; + c.mxRefCount = (c.mxRefCount || 0) - 1; + 0 == c.mxRefCount && null != c.parentNode && c.parentNode.removeChild(c) + } +}; +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(a, b) { + mxStencilRegistry.stencils[a] = b + }, + getStencil: function(a) { + return mxStencilRegistry.stencils[a] + } + }, + mxMarker = { + markers: [], + addMarker: function(a, b) { + mxMarker.markers[a] = b + }, + createMarker: function(a, b, c, d, e, f, g, h, k, l) { + var m = mxMarker.markers[c]; + return null != m ? m(a, b, c, d, e, f, g, h, k, l) : null + } + }; +(function() { + function a(a, b, e, f, g, h, k, l, m, n) { + b = 1.118 * g * m; + l = 1.118 * h * m; + g *= k + m; + h *= k + m; + var p = f.clone(); + p.x -= b; + p.y -= l; + k = e != mxConstants.ARROW_CLASSIC ? 1 : 0.75; + f.x += -g * k - b; + f.y += -h * k - l; + return function() { + a.begin(); + a.moveTo(p.x, p.y); + a.lineTo(p.x - g - h / 2, p.y - h + g / 2); + e == mxConstants.ARROW_CLASSIC && a.lineTo(p.x - 3 * g / 4, p.y - 3 * h / 4); + a.lineTo(p.x + h / 2 - g, p.y - h - g / 2); + a.close(); + n ? a.fillAndStroke() : a.stroke() + } + } + + function b(a, b, e, f, g, h, k, l, m, n) { + l = e == mxConstants.ARROW_DIAMOND ? 0.7071 : 0.9862; + b = g * m * l; + l *= h * m; + g *= k + m; + h *= k + m; + var p = f.clone(); + p.x -= b; + p.y -= l; + f.x += -g - b; + f.y += -h - l; + var q = e == mxConstants.ARROW_DIAMOND ? 2 : 3.4; + return function() { + a.begin(); + a.moveTo(p.x, p.y); + a.lineTo(p.x - g / 2 - h / q, p.y + g / q - h / 2); + a.lineTo(p.x - g, p.y - h); + a.lineTo(p.x - g / 2 + h / q, p.y - h / 2 - g / q); + a.close(); + n ? a.fillAndStroke() : a.stroke() + } + } + mxMarker.addMarker("classic", a); + mxMarker.addMarker("block", a); + mxMarker.addMarker("open", function(a, b, e, f, g, h, k, l, m, n) { + b = 1.118 * g * m; + e = 1.118 * h * m; + g *= k + m; + h *= k + m; + var p = f.clone(); + p.x -= b; + p.y -= e; + f.x += 2 * -b; + f.y += 2 * -e; + return function() { + a.begin(); + a.moveTo(p.x - g - + h / 2, p.y - h + g / 2); + a.lineTo(p.x, p.y); + a.lineTo(p.x + h / 2 - g, p.y - h - g / 2); + a.stroke() + } + }); + mxMarker.addMarker("oval", function(a, b, e, f, g, h, k, l, m, n) { + var p = k / 2, + q = f.clone(); + f.x -= g * p; + f.y -= h * p; + return function() { + a.ellipse(q.x - p, q.y - p, k, k); + n ? a.fillAndStroke() : a.stroke() + } + }); + mxMarker.addMarker("diamond", b); + mxMarker.addMarker("diamondThin", b) +})(); + +function mxActor(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxActor, mxShape); +mxActor.prototype.paintVertexShape = function(a, b, c, d, e) { + a.translate(b, c); + a.begin(); + this.redrawPath(a, b, c, d, e); + a.fillAndStroke() +}; +mxActor.prototype.redrawPath = function(a, b, c, d, e) { + b = d / 3; + a.moveTo(0, e); + a.curveTo(0, 3 * e / 5, 0, 2 * e / 5, d / 2, 2 * e / 5); + a.curveTo(d / 2 - b, 2 * e / 5, d / 2 - b, 0, d / 2, 0); + a.curveTo(d / 2 + b, 0, d / 2 + b, 2 * e / 5, d / 2, 2 * e / 5); + a.curveTo(d, 2 * e / 5, d, 3 * e / 5, d, e); + a.close() +}; + +function mxCloud(a, b, c, d) { + mxActor.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxCloud, mxActor); +mxCloud.prototype.redrawPath = function(a, b, c, d, e) { + a.moveTo(0.25 * d, 0.25 * e); + a.curveTo(0.05 * d, 0.25 * e, 0, 0.5 * e, 0.16 * d, 0.55 * e); + a.curveTo(0, 0.66 * e, 0.18 * d, 0.9 * e, 0.31 * d, 0.8 * e); + a.curveTo(0.4 * d, e, 0.7 * d, e, 0.8 * d, 0.8 * e); + a.curveTo(d, 0.8 * e, d, 0.6 * e, 0.875 * d, 0.5 * e); + a.curveTo(d, 0.3 * e, 0.8 * d, 0.1 * e, 0.625 * d, 0.2 * e); + a.curveTo(0.5 * d, 0.05 * e, 0.3 * d, 0.05 * e, 0.25 * d, 0.25 * e); + a.close() +}; + +function mxRectangleShape(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxRectangleShape, mxShape); +mxRectangleShape.prototype.isHtmlAllowed = function() { + return !this.isRounded && !this.glass && 0 == this.rotation +}; +mxRectangleShape.prototype.paintBackground = function(a, b, c, d, e) { + if (this.isRounded) { + var f = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, 100 * mxConstants.RECTANGLE_ROUNDING_FACTOR) / 100, + f = Math.min(d * f, e * f); + a.roundrect(b, c, d, e, f, f) + } else a.rect(b, c, d, e); + a.fillAndStroke() +}; +mxRectangleShape.prototype.paintForeground = function(a, b, c, d, e) { + this.glass && this.paintGlassEffect(a, b, c, d, e, this.getArcSize(d + this.strokewidth, e + this.strokewidth)) +}; +mxRectangleShape.prototype.redrawHtmlShape = function() { + this.updateHtmlBounds(this.node); + this.updateHtmlFilters(this.node); + this.updateHtmlColors(this.node) +}; +mxRectangleShape.prototype.updateHtmlBounds = function(a) { + var b = 9 <= document.documentMode ? 0 : Math.ceil(this.strokewidth * this.scale); + a.style.borderWidth = Math.max(1, b) + "px"; + a.style.overflow = "hidden"; + a.style.left = Math.round(this.bounds.x - b / 2) + "px"; + a.style.top = Math.round(this.bounds.y - b / 2) + "px"; + "CSS1Compat" == document.compatMode && (b = -b); + a.style.width = Math.round(Math.max(0, this.bounds.width + b)) + "px"; + a.style.height = Math.round(Math.max(0, this.bounds.height + b)) + "px" +}; +mxRectangleShape.prototype.updateHtmlColors = function(a) { + var b = this.stroke; + null != b && b != mxConstants.NONE ? (a.style.borderColor = b, this.isDashed ? a.style.borderStyle = "dashed" : 0 < this.strokewidth && (a.style.borderStyle = "solid"), a.style.borderWidth = Math + .max(1, Math.ceil(this.strokewidth * this.scale)) + "px") : a.style.borderWidth = "0px"; + b = this.fill; + null != b && b != mxConstants.NONE ? (a.style.backgroundColor = b, a.style.backgroundImage = "none") : this.pointerEvents ? a.style.backgroundColor = "transparent" : 8 == document.documentMode ? + mxUtils.addTransparentBackgroundFilter(a) : this.setTransparentBackgroundImage(a) +}; +mxRectangleShape.prototype.updateHtmlFilters = function(a) { + var b = ""; + 100 > this.opacity && (b += "alpha(opacity\x3d" + this.opacity + ")"); + this.isShadow && (b += "progid:DXImageTransform.Microsoft.dropShadow (OffX\x3d'" + Math.round(mxConstants.SHADOW_OFFSET_X * this.scale) + "', OffY\x3d'" + Math.round(mxConstants.SHADOW_OFFSET_Y * + this.scale) + "', Color\x3d'" + mxConstants.SHADOWCOLOR + "')"); + if (this.gradient) { + var c = this.fill, + d = this.gradient, + e = "0", + f = { + east: 0, + south: 1, + west: 2, + north: 3 + }, + g = null != this.direction ? f[this.direction] : 0; + null != + this.gradientDirection && (g = mxUtils.mod(g + f[this.gradientDirection] - 1, 4)); + 1 == g ? (e = "1", f = c, c = d, d = f) : 2 == g ? (f = c, c = d, d = f) : 3 == g && (e = "1"); + b += "progid:DXImageTransform.Microsoft.gradient(startColorStr\x3d'" + c + "', endColorStr\x3d'" + d + "', gradientType\x3d'" + e + "')" + } + a.style.filter = b +}; + +function mxEllipse(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxEllipse, mxShape); +mxEllipse.prototype.paintVertexShape = function(a, b, c, d, e) { + a.ellipse(b, c, d, e); + a.fillAndStroke() +}; + +function mxDoubleEllipse(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxDoubleEllipse, mxShape); +mxDoubleEllipse.prototype.vmlScale = 10; +mxDoubleEllipse.prototype.paintBackground = function(a, b, c, d, e) { + a.ellipse(b, c, d, e); + a.fillAndStroke() +}; +mxDoubleEllipse.prototype.paintForeground = function(a, b, c, d, e) { + var f = Math.min(4, Math.min(d / 5, e / 5)); + d -= 2 * f; + e -= 2 * f; + 0 < d && 0 < e && a.ellipse(b + f, c + f, d, e); + a.stroke() +}; + +function mxRhombus(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxRhombus, mxShape); +mxRhombus.prototype.paintVertexShape = function(a, b, c, d, e) { + var f = d / 2, + g = e / 2; + a.begin(); + a.moveTo(b + f, c); + a.lineTo(b + d, c + g); + a.lineTo(b + f, c + e); + a.lineTo(b, c + g); + a.close(); + a.fillAndStroke() +}; + +function mxPolyline(a, b, c) { + mxShape.call(this); + this.points = a; + this.stroke = b; + this.strokewidth = null != c ? c : 1 +} +mxUtils.extend(mxPolyline, mxShape); +mxPolyline.prototype.getRotation = function() { + return 0 +}; +mxPolyline.prototype.paintEdgeShape = function(a, b) { + this.paintLine(a, b, this.isRounded) +}; +mxPolyline.prototype.paintLine = function(a, b, c) { + var d = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2, + e = b[0], + f = b[b.length - 1]; + a.begin(); + a.moveTo(e.x, e.y); + for (var g = 1; g < b.length - 1; g++) { + var h = b[g], + k = e.x - h.x, + e = e.y - h.y; + if (c && g < b.length - 1 && (0 != k || 0 != e)) { + var l = Math.sqrt(k * k + e * e), + k = k * Math.min(d, l / 2) / l, + e = e * Math.min(d, l / 2) / l; + a.lineTo(h.x + k, h.y + e); + e = b[g + 1]; + k = e.x - h.x; + e = e.y - h.y; + l = Math.max(1, Math.sqrt(k * k + e * e)); + k = k * Math.min(d, l / 2) / l; + e = e * Math.min(d, l / 2) / l; + k = h.x + k; + e = h.y + e; + a.quadTo(h.x, + h.y, k, e); + h = new mxPoint(k, e) + } else a.lineTo(h.x, h.y); + e = h + } + a.lineTo(f.x, f.y); + a.stroke() +}; + +function mxArrow(a, b, c, d, e, f, g) { + mxShape.call(this); + this.points = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1; + this.arrowWidth = null != e ? e : mxConstants.ARROW_WIDTH; + this.spacing = null != f ? f : mxConstants.ARROW_SPACING; + this.endSize = null != g ? g : mxConstants.ARROW_SIZE +} +mxUtils.extend(mxArrow, mxShape); +mxArrow.prototype.paintEdgeShape = function(a, b) { + var c = mxConstants.ARROW_SPACING, + d = mxConstants.ARROW_WIDTH, + e = mxConstants.ARROW_SIZE, + f = b[0], + g = b[b.length - 1], + h = g.x - f.x, + k = g.y - f.y, + l = Math.sqrt(h * h + k * k), + m = l - 2 * c - e, + h = h / l, + k = k / l, + l = d * k / 3, + d = -d * h / 3, + e = f.x - l / 2 + c * h, + f = f.y - d / 2 + c * k, + n = e + l, + p = f + d, + q = n + m * h, + m = p + m * k, + s = q + l, + r = m + d, + t = s - 3 * l, + v = r - 3 * d; + a.begin(); + a.moveTo(e, f); + a.lineTo(n, p); + a.lineTo(q, m); + a.lineTo(s, r); + a.lineTo(g.x - c * h, g.y - c * k); + a.lineTo(t, v); + a.lineTo(t + l, v + d); + a.close(); + a.fillAndStroke() +}; + +function mxText(a, b, c, d, e, f, g, h, k, l, m, n, p, q, s, r, t, v, w, u) { + mxShape.call(this); + this.value = a; + this.bounds = b; + this.color = null != e ? e : "black"; + this.align = null != c ? c : ""; + this.valign = null != d ? d : ""; + this.family = null != f ? f : mxConstants.DEFAULT_FONTFAMILY; + this.size = null != g ? g : mxConstants.DEFAULT_FONTSIZE; + this.fontStyle = null != h ? h : mxConstants.DEFAULT_FONTSTYLE; + this.spacing = parseInt(k || 2); + this.spacingTop = this.spacing + parseInt(l || 0); + this.spacingRight = this.spacing + parseInt(m || 0); + this.spacingBottom = this.spacing + parseInt(n || 0); + this.spacingLeft = this.spacing + parseInt(p || 0); + this.horizontal = null != q ? q : !0; + this.background = s; + this.border = r; + this.wrap = null != t ? t : !1; + this.clipped = null != v ? v : !1; + this.overflow = null != w ? w : "visible"; + this.labelPadding = null != u ? u : 0; + this.rotation = 0 +} +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 a = this.node; + 8 == document.documentMode && null != a.firstChild && (a = a.firstChild, null != a.firstChild && (a = a.firstChild)); + this.boundingBox = this.bounds.clone(); + var b = this.getTextRotation(); + if (!this.ignoreStringSize && null != a && "fill" != this.overflow && (!this.clipped || !this.ignoreClippedStringSize)) { + var c = null, + d = null; + if (null != a.ownerSVGElement) + if (null != a.firstChild && null != a.firstChild.firstChild && "foreignObject" == a.firstChild.firstChild.nodeName) a = a.firstChild.firstChild, + c = this.wrap ? this.bounds.width : parseInt(a.getAttribute("width")) * this.scale, d = parseInt(a.getAttribute("height")) * this.scale; + else { + b = a.getBBox(); + if (0 == b.width && 0 == b.height) return; + this.boundingBox = new mxRectangle(b.x, b.y, b.width, b.height); + b = 0 + } else d = this.state.view.textDiv, null != this.offsetWidth && null != this.offsetHeight ? (c = this.wrap ? this.bounds.width : this.offsetWidth * this.scale, d = this.offsetHeight * this.scale) : + null != d ? (this.updateFont(d), this.updateSize(d), mxUtils.isNode(this.value) ? d.innerHTML = this.value.outerHTML : + (c = this.replaceLinefeeds ? this.value.replace(/\n/g, "\x3cbr/\x3e") : this.value, d.innerHTML = c), c = this.wrap ? this.bounds.width : d.offsetWidth * this.scale, d = d.offsetHeight * + this.scale) : (c = this.wrap ? this.bounds.width : a.offsetWidth * this.scale, d = a.offsetHeight * this.scale); + null != c && null != d && (this.boundingBox = new mxRectangle(this.bounds.x + this.margin.x * c, this.bounds.y + this.margin.y * d, c, d)) + } else this.boundingBox.x += this.margin.x * this.boundingBox.width, this.boundingBox.y += this.margin.y * this.boundingBox.height; + null != + this.boundingBox && (0 != b && (b = mxUtils.getBoundingBox(this.boundingBox, b), this.boundingBox.x = b.x, this.boundingBox.y = b.y, mxClient.IS_QUIRKS || (this.boundingBox.width = b.width, + this.boundingBox.height = b.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(a, b, c, d, e) { + mxShape.prototype.configureCanvas.apply(this, arguments); + a.setFontColor(this.color); + a.setFontBackgroundColor(this.background); + a.setFontBorderColor(this.border); + a.setFontFamily(this.family); + a.setFontSize(this.size); + a.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(a) { + var b = this.scale, + c = this.bounds.x / b, + d = this.bounds.y / b, + e = this.bounds.width / b, + b = this.bounds.height / b; + this.updateTransform(a, c, d, e, b); + this.configureCanvas(a, c, d, e, b); + var f = mxUtils.isNode(this.value) || this.dialect == mxConstants.DIALECT_STRICTHTML, + g = f || a instanceof mxVmlCanvas2D ? "html" : "", + h = this.value; + !f && "html" == g && (h = mxUtils.htmlEntities(h, !1)); + h = !mxUtils.isNode(this.value) && this.replaceLinefeeds && "html" == g ? h.replace(/\n/g, "\x3cbr/\x3e") : h; + a.text(c, d, e, b, h, this.align, + this.valign, this.wrap, g, "fill" == this.overflow, this.clipped, this.getTextRotation()) +}; +mxText.prototype.redrawHtmlShape = function() { + var a = this.node.style; + a.opacity = 1 > this.opacity ? this.opacity : ""; + a.overflow = ""; + a.width = ""; + a.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 a = this.getTextRotation(), + b = this.node.style, + c = this.margin.x, + d = this.margin.y; + 0 != a ? (b[mxClient.CSS_PREFIX + "TransformOrigin"] = 100 * -c + "% " + 100 * -d + "%", b[mxClient.CSS_PREFIX + "Transform"] = "translate(" + 100 * c + "%," + 100 * d + "%)scale(" + this.scale + + ") rotate(" + a + "deg)") : (b[mxClient.CSS_PREFIX + "TransformOrigin"] = "0% 0%", b[mxClient.CSS_PREFIX + "Transform"] = "scale(" + this.scale + ")translate(" + 100 * c + "%," + 100 * d + + "%)"); + b.left = Math.round(this.bounds.x) + "px"; + b.top = Math.round(this.bounds.y) + + "px" +}; +mxText.prototype.updateHtmlFilter = function() { + var a = this.node.style, + b = this.margin.x, + c = this.margin.y, + d = this.scale; + a.filter = ""; + var e = 0, + f = 0, + g = null != this.state ? this.state.view.textDiv : null; + if (null != g) { + g.style.overflow = ""; + g.style.height = ""; + g.style.width = ""; + this.updateFont(g); + this.updateSize(g); + if (mxUtils.isNode(this.value)) g.innerHTML = this.value.outerHTML; + else { + var h = this.value; + this.dialect != mxConstants.DIALECT_STRICTHTML && (h = mxUtils.htmlEntities(h, !1)); + h = this.replaceLinefeeds ? h.replace(/\n/g, "\x3cbr/\x3e") : h; + g.innerHTML = h + } + e = g.offsetWidth + 2; + f = g.offsetHeight + 2 + } else e = this.node.offsetWidth, f = this.node.offsetHeight + 1; + this.offsetWidth = e; + this.offsetHeight = f; + g = this.bounds.width / d; + h = this.bounds.height / d; + mxClient.IS_QUIRKS && (this.clipped || "fill" == this.overflow) && 0 < h ? (h = Math.min(h, f), a.height = Math.round(h + 1) + "px") : h = f; + "fill" != this.overflow && (mxClient.IS_QUIRKS && (this.clipped || this.wrap) && 0 < g ? (g = Math.min(g, e), a.width = Math.round(g) + "px") : g = e); + var h = h * d, + g = g * d, + e = this.getTextRotation() * (Math.PI / 180), + f = parseFloat(parseFloat(Math.cos(e)).toFixed(8)), + k = parseFloat(parseFloat(Math.sin(-e)).toFixed(8)), + e = e % (2 * Math.PI); + 0 > e && (e += 2 * Math.PI); + e %= Math.PI; + e > Math.PI / 2 && (e = Math.PI - e); + var l = Math.cos(e), + m = Math.sin(-e), + b = g * -(b + 0.5), + c = h * -(c + 0.5), + n = (h - h * l + g * m) / 2 + k * b - f * c; + 0 != e && (a.filter = "progid:DXImageTransform.Microsoft.Matrix(M11\x3d" + f + ", M12\x3d" + k + ", M21\x3d" + -k + ", M22\x3d" + f + ", sizingMethod\x3d'auto expand')"); + a.zoom = d; + a.left = Math.round(this.bounds.x + ((g - g * l + h * m) / 2 - f * b - k * c) - g / 2) + "px"; + a.top = Math.round(this.bounds.y + n - h / 2) + "px" +}; +mxText.prototype.updateValue = function() { + if (mxUtils.isNode(this.value)) this.node.innerHTML = "", this.node.appendChild(this.value); + else { + var a = this.value; + this.dialect != mxConstants.DIALECT_STRICTHTML && (a = mxUtils.htmlEntities(a, !1)); + var a = this.replaceLinefeeds ? a.replace(/\n/g, "\x3cbr/\x3e") : a, + b = null != this.background && this.background != mxConstants.NONE ? this.background : null, + c = null != this.border && this.border != mxConstants.NONE ? this.border : null; + if (null != b || null != c) + if ("fill" == this.overflow) null != b && (this.node.style.backgroundColor = + b), null != c && (this.node.style.border = "1px solid " + c); + else { + var d = ""; + null != b && (d += "background-color:" + b + ";"); + null != c && (d += "border:1px solid " + c + ";"); + a = '\x3cdiv style\x3d"zoom:1;' + d + "display:inline-block;_display:inline;padding-bottom:1px;padding-right:1px;line-height:" + this.node.style.lineHeight + '"\x3e' + a + "\x3c/div\x3e"; + this.node.style.lineHeight = "" + } + this.node.innerHTML = a + } +}; +mxText.prototype.updateFont = function(a) { + a = a.style; + a.lineHeight = Math.round(this.size * mxConstants.LINE_HEIGHT) + "px"; + a.fontSize = Math.round(this.size) + "px"; + a.fontFamily = this.family; + a.verticalAlign = "top"; + a.color = this.color; + a.fontWeight = (this.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD ? "bold" : ""; + a.fontStyle = (this.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC ? "italic" : ""; + a.fontDecoration = (this.fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE ? "underline" : ""; + a.textAlign = + this.align == mxConstants.ALIGN_CENTER ? "center" : this.align == mxConstants.ALIGN_RIGHT ? "right" : "left" +}; +mxText.prototype.updateSize = function(a) { + var b = Math.round(this.bounds.width / this.scale), + c = Math.round(this.bounds.height / this.scale); + a = a.style; + this.clipped ? (a.overflow = "hidden", 0 < c && (a.maxHeight = c + "px"), 0 < b && (a.width = b + "px")) : "fill" == this.overflow && (a.width = b + "px", 0 < c && (a.maxHeight = c + "px")); + this.wrap ? (!this.clipped && 0 < b && (a.width = b + "px"), a.whiteSpace = "normal") : a.whiteSpace = "nowrap" +}; +mxText.prototype.updateMargin = function() { + this.margin = mxUtils.getAlignmentAsPoint(this.align, this.valign) +}; +mxText.prototype.getSpacing = function() { + var a = 0, + b = 0, + a = this.align == mxConstants.ALIGN_CENTER ? (this.spacingLeft - this.spacingRight) / 2 : this.align == mxConstants.ALIGN_RIGHT ? -this.spacingRight - this.baseSpacingRight : this.spacingLeft + + this.baseSpacingLeft, + b = this.valign == mxConstants.ALIGN_MIDDLE ? (this.spacingTop - this.spacingBottom) / 2 : this.valign == mxConstants.ALIGN_BOTTOM ? -this.spacingBottom - this.baseSpacingBottom : this.spacingTop + + this.baseSpacingTop; + return new mxPoint(a, b) +}; + +function mxTriangle() { + mxActor.call(this) +} +mxUtils.extend(mxTriangle, mxActor); +mxTriangle.prototype.redrawPath = function(a, b, c, d, e) { + a.moveTo(0, 0); + a.lineTo(d, 0.5 * e); + a.lineTo(0, e); + a.close() +}; + +function mxHexagon() { + mxActor.call(this) +} +mxUtils.extend(mxHexagon, mxActor); +mxHexagon.prototype.redrawPath = function(a, b, c, d, e) { + a.moveTo(0.25 * d, 0); + a.lineTo(0.75 * d, 0); + a.lineTo(d, 0.5 * e); + a.lineTo(0.75 * d, e); + a.lineTo(0.25 * d, e); + a.lineTo(0, 0.5 * e); + a.close() +}; + +function mxLine(a, b, c) { + mxShape.call(this); + this.bounds = a; + this.stroke = b; + this.strokewidth = null != c ? c : 1 +} +mxUtils.extend(mxLine, mxShape); +mxLine.prototype.paintVertexShape = function(a, b, c, d, e) { + c += e / 2; + a.begin(); + a.moveTo(b, c); + a.lineTo(b + d, c); + a.stroke() +}; + +function mxImageShape(a, b, c, d, e) { + mxShape.call(this); + this.bounds = a; + this.image = b; + this.fill = c; + this.stroke = d; + this.strokewidth = null != e ? e : 1; + this.shadow = !1 +} +mxUtils.extend(mxImageShape, mxRectangleShape); +mxImageShape.prototype.preserveImageAspect = !0; +mxImageShape.prototype.getSvgScreenOffset = function() { + return !mxClient.IS_IE ? 0.5 : 0 +}; +mxImageShape.prototype.apply = function(a) { + 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 a = document.createElement("div"); + a.style.position = "absolute"; + return a +}; +mxImageShape.prototype.paintVertexShape = function(a, b, c, d, e) { + if (null != this.image) { + var f = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_BACKGROUND, null), + g = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_BORDER, null); + if (null != f || null != g) a.setFillColor(f), a.setStrokeColor(g), a.rect(b, c, d, e), a.fillAndStroke(); + a.image(b, c, d, e, this.image, this.preserveImageAspect, !1, !1) + } else mxRectangleShape.prototype.paintBackground.apply(this, arguments) +}; +mxImageShape.prototype.redrawHtmlShape = 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 = 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 = ""; + if (null != this.image) { + var a = document.createElement(mxClient.IS_IE6 || null == mxClient.CSS_PREFIX && 0 != + this.rotation ? mxClient.VML_PREFIX + ":image" : "img"); + a.style.position = "absolute"; + a.src = this.image; + var b = 100 > this.opacity ? "alpha(opacity\x3d" + this.opacity + ")" : ""; + this.node.style.filter = b; + this.flipH && this.flipV ? b += "progid:DXImageTransform.Microsoft.BasicImage(rotation\x3d2)" : this.flipH ? b += "progid:DXImageTransform.Microsoft.BasicImage(mirror\x3d1)" : this.flipV && (b += + "progid:DXImageTransform.Microsoft.BasicImage(rotation\x3d2, mirror\x3d1)"); + a.style.filter != b && (a.style.filter = b); + "image" == a.nodeName ? a.style.rotation = + this.rotation : a.style[mxClient.CSS_PREFIX + "Transform"] = "rotate(" + this.rotation + "deg)"; + a.style.width = this.node.style.width; + a.style.height = this.node.style.height; + this.node.style.backgroundImage = ""; + this.node.appendChild(a) + } else this.setTransparentBackgroundImage(this.node) +}; + +function mxLabel(a, b, c, d) { + mxRectangleShape.call(this, a, b, c, d) +} +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(a) { + 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(a, b, c, d, e) { + this.paintImage(a, b, c, d, e); + this.paintIndicator(a, b, c, d, e); + mxRectangleShape.prototype.paintForeground.apply(this, arguments) +}; +mxLabel.prototype.paintImage = function(a, b, c, d, e) { + null != this.image && (b = this.getImageBounds(b, c, d, e), a.image(b.x, b.y, b.width, b.height, this.image, !1, !1, !1)) +}; +mxLabel.prototype.getImageBounds = function(a, b, c, d) { + var e = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_ALIGN, mxConstants.ALIGN_LEFT), + f = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE), + g = mxUtils.getNumber(this.style, mxConstants.STYLE_IMAGE_WIDTH, mxConstants.DEFAULT_IMAGESIZE), + h = mxUtils.getNumber(this.style, mxConstants.STYLE_IMAGE_HEIGHT, mxConstants.DEFAULT_IMAGESIZE), + k = mxUtils.getNumber(this.style, mxConstants.STYLE_SPACING, this.spacing) + 5; + a = e == mxConstants.ALIGN_CENTER ? + a + (c - g) / 2 : e == mxConstants.ALIGN_RIGHT ? a + (c - g - k) : a + k; + b = f == mxConstants.ALIGN_TOP ? b + k : f == mxConstants.ALIGN_BOTTOM ? b + (d - h - k) : b + (d - h) / 2; + return new mxRectangle(a, b, g, h) +}; +mxLabel.prototype.paintIndicator = function(a, b, c, d, e) { + null != this.indicator ? (this.indicator.bounds = this.getIndicatorBounds(b, c, d, e), this.indicator.paint(a)) : null != this.indicatorImage && (b = this.getIndicatorBounds(b, c, d, e), a.image( + b.x, b.y, b.width, b.height, this.indicatorImage, !1, !1, !1)) +}; +mxLabel.prototype.getIndicatorBounds = function(a, b, c, d) { + var e = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_ALIGN, mxConstants.ALIGN_LEFT), + f = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE), + g = mxUtils.getNumber(this.style, mxConstants.STYLE_INDICATOR_WIDTH, this.indicatorSize), + h = mxUtils.getNumber(this.style, mxConstants.STYLE_INDICATOR_HEIGHT, this.indicatorSize), + k = this.spacing + 5; + a = e == mxConstants.ALIGN_RIGHT ? a + (c - g - k) : e == mxConstants.ALIGN_CENTER ? a + (c - g) / + 2 : a + k; + b = f == mxConstants.ALIGN_BOTTOM ? b + (d - h - k) : f == mxConstants.ALIGN_TOP ? b + k : b + (d - h) / 2; + return new mxRectangle(a, b, g, h) +}; +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 a = document.createElement("img"); + a.style.position = "relative"; + a.setAttribute("border", "0"); + var b = this.getImageBounds(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height); + b.x -= this.bounds.x; + b.y -= this.bounds.y; + a.style.left = Math.round(b.x) + "px"; + a.style.top = Math.round(b.y) + "px"; + a.style.width = + Math.round(b.width) + "px"; + a.style.height = Math.round(b.height) + "px"; + a.src = this.image; + this.node.appendChild(a) + } +}; + +function mxCylinder(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxCylinder, mxShape); +mxCylinder.prototype.maxHeight = 40; +mxCylinder.prototype.svgStrokeTolerance = 0; +mxCylinder.prototype.paintVertexShape = function(a, b, c, d, e) { + a.translate(b, c); + a.begin(); + this.redrawPath(a, b, c, d, e, !1); + a.fillAndStroke(); + a.setShadow(!1); + a.begin(); + this.redrawPath(a, b, c, d, e, !0); + a.stroke() +}; +mxCylinder.prototype.redrawPath = function(a, b, c, d, e, f) { + b = Math.min(this.maxHeight, Math.round(e / 5)); + if (f && null != this.fill || !f && null == this.fill) a.moveTo(0, b), a.curveTo(0, 2 * b, d, 2 * b, d, b), f || (a.stroke(), a.begin()); + f || (a.moveTo(0, b), a.curveTo(0, -b / 3, d, -b / 3, d, b), a.lineTo(d, e - b), a.curveTo(d, e + b / 3, 0, e + b / 3, 0, e - b), a.close()) +}; + +function mxConnector(a, b, c) { + mxPolyline.call(this, a, b, c) +} +mxUtils.extend(mxConnector, mxPolyline); +mxConnector.prototype.paintEdgeShape = function(a, b) { + var c = this.createMarker(a, b, !0), + d = this.createMarker(a, b, !1); + null == this.style || 1 != this.style[mxConstants.STYLE_CURVED] ? this.paintLine(a, b, this.isRounded) : this.paintCurvedLine(a, b); + a.setFillColor(this.stroke); + a.setShadow(!1); + a.setDashed(!1); + null != c && c(); + null != d && d() +}; +mxConnector.prototype.paintCurvedLine = function(a, b) { + a.begin(); + var c = b[0], + d = b.length; + a.moveTo(c.x, c.y); + for (c = 1; c < d - 2; c++) { + var e = b[c], + f = b[c + 1]; + a.quadTo(e.x, e.y, (e.x + f.x) / 2, (e.y + f.y) / 2) + } + e = b[d - 2]; + f = b[d - 1]; + a.quadTo(e.x, e.y, f.x, f.y); + a.stroke() +}; +mxConnector.prototype.createMarker = function(a, b, c) { + var d = b.length, + e = c ? b[1] : b[d - 2]; + b = c ? b[0] : b[d - 1]; + var d = b.x - e.x, + f = b.y - e.y, + g = Math.max(1, Math.sqrt(d * d + f * f)), + e = d / g, + d = f / g, + f = mxUtils.getNumber(this.style, c ? mxConstants.STYLE_STARTSIZE : mxConstants.STYLE_ENDSIZE, mxConstants.DEFAULT_MARKERSIZE), + g = mxUtils.getValue(this.style, c ? mxConstants.STYLE_STARTARROW : mxConstants.STYLE_ENDARROW); + return mxMarker.createMarker(a, this, g, b, e, d, f, c, this.strokewidth, 0 != this.style[c ? mxConstants.STYLE_STARTFILL : mxConstants.STYLE_ENDFILL]) +}; +mxConnector.prototype.augmentBoundingBox = function(a) { + mxShape.prototype.augmentBoundingBox.apply(this, arguments); + var b = 0; + mxUtils.getValue(this.style, mxConstants.STYLE_STARTARROW, mxConstants.NONE) != mxConstants.NONE && (b = mxUtils.getNumber(this.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_MARKERSIZE) + + 1); + mxUtils.getValue(this.style, mxConstants.STYLE_ENDARROW, mxConstants.NONE) != mxConstants.NONE && (b = Math.max(b, mxUtils.getNumber(this.style, mxConstants.STYLE_ENDSIZE, mxConstants.DEFAULT_MARKERSIZE)) + + 1); + a.grow(Math.ceil(b * this.scale)) +}; + +function mxSwimlane(a, b, c, d) { + mxShape.call(this); + this.bounds = a; + this.fill = b; + this.stroke = c; + this.strokewidth = null != d ? d : 1 +} +mxUtils.extend(mxSwimlane, mxShape); +mxSwimlane.prototype.imageSize = 16; +mxSwimlane.prototype.getGradientBounds = function(a, b, c, d, e) { + a = Math.min(e, mxUtils.getValue(this.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)); + return new mxRectangle(b, c, d, a) +}; +mxSwimlane.prototype.getRotation = function() { + var a = mxShape.prototype.getRotation.apply(this, arguments); + 1 != mxUtils.getValue(this.style, mxConstants.STYLE_HORIZONTAL, 1) && (a += mxText.prototype.verticalTextRotation); + return a +}; +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(a, b, c) { + a = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, 100 * mxConstants.RECTANGLE_ROUNDING_FACTOR) / 100; + return 3 * c * a +}; +mxSwimlane.prototype.paintVertexShape = function(a, b, c, d, e) { + var f = Math.min(e, mxUtils.getValue(this.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)), + g = mxUtils.getValue(this.style, mxConstants.STYLE_SWIMLANE_FILLCOLOR, mxConstants.NONE), + h = 1 == mxUtils.getValue(this.style, mxConstants.STYLE_SWIMLANE_LINE, 1), + k = 0; + a.translate(b, c); + this.isRounded ? (k = this.getArcSize(d, e, f), this.paintRoundedSwimlane(a, b, c, d, e, f, k, g, h)) : this.paintSwimlane(a, b, c, d, e, f, g, h); + g = mxUtils.getValue(this.style, mxConstants.STYLE_SEPARATORCOLOR, + mxConstants.NONE); + this.paintSeparator(a, d, f, e, g); + null != this.image && (e = this.getImageBounds(b, f, d, e), a.image(e.x - b, e.y - c, e.width, e.height, this.image, !1, !1, !1)); + this.glass && (a.setShadow(!1), this.paintGlassEffect(a, 0, 0, d, f, k)) +}; +mxSwimlane.prototype.paintSwimlane = function(a, b, c, d, e, f, g, h) { + g != mxConstants.NONE && (a.save(), a.setFillColor(g), a.rect(0, 0, d, e), a.fillAndStroke(), a.restore(), a.setShadow(!1)); + a.begin(); + a.moveTo(0, f); + a.lineTo(0, 0); + a.lineTo(d, 0); + a.lineTo(d, f); + h && a.close(); + a.fillAndStroke(); + f < e && g == mxConstants.NONE && (a.pointerEvents = !1, a.begin(), a.moveTo(0, f), a.lineTo(0, e), a.lineTo(d, e), a.lineTo(d, f), a.stroke()) +}; +mxSwimlane.prototype.paintRoundedSwimlane = function(a, b, c, d, e, f, g, h, k) { + h != mxConstants.NONE && (a.save(), a.setFillColor(h), a.roundrect(0, 0, d, e, g, g), a.fillAndStroke(), a.restore(), a.setShadow(!1)); + a.begin(); + a.moveTo(d, f); + a.lineTo(d, g); + a.quadTo(d, 0, d - Math.min(d / 2, g), 0); + a.lineTo(Math.min(d / 2, g), 0); + a.quadTo(0, 0, 0, g); + a.lineTo(0, f); + k && a.close(); + a.fillAndStroke(); + f < e && h == mxConstants.NONE && (a.pointerEvents = !1, a.begin(), a.moveTo(0, f), a.lineTo(0, e - g), a.quadTo(0, e, Math.min(d / 2, g), e), a.lineTo(d - Math.min(d / 2, g), e), + a.quadTo(d, e, d, e - g), a.lineTo(d, f), a.stroke()) +}; +mxSwimlane.prototype.paintSeparator = function(a, b, c, d, e) { + e != mxConstants.NONE && (a.setStrokeColor(e), a.setDashed(!0), a.begin(), a.moveTo(b, c), a.lineTo(b, d), a.stroke(), a.setDashed(!1)) +}; +mxSwimlane.prototype.getImageBounds = function(a, b, c, d) { + return new mxRectangle(a + c - this.imageSize, b, this.imageSize, this.imageSize) +}; + +function mxGraphLayout(a) { + this.graph = a +} +mxGraphLayout.prototype.graph = null; +mxGraphLayout.prototype.useBoundingBox = !0; +mxGraphLayout.prototype.parent = null; +mxGraphLayout.prototype.moveCell = function(a, b, c) {}; +mxGraphLayout.prototype.execute = function(a) {}; +mxGraphLayout.prototype.getGraph = function() { + return this.graph +}; +mxGraphLayout.prototype.getConstraint = function(a, b, c, d) { + c = this.graph.view.getState(b); + b = null != c ? c.style : this.graph.getCellStyle(b); + return null != b ? b[a] : null +}; +mxGraphLayout.traverse = function(a, b, c, d, e) { + if (null != c && null != a) { + b = null != b ? b : !0; + e = e || []; + var f = mxCellPath.create(a); + if (null == e[f] && (e[f] = a, d = c(a, d), null == d || d)) + if (d = this.graph.model.getEdgeCount(a), 0 < d) + for (f = 0; f < d; f++) { + var g = this.graph.model.getEdgeAt(a, f), + h = this.graph.model.getTerminal(g, !0) == a; + if (!b || h) h = this.graph.view.getVisibleTerminal(g, !h), this.traverse(h, b, c, g, e) + } + } +}; +mxGraphLayout.prototype.isVertexMovable = function(a) { + return this.graph.isCellMovable(a) +}; +mxGraphLayout.prototype.isVertexIgnored = function(a) { + return !this.graph.getModel().isVertex(a) || !this.graph.isCellVisible(a) +}; +mxGraphLayout.prototype.isEdgeIgnored = function(a) { + var b = this.graph.getModel(); + return !b.isEdge(a) || !this.graph.isCellVisible(a) || null == b.getTerminal(a, !0) || null == b.getTerminal(a, !1) +}; +mxGraphLayout.prototype.setEdgeStyleEnabled = function(a, b) { + this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE, b ? "0" : "1", [a]) +}; +mxGraphLayout.prototype.setOrthogonalEdge = function(a, b) { + this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL, b ? "1" : "0", [a]) +}; +mxGraphLayout.prototype.getParentOffset = function(a) { + var b = new mxPoint; + if (null != a && a != this.parent) { + var c = this.graph.getModel(); + if (c.isAncestor(this.parent, a)) + for (var d = c.getGeometry(a); a != this.parent;) b.x += d.x, b.y += d.y, a = c.getParent(a), d = c.getGeometry(a) + } + return b +}; +mxGraphLayout.prototype.setEdgePoints = function(a, b) { + if (null != a) { + var c = this.graph.model, + d = c.getGeometry(a); + null == d ? (d = new mxGeometry, d.setRelative(!0)) : d = d.clone(); + if (null != this.parent && null != b) + for (var e = c.getParent(a), e = this.getParentOffset(e), f = 0; f < b.length; f++) b[f].x -= e.x, b[f].y -= e.y; + d.points = b; + c.setGeometry(a, d) + } +}; +mxGraphLayout.prototype.setVertexLocation = function(a, b, c) { + var d = this.graph.getModel(), + e = d.getGeometry(a), + f = null; + if (null != e) { + f = new mxRectangle(b, c, e.width, e.height); + if (this.useBoundingBox) { + var g = this.graph.getView().getState(a); + if (null != g && null != g.text && null != g.text.boundingBox) { + var h = this.graph.getView().scale, + k = g.text.boundingBox; + g.text.boundingBox.x < g.x && (b += (g.x - k.x) / h, f.width = k.width); + g.text.boundingBox.y < g.y && (c += (g.y - k.y) / h, f.height = k.height) + } + } + null != this.parent && (g = d.getParent(a), null != g && g != + this.parent && (g = this.getParentOffset(g), b -= g.x, c -= g.y)); + if (e.x != b || e.y != c) e = e.clone(), e.x = b, e.y = c, d.setGeometry(a, e) + } + return f +}; +mxGraphLayout.prototype.getVertexBounds = function(a) { + var b = this.graph.getModel().getGeometry(a); + if (this.useBoundingBox) { + var c = this.graph.getView().getState(a); + if (null != c && null != c.text && null != c.text.boundingBox) var d = this.graph.getView().scale, + e = c.text.boundingBox, + f = Math.max(c.x - e.x, 0) / d, + g = Math.max(c.y - e.y, 0) / d, + h = Math.max(e.x + e.width - (c.x + c.width), 0) / d, + c = Math.max(e.y + e.height - (c.y + c.height), 0) / d, + b = new mxRectangle(b.x - f, b.y - g, b.width + f + h, b.height + g + c) + } + null != this.parent && (a = this.graph.getModel().getParent(a), + b = b.clone(), null != a && a != this.parent && (a = this.getParentOffset(a), b.x += a.x, b.y += a.y)); + return new mxRectangle(b.x, b.y, b.width, b.height) +}; +mxGraphLayout.prototype.arrangeGroups = function(a, b) { + this.graph.getModel().beginUpdate(); + try { + for (var c = a.length - 1; 0 <= c; c--) { + var d = a[c], + e = this.graph.getChildVertices(d), + f = this.graph.getBoundingBoxFromGeometry(e), + g = this.graph.getCellGeometry(d), + h = 0, + k = 0; + if (this.graph.isSwimlane(d)) var l = this.graph.getStartSize(d), + h = l.width, + k = l.height; + null != f && null != g && (g = g.clone(), g.x = g.x + f.x - b - h, g.y = g.y + f.y - b - k, g.width = f.width + 2 * b + h, g.height = f.height + 2 * b + k, this.graph.getModel().setGeometry(d, + g), this.graph.moveCells(e, + b + h - f.x, b + k - f.y)) + } + } finally { + this.graph.getModel().endUpdate() + } +}; + +function mxStackLayout(a, b, c, d, e, f) { + mxGraphLayout.call(this, a); + this.horizontal = null != b ? b : !0; + this.spacing = null != c ? c : 0; + this.x0 = null != d ? d : 0; + this.y0 = null != e ? e : 0; + this.border = null != f ? f : 0 +} +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(a, b, c) { + var d = this.graph.getModel(), + e = d.getParent(a), + f = this.isHorizontal(); + if (null != a && null != e) { + var g = 0, + h = 0, + k = d.getChildCount(e); + b = f ? b : c; + g = this.graph.getView().getState(e); + null != g && (b -= f ? g.x : g.y); + for (g = 0; g < k; g++) + if (c = d.getChildAt(e, g), c != a && (c = d.getGeometry(c), null != c)) { + c = f ? c.x + c.width / 2 : c.y + c.height / 2; + if (h < b && c > b) break; + h = c + } + f = e.getIndex(a); + f = Math.max(0, g - (g > f ? 1 : 0)); + d.add(e, a, f) + } +}; +mxStackLayout.prototype.getParentSize = function(a) { + var b = this.graph.getModel(), + c = b.getGeometry(a); + if (null != this.graph.container && (null == c && b.isLayer(a) || a == this.graph.getView().currentRoot)) c = new mxRectangle(0, 0, this.graph.container.offsetWidth - 1, this.graph.container.offsetHeight - + 1); + return c +}; +mxStackLayout.prototype.execute = function(a) { + if (null != a) { + var b = this.isHorizontal(), + c = this.graph.getModel(), + d = this.getParentSize(a), + e = 0; + null != d && (e = b ? d.height : d.width); + var e = e - (2 * this.spacing + 2 * this.border), + f = this.x0 + this.border, + g = this.y0 + this.border; + if (this.graph.isSwimlane(a)) { + var h = this.graph.getCellStyle(a), + k = mxUtils.getValue(h, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE), + h = mxUtils.getValue(h, mxConstants.STYLE_HORIZONTAL, !0); + b == h && (e -= k); + b ? g += k : f += k + } + c.beginUpdate(); + try { + for (var k = 0, + h = null, l = c.getChildCount(a), m = 0; m < l; m++) { + var n = c.getChildAt(a, m); + if (!this.isVertexIgnored(n) && this.isVertexMovable(n)) { + var p = c.getGeometry(n); + if (null != p) { + p = p.clone(); + if (null != this.wrap && null != h && (b && h.x + h.width + p.width + 2 * this.spacing > this.wrap || !b && h.y + h.height + p.height + 2 * this.spacing > this.wrap)) h = null, b ? g += + k + this.spacing : f += k + this.spacing, k = 0; + k = Math.max(k, b ? p.height : p.width); + null != h ? b ? p.x = h.x + h.width + this.spacing : p.y = h.y + h.height + this.spacing : this.keepFirstLocation || (b ? p.x = f : p.y = g); + b ? p.y = g : p.x = f; + this.fill && 0 < e && (b ? p.height = e : p.width = e); + c.setGeometry(n, p); + h = p + } + } + } + this.resizeParent && null != d && null != h && !this.graph.isCellCollapsed(a) ? (d = d.clone(), b ? d.width = h.x + h.width + this.spacing : d.height = h.y + h.height + this.spacing, c.setGeometry( + a, d)) : this.resizeLast && (null != d && null != h) && (b ? h.width = d.width - h.x - this.spacing : h.height = d.height - h.y - this.spacing) + } finally { + c.endUpdate() + } + } +}; + +function mxPartitionLayout(a, b, c, d) { + mxGraphLayout.call(this, a); + this.horizontal = null != b ? b : !0; + this.spacing = c || 0; + this.border = d || 0 +} +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(a, b, c) { + c = this.graph.getModel(); + var d = c.getParent(a); + if (null != a && null != d) { + for (var e = 0, f = 0, g = c.getChildCount(d), e = 0; e < g; e++) { + var h = c.getChildAt(d, e), + h = this.getVertexBounds(h); + if (null != h) { + h = h.x + h.width / 2; + if (f < b && h > b) break; + f = h + } + } + b = d.getIndex(a); + b = Math.max(0, e - (e > b ? 1 : 0)); + c.add(d, a, b) + } +}; +mxPartitionLayout.prototype.execute = function(a) { + var b = this.isHorizontal(), + c = this.graph.getModel(), + d = c.getGeometry(a); + if (null != this.graph.container && (null == d && c.isLayer(a) || a == this.graph.getView().currentRoot)) d = new mxRectangle(0, 0, this.graph.container.offsetWidth - 1, this.graph.container.offsetHeight - + 1); + if (null != d) { + for (var e = [], f = c.getChildCount(a), g = 0; g < f; g++) { + var h = c.getChildAt(a, g); + !this.isVertexIgnored(h) && this.isVertexMovable(h) && e.push(h) + } + f = e.length; + if (0 < f) { + var k = this.border, + l = this.border, + m = b ? + d.height : d.width, + m = m - 2 * this.border; + a = this.graph.isSwimlane(a) ? this.graph.getStartSize(a) : new mxRectangle; + m -= b ? a.height : a.width; + k += a.width; + l += a.height; + a = this.border + (f - 1) * this.spacing; + d = b ? (d.width - k - a) / f : (d.height - l - a) / f; + if (0 < d) { + c.beginUpdate(); + try { + for (g = 0; g < f; g++) { + var h = e[g], + n = c.getGeometry(h); + null != n && (n = n.clone(), n.x = k, n.y = l, b ? (this.resizeVertices && (n.width = d, n.height = m), k += d + this.spacing) : (this.resizeVertices && (n.height = d, n.width = m), l += + d + this.spacing), c.setGeometry(h, n)) + } + } finally { + c.endUpdate() + } + } + } + } +}; + +function mxCompactTreeLayout(a, b, c) { + mxGraphLayout.call(this, a); + this.horizontal = null != b ? b : !0; + this.invert = null != c ? c : !1 +} +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(a) { + return mxGraphLayout.prototype.isVertexIgnored.apply(this, arguments) || 0 == this.graph.getConnections(a).length +}; +mxCompactTreeLayout.prototype.isHorizontal = function() { + return this.horizontal +}; +mxCompactTreeLayout.prototype.execute = function(a, b) { + this.parent = a; + var c = this.graph.getModel(); + if (null == b) + if (0 < this.graph.getEdges(a, c.getParent(a), this.invert, !this.invert, !1).length) b = a; + else { + var d = this.graph.findTreeRoots(a, !0, this.invert); + if (0 < d.length) + for (var e = 0; e < d.length; e++) + if (!this.isVertexIgnored(d[e]) && 0 < this.graph.getEdges(d[e], null, this.invert, !this.invert, !1).length) { + b = d[e]; + break + } + } + if (null != b) { + this.parentsChanged = this.resizeParent ? {} : null; + c.beginUpdate(); + try { + var f = this.dfs(b, a); + if (null != + f) { + this.layout(f); + var g = this.graph.gridSize, + d = g; + if (!this.moveTree) { + var h = this.getVertexBounds(b); + null != h && (g = h.x, d = h.y) + } + h = null; + h = this.isHorizontal() ? this.horizontalLayout(f, g, d) : this.verticalLayout(f, null, g, d); + if (null != h) { + var k = e = 0; + 0 > h.x && (e = Math.abs(g - h.x)); + 0 > h.y && (k = Math.abs(d - h.y)); + (0 != e || 0 != k) && this.moveNode(f, e, k); + this.resizeParent && this.adjustParents(); + this.edgeRouting && this.localEdgeProcessing(f) + } + } + } finally { + c.endUpdate() + } + } +}; +mxCompactTreeLayout.prototype.moveNode = function(a, b, c) { + a.x += b; + a.y += c; + this.apply(a); + for (a = a.child; null != a;) this.moveNode(a, b, c), a = a.next +}; +mxCompactTreeLayout.prototype.dfs = function(a, b, c) { + c = null != c ? c : []; + var d = mxCellPath.create(a), + e = null; + if (null != a && null == c[d] && !this.isVertexIgnored(a)) { + c[d] = a; + var e = this.createNode(a), + d = this.graph.getModel(), + f = null; + a = this.graph.getEdges(a, b, this.invert, !this.invert, !1, !0); + for (var g = this.graph.getView(), h = 0; h < a.length; h++) { + var k = a[h]; + if (!this.isEdgeIgnored(k)) { + this.resetEdges && this.setEdgePoints(k, null); + this.edgeRouting && (this.setEdgeStyleEnabled(k, !1), this.setEdgePoints(k, null)); + var l = g.getState(k), + k = null != l ? l.getVisibleTerminal(this.invert) : g.getVisibleTerminal(k, this.invert), + l = this.dfs(k, b, c); + null != l && null != d.getGeometry(k) && (null == f ? e.child = l : f.next = l, f = l) + } + } + } + return e +}; +mxCompactTreeLayout.prototype.layout = function(a) { + if (null != a) { + for (var b = a.child; null != b;) this.layout(b), b = b.next; + null != a.child ? this.attachParent(a, this.join(a)) : this.layoutLeaf(a) + } +}; +mxCompactTreeLayout.prototype.horizontalLayout = function(a, b, c, d) { + a.x += b + a.offsetX; + a.y += c + a.offsetY; + d = this.apply(a, d); + b = a.child; + if (null != b) { + d = this.horizontalLayout(b, a.x, a.y, d); + c = a.y + b.offsetY; + for (var e = b.next; null != e;) d = this.horizontalLayout(e, a.x + b.offsetX, c, d), c += e.offsetY, e = e.next + } + return d +}; +mxCompactTreeLayout.prototype.verticalLayout = function(a, b, c, d, e) { + a.x += c + a.offsetY; + a.y += d + a.offsetX; + e = this.apply(a, e); + b = a.child; + if (null != b) { + e = this.verticalLayout(b, a, a.x, a.y, e); + c = a.x + b.offsetY; + for (d = b.next; null != d;) e = this.verticalLayout(d, a, c, a.y + b.offsetX, e), c += d.offsetY, d = d.next + } + return e +}; +mxCompactTreeLayout.prototype.attachParent = function(a, b) { + var c = this.nodeDistance + this.levelDistance, + d = (b - a.width) / 2 - this.nodeDistance, + e = d + a.width + 2 * this.nodeDistance - b; + a.child.offsetX = c + a.height; + a.child.offsetY = e; + a.contour.upperHead = this.createLine(a.height, 0, this.createLine(c, e, a.contour.upperHead)); + a.contour.lowerHead = this.createLine(a.height, 0, this.createLine(c, d, a.contour.lowerHead)) +}; +mxCompactTreeLayout.prototype.layoutLeaf = function(a) { + var b = 2 * this.nodeDistance; + a.contour.upperTail = this.createLine(a.height + b, 0); + a.contour.upperHead = a.contour.upperTail; + a.contour.lowerTail = this.createLine(0, -a.width - b); + a.contour.lowerHead = this.createLine(a.height + b, 0, a.contour.lowerTail) +}; +mxCompactTreeLayout.prototype.join = function(a) { + var b = 2 * this.nodeDistance, + c = a.child; + a.contour = c.contour; + for (var d = c.width + b, e = d, c = c.next; null != c;) { + var f = this.merge(a.contour, c.contour); + c.offsetY = f + d; + c.offsetX = 0; + d = c.width + b; + e += f + d; + c = c.next + } + return e +}; +mxCompactTreeLayout.prototype.merge = function(a, b) { + for (var c = 0, d = 0, e = 0, f = a.lowerHead, g = b.upperHead; null != g && null != f;) { + var h = this.offset(c, d, g.dx, g.dy, f.dx, f.dy), + d = d + h, + e = e + h; + c + g.dx <= f.dx ? (c += g.dx, d += g.dy, g = g.next) : (c -= f.dx, d -= f.dy, f = f.next) + } + null != g ? (c = this.bridge(a.upperTail, 0, 0, g, c, d), a.upperTail = null != c.next ? b.upperTail : c, a.lowerTail = b.lowerTail) : (c = this.bridge(b.lowerTail, c, d, f, 0, 0), null == c.next && + (a.lowerTail = c)); + a.lowerHead = b.lowerHead; + return e +}; +mxCompactTreeLayout.prototype.offset = function(a, b, c, d, e, f) { + var g = 0; + if (e <= a || 0 >= a + c) return 0; + g = 0 < e * d - c * f ? 0 > a ? a * d / c - b : 0 < a ? a * f / e - b : -b : e < a + c ? f - (b + (e - a) * d / c) : e > a + c ? (c + a) * f / e - (b + d) : f - (b + d); + return 0 < g ? g : 0 +}; +mxCompactTreeLayout.prototype.bridge = function(a, b, c, d, e, f) { + b = e + d.dx - b; + e = e = 0; + 0 == d.dx ? e = d.dy : (e = b * d.dy, e /= d.dx); + b = this.createLine(b, e, d.next); + a.next = this.createLine(0, f + d.dy - e - c, b); + return b +}; +mxCompactTreeLayout.prototype.createNode = function(a) { + var b = {}; + b.cell = a; + b.x = 0; + b.y = 0; + b.width = 0; + b.height = 0; + a = this.getVertexBounds(a); + null != a && (this.isHorizontal() ? (b.width = a.height, b.height = a.width) : (b.width = a.width, b.height = a.height)); + b.offsetX = 0; + b.offsetY = 0; + b.contour = {}; + return b +}; +mxCompactTreeLayout.prototype.apply = function(a, b) { + var c = this.graph.getModel(), + d = a.cell, + e = c.getGeometry(d); + null != d && null != e && (this.isVertexMovable(d) && (e = this.setVertexLocation(d, a.x, a.y), this.resizeParent && (c = c.getParent(d), d = mxCellPath.create(c), null == this.parentsChanged[d] && + (this.parentsChanged[d] = c))), b = null == b ? new mxRectangle(e.x, e.y, e.width, e.height) : new mxRectangle(Math.min(b.x, e.x), Math.min(b.y, e.y), Math.max(b.x + b.width, e.x + e.width), + Math.max(b.y + b.height, e.y + e.height))); + return b +}; +mxCompactTreeLayout.prototype.createLine = function(a, b, c) { + var d = {}; + d.dx = a; + d.dy = b; + d.next = c; + return d +}; +mxCompactTreeLayout.prototype.adjustParents = function() { + var a = [], + b; + for (b in this.parentsChanged) a.push(this.parentsChanged[b]); + this.arrangeGroups(mxUtils.sortCells(a, !0), this.groupPadding) +}; +mxCompactTreeLayout.prototype.localEdgeProcessing = function(a) { + this.processNodeOutgoing(a); + for (a = a.child; null != a;) this.localEdgeProcessing(a), a = a.next +}; +mxCompactTreeLayout.prototype.processNodeOutgoing = function(a) { + for (var b = a.child, c = a.cell, d = 0, e = []; null != b;) { + d++; + var f = b.x; + this.horizontal && (f = b.y); + e.push(new WeightedCellSorter(b, f)); + b = b.next + } + e.sort(WeightedCellSorter.prototype.compare); + var f = a.width, + g = (d + 1) * this.prefHozEdgeSep; + f > g + 2 * this.prefHozEdgeSep && (f -= 2 * this.prefHozEdgeSep); + a = f / d; + b = a / 2; + f > g + 2 * this.prefHozEdgeSep && (b += this.prefHozEdgeSep); + for (var f = this.minEdgeJetty - this.prefVertEdgeOff, g = 0, h = this.getVertexBounds(c), k = 0; k < e.length; k++) { + for (var l = + e[k].cell.cell, m = this.getVertexBounds(l), l = this.graph.getEdgesBetween(c, l, !1), n = [], p = 0, q = 0, s = 0; s < l.length; s++) this.horizontal ? (p = h.x + h.width, q = h.y + b, n.push( + new mxPoint(p, q)), p = h.x + h.width + f, n.push(new mxPoint(p, q)), q = m.y + m.height / 2) : (p = h.x + b, q = h.y + h.height, n.push(new mxPoint(p, q)), q = h.y + h.height + f, n.push( + new mxPoint(p, q)), p = m.x + m.width / 2), n.push(new mxPoint(p, q)), this.setEdgePoints(l[s], n); + k < d / 2 ? f += this.prefVertEdgeOff : k > d / 2 && (f -= this.prefVertEdgeOff); + b += a; + g = Math.max(g, f) + } +}; + +function WeightedCellSorter(a, b) { + this.cell = a; + this.weightedValue = b +} +WeightedCellSorter.prototype.weightedValue = 0; +WeightedCellSorter.prototype.nudge = !1; +WeightedCellSorter.prototype.visited = !1; +WeightedCellSorter.prototype.rankIndex = null; +WeightedCellSorter.prototype.cell = null; +WeightedCellSorter.prototype.compare = function(a, b) { + return null != a && null != b ? b.weightedValue > a.weightedValue ? 1 : b.weightedValue < a.weightedValue ? -1 : b.nudge ? 1 : -1 : 0 +}; + +function mxFastOrganicLayout(a) { + mxGraphLayout.call(this, a) +} +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(a) { + return mxGraphLayout.prototype.isVertexIgnored.apply(this, arguments) || 0 == this.graph.getConnections(a).length +}; +mxFastOrganicLayout.prototype.execute = function(a) { + var b = this.graph.getModel(); + this.vertexArray = []; + for (var c = this.graph.getChildVertices(a), d = 0; d < c.length; d++) this.isVertexIgnored(c[d]) || this.vertexArray.push(c[d]); + var e = this.useInputOrigin ? this.graph.view.getBounds(this.vertexArray) : null, + f = this.vertexArray.length; + this.indices = []; + this.dispX = []; + this.dispY = []; + this.cellLocation = []; + this.isMoveable = []; + this.neighbours = []; + this.radius = []; + this.radiusSquared = []; + 0.0010 > this.forceConstant && (this.forceConstant = + 0.0010); + this.forceConstantSquared = this.forceConstant * this.forceConstant; + for (d = 0; d < this.vertexArray.length; d++) { + var g = this.vertexArray[d]; + this.cellLocation[d] = []; + var h = mxCellPath.create(g); + this.indices[h] = d; + var k = this.getVertexBounds(g), + l = k.width, + m = k.height, + n = k.x, + p = k.y; + this.cellLocation[d][0] = n + l / 2; + this.cellLocation[d][1] = p + m / 2; + this.radius[d] = Math.min(l, m); + this.radiusSquared[d] = this.radius[d] * this.radius[d] + } + b.beginUpdate(); + try { + for (d = 0; d < f; d++) { + this.dispX[d] = 0; + this.dispY[d] = 0; + this.isMoveable[d] = this.isVertexMovable(this.vertexArray[d]); + var q = this.graph.getConnections(this.vertexArray[d], a), + c = this.graph.getOpposites(q, this.vertexArray[d]); + this.neighbours[d] = []; + for (l = 0; l < c.length; l++) { + this.resetEdges && this.graph.resetEdge(q[l]); + this.disableEdgeStyle && this.setEdgeStyleEnabled(q[l], !1); + var h = mxCellPath.create(c[l]), + s = this.indices[h]; + this.neighbours[d][l] = null != s ? s : d + } + } + this.temperature = this.initialTemp; + 0 == this.maxIterations && (this.maxIterations = 20 * Math.sqrt(f)); + for (this.iteration = 0; this.iteration < this.maxIterations; this.iteration++) { + if (!this.allowedToRun) return; + this.calcRepulsion(); + this.calcAttraction(); + this.calcPositions(); + this.reduceTemperature() + } + a = c = null; + for (d = 0; d < this.vertexArray.length; d++) g = this.vertexArray[d], this.isVertexMovable(g) && (k = this.getVertexBounds(g), null != k && (this.cellLocation[d][0] -= k.width / 2, this.cellLocation[ + d][1] -= k.height / 2, n = this.graph.snap(this.cellLocation[d][0]), p = this.graph.snap(this.cellLocation[d][1]), this.setVertexLocation(g, n, p), c = null == c ? n : Math.min(c, n), a = + null == a ? p : Math.min(a, p))); + d = -(c || 0) + 1; + g = -(a || 0) + 1; + null != e && (d += e.x, + g += e.y); + this.graph.moveCells(this.vertexArray, d, g) + } finally { + b.endUpdate() + } +}; +mxFastOrganicLayout.prototype.calcPositions = function() { + for (var a = 0; a < this.vertexArray.length; a++) + if (this.isMoveable[a]) { + var b = Math.sqrt(this.dispX[a] * this.dispX[a] + this.dispY[a] * this.dispY[a]); + 0.0010 > b && (b = 0.0010); + var c = this.dispX[a] / b * Math.min(b, this.temperature), + b = this.dispY[a] / b * Math.min(b, this.temperature); + this.dispX[a] = 0; + this.dispY[a] = 0; + this.cellLocation[a][0] += c; + this.cellLocation[a][1] += b + } +}; +mxFastOrganicLayout.prototype.calcAttraction = function() { + for (var a = 0; a < this.vertexArray.length; a++) + for (var b = 0; b < this.neighbours[a].length; b++) { + var c = this.neighbours[a][b]; + if (a != c && this.isMoveable[a] && this.isMoveable[c]) { + var d = this.cellLocation[a][0] - this.cellLocation[c][0], + e = this.cellLocation[a][1] - this.cellLocation[c][1], + f = d * d + e * e - this.radiusSquared[a] - this.radiusSquared[c]; + f < this.minDistanceLimitSquared && (f = this.minDistanceLimitSquared); + var g = Math.sqrt(f), + f = f / this.forceConstant, + d = d / g * f, + e = e / g * f; + this.dispX[a] -= d; + this.dispY[a] -= e; + this.dispX[c] += d; + this.dispY[c] += e + } + } +}; +mxFastOrganicLayout.prototype.calcRepulsion = function() { + for (var a = this.vertexArray.length, b = 0; b < a; b++) + for (var c = b; c < a; c++) { + if (!this.allowedToRun) return; + if (c != b && this.isMoveable[b] && this.isMoveable[c]) { + var d = this.cellLocation[b][0] - this.cellLocation[c][0], + e = this.cellLocation[b][1] - this.cellLocation[c][1]; + 0 == d && (d = 0.01 + Math.random()); + 0 == e && (e = 0.01 + Math.random()); + var f = Math.sqrt(d * d + e * e), + g = f - this.radius[b] - this.radius[c]; + g > this.maxDistanceLimit || (g < this.minDistanceLimit && (g = this.minDistanceLimit), g = this.forceConstantSquared / + g, d = d / f * g, e = e / f * g, this.dispX[b] += d, this.dispY[b] += e, this.dispX[c] -= d, this.dispY[c] -= e) + } + } +}; +mxFastOrganicLayout.prototype.reduceTemperature = function() { + this.temperature = this.initialTemp * (1 - this.iteration / this.maxIterations) +}; + +function mxCircleLayout(a, b) { + mxGraphLayout.call(this, a); + this.radius = null != b ? b : 100 +} +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(a) { + var b = this.graph.getModel(); + b.beginUpdate(); + try { + for (var c = 0, d = null, e = null, f = [], g = b.getChildCount(a), h = 0; h < g; h++) { + var k = b.getChildAt(a, h); + if (this.isVertexIgnored(k)) this.isEdgeIgnored(k) || (this.resetEdges && this.graph.resetEdge(k), this.disableEdgeStyle && this.setEdgeStyleEnabled(k, !1)); + else { + f.push(k); + var l = this.getVertexBounds(k), + d = null == d ? l.y : Math.min(d, l.y), + e = null == e ? l.x : Math.min(e, l.x), + c = Math.max(c, Math.max(l.width, l.height)) + } + } + var m = this.getRadius(f.length, + c); + this.moveCircle && (e = this.x0, d = this.y0); + this.circle(f, m, e, d) + } finally { + b.endUpdate() + } +}; +mxCircleLayout.prototype.getRadius = function(a, b) { + return Math.max(a * b / Math.PI, this.radius) +}; +mxCircleLayout.prototype.circle = function(a, b, c, d) { + for (var e = a.length, f = 2 * Math.PI / e, g = 0; g < e; g++) this.isVertexMovable(a[g]) && this.setVertexLocation(a[g], c + b + b * Math.sin(g * f), d + b + b * Math.cos(g * f)) +}; + +function mxParallelEdgeLayout(a) { + mxGraphLayout.call(this, a) +} +mxParallelEdgeLayout.prototype = new mxGraphLayout; +mxParallelEdgeLayout.prototype.constructor = mxParallelEdgeLayout; +mxParallelEdgeLayout.prototype.spacing = 20; +mxParallelEdgeLayout.prototype.execute = function(a) { + a = this.findParallels(a); + this.graph.model.beginUpdate(); + try { + for (var b in a) { + var c = a[b]; + 1 < c.length && this.layout(c) + } + } finally { + this.graph.model.endUpdate() + } +}; +mxParallelEdgeLayout.prototype.findParallels = function(a) { + for (var b = this.graph.getModel(), c = [], d = b.getChildCount(a), e = 0; e < d; e++) { + var f = b.getChildAt(a, e); + if (!this.isEdgeIgnored(f)) { + var g = this.getEdgeId(f); + null != g && (null == c[g] && (c[g] = []), c[g].push(f)) + } + } + return c +}; +mxParallelEdgeLayout.prototype.getEdgeId = function(a) { + var b = this.graph.getView(), + c = b.getState(a), + d = null != c ? c.getVisibleTerminal(!0) : b.getVisibleTerminal(a, !0); + a = null != c ? c.getVisibleTerminal(!1) : b.getVisibleTerminal(a, !1); + return null != d && null != a ? (d = mxCellPath.create(d), a = mxCellPath.create(a), d > a ? a + "-" + d : d + "-" + a) : null +}; +mxParallelEdgeLayout.prototype.layout = function(a) { + var b = a[0], + c = this.graph.getModel(), + d = c.getGeometry(c.getTerminal(b, !0)), + e = c.getGeometry(c.getTerminal(b, !1)); + if (d == e) + for (var b = d.x + d.width + this.spacing, c = d.y + d.height / 2, f = 0; f < a.length; f++) this.route(a[f], b, c), b += this.spacing; + else if (null != d && null != e) + for (var b = d.x + d.width / 2, c = d.y + d.height / 2, f = e.x + e.width / 2 - b, g = e.y + e.height / 2 - c, e = Math.sqrt(f * f + g * g), d = g * this.spacing / e, e = f * this.spacing / e, + b = b + f / 2 + d * (a.length - 1) / 2, c = c + g / 2 - e * (a.length - 1) / 2, f = 0; f < a.length; f++) this.route(a[f], + b, c), b -= d, c += e +}; +mxParallelEdgeLayout.prototype.route = function(a, b, c) { + this.graph.isCellMovable(a) && this.setEdgePoints(a, [new mxPoint(b, c)]) +}; + +function mxCompositeLayout(a, b, c) { + mxGraphLayout.call(this, a); + this.layouts = b; + this.master = c +} +mxCompositeLayout.prototype = new mxGraphLayout; +mxCompositeLayout.prototype.constructor = mxCompositeLayout; +mxCompositeLayout.prototype.layouts = null; +mxCompositeLayout.prototype.master = null; +mxCompositeLayout.prototype.moveCell = function(a, b, c) { + null != this.master ? this.master.move.apply(this.master, arguments) : this.layouts[0].move.apply(this.layouts[0], arguments) +}; +mxCompositeLayout.prototype.execute = function(a) { + var b = this.graph.getModel(); + b.beginUpdate(); + try { + for (var c = 0; c < this.layouts.length; c++) this.layouts[c].execute.apply(this.layouts[c], arguments) + } finally { + b.endUpdate() + } +}; + +function mxEdgeLabelLayout(a, b) { + mxGraphLayout.call(this, a) +} +mxEdgeLabelLayout.prototype = new mxGraphLayout; +mxEdgeLabelLayout.prototype.constructor = mxEdgeLabelLayout; +mxEdgeLabelLayout.prototype.execute = function(a) { + for (var b = this.graph.view, c = this.graph.getModel(), d = [], e = [], f = c.getChildCount(a), g = 0; g < f; g++) { + var h = c.getChildAt(a, g), + k = b.getState(h); + null != k && (this.isVertexIgnored(h) ? this.isEdgeIgnored(h) || d.push(k) : e.push(k)) + } + this.placeLabels(e, d) +}; +mxEdgeLabelLayout.prototype.placeLabels = function(a, b) { + var c = this.graph.getModel(); + c.beginUpdate(); + try { + for (var d = 0; d < b.length; d++) { + var e = b[d]; + if (null != e && null != e.text && null != e.text.boundingBox) + for (var f = 0; f < a.length; f++) { + var g = a[f]; + null != g && this.avoid(e, g) + } + } + } finally { + c.endUpdate() + } +}; +mxEdgeLabelLayout.prototype.avoid = function(a, b) { + var c = this.graph.getModel(), + d = a.text.boundingBox; + if (mxUtils.intersects(d, b)) { + var e = -d.y - d.height + b.y, + f = -d.y + b.y + b.height, + e = Math.abs(e) < Math.abs(f) ? e : f, + f = -d.x - d.width + b.x, + d = -d.x + b.x + b.width, + d = Math.abs(f) < Math.abs(d) ? f : d; + Math.abs(d) < Math.abs(e) ? e = 0 : d = 0; + f = c.getGeometry(a.cell); + null != f && (f = f.clone(), null != f.offset ? (f.offset.x += d, f.offset.y += e) : f.offset = new mxPoint(d, e), c.setGeometry(a.cell, f)) + } +}; + +function mxGraphAbstractHierarchyCell() { + this.x = []; + this.y = []; + this.temp = [] +} +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(a) { + return null +}; +mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells = function(a) { + return null +}; +mxGraphAbstractHierarchyCell.prototype.isEdge = function() { + return !1 +}; +mxGraphAbstractHierarchyCell.prototype.isVertex = function() { + return !1 +}; +mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable = function(a) { + return null +}; +mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable = function(a, b) { + return null +}; +mxGraphAbstractHierarchyCell.prototype.setX = function(a, b) { + this.isVertex() ? this.x[0] = b : this.isEdge() && (this.x[a - this.minRank - 1] = b) +}; +mxGraphAbstractHierarchyCell.prototype.getX = function(a) { + return this.isVertex() ? this.x[0] : this.isEdge() ? this.x[a - this.minRank - 1] : 0 +}; +mxGraphAbstractHierarchyCell.prototype.setY = function(a, b) { + this.isVertex() ? this.y[0] = b : this.isEdge() && (this.y[a - this.minRank - 1] = b) +}; + +function mxGraphHierarchyNode(a) { + mxGraphAbstractHierarchyCell.apply(this, arguments); + this.cell = a +} +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(a) { + return this.maxRank +}; +mxGraphHierarchyNode.prototype.getNextLayerConnectedCells = function(a) { + if (null == this.nextLayerConnectedCells) { + this.nextLayerConnectedCells = []; + this.nextLayerConnectedCells[0] = []; + for (var b = 0; b < this.connectsAsTarget.length; b++) { + var c = this.connectsAsTarget[b]; - 1 == c.maxRank || c.maxRank == a + 1 ? this.nextLayerConnectedCells[0].push(c.source) : this.nextLayerConnectedCells[0].push(c) + } + } + return this.nextLayerConnectedCells[0] +}; +mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells = function(a) { + if (null == this.previousLayerConnectedCells) { + this.previousLayerConnectedCells = []; + this.previousLayerConnectedCells[0] = []; + for (var b = 0; b < this.connectsAsSource.length; b++) { + var c = this.connectsAsSource[b]; - 1 == c.minRank || c.minRank == a - 1 ? this.previousLayerConnectedCells[0].push(c.target) : this.previousLayerConnectedCells[0].push(c) + } + } + return this.previousLayerConnectedCells[0] +}; +mxGraphHierarchyNode.prototype.isVertex = function() { + return !0 +}; +mxGraphHierarchyNode.prototype.getGeneralPurposeVariable = function(a) { + return this.temp[0] +}; +mxGraphHierarchyNode.prototype.setGeneralPurposeVariable = function(a, b) { + this.temp[0] = b +}; +mxGraphHierarchyNode.prototype.isAncestor = function(a) { + if (null != a && null != this.hashCode && null != a.hashCode && this.hashCode.length < a.hashCode.length) { + if (this.hashCode == a.hashCode) return !0; + if (null == this.hashCode || null == this.hashCode) return !1; + for (var b = 0; b < this.hashCode.length; b++) + if (this.hashCode[b] != a.hashCode[b]) return !1; + return !0 + } + return !1 +}; +mxGraphHierarchyNode.prototype.getCoreCell = function() { + return this.cell +}; + +function mxGraphHierarchyEdge(a) { + mxGraphAbstractHierarchyCell.apply(this, arguments); + this.edges = a +} +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(a) { + a = this.source; + this.source = this.target; + this.target = a; + this.isReversed = !this.isReversed +}; +mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells = function(a) { + if (null == this.nextLayerConnectedCells) { + this.nextLayerConnectedCells = []; + for (var b = 0; b < this.temp.length; b++) this.nextLayerConnectedCells[b] = [], b == this.temp.length - 1 ? this.nextLayerConnectedCells[b].push(this.source) : this.nextLayerConnectedCells[b].push( + this) + } + return this.nextLayerConnectedCells[a - this.minRank - 1] +}; +mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells = function(a) { + if (null == this.previousLayerConnectedCells) { + this.previousLayerConnectedCells = []; + for (var b = 0; b < this.temp.length; b++) this.previousLayerConnectedCells[b] = [], 0 == b ? this.previousLayerConnectedCells[b].push(this.target) : this.previousLayerConnectedCells[b].push( + this) + } + return this.previousLayerConnectedCells[a - this.minRank - 1] +}; +mxGraphHierarchyEdge.prototype.isEdge = function() { + return !0 +}; +mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable = function(a) { + return this.temp[a - this.minRank - 1] +}; +mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable = function(a, b) { + this.temp[a - this.minRank - 1] = b +}; +mxGraphHierarchyEdge.prototype.getCoreCell = function() { + return null != this.edges && 0 < this.edges.length ? this.edges[0] : null +}; + +function mxGraphHierarchyModel(a, b, c, d, e) { + a.getGraph(); + this.tightenToSource = e; + this.roots = c; + this.parent = d; + this.vertexMapper = {}; + this.edgeMapper = {}; + this.maxRank = 0; + c = []; + null == b && (b = this.graph.getChildVertices(d)); + this.maxRank = this.SOURCESCANSTARTRANK; + this.createInternalCells(a, b, c); + for (d = 0; d < b.length; d++) { + e = c[d].connectsAsSource; + for (var f = 0; f < e.length; f++) { + var g = e[f], + h = g.edges; + if (null != h && 0 < h.length) { + var h = h[0], + k = a.getVisibleTerminal(h, !1), + k = mxCellPath.create(k), + k = this.vertexMapper[k]; + c[d] == k && (k = a.getVisibleTerminal(h, !0), k = mxCellPath.create(k), k = this.vertexMapper[k]); + null != k && c[d] != k && (g.target = k, 0 == k.connectsAsTarget.length && (k.connectsAsTarget = []), 0 > mxUtils.indexOf(k.connectsAsTarget, g) && k.connectsAsTarget.push(g)) + } + } + c[d].temp[0] = 1 + } +} +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(a, b, c) { + for (var d = a.getGraph(), e = 0; e < b.length; e++) { + c[e] = new mxGraphHierarchyNode(b[e]); + var f = mxCellPath.create(b[e]); + this.vertexMapper[f] = c[e]; + f = a.getEdges(b[e]); + c[e].connectsAsSource = []; + for (var g = 0; g < f.length; g++) { + var h = a.getVisibleTerminal(f[g], !1); + if (h != b[e] && h != b[e] && a.graph.model.isVertex(h) && !a.isVertexIgnored(h)) { + var k = a.getEdgesBetween(b[e], h, !1), + l = a.getEdgesBetween(b[e], h, !0), + h = mxCellPath.create(k[0]); + if (null != k && 0 < k.length && null == + this.edgeMapper[h] && 2 * l.length >= k.length) { + for (var l = new mxGraphHierarchyEdge(k), m = 0; m < k.length; m++) { + var n = k[m], + h = mxCellPath.create(n); + this.edgeMapper[h] = l; + d.resetEdge(n); + a.disableEdgeStyle && (a.setEdgeStyleEnabled(n, !1), a.setOrthogonalEdge(n, !0)) + } + l.source = c[e]; + 0 > mxUtils.indexOf(c[e].connectsAsSource, l) && c[e].connectsAsSource.push(l) + } + } + } + c[e].temp[0] = 0 + } +}; +mxGraphHierarchyModel.prototype.initialRank = function() { + var a = []; + if (null != this.roots) + for (var b = 0; b < this.roots.length; b++) { + var c = mxCellPath.create(this.roots[b]), + c = this.vertexMapper[c]; + null != c && a.push(c) + } + for (var d in this.vertexMapper) c = this.vertexMapper[d], c.temp[0] = -1; + for (var e = a.slice(); 0 < a.length;) { + var c = a[0], + f, g; + f = c.connectsAsTarget; + g = c.connectsAsSource; + for (var h = !0, k = this.SOURCESCANSTARTRANK, b = 0; b < f.length; b++) { + var l = f[b]; + if (5270620 == l.temp[0]) l = l.source, k = Math.min(k, l.temp[0] - 1); + else { + h = !1; + break + } + } + if (h) { + c.temp[0] = + k; + this.maxRank = Math.min(this.maxRank, k); + if (null != g) + for (b = 0; b < g.length; b++) l = g[b], l.temp[0] = 5270620, l = l.target, -1 == l.temp[0] && (a.push(l), l.temp[0] = -2); + a.shift() + } else if (b = a.shift(), a.push(c), b == c && 1 == a.length) break + } + for (d in this.vertexMapper) c = this.vertexMapper[d], c.temp[0] -= this.maxRank; + for (b = 0; b < e.length; b++) { + c = e[b]; + a = 0; + f = c.connectsAsSource; + for (d = 0; d < f.length; d++) l = f[d], l = l.target, c.temp[0] = Math.max(a, l.temp[0] + 1), a = c.temp[0] + } + this.maxRank = this.SOURCESCANSTARTRANK - this.maxRank +}; +mxGraphHierarchyModel.prototype.fixRanks = function() { + var a = []; + this.ranks = []; + for (var b = 0; b < this.maxRank + 1; b++) a[b] = [], this.ranks[b] = a[b]; + var c = null; + if (null != this.roots) + for (var d = this.roots, c = [], b = 0; b < d.length; b++) { + var e = mxCellPath.create(d[b]); + c[b] = this.vertexMapper[e] + } + this.visit(function(b, c, d, e, l) { + 0 == l && (0 > c.maxRank && 0 > c.minRank) && (a[c.temp[0]].push(c), c.maxRank = c.temp[0], c.minRank = c.temp[0], c.temp[0] = a[c.maxRank].length - 1); + if (null != b && null != d && 1 < b.maxRank - c.maxRank) { + d.maxRank = b.maxRank; + d.minRank = + c.maxRank; + d.temp = []; + d.x = []; + d.y = []; + for (b = d.minRank + 1; b < d.maxRank; b++) a[b].push(d), d.setGeneralPurposeVariable(b, a[b].length - 1) + } + }, c, !1, null) +}; +mxGraphHierarchyModel.prototype.visit = function(a, b, c, d) { + if (null != b) { + for (var e = 0; e < b.length; e++) { + var f = b[e]; + null != f && (null == d && (d = {}), c ? (f.hashCode = [], f.hashCode[0] = this.dfsCount, f.hashCode[1] = e, this.extendedDfs(null, f, null, a, d, f.hashCode, e, 0)) : this.dfs(null, f, null, + a, d, 0)) + } + this.dfsCount++ + } +}; +mxGraphHierarchyModel.prototype.dfs = function(a, b, c, d, e, f) { + if (null != b) { + var g = mxCellPath.create(b.cell); + if (null == e[g]) { + e[g] = b; + d(a, b, c, f, 0); + a = b.connectsAsSource.slice(); + for (c = 0; c < a.length; c++) g = a[c], this.dfs(b, g.target, g, d, e, f + 1) + } else d(a, b, c, f, 1) + } +}; +mxGraphHierarchyModel.prototype.extendedDfs = function(a, b, c, d, e, f, g, h) { + if (null != b) { + if (null != a && (null == b.hashCode || b.hashCode[0] != a.hashCode[0])) f = a.hashCode.length + 1, b.hashCode = a.hashCode.slice(), b.hashCode[f - 1] = g; + g = mxCellPath.create(b.cell); + if (null == e[g]) { + e[g] = b; + d(a, b, c, h, 0); + a = b.connectsAsSource.slice(); + for (c = 0; c < a.length; c++) g = a[c], this.extendedDfs(b, g.target, g, d, e, b.hashCode, c, h + 1) + } else d(a, b, c, h, 1) + } +}; + +function mxHierarchicalLayoutStage() {} +mxHierarchicalLayoutStage.prototype.execute = function(a) {}; + +function mxMedianHybridCrossingReduction(a) { + this.layout = a +} +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(a) { + a = this.layout.getModel(); + this.nestedBestRanks = []; + for (var b = 0; b < a.ranks.length; b++) this.nestedBestRanks[b] = a.ranks[b].slice(); + for (var c = 0, d = this.calculateCrossings(a), b = 0; b < this.maxIterations && c < this.maxNoImprovementIterations; b++) { + this.weightedMedian(b, a); + this.transpose(b, a); + var e = this.calculateCrossings(a); + if (e < d) { + d = e; + for (e = c = 0; e < this.nestedBestRanks.length; e++) + for (var f = a.ranks[e], g = 0; g < f.length; g++) { + var h = f[g]; + this.nestedBestRanks[e][h.getGeneralPurposeVariable(e)] = + h + } + } else { + c++; + for (e = 0; e < this.nestedBestRanks.length; e++) { + f = a.ranks[e]; + for (g = 0; g < f.length; g++) h = f[g], h.setGeneralPurposeVariable(e, g) + } + } + if (0 == d) break + } + c = []; + d = []; + for (b = 0; b < a.maxRank + 1; b++) d[b] = [], c[b] = d[b]; + for (b = 0; b < this.nestedBestRanks.length; b++) + for (e = 0; e < this.nestedBestRanks[b].length; e++) d[b].push(this.nestedBestRanks[b][e]); + a.ranks = c +}; +mxMedianHybridCrossingReduction.prototype.calculateCrossings = function(a) { + for (var b = a.ranks.length, c = 0, d = 1; d < b; d++) c += this.calculateRankCrossing(d, a); + return c +}; +mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(a, b) { + for (var c = 0, d = b.ranks[a], e = d.length, f = b.ranks[a - 1].length, g = [], h = 0; h < e; h++) g[h] = []; + for (h = 0; h < d.length; h++) + for (var k = d[h], l = k.getGeneralPurposeVariable(a), m = k.getPreviousLayerConnectedCells(a), k = 0; k < m.length; k++) { + var n = m[k].getGeneralPurposeVariable(a - 1); + g[l][n] = 201207 + } + for (h = 0; h < e; h++) + for (k = 0; k < f; k++) + if (201207 == g[h][k]) { + for (d = h + 1; d < e; d++) + for (l = 0; l < k; l++) 201207 == g[d][l] && c++; + for (d = 0; d < h; d++) + for (l = k + 1; l < f; l++) 201207 == g[d][l] && + c++ + } + return c / 2 +}; +mxMedianHybridCrossingReduction.prototype.transpose = function(a, b) { + for (var c = !0, d = 0; c && 10 > d++;) + for (var e = 1 == a % 2 && 1 == d % 2, c = !1, f = 0; f < b.ranks.length; f++) { + for (var g = b.ranks[f], h = [], k = 0; k < g.length; k++) { + var l = g[k], + m = l.getGeneralPurposeVariable(f); + 0 > m && (m = k); + h[m] = l + } + for (var n = m = l = null, p = null, q = null, s = null, r = null, t = null, v = null, w = null, k = 0; k < g.length - 1; k++) { + if (0 == k) { + for (var v = h[k], l = v.getNextLayerConnectedCells(f), m = v.getPreviousLayerConnectedCells(f), q = [], s = [], u = 0; u < l.length; u++) q[u] = l[u].getGeneralPurposeVariable(f + 1); + for (u = 0; u < m.length; u++) s[u] = m[u].getGeneralPurposeVariable(f - 1) + } else l = n, m = p, q = r, s = t, v = w; + w = h[k + 1]; + n = w.getNextLayerConnectedCells(f); + p = w.getPreviousLayerConnectedCells(f); + r = []; + t = []; + for (u = 0; u < n.length; u++) r[u] = n[u].getGeneralPurposeVariable(f + 1); + for (u = 0; u < p.length; u++) t[u] = p[u].getGeneralPurposeVariable(f - 1); + for (var y = 0, z = 0, u = 0; u < q.length; u++) + for (var x = 0; x < r.length; x++) q[u] > r[x] && y++, q[u] < r[x] && z++; + for (u = 0; u < s.length; u++) + for (x = 0; x < t.length; x++) s[u] > t[x] && y++, s[u] < t[x] && z++; + if (z < y || z == y && e) n = v.getGeneralPurposeVariable(f), + v.setGeneralPurposeVariable(f, w.getGeneralPurposeVariable(f)), w.setGeneralPurposeVariable(f, n), n = l, p = m, r = q, t = s, w = v, e || (c = !0) + } + } +}; +mxMedianHybridCrossingReduction.prototype.weightedMedian = function(a, b) { + var c = 0 == a % 2; + if (c) + for (var d = b.maxRank - 1; 0 <= d; d--) this.medianRank(d, c); + else + for (d = 1; d < b.maxRank; d++) this.medianRank(d, c) +}; +mxMedianHybridCrossingReduction.prototype.medianRank = function(a, b) { + for (var c = this.nestedBestRanks[a].length, d = [], e = [], f = 0; f < c; f++) { + var g = this.nestedBestRanks[a][f], + h = new MedianCellSorter; + h.cell = g; + var k; + k = b ? g.getNextLayerConnectedCells(a) : g.getPreviousLayerConnectedCells(a); + var l; + l = b ? a + 1 : a - 1; + null != k && 0 != k.length ? (h.medianValue = this.medianValue(k, l), d.push(h)) : e[g.getGeneralPurposeVariable(a)] = !0 + } + d.sort(MedianCellSorter.prototype.compare); + for (f = 0; f < c; f++) null == e[f] && (g = d.shift().cell, g.setGeneralPurposeVariable(a, + f)) +}; +mxMedianHybridCrossingReduction.prototype.medianValue = function(a, b) { + for (var c = [], d = 0, e = 0; e < a.length; e++) { + var f = a[e]; + c[d++] = f.getGeneralPurposeVariable(b) + } + c.sort(function(a, b) { + return a - b + }); + if (1 == d % 2) return c[Math.floor(d / 2)]; + if (2 == d) return (c[0] + c[1]) / 2; + e = d / 2; + f = c[e - 1] - c[0]; + d = c[d - 1] - c[e]; + return (c[e - 1] * d + c[e] * f) / (f + d) +}; + +function MedianCellSorter() {} +MedianCellSorter.prototype.medianValue = 0; +MedianCellSorter.prototype.cell = !1; +MedianCellSorter.prototype.compare = function(a, b) { + return null != a && null != b ? b.medianValue > a.medianValue ? -1 : b.medianValue < a.medianValue ? 1 : 0 : 0 +}; + +function mxMinimumCycleRemover(a) { + this.layout = a +} +mxMinimumCycleRemover.prototype = new mxHierarchicalLayoutStage; +mxMinimumCycleRemover.prototype.constructor = mxMinimumCycleRemover; +mxMinimumCycleRemover.prototype.layout = null; +mxMinimumCycleRemover.prototype.execute = function(a) { + var b = this.layout.getModel(), + c = {}, + d = mxUtils.clone(b.vertexMapper, null, !0), + e = null; + if (null != b.roots) { + var f = b.roots, + e = []; + for (a = 0; a < f.length; a++) { + var g = mxCellPath.create(f[a]); + e[a] = b.vertexMapper[g] + } + } + b.visit(function(a, b, e, f, g) { + b.isAncestor(a) && (e.invert(), mxUtils.remove(e, a.connectsAsSource), a.connectsAsTarget.push(e), mxUtils.remove(e, b.connectsAsTarget), b.connectsAsSource.push(e)); + a = mxCellPath.create(b.cell); + c[a] = b; + delete d[a] + }, e, !0, null); + e = null; + 0 < + d.lenth && (e = mxUtils.clone(d, null, !0)); + a = mxUtils.clone(c, null, !0); + b.visit(function(a, b, e, f, g) { + b.isAncestor(a) && (e.invert(), mxUtils.remove(e, a.connectsAsSource), b.connectsAsSource.push(e), a.connectsAsTarget.push(e), mxUtils.remove(e, b.connectsAsTarget)); + a = mxCellPath.create(b.cell); + c[a] = b; + delete d[a] + }, d, !0, a); + f = this.layout.getGraph(); + if (null != e && 0 < e.length) { + b = b.roots; + for (a = 0; a < e.length; a++) g = e[a].cell, 0 == f.getIncomingEdges(g).length && b.push(g) + } +}; + +function mxCoordinateAssignment(a, b, c, d, e, f) { + this.layout = a; + this.intraCellSpacing = b; + this.interRankCellSpacing = c; + this.orientation = d; + this.initialX = e; + this.parallelEdgeSpacing = f +} +var mxHierarchicalEdgeStyle = { + ORTHOGONAL: 1, + POLYLINE: 2, + STRAIGHT: 3, + CURVE: 4 +}; +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 a = this.layout.getModel(); + mxLog.show(); + mxLog.writeln("\x3d\x3d\x3d\x3d\x3d\x3dCoord assignment debug\x3d\x3d\x3d\x3d\x3d\x3d\x3d"); + for (var b = 0; b < a.ranks.length; b++) { + mxLog.write("Rank ", b, " : "); + for (var c = a.ranks[b], d = 0; d < c.length; d++) mxLog.write(c[d].getGeneralPurposeVariable(b), " "); + mxLog.writeln() + } + mxLog.writeln("\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d") +}; +mxCoordinateAssignment.prototype.execute = function(a) { + this.jettyPositions = []; + a = this.layout.getModel(); + this.currentXDelta = 0; + this.initialCoords(this.layout.getGraph(), a); + this.fineTuning && this.minNode(a); + var b = 1E8; + if (this.fineTuning) + for (var c = 0; c < this.maxIterations; c++) { + 0 != c && (this.medianPos(c, a), this.minNode(a)); + if (this.currentXDelta < b) { + for (var d = 0; d < a.ranks.length; d++) + for (var e = a.ranks[d], f = 0; f < e.length; f++) { + var g = e[f]; + g.setX(d, g.getGeneralPurposeVariable(d)) + } + b = this.currentXDelta + } else + for (d = 0; d < a.ranks.length; d++) { + e = + a.ranks[d]; + for (f = 0; f < e.length; f++) g = e[f], g.setGeneralPurposeVariable(d, g.getX(d)) + } + this.minPath(this.layout.getGraph(), a); + this.currentXDelta = 0 + } + this.setCellLocations(this.layout.getGraph(), a) +}; +mxCoordinateAssignment.prototype.minNode = function(a) { + for (var b = [], c = [], d = [], e = 0; e <= a.maxRank; e++) { + d[e] = a.ranks[e]; + for (var f = 0; f < d[e].length; f++) { + var g = d[e][f], + h = new WeightedCellSorter(g, e); + h.rankIndex = f; + h.visited = !0; + b.push(h); + g = mxCellPath.create(g.getCoreCell()); + c[g] = h + } + } + a = 10 * b.length; + for (f = 0; 0 < b.length && f <= a;) { + var h = b.shift(), + e = h.cell, + k = h.weightedValue, + l = parseInt(h.rankIndex), + g = e.getNextLayerConnectedCells(k), + m = e.getPreviousLayerConnectedCells(k), + n = g.length, + p = m.length, + q = this.medianXValue(g, k + 1), + s = + this.medianXValue(m, k - 1), + r = n + p, + t = e.getGeneralPurposeVariable(k), + v = t; + 0 < r && (v = (q * n + s * p) / r); + n = !1; + v < t - 1 ? 0 == l ? (e.setGeneralPurposeVariable(k, v), n = !0) : (l = d[k][l - 1], t = l.getGeneralPurposeVariable(k), t = t + l.width / 2 + this.intraCellSpacing + e.width / 2, t < v ? (e.setGeneralPurposeVariable( + k, v), n = !0) : t < e.getGeneralPurposeVariable(k) - 1 && (e.setGeneralPurposeVariable(k, t), n = !0)) : v > t + 1 && (l == d[k].length - 1 ? (e.setGeneralPurposeVariable(k, v), n = !0) : + (l = d[k][l + 1], t = l.getGeneralPurposeVariable(k), t = t - l.width / 2 - this.intraCellSpacing - + e.width / 2, t > v ? (e.setGeneralPurposeVariable(k, v), n = !0) : t > e.getGeneralPurposeVariable(k) + 1 && (e.setGeneralPurposeVariable(k, t), n = !0))); + if (n) { + for (e = 0; e < g.length; e++) k = g[e], k = mxCellPath.create(k.getCoreCell()), k = c[k], null != k && !1 == k.visited && (k.visited = !0, b.push(k)); + for (e = 0; e < m.length; e++) k = m[e], k = mxCellPath.create(k.getCoreCell()), k = c[k], null != k && !1 == k.visited && (k.visited = !0, b.push(k)) + } + h.visited = !1; + f++ + } +}; +mxCoordinateAssignment.prototype.medianPos = function(a, b) { + if (0 == a % 2) + for (var c = b.maxRank; 0 < c; c--) this.rankMedianPosition(c - 1, b, c); + else + for (c = 0; c < b.maxRank - 1; c++) this.rankMedianPosition(c + 1, b, c) +}; +mxCoordinateAssignment.prototype.rankMedianPosition = function(a, b, c) { + b = b.ranks[a]; + for (var d = [], e = [], f = 0; f < b.length; f++) { + var g = b[f]; + d[f] = new WeightedCellSorter; + d[f].cell = g; + d[f].rankIndex = f; + var h = mxCellPath.create(g.getCoreCell()); + e[h] = d[f]; + var k = null, + k = c < a ? g.getPreviousLayerConnectedCells(a) : g.getNextLayerConnectedCells(a); + d[f].weightedValue = this.calculatedWeightedValue(g, k) + } + d.sort(WeightedCellSorter.prototype.compare); + for (f = 0; f < d.length; f++) { + h = 0; + g = d[f].cell; + h = 0; + k = c < a ? g.getPreviousLayerConnectedCells(a).slice() : + g.getNextLayerConnectedCells(a).slice(); + null != k && (h = k.length, h = 0 < h ? this.medianXValue(k, c) : g.getGeneralPurposeVariable(a)); + for (var l = 0, k = -1E8, m = d[f].rankIndex - 1; 0 <= m;) { + var n = mxCellPath.create(b[m].getCoreCell()), + n = e[n]; + if (null != n) { + var p = n.cell; + n.visited ? (k = p.getGeneralPurposeVariable(a) + p.width / 2 + this.intraCellSpacing + l + g.width / 2, m = -1) : (l += p.width + this.intraCellSpacing, m--) + } + } + l = 0; + p = 1E8; + for (m = d[f].rankIndex + 1; m < d.length;) + if (n = mxCellPath.create(b[m].getCoreCell()), n = e[n], null != n) { + var q = n.cell; + n.visited ? + (p = q.getGeneralPurposeVariable(a) - q.width / 2 - this.intraCellSpacing - l - g.width / 2, m = d.length) : (l += q.width + this.intraCellSpacing, m++) + } + h >= k && h <= p ? g.setGeneralPurposeVariable(a, h) : h < k ? (g.setGeneralPurposeVariable(a, k), this.currentXDelta += k - h) : h > p && (g.setGeneralPurposeVariable(a, p), this.currentXDelta += + h - p); + d[f].visited = !0 + } +}; +mxCoordinateAssignment.prototype.calculatedWeightedValue = function(a, b) { + for (var c = 0, d = 0; d < b.length; d++) { + var e = b[d]; + a.isVertex() && e.isVertex() ? c++ : c = a.isEdge() && e.isEdge() ? c + 8 : c + 2 + } + return c +}; +mxCoordinateAssignment.prototype.medianXValue = function(a, b) { + if (0 == a.length) return 0; + for (var c = [], d = 0; d < a.length; d++) c[d] = a[d].getGeneralPurposeVariable(b); + c.sort(function(a, b) { + return a - b + }); + if (1 == a.length % 2) return c[Math.floor(a.length / 2)]; + d = a.length / 2; + return (c[d - 1] + c[d]) / 2 +}; +mxCoordinateAssignment.prototype.initialCoords = function(a, b) { + this.calculateWidestRank(a, b); + for (var c = this.widestRank; 0 <= c; c--) c < b.maxRank && this.rankCoordinates(c, a, b); + for (c = this.widestRank + 1; c <= b.maxRank; c++) 0 < c && this.rankCoordinates(c, a, b) +}; +mxCoordinateAssignment.prototype.rankCoordinates = function(a, b, c) { + b = c.ranks[a]; + c = 0; + for (var d = this.initialX + (this.widestRankValue - this.rankWidths[a]) / 2, e = !1, f = 0; f < b.length; f++) { + var g = b[f]; + if (g.isVertex()) { + var h = this.layout.getVertexBounds(g.cell); + null != h ? this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_SOUTH ? (g.width = h.width, g.height = h.height) : (g.width = h.height, g.height = h.width) : + e = !0; + c = Math.max(c, g.height) + } else g.isEdge() && (h = 1, null != g.edges ? h = g.edges.length : mxLog.warn("edge.edges is null"), + g.width = (h - 1) * this.parallelEdgeSpacing); + d += g.width / 2; + g.setX(a, d); + g.setGeneralPurposeVariable(a, d); + d += g.width / 2; + d += this.intraCellSpacing + }!0 == e && mxLog.warn("At least one cell has no bounds") +}; +mxCoordinateAssignment.prototype.calculateWidestRank = function(a, b) { + var c = -this.interRankCellSpacing, + d = 0; + this.rankWidths = []; + this.rankY = []; + for (var e = b.maxRank; 0 <= e; e--) { + for (var f = 0, g = b.ranks[e], h = this.initialX, k = !1, l = 0; l < g.length; l++) { + var m = g[l]; + if (m.isVertex()) { + var n = this.layout.getVertexBounds(m.cell); + null != n ? this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_SOUTH ? (m.width = n.width, m.height = n.height) : (m.width = n.height, m.height = n + .width) : k = !0; + f = Math.max(f, m.height) + } else m.isEdge() && + (n = 1, null != m.edges ? n = m.edges.length : mxLog.warn("edge.edges is null"), m.width = (n - 1) * this.parallelEdgeSpacing); + h += m.width / 2; + m.setX(e, h); + m.setGeneralPurposeVariable(e, h); + h += m.width / 2; + h += this.intraCellSpacing; + h > this.widestRankValue && (this.widestRankValue = h, this.widestRank = e); + this.rankWidths[e] = h + }!0 == k && mxLog.warn("At least one cell has no bounds"); + this.rankY[e] = c; + h = f / 2 + d / 2 + this.interRankCellSpacing; + d = f; + c = this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_WEST ? c + h : c - + h; + for (l = 0; l < g.length; l++) g[l].setY(e, c) + } +}; +mxCoordinateAssignment.prototype.minPath = function(a, b) { + var c = b.edgeMapper, + d; + for (d in c) { + var e = c[d]; + if (!(1 > e.maxRank - e.minRank - 1)) { + for (var f = e.getGeneralPurposeVariable(e.minRank + 1), g = !0, h = 0, k = e.minRank + 2; k < e.maxRank; k++) { + var l = e.getGeneralPurposeVariable(k); + f != l ? (g = !1, f = l) : h++ + } + if (!g) { + for (var g = f = 0, l = [], m = [], n = e.getGeneralPurposeVariable(e.minRank + 1), k = e.minRank + 1; k < e.maxRank - 1; k++) { + var p = e.getX(k + 1); + n == p ? (l[k - e.minRank - 1] = n, f++) : this.repositionValid(b, e, k + 1, n) ? (l[k - e.minRank - 1] = n, f++) : n = l[k - e.minRank - + 1] = p + } + n = e.getX(k); + for (k = e.maxRank - 1; k > e.minRank + 1; k--) p = e.getX(k - 1), n == p ? (m[k - e.minRank - 2] = n, g++) : this.repositionValid(b, e, k - 1, n) ? (m[k - e.minRank - 2] = n, g++) : (m[k - + e.minRank - 2] = e.getX(k - 1), n = p); + if (g > h || f > h) + if (g >= f) + for (k = e.maxRank - 2; k > e.minRank; k--) e.setX(k, m[k - e.minRank - 1]); + else if (f > g) + for (k = e.minRank + 2; k < e.maxRank; k++) e.setX(k, l[k - e.minRank - 2]) + } + } + } +}; +mxCoordinateAssignment.prototype.repositionValid = function(a, b, c, d) { + a = a.ranks[c]; + for (var e = -1, f = 0; f < a.length; f++) + if (b == a[f]) { + e = f; + break + } + if (0 > e) return !1; + f = b.getGeneralPurposeVariable(c); + if (d < f) { + if (0 == e) return !0; + a = a[e - 1]; + c = a.getGeneralPurposeVariable(c); + c = c + a.width / 2 + this.intraCellSpacing + b.width / 2; + if (!(c <= d)) return !1 + } else if (d > f) { + if (e == a.length - 1) return !0; + a = a[e + 1]; + c = a.getGeneralPurposeVariable(c); + c = c - a.width / 2 - this.intraCellSpacing - b.width / 2; + if (!(c >= d)) return !1 + } + return !0 +}; +mxCoordinateAssignment.prototype.setCellLocations = function(a, b) { + this.rankTopY = []; + this.rankBottomY = []; + for (var c = 0; c < b.ranks.length; c++) this.rankTopY[c] = Number.MAX_VALUE, this.rankBottomY[c] = 0; + c = null; + this.layout.resizeParent && (c = {}); + var d = b.edgeMapper, + e = b.vertexMapper, + f; + for (f in e) { + var g = e[f]; + this.setVertexLocation(g); + if (this.layout.resizeParent) { + var g = a.model.getParent(g.cell), + h = mxCellPath.create(g); + null == c[h] && (c[h] = g) + } + } + this.layout.resizeParent && null != c && this.adjustParents(c); + (this.edgeStyle == mxHierarchicalEdgeStyle.ORTHOGONAL || + this.edgeStyle == mxHierarchicalEdgeStyle.POLYLINE || this.edgeStyle == mxHierarchicalEdgeStyle.CURVE) && this.localEdgeProcessing(b); + for (f in d) this.setEdgePosition(d[f]) +}; +mxCoordinateAssignment.prototype.adjustParents = function(a) { + var b = [], + c; + for (c in a) b.push(a[c]); + this.layout.arrangeGroups(mxUtils.sortCells(b, !0), this.groupPadding) +}; +mxCoordinateAssignment.prototype.localEdgeProcessing = function(a) { + for (var b = 0; b < a.ranks.length; b++) + for (var c = a.ranks[b], d = 0; d < c.length; d++) { + var e = c[d]; + if (e.isVertex()) + for (var f = e.getPreviousLayerConnectedCells(b), g = b - 1, h = 0; 2 > h; h++) { + if (-1 < g && g < a.ranks.length && null != f && 0 < f.length) { + for (var k = [], l = 0; l < f.length; l++) { + var m = new WeightedCellSorter(f[l], f[l].getX(g)); + k.push(m) + } + k.sort(WeightedCellSorter.prototype.compare); + for (var m = e.x[0] - e.width / 2, n = m + e.width, p = f = 0, g = [], l = 0; l < k.length; l++) { + var q = k[l].cell, + s; + if (q.isVertex()) { + s = 0 == h ? e.connectsAsSource : e.connectsAsTarget; + for (var r = 0; r < s.length; r++) + if (s[r].source == q || s[r].target == q) f += s[r].edges.length, p++, g.push(s[r]) + } else f += q.edges.length, p++, g.push(q) + } + e.width > (f + 1) * this.prefHozEdgeSep + 2 * this.prefHozEdgeSep && (m += this.prefHozEdgeSep, n -= this.prefHozEdgeSep); + k = (n - m) / f; + m += k / 2; + n = this.minEdgeJetty - this.prefVertEdgeOff; + for (l = p = 0; l < g.length; l++) { + q = g[l].edges.length; + r = mxCellPath.create(g[l].edges[0]); + s = this.jettyPositions[r]; + null == s && (s = [], this.jettyPositions[r] = + s); + l < f / 2 ? n += this.prefVertEdgeOff : l > f / 2 && (n -= this.prefVertEdgeOff); + for (r = 0; r < q; r++) s[4 * r + 2 * h] = m, m += k, s[4 * r + 2 * h + 1] = n; + p = Math.max(p, n) + } + } + f = e.getNextLayerConnectedCells(b); + g = b + 1 + } + } +}; +mxCoordinateAssignment.prototype.setEdgePosition = function(a) { + var b = 0; + if (101207 != a.temp[0]) { + var c = a.maxRank, + d = a.minRank; + c == d && (c = a.source.maxRank, d = a.target.minRank); + for (var e = 0, f = mxCellPath.create(a.edges[0]), f = this.jettyPositions[f], g = a.isReversed ? a.target.cell : a.source.cell, h = this.layout.graph, k = 0; k < a.edges.length; k++) { + var l = a.edges[k], + m = this.layout.getVisibleTerminal(l, !0), + n = h.model.getTerminal(l, !0), + p = [], + q = a.isReversed; + m != g && (q = !q); + if (null != f) { + var s = q ? 2 : 0, + r = q ? this.rankTopY[d] : this.rankBottomY[c], + t = f[4 * e + 1 + s]; + q && (t = -t); + r += t; + s = f[4 * e + s]; + n = h.model.getTerminal(l, !0); + this.layout.isPort(n) && h.model.getParent(n) == m && (s = h.view.getState(n), s = null != s ? s.x : m.geometry.x + a.source.width * n.geometry.x); + this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_SOUTH ? (p.push(new mxPoint(s, r)), this.edgeStyle == mxHierarchicalEdgeStyle.CURVE && p.push( + new mxPoint(s, r + t))) : (p.push(new mxPoint(r, s)), this.edgeStyle == mxHierarchicalEdgeStyle.CURVE && p.push(new mxPoint(r + t, s))) + } + s = a.x.length - + 1; + r = t = -1; + m = a.maxRank - 1; + q && (s = 0, t = a.x.length, r = 1, m = a.minRank + 1); + for (; a.maxRank != a.minRank && s != t; s += r) { + var n = a.x[s] + b, + v = (this.rankTopY[m] + this.rankBottomY[m + 1]) / 2, + w = (this.rankTopY[m - 1] + this.rankBottomY[m]) / 2; + if (q) var u = v, + v = w, + w = u; + this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_SOUTH ? (p.push(new mxPoint(n, v)), p.push(new mxPoint(n, w))) : (p.push(new mxPoint(v, n)), p.push( + new mxPoint(w, n))); + this.limitX = Math.max(this.limitX, n); + m += r + } + null != f && (s = q ? 2 : 0, r = q ? this.rankBottomY[c] : + this.rankTopY[d], t = f[4 * e + 3 - s], q && (t = -t), r -= t, s = f[4 * e + 2 - s], q = h.model.getTerminal(l, !1), m = this.layout.getVisibleTerminal(l, !1), this.layout.isPort(q) && h.model + .getParent(q) == m && (s = h.view.getState(q), s = null != s ? s.x : m.geometry.x + a.target.width * q.geometry.x), this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == + mxConstants.DIRECTION_SOUTH ? (this.edgeStyle == mxHierarchicalEdgeStyle.CURVE && p.push(new mxPoint(s, r - t)), p.push(new mxPoint(s, r))) : (this.edgeStyle == mxHierarchicalEdgeStyle.CURVE && + p.push(new mxPoint(r - + t, s)), p.push(new mxPoint(r, s)))); + a.isReversed && this.processReversedEdge(a, l); + this.layout.setEdgePoints(l, p); + b = 0 == b ? this.parallelEdgeSpacing : 0 < b ? -b : -b + this.parallelEdgeSpacing; + e++ + } + a.temp[0] = 101207 + } +}; +mxCoordinateAssignment.prototype.setVertexLocation = function(a) { + var b = a.cell, + c = a.x[0] - a.width / 2, + d = a.y[0] - a.height / 2; + this.rankTopY[a.minRank] = Math.min(this.rankTopY[a.minRank], d); + this.rankBottomY[a.minRank] = Math.max(this.rankBottomY[a.minRank], d + a.height); + this.orientation == mxConstants.DIRECTION_NORTH || this.orientation == mxConstants.DIRECTION_SOUTH ? this.layout.setVertexLocation(b, c, d) : this.layout.setVertexLocation(b, d, c); + this.limitX = Math.max(this.limitX, c + a.width) +}; +mxCoordinateAssignment.prototype.processReversedEdge = function(a, b) {}; + +function WeightedCellSorter(a, b) { + this.cell = a; + this.weightedValue = b +} +WeightedCellSorter.prototype.weightedValue = 0; +WeightedCellSorter.prototype.nudge = !1; +WeightedCellSorter.prototype.visited = !1; +WeightedCellSorter.prototype.rankIndex = null; +WeightedCellSorter.prototype.cell = null; +WeightedCellSorter.prototype.compare = function(a, b) { + return null != a && null != b ? b.weightedValue > a.weightedValue ? -1 : b.weightedValue < a.weightedValue ? 1 : b.nudge ? -1 : 1 : 0 +}; + +function mxHierarchicalLayout(a, b, c) { + mxGraphLayout.call(this, a); + this.orientation = null != b ? b : mxConstants.DIRECTION_NORTH; + this.deterministic = null != c ? c : !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(a, b) { + this.parent = a; + var c = this.graph.model; + this.edgesCache = {}; + if (!(null == b && null == a)) { + if (null != b && null != a) { + for (var d = [], e = 0; e < b.length; e++) c.isAncestor(a, b[e]) && d.push(b[e]); + this.roots = d + } else this.roots = b; + c.beginUpdate(); + try { + this.run(a), this.resizeParent && !this.graph.isCellCollapsed(a) && this.graph.updateGroupBounds([a], this.parentBorder, this.moveParent) + } finally { + c.endUpdate() + } + } +}; +mxHierarchicalLayout.prototype.findRoots = function(a, b) { + var c = []; + if (null != a && null != b) { + var d = this.graph.model, + e = null, + f = -1E5, + g; + for (g in b) { + var h = b[g]; + if (d.isVertex(h) && this.graph.isCellVisible(h)) { + for (var k = this.getEdges(h), l = 0, m = 0, n = 0; n < k.length; n++) this.getVisibleTerminal(k[n], !0) == h ? l++ : m++; + 0 == m && 0 < l && c.push(h); + k = l - m; + k > f && (f = k, e = h) + } + } + 0 == c.length && null != e && c.push(e) + } + return c +}; +mxHierarchicalLayout.prototype.getEdges = function(a) { + var b = mxCellPath.create(a); + if (null != this.edgesCache[b]) return this.edgesCache[b]; + for (var c = this.graph.model, d = [], e = this.graph.isCellCollapsed(a), f = c.getChildCount(a), g = 0; g < f; g++) { + var h = c.getChildAt(a, g); + if (this.isPort(h)) d = d.concat(c.getEdges(h, !0, !0)); + else if (e || !this.graph.isCellVisible(h)) d = d.concat(c.getEdges(h, !0, !0)) + } + d = d.concat(c.getEdges(a, !0, !0)); + c = []; + for (g = 0; g < d.length; g++) e = this.getVisibleTerminal(d[g], !0), f = this.getVisibleTerminal(d[g], !1), (e == f || e != f && (f == a && (null == this.parent || this.graph.isValidAncestor(e, + this.parent, this.traverseAncestors)) || e == a && (null == this.parent || this.graph.isValidAncestor(f, this.parent, this.traverseAncestors)))) && c.push(d[g]); + return this.edgesCache[b] = c +}; +mxHierarchicalLayout.prototype.getVisibleTerminal = function(a, b) { + var c = this.graph.view.getState(a), + c = null != c ? c.getVisibleTerminal(b) : this.graph.view.getVisibleTerminal(a, b); + this.isPort(c) && (c = this.graph.model.getParent(c)); + return c +}; +mxHierarchicalLayout.prototype.run = function(a) { + var b = [], + c = []; + if (null == this.roots && null != a) { + var d = {}; + this.filterDescendants(a, d); + this.roots = []; + var e = !0, + f; + for (f in d) + if (null != d[f]) { + e = !1; + break + } + for (; !e;) { + for (var g = this.findRoots(a, d), e = 0; e < g.length; e++) { + var h = []; + b.push(h); + this.traverse(g[e], !0, null, c, h, b, d) + } + for (e = 0; e < g.length; e++) this.roots.push(g[e]); + e = !0; + for (f in d) + if (null != d[f]) { + e = !1; + break + } + } + } else + for (e = 0; e < roots.length; e++) h = [], b.push(h), traverse(roots.get(e), !0, null, c, h, b, null); + for (e = c = 0; e < b.length; e++) { + h = + b[e]; + d = []; + for (f in h) d.push(h[f]); + this.model = new mxGraphHierarchyModel(this, d, this.roots, a, this.tightenToSource); + this.cycleStage(a); + this.layeringStage(); + this.crossingStage(a); + c = this.placementStage(c, a) + } +}; +mxHierarchicalLayout.prototype.filterDescendants = function(a, b) { + var c = this.graph.model; + c.isVertex(a) && (a != this.parent && this.graph.isCellVisible(a)) && (b[mxCellPath.create(a)] = a); + if (this.traverseAncestors || a == this.parent && this.graph.isCellVisible(a)) + for (var d = c.getChildCount(a), e = 0; e < d; e++) { + var f = c.getChildAt(a, e); + this.isPort(f) || this.filterDescendants(f, b) + } +}; +mxHierarchicalLayout.prototype.isPort = function(a) { + return a.geometry.relative ? !0 : !1 +}; +mxHierarchicalLayout.prototype.getEdgesBetween = function(a, b, c) { + c = null != c ? c : !1; + for (var d = this.getEdges(a), e = [], f = 0; f < d.length; f++) { + var g = this.getVisibleTerminal(d[f], !0), + h = this.getVisibleTerminal(d[f], !1); + (g == a && h == b || !c && g == b && h == a) && e.push(d[f]) + } + return e +}; +mxHierarchicalLayout.prototype.traverse = function(a, b, c, d, e, f, g) { + if (null != a && null != d) { + var h = mxCellPath.create(a); + if (null == d[h] && (null == g || null != g[h])) { + null == e[h] && (e[h] = a); + null == d[h] && (d[h] = a); + delete g[h]; + var k = this.getEdges(a); + for (c = 0; c < k.length; c++) + if (h = this.getVisibleTerminal(k[c], !0) == a, !b || h) h = this.getVisibleTerminal(k[c], !h), e = this.traverse(h, b, k[c], d, e, f, g) + } else if (null == e[h]) + for (c = 0; c < f.length; c++) + if (a = f[c], null != a[h]) { + for (k in e) a[k] = e[k]; + f.pop(); + return a + } + } + return e +}; +mxHierarchicalLayout.prototype.cycleStage = function(a) { + (new mxMinimumCycleRemover(this)).execute(a) +}; +mxHierarchicalLayout.prototype.layeringStage = function() { + this.model.initialRank(); + this.model.fixRanks() +}; +mxHierarchicalLayout.prototype.crossingStage = function(a) { + (new mxMedianHybridCrossingReduction(this)).execute(a) +}; +mxHierarchicalLayout.prototype.placementStage = function(a, b) { + var c = new mxCoordinateAssignment(this, this.intraCellSpacing, this.interRankCellSpacing, this.orientation, a, this.parallelEdgeSpacing); + c.fineTuning = this.fineTuning; + c.execute(b); + return c.limitX + this.interHierarchySpacing +}; + +function mxGraphModel(a) { + this.currentEdit = this.createUndoableEdit(); + null != a ? this.setRoot(a) : this.clear() +} +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(a) { + this.createIds = a +}; +mxGraphModel.prototype.createRoot = function() { + var a = new mxCell; + a.insert(new mxCell); + return a +}; +mxGraphModel.prototype.getCell = function(a) { + return null != this.cells ? this.cells[a] : null +}; +mxGraphModel.prototype.filterCells = function(a, b) { + var c = null; + if (null != a) + for (var c = [], d = 0; d < a.length; d++) b(a[d]) && c.push(a[d]); + return c +}; +mxGraphModel.prototype.getDescendants = function(a) { + return this.filterDescendants(null, a) +}; +mxGraphModel.prototype.filterDescendants = function(a, b) { + var c = []; + b = b || this.getRoot(); + (null == a || a(b)) && c.push(b); + for (var d = this.getChildCount(b), e = 0; e < d; e++) var f = this.getChildAt(b, e), + c = c.concat(this.filterDescendants(a, f)); + return c +}; +mxGraphModel.prototype.getRoot = function(a) { + var b = a || this.root; + if (null != a) + for (; null != a;) b = a, a = this.getParent(a); + return b +}; +mxGraphModel.prototype.setRoot = function(a) { + this.execute(new mxRootChange(this, a)); + return a +}; +mxGraphModel.prototype.rootChanged = function(a) { + var b = this.root; + this.root = a; + this.nextId = 0; + this.cells = null; + this.cellAdded(a); + return b +}; +mxGraphModel.prototype.isRoot = function(a) { + return null != a && this.root == a +}; +mxGraphModel.prototype.isLayer = function(a) { + return this.isRoot(this.getParent(a)) +}; +mxGraphModel.prototype.isAncestor = function(a, b) { + for (; null != b && b != a;) b = this.getParent(b); + return b == a +}; +mxGraphModel.prototype.contains = function(a) { + return this.isAncestor(this.root, a) +}; +mxGraphModel.prototype.getParent = function(a) { + return null != a ? a.getParent() : null +}; +mxGraphModel.prototype.add = function(a, b, c) { + if (b != a && null != a && null != b) { + null == c && (c = this.getChildCount(a)); + var d = a != this.getParent(b); + this.execute(new mxChildChange(this, a, b, c)); + this.maintainEdgeParent && d && this.updateEdgeParents(b) + } + return b +}; +mxGraphModel.prototype.cellAdded = function(a) { + if (null != a) { + null == a.getId() && this.createIds && a.setId(this.createId(a)); + if (null != a.getId()) { + var b = this.getCell(a.getId()); + if (b != a) { + for (; null != b;) a.setId(this.createId(a)), b = this.getCell(a.getId()); + null == this.cells && (this.cells = {}); + this.cells[a.getId()] = a + } + } + mxUtils.isNumeric(a.getId()) && (this.nextId = Math.max(this.nextId, a.getId())); + for (var b = this.getChildCount(a), c = 0; c < b; c++) this.cellAdded(this.getChildAt(a, c)) + } +}; +mxGraphModel.prototype.createId = function(a) { + a = this.nextId; + this.nextId++; + return this.prefix + a + this.postfix +}; +mxGraphModel.prototype.updateEdgeParents = function(a, b) { + b = b || this.getRoot(a); + for (var c = this.getChildCount(a), d = 0; d < c; d++) { + var e = this.getChildAt(a, d); + this.updateEdgeParents(e, b) + } + e = this.getEdgeCount(a); + c = []; + for (d = 0; d < e; d++) c.push(this.getEdgeAt(a, d)); + for (d = 0; d < c.length; d++) e = c[d], this.isAncestor(b, e) && this.updateEdgeParent(e, b) +}; +mxGraphModel.prototype.updateEdgeParent = function(a, b) { + for (var c = this.getTerminal(a, !0), d = this.getTerminal(a, !1), e = null; null != c && !this.isEdge(c) && null != c.geometry && c.geometry.relative;) c = this.getParent(c); + for (; null != d && !this.isEdge(d) && null != d.geometry && d.geometry.relative;) d = this.getParent(d); + if (this.isAncestor(b, c) && this.isAncestor(b, d) && (e = c == d ? this.getParent(c) : this.getNearestCommonAncestor(c, d), null != e && (this.getParent(e) != this.root || this.isAncestor(e, a)) && + this.getParent(a) != e)) { + c = this.getGeometry(a); + if (null != c) { + var f = this.getOrigin(this.getParent(a)), + g = this.getOrigin(e), + d = g.x - f.x, + f = g.y - f.y, + c = c.clone(); + c.translate(-d, -f); + this.setGeometry(a, c) + } + this.add(e, a, this.getChildCount(e)) + } +}; +mxGraphModel.prototype.getOrigin = function(a) { + var b = null; + null != a ? (b = this.getOrigin(this.getParent(a)), this.isEdge(a) || (a = this.getGeometry(a), null != a && (b.x += a.x, b.y += a.y))) : b = new mxPoint; + return b +}; +mxGraphModel.prototype.getNearestCommonAncestor = function(a, b) { + if (null != a && null != b) { + var c = mxCellPath.create(b); + if (null != c && 0 < c.length) { + var d = a, + e = mxCellPath.create(d); + if (c.length < e.length) var d = b, + f = e, + e = c, + c = f; + for (; null != d;) { + f = this.getParent(d); + if (0 == c.indexOf(e + mxCellPath.PATH_SEPARATOR) && null != f) return d; + e = mxCellPath.getParentPath(e); + d = f + } + } + } + return null +}; +mxGraphModel.prototype.remove = function(a) { + a == this.root ? this.setRoot(null) : null != this.getParent(a) && this.execute(new mxChildChange(this, null, a)); + return a +}; +mxGraphModel.prototype.cellRemoved = function(a) { + if (null != a && null != this.cells) { + for (var b = this.getChildCount(a) - 1; 0 <= b; b--) this.cellRemoved(this.getChildAt(a, b)); + null != this.cells && null != a.getId() && delete this.cells[a.getId()] + } +}; +mxGraphModel.prototype.parentForCellChanged = function(a, b, c) { + var d = this.getParent(a); + null != b ? (b != d || d.getIndex(a) != c) && b.insert(a, c) : null != d && (c = d.getIndex(a), d.remove(c)); + !this.contains(d) && null != b ? this.cellAdded(a) : null == b && this.cellRemoved(a); + return d +}; +mxGraphModel.prototype.getChildCount = function(a) { + return null != a ? a.getChildCount() : 0 +}; +mxGraphModel.prototype.getChildAt = function(a, b) { + return null != a ? a.getChildAt(b) : null +}; +mxGraphModel.prototype.getChildren = function(a) { + return null != a ? a.children : null +}; +mxGraphModel.prototype.getChildVertices = function(a) { + return this.getChildCells(a, !0, !1) +}; +mxGraphModel.prototype.getChildEdges = function(a) { + return this.getChildCells(a, !1, !0) +}; +mxGraphModel.prototype.getChildCells = function(a, b, c) { + b = null != b ? b : !1; + c = null != c ? c : !1; + for (var d = this.getChildCount(a), e = [], f = 0; f < d; f++) { + var g = this.getChildAt(a, f); + (!c && !b || c && this.isEdge(g) || b && this.isVertex(g)) && e.push(g) + } + return e +}; +mxGraphModel.prototype.getTerminal = function(a, b) { + return null != a ? a.getTerminal(b) : null +}; +mxGraphModel.prototype.setTerminal = function(a, b, c) { + var d = b != this.getTerminal(a, c); + this.execute(new mxTerminalChange(this, a, b, c)); + this.maintainEdgeParent && d && this.updateEdgeParent(a, this.getRoot()); + return b +}; +mxGraphModel.prototype.setTerminals = function(a, b, c) { + this.beginUpdate(); + try { + this.setTerminal(a, b, !0), this.setTerminal(a, c, !1) + } finally { + this.endUpdate() + } +}; +mxGraphModel.prototype.terminalForCellChanged = function(a, b, c) { + var d = this.getTerminal(a, c); + null != b ? b.insertEdge(a, c) : null != d && d.removeEdge(a, c); + return d +}; +mxGraphModel.prototype.getEdgeCount = function(a) { + return null != a ? a.getEdgeCount() : 0 +}; +mxGraphModel.prototype.getEdgeAt = function(a, b) { + return null != a ? a.getEdgeAt(b) : null +}; +mxGraphModel.prototype.getDirectedEdgeCount = function(a, b, c) { + for (var d = 0, e = this.getEdgeCount(a), f = 0; f < e; f++) { + var g = this.getEdgeAt(a, f); + g != c && this.getTerminal(g, b) == a && d++ + } + return d +}; +mxGraphModel.prototype.getConnections = function(a) { + return this.getEdges(a, !0, !0, !1) +}; +mxGraphModel.prototype.getIncomingEdges = function(a) { + return this.getEdges(a, !0, !1, !1) +}; +mxGraphModel.prototype.getOutgoingEdges = function(a) { + return this.getEdges(a, !1, !0, !1) +}; +mxGraphModel.prototype.getEdges = function(a, b, c, d) { + b = null != b ? b : !0; + c = null != c ? c : !0; + d = null != d ? d : !0; + for (var e = this.getEdgeCount(a), f = [], g = 0; g < e; g++) { + var h = this.getEdgeAt(a, g), + k = this.getTerminal(h, !0), + l = this.getTerminal(h, !1); + (d && k == l || k != l && (b && l == a || c && k == a)) && f.push(h) + } + return f +}; +mxGraphModel.prototype.getEdgesBetween = function(a, b, c) { + c = null != c ? c : !1; + var d = this.getEdgeCount(a), + e = this.getEdgeCount(b), + f = a, + g = d; + e < d && (g = e, f = b); + d = []; + for (e = 0; e < g; e++) { + var h = this.getEdgeAt(f, e), + k = this.getTerminal(h, !0), + l = this.getTerminal(h, !1), + m = l == a && k == b; + (k == a && l == b || !c && m) && d.push(h) + } + return d +}; +mxGraphModel.prototype.getOpposites = function(a, b, c, d) { + c = null != c ? c : !0; + d = null != d ? d : !0; + var e = []; + if (null != a) + for (var f = 0; f < a.length; f++) { + var g = this.getTerminal(a[f], !0), + h = this.getTerminal(a[f], !1); + g == b && null != h && h != b && d ? e.push(h) : h == b && (null != g && g != b && c) && e.push(g) + } + return e +}; +mxGraphModel.prototype.getTopmostCells = function(a) { + for (var b = [], c = 0; c < a.length; c++) { + for (var d = a[c], e = !0, f = this.getParent(d); null != f;) { + if (0 <= mxUtils.indexOf(a, f)) { + e = !1; + break + } + f = this.getParent(f) + } + e && b.push(d) + } + return b +}; +mxGraphModel.prototype.isVertex = function(a) { + return null != a ? a.isVertex() : !1 +}; +mxGraphModel.prototype.isEdge = function(a) { + return null != a ? a.isEdge() : !1 +}; +mxGraphModel.prototype.isConnectable = function(a) { + return null != a ? a.isConnectable() : !1 +}; +mxGraphModel.prototype.getValue = function(a) { + return null != a ? a.getValue() : null +}; +mxGraphModel.prototype.setValue = function(a, b) { + this.execute(new mxValueChange(this, a, b)); + return b +}; +mxGraphModel.prototype.valueForCellChanged = function(a, b) { + return a.valueChanged(b) +}; +mxGraphModel.prototype.getGeometry = function(a, b) { + return null != a ? a.getGeometry() : null +}; +mxGraphModel.prototype.setGeometry = function(a, b) { + b != this.getGeometry(a) && this.execute(new mxGeometryChange(this, a, b)); + return b +}; +mxGraphModel.prototype.geometryForCellChanged = function(a, b) { + var c = this.getGeometry(a); + a.setGeometry(b); + return c +}; +mxGraphModel.prototype.getStyle = function(a) { + return null != a ? a.getStyle() : null +}; +mxGraphModel.prototype.setStyle = function(a, b) { + b != this.getStyle(a) && this.execute(new mxStyleChange(this, a, b)); + return b +}; +mxGraphModel.prototype.styleForCellChanged = function(a, b) { + var c = this.getStyle(a); + a.setStyle(b); + return c +}; +mxGraphModel.prototype.isCollapsed = function(a) { + return null != a ? a.isCollapsed() : !1 +}; +mxGraphModel.prototype.setCollapsed = function(a, b) { + b != this.isCollapsed(a) && this.execute(new mxCollapseChange(this, a, b)); + return b +}; +mxGraphModel.prototype.collapsedStateForCellChanged = function(a, b) { + var c = this.isCollapsed(a); + a.setCollapsed(b); + return c +}; +mxGraphModel.prototype.isVisible = function(a) { + return null != a ? a.isVisible() : !1 +}; +mxGraphModel.prototype.setVisible = function(a, b) { + b != this.isVisible(a) && this.execute(new mxVisibleChange(this, a, b)); + return b +}; +mxGraphModel.prototype.visibleStateForCellChanged = function(a, b) { + var c = this.isVisible(a); + a.setVisible(b); + return c +}; +mxGraphModel.prototype.execute = function(a) { + a.execute(); + this.beginUpdate(); + this.currentEdit.add(a); + this.fireEvent(new mxEventObject(mxEvent.EXECUTE, "change", a)); + this.fireEvent(new mxEventObject(mxEvent.EXECUTED, "change", a)); + 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() { + this.updateLevel--; + 0 == this.updateLevel && this.fireEvent(new mxEventObject(mxEvent.END_EDIT)); + if (!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 a = this.currentEdit; + this.currentEdit = this.createUndoableEdit(); + a.notify(); + this.fireEvent(new mxEventObject(mxEvent.UNDO, + "edit", a)) + } + } finally { + this.endingUpdate = !1 + } + } +}; +mxGraphModel.prototype.createUndoableEdit = function() { + var a = new mxUndoableEdit(this, !0); + a.notify = function() { + a.source.fireEvent(new mxEventObject(mxEvent.CHANGE, "edit", a, "changes", a.changes)); + a.source.fireEvent(new mxEventObject(mxEvent.NOTIFY, "edit", a, "changes", a.changes)) + }; + return a +}; +mxGraphModel.prototype.mergeChildren = function(a, b, c) { + c = null != c ? c : !0; + this.beginUpdate(); + try { + var d = {}; + this.mergeChildrenImpl(a, b, c, d); + for (var e in d) { + var f = d[e], + g = this.getTerminal(f, !0); + null != g && (g = d[mxCellPath.create(g)], this.setTerminal(f, g, !0)); + g = this.getTerminal(f, !1); + null != g && (g = d[mxCellPath.create(g)], this.setTerminal(f, g, !1)) + } + } finally { + this.endUpdate() + } +}; +mxGraphModel.prototype.mergeChildrenImpl = function(a, b, c, d) { + this.beginUpdate(); + try { + for (var e = a.getChildCount(), f = 0; f < e; f++) { + var g = a.getChildAt(f); + if ("function" == typeof g.getId) { + var h = g.getId(), + k = null != h && (!this.isEdge(g) || !c) ? this.getCell(h) : null; + if (null == k) { + var l = g.clone(); + l.setId(h); + l.setTerminal(g.getTerminal(!0), !0); + l.setTerminal(g.getTerminal(!1), !1); + k = b.insert(l); + this.cellAdded(k) + } + d[mxCellPath.create(g)] = k; + this.mergeChildrenImpl(g, k, c, d) + } + } + } finally { + this.endUpdate() + } +}; +mxGraphModel.prototype.getParents = function(a) { + var b = []; + if (null != a) + for (var c = {}, d = 0; d < a.length; d++) { + var e = this.getParent(a[d]); + if (null != e) { + var f = mxCellPath.create(e); + null == c[f] && (c[f] = e, b.push(e)) + } + } + return b +}; +mxGraphModel.prototype.cloneCell = function(a) { + return null != a ? this.cloneCells([a], !0)[0] : null +}; +mxGraphModel.prototype.cloneCells = function(a, b) { + for (var c = {}, d = [], e = 0; e < a.length; e++) null != a[e] ? d.push(this.cloneCellImpl(a[e], c, b)) : d.push(null); + for (e = 0; e < d.length; e++) null != d[e] && this.restoreClone(d[e], a[e], c); + return d +}; +mxGraphModel.prototype.cloneCellImpl = function(a, b, c) { + var d = this.cellCloned(a); + b[mxObjectIdentity.get(a)] = d; + if (c) { + c = this.getChildCount(a); + for (var e = 0; e < c; e++) { + var f = this.cloneCellImpl(this.getChildAt(a, e), b, !0); + d.insert(f) + } + } + return d +}; +mxGraphModel.prototype.cellCloned = function(a) { + return a.clone() +}; +mxGraphModel.prototype.restoreClone = function(a, b, c) { + var d = this.getTerminal(b, !0); + null != d && (d = c[mxObjectIdentity.get(d)], null != d && d.insertEdge(a, !0)); + d = this.getTerminal(b, !1); + null != d && (d = c[mxObjectIdentity.get(d)], null != d && d.insertEdge(a, !1)); + for (var d = this.getChildCount(a), e = 0; e < d; e++) this.restoreClone(this.getChildAt(a, e), this.getChildAt(b, e), c) +}; + +function mxRootChange(a, b) { + this.model = a; + this.previous = this.root = b +} +mxRootChange.prototype.execute = function() { + this.root = this.previous; + this.previous = this.model.rootChanged(this.previous) +}; + +function mxChildChange(a, b, c, d) { + this.model = a; + this.previous = this.parent = b; + this.child = c; + this.previousIndex = this.index = d +} +mxChildChange.prototype.execute = function() { + var a = this.model.getParent(this.child), + b = null != a ? a.getIndex(this.child) : 0; + null == this.previous && this.connect(this.child, !1); + a = this.model.parentForCellChanged(this.child, this.previous, this.previousIndex); + null != this.previous && this.connect(this.child, !0); + this.parent = this.previous; + this.previous = a; + this.index = this.previousIndex; + this.previousIndex = b +}; +mxChildChange.prototype.connect = function(a, b) { + b = null != b ? b : !0; + var c = a.getTerminal(!0), + d = a.getTerminal(!1); + null != c && (b ? this.model.terminalForCellChanged(a, c, !0) : this.model.terminalForCellChanged(a, null, !0)); + null != d && (b ? this.model.terminalForCellChanged(a, d, !1) : this.model.terminalForCellChanged(a, null, !1)); + a.setTerminal(c, !0); + a.setTerminal(d, !1); + c = this.model.getChildCount(a); + for (d = 0; d < c; d++) this.connect(this.model.getChildAt(a, d), b) +}; + +function mxTerminalChange(a, b, c, d) { + this.model = a; + this.cell = b; + this.previous = this.terminal = c; + this.source = d +} +mxTerminalChange.prototype.execute = function() { + this.terminal = this.previous; + this.previous = this.model.terminalForCellChanged(this.cell, this.previous, this.source) +}; + +function mxValueChange(a, b, c) { + this.model = a; + this.cell = b; + this.previous = this.value = c +} +mxValueChange.prototype.execute = function() { + this.value = this.previous; + this.previous = this.model.valueForCellChanged(this.cell, this.previous) +}; + +function mxStyleChange(a, b, c) { + this.model = a; + this.cell = b; + this.previous = this.style = c +} +mxStyleChange.prototype.execute = function() { + this.style = this.previous; + this.previous = this.model.styleForCellChanged(this.cell, this.previous) +}; + +function mxGeometryChange(a, b, c) { + this.model = a; + this.cell = b; + this.previous = this.geometry = c +} +mxGeometryChange.prototype.execute = function() { + this.geometry = this.previous; + this.previous = this.model.geometryForCellChanged(this.cell, this.previous) +}; + +function mxCollapseChange(a, b, c) { + this.model = a; + this.cell = b; + this.previous = this.collapsed = c +} +mxCollapseChange.prototype.execute = function() { + this.collapsed = this.previous; + this.previous = this.model.collapsedStateForCellChanged(this.cell, this.previous) +}; + +function mxVisibleChange(a, b, c) { + this.model = a; + this.cell = b; + this.previous = this.visible = c +} +mxVisibleChange.prototype.execute = function() { + this.visible = this.previous; + this.previous = this.model.visibleStateForCellChanged(this.cell, this.previous) +}; + +function mxCellAttributeChange(a, b, c) { + this.cell = a; + this.attribute = b; + this.previous = this.value = c +} +mxCellAttributeChange.prototype.execute = function() { + var a = this.cell.getAttribute(this.attribute); + null == this.previous ? this.cell.value.removeAttribute(this.attribute) : this.cell.setAttribute(this.attribute, this.previous); + this.previous = a +}; + +function mxCell(a, b, c) { + this.value = a; + this.setGeometry(b); + this.setStyle(c); + if (null != this.onInit) this.onInit() +} +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(a) { + this.id = a +}; +mxCell.prototype.getValue = function() { + return this.value +}; +mxCell.prototype.setValue = function(a) { + this.value = a +}; +mxCell.prototype.valueChanged = function(a) { + var b = this.getValue(); + this.setValue(a); + return b +}; +mxCell.prototype.getGeometry = function() { + return this.geometry +}; +mxCell.prototype.setGeometry = function(a) { + this.geometry = a +}; +mxCell.prototype.getStyle = function() { + return this.style +}; +mxCell.prototype.setStyle = function(a) { + this.style = a +}; +mxCell.prototype.isVertex = function() { + return this.vertex +}; +mxCell.prototype.setVertex = function(a) { + this.vertex = a +}; +mxCell.prototype.isEdge = function() { + return this.edge +}; +mxCell.prototype.setEdge = function(a) { + this.edge = a +}; +mxCell.prototype.isConnectable = function() { + return this.connectable +}; +mxCell.prototype.setConnectable = function(a) { + this.connectable = a +}; +mxCell.prototype.isVisible = function() { + return this.visible +}; +mxCell.prototype.setVisible = function(a) { + this.visible = a +}; +mxCell.prototype.isCollapsed = function() { + return this.collapsed +}; +mxCell.prototype.setCollapsed = function(a) { + this.collapsed = a +}; +mxCell.prototype.getParent = function() { + return this.parent +}; +mxCell.prototype.setParent = function(a) { + this.parent = a +}; +mxCell.prototype.getTerminal = function(a) { + return a ? this.source : this.target +}; +mxCell.prototype.setTerminal = function(a, b) { + b ? this.source = a : this.target = a; + return a +}; +mxCell.prototype.getChildCount = function() { + return null == this.children ? 0 : this.children.length +}; +mxCell.prototype.getIndex = function(a) { + return mxUtils.indexOf(this.children, a) +}; +mxCell.prototype.getChildAt = function(a) { + return null == this.children ? null : this.children[a] +}; +mxCell.prototype.insert = function(a, b) { + null != a && (null == b && (b = this.getChildCount(), a.getParent() == this && b--), a.removeFromParent(), a.setParent(this), null == this.children ? (this.children = [], this.children.push(a)) : + this.children.splice(b, 0, a)); + return a +}; +mxCell.prototype.remove = function(a) { + var b = null; + null != this.children && 0 <= a && (b = this.getChildAt(a), null != b && (this.children.splice(a, 1), b.setParent(null))); + return b +}; +mxCell.prototype.removeFromParent = function() { + if (null != this.parent) { + var a = this.parent.getIndex(this); + this.parent.remove(a) + } +}; +mxCell.prototype.getEdgeCount = function() { + return null == this.edges ? 0 : this.edges.length +}; +mxCell.prototype.getEdgeIndex = function(a) { + return mxUtils.indexOf(this.edges, a) +}; +mxCell.prototype.getEdgeAt = function(a) { + return null == this.edges ? null : this.edges[a] +}; +mxCell.prototype.insertEdge = function(a, b) { + if (null != a && (a.removeFromTerminal(b), a.setTerminal(this, b), null == this.edges || a.getTerminal(!b) != this || 0 > mxUtils.indexOf(this.edges, a))) null == this.edges && (this.edges = []), + this.edges.push(a); + return a +}; +mxCell.prototype.removeEdge = function(a, b) { + if (null != a) { + if (a.getTerminal(!b) != this && null != this.edges) { + var c = this.getEdgeIndex(a); + 0 <= c && this.edges.splice(c, 1) + } + a.setTerminal(null, b) + } + return a +}; +mxCell.prototype.removeFromTerminal = function(a) { + var b = this.getTerminal(a); + null != b && b.removeEdge(this, a) +}; +mxCell.prototype.getAttribute = function(a, b) { + var c = this.getValue(); + return (null != c && c.nodeType == mxConstants.NODETYPE_ELEMENT ? c.getAttribute(a) : null) || b +}; +mxCell.prototype.setAttribute = function(a, b) { + var c = this.getValue(); + null != c && c.nodeType == mxConstants.NODETYPE_ELEMENT && c.setAttribute(a, b) +}; +mxCell.prototype.clone = function() { + var a = mxUtils.clone(this, this.mxTransient); + a.setValue(this.cloneValue()); + return a +}; +mxCell.prototype.cloneValue = function() { + var a = this.getValue(); + null != a && ("function" == typeof a.clone ? a = a.clone() : isNaN(a.nodeType) || (a = a.cloneNode(!0))); + return a +}; + +function mxGeometry(a, b, c, d) { + mxRectangle.call(this, a, b, c, d) +} +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 a = 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 = a + } +}; +mxGeometry.prototype.getTerminalPoint = function(a) { + return a ? this.sourcePoint : this.targetPoint +}; +mxGeometry.prototype.setTerminalPoint = function(a, b) { + b ? this.sourcePoint = a : this.targetPoint = a; + return a +}; +mxGeometry.prototype.translate = function(a, b) { + this.clone(); + this.relative || (this.x += a, this.y += b); + null != this.sourcePoint && (this.sourcePoint.x += a, this.sourcePoint.y += b); + null != this.targetPoint && (this.targetPoint.x += a, this.targetPoint.y += b); + if (this.TRANSLATE_CONTROL_POINTS && null != this.points) + for (var c = this.points.length, d = 0; d < c; d++) { + var e = this.points[d]; + null != e && (e.x += a, e.y += b) + } +}; +var mxCellPath = { + PATH_SEPARATOR: ".", + create: function(a) { + var b = ""; + if (null != a) + for (var c = a.getParent(); null != c;) b = c.getIndex(a) + mxCellPath.PATH_SEPARATOR + b, a = c, c = a.getParent(); + a = b.length; + 1 < a && (b = b.substring(0, a - 1)); + return b + }, + getParentPath: function(a) { + if (null != a) { + var b = a.lastIndexOf(mxCellPath.PATH_SEPARATOR); + if (0 <= b) return a.substring(0, b); + if (0 < a.length) return "" + } + return null + }, + resolve: function(a, b) { + var c = a; + if (null != b) + for (var d = b.split(mxCellPath.PATH_SEPARATOR), e = 0; e < d.length; e++) c = c.getChildAt(parseInt(d[e])); + return c + }, + compare: function(a, b) { + for (var c = Math.min(a.length, b.length), d = 0, e = 0; e < c; e++) + if (a[e] != b[e]) { + 0 == a[e].length || 0 == b[e].length ? d = a[e] == b[e] ? 0 : a[e] > b[e] ? 1 : -1 : (c = parseInt(a[e]), e = parseInt(b[e]), d = c == e ? 0 : c > e ? 1 : -1); + break + } + 0 == d && (c = a.length, e = b.length, c != e && (d = c > e ? 1 : -1)); + return d + } + }, + mxPerimeter = { + RectanglePerimeter: function(a, b, c, d) { + b = a.getCenterX(); + var e = a.getCenterY(), + f = Math.atan2(c.y - e, c.x - b), + g = new mxPoint(0, 0), + h = Math.PI, + k = Math.PI / 2 - f, + l = Math.atan2(a.height, a.width); + f < -h + l || f > h - l ? (g.x = a.x, g.y = e - a.width * + Math.tan(f) / 2) : f < -l ? (g.y = a.y, g.x = b - a.height * Math.tan(k) / 2) : f < l ? (g.x = a.x + a.width, g.y = e + a.width * Math.tan(f) / 2) : (g.y = a.y + a.height, g.x = b + a.height * + Math.tan(k) / 2); + d && (c.x >= a.x && c.x <= a.x + a.width ? g.x = c.x : c.y >= a.y && c.y <= a.y + a.height && (g.y = c.y), c.x < a.x ? g.x = a.x : c.x > a.x + a.width && (g.x = a.x + a.width), c.y < a.y ? g.y = + a.y : c.y > a.y + a.height && (g.y = a.y + a.height)); + return g + }, + EllipsePerimeter: function(a, b, c, d) { + var e = a.x, + f = a.y, + g = a.width / 2, + h = a.height / 2, + k = e + g, + l = f + h; + b = c.x; + c = c.y; + var m = parseInt(b - k), + n = parseInt(c - l); + if (0 == m && 0 != n) return new mxPoint(k, + l + h * n / Math.abs(n)); + if (0 == m && 0 == n) return new mxPoint(b, c); + if (d) { + if (c >= f && c <= f + a.height) return a = c - l, a = Math.sqrt(g * g * (1 - a * a / (h * h))) || 0, b <= e && (a = -a), new mxPoint(k + a, c); + if (b >= e && b <= e + a.width) return a = b - k, a = Math.sqrt(h * h * (1 - a * a / (g * g))) || 0, c <= f && (a = -a), new mxPoint(b, l + a) + } + e = n / m; + l -= e * k; + f = g * g * e * e + h * h; + a = -2 * k * f; + h = Math.sqrt(a * a - 4 * f * (g * g * e * e * k * k + h * h * k * k - g * g * h * h)); + g = (-a + h) / (2 * f); + h = (-a - h) / (2 * f); + k = e * g + l; + l = e * h + l; + e = Math.sqrt(Math.pow(g - b, 2) + Math.pow(k - c, 2)); + b = Math.sqrt(Math.pow(h - b, 2) + Math.pow(l - c, 2)); + f = c = 0; + e < b ? (c = + g, f = k) : (c = h, f = l); + return new mxPoint(c, f) + }, + RhombusPerimeter: function(a, b, c, d) { + b = a.x; + var e = a.y, + f = a.width; + a = a.height; + var g = b + f / 2, + h = e + a / 2, + k = c.x; + c = c.y; + if (g == k) return h > c ? new mxPoint(g, e) : new mxPoint(g, e + a); + if (h == c) return g > k ? new mxPoint(b, h) : new mxPoint(b + f, h); + var l = g, + m = h; + d && (k >= b && k <= b + f ? l = k : c >= e && c <= e + a && (m = c)); + return k < g ? c < h ? mxUtils.intersection(k, c, l, m, g, e, b, h) : mxUtils.intersection(k, c, l, m, g, e + a, b, h) : c < h ? mxUtils.intersection(k, c, l, m, g, e, b + f, h) : mxUtils.intersection( + k, c, l, m, g, e + a, b + f, h) + }, + TrianglePerimeter: function(a, + b, c, d) { + b = null != b ? b.style[mxConstants.STYLE_DIRECTION] : null; + var e = b == mxConstants.DIRECTION_NORTH || b == mxConstants.DIRECTION_SOUTH, + f = a.x, + g = a.y, + h = a.width; + a = a.height; + var k = f + h / 2, + l = g + a / 2, + m = new mxPoint(f, g), + n = new mxPoint(f + h, l), + p = new mxPoint(f, g + a); + b == mxConstants.DIRECTION_NORTH ? (m = p, n = new mxPoint(k, g), p = new mxPoint(f + h, g + a)) : b == mxConstants.DIRECTION_SOUTH ? (n = new mxPoint(k, g + a), p = new mxPoint(f + h, g)) : + b == mxConstants.DIRECTION_WEST && (m = new mxPoint(f + h, g), n = new mxPoint(f, l), p = new mxPoint(f + h, g + a)); + var q = c.x - + k, + s = c.y - l, + q = e ? Math.atan2(q, s) : Math.atan2(s, q), + r = e ? Math.atan2(h, a) : Math.atan2(a, h), + s = !1, + s = b == mxConstants.DIRECTION_NORTH || b == mxConstants.DIRECTION_WEST ? q > -r && q < r : q < -Math.PI + r || q > Math.PI - r, + r = null; + s ? r = d && (e && c.x >= m.x && c.x <= p.x || !e && c.y >= m.y && c.y <= p.y) ? e ? new mxPoint(c.x, m.y) : new mxPoint(m.x, c.y) : b == mxConstants.DIRECTION_NORTH ? new mxPoint(f + h / 2 + + a * Math.tan(q) / 2, g + a) : b == mxConstants.DIRECTION_SOUTH ? new mxPoint(f + h / 2 - a * Math.tan(q) / 2, g) : b == mxConstants.DIRECTION_WEST ? new mxPoint(f + h, g + a / 2 + h * + Math.tan(q) / 2) : new mxPoint(f, + g + a / 2 - h * Math.tan(q) / 2) : (d && (d = new mxPoint(k, l), c.y >= g && c.y <= g + a ? (d.x = e ? k : b == mxConstants.DIRECTION_WEST ? f + h : f, d.y = c.y) : c.x >= f && c.x <= f + + h && (d.x = c.x, d.y = !e ? l : b == mxConstants.DIRECTION_NORTH ? g + a : g), k = d.x, l = d.y), r = e && c.x <= f + h / 2 || !e && c.y <= g + a / 2 ? mxUtils.intersection(c.x, c.y, k, + l, m.x, m.y, n.x, n.y) : mxUtils.intersection(c.x, c.y, k, l, n.x, n.y, p.x, p.y)); + null == r && (r = new mxPoint(k, l)); + return r + } + }; + +function mxPrintPreview(a, b, c, d, e, f, g, h, k) { + this.graph = a; + this.scale = null != b ? b : 1 / a.pageScale; + this.border = null != d ? d : 0; + this.pageFormat = null != c ? c : a.pageFormat; + this.title = null != h ? h : "Printer-friendly version"; + this.x0 = null != e ? e : 0; + this.y0 = null != f ? f : 0; + this.borderColor = g; + this.pageSelector = null != k ? k : !0 +} +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 a = ""; + 8 == document.documentMode && (a = '\x3cmeta http-equiv\x3d"X-UA-Compatible" content\x3d"IE\x3d8"\x3e'); + return a +}; +mxPrintPreview.prototype.open = function(a) { + var b = this.graph.cellRenderer.initializeOverlay, + c = null; + try { + this.printOverlays && (this.graph.cellRenderer.initializeOverlay = function(a, b) { + b.init(a.view.getDrawPane()) + }); + if (null == this.wnd) { + this.wnd = window.open(); + var d = this.wnd.document, + e = this.getDoctype(); + null != e && 0 < e.length && d.writeln(e); + d.writeln("\x3chtml\x3e"); + d.writeln("\x3chead\x3e"); + this.writeHead(d, a); + d.writeln("\x3c/head\x3e"); + d.writeln('\x3cbody class\x3d"mxPage"\x3e'); + mxClient.link("stylesheet", mxClient.basePath + + "/css/common.css", d); + mxClient.IS_VML && (d.namespaces.add("v", "urn:schemas-microsoft-com:vml"), d.namespaces.add("o", "urn:schemas-microsoft-com:office:office"), d.createStyleSheet().cssText = + "v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}", mxClient.link("stylesheet", mxClient.basePath + "/css/explorer.css", d)); + var f = this.graph.getGraphBounds().clone(), + g = this.graph.getView().getScale(), + h = g / this.scale, + k = this.graph.getView().getTranslate(); + this.autoOrigin || (this.x0 = -k.x * this.scale, this.y0 = -k.y * this.scale, f.width += f.x, f.height += f.y, f.x = 0, this.border = f.y = 0); + f.width /= h; + f.height /= h; + var l = this.pageFormat.width - 2 * this.border, + m = this.pageFormat.height - 2 * this.border, + n = Math.max(1, Math.ceil((f.width + this.x0) / l)), + p = Math.max(1, Math.ceil((f.height + this.y0) / m)); + this.pageCount = n * p; + var q = mxUtils.bind(this, function() { + if (this.pageSelector && (1 < p || 1 < n)) { + var a = this.createPageSelector(p, n); + d.body.appendChild(a); + if (mxClient.IS_IE) { + a.style.position = "absolute"; + var b = function() { + a.style.top = d.body.scrollTop + + 10 + "px" + }; + mxEvent.addListener(this.wnd, "scroll", function(a) { + b() + }); + mxEvent.addListener(this.wnd, "resize", function(a) { + b() + }) + } + } + }); + a = function(a, b) { + null != this.borderColor && (a.style.borderColor = this.borderColor, a.style.borderStyle = "solid", a.style.borderWidth = "1px"); + a.style.background = "white"; + b && (a.style.pageBreakAfter = "always"); + mxClient.IS_IE ? (d.writeln(a.outerHTML), a.parentNode.removeChild(a)) : (a.parentNode.removeChild(a), d.body.appendChild(a)); + if (b) { + var c = d.createElement("hr"); + c.className = "mxPageBreak"; + d.body.appendChild(c) + } + }; + var s = this.getCoverPages(this.pageFormat.width, this.pageFormat.height); + if (null != s) + for (var r = 0; r < s.length; r++) a(s[r], !0); + for (var t = this.getAppendices(this.pageFormat.width, this.pageFormat.height), r = 0; r < p; r++) + for (var v = r * m / this.scale - this.y0 / this.scale + (f.y - k.y * g) / g, s = 0; s < n; s++) { + if (null == this.wnd) return null; + var w = s * l / this.scale - this.x0 / this.scale + (f.x - k.x * g) / g, + u = r * n + s + 1, + c = this.renderPage(this.pageFormat.width, this.pageFormat.height, mxUtils.bind(this, function(a) { + this.addGraphFragment(-w, -v, this.scale, u, a) + })); + c.setAttribute("id", "mxPage-" + u); + a(c, null != t || r < p - 1 || s < n - 1) + } + if (null != t) + for (r = 0; r < t.length; r++) a(t[r], r < t.length); + d.writeln("\x3c/body\x3e"); + d.writeln("\x3c/html\x3e"); + d.close(); + q(); + mxEvent.release(d.body) + } + this.wnd.focus() + } catch (y) { + null != c && null != c.parentNode && c.parentNode.removeChild(c) + } finally { + this.graph.cellRenderer.initializeOverlay = b + } + return this.wnd +}; +mxPrintPreview.prototype.writeHead = function(a, b) { + null != this.title && a.writeln("\x3ctitle\x3e" + this.title + "\x3c/title\x3e"); + a.writeln('\x3cstyle type\x3d"text/css"\x3e'); + a.writeln("@media print {"); + a.writeln(" table.mxPageSelector { display: none; }"); + a.writeln(" hr.mxPageBreak { display: none; }"); + a.writeln("}"); + a.writeln("@media screen {"); + a.writeln(" table.mxPageSelector { position: fixed; right: 10px; top: 10px;font-family: Arial; font-size:10pt; border: solid 1px darkgray;background: white; border-collapse:collapse; }"); + a.writeln(" table.mxPageSelector td { border: solid 1px gray; padding:4px; }"); + a.writeln(" body.mxPage { background: gray; }"); + a.writeln("}"); + null != b && a.writeln(b); + a.writeln("\x3c/style\x3e") +}; +mxPrintPreview.prototype.createPageSelector = function(a, b) { + var c = this.wnd.document, + d = c.createElement("table"); + d.className = "mxPageSelector"; + d.setAttribute("border", "0"); + for (var e = c.createElement("tbody"), f = 0; f < a; f++) { + for (var g = c.createElement("tr"), h = 0; h < b; h++) { + var k = f * b + h + 1, + l = c.createElement("td"); + if (!mxClient.IS_NS || mxClient.IS_SF || mxClient.IS_GC) { + var m = c.createElement("a"); + m.setAttribute("href", "#mxPage-" + k); + mxUtils.write(m, k, c); + l.appendChild(m) + } else mxUtils.write(l, k, c); + g.appendChild(l) + } + e.appendChild(g) + } + d.appendChild(e); + return d +}; +mxPrintPreview.prototype.renderPage = function(a, b, c) { + var d = document.createElement("div"); + try { + d.style.width = a + "px"; + d.style.height = b + "px"; + d.style.overflow = "hidden"; + d.style.pageBreakInside = "avoid"; + d.style.position = "relative"; + var e = document.createElement("div"); + e.style.top = this.border + "px"; + e.style.left = this.border + "px"; + e.style.width = a - 2 * this.border + "px"; + e.style.height = b - 2 * this.border + "px"; + e.style.overflow = "hidden"; + this.graph.dialect == mxConstants.DIALECT_VML && (e.style.position = "absolute"); + d.appendChild(e); + document.body.appendChild(d); + c(e) + } catch (f) { + throw d.parentNode.removeChild(d), f; + } + return d +}; +mxPrintPreview.prototype.addGraphFragment = function(a, b, c, d, e) { + d = this.graph.getView(); + var f = this.graph.container; + this.graph.container = e; + var g = d.getCanvas(), + h = d.getBackgroundPane(), + k = d.getDrawPane(), + l = d.getOverlayPane(); + this.graph.dialect == mxConstants.DIALECT_SVG ? d.createSvg() : this.graph.dialect == mxConstants.DIALECT_VML ? d.createVml() : d.createHtml(); + var m = d.isEventsEnabled(); + d.setEventsEnabled(!1); + var n = this.graph.isEnabled(); + this.graph.setEnabled(!1); + var p = d.getTranslate(); + d.translate = new mxPoint(a, + b); + a = null; + try { + var q = [this.graph.getModel().getRoot()]; + a = new mxTemporaryCellStates(d, c, q) + } finally { + if (mxClient.IS_IE) d.overlayPane.innerHTML = ""; + else + for (c = e.firstChild; null != c;) q = c.nextSibling, b = c.nodeName.toLowerCase(), "svg" == b ? (c.setAttribute("width", parseInt(e.style.width)), c.setAttribute("height", parseInt(e.style.height))) : + "default" != c.style.cursor && "table" != b && c.parentNode.removeChild(c), c = q; + d.overlayPane.parentNode.removeChild(d.overlayPane); + this.graph.setEnabled(n); + this.graph.container = f; + d.canvas = + g; + d.backgroundPane = h; + d.drawPane = k; + d.overlayPane = l; + d.translate = p; + a.destroy(); + d.setEventsEnabled(m) + } +}; +mxPrintPreview.prototype.getCoverPages = function() { + return null +}; +mxPrintPreview.prototype.getAppendices = function() { + return null +}; +mxPrintPreview.prototype.print = function() { + var a = this.open(); + null != a && a.print() +}; +mxPrintPreview.prototype.close = function() { + null != this.wnd && (this.wnd.close(), this.wnd = null) +}; + +function mxStylesheet() { + this.styles = {}; + this.putDefaultVertexStyle(this.createDefaultVertexStyle()); + this.putDefaultEdgeStyle(this.createDefaultEdgeStyle()) +} +mxStylesheet.prototype.createDefaultVertexStyle = function() { + var a = {}; + a[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RECTANGLE; + a[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter; + a[mxConstants.STYLE_VERTICAL_ALIGN] = mxConstants.ALIGN_MIDDLE; + a[mxConstants.STYLE_ALIGN] = mxConstants.ALIGN_CENTER; + a[mxConstants.STYLE_FILLCOLOR] = "#C3D9FF"; + a[mxConstants.STYLE_STROKECOLOR] = "#6482B9"; + a[mxConstants.STYLE_FONTCOLOR] = "#774400"; + return a +}; +mxStylesheet.prototype.createDefaultEdgeStyle = function() { + var a = {}; + a[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_CONNECTOR; + a[mxConstants.STYLE_ENDARROW] = mxConstants.ARROW_CLASSIC; + a[mxConstants.STYLE_VERTICAL_ALIGN] = mxConstants.ALIGN_MIDDLE; + a[mxConstants.STYLE_ALIGN] = mxConstants.ALIGN_CENTER; + a[mxConstants.STYLE_STROKECOLOR] = "#6482B9"; + a[mxConstants.STYLE_FONTCOLOR] = "#446299"; + return a +}; +mxStylesheet.prototype.putDefaultVertexStyle = function(a) { + this.putCellStyle("defaultVertex", a) +}; +mxStylesheet.prototype.putDefaultEdgeStyle = function(a) { + this.putCellStyle("defaultEdge", a) +}; +mxStylesheet.prototype.getDefaultVertexStyle = function() { + return this.styles.defaultVertex +}; +mxStylesheet.prototype.getDefaultEdgeStyle = function() { + return this.styles.defaultEdge +}; +mxStylesheet.prototype.putCellStyle = function(a, b) { + this.styles[a] = b +}; +mxStylesheet.prototype.getCellStyle = function(a, b) { + var c = b; + if (null != a && 0 < a.length) + for (var d = a.split(";"), c = null != c && ";" != a.charAt(0) ? mxUtils.clone(c) : {}, e = 0; e < d.length; e++) { + var f = d[e], + g = f.indexOf("\x3d"); + if (0 <= g) { + var h = f.substring(0, g), + f = f.substring(g + 1); + f == mxConstants.NONE ? delete c[h] : mxUtils.isNumeric(f) ? c[h] = parseFloat(f) : c[h] = f + } else if (f = this.styles[f], null != f) + for (h in f) c[h] = f[h] + } + return c +}; + +function mxCellState(a, b, c) { + this.view = a; + this.cell = b; + this.style = c; + this.origin = new mxPoint; + this.absoluteOffset = new mxPoint +} +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(a, b) { + a = a || 0; + b = null != b ? b : new mxRectangle(this.x, this.y, this.width, this.height); + if (null != this.shape && null != this.shape.stencil) { + var c = this.shape.stencil.computeAspect(this.style, b.x, b.y, b.width, b.height); + b.x = c.x; + b.y = c.y; + b.width = this.shape.stencil.w0 * c.width; + b.height = this.shape.stencil.h0 * c.height + } + 0 != a && b.grow(a); + return b +}; +mxCellState.prototype.setAbsoluteTerminalPoint = function(a, b) { + b ? (null == this.absolutePoints && (this.absolutePoints = []), 0 == this.absolutePoints.length ? this.absolutePoints.push(a) : this.absolutePoints[0] = a) : null == this.absolutePoints ? (this.absolutePoints = [], + this.absolutePoints.push(null), this.absolutePoints.push(a)) : 1 == this.absolutePoints.length ? this.absolutePoints.push(a) : this.absolutePoints[this.absolutePoints.length - 1] = a +}; +mxCellState.prototype.setCursor = function(a) { + null != this.shape && this.shape.setCursor(a); + null != this.text && this.text.setCursor(a) +}; +mxCellState.prototype.getVisibleTerminal = function(a) { + a = this.getVisibleTerminalState(a); + return null != a ? a.cell : null +}; +mxCellState.prototype.getVisibleTerminalState = function(a) { + return a ? this.visibleSourceState : this.visibleTargetState +}; +mxCellState.prototype.setVisibleTerminalState = function(a, b) { + b ? this.visibleSourceState = a : this.visibleTargetState = a +}; +mxCellState.prototype.destroy = function() { + this.view.graph.cellRenderer.destroy(this) +}; +mxCellState.prototype.clone = function() { + var a = new mxCellState(this.view, this.cell, this.style); + if (null != this.absolutePoints) { + a.absolutePoints = []; + for (var b = 0; b < this.absolutePoints.length; b++) a.absolutePoints[b] = this.absolutePoints[b].clone() + } + null != this.origin && (a.origin = this.origin.clone()); + null != this.absoluteOffset && (a.absoluteOffset = this.absoluteOffset.clone()); + null != this.boundingBox && (a.boundingBox = this.boundingBox.clone()); + a.terminalDistance = this.terminalDistance; + a.segments = this.segments; + a.length = + this.length; + a.x = this.x; + a.y = this.y; + a.width = this.width; + a.height = this.height; + return a +}; + +function mxGraphSelectionModel(a) { + this.graph = a; + this.cells = [] +} +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(a) { + this.singleSelection = a +}; +mxGraphSelectionModel.prototype.isSelected = function(a) { + return null != a ? 0 <= mxUtils.indexOf(this.cells, a) : !1 +}; +mxGraphSelectionModel.prototype.isEmpty = function() { + return 0 == this.cells.length +}; +mxGraphSelectionModel.prototype.clear = function() { + this.changeSelection(null, this.cells) +}; +mxGraphSelectionModel.prototype.setCell = function(a) { + null != a && this.setCells([a]) +}; +mxGraphSelectionModel.prototype.setCells = function(a) { + if (null != a) { + this.singleSelection && (a = [this.getFirstSelectableCell(a)]); + for (var b = [], c = 0; c < a.length; c++) this.graph.isCellSelectable(a[c]) && b.push(a[c]); + this.changeSelection(b, this.cells) + } +}; +mxGraphSelectionModel.prototype.getFirstSelectableCell = function(a) { + if (null != a) + for (var b = 0; b < a.length; b++) + if (this.graph.isCellSelectable(a[b])) return a[b]; + return null +}; +mxGraphSelectionModel.prototype.addCell = function(a) { + null != a && this.addCells([a]) +}; +mxGraphSelectionModel.prototype.addCells = function(a) { + if (null != a) { + var b = null; + this.singleSelection && (b = this.cells, a = [this.getFirstSelectableCell(a)]); + for (var c = [], d = 0; d < a.length; d++) !this.isSelected(a[d]) && this.graph.isCellSelectable(a[d]) && c.push(a[d]); + this.changeSelection(c, b) + } +}; +mxGraphSelectionModel.prototype.removeCell = function(a) { + null != a && this.removeCells([a]) +}; +mxGraphSelectionModel.prototype.removeCells = function(a) { + if (null != a) { + for (var b = [], c = 0; c < a.length; c++) this.isSelected(a[c]) && b.push(a[c]); + this.changeSelection(null, b) + } +}; +mxGraphSelectionModel.prototype.changeSelection = function(a, b) { + if (null != a && 0 < a.length && null != a[0] || null != b && 0 < b.length && null != b[0]) { + var c = new mxSelectionChange(this, a, b); + c.execute(); + var d = new mxUndoableEdit(this, !1); + d.add(c); + this.fireEvent(new mxEventObject(mxEvent.UNDO, "edit", d)) + } +}; +mxGraphSelectionModel.prototype.cellAdded = function(a) { + null != a && !this.isSelected(a) && this.cells.push(a) +}; +mxGraphSelectionModel.prototype.cellRemoved = function(a) { + null != a && (a = mxUtils.indexOf(this.cells, a), 0 <= a && this.cells.splice(a, 1)) +}; + +function mxSelectionChange(a, b, c) { + this.selectionModel = a; + this.added = null != b ? b.slice() : null; + this.removed = null != c ? c.slice() : null +} +mxSelectionChange.prototype.execute = function() { + var a = mxLog.enter("mxSelectionChange.execute"); + window.status = mxResources.get(this.selectionModel.updatingSelectionResource) || this.selectionModel.updatingSelectionResource; + if (null != this.removed) + for (var b = 0; b < this.removed.length; b++) this.selectionModel.cellRemoved(this.removed[b]); + if (null != this.added) + for (b = 0; b < this.added.length; b++) this.selectionModel.cellAdded(this.added[b]); + b = this.added; + this.added = this.removed; + this.removed = b; + window.status = mxResources.get(this.selectionModel.doneResource) || + this.selectionModel.doneResource; + mxLog.leave("mxSelectionChange.execute", a); + this.selectionModel.fireEvent(new mxEventObject(mxEvent.CHANGE, "added", this.added, "removed", this.removed)) +}; + +function mxCellEditor(a) { + this.graph = a +} +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(a) { + this.focusLost() + })); + mxEvent.addListener(this.textarea, "keydown", mxUtils.bind(this, function(a) { + mxEvent.isConsumed(a) || + (113 == a.keyCode || this.graph.isEnterStopsCellEditing() && 13 == a.keyCode && !mxEvent.isControlDown(a) && !mxEvent.isShiftDown(a) ? (this.graph.stopEditing(!1), mxEvent.consume(a)) : + 27 == a.keyCode ? (this.graph.stopEditing(!0), mxEvent.consume(a)) : (this.clearOnChange && (this.clearOnChange = !1, this.textarea.value = ""), this.setModified(!0))) + })); + mxEvent.addListener(this.textarea, "keypress", mxUtils.bind(this, function(a) { + this.autoSize && !mxEvent.isConsumed(a) && setTimeout(mxUtils.bind(this, function() { + this.resize() + }), 0) + })) +}; +mxCellEditor.prototype.resize = function() { + if (null != this.textDiv) { + var a = this.graph.getView().getState(this.editingCell), + b = this.graph.isLabelClipped(a.cell), + c = this.graph.isWrapping(a.cell); + if (this.graph.getModel().isEdge(a.cell)) this.bounds.x = a.absoluteOffset.x, this.bounds.y = a.absoluteOffset.y, this.bounds.width = 0, this.bounds.height = 0; + else if (null != this.bounds) { + this.bounds.x = a.x; + this.bounds.y = a.y; + this.bounds.width = a.width; + this.bounds.height = a.height; + var d = mxUtils.getValue(a.style, mxConstants.STYLE_LABEL_POSITION, + mxConstants.ALIGN_CENTER); + d == mxConstants.ALIGN_LEFT ? this.bounds.x -= a.width : d == mxConstants.ALIGN_RIGHT && (this.bounds.x += a.width); + d = mxUtils.getValue(a.style, mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_MIDDLE); + d == mxConstants.ALIGN_TOP ? this.bounds.y -= a.height : d == mxConstants.ALIGN_BOTTOM && (this.bounds.y += a.height) + } + d = this.textarea.value; + if ("\n" == d.charAt(d.length - 1) || "" == d) d += "\x26nbsp;"; + d = mxUtils.htmlEntities(d, !1); + c ? (this.textDiv.style.whiteSpace = "normal", this.textDiv.style.width = this.bounds.width + + "px") : d = d.replace(/ /g, "\x26nbsp;"); + d = d.replace(/\n/g, "\x3cbr/\x3e"); + this.textDiv.innerHTML = d; + var d = this.textDiv.offsetWidth + 30, + e = this.textDiv.offsetHeight + 16, + d = Math.max(d, 40), + e = Math.max(e, 20); + b && (d = Math.min(this.bounds.width - 4, d), e = Math.min(this.bounds.height, e)); + var f = null != a.text ? a.text.margin : null; + null == f && (f = mxUtils.getValue(a.style, mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER), a = mxUtils.getValue(a.style, mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE), f = + mxUtils.getAlignmentAsPoint(f, + a)); + if (null != f) { + if (b || !c) this.textarea.style.left = Math.max(0, Math.round(this.bounds.x - f.x * this.bounds.width + f.x * d) - 3) + "px"; + this.textarea.style.top = Math.max(0, Math.round(this.bounds.y - f.y * this.bounds.height + f.y * e) + 4) + "px" + } + if (b || !c) this.textarea.style.width = d + "px"; + this.textarea.style.height = e + "px" + } +}; +mxCellEditor.prototype.isModified = function() { + return this.modified +}; +mxCellEditor.prototype.setModified = function(a) { + this.modified = a +}; +mxCellEditor.prototype.focusLost = function() { + this.stopEditing(!this.graph.isInvokesStopCellEditing()) +}; +mxCellEditor.prototype.startEditing = function(a, b) { + null == this.textarea && this.init(); + this.stopEditing(!0); + var c = this.graph.getView().getState(a); + if (null != c) { + this.editingCell = a; + this.trigger = b; + this.textNode = null; + null != c.text && this.isHideLabel(c) && (this.textNode = c.text.node, this.textNode.style.visibility = "hidden"); + var d = this.graph.getView().scale, + d = mxUtils.getValue(c.style, mxConstants.STYLE_FONTSIZE, mxConstants.DEFAULT_FONTSIZE) * d, + e = mxUtils.getValue(c.style, mxConstants.STYLE_FONTFAMILY, mxConstants.DEFAULT_FONTFAMILY), + f = mxUtils.getValue(c.style, mxConstants.STYLE_FONTCOLOR, "black"), + g = mxUtils.getValue(c.style, mxConstants.STYLE_ALIGN, mxConstants.ALIGN_LEFT), + h = (mxUtils.getValue(c.style, mxConstants.STYLE_FONTSTYLE, 0) & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD, + k = (mxUtils.getValue(c.style, mxConstants.STYLE_FONTSTYLE, 0) & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC, + l = (mxUtils.getValue(c.style, mxConstants.STYLE_FONTSTYLE, 0) & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE; + this.textarea.style.fontSize = Math.round(d) + + "px"; + this.textarea.style.lineHeight = Math.round(d * mxConstants.LINE_HEIGHT) + "px"; + this.textarea.style.fontFamily = e; + this.textarea.style.textAlign = g; + this.textarea.style.color = f; + this.textarea.style.fontWeight = h ? "bold" : "normal"; + this.textarea.style.fontStyle = k ? "italic" : ""; + this.textarea.style.textDecoration = l ? "underline" : ""; + this.textarea.style.overflow = "auto"; + this.textarea.style.outline = "none"; + this.bounds = d = this.getEditorBounds(c); + this.textarea.style.left = d.x + "px"; + this.textarea.style.top = d.y + "px"; + this.textarea.style.width = + d.width + "px"; + this.textarea.style.height = d.height + "px"; + this.textarea.style.zIndex = 5; + c = this.getInitialValue(c, b); + null == c || 0 == c.length ? (c = this.getEmptyLabelText(), this.clearOnChange = !0) : this.clearOnChange = !1; + this.setModified(!1); + this.textarea.value = c; + 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 a = document.createElement("div"), + b = a.style; + b.position = "absolute"; + b.whiteSpace = "nowrap"; + b.visibility = "hidden"; + b.display = mxClient.IS_QUIRKS ? "inline" : "inline-block"; + b.zoom = "1"; + b.verticalAlign = "top"; + b.lineHeight = this.textarea.style.lineHeight; + b.fontSize = this.textarea.style.fontSize; + b.fontFamily = this.textarea.style.fontFamily; + b.fontWeight = this.textarea.style.fontWeight; + b.textAlign = this.textarea.style.textAlign; + b.fontStyle = this.textarea.style.fontStyle; + b.textDecoration = this.textarea.style.textDecoration; + return a +}; +mxCellEditor.prototype.stopEditing = function(a) { + null != this.editingCell && (null != this.textNode && (this.textNode.style.visibility = "visible", this.textNode = null), !a && 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(a, b) { + return this.graph.getEditingValue(a.cell, b) +}; +mxCellEditor.prototype.getCurrentValue = function() { + return this.textarea.value.replace(/\r/g, "") +}; +mxCellEditor.prototype.isHideLabel = function(a) { + return !0 +}; +mxCellEditor.prototype.getMinimumSize = function(a) { + var b = this.graph.getView().scale; + return new mxRectangle(0, 0, null == a.text ? 30 : a.text.size * b + 20, "left" == this.textarea.style.textAlign ? 120 : 40) +}; +mxCellEditor.prototype.getEditorBounds = function(a) { + var b = this.graph.getModel().isEdge(a.cell), + c = this.graph.getView().scale, + d = this.getMinimumSize(a), + e = d.width, + d = d.height, + f = parseInt(a.style[mxConstants.STYLE_SPACING] || 2) * c, + g = parseInt(a.style[mxConstants.STYLE_SPACING_TOP] || 0) * c + f, + h = parseInt(a.style[mxConstants.STYLE_SPACING_RIGHT] || 0) * c + f, + k = parseInt(a.style[mxConstants.STYLE_SPACING_BOTTOM] || 0) * c + f, + c = parseInt(a.style[mxConstants.STYLE_SPACING_LEFT] || 0) * c + f, + h = new mxRectangle(a.x, a.y, Math.max(e, a.width - + c - h), Math.max(d, a.height - g - k)); + b ? (h.x = a.absoluteOffset.x, h.y = a.absoluteOffset.y, null != a.text && null != a.text.boundingBox && (0 < a.text.boundingBox.x && (h.x = a.text.boundingBox.x), 0 < a.text.boundingBox.y && (h.y = + a.text.boundingBox.y))) : null != a.text && null != a.text.boundingBox && (h.x = Math.min(h.x, a.text.boundingBox.x), h.y = Math.min(h.y, a.text.boundingBox.y)); + h.x += c; + h.y += g; + null != a.text && null != a.text.boundingBox && (b ? (h.width = Math.max(e, a.text.boundingBox.width), h.height = Math.max(d, a.text.boundingBox.height)) : (h.width = + Math.max(h.width, a.text.boundingBox.width), h.height = Math.max(h.height, a.text.boundingBox.height))); + this.graph.getModel().isVertex(a.cell) && (b = mxUtils.getValue(a.style, mxConstants.STYLE_LABEL_POSITION, mxConstants.ALIGN_CENTER), b == mxConstants.ALIGN_LEFT ? h.x -= a.width : b == + mxConstants.ALIGN_RIGHT && (h.x += a.width), b = mxUtils.getValue(a.style, mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_MIDDLE), b == mxConstants.ALIGN_TOP ? h.y -= a.height : + b == mxConstants.ALIGN_BOTTOM && (h.y += a.height)); + return h +}; +mxCellEditor.prototype.getEmptyLabelText = function(a) { + 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) +}; + +function mxCellRenderer() {} +mxCellRenderer.prototype.defaultEdgeShape = mxConnector; +mxCellRenderer.prototype.defaultVertexShape = mxRectangleShape; +mxCellRenderer.prototype.defaultTextShape = mxText; +mxCellRenderer.prototype.legacyControlPosition = !0; +mxCellRenderer.prototype.defaultShapes = {}; +mxCellRenderer.registerShape = function(a, b) { + mxCellRenderer.prototype.defaultShapes[a] = b +}; +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(a, b) { + var c = a.view.graph.getModel(); + if (null != a.view.graph.container && null == a.shape && a.cell != a.view.currentRoot && (c.isVertex(a.cell) || c.isEdge(a.cell))) + if (this.createShape(a), null != a.shape && (null == b || b)) this.initializeShape(a), a.view.graph.ordered || c.isEdge(a.cell) ? a.invalidOrder = !0 : a.view.graph.keepEdgesInForeground && + null != this.firstEdge && (this.firstEdge.parentNode == a.shape.node.parentNode ? this.insertState(a, this.firstEdge) : this.firstEdge = null), a.shape.scale = + a.view.scale, this.createCellOverlays(a), this.installListeners(a) +}; +mxCellRenderer.prototype.initializeShape = function(a) { + a.shape.init(a.view.getDrawPane()) +}; +mxCellRenderer.prototype.getPreviousStateInContainer = function(a, b) { + for (var c = null, d = a.view.graph, e = d.getModel(), f = a.cell, g = e.getParent(f); null != g && null == c;) c = this.findPreviousStateInContainer(d, g, f, b), f = g, g = e.getParent(f); + return c +}; +mxCellRenderer.prototype.findPreviousStateInContainer = function(a, b, c, d) { + var e = null, + f = a.getModel(); + for (c = null != c ? b.getIndex(c) - 1 : f.getChildCount(b) - 1; 0 <= c && null == e; c--) e = this.findPreviousStateInContainer(a, f.getChildAt(b, c), null, d); + if (null == e && (e = a.view.getState(b), null != e && (null == e.shape || null == e.shape.node || e.shape.node.parentNode != d))) e = null; + return e +}; +mxCellRenderer.prototype.order = function(a) { + var b = a.shape.node.parentNode, + c = this.getPreviousStateInContainer(a, b), + d = b.firstChild; + null != c && (d = c.shape.node, null != c.text && (null != c.text.node && c.text.node.parentNode == b) && (d = c.text.node), d = d.nextSibling); + this.insertState(a, d) +}; +mxCellRenderer.prototype.orderEdge = function(a) { + var b = a.view, + c = b.graph.getModel(); + if (b.graph.keepEdgesInForeground) { + if (null == this.firstEdge || null == this.firstEdge.parentNode || this.firstEdge.parentNode != a.shape.node.parentNode) this.firstEdge = a.shape.node + } else if (b.graph.keepEdgesInBackground) { + var d = a.shape.node, + e = d.parentNode, + c = c.getParent(a.cell), + b = b.getState(c), + e = null != b && null != b.shape && null != b.shape.node ? b.shape.node.nextSibling : e.firstChild; + null != e && e != d && this.insertState(a, e) + } +}; +mxCellRenderer.prototype.insertState = function(a, b) { + a.shape.node.parentNode.insertBefore(a.shape.node, b); + null != a.text && (null != a.text.node && a.text.node.parentNode == a.shape.node.parentNode) && a.shape.node.parentNode.insertBefore(a.text.node, a.shape.node.nextSibling) +}; +mxCellRenderer.prototype.createShape = function(a) { + if (null != a.style) { + var b = mxStencilRegistry.getStencil(a.style[mxConstants.STYLE_SHAPE]); + null != b ? a.shape = new mxShape(b) : (b = this.getShapeConstructor(a), a.shape = new b); + a.shape.points = a.absolutePoints; + a.shape.bounds = new mxRectangle(a.x, a.y, a.width, a.height); + a.shape.dialect = a.view.graph.dialect; + this.configureShape(a) + } +}; +mxCellRenderer.prototype.getShape = function(a) { + return null != a ? mxCellRenderer.prototype.defaultShapes[a] : null +}; +mxCellRenderer.prototype.getShapeConstructor = function(a) { + var b = this.getShape(a.style[mxConstants.STYLE_SHAPE]); + null == b && (b = a.view.graph.getModel().isEdge(a.cell) ? this.defaultEdgeShape : this.defaultVertexShape); + return b +}; +mxCellRenderer.prototype.configureShape = function(a) { + a.shape.apply(a); + a.shape.image = a.view.graph.getImage(a); + a.shape.indicatorShape = this.getShape(a.view.graph.getIndicatorShape(a)); + a.shape.indicatorColor = a.view.graph.getIndicatorColor(a); + a.shape.indicatorGradientColor = a.view.graph.getIndicatorGradientColor(a); + a.shape.indicatorDirection = a.style[mxConstants.STYLE_INDICATOR_DIRECTION]; + a.shape.indicatorImage = a.view.graph.getIndicatorImage(a); + this.postConfigureShape(a) +}; +mxCellRenderer.prototype.postConfigureShape = function(a) { + null != a.shape && (this.resolveColor(a, "indicatorColor", mxConstants.STYLE_FILLCOLOR), this.resolveColor(a, "indicatorGradientColor", mxConstants.STYLE_GRADIENTCOLOR), this.resolveColor(a, + "fill", mxConstants.STYLE_FILLCOLOR), this.resolveColor(a, "stroke", mxConstants.STYLE_STROKECOLOR), this.resolveColor(a, "gradient", mxConstants.STYLE_GRADIENTCOLOR)) +}; +mxCellRenderer.prototype.resolveColor = function(a, b, c) { + var d = a.shape[b], + e = a.view.graph, + f = null; + "inherit" == d ? f = e.model.getParent(a.cell) : "swimlane" == d ? (f = null != e.model.getTerminal(a.cell, !1) ? e.model.getTerminal(a.cell, !1) : a.cell, f = e.getSwimlane(f), c = e.swimlaneIndicatorColorAttribute) : + "indicated" == d && (a.shape[b] = a.shape.indicatorColor); + null != f && (d = e.getView().getState(f), a.shape[b] = null, null != d && (a.shape[b] = null != d.shape && "indicatorColor" != b ? d.shape[b] : d.style[c])) +}; +mxCellRenderer.prototype.getLabelValue = function(a) { + return a.view.graph.getLabel(a.cell) +}; +mxCellRenderer.prototype.createLabel = function(a, b) { + var c = a.view.graph; + c.getModel().isEdge(a.cell); + if (0 < a.style[mxConstants.STYLE_FONTSIZE] || null == a.style[mxConstants.STYLE_FONTSIZE]) { + var d = c.isHtmlLabel(a.cell) || null != b && mxUtils.isNode(b); + a.text = new this.defaultTextShape(b, new mxRectangle, a.style[mxConstants.STYLE_ALIGN] || mxConstants.ALIGN_CENTER, c.getVerticalAlign(a), a.style[mxConstants.STYLE_FONTCOLOR], a.style[ + mxConstants.STYLE_FONTFAMILY], a.style[mxConstants.STYLE_FONTSIZE], a.style[mxConstants.STYLE_FONTSTYLE], + a.style[mxConstants.STYLE_SPACING], a.style[mxConstants.STYLE_SPACING_TOP], a.style[mxConstants.STYLE_SPACING_RIGHT], a.style[mxConstants.STYLE_SPACING_BOTTOM], a.style[mxConstants.STYLE_SPACING_LEFT], + a.style[mxConstants.STYLE_HORIZONTAL], a.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR], a.style[mxConstants.STYLE_LABEL_BORDERCOLOR], c.isWrapping(a.cell) && c.isHtmlLabel(a.cell), c.isLabelClipped( + a.cell), a.style[mxConstants.STYLE_OVERFLOW], a.style[mxConstants.STYLE_LABEL_PADDING]); + a.text.opacity = mxUtils.getValue(a.style, + mxConstants.STYLE_TEXT_OPACITY, 100); + a.text.dialect = d ? mxConstants.DIALECT_STRICTHTML : a.view.graph.dialect; + a.text.state = a; + this.initializeLabel(a); + var e = !1, + f = function(b) { + var d = a; + if (mxClient.IS_TOUCH || e) d = mxEvent.getClientX(b), b = mxEvent.getClientY(b), b = mxUtils.convertPoint(c.container, d, b), d = c.view.getState(c.getCellAt(b.x, b.y)); + return d + }; + mxEvent.addGestureListeners(a.text.node, mxUtils.bind(this, function(b) { + this.isLabelEvent(a, b) && (c.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(b, a)), e = c.dialect != + mxConstants.DIALECT_SVG && "IMG" == mxEvent.getSource(b).nodeName) + }), mxUtils.bind(this, function(b) { + this.isLabelEvent(a, b) && c.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(b, f(b))) + }), mxUtils.bind(this, function(b) { + this.isLabelEvent(a, b) && (c.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(b, f(b))), e = !1) + })); + mxEvent.addListener(a.text.node, "dblclick", mxUtils.bind(this, function(b) { + this.isLabelEvent(a, b) && (c.dblClick(b, a.cell), mxEvent.consume(b)) + })) + } +}; +mxCellRenderer.prototype.initializeLabel = function(a) { + var b = a.view.graph; + a.text.dialect != mxConstants.DIALECT_SVG && (mxClient.IS_SVG && mxClient.NO_FO ? a.text.init(b.container) : mxUtils.isVml(a.view.getDrawPane()) && (null != a.shape.label ? a.text.init(a.shape.label) : + a.text.init(a.shape.node))); + null == a.text.node && (a.text.init(a.view.getDrawPane()), null != a.shape && null != a.text && a.shape.node.parentNode.insertBefore(a.text.node, a.shape.node.nextSibling)) +}; +mxCellRenderer.prototype.createCellOverlays = function(a) { + var b = a.view.graph.getCellOverlays(a.cell), + c = null; + if (null != b) + for (var c = new mxDictionary, d = 0; d < b.length; d++) { + var e = null != a.overlays ? a.overlays.remove(b[d]) : null; + null == e && (e = new mxImageShape(new mxRectangle, b[d].image.src), e.dialect = a.view.graph.dialect, e.preserveImageAspect = !1, e.overlay = b[d], this.initializeOverlay(a, e), this.installCellOverlayListeners( + a, b[d], e), null != b[d].cursor && (e.node.style.cursor = b[d].cursor)); + c.put(b[d], e) + } + null != a.overlays && + a.overlays.visit(function(a, b) { + b.destroy() + }); + a.overlays = c +}; +mxCellRenderer.prototype.initializeOverlay = function(a, b) { + b.init(a.view.getOverlayPane()) +}; +mxCellRenderer.prototype.installCellOverlayListeners = function(a, b, c) { + var d = a.view.graph; + mxEvent.addListener(c.node, "click", function(c) { + d.isEditing() && d.stopEditing(!d.isInvokesStopCellEditing()); + b.fireEvent(new mxEventObject(mxEvent.CLICK, "event", c, "cell", a.cell)) + }); + mxEvent.addGestureListeners(c.node, function(a) { + mxEvent.consume(a) + }, function(b) { + d.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(b, a)) + }); + mxClient.IS_TOUCH && mxEvent.addListener(c.node, "touchend", function(c) { + b.fireEvent(new mxEventObject(mxEvent.CLICK, + "event", c, "cell", a.cell)) + }) +}; +mxCellRenderer.prototype.createControl = function(a) { + var b = a.view.graph, + c = b.getFoldingImage(a); + if (b.foldingEnabled && null != c) { + if (null == a.control) { + var d = new mxRectangle(0, 0, c.width, c.height); + a.control = new mxImageShape(d, c.src); + a.control.preserveImageAspect = !1; + a.control.dialect = b.dialect; + this.initControl(a, a.control, !0, function(c) { + if (b.isEnabled()) { + var d = !b.isCellCollapsed(a.cell); + b.foldCells(d, !1, [a.cell]); + mxEvent.consume(c) + } + }) + } + } else null != a.control && (a.control.destroy(), a.control = null) +}; +mxCellRenderer.prototype.initControl = function(a, b, c, d) { + var e = a.view.graph; + e.isHtmlLabel(a.cell) && mxClient.NO_FO && e.dialect == mxConstants.DIALECT_SVG ? (b.dialect = mxConstants.DIALECT_PREFERHTML, b.init(e.container), b.node.style.zIndex = 1) : b.init(a.view.getOverlayPane()); + b = b.innerNode || b.node; + d && (e.isEnabled() && (b.style.cursor = "pointer"), mxEvent.addListener(b, "click", d)); + c && mxEvent.addGestureListeners(b, function(b) { + e.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(b, a)); + mxEvent.consume(b) + }, function(b) { + e.fireMouseEvent(mxEvent.MOUSE_MOVE, + new mxMouseEvent(b, a)) + }); + return b +}; +mxCellRenderer.prototype.isShapeEvent = function(a, b) { + return !0 +}; +mxCellRenderer.prototype.isLabelEvent = function(a, b) { + return !0 +}; +mxCellRenderer.prototype.installListeners = function(a) { + var b = a.view.graph, + c = function(c) { + var d = a; + if (b.dialect != mxConstants.DIALECT_SVG && "IMG" == mxEvent.getSource(c).nodeName || mxClient.IS_TOUCH) d = mxEvent.getClientX(c), c = mxEvent.getClientY(c), c = mxUtils.convertPoint(b.container, + d, c), d = b.view.getState(b.getCellAt(c.x, c.y)); + return d + }, + d = !1; + mxEvent.addListener(a.shape.node, "gesturestart", mxUtils.bind(this, function(a) { + b.lastTouchTime = 0; + d = !0; + mxEvent.consume(a) + })); + mxEvent.addGestureListeners(a.shape.node, mxUtils.bind(this, + function(c) { + this.isShapeEvent(a, c) && !d ? b.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(c, null != a.shape && mxEvent.getSource(c) == a.shape.content ? null : a)) : d && mxEvent.consume(c) + }), mxUtils.bind(this, function(e) { + this.isShapeEvent(a, e) && !d ? b.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(e, null != a.shape && mxEvent.getSource(e) == a.shape.content ? null : c(e))) : d && mxEvent.consume( + e) + }), mxUtils.bind(this, function(e) { + this.isShapeEvent(a, e) && !d ? b.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(e, null != a.shape && + mxEvent.getSource(e) == a.shape.content ? null : c(e))) : d && mxEvent.consume(e) + })); + var e = mxClient.IS_TOUCH ? "gestureend" : "dblclick"; + mxEvent.addListener(a.shape.node, e, mxUtils.bind(this, function(c) { + d = !1; + "gestureend" == e ? (b.lastTouchTime = 0, b.gestureEnabled && (b.handleGesture(a, c), mxEvent.consume(c))) : this.isShapeEvent(a, c) && (b.dblClick(c, null != a.shape && mxEvent.getSource( + c) == a.shape.content ? null : a.cell), mxEvent.consume(c)) + })) +}; +mxCellRenderer.prototype.redrawLabel = function(a, b) { + var c = this.getLabelValue(a); + if (null == a.text && null != c && (mxUtils.isNode(c) || 0 < c.length)) this.createLabel(a, c); + else if (null != a.text && (null == c || 0 == c.length)) a.text.destroy(), a.text = null; + if (null != a.text) { + var d = a.view.graph, + e = d.isWrapping(a.cell), + d = d.isLabelClipped(a.cell), + f = this.getLabelBounds(a); + if (b || a.text.value != c || a.text.isWrapping != e || a.text.isClipping != d || a.text.scale != a.view.scale || !a.text.bounds.equals(f)) a.text.value = c, a.text.bounds = f, a.text.scale = + this.getTextScale(a), a.text.isWrapping = e, a.text.isClipping = d, a.text.redraw() + } +}; +mxCellRenderer.prototype.getTextScale = function(a) { + return a.view.scale +}; +mxCellRenderer.prototype.getLabelBounds = function(a) { + var b = a.view.graph, + c = a.view.scale, + d = b.getModel().isEdge(a.cell), + e = new mxRectangle(a.absoluteOffset.x, a.absoluteOffset.y); + a.text.updateMargin(); + d ? (d = a.text.getSpacing(), e.x += d.x * c, e.y += d.y * c, b = b.getCellGeometry(a.cell), null != b && (e.width = Math.max(0, a.text.margin.x * b.width * c - a.text.spacingLeft * c - a.text.spacingRight * + c), e.height = Math.max(0, a.text.margin.y * b.height * c - a.text.spacingTop * c - a.text.spacingBottom * c))) : (a.text.isPaintBoundsInverted() && (d = e.x, + e.x = e.y, e.y = d), e.x += a.x, e.y += a.y, e.width = Math.max(1, a.width), e.height = Math.max(1, a.height), b.isSwimlane(a.cell) && (b = b.getStartSize(a.cell), 0 < b.width ? (d = Math.min( + e.width, b.width * c), a.shape.flipH && (e.x += e.width - d), e.width = d) : 0 < b.height && (d = Math.min(e.height, b.height * c), a.shape.flipV && (e.y += e.height - d), e.height = d)), + this.rotateLabelBounds(a, e)); + return e +}; +mxCellRenderer.prototype.rotateLabelBounds = function(a, b) { + if (a.text.isPaintBoundsInverted()) { + var c = (a.width - a.height) / 2; + b.x += c; + b.y -= c; + c = b.width; + b.width = b.height; + b.height = c + } + b.x -= a.text.margin.x * b.width; + b.y -= a.text.margin.y * b.height; + if ("fill" != a.style[mxConstants.STYLE_OVERFLOW]) { + var c = a.view.scale, + d = a.text.getSpacing(); + b.x += d.x * c; + b.y += d.y * c; + b.width = Math.max(0, b.width - a.text.spacingLeft * c - a.text.spacingRight * c); + b.height = Math.max(0, b.height - a.text.spacingTop * c - a.text.spacingBottom * c) + } + var e = a.text.getTextRotation(); + if (0 != e && (null != a && a.view.graph.model.isVertex(a.cell)) && (c = a.getCenterX(), d = a.getCenterY(), b.x != c || b.y != d)) e *= Math.PI / 180, pt = mxUtils.getRotatedPoint(new mxPoint(b.x, + b.y), Math.cos(e), Math.sin(e), new mxPoint(c, d)), b.x = pt.x, b.y = pt.y +}; +mxCellRenderer.prototype.redrawCellOverlays = function(a, b) { + this.createCellOverlays(a); + if (null != a.overlays) { + var c = mxUtils.mod(mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION, 0), 90), + d = mxUtils.toRadians(c), + e = Math.cos(d), + f = Math.sin(d); + a.overlays.visit(function(d, h) { + var k = h.overlay.getBounds(a); + if (!a.view.graph.getModel().isEdge(a.cell) && null != a.shape && 0 != c) { + var l = k.getCenterX(), + m = k.getCenterY(), + m = mxUtils.getRotatedPoint(new mxPoint(l, m), e, f, new mxPoint(a.getCenterX(), a.getCenterY())), + l = m.x, + m = m.y; + k.x = + Math.round(l - k.width / 2); + k.y = Math.round(m - k.height / 2) + } + if (b || null == h.bounds || h.scale != a.view.scale || !h.bounds.equals(k)) h.bounds = k, h.scale = a.view.scale, h.redraw() + }) + } +}; +mxCellRenderer.prototype.redrawControl = function(a, b) { + if (null != a.control) { + var c = this.getControlBounds(a), + d = this.legacyControlPosition ? mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION, 0) : a.shape.getTextRotation(), + e = a.view.scale; + if (b || a.control.scale != e || !a.control.bounds.equals(c) || a.control.rotation != d) a.control.rotation = d, a.control.bounds = c, a.control.scale = e, a.control.redraw() + } +}; +mxCellRenderer.prototype.getControlBounds = function(a) { + if (null != a.control) { + var b = a.control.scale, + c = a.control.bounds.width / b, + b = a.control.bounds.height / b, + d = a.view.scale, + e = a.getCenterX(), + f = a.getCenterY(); + if (!a.view.graph.getModel().isEdge(a.cell) && (e = a.x + c * d, f = a.y + b * d, null != a.shape)) { + var g = a.shape.getShapeRotation(); + if (this.legacyControlPosition) g = mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION, 0); + else if (a.shape.isPaintBoundsInverted()) var h = (a.width - a.height) / 2, + e = e + h, + f = f - h; + 0 != g && (h = mxUtils.toRadians(g), + g = Math.cos(h), h = Math.sin(h), f = mxUtils.getRotatedPoint(new mxPoint(e, f), g, h, new mxPoint(a.getCenterX(), a.getCenterY())), e = f.x, f = f.y) + } + return a.view.graph.getModel().isEdge(a.cell), new mxRectangle(Math.round(e - c / 2 * d), Math.round(f - b / 2 * d), Math.round(c * d), Math.round(b * d)) + } + return null +}; +mxCellRenderer.prototype.redraw = function(a, b, c) { + if (null != a.shape) { + var d = !1; + a.view.graph.getModel().isEdge(a.cell); + reconfigure = null != b ? b : !1; + this.createControl(a); + if (a.orderChanged || a.invalidOrder) a.view.graph.ordered ? this.order(a) : this.orderEdge(a); + if (a.orderChanged || !mxUtils.equalEntries(a.shape.style, a.style)) this.configureShape(a), b = !0; + delete a.invalidOrder; + delete a.orderChanged; + if (b || null == a.shape.bounds || a.shape.scale != a.view.scale || !a.shape.bounds.equals(a) || !mxUtils.equalPoints(a.shape.points, + a.absolutePoints)) d = !0, a.shape.points = null != a.absolutePoints ? a.absolutePoints.slice() : null, a.shape.bounds = new mxRectangle(a.x, a.y, a.width, a.height), a.shape.scale = a.view + .scale, null == c || c ? a.shape.redraw() : a.shape.updateBoundingBox(); + if (null == c || c) this.redrawLabel(a, d), this.redrawCellOverlays(a, d), this.redrawControl(a, d) + } +}; +mxCellRenderer.prototype.destroy = function(a) { + null != a.shape && (null != a.text && (a.text.destroy(), a.text = null), null != a.overlays && (a.overlays.visit(function(a, c) { + c.destroy() + }), a.overlays = null), null != a.control && (a.control.destroy(), a.control = null), a.shape.destroy(), a.shape = null) +}; +var mxEdgeStyle = { + EntityRelation: function(a, b, c, d, e) { + var f = a.view, + g = f.graph; + d = mxUtils.getValue(a.style, mxConstants.STYLE_SEGMENT, mxConstants.ENTITY_SEGMENT) * f.scale; + var h = a.absolutePoints, + k = h[0], + l = h[h.length - 1], + h = !1; + if (null != k) b = new mxCellState, b.x = k.x, b.y = k.y; + else if (null != b) { + var m = mxUtils.getPortConstraints(b, a, !0, mxConstants.DIRECTION_MASK_NONE); + m != mxConstants.DIRECTION_MASK_NONE ? h = m == mxConstants.DIRECTION_MASK_WEST : (k = g.getCellGeometry(b.cell), k.relative ? h = 0.5 >= k.x : null != c && (h = c.x + c.width < b.x)) + } else return; + k = !0; + null != l ? (c = new mxCellState, c.x = l.x, c.y = l.y) : null != c && (m = mxUtils.getPortConstraints(c, a, !1, mxConstants.DIRECTION_MASK_NONE), m != mxConstants.DIRECTION_MASK_NONE ? k = m == + mxConstants.DIRECTION_MASK_WEST : (a = g.getCellGeometry(c.cell), a.relative ? k = 0.5 >= a.x : null != b && (k = b.x + b.width < c.x))); + null != b && null != c && (a = h ? b.x : b.x + b.width, b = f.getRoutingCenterY(b), g = k ? c.x : c.x + c.width, c = f.getRoutingCenterY(c), f = new mxPoint(a + (h ? -d : d), b), l = new mxPoint( + g + (k ? -d : d), c), h == k ? (d = h ? Math.min(a, g) - d : Math.max(a, g) + d, e.push(new mxPoint(d, + b)), e.push(new mxPoint(d, c))) : (f.x < l.x == h ? (d = b + (c - b) / 2, e.push(f), e.push(new mxPoint(f.x, d)), e.push(new mxPoint(l.x, d))) : e.push(f), e.push(l))) + }, + Loop: function(a, b, c, d, e) { + if (null != b) { + c = a.view; + var f = c.graph; + d = null != d && 0 < d.length ? d[0] : null; + null != d && (d = c.transformControlPoint(a, d), mxUtils.contains(b, d.x, d.y) && (d = null)); + var g = 0, + h = 0, + k = 0, + l = 0, + f = mxUtils.getValue(a.style, mxConstants.STYLE_SEGMENT, f.gridSize) * c.scale; + a = mxUtils.getValue(a.style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_WEST); + a == mxConstants.DIRECTION_NORTH || + a == mxConstants.DIRECTION_SOUTH ? (g = c.getRoutingCenterX(b), h = f) : (k = c.getRoutingCenterY(b), l = f); + null == d || d.x < b.x || d.x > b.x + b.width ? null != d ? (g = d.x, l = Math.max(Math.abs(k - d.y), l)) : a == mxConstants.DIRECTION_NORTH ? k = b.y - 2 * h : a == mxConstants.DIRECTION_SOUTH ? + k = b.y + b.height + 2 * h : g = a == mxConstants.DIRECTION_EAST ? b.x - 2 * l : b.x + b.width + 2 * l : null != d && (g = c.getRoutingCenterX(b), h = Math.max(Math.abs(g - d.x), l), k = + d.y, l = 0); + e.push(new mxPoint(g - h, k - l)); + e.push(new mxPoint(g + h, k + l)) + } + }, + ElbowConnector: function(a, b, c, d, e) { + var f = null != + d && 0 < d.length ? d[0] : null, + g = !1, + h = !1; + if (null != b && null != c) + if (null != f) var k = Math.min(b.x, c.x), + l = Math.max(b.x + b.width, c.x + c.width), + h = Math.min(b.y, c.y), + m = Math.max(b.y + b.height, c.y + c.height), + f = a.view.transformControlPoint(a, f), + g = f.y < h || f.y > m, + h = f.x < k || f.x > l; + else k = Math.max(b.x, c.x), l = Math.min(b.x + b.width, c.x + c.width), g = k == l, g || (h = Math.max(b.y, c.y), m = Math.min(b.y + b.height, c.y + c.height), h = h == m); + !h && (g || a.style[mxConstants.STYLE_ELBOW] == mxConstants.ELBOW_VERTICAL) ? mxEdgeStyle.TopToBottom(a, b, c, d, e) : mxEdgeStyle.SideToSide(a, + b, c, d, e) + }, + SideToSide: function(a, b, c, d, e) { + var f = a.view; + d = null != d && 0 < d.length ? d[0] : null; + var g = a.absolutePoints, + h = g[0], + g = g[g.length - 1]; + null != d && (d = f.transformControlPoint(a, d)); + null != h && (b = new mxCellState, b.x = h.x, b.y = h.y); + null != g && (c = new mxCellState, c.x = g.x, c.y = g.y); + null != b && null != c && (a = Math.max(b.x, c.x), h = Math.min(b.x + b.width, c.x + c.width), a = null != d ? d.x : h + (a - h) / 2, h = f.getRoutingCenterY(b), f = f.getRoutingCenterY(c), + null != d && (d.y >= b.y && d.y <= b.y + b.height && (h = d.y), d.y >= c.y && d.y <= c.y + c.height && (f = d.y)), !mxUtils.contains(c, + a, h) && !mxUtils.contains(b, a, h) && e.push(new mxPoint(a, h)), !mxUtils.contains(c, a, f) && !mxUtils.contains(b, a, f) && e.push(new mxPoint(a, f)), 1 == e.length && (null != d ? ! + mxUtils.contains(c, a, d.y) && !mxUtils.contains(b, a, d.y) && e.push(new mxPoint(a, d.y)) : (f = Math.max(b.y, c.y), b = Math.min(b.y + b.height, c.y + c.height), e.push(new mxPoint(a, + f + (b - f) / 2))))) + }, + TopToBottom: function(a, b, c, d, e) { + var f = a.view; + d = null != d && 0 < d.length ? d[0] : null; + var g = a.absolutePoints, + h = g[0], + g = g[g.length - 1]; + null != d && (d = f.transformControlPoint(a, d)); + null != + h && (b = new mxCellState, b.x = h.x, b.y = h.y); + null != g && (c = new mxCellState, c.x = g.x, c.y = g.y); + null != b && null != c && (h = Math.max(b.y, c.y), g = Math.min(b.y + b.height, c.y + c.height), a = f.getRoutingCenterX(b), null != d && (d.x >= b.x && d.x <= b.x + b.width) && (a = d.x), h = + null != d ? d.y : g + (h - g) / 2, !mxUtils.contains(c, a, h) && !mxUtils.contains(b, a, h) && e.push(new mxPoint(a, h)), a = null != d && d.x >= c.x && d.x <= c.x + c.width ? d.x : f.getRoutingCenterX( + c), !mxUtils.contains(c, a, h) && !mxUtils.contains(b, a, h) && e.push(new mxPoint(a, h)), 1 == e.length && (null != d && 1 == + e.length ? !mxUtils.contains(c, d.x, h) && !mxUtils.contains(b, d.x, h) && e.push(new mxPoint(d.x, h)) : (f = Math.max(b.x, c.x), b = Math.min(b.x + b.width, c.x + c.width), e.push(new mxPoint( + f + (b - f) / 2, h))))) + }, + SegmentConnector: function(a, b, c, d, e) { + var f = a.absolutePoints, + g = !0, + h = null, + k = f[0]; + null == k && null != b ? k = new mxPoint(a.view.getRoutingCenterX(b), a.view.getRoutingCenterY(b)) : null != k && (k = k.clone()); + var l = f.length - 1; + if (null != d && 0 < d.length) { + for (var h = a.view.transformControlPoint(a, d[0]), m = b, n = f[0], p = !1, q = !1, p = h, s = d.length, r = + 0; 2 > r; r++) { + var t = null != n && n.x == p.x, + v = null != n && n.y == p.y, + w = null != m && p.y >= m.y && p.y <= m.y + m.height, + m = null != m && p.x >= m.x && p.x <= m.x + m.width, + p = v || null == n && w, + q = t || null == n && m; + if (null != n && !v && !t && (w || m)) { + g = w ? !1 : !0; + break + } + if (q || p) { + g = p; + 1 == r && (g = 0 == d.length % 2 ? p : q); + break + } + m = c; + n = f[l]; + p = a.view.transformControlPoint(a, d[s - 1]) + } + g && (null != f[0] && f[0].y != h.y || null == f[0] && null != b && (h.y < b.y || h.y > b.y + b.height)) ? e.push(new mxPoint(k.x, h.y)) : !g && (null != f[0] && f[0].x != h.x || null == f[ + 0] && null != b && (h.x < b.x || h.x > b.x + b.width)) && e.push(new mxPoint(h.x, + k.y)); + g ? k.y = h.y : k.x = h.x; + for (r = 0; r < d.length; r++) g = !g, h = a.view.transformControlPoint(a, d[r]), g ? k.y = h.y : k.x = h.x, e.push(k.clone()) + } else h = k, g = !0; + k = f[l]; + null == k && null != c && (k = new mxPoint(a.view.getRoutingCenterX(c), a.view.getRoutingCenterY(c))); + g && (null != f[l] && f[l].y != h.y || null == f[l] && null != c && (h.y < c.y || h.y > c.y + c.height)) ? e.push(new mxPoint(k.x, h.y)) : !g && (null != f[l] && f[l].x != h.x || null == f[l] && + null != c && (h.x < c.x || h.x > c.x + c.width)) && e.push(new mxPoint(h.x, k.y)); + if (null == f[0] && null != b) + for (; 1 < e.length && mxUtils.contains(b, + e[1].x, e[1].y);) e = e.splice(1, 1); + if (null == f[l] && null != c) + for (; 1 < e.length && mxUtils.contains(c, e[e.length - 1].x, e[e.length - 1].y);) e = e.splice(e.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(a, b, c, d, e) { + var f = a.view.graph, + g = null == b ? !1 : f.getModel().isEdge(b.cell), + f = null == c ? !1 : f.getModel().isEdge(c.cell); + if (null != d && 0 < d.length || g || f) mxEdgeStyle.SegmentConnector(a, b, c, d, e); + else { + d = a.absolutePoints; + var h = d[0], + k = d[d.length - 1]; + d = null != b ? b.x : h.x; + var g = null != b ? b.y : h.y, + l = null != b ? b.width : + 1, + m = null != b ? b.height : 1, + n = null != c ? c.x : k.x, + p = null != c ? c.y : k.y, + q = null != c ? c.width : 1, + s = null != c ? c.height : 1, + f = a.view.scale * mxEdgeStyle.orthBuffer, + r = [mxConstants.DIRECTION_MASK_ALL, mxConstants.DIRECTION_MASK_ALL]; + null != b && (r[0] = mxUtils.getPortConstraints(b, a, !0, mxConstants.DIRECTION_MASK_ALL)); + null != c && (r[1] = mxUtils.getPortConstraints(c, a, !1, mxConstants.DIRECTION_MASK_ALL)); + a = [0, 0]; + d = [ + [d, g, l, m], + [n, p, q, s] + ]; + for (l = 0; 2 > l; l++) mxEdgeStyle.limits[l][1] = d[l][0] - f, mxEdgeStyle.limits[l][2] = d[l][1] - f, mxEdgeStyle.limits[l][4] = + d[l][0] + d[l][2] + f, mxEdgeStyle.limits[l][8] = d[l][1] + d[l][3] + f; + l = d[0][0] + d[0][2] / 2 - (d[1][0] + d[1][2] / 2); + m = d[0][1] + d[0][3] / 2 - (d[1][1] + d[1][3] / 2); + g = 0; + 0 > l ? g = 0 > m ? 2 : 1 : 0 >= m && (g = 3, 0 == l && (g = 2)); + m = null; + null != b && (m = h); + b = [ + [0.5, 0.5], + [0.5, 0.5] + ]; + for (l = 0; 2 > l; l++) null != m && (b[l][0] = (m.x - d[l][0]) / d[l][2], 0.01 > b[l][0] ? a[l] = mxConstants.DIRECTION_MASK_WEST : 0.99 < b[l][0] && (a[l] = mxConstants.DIRECTION_MASK_EAST), + b[l][1] = (m.y - d[l][1]) / d[l][3], 0.01 > b[l][1] ? a[l] = mxConstants.DIRECTION_MASK_NORTH : 0.99 < b[l][1] && (a[l] = mxConstants.DIRECTION_MASK_SOUTH)), + m = null, null != c && (m = k); + l = d[0][1] - (d[1][1] + d[1][3]); + m = d[0][0] - (d[1][0] + d[1][2]); + n = d[1][1] - (d[0][1] + d[0][3]); + p = d[1][0] - (d[0][0] + d[0][2]); + mxEdgeStyle.vertexSeperations[1] = Math.max(m - 2 * f, 0); + mxEdgeStyle.vertexSeperations[2] = Math.max(l - 2 * f, 0); + mxEdgeStyle.vertexSeperations[4] = Math.max(n - 2 * f, 0); + mxEdgeStyle.vertexSeperations[3] = Math.max(p - 2 * f, 0); + c = []; + h = []; + k = []; + h[0] = m >= p ? mxConstants.DIRECTION_MASK_WEST : mxConstants.DIRECTION_MASK_EAST; + k[0] = l >= n ? mxConstants.DIRECTION_MASK_NORTH : mxConstants.DIRECTION_MASK_SOUTH; + h[1] = mxUtils.reversePortConstraints(h[0]); + k[1] = mxUtils.reversePortConstraints(k[0]); + m = m >= p ? m : p; + n = l >= n ? l : n; + p = [ + [0, 0], + [0, 0] + ]; + q = !1; + for (l = 0; 2 > l; l++) 0 == a[l] && (0 == (h[l] & r[l]) && (h[l] = mxUtils.reversePortConstraints(h[l])), 0 == (k[l] & r[l]) && (k[l] = mxUtils.reversePortConstraints(k[l])), p[l][0] = k[l], + p[l][1] = h[l]); + n > 2 * f && m > 2 * f && (0 < (h[0] & r[0]) && 0 < (k[1] & r[1]) ? (p[0][0] = h[0], p[0][1] = k[0], p[1][0] = k[1], p[1][1] = h[1], q = !0) : 0 < (k[0] & r[0]) && 0 < (h[1] & r[1]) && (p[0] + [0] = k[0], p[0][1] = h[0], p[1][0] = h[1], p[1][1] = k[1], q = !0)); + n > 2 * f && !q && + (p[0][0] = k[0], p[0][1] = h[0], p[1][0] = k[1], p[1][1] = h[1], q = !0); + m > 2 * f && !q && (p[0][0] = h[0], p[0][1] = k[0], p[1][0] = h[1], p[1][1] = k[1]); + for (l = 0; 2 > l; l++) + if (0 == a[l] && (0 == (p[l][0] & r[l]) && (p[l][0] = p[l][1]), c[l] = p[l][0] & r[l], c[l] |= (p[l][1] & r[l]) << 8, c[l] |= (p[1 - l][l] & r[l]) << 16, c[l] |= (p[1 - l][1 - l] & r[l]) << + 24, 0 == (c[l] & 15) && (c[l] <<= 8), 0 == (c[l] & 3840) && (c[l] = c[l] & 15 | c[l] >> 8), 0 == (c[l] & 983040) && (c[l] = c[l] & 65535 | (c[l] & 251658240) >> 8), a[l] = c[l] & 15, + r[l] == mxConstants.DIRECTION_MASK_WEST || r[l] == mxConstants.DIRECTION_MASK_NORTH || r[l] == + mxConstants.DIRECTION_MASK_EAST || r[l] == mxConstants.DIRECTION_MASK_SOUTH)) a[l] = r[l]; + l = a[0] == mxConstants.DIRECTION_MASK_EAST ? 3 : a[0]; + r = a[1] == mxConstants.DIRECTION_MASK_EAST ? 3 : a[1]; + l -= g; + r -= g; + 1 > l && (l += 4); + 1 > r && (r += 4); + r = mxEdgeStyle.routePatterns[l - 1][r - 1]; + mxEdgeStyle.wayPoints1[0][0] = d[0][0]; + mxEdgeStyle.wayPoints1[0][1] = d[0][1]; + switch (a[0]) { + case mxConstants.DIRECTION_MASK_WEST: + mxEdgeStyle.wayPoints1[0][0] -= f; + mxEdgeStyle.wayPoints1[0][1] += b[0][1] * d[0][3]; + break; + case mxConstants.DIRECTION_MASK_SOUTH: + mxEdgeStyle.wayPoints1[0][0] += + b[0][0] * d[0][2]; + mxEdgeStyle.wayPoints1[0][1] += d[0][3] + f; + break; + case mxConstants.DIRECTION_MASK_EAST: + mxEdgeStyle.wayPoints1[0][0] += d[0][2] + f; + mxEdgeStyle.wayPoints1[0][1] += b[0][1] * d[0][3]; + break; + case mxConstants.DIRECTION_MASK_NORTH: + mxEdgeStyle.wayPoints1[0][0] += b[0][0] * d[0][2], mxEdgeStyle.wayPoints1[0][1] -= f + } + f = 0; + h = c = 0 < (a[0] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) ? 0 : 1; + for (l = k = 0; l < r.length; l++) { + k = r[l] & 15; + s = k == mxConstants.DIRECTION_MASK_EAST ? 3 : k; + s += g; + 4 < s && (s -= 4); + m = mxEdgeStyle.dirVectors[s - + 1]; + k = 0 < s % 2 ? 0 : 1; + k != c && (f++, mxEdgeStyle.wayPoints1[f][0] = mxEdgeStyle.wayPoints1[f - 1][0], mxEdgeStyle.wayPoints1[f][1] = mxEdgeStyle.wayPoints1[f - 1][1]); + var t = 0 < (r[l] & mxEdgeStyle.TARGET_MASK), + q = 0 < (r[l] & mxEdgeStyle.SOURCE_MASK), + n = (r[l] & mxEdgeStyle.SIDE_MASK) >> 5, + n = n << g; + 15 < n && (n >>= 4); + p = 0 < (r[l] & mxEdgeStyle.CENTER_MASK); + (q || t) && 9 > n ? (s = 0, q = q ? 0 : 1, s = p && 0 == k ? d[q][0] + b[q][0] * d[q][2] : p ? d[q][1] + b[q][1] * d[q][3] : mxEdgeStyle.limits[q][n], 0 == k ? (n = (s - mxEdgeStyle.wayPoints1[ + f][0]) * m[0], 0 < n && (mxEdgeStyle.wayPoints1[f][0] += + m[0] * n)) : (n = (s - mxEdgeStyle.wayPoints1[f][1]) * m[1], 0 < n && (mxEdgeStyle.wayPoints1[f][1] += m[1] * n))) : p && (mxEdgeStyle.wayPoints1[f][0] += m[0] * Math.abs(mxEdgeStyle.vertexSeperations[ + s] / 2), mxEdgeStyle.wayPoints1[f][1] += m[1] * Math.abs(mxEdgeStyle.vertexSeperations[s] / 2)); + 0 < f && mxEdgeStyle.wayPoints1[f][k] == mxEdgeStyle.wayPoints1[f - 1][k] ? f-- : c = k + } + for (l = 0; l <= f && !(l == f && ((0 < (a[1] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) ? 0 : 1) == h ? 0 : 1) != (f + 1) % 2); l++) e.push(new mxPoint( + mxEdgeStyle.wayPoints1[l][0], + mxEdgeStyle.wayPoints1[l][1])) + } + }, + getRoutePattern: function(a, b, c, d) { + var e = a[0] == mxConstants.DIRECTION_MASK_EAST ? 3 : a[0]; + a = a[1] == mxConstants.DIRECTION_MASK_EAST ? 3 : a[1]; + e -= b; + a -= b; + 1 > e && (e += 4); + 1 > a && (a += 4); + b = routePatterns[e - 1][a - 1]; + if (0 == c || 0 == d) null != inlineRoutePatterns[e - 1][a - 1] && (b = inlineRoutePatterns[e - 1][a - 1]); + return b + } + }, + mxStyleRegistry = { + values: [], + putValue: function(a, b) { + mxStyleRegistry.values[a] = b + }, + getValue: function(a) { + return mxStyleRegistry.values[a] + }, + getName: function(a) { + for (var b in mxStyleRegistry.values) + if (mxStyleRegistry.values[b] == + a) return b; + return null + } + }; +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); + +function mxGraphView(a) { + this.graph = a; + this.translate = new mxPoint; + this.graphBounds = new mxRectangle; + this.states = new mxDictionary +} +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(a) { + this.graphBounds = a +}; +mxGraphView.prototype.getBounds = function(a) { + var b = null; + if (null != a && 0 < a.length) + for (var c = this.graph.getModel(), d = 0; d < a.length; d++) + if (c.isVertex(a[d]) || c.isEdge(a[d])) { + var e = this.getState(a[d]); + null != e && (null == b ? b = new mxRectangle(e.x, e.y, e.width, e.height) : b.add(e)) + } + return b +}; +mxGraphView.prototype.setCurrentRoot = function(a) { + if (this.currentRoot != a) { + var b = new mxCurrentRootChange(this, a); + b.execute(); + var c = new mxUndoableEdit(this, !1); + c.add(b); + this.fireEvent(new mxEventObject(mxEvent.UNDO, "edit", c)); + this.graph.sizeDidChange() + } + return a +}; +mxGraphView.prototype.scaleAndTranslate = function(a, b, c) { + var d = this.scale, + e = new mxPoint(this.translate.x, this.translate.y); + if (this.scale != a || this.translate.x != b || this.translate.y != c) this.scale = a, this.translate.x = b, this.translate.y = c, this.isEventsEnabled() && (this.revalidate(), this.graph.sizeDidChange()); + this.fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE, "scale", a, "previousScale", d, "translate", this.translate, "previousTranslate", e)) +}; +mxGraphView.prototype.getScale = function() { + return this.scale +}; +mxGraphView.prototype.setScale = function(a) { + var b = this.scale; + this.scale != a && (this.scale = a, this.isEventsEnabled() && (this.revalidate(), this.graph.sizeDidChange())); + this.fireEvent(new mxEventObject(mxEvent.SCALE, "scale", a, "previousScale", b)) +}; +mxGraphView.prototype.getTranslate = function() { + return this.translate +}; +mxGraphView.prototype.setTranslate = function(a, b) { + var c = new mxPoint(this.translate.x, this.translate.y); + if (this.translate.x != a || this.translate.y != b) this.translate.x = a, this.translate.y = b, this.isEventsEnabled() && (this.revalidate(), this.graph.sizeDidChange()); + this.fireEvent(new mxEventObject(mxEvent.TRANSLATE, "translate", this.translate, "previousTranslate", c)) +}; +mxGraphView.prototype.refresh = function() { + null != this.currentRoot && this.clear(); + this.revalidate() +}; +mxGraphView.prototype.revalidate = function() { + this.invalidate(); + this.validate() +}; +mxGraphView.prototype.clear = function(a, b, c) { + var d = this.graph.getModel(); + a = a || d.getRoot(); + b = null != b ? b : !1; + c = null != c ? c : !0; + this.removeState(a); + if (c && (b || a != this.currentRoot)) { + c = d.getChildCount(a); + for (var e = 0; e < c; e++) this.clear(d.getChildAt(a, e), b) + } else this.invalidate(a) +}; +mxGraphView.prototype.invalidate = function(a, b, c, d) { + var e = this.graph.getModel(); + a = a || e.getRoot(); + b = null != b ? b : !0; + c = null != c ? c : !0; + d = null != d ? d : !1; + var f = this.getState(a); + null != f && (f.invalid = !0, d && (f.orderChanged = !0)); + if (b) + for (var g = e.getChildCount(a), f = 0; f < g; f++) { + var h = e.getChildAt(a, f); + this.invalidate(h, b, c, d) + } + if (c) { + d = e.getEdgeCount(a); + for (f = 0; f < d; f++) this.invalidate(e.getEdgeAt(a, f), b, c) + } +}; +mxGraphView.prototype.validate = function(a) { + var b = mxLog.enter("mxGraphView.validate"); + window.status = mxResources.get(this.updatingDocumentResource) || this.updatingDocumentResource; + var c = null; + if (this.optimizeVmlReflows && null != this.canvas && null == this.textDiv && (8 == document.documentMode || mxClient.IS_QUIRKS)) { + c = this.canvas.style.display; + this.canvas.style.display = "none"; + var d = document.createElement("div"); + d.style.position = "absolute"; + d.style.whiteSpace = "nowrap"; + d.style.visibility = "hidden"; + d.style.display = mxClient.IS_QUIRKS ? + "inline" : "inline-block"; + d.style.zoom = "1"; + document.body.appendChild(d); + this.textDiv = d + } + a = a || (null != this.currentRoot ? this.currentRoot : this.graph.getModel().getRoot()); + this.validateBounds(null, a); + a = this.validatePoints(null, a); + null == a && (a = new mxRectangle); + this.setGraphBounds(a); + this.validateBackground(); + null != c && (this.canvas.style.display = c, document.body.removeChild(this.textDiv), this.textDiv = null); + window.status = mxResources.get(this.doneResource) || this.doneResource; + mxLog.leave("mxGraphView.validate", b) +}; +mxGraphView.prototype.createBackgroundPageShape = function(a) { + return new mxRectangleShape(a, "white", "black") +}; +mxGraphView.prototype.validateBackground = function() { + var a = this.graph.getBackgroundImage(); + if (null != a) { + if (null == this.backgroundImage || this.backgroundImage.image != a.src) { + null != this.backgroundImage && this.backgroundImage.destroy(); + var b = new mxRectangle(0, 0, 1, 1); + this.backgroundImage = new mxImageShape(b, a.src); + this.backgroundImage.dialect = this.graph.dialect; + this.backgroundImage.init(this.backgroundPane); + this.backgroundImage.redraw() + } + this.redrawBackgroundImage(this.backgroundImage, a) + } else null != this.backgroundImage && + (this.backgroundImage.destroy(), this.backgroundImage = null); + this.graph.pageVisible ? (b = this.getBackgroundPageBounds(), null == this.backgroundPageShape ? (this.backgroundPageShape = this.createBackgroundPageShape(b), 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(a) { + this.graph.dblClick(a) + })), mxEvent.addGestureListeners(this.backgroundPageShape.node, mxUtils.bind(this, function(a) { + this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(a)) + }), mxUtils.bind(this, function(a) { + null != this.graph.tooltipHandler && this.graph.tooltipHandler.isHideOnHover() && this.graph.tooltipHandler.hide(); + this.graph.isMouseDown && !mxEvent.isConsumed(a) && this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(a)) + }), mxUtils.bind(this, function(a) { + this.graph.fireMouseEvent(mxEvent.MOUSE_UP, + new mxMouseEvent(a)) + }))) : (this.backgroundPageShape.scale = this.scale, this.backgroundPageShape.bounds = b, this.backgroundPageShape.redraw())) : null != this.backgroundPageShape && (this.backgroundPageShape.destroy(), + this.backgroundPageShape = null) +}; +mxGraphView.prototype.getBackgroundPageBounds = function() { + var a = this.graph.pageFormat, + b = this.scale * this.graph.pageScale; + return new mxRectangle(this.scale * this.translate.x, this.scale * this.translate.y, a.width * b, a.height * b) +}; +mxGraphView.prototype.redrawBackgroundImage = function(a, b) { + a.scale = this.scale; + a.bounds.x = this.scale * this.translate.x; + a.bounds.y = this.scale * this.translate.y; + a.bounds.width = this.scale * b.width; + a.bounds.height = this.scale * b.height; + a.redraw() +}; +mxGraphView.prototype.validateBounds = function(a, b) { + var c = this.graph.getModel(), + d = this.getState(b, !0); + if (null != d && d.invalid) { + if (this.graph.isCellVisible(b)) { + if (b != this.currentRoot && null != a) { + d.absoluteOffset.x = 0; + d.absoluteOffset.y = 0; + d.origin.x = a.origin.x; + d.origin.y = a.origin.y; + var e = this.graph.getCellGeometry(b); + if (null != e) { + if (!c.isEdge(b)) { + var f = e.offset || this.EMPTY_POINT; + e.relative ? (d.origin.x += e.x * a.width / this.scale + f.x, d.origin.y += e.y * a.height / this.scale + f.y) : (d.absoluteOffset.x = this.scale * f.x, d.absoluteOffset.y = + this.scale * f.y, d.origin.x += e.x, d.origin.y += e.y) + } + d.x = this.scale * (this.translate.x + d.origin.x); + d.y = this.scale * (this.translate.y + d.origin.y); + d.width = this.scale * e.width; + d.height = this.scale * e.height; + if (c.isVertex(b)) { + if (e.relative && (f = mxUtils.toRadians(a.style[mxConstants.STYLE_ROTATION] || "0"), 0 != f)) { + var e = Math.cos(f), + f = Math.sin(f), + g = new mxPoint(d.getCenterX(), d.getCenterY()), + h = new mxPoint(a.getCenterX(), a.getCenterY()), + e = mxUtils.getRotatedPoint(g, e, f, h); + d.x = e.x - d.width / 2; + d.y = e.y - d.height / 2 + } + this.updateVertexLabelOffset(d) + } + } + } + } else this.removeState(b); + f = this.graph.getChildOffsetForCell(b); + null != f && (d.origin.x += f.x, d.origin.y += f.y) + } + if (null != d && (!this.graph.isCellCollapsed(b) || b == this.currentRoot)) { + e = c.getChildCount(b); + for (f = 0; f < e; f++) g = c.getChildAt(b, f), this.validateBounds(d, g) + } +}; +mxGraphView.prototype.updateVertexLabelOffset = function(a) { + var b = mxUtils.getValue(a.style, mxConstants.STYLE_LABEL_POSITION, mxConstants.ALIGN_CENTER); + b == mxConstants.ALIGN_LEFT ? a.absoluteOffset.x -= a.width : b == mxConstants.ALIGN_RIGHT && (a.absoluteOffset.x += a.width); + b = mxUtils.getValue(a.style, mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_MIDDLE); + b == mxConstants.ALIGN_TOP ? a.absoluteOffset.y -= a.height : b == mxConstants.ALIGN_BOTTOM && (a.absoluteOffset.y += a.height) +}; +mxGraphView.prototype.validatePoints = function(a, b) { + var c = this.graph.getModel(), + d = this.getState(b), + e = null; + if (null != d) { + if (d.invalid) { + var f = this.graph.getCellGeometry(b); + if (null != f && c.isEdge(b)) { + var g = this.getState(this.getVisibleTerminal(b, !0)); + d.setVisibleTerminalState(g, !0); + if (null != g && c.isEdge(g.cell) && !c.isAncestor(g.cell, b)) { + var h = this.getState(c.getParent(g.cell)); + this.validatePoints(h, g.cell) + } + var k = this.getState(this.getVisibleTerminal(b, !1)); + d.setVisibleTerminalState(k, !1); + null != k && (c.isEdge(k.cell) && + !c.isAncestor(k.cell, b)) && (h = this.getState(c.getParent(k.cell)), this.validatePoints(h, k.cell)); + this.updateFixedTerminalPoints(d, g, k); + this.updatePoints(d, f.points, g, k); + this.updateFloatingTerminalPoints(d, g, k); + this.updateEdgeBounds(d); + this.updateEdgeLabelOffset(d) + } else null != f && (f.relative && null != a && c.isEdge(a.cell)) && (f = this.getPoint(a, f), null != f && (d.x = f.x, d.y = f.y, f.x = f.x / this.scale - this.translate.x, f.y = f.y / this.scale - + this.translate.y, d.origin = f, this.childMoved(a, d))); + d.invalid = !1; + b != this.currentRoot && + this.graph.cellRenderer.redraw(d, !1, this.isRendering()) + } + if (c.isEdge(b) || c.isVertex(b)) null != d.shape && null != d.shape.boundingBox && (e = d.shape.boundingBox.clone()), null != d.text && !this.graph.isLabelClipped(d.cell) && null != d.text.boundingBox && + (null != e ? e.add(d.text.boundingBox) : e = d.text.boundingBox.clone()) + } + if (null != d && (!this.graph.isCellCollapsed(b) || b == this.currentRoot)) { + f = c.getChildCount(b); + for (g = 0; g < f; g++) h = c.getChildAt(b, g), h = this.validatePoints(d, h), null != h && (null == e ? e = h : e.add(h)) + } + return e +}; +mxGraphView.prototype.childMoved = function(a, b) { + var c = b.cell; + if (!this.graph.isCellCollapsed(c) || c == this.currentRoot) + for (var d = this.graph.getModel(), e = d.getChildCount(c), f = 0; f < e; f++) this.validateBounds(b, d.getChildAt(c, f)) +}; +mxGraphView.prototype.updateFixedTerminalPoints = function(a, b, c) { + this.updateFixedTerminalPoint(a, b, !0, this.graph.getConnectionConstraint(a, b, !0)); + this.updateFixedTerminalPoint(a, c, !1, this.graph.getConnectionConstraint(a, c, !1)) +}; +mxGraphView.prototype.updateFixedTerminalPoint = function(a, b, c, d) { + var e = null; + null != d && (e = this.graph.getConnectionPoint(b, d)); + if (null == e && null == b) { + b = this.scale; + d = this.translate; + var f = a.origin, + e = this.graph.getCellGeometry(a.cell).getTerminalPoint(c); + null != e && (e = new mxPoint(b * (d.x + e.x + f.x), b * (d.y + e.y + f.y))) + } + a.setAbsoluteTerminalPoint(e, c) +}; +mxGraphView.prototype.updatePoints = function(a, b, c, d) { + if (null != a) { + var e = []; + e.push(a.absolutePoints[0]); + var f = this.getEdgeStyle(a, b, c, d); + if (null != f) c = this.getTerminalPort(a, c, !0), d = this.getTerminalPort(a, d, !1), f(a, c, d, b, e); + else if (null != b) + for (f = 0; f < b.length; f++) null != b[f] && (d = mxUtils.clone(b[f]), e.push(this.transformControlPoint(a, d))); + b = a.absolutePoints; + e.push(b[b.length - 1]); + a.absolutePoints = e + } +}; +mxGraphView.prototype.transformControlPoint = function(a, b) { + var c = a.origin; + return new mxPoint(this.scale * (b.x + this.translate.x + c.x), this.scale * (b.y + this.translate.y + c.y)) +}; +mxGraphView.prototype.getEdgeStyle = function(a, b, c, d) { + a = null != c && c == d ? mxUtils.getValue(a.style, mxConstants.STYLE_LOOP, this.graph.defaultLoopStyle) : !mxUtils.getValue(a.style, mxConstants.STYLE_NOEDGESTYLE, !1) ? a.style[mxConstants.STYLE_EDGE] : + null; + "string" == typeof a && (b = mxStyleRegistry.getValue(a), null == b && this.isAllowEval() && (b = mxUtils.eval(a)), a = b); + return "function" == typeof a ? a : null +}; +mxGraphView.prototype.updateFloatingTerminalPoints = function(a, b, c) { + var d = a.absolutePoints, + e = d[0]; + null == d[d.length - 1] && null != c && this.updateFloatingTerminalPoint(a, c, b, !1); + null == e && null != b && this.updateFloatingTerminalPoint(a, b, c, !0) +}; +mxGraphView.prototype.updateFloatingTerminalPoint = function(a, b, c, d) { + b = this.getTerminalPort(a, b, d); + var e = this.getNextPoint(a, c, d), + f = this.graph.isOrthogonal(a); + c = mxUtils.toRadians(Number(b.style[mxConstants.STYLE_ROTATION] || "0")); + var g = new mxPoint(b.getCenterX(), b.getCenterY()); + if (0 != c) var h = Math.cos(-c), + k = Math.sin(-c), + e = mxUtils.getRotatedPoint(e, h, k, g); + h = parseFloat(a.style[mxConstants.STYLE_PERIMETER_SPACING] || 0); + h += parseFloat(a.style[d ? mxConstants.STYLE_SOURCE_PERIMETER_SPACING : mxConstants.STYLE_TARGET_PERIMETER_SPACING] || + 0); + b = this.getPerimeterPoint(b, e, 0 == c && f, h); + 0 != c && (h = Math.cos(c), k = Math.sin(c), b = mxUtils.getRotatedPoint(b, h, k, g)); + a.setAbsoluteTerminalPoint(b, d) +}; +mxGraphView.prototype.getTerminalPort = function(a, b, c) { + a = mxUtils.getValue(a.style, c ? mxConstants.STYLE_SOURCE_PORT : mxConstants.STYLE_TARGET_PORT); + null != a && (a = this.getState(this.graph.getModel().getCell(a)), null != a && (b = a)); + return b +}; +mxGraphView.prototype.getPerimeterPoint = function(a, b, c, d) { + var e = null; + if (null != a) { + var f = this.getPerimeterFunction(a); + if (null != f && null != b && (d = this.getPerimeterBounds(a, d), 0 < d.width || 0 < d.height)) e = f(d, a, b, c); + null == e && (e = this.getPoint(a)) + } + return e +}; +mxGraphView.prototype.getRoutingCenterX = function(a) { + var b = null != a.style ? parseFloat(a.style[mxConstants.STYLE_ROUTING_CENTER_X]) || 0 : 0; + return a.getCenterX() + b * a.width +}; +mxGraphView.prototype.getRoutingCenterY = function(a) { + var b = null != a.style ? parseFloat(a.style[mxConstants.STYLE_ROUTING_CENTER_Y]) || 0 : 0; + return a.getCenterY() + b * a.height +}; +mxGraphView.prototype.getPerimeterBounds = function(a, b) { + b = null != b ? b : 0; + null != a && (b += parseFloat(a.style[mxConstants.STYLE_PERIMETER_SPACING] || 0)); + return a.getPerimeterBounds(b * this.scale) +}; +mxGraphView.prototype.getPerimeterFunction = function(a) { + a = a.style[mxConstants.STYLE_PERIMETER]; + if ("string" == typeof a) { + var b = mxStyleRegistry.getValue(a); + null == b && this.isAllowEval() && (b = mxUtils.eval(a)); + a = b + } + return "function" == typeof a ? a : null +}; +mxGraphView.prototype.getNextPoint = function(a, b, c) { + a = a.absolutePoints; + var d = null; + if (null != a && (c || 2 < a.length || null == b)) d = a.length, d = a[c ? Math.min(1, d - 1) : Math.max(0, d - 2)]; + null == d && null != b && (d = new mxPoint(b.getCenterX(), b.getCenterY())); + return d +}; +mxGraphView.prototype.getVisibleTerminal = function(a, b) { + for (var c = this.graph.getModel(), d = c.getTerminal(a, b), e = d; null != d && d != this.currentRoot;) { + if (!this.graph.isCellVisible(e) || this.graph.isCellCollapsed(d)) e = d; + d = c.getParent(d) + } + c.getParent(e) == c.getRoot() && (e = null); + return e +}; +mxGraphView.prototype.updateEdgeBounds = function(a) { + var b = a.absolutePoints; + a.length = 0; + if (null != b && 0 < b.length) { + var c = b[0], + d = b[b.length - 1]; + if (null == c || null == d) a.cell != this.currentRoot && this.clear(a.cell, !0); + else { + if (c.x != d.x || c.y != d.y) { + var e = d.x - c.x, + f = d.y - c.y; + a.terminalDistance = Math.sqrt(e * e + f * f) + } else a.terminalDistance = 0; + var d = 0, + g = [], + f = c; + if (null != f) { + for (var c = f.x, h = f.y, k = c, l = h, m = 1; m < b.length; m++) { + var n = b[m]; + null != n && (e = f.x - n.x, f = f.y - n.y, e = Math.sqrt(e * e + f * f), g.push(e), d += e, f = n, c = Math.min(f.x, c), h = Math.min(f.y, + h), k = Math.max(f.x, k), l = Math.max(f.y, l)) + } + a.length = d; + a.segments = g; + a.x = c; + a.y = h; + a.width = Math.max(1, k - c); + a.height = Math.max(1, l - h) + } + } + } +}; +mxGraphView.prototype.getPoint = function(a, b) { + var c = a.getCenterX(), + d = a.getCenterY(); + if (null != a.segments && (null == b || b.relative)) { + for (var e = a.absolutePoints.length, f = ((null != b ? b.x / 2 : 0) + 0.5) * a.length, g = a.segments[0], h = 0, k = 1; f > h + g && k < e - 1;) h += g, g = a.segments[k++]; + e = 0 == g ? 0 : (f - h) / g; + f = a.absolutePoints[k - 1]; + k = a.absolutePoints[k]; + if (null != f && null != k) { + h = c = d = 0; + if (null != b) { + var d = b.y, + l = b.offset; + null != l && (c = l.x, h = l.y) + } + l = k.x - f.x; + k = k.y - f.y; + c = f.x + l * e + ((0 == g ? 0 : k / g) * d + c) * this.scale; + d = f.y + k * e - ((0 == g ? 0 : l / g) * d - h) * this.scale + } + } else null != + b && (l = b.offset, null != l && (c += l.x, d += l.y)); + return new mxPoint(c, d) +}; +mxGraphView.prototype.getRelativePoint = function(a, b, c) { + var d = this.graph.getModel().getGeometry(a.cell); + if (null != d) { + var e = a.absolutePoints.length; + if (d.relative && 1 < e) { + for (var d = a.length, f = a.segments, g = a.absolutePoints[0], h = a.absolutePoints[1], k = mxUtils.ptSegDistSq(g.x, g.y, h.x, h.y, b, c), l = 0, m = 0, n = 0, p = 2; p < e; p++) m += f[p - + 2], h = a.absolutePoints[p], g = mxUtils.ptSegDistSq(g.x, g.y, h.x, h.y, b, c), g <= k && (k = g, l = p - 1, n = m), g = h; + e = f[l]; + g = a.absolutePoints[l]; + h = a.absolutePoints[l + 1]; + k = h.x; + f = h.y; + a = g.x - k; + l = g.y - f; + k = b - k; + f = c - f; + k = a - k; + f = l - f; + f = k * a + f * l; + a = Math.sqrt(0 >= f ? 0 : f * f / (a * a + l * l)); + a > e && (a = e); + e = Math.sqrt(mxUtils.ptSegDistSq(g.x, g.y, h.x, h.y, b, c)); - 1 == mxUtils.relativeCcw(g.x, g.y, h.x, h.y, b, c) && (e = -e); + return new mxPoint(-2 * ((d / 2 - n - a) / d), e / this.scale) + } + } + return new mxPoint +}; +mxGraphView.prototype.updateEdgeLabelOffset = function(a) { + var b = a.absolutePoints; + a.absoluteOffset.x = a.getCenterX(); + a.absoluteOffset.y = a.getCenterY(); + if (null != b && 0 < b.length && null != a.segments) { + var c = this.graph.getCellGeometry(a.cell); + if (c.relative) { + var d = this.getPoint(a, c); + null != d && (a.absoluteOffset = d) + } else { + var d = b[0], + e = b[b.length - 1]; + if (null != d && null != e) { + var b = e.x - d.x, + f = e.y - d.y, + g = e = 0, + c = c.offset; + null != c && (e = c.x, g = c.y); + c = d.y + f / 2 + g * this.scale; + a.absoluteOffset.x = d.x + b / 2 + e * this.scale; + a.absoluteOffset.y = c + } + } + } +}; +mxGraphView.prototype.getState = function(a, b) { + b = b || !1; + var c = null; + null != a && (c = this.states.get(a), this.graph.isCellVisible(a) && (null == c && b && this.graph.isCellVisible(a) ? (c = this.createState(a), this.states.put(a, c)) : b && (null != c && this.updateStyle) && + (c.style = this.graph.getCellStyle(a)))); + return c +}; +mxGraphView.prototype.isRendering = function() { + return this.rendering +}; +mxGraphView.prototype.setRendering = function(a) { + this.rendering = a +}; +mxGraphView.prototype.isAllowEval = function() { + return this.allowEval +}; +mxGraphView.prototype.setAllowEval = function(a) { + this.allowEval = a +}; +mxGraphView.prototype.getStates = function() { + return this.states +}; +mxGraphView.prototype.setStates = function(a) { + this.states = a +}; +mxGraphView.prototype.getCellStates = function(a) { + if (null == a) return this.states; + for (var b = [], c = 0; c < a.length; c++) { + var d = this.getState(a[c]); + null != d && b.push(d) + } + return b +}; +mxGraphView.prototype.removeState = function(a) { + var b = null; + null != a && (b = this.states.remove(a), null != b && (this.graph.cellRenderer.destroy(b), b.destroy())); + return b +}; +mxGraphView.prototype.createState = function(a) { + var b = this.graph.getCellStyle(a); + a = new mxCellState(this, a, b); + this.graph.cellRenderer.initialize(a, this.isRendering()); + return a +}; +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(a) { + a = mxEvent.getSource(a); + return a == this.graph.container || a.parentNode == this.backgroundPane || null != a.parentNode && a.parentNode.parentNode == this.backgroundPane || a == this.canvas.parentNode || a == this.canvas || + a == this.backgroundPane || a == this.drawPane || a == this.overlayPane +}; +mxGraphView.prototype.isScrollEvent = function(a) { + var b = mxUtils.getOffset(this.graph.container); + a = new mxPoint(a.clientX - b.x, a.clientY - b.y); + var b = this.graph.container.offsetWidth, + c = this.graph.container.clientWidth; + if (b > c && a.x > c + 2 && a.x <= b) return !0; + b = this.graph.container.offsetHeight; + c = this.graph.container.clientHeight; + return b > c && a.y > c + 2 && a.y <= b ? !0 : !1 +}; +mxGraphView.prototype.init = function() { + this.installListeners(); + var a = this.graph; + a.dialect == mxConstants.DIALECT_SVG ? this.createSvg() : a.dialect == mxConstants.DIALECT_VML ? this.createVml() : this.createHtml() +}; +mxGraphView.prototype.installListeners = function() { + var a = this.graph, + b = a.container; + if (null != b) { + mxEvent.addGestureListeners(b, mxUtils.bind(this, function(b) { + mxClient.IS_TOUCH && a.isEditing() && a.stopEditing(!a.isInvokesStopCellEditing()); + this.isContainerEvent(b) && (!mxClient.IS_IE && !mxClient.IS_GC && !mxClient.IS_OP && !mxClient.IS_SF || !this.isScrollEvent(b)) && a.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent( + b)) + }), mxUtils.bind(this, function(b) { + this.isContainerEvent(b) && a.fireMouseEvent(mxEvent.MOUSE_MOVE, + new mxMouseEvent(b)) + }), mxUtils.bind(this, function(b) { + this.isContainerEvent(b) && a.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(b)) + })); + mxEvent.addListener(b, "dblclick", mxUtils.bind(this, function(b) { + a.dblClick(b) + })); + var c = function(c) { + var e = null; + mxClient.IS_TOUCH && (e = mxEvent.getClientX(c), c = mxEvent.getClientY(c), c = mxUtils.convertPoint(b, e, c), e = a.view.getState(a.getCellAt(c.x, c.y))); + return e + }; + a.addMouseListener({ + mouseDown: function(b, c) { + a.panningHandler.hideMenu() + }, + mouseMove: function() {}, + mouseUp: function() {} + }); + this.moveHandler = mxUtils.bind(this, function(b) { + null != a.tooltipHandler && a.tooltipHandler.isHideOnHover() && a.tooltipHandler.hide(); + this.captureDocumentGesture && (a.isMouseDown && !mxEvent.isConsumed(b)) && a.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(b, c(b))) + }); + this.endHandler = mxUtils.bind(this, function(b) { + this.captureDocumentGesture && a.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(b)) + }); + mxEvent.addGestureListeners(document, null, this.moveHandler, this.endHandler) + } +}; +mxGraphView.prototype.createHtml = function() { + var a = this.graph.container; + null != a && (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), a.appendChild(this.canvas), + mxClient.IS_QUIRKS && (a = mxUtils.bind(this, function(a) { + a = this.getGraphBounds(); + this.updateHtmlCanvasSize(a.x + a.width + this.graph.border, a.y + a.height + this.graph.border) + }), mxEvent.addListener(window, "resize", a))) +}; +mxGraphView.prototype.updateHtmlCanvasSize = function(a, b) { + if (null != this.graph.container) { + var c = this.graph.container.offsetHeight; + this.canvas.style.width = this.graph.container.offsetWidth < a ? a + "px" : "100%"; + this.canvas.style.height = c < b ? b + "px" : "100%" + } +}; +mxGraphView.prototype.createHtmlPane = function(a, b) { + var c = document.createElement("DIV"); + null != a && null != b ? (c.style.position = "absolute", c.style.left = "0px", c.style.top = "0px", c.style.width = a, c.style.height = b) : c.style.position = "relative"; + return c +}; +mxGraphView.prototype.createVml = function() { + var a = this.graph.container; + if (null != a) { + var b = a.offsetWidth, + c = a.offsetHeight; + this.canvas = this.createVmlPane(b, c); + this.backgroundPane = this.createVmlPane(b, c); + this.drawPane = this.createVmlPane(b, c); + this.overlayPane = this.createVmlPane(b, c); + this.canvas.appendChild(this.backgroundPane); + this.canvas.appendChild(this.drawPane); + this.canvas.appendChild(this.overlayPane); + a.appendChild(this.canvas) + } +}; +mxGraphView.prototype.createVmlPane = function(a, b) { + var c = document.createElement(mxClient.VML_PREFIX + ":group"); + c.style.position = "absolute"; + c.style.left = "0px"; + c.style.top = "0px"; + c.style.width = a + "px"; + c.style.height = b + "px"; + c.setAttribute("coordsize", a + "," + b); + c.setAttribute("coordorigin", "0,0"); + return c +}; +mxGraphView.prototype.createSvg = function() { + var a = 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 b = document.createElementNS(mxConstants.NS_SVG, + "svg"); + b.style.width = "100%"; + b.style.height = "100%"; + b.style.display = "block"; + b.appendChild(this.canvas); + null != a && (a.appendChild(b), "static" == mxUtils.getCurrentStyle(a).position && (a.style.position = "relative")) +}; +mxGraphView.prototype.destroy = function() { + var a = null != this.canvas ? this.canvas.ownerSVGElement : null; + null == a && (a = this.canvas); + null != a && null != a.parentNode && (this.clear(this.currentRoot, !0), mxEvent.removeGestureListeners(document, null, this.moveHandler, this.endHandler), mxEvent.release(this.graph.container), a + .parentNode.removeChild(a), this.overlayPane = this.drawPane = this.backgroundPane = this.canvas = this.endHandler = this.moveHandler = null) +}; + +function mxCurrentRootChange(a, b) { + this.view = a; + this.previous = this.root = b; + this.isUp = null == b; + if (!this.isUp) + for (var c = this.view.currentRoot, d = this.view.graph.getModel(); null != c;) { + if (c == b) { + this.isUp = !0; + break + } + c = d.getParent(c) + } +} +mxCurrentRootChange.prototype.execute = function() { + var a = this.view.currentRoot; + this.view.currentRoot = this.previous; + this.previous = a; + a = this.view.graph.getTranslateForRoot(this.view.currentRoot); + null != a && (this.view.translate = new mxPoint(-a.x, -a.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 +}; + +function mxGraph(a, b, c, d) { + this.mouseListeners = null; + this.renderHint = c; + this.dialect = mxClient.IS_SVG ? mxConstants.DIALECT_SVG : c == mxConstants.RENDERING_HINT_EXACT && mxClient.IS_VML ? mxConstants.DIALECT_VML : c == mxConstants.RENDERING_HINT_FASTEST ? mxConstants + .DIALECT_STRICTHTML : c == mxConstants.RENDERING_HINT_FASTER ? mxConstants.DIALECT_PREFERHTML : mxConstants.DIALECT_MIXEDHTML; + this.model = null != b ? b : new mxGraphModel; + this.multiplicities = []; + this.imageBundles = []; + this.cellRenderer = this.createCellRenderer(); + this.setSelectionModel(this.createSelectionModel()); + this.setStylesheet(null != d ? d : this.createStylesheet()); + this.view = this.createGraphView(); + this.graphModelChangeListener = mxUtils.bind(this, function(a, b) { + this.graphModelChanged(b.getProperty("edit").changes) + }); + this.model.addListener(mxEvent.CHANGE, this.graphModelChangeListener); + this.createHandlers(); + null != a && this.init(a); + this.view.revalidate() +} +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 = 0.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 = 0.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(mxClient.imageBasePath + "/warning" + (mxClient.IS_MAC ? ".png" : ".gif"), 16, 16); +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(a) { + this.container = a; + this.cellEditor = this.createCellEditor(); + this.view.init(); + this.sizeDidChange(); + mxClient.IS_IE && (mxEvent.addListener(window, "unload", mxUtils.bind(this, function() { + this.destroy() + })), mxEvent.addListener(a, "selectstart", mxUtils.bind(this, function() { + return this.isEditing() + }))); + 8 == document.documentMode && a.insertAdjacentHTML("beforeend", '\x3cv:group style\x3d"DISPLAY: none;"\x3e\x3c/v:group\x3e') +}; +mxGraph.prototype.createHandlers = function(a) { + 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(a) { + this.stylesheet = a +}; +mxGraph.prototype.getSelectionModel = function() { + return this.selectionModel +}; +mxGraph.prototype.setSelectionModel = function(a) { + this.selectionModel = a +}; +mxGraph.prototype.getSelectionCellsForChanges = function(a) { + for (var b = [], c = 0; c < a.length; c++) { + var d = a[c]; + if (d.constructor != mxRootChange) { + var e = null; + d instanceof mxChildChange && null == d.previous ? e = d.child : null != d.cell && d.cell instanceof mxCell && (e = d.cell); + null != e && 0 > mxUtils.indexOf(b, e) && b.push(e) + } + } + return this.getModel().getTopmostCells(b) +}; +mxGraph.prototype.graphModelChanged = function(a) { + for (var b = 0; b < a.length; b++) this.processChange(a[b]); + this.removeSelectionCells(this.getRemovedCellsForChanges(a)); + this.view.validate(); + this.sizeDidChange() +}; +mxGraph.prototype.getRemovedCellsForChanges = function(a) { + for (var b = [], c = 0; c < a.length; c++) { + var d = a[c]; + if (d instanceof mxRootChange) break; + else d instanceof mxChildChange ? null != d.previous && null == d.parent && (b = b.concat(this.model.getDescendants(d.child))) : d instanceof mxVisibleChange && (b = b.concat(this.model.getDescendants( + d.cell))) + } + return b +}; +mxGraph.prototype.processChange = function(a) { + if (a instanceof mxRootChange) this.clearSelection(), this.removeStateForCell(a.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 (a instanceof mxChildChange) { + var b = this.model.getParent(a.child); + null != b ? this.view.invalidate(a.child, !0, !1, null != a.previous) : (this.removeStateForCell(a.child), this.view.currentRoot == a.child && this.home()); + b != a.previous && + (null != b && this.view.invalidate(b, !1, !1), null != a.previous && this.view.invalidate(a.previous, !1, !1)) + } else a instanceof mxTerminalChange || a instanceof mxGeometryChange ? this.view.invalidate(a.cell) : a instanceof mxValueChange ? this.view.invalidate(a.cell, !1, !1) : a instanceof mxStyleChange ? + (this.view.invalidate(a.cell, !0, !0, !1), this.view.removeState(a.cell)) : null != a.cell && a.cell instanceof mxCell && this.removeStateForCell(a.cell) +}; +mxGraph.prototype.removeStateForCell = function(a) { + for (var b = this.model.getChildCount(a), c = 0; c < b; c++) this.removeStateForCell(this.model.getChildAt(a, c)); + this.view.removeState(a) +}; +mxGraph.prototype.addCellOverlay = function(a, b) { + null == a.overlays && (a.overlays = []); + a.overlays.push(b); + var c = this.view.getState(a); + null != c && this.cellRenderer.redraw(c); + this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY, "cell", a, "overlay", b)); + return b +}; +mxGraph.prototype.getCellOverlays = function(a) { + return a.overlays +}; +mxGraph.prototype.removeCellOverlay = function(a, b) { + if (null == b) this.removeCellOverlays(a); + else { + var c = mxUtils.indexOf(a.overlays, b); + 0 <= c ? (a.overlays.splice(c, 1), 0 == a.overlays.length && (a.overlays = null), c = this.view.getState(a), null != c && this.cellRenderer.redraw(c), this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, + "cell", a, "overlay", b))) : b = null + } + return b +}; +mxGraph.prototype.removeCellOverlays = function(a) { + var b = a.overlays; + if (null != b) { + a.overlays = null; + var c = this.view.getState(a); + null != c && this.cellRenderer.redraw(c); + for (c = 0; c < b.length; c++) this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, "cell", a, "overlay", b[c])) + } + return b +}; +mxGraph.prototype.clearCellOverlays = function(a) { + a = null != a ? a : this.model.getRoot(); + this.removeCellOverlays(a); + for (var b = this.model.getChildCount(a), c = 0; c < b; c++) { + var d = this.model.getChildAt(a, c); + this.clearCellOverlays(d) + } +}; +mxGraph.prototype.setCellWarning = function(a, b, c, d) { + if (null != b && 0 < b.length) return c = null != c ? c : this.warningImage, b = new mxCellOverlay(c, "\x3cfont color\x3dred\x3e" + b + "\x3c/font\x3e"), d && b.addListener(mxEvent.CLICK, mxUtils + .bind(this, function(b, c) { + this.isEnabled() && this.setSelectionCell(a) + })), this.addCellOverlay(a, b); + this.removeCellOverlays(a); + return null +}; +mxGraph.prototype.startEditing = function(a) { + this.startEditingAtCell(null, a) +}; +mxGraph.prototype.startEditingAtCell = function(a, b) { + null == a && (a = this.getSelectionCell(), null != a && !this.isCellEditable(a) && (a = null)); + null != a && (this.fireEvent(new mxEventObject(mxEvent.START_EDITING, "cell", a, "event", b)), this.cellEditor.startEditing(a, b)) +}; +mxGraph.prototype.getEditingValue = function(a, b) { + return this.convertValueToString(a) +}; +mxGraph.prototype.stopEditing = function(a) { + this.cellEditor.stopEditing(a) +}; +mxGraph.prototype.labelChanged = function(a, b, c) { + this.model.beginUpdate(); + try { + this.cellLabelChanged(a, b, this.isAutoSizeCell(a)), this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED, "cell", a, "value", b, "event", c)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellLabelChanged = function(a, b, c) { + this.model.beginUpdate(); + try { + this.model.setValue(a, b), c && this.cellSizeUpdated(a, !1) + } finally { + this.model.endUpdate() + } +}; +mxGraph.prototype.escape = function(a) { + this.stopEditing(!0); + this.connectionHandler.reset(); + this.graphHandler.reset(); + a = this.getSelectionCells(); + for (var b = 0; b < a.length; b++) { + var c = this.view.getState(a[b]); + null != c && null != c.handler && c.handler.reset() + } +}; +mxGraph.prototype.click = function(a) { + var b = a.getEvent(), + c = a.getCell(), + d = new mxEventObject(mxEvent.CLICK, "event", b, "cell", c); + a.isConsumed() && d.consume(); + this.fireEvent(d); + this.isEnabled() && (!mxEvent.isConsumed(b) && !d.isConsumed()) && (null != c ? this.selectCellForEvent(c, b) : (c = null, this.isSwimlaneSelectionEnabled() && (c = this.getSwimlaneAt(a.getGraphX(), + a.getGraphY())), null != c ? this.selectCellForEvent(c, b) : this.isToggleEvent(b) || this.clearSelection())) +}; +mxGraph.prototype.dblClick = function(a, b) { + var c = new mxEventObject(mxEvent.DOUBLE_CLICK, "event", a, "cell", b); + this.fireEvent(c); + this.isEnabled() && (!mxEvent.isConsumed(a) && !c.isConsumed() && null != b && this.isCellEditable(b)) && this.startEditingAtCell(b, a) +}; +mxGraph.prototype.scrollPointToVisible = function(a, b, c, d) { + if (!this.timerAutoScroll && (this.ignoreScrollbars || mxUtils.hasScrollbars(this.container))) { + var e = this.container; + d = null != d ? d : 20; + if (a >= e.scrollLeft && b >= e.scrollTop && a <= e.scrollLeft + e.clientWidth && b <= e.scrollTop + e.clientHeight) { + var f = e.scrollLeft + e.clientWidth - a; + if (f < d) { + if (a = e.scrollLeft, e.scrollLeft += d - f, c && a == e.scrollLeft) { + if (this.dialect == mxConstants.DIALECT_SVG) { + a = this.view.getDrawPane().ownerSVGElement; + var g = this.container.scrollWidth + d - f + } else g = + Math.max(e.clientWidth, e.scrollWidth) + d - f, a = this.view.getCanvas(); + a.style.width = g + "px"; + e.scrollLeft += d - f + } + } else f = a - e.scrollLeft, f < d && (e.scrollLeft -= d - f); + f = e.scrollTop + e.clientHeight - b; + f < d ? (a = e.scrollTop, e.scrollTop += d - f, a == e.scrollTop && c && (this.dialect == mxConstants.DIALECT_SVG ? (a = this.view.getDrawPane().ownerSVGElement, b = this.container.scrollHeight + + d - f) : (b = Math.max(e.clientHeight, e.scrollHeight) + d - f, a = this.view.getCanvas()), a.style.height = b + "px", e.scrollTop += d - f)) : (f = b - e.scrollTop, f < d && (e.scrollTop -= + d - f)) + } + } else this.allowAutoPanning && !this.panningHandler.active && (null == this.panningManager && (this.panningManager = this.createPanningManager()), this.panningManager.panTo(a + this.panDx, b + + this.panDy)) +}; +mxGraph.prototype.createPanningManager = function() { + return new mxPanningManager(this) +}; +mxGraph.prototype.getBorderSizes = function() { + function a(a) { + var b = 0, + b = "thin" == a ? 2 : "medium" == a ? 4 : "thick" == a ? 6 : parseInt(a); + isNaN(b) && (b = 0); + return b + } + var b = mxUtils.getCurrentStyle(this.container), + c = new mxRectangle; + c.x = a(b.borderLeftWidth) + parseInt(b.paddingLeft || 0); + c.y = a(b.borderTopWidth) + parseInt(b.paddingTop || 0); + c.width = a(b.borderRightWidth) + parseInt(b.paddingRight || 0); + c.height = a(b.borderBottomWidth) + parseInt(b.paddingBottom || 0); + return c +}; +mxGraph.prototype.getPreferredPageSize = function(a, b, c) { + a = this.view.scale; + var d = this.view.translate, + e = this.pageFormat, + f = a * this.pageScale, + e = new mxRectangle(0, 0, e.width * f, e.height * f); + b = this.pageBreaksVisible ? Math.ceil(b / e.width) : 1; + c = this.pageBreaksVisible ? Math.ceil(c / e.height) : 1; + return new mxRectangle(0, 0, b * e.width + 2 + d.x / a, c * e.height + 2 + d.y / a) +}; +mxGraph.prototype.sizeDidChange = function() { + var a = this.getGraphBounds(); + if (null != this.container) { + var b = this.getBorder(), + c = Math.max(0, a.x + a.width + 1 + b), + b = Math.max(0, a.y + a.height + 1 + b); + null != this.minimumContainerSize && (c = Math.max(c, this.minimumContainerSize.width), b = Math.max(b, this.minimumContainerSize.height)); + this.resizeContainer && this.doResizeContainer(c, b); + if (this.preferPageSize || !mxClient.IS_IE && this.pageVisible) { + var d = this.getPreferredPageSize(a, c, b); + null != d && (c = d.width, b = d.height) + } + null != this.minimumGraphSize && + (c = Math.max(c, this.minimumGraphSize.width * this.view.scale), b = Math.max(b, this.minimumGraphSize.height * this.view.scale)); + c = Math.ceil(c - 1); + b = Math.ceil(b - 1); + this.dialect == mxConstants.DIALECT_SVG ? (d = this.view.getDrawPane().ownerSVGElement, d.style.minWidth = Math.max(1, c) + "px", d.style.minHeight = Math.max(1, b) + "px", d.style.width = + "100%", d.style.height = "100%") : mxClient.IS_QUIRKS ? this.view.updateHtmlCanvasSize(Math.max(1, c), Math.max(1, b)) : (this.view.canvas.style.minWidth = Math.max(1, c) + "px", this.view.canvas + .style.minHeight = + Math.max(1, b) + "px"); + this.updatePageBreaks(this.pageBreaksVisible, c - 1, b - 1) + } + this.fireEvent(new mxEventObject(mxEvent.SIZE, "bounds", a)) +}; +mxGraph.prototype.doResizeContainer = function(a, b) { + if (mxClient.IS_IE) + if (mxClient.IS_QUIRKS) { + var c = this.getBorderSizes(); + a += Math.max(2, c.x + c.width + 1); + b += Math.max(2, c.y + c.height + 1) + } else 9 <= document.documentMode ? (a += 3, b += 5) : (a += 1, b += 1); + else b += 1; + null != this.maximumContainerSize && (a = Math.min(this.maximumContainerSize.width, a), b = Math.min(this.maximumContainerSize.height, b)); + this.container.style.width = Math.ceil(a) + "px"; + this.container.style.height = Math.ceil(b) + "px" +}; +mxGraph.prototype.updatePageBreaks = function(a, b, c) { + var d = this.view.scale, + e = this.view.translate, + f = this.pageFormat, + g = d * this.pageScale, + e = new mxRectangle(d * e.x, d * e.y, f.width * g, f.height * g); + a = a && Math.min(e.width, e.height) > this.minPageBreakDist; + e.x = mxUtils.mod(e.x, e.width); + e.y = mxUtils.mod(e.y, e.height); + f = a ? Math.ceil((b - e.x) / e.width) : 0; + a = a ? Math.ceil((c - e.y) / e.height) : 0; + null == this.horizontalPageBreaks && 0 < f && (this.horizontalPageBreaks = []); + if (null != this.horizontalPageBreaks) { + for (g = 0; g <= f; g++) { + var h = [new mxPoint(e.x + + g * e.width, 1), new mxPoint(e.x + g * e.width, c)]; + null != this.horizontalPageBreaks[g] ? (this.horizontalPageBreaks[g].scale = 1, this.horizontalPageBreaks[g].points = h, this.horizontalPageBreaks[g].redraw()) : (h = new mxPolyline(h, this.pageBreakColor, + this.scale), h.dialect = this.dialect, h.isDashed = this.pageBreakDashed, h.scale = d, h.init(this.view.backgroundPane), h.redraw(), this.horizontalPageBreaks[g] = h) + } + for (g = f; g < this.horizontalPageBreaks.length; g++) this.horizontalPageBreaks[g].destroy(); + this.horizontalPageBreaks.splice(f, + this.horizontalPageBreaks.length - f) + } + null == this.verticalPageBreaks && 0 < a && (this.verticalPageBreaks = []); + if (null != this.verticalPageBreaks) { + for (g = 0; g <= a; g++) h = [new mxPoint(1, e.y + g * e.height), new mxPoint(b, e.y + g * e.height)], null != this.verticalPageBreaks[g] ? (this.verticalPageBreaks[g].scale = 1, this.verticalPageBreaks[ + g].points = h, this.verticalPageBreaks[g].redraw()) : (h = new mxPolyline(h, this.pageBreakColor, d), h.dialect = this.dialect, h.isDashed = this.pageBreakDashed, h.scale = d, h.init(this.view + .backgroundPane), h.redraw(), + this.verticalPageBreaks[g] = h); + for (g = a; g < this.verticalPageBreaks.length; g++) this.verticalPageBreaks[g].destroy(); + this.verticalPageBreaks.splice(a, this.verticalPageBreaks.length - a) + } +}; +mxGraph.prototype.getCellStyle = function(a) { + var b = this.model.getStyle(a), + c = null, + c = this.model.isEdge(a) ? this.stylesheet.getDefaultEdgeStyle() : this.stylesheet.getDefaultVertexStyle(); + null != b && (c = this.postProcessCellStyle(this.stylesheet.getCellStyle(b, c))); + null == c && (c = mxGraph.prototype.EMPTY_ARRAY); + return c +}; +mxGraph.prototype.postProcessCellStyle = function(a) { + if (null != a) { + var b = a[mxConstants.STYLE_IMAGE], + c = this.getImageFromBundles(b); + null != c ? a[mxConstants.STYLE_IMAGE] = c : c = b; + null != c && "data:image/" == c.substring(0, 11) && (b = c.indexOf(","), 0 < b && (c = c.substring(0, b) + ";base64," + c.substring(b + 1)), a[mxConstants.STYLE_IMAGE] = c) + } + return a +}; +mxGraph.prototype.setCellStyle = function(a, b) { + b = b || this.getSelectionCells(); + if (null != b) { + this.model.beginUpdate(); + try { + for (var c = 0; c < b.length; c++) this.model.setStyle(b[c], a) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.toggleCellStyle = function(a, b, c) { + c = c || this.getSelectionCell(); + this.toggleCellStyles(a, b, [c]) +}; +mxGraph.prototype.toggleCellStyles = function(a, b, c) { + b = null != b ? b : !1; + c = c || this.getSelectionCells(); + if (null != c && 0 < c.length) { + var d = this.view.getState(c[0]), + d = null != d ? d.style : this.getCellStyle(c[0]); + null != d && (b = mxUtils.getValue(d, a, b) ? 0 : 1, this.setCellStyles(a, b, c)) + } +}; +mxGraph.prototype.setCellStyles = function(a, b, c) { + c = c || this.getSelectionCells(); + mxUtils.setCellStyles(this.model, c, a, b) +}; +mxGraph.prototype.toggleCellStyleFlags = function(a, b, c) { + this.setCellStyleFlags(a, b, null, c) +}; +mxGraph.prototype.setCellStyleFlags = function(a, b, c, d) { + d = d || this.getSelectionCells(); + if (null != d && 0 < d.length) { + if (null == c) { + var e = this.view.getState(d[0]), + e = null != e ? e.style : this.getCellStyle(d[0]); + null != e && (c = (parseInt(e[a] || 0) & b) != b) + } + mxUtils.setCellStyleFlags(this.model, d, a, b, c) + } +}; +mxGraph.prototype.alignCells = function(a, b, c) { + null == b && (b = this.getSelectionCells()); + if (null != b && 1 < b.length) { + if (null == c) + for (var d = 0; d < b.length; d++) { + var e = this.getCellGeometry(b[d]); + if (null != e && !this.model.isEdge(b[d])) + if (null == c) + if (a == mxConstants.ALIGN_CENTER) { + c = e.x + e.width / 2; + break + } else if (a == mxConstants.ALIGN_RIGHT) c = e.x + e.width; + else if (a == mxConstants.ALIGN_TOP) c = e.y; + else if (a == mxConstants.ALIGN_MIDDLE) { + c = e.y + e.height / 2; + break + } else c = a == mxConstants.ALIGN_BOTTOM ? e.y + e.height : e.x; + else c = a == mxConstants.ALIGN_RIGHT ? + Math.max(c, e.x + e.width) : a == mxConstants.ALIGN_TOP ? Math.min(c, e.y) : a == mxConstants.ALIGN_BOTTOM ? Math.max(c, e.y + e.height) : Math.min(c, e.x) + } + if (null != c) { + this.model.beginUpdate(); + try { + for (d = 0; d < b.length; d++) e = this.getCellGeometry(b[d]), null != e && !this.model.isEdge(b[d]) && (e = e.clone(), a == mxConstants.ALIGN_CENTER ? e.x = c - e.width / 2 : a == + mxConstants.ALIGN_RIGHT ? e.x = c - e.width : a == mxConstants.ALIGN_TOP ? e.y = c : a == mxConstants.ALIGN_MIDDLE ? e.y = c - e.height / 2 : a == mxConstants.ALIGN_BOTTOM ? e.y = c - e + .height : e.x = c, this.model.setGeometry(b[d], + e)); + this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS, "align", a, "cells", b)) + } finally { + this.model.endUpdate() + } + } + } + return b +}; +mxGraph.prototype.flipEdge = function(a) { + if (null != a && null != this.alternateEdgeStyle) { + this.model.beginUpdate(); + try { + var b = this.model.getStyle(a); + null == b || 0 == b.length ? this.model.setStyle(a, this.alternateEdgeStyle) : this.model.setStyle(a, null); + this.resetEdge(a); + this.fireEvent(new mxEventObject(mxEvent.FLIP_EDGE, "edge", a)) + } finally { + this.model.endUpdate() + } + } + return a +}; +mxGraph.prototype.addImageBundle = function(a) { + this.imageBundles.push(a) +}; +mxGraph.prototype.removeImageBundle = function(a) { + for (var b = [], c = 0; c < this.imageBundles.length; c++) this.imageBundles[c] != a && b.push(this.imageBundles[c]); + this.imageBundles = b +}; +mxGraph.prototype.getImageFromBundles = function(a) { + if (null != a) + for (var b = 0; b < this.imageBundles.length; b++) { + var c = this.imageBundles[b].getImage(a); + if (null != c) return c + } + return null +}; +mxGraph.prototype.orderCells = function(a, b) { + null == b && (b = mxUtils.sortCells(this.getSelectionCells(), !0)); + this.model.beginUpdate(); + try { + this.cellsOrdered(b, a), this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS, "back", a, "cells", b)) + } finally { + this.model.endUpdate() + } + return b +}; +mxGraph.prototype.cellsOrdered = function(a, b) { + if (null != a) { + this.model.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) { + var d = this.model.getParent(a[c]); + b ? this.model.add(d, a[c], c) : this.model.add(d, a[c], this.model.getChildCount(d) - 1) + } + this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED, "back", b, "cells", a)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.groupCells = function(a, b, c) { + null == c && (c = mxUtils.sortCells(this.getSelectionCells(), !0)); + c = this.getCellsForGroup(c); + null == a && (a = this.createGroupCell(c)); + var d = this.getBoundsForGroup(a, c, b); + if (0 < c.length && null != d) { + var e = this.model.getParent(a); + null == e && (e = this.model.getParent(c[0])); + this.model.beginUpdate(); + try { + null == this.getCellGeometry(a) && this.model.setGeometry(a, new mxGeometry); + var f = this.model.getChildCount(e); + this.cellsAdded([a], e, f, null, null, !1); + f = this.model.getChildCount(a); + this.cellsAdded(c, a, f, null, null, !1, !1); + this.cellsMoved(c, -d.x, -d.y, !1, !0); + this.cellsResized([a], [d]); + this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS, "group", a, "border", b, "cells", c)) + } finally { + this.model.endUpdate() + } + } + return a +}; +mxGraph.prototype.getCellsForGroup = function(a) { + var b = []; + if (null != a && 0 < a.length) { + var c = this.model.getParent(a[0]); + b.push(a[0]); + for (var d = 1; d < a.length; d++) this.model.getParent(a[d]) == c && b.push(a[d]) + } + return b +}; +mxGraph.prototype.getBoundsForGroup = function(a, b, c) { + b = this.getBoundingBoxFromGeometry(b); + null != b && (this.isSwimlane(a) && (a = this.getStartSize(a), b.x -= a.width, b.y -= a.height, b.width += a.width, b.height += a.height), b.x -= c, b.y -= c, b.width += 2 * c, b.height += 2 * c); + return b +}; +mxGraph.prototype.createGroupCell = function(a) { + a = new mxCell(""); + a.setVertex(!0); + a.setConnectable(!1); + return a +}; +mxGraph.prototype.ungroupCells = function(a) { + var b = []; + if (null == a) { + a = this.getSelectionCells(); + for (var c = [], d = 0; d < a.length; d++) 0 < this.model.getChildCount(a[d]) && c.push(a[d]); + a = c + } + if (null != a && 0 < a.length) { + this.model.beginUpdate(); + try { + for (d = 0; d < a.length; d++) { + var e = this.model.getChildren(a[d]); + if (null != e && 0 < e.length) { + var e = e.slice(), + f = this.model.getParent(a[d]), + g = this.model.getChildCount(f); + this.cellsAdded(e, f, g, null, null, !0); + b = b.concat(e) + } + } + this.cellsRemoved(this.addAllEdges(a)); + this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS, + "cells", a)) + } finally { + this.model.endUpdate() + } + } + return b +}; +mxGraph.prototype.removeCellsFromParent = function(a) { + null == a && (a = this.getSelectionCells()); + this.model.beginUpdate(); + try { + var b = this.getDefaultParent(), + c = this.model.getChildCount(b); + this.cellsAdded(a, b, c, null, null, !0); + this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT, "cells", a)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.updateGroupBounds = function(a, b, c) { + null == a && (a = this.getSelectionCells()); + b = null != b ? b : 0; + c = null != c ? c : !1; + this.model.beginUpdate(); + try { + for (var d = 0; d < a.length; d++) { + var e = this.getCellGeometry(a[d]); + if (null != e) { + var f = this.getChildCells(a[d]); + if (null != f && 0 < f.length) { + var g = this.getBoundingBoxFromGeometry(f); + if (0 < g.width && 0 < g.height) { + var h = this.isSwimlane(a[d]) ? this.getStartSize(a[d]) : new mxRectangle, + e = e.clone(); + c && (e.x += g.x - h.width - b, e.y += g.y - h.height - b); + e.width = g.width + h.width + 2 * b; + e.height = + g.height + h.height + 2 * b; + this.model.setGeometry(a[d], e); + this.moveCells(f, -g.x + h.width + b, -g.y + h.height + b) + } + } + } + } + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cloneCells = function(a, b) { + b = null != b ? b : !0; + var c = null; + if (null != a) { + for (var d = {}, c = [], e = 0; e < a.length; e++) { + var f = mxCellPath.create(a[e]); + d[f] = a[e]; + c.push(a[e]) + } + if (0 < c.length) + for (var f = this.view.scale, g = this.view.translate, c = this.model.cloneCells(a, !0), e = 0; e < a.length; e++) + if (!b && this.model.isEdge(c[e]) && null != this.getEdgeValidationError(c[e], this.model.getTerminal(c[e], !0), this.model.getTerminal(c[e], !1))) c[e] = null; + else { + var h = this.model.getGeometry(c[e]); + if (null != h) { + var k = this.view.getState(a[e]), + l = this.view.getState(this.model.getParent(a[e])); + if (null != k && null != l) { + var m = l.origin.x, + l = l.origin.y; + if (this.model.isEdge(c[e])) { + for (var k = k.absolutePoints, n = this.model.getTerminal(a[e], !0), p = mxCellPath.create(n); null != n && null == d[p];) n = this.model.getParent(n), p = mxCellPath.create(n); + null == n && h.setTerminalPoint(new mxPoint(k[0].x / f - g.x, k[0].y / f - g.y), !0); + n = this.model.getTerminal(a[e], !1); + for (p = mxCellPath.create(n); null != n && null == d[p];) n = this.model.getParent(n), p = mxCellPath.create(n); + null == n && (n = k.length - + 1, h.setTerminalPoint(new mxPoint(k[n].x / f - g.x, k[n].y / f - g.y), !1)); + h = h.points; + if (null != h) + for (k = 0; k < h.length; k++) h[k].x += m, h[k].y += l + } else h.x += m, h.y += l + } + } + } else c = [] + } + return c +}; +mxGraph.prototype.insertVertex = function(a, b, c, d, e, f, g, h, k) { + b = this.createVertex(a, b, c, d, e, f, g, h, k); + return this.addCell(b, a) +}; +mxGraph.prototype.createVertex = function(a, b, c, d, e, f, g, h, k) { + a = new mxGeometry(d, e, f, g); + a.relative = null != k ? k : !1; + c = new mxCell(c, a, h); + c.setId(b); + c.setVertex(!0); + c.setConnectable(!0); + return c +}; +mxGraph.prototype.insertEdge = function(a, b, c, d, e, f) { + b = this.createEdge(a, b, c, d, e, f); + return this.addEdge(b, a, d, e) +}; +mxGraph.prototype.createEdge = function(a, b, c, d, e, f) { + a = new mxCell(c, new mxGeometry, f); + a.setId(b); + a.setEdge(!0); + a.geometry.relative = !0; + return a +}; +mxGraph.prototype.addEdge = function(a, b, c, d, e) { + return this.addCell(a, b, e, c, d) +}; +mxGraph.prototype.addCell = function(a, b, c, d, e) { + return this.addCells([a], b, c, d, e)[0] +}; +mxGraph.prototype.addCells = function(a, b, c, d, e) { + null == b && (b = this.getDefaultParent()); + null == c && (c = this.model.getChildCount(b)); + this.model.beginUpdate(); + try { + this.cellsAdded(a, b, c, d, e, !1, !0), this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS, "cells", a, "parent", b, "index", c, "source", d, "target", e)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellsAdded = function(a, b, c, d, e, f, g) { + if (null != a && null != b && null != c) { + this.model.beginUpdate(); + try { + for (var h = f ? this.view.getState(b) : null, k = null != h ? h.origin : null, l = new mxPoint(0, 0), h = 0; h < a.length; h++) + if (null == a[h]) c--; + else { + var m = this.model.getParent(a[h]); + if (null != k && a[h] != b && b != m) { + var n = this.view.getState(m), + p = null != n ? n.origin : l, + q = this.model.getGeometry(a[h]); + if (null != q) { + var s = p.x - k.x, + r = p.y - k.y, + q = q.clone(); + q.translate(s, r); + !q.relative && (this.model.isVertex(a[h]) && !this.isAllowNegativeCoordinates()) && + (q.x = Math.max(0, q.x), q.y = Math.max(0, q.y)); + this.model.setGeometry(a[h], q) + } + } + b == m && c + h > this.model.getChildCount(b) && c--; + this.model.add(b, a[h], c + h); + this.isExtendParentsOnAdd() && this.isExtendParent(a[h]) && this.extendParent(a[h]); + (null == g || g) && this.constrainChild(a[h]); + null != d && this.cellConnected(a[h], d, !0); + null != e && this.cellConnected(a[h], e, !1) + } + this.fireEvent(new mxEventObject(mxEvent.CELLS_ADDED, "cells", a, "parent", b, "index", c, "source", d, "target", e, "absolute", f)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.removeCells = function(a, b) { + b = null != b ? b : !0; + null == a && (a = this.getDeletableCells(this.getSelectionCells())); + b && (a = this.getDeletableCells(this.addAllEdges(a))); + this.model.beginUpdate(); + try { + this.cellsRemoved(a), this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS, "cells", a, "includeEdges", b)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellsRemoved = function(a) { + if (null != a && 0 < a.length) { + var b = this.view.scale, + c = this.view.translate; + this.model.beginUpdate(); + try { + for (var d = {}, e = 0; e < a.length; e++) { + var f = mxCellPath.create(a[e]); + d[f] = a[e] + } + for (e = 0; e < a.length; e++) { + for (var g = this.getConnections(a[e]), h = 0; h < g.length; h++) + if (f = mxCellPath.create(g[h]), null == d[f]) { + var k = this.model.getGeometry(g[h]); + if (null != k) { + var l = this.view.getState(g[h]); + if (null != l) { + var k = k.clone(), + m = l.getVisibleTerminal(!0) == a[e], + n = l.absolutePoints, + p = m ? 0 : n.length - + 1; + k.setTerminalPoint(new mxPoint(n[p].x / b - c.x, n[p].y / b - c.y), m); + this.model.setTerminal(g[h], null, m); + this.model.setGeometry(g[h], k) + } + } + } + this.model.remove(a[e]) + } + this.fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED, "cells", a)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.splitEdge = function(a, b, c, d, e) { + d = d || 0; + e = e || 0; + null == c && (c = this.cloneCells([a])[0]); + var f = this.model.getParent(a), + g = this.model.getTerminal(a, !0); + this.model.beginUpdate(); + try { + this.cellsMoved(b, d, e, !1, !1), this.cellsAdded(b, f, this.model.getChildCount(f), null, null, !0), this.cellsAdded([c], f, this.model.getChildCount(f), g, b[0], !1), this.cellConnected(a, b[ + 0], !0), this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE, "edge", a, "cells", b, "newEdge", c, "dx", d, "dy", e)) + } finally { + this.model.endUpdate() + } + return c +}; +mxGraph.prototype.toggleCells = function(a, b, c) { + null == b && (b = this.getSelectionCells()); + c && (b = this.addAllEdges(b)); + this.model.beginUpdate(); + try { + this.cellsToggled(b, a), this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS, "show", a, "cells", b, "includeEdges", c)) + } finally { + this.model.endUpdate() + } + return b +}; +mxGraph.prototype.cellsToggled = function(a, b) { + if (null != a && 0 < a.length) { + this.model.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) this.model.setVisible(a[c], b) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.foldCells = function(a, b, c, d) { + b = null != b ? b : !1; + null == c && (c = this.getFoldableCells(this.getSelectionCells(), a)); + this.stopEditing(!1); + this.model.beginUpdate(); + try { + this.cellsFolded(c, a, b, d), this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS, "collapse", a, "recurse", b, "cells", c)) + } finally { + this.model.endUpdate() + } + return c +}; +mxGraph.prototype.cellsFolded = function(a, b, c, d) { + if (null != a && 0 < a.length) { + this.model.beginUpdate(); + try { + for (var e = 0; e < a.length; e++) + if ((!d || this.isCellFoldable(a[e], b)) && b != this.isCellCollapsed(a[e])) + if (this.model.setCollapsed(a[e], b), this.swapBounds(a[e], b), this.isExtendParent(a[e]) && this.extendParent(a[e]), c) { + var f = this.model.getChildren(a[e]); + this.foldCells(f, b, c) + } + this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED, "cells", a, "collapse", b, "recurse", c)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.swapBounds = function(a, b) { + if (null != a) { + var c = this.model.getGeometry(a); + null != c && (c = c.clone(), this.updateAlternateBounds(a, c, b), c.swap(), this.model.setGeometry(a, c)) + } +}; +mxGraph.prototype.updateAlternateBounds = function(a, b, c) { + if (null != a && null != b) { + c = this.view.getState(a); + c = null != c ? c.style : this.getCellStyle(a); + if (null == b.alternateBounds) { + var d = b; + this.collapseToPreferredSize && (a = this.getPreferredSizeForCell(a), null != a && (d = a, a = mxUtils.getValue(c, mxConstants.STYLE_STARTSIZE), 0 < a && (d.height = Math.max(d.height, a)))); + b.alternateBounds = new mxRectangle(0, 0, d.width, d.height) + } + if (null != b.alternateBounds) { + b.alternateBounds.x = b.x; + b.alternateBounds.y = b.y; + var e = mxUtils.toRadians(c[mxConstants.STYLE_ROTATION] || + "0"); + 0 != e && (a = b.alternateBounds.getCenterX() - b.getCenterX(), c = b.alternateBounds.getCenterY() - b.getCenterY(), d = Math.cos(e), e = Math.sin(e), b.alternateBounds.x += d * a - e * c - a, + b.alternateBounds.y += e * a + d * c - c) + } + } +}; +mxGraph.prototype.addAllEdges = function(a) { + var b = a.slice(); + return b = b.concat(this.getAllEdges(a)) +}; +mxGraph.prototype.getAllEdges = function(a) { + var b = []; + if (null != a) + for (var c = 0; c < a.length; c++) { + for (var d = this.model.getEdgeCount(a[c]), e = 0; e < d; e++) b.push(this.model.getEdgeAt(a[c], e)); + d = this.model.getChildren(a[c]); + b = b.concat(this.getAllEdges(d)) + } + return b +}; +mxGraph.prototype.updateCellSize = function(a, b) { + b = null != b ? b : !1; + this.model.beginUpdate(); + try { + this.cellSizeUpdated(a, b), this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE, "cell", a, "ignoreChildren", b)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellSizeUpdated = function(a, b) { + if (null != a) { + this.model.beginUpdate(); + try { + var c = this.getPreferredSizeForCell(a), + d = this.model.getGeometry(a); + if (null != c && null != d) { + var e = this.isCellCollapsed(a), + d = d.clone(); + if (this.isSwimlane(a)) { + var f = this.view.getState(a), + g = null != f ? f.style : this.getCellStyle(a), + h = this.model.getStyle(a); + null == h && (h = ""); + mxUtils.getValue(g, mxConstants.STYLE_HORIZONTAL, !0) ? (h = mxUtils.setStyle(h, mxConstants.STYLE_STARTSIZE, c.height + 8), e && (d.height = c.height + 8), d.width = c.width) : + (h = mxUtils.setStyle(h, mxConstants.STYLE_STARTSIZE, c.width + 8), e && (d.width = c.width + 8), d.height = c.height); + this.model.setStyle(a, h) + } else d.width = c.width, d.height = c.height; + if (!b && !e) { + var k = this.view.getBounds(this.model.getChildren(a)); + if (null != k) { + var l = this.view.translate, + m = this.view.scale, + n = (k.y + k.height) / m - d.y - l.y; + d.width = Math.max(d.width, (k.x + k.width) / m - d.x - l.x); + d.height = Math.max(d.height, n) + } + } + this.cellsResized([a], [d]) + } + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.getPreferredSizeForCell = function(a) { + var b = null; + if (null != a) { + var c = this.view.getState(a), + d = null != c ? c.style : this.getCellStyle(a); + if (null != d && !this.model.isEdge(a)) { + var e = d[mxConstants.STYLE_FONTSIZE] || mxConstants.DEFAULT_FONTSIZE, + f = 0, + b = 0; + if ((null != this.getImage(c) || null != d[mxConstants.STYLE_IMAGE]) && d[mxConstants.STYLE_SHAPE] == mxConstants.SHAPE_LABEL) d[mxConstants.STYLE_VERTICAL_ALIGN] == mxConstants.ALIGN_MIDDLE && + (f += parseFloat(d[mxConstants.STYLE_IMAGE_WIDTH]) || mxLabel.prototype.imageSize), + d[mxConstants.STYLE_ALIGN] != mxConstants.ALIGN_CENTER && (b += parseFloat(d[mxConstants.STYLE_IMAGE_HEIGHT]) || mxLabel.prototype.imageSize); + f += 2 * (d[mxConstants.STYLE_SPACING] || 0); + f += d[mxConstants.STYLE_SPACING_LEFT] || 0; + f += d[mxConstants.STYLE_SPACING_RIGHT] || 0; + b += 2 * (d[mxConstants.STYLE_SPACING] || 0); + b += d[mxConstants.STYLE_SPACING_TOP] || 0; + b += d[mxConstants.STYLE_SPACING_BOTTOM] || 0; + c = this.getFoldingImage(c); + null != c && (f += c.width + 8); + c = this.getLabel(a); + null != c && 0 < c.length ? (this.isHtmlLabel(a) || (c = c.replace(/\n/g, + "\x3cbr\x3e")), e = mxUtils.getSizeForString(c, e, d[mxConstants.STYLE_FONTFAMILY]), a = e.width + f, b = e.height + b, mxUtils.getValue(d, mxConstants.STYLE_HORIZONTAL, !0) || (d = b, + b = a, a = d), this.gridEnabled && (a = this.snap(a + this.gridSize / 2), b = this.snap(b + this.gridSize / 2)), b = new mxRectangle(0, 0, a, b)) : (d = 4 * this.gridSize, b = new mxRectangle( + 0, 0, d, d)) + } + } + return b +}; +mxGraph.prototype.handleGesture = function(a, b) { + if (0.2 < Math.abs(1 - b.scale)) { + var c = this.view.scale, + d = this.view.translate, + e = a.width * b.scale, + f = a.height * b.scale, + g = a.y - (f - a.height) / 2, + c = new mxRectangle(this.snap((a.x - (e - a.width) / 2) / c) - d.x, this.snap(g / c) - d.y, this.snap(e / c), this.snap(f / c)); + this.resizeCell(a.cell, c) + } +}; +mxGraph.prototype.resizeCell = function(a, b) { + return this.resizeCells([a], [b])[0] +}; +mxGraph.prototype.resizeCells = function(a, b) { + this.model.beginUpdate(); + try { + this.cellsResized(a, b), this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS, "cells", a, "bounds", b)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellsResized = function(a, b) { + if (null != a && null != b && a.length == b.length) { + this.model.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) { + var d = b[c], + e = this.model.getGeometry(a[c]); + if (null != e && (e.x != d.x || e.y != d.y || e.width != d.width || e.height != d.height)) { + e = e.clone(); + if (e.relative) { + var f = e.offset; + null != f && (f.x += d.x - e.x, f.y += d.y - e.y) + } else e.x = d.x, e.y = d.y; + e.width = d.width; + e.height = d.height; + !e.relative && (this.model.isVertex(a[c]) && !this.isAllowNegativeCoordinates()) && (e.x = Math.max(0, e.x), e.y = Math.max(0, + e.y)); + this.model.setGeometry(a[c], e); + this.isExtendParent(a[c]) && this.extendParent(a[c]) + } + } + this.resetEdgesOnResize && this.resetEdges(a); + this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED, "cells", a, "bounds", b)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.extendParent = function(a) { + if (null != a) { + var b = this.model.getParent(a), + c = this.model.getGeometry(b); + if (null != b && (null != c && !this.isCellCollapsed(b)) && (a = this.model.getGeometry(a), null != a && (c.width < a.x + a.width || c.height < a.y + a.height))) c = c.clone(), c.width = Math.max( + c.width, a.x + a.width), c.height = Math.max(c.height, a.y + a.height), this.cellsResized([b], [c]) + } +}; +mxGraph.prototype.importCells = function(a, b, c, d, e) { + return this.moveCells(a, b, c, !0, d, e) +}; +mxGraph.prototype.moveCells = function(a, b, c, d, e, f) { + b = null != b ? b : 0; + c = null != c ? c : 0; + d = null != d ? d : !1; + if (null != a && (0 != b || 0 != c || d || null != e)) { + this.model.beginUpdate(); + try { + d && (a = this.cloneCells(a, this.isCloneInvalidEdges()), null == e && (e = this.getDefaultParent())); + var g = this.isAllowNegativeCoordinates(); + null != e && this.setAllowNegativeCoordinates(!0); + this.cellsMoved(a, b, c, !d && this.isDisconnectOnMove() && this.isAllowDanglingEdges(), null == e); + this.setAllowNegativeCoordinates(g); + if (null != e) { + var h = this.model.getChildCount(e); + this.cellsAdded(a, e, h, null, null, !0) + } + this.fireEvent(new mxEventObject(mxEvent.MOVE_CELLS, "cells", a, "dx", b, "dy", c, "clone", d, "target", e, "event", f)) + } finally { + this.model.endUpdate() + } + } + return a +}; +mxGraph.prototype.cellsMoved = function(a, b, c, d, e) { + if (null != a && (0 != b || 0 != c)) { + this.model.beginUpdate(); + try { + d && this.disconnectGraph(a); + for (var f = 0; f < a.length; f++) this.translateCell(a[f], b, c), e && this.constrainChild(a[f]); + this.resetEdgesOnMove && this.resetEdges(a); + this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED, "cells", a, "dx", c, "dy", c, "disconnect", d)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.translateCell = function(a, b, c) { + var d = this.model.getGeometry(a); + null != d && (d = d.clone(), d.translate(b, c), !d.relative && (this.model.isVertex(a) && !this.isAllowNegativeCoordinates()) && (d.x = Math.max(0, d.x), d.y = Math.max(0, d.y)), d.relative && ! + this.model.isEdge(a) && (null == d.offset ? d.offset = new mxPoint(b, c) : (d.offset.x += b, d.offset.y += c)), this.model.setGeometry(a, d)) +}; +mxGraph.prototype.getCellContainmentArea = function(a) { + if (null != a && !this.model.isEdge(a)) { + var b = this.model.getParent(a); + if (b == this.getDefaultParent() || b == this.getCurrentRoot()) return this.getMaximumGraphBounds(); + if (null != b && b != this.getDefaultParent()) { + var c = this.model.getGeometry(b); + if (null != c) { + var d = a = 0, + e = c.width, + c = c.height; + this.isSwimlane(b) && (b = this.getStartSize(b), a = b.width, e -= b.width, d = b.height, c -= b.height); + return new mxRectangle(a, d, e, c) + } + } + } + return null +}; +mxGraph.prototype.getMaximumGraphBounds = function() { + return this.maximumGraphBounds +}; +mxGraph.prototype.constrainChild = function(a) { + if (null != a) { + var b = this.model.getGeometry(a), + c = this.isConstrainChild(a) ? this.getCellContainmentArea(a) : this.getMaximumGraphBounds(); + if (null != b && null != c && !b.relative && (b.x < c.x || b.y < c.y || c.width < b.x + b.width || c.height < b.y + b.height)) a = this.getOverlap(a), 0 < c.width && (b.x = Math.min(b.x, c.x + + c.width - (1 - a) * b.width)), 0 < c.height && (b.y = Math.min(b.y, c.y + c.height - (1 - a) * b.height)), b.x = Math.max(b.x, c.x - b.width * a), b.y = Math.max(b.y, c.y - b.height * a) + } +}; +mxGraph.prototype.resetEdges = function(a) { + if (null != a) { + for (var b = {}, c = 0; c < a.length; c++) { + var d = mxCellPath.create(a[c]); + b[d] = a[c] + } + this.model.beginUpdate(); + try { + for (c = 0; c < a.length; c++) { + var e = this.model.getEdges(a[c]); + if (null != e) + for (d = 0; d < e.length; d++) { + var f = this.view.getState(e[d]), + g = null != f ? f.getVisibleTerminal(!0) : this.view.getVisibleTerminal(e[d], !0), + h = null != f ? f.getVisibleTerminal(!1) : this.view.getVisibleTerminal(e[d], !1), + k = mxCellPath.create(g), + l = mxCellPath.create(h); + (null == b[k] || null == b[l]) && this.resetEdge(e[d]) + } + this.resetEdges(this.model.getChildren(a[c])) + } + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.resetEdge = function(a) { + var b = this.model.getGeometry(a); + null != b && (null != b.points && 0 < b.points.length) && (b = b.clone(), b.points = [], this.model.setGeometry(a, b)); + return a +}; +mxGraph.prototype.getAllConnectionConstraints = function(a, b) { + return null != a && null != a.shape && null != a.shape.stencil ? a.shape.stencil.constraints : null +}; +mxGraph.prototype.getConnectionConstraint = function(a, b, c) { + b = null; + var d = a.style[c ? mxConstants.STYLE_EXIT_X : mxConstants.STYLE_ENTRY_X]; + if (null != d) { + var e = a.style[c ? mxConstants.STYLE_EXIT_Y : mxConstants.STYLE_ENTRY_Y]; + null != e && (b = new mxPoint(parseFloat(d), parseFloat(e))) + } + d = !1; + null != b && (d = mxUtils.getValue(a.style, c ? mxConstants.STYLE_EXIT_PERIMETER : mxConstants.STYLE_ENTRY_PERIMETER, !0)); + return new mxConnectionConstraint(b, d) +}; +mxGraph.prototype.setConnectionConstraint = function(a, b, c, d) { + if (null != d) { + this.model.beginUpdate(); + try { + null == d || null == d.point ? (this.setCellStyles(c ? mxConstants.STYLE_EXIT_X : mxConstants.STYLE_ENTRY_X, null, [a]), this.setCellStyles(c ? mxConstants.STYLE_EXIT_Y : mxConstants.STYLE_ENTRY_Y, + null, [a]), this.setCellStyles(c ? mxConstants.STYLE_EXIT_PERIMETER : mxConstants.STYLE_ENTRY_PERIMETER, null, [a])) : null != d.point && (this.setCellStyles(c ? mxConstants.STYLE_EXIT_X : + mxConstants.STYLE_ENTRY_X, d.point.x, [a]), this.setCellStyles(c ? + mxConstants.STYLE_EXIT_Y : mxConstants.STYLE_ENTRY_Y, d.point.y, [a]), d.perimeter ? this.setCellStyles(c ? mxConstants.STYLE_EXIT_PERIMETER : mxConstants.STYLE_ENTRY_PERIMETER, null, [ + a + ]) : this.setCellStyles(c ? mxConstants.STYLE_EXIT_PERIMETER : mxConstants.STYLE_ENTRY_PERIMETER, "0", [a])) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.getConnectionPoint = function(a, b) { + var c = null; + if (null != a) { + var d = this.view.getPerimeterBounds(a), + e = new mxPoint(d.getCenterX(), d.getCenterY()), + f = a.style[mxConstants.STYLE_DIRECTION], + g = 0; + if (null != f && ("north" == f ? g += 270 : "west" == f ? g += 180 : "south" == f && (g += 90), "north" == f || "south" == f)) { + d.x += d.width / 2 - d.height / 2; + d.y += d.height / 2 - d.width / 2; + var h = d.width; + d.width = d.height; + d.height = h + } + if (null != b.point) { + var k = c = 1, + l = 0, + m = 0; + if (this.getModel().isVertex(a.cell)) { + var n = a.style[mxConstants.STYLE_FLIPH], + p = + a.style[mxConstants.STYLE_FLIPV]; + null != a.shape.stencil && (n = 1 == mxUtils.getValue(a.style, "stencilFlipH", 0) || n, p = 1 == mxUtils.getValue(a.style, "stencilFlipV", 0) || p); + if ("north" == f || "south" == f) h = n, n = p, p = h; + n && (c = -1, l = -d.width); + p && (k = -1, m = -d.height) + } + c = new mxPoint(d.x + b.point.x * d.width * c - l, d.y + b.point.y * d.height * k - m) + } + f = a.style[mxConstants.STYLE_ROTATION] || 0; + b.perimeter ? (0 != g && null != c && (h = d = 0, 90 == g ? h = 1 : 180 == g ? d = -1 : 270 == f && (h = -1), c = mxUtils.getRotatedPoint(c, d, h, e)), null != c && b.perimeter && (c = this.view + .getPerimeterPoint(a, + c, !1))) : f += g; + 0 != f && null != c && (g = mxUtils.toRadians(f), d = Math.cos(g), h = Math.sin(g), c = mxUtils.getRotatedPoint(c, d, h, e)) + } + return c +}; +mxGraph.prototype.connectCell = function(a, b, c, d) { + this.model.beginUpdate(); + try { + var e = this.model.getTerminal(a, c); + this.cellConnected(a, b, c, d); + this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL, "edge", a, "terminal", b, "source", c, "previous", e)) + } finally { + this.model.endUpdate() + } + return a +}; +mxGraph.prototype.cellConnected = function(a, b, c, d) { + if (null != a) { + this.model.beginUpdate(); + try { + var e = this.model.getTerminal(a, c); + this.setConnectionConstraint(a, b, c, d); + this.isPortsEnabled() && (d = null, this.isPort(b) && (d = b.getId(), b = this.getTerminalForPort(b, c)), this.setCellStyles(c ? mxConstants.STYLE_SOURCE_PORT : mxConstants.STYLE_TARGET_PORT, + d, [a])); + this.model.setTerminal(a, b, c); + this.resetEdgesOnConnect && this.resetEdge(a); + this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED, "edge", a, "terminal", b, "source", + c, "previous", e)) + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.disconnectGraph = function(a) { + if (null != a) { + this.model.beginUpdate(); + try { + for (var b = this.view.scale, c = this.view.translate, d = {}, e = 0; e < a.length; e++) { + var f = mxCellPath.create(a[e]); + d[f] = a[e] + } + for (e = 0; e < a.length; e++) + if (this.model.isEdge(a[e])) { + var g = this.model.getGeometry(a[e]); + if (null != g) { + var h = this.view.getState(a[e]), + k = this.view.getState(this.model.getParent(a[e])); + if (null != h && null != k) { + var g = g.clone(), + l = -k.origin.x, + m = -k.origin.y, + n = h.absolutePoints, + p = this.model.getTerminal(a[e], !0); + if (null != + p && this.isCellDisconnectable(a[e], p, !0)) { + for (var q = mxCellPath.create(p); null != p && null == d[q];) p = this.model.getParent(p), q = mxCellPath.create(p); + null == p && (g.setTerminalPoint(new mxPoint(n[0].x / b - c.x + l, n[0].y / b - c.y + m), !0), this.model.setTerminal(a[e], null, !0)) + } + var s = this.model.getTerminal(a[e], !1); + if (null != s && this.isCellDisconnectable(a[e], s, !1)) { + for (var r = mxCellPath.create(s); null != s && null == d[r];) s = this.model.getParent(s), r = mxCellPath.create(s); + if (null == s) { + var t = n.length - 1; + g.setTerminalPoint(new mxPoint(n[t].x / + b - c.x + l, n[t].y / b - c.y + m), !1); + this.model.setTerminal(a[e], null, !1) + } + } + this.model.setGeometry(a[e], g) + } + } + } + } finally { + this.model.endUpdate() + } + } +}; +mxGraph.prototype.getCurrentRoot = function() { + return this.view.currentRoot +}; +mxGraph.prototype.getTranslateForRoot = function(a) { + return null +}; +mxGraph.prototype.isPort = function(a) { + return !1 +}; +mxGraph.prototype.getTerminalForPort = function(a, b) { + return this.model.getParent(a) +}; +mxGraph.prototype.getChildOffsetForCell = function(a) { + return null +}; +mxGraph.prototype.enterGroup = function(a) { + a = a || this.getSelectionCell(); + null != a && this.isValidRoot(a) && (this.view.setCurrentRoot(a), this.clearSelection()) +}; +mxGraph.prototype.exitGroup = function() { + var a = this.model.getRoot(), + b = this.getCurrentRoot(); + if (null != b) { + for (var c = this.model.getParent(b); c != a && !this.isValidRoot(c) && this.model.getParent(c) != a;) c = this.model.getParent(c); + c == a || this.model.getParent(c) == a ? this.view.setCurrentRoot(null) : this.view.setCurrentRoot(c); + null != this.view.getState(b) && this.setSelectionCell(b) + } +}; +mxGraph.prototype.home = function() { + var a = this.getCurrentRoot(); + null != a && (this.view.setCurrentRoot(null), null != this.view.getState(a) && this.setSelectionCell(a)) +}; +mxGraph.prototype.isValidRoot = function(a) { + return null != a +}; +mxGraph.prototype.getGraphBounds = function() { + return this.view.getGraphBounds() +}; +mxGraph.prototype.getCellBounds = function(a, b, c) { + var d = [a]; + b && (d = d.concat(this.model.getEdges(a))); + d = this.view.getBounds(d); + if (c) { + c = this.model.getChildCount(a); + for (var e = 0; e < c; e++) { + var f = this.getCellBounds(this.model.getChildAt(a, e), b, !0); + null != d ? d.add(f) : d = f + } + } + return d +}; +mxGraph.prototype.getBoundingBoxFromGeometry = function(a, b) { + b = null != b ? b : !1; + var c = null; + if (null != a) + for (var d = 0; d < a.length; d++) + if (b || this.model.isVertex(a[d])) { + var e = this.getCellGeometry(a[d]); + if (null != e) { + var f = e.points; + if (null != f && 0 < f.length) { + for (var g = new mxRectangle(f[0].x, f[0].y, 0, 0), h = function(a) { + null != a && g.add(new mxRectangle(a.x, a.y, 0, 0)) + }, k = 1; k < f.length; k++) h(f[k]); + h(e.getTerminalPoint(!0)); + h(e.getTerminalPoint(!1)) + } + null == c ? c = new mxRectangle(e.x, e.y, e.width, e.height) : c.add(e) + } + } + return c +}; +mxGraph.prototype.refresh = function(a) { + this.view.clear(a, null == a); + this.view.validate(); + this.sizeDidChange(); + this.fireEvent(new mxEventObject(mxEvent.REFRESH)) +}; +mxGraph.prototype.snap = function(a) { + this.gridEnabled && (a = Math.round(a / this.gridSize) * this.gridSize); + return a +}; +mxGraph.prototype.panGraph = function(a, b) { + if (this.useScrollbarsForPanning && mxUtils.hasScrollbars(this.container)) this.container.scrollLeft = -a, this.container.scrollTop = -b; + else { + var c = this.view.getCanvas(); + if (this.dialect == mxConstants.DIALECT_SVG) + if (0 == a && 0 == b) { + if (mxClient.IS_IE ? c.setAttribute("transform", "translate(" + a + "," + b + ")") : c.removeAttribute("transform"), null != this.shiftPreview1) { + for (var d = this.shiftPreview1.firstChild; null != d;) { + var e = d.nextSibling; + this.container.appendChild(d); + d = e + } + this.shiftPreview1.parentNode.removeChild(this.shiftPreview1); + this.shiftPreview1 = null; + this.container.appendChild(c.parentNode); + for (d = this.shiftPreview2.firstChild; null != d;) e = d.nextSibling, this.container.appendChild(d), d = e; + this.shiftPreview2.parentNode.removeChild(this.shiftPreview2); + this.shiftPreview2 = null + } + } else { + c.setAttribute("transform", "translate(" + a + "," + b + ")"); + if (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"; + for (var f = this.shiftPreview1, d = this.container.firstChild; null != d;) e = d.nextSibling, d != c.parentNode ? f.appendChild(d) : f = this.shiftPreview2, d = e; + this.container.insertBefore(this.shiftPreview1, c.parentNode); + this.container.appendChild(this.shiftPreview2) + } + this.shiftPreview1.style.left = a + "px"; + this.shiftPreview1.style.top = b + "px"; + this.shiftPreview2.style.left = a + "px"; + this.shiftPreview2.style.top = b + "px" + } else c.style.left = + a + "px", c.style.top = b + "px"; + this.panDx = a; + this.panDy = b; + 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(a, b) { + this.zoom(a / this.view.scale, b) +}; +mxGraph.prototype.zoom = function(a, b) { + b = null != b ? b : this.centerZoom; + var c = this.view.scale * a, + d = this.view.getState(this.getSelectionCell()); + if (this.keepSelectionVisibleOnZoom && null != d) d = new mxRectangle(d.x * a, d.y * a, d.width * a, d.height * a), this.view.scale = c, this.scrollRectToVisible(d) || (this.view.revalidate(), + this.view.setScale(c)); + else if (b && !mxUtils.hasScrollbars(this.container)) { + var d = this.container.offsetWidth, + e = this.container.offsetHeight; + if (1 < a) var f = (a - 1) / (2 * c), + d = d * -f, + e = e * -f; + else f = (1 / a - 1) / (2 * this.view.scale), + d *= f, e *= f; + this.view.scaleAndTranslate(c, this.view.translate.x + d, this.view.translate.y + e) + } else this.view.setScale(c), mxUtils.hasScrollbars(this.container) && (e = d = 0, b && (d = this.container.offsetWidth * (a - 1) / 2, e = this.container.offsetHeight * (a - 1) / 2), this.container + .scrollLeft = Math.round(this.container.scrollLeft * a + d), this.container.scrollTop = Math.round(this.container.scrollTop * a + e)) +}; +mxGraph.prototype.zoomToRect = function(a) { + var b = this.container.clientWidth / a.width / (this.container.clientHeight / a.height); + a.x = Math.max(0, a.x); + a.y = Math.max(0, a.y); + var c = Math.min(this.container.scrollWidth, a.x + a.width), + d = Math.min(this.container.scrollHeight, a.y + a.height); + a.width = c - a.x; + a.height = d - a.y; + 1 > b ? (b = a.height / b, c = (b - a.height) / 2, a.height = b, b = Math.min(a.y, c), a.y -= b, d = Math.min(this.container.scrollHeight, a.y + a.height), a.height = d - a.y) : (b *= a.width, c = + (b - a.width) / 2, a.width = b, b = Math.min(a.x, c), a.x -= b, + c = Math.min(this.container.scrollWidth, a.x + a.width), a.width = c - a.x); + b = this.container.clientWidth / a.width; + c = this.view.scale * b; + mxUtils.hasScrollbars(this.container) ? (this.view.setScale(c), this.container.scrollLeft = Math.round(a.x * b), this.container.scrollTop = Math.round(a.y * b)) : this.view.scaleAndTranslate(c, + this.view.translate.x - a.x / this.view.scale, this.view.translate.y - a.y / this.view.scale) +}; +mxGraph.prototype.fit = function(a, b) { + if (null != this.container) { + a = null != a ? a : 0; + b = null != b ? b : !1; + var c = this.container.clientWidth, + d = this.container.clientHeight, + e = this.view.getGraphBounds(); + b && (null != e.x && null != e.y) && (e.width += e.x, e.height += e.y, e.x = 0, e.y = 0); + var f = this.view.scale, + g = e.width / f, + h = e.height / f; + null != this.backgroundImage && (g = Math.max(g, this.backgroundImage.width - e.x / f), h = Math.max(h, this.backgroundImage.height - e.y / f)); + var k = b ? a : 2 * a, + c = Math.floor(100 * Math.min(c / (g + k), d / (h + k))) / 100; + null != this.minFitScale && + (c = Math.max(c, this.minFitScale)); + null != this.maxFitScale && (c = Math.min(c, this.maxFitScale)); + b ? this.view.scale != c && this.view.setScale(c) : mxUtils.hasScrollbars(this.container) ? (this.view.setScale(c), null != e.x && (this.container.scrollLeft = Math.round(e.x / f) * c - a - + Math.max(0, (this.container.clientWidth - g * c) / 2)), null != e.y && (this.container.scrollTop = Math.round(e.y / f) * c - a - Math.max(0, (this.container.clientHeight - h * c) / 2))) : + this.view.scaleAndTranslate(c, null != e.x ? Math.floor(this.view.translate.x - e.x / f + a + 1) : a, null != + e.y ? Math.floor(this.view.translate.y - e.y / f + a + 1) : a) + } + return this.view.scale +}; +mxGraph.prototype.scrollCellToVisible = function(a, b) { + var c = -this.view.translate.x, + d = -this.view.translate.y, + e = this.view.getState(a); + null != e && (c = new mxRectangle(c + e.x, d + e.y, e.width, e.height), b && null != this.container && (d = this.container.clientWidth, e = this.container.clientHeight, c.x = c.getCenterX() - d / + 2, c.width = d, c.y = c.getCenterY() - e / 2, c.height = e), this.scrollRectToVisible(c) && this.view.setTranslate(this.view.translate.x, this.view.translate.y)) +}; +mxGraph.prototype.scrollRectToVisible = function(a) { + var b = !1; + if (null != a) { + var c = this.container.offsetWidth, + d = this.container.offsetHeight, + e = Math.min(c, a.width), + f = Math.min(d, a.height); + if (mxUtils.hasScrollbars(this.container)) { + c = this.container; + a.x += this.view.translate.x; + a.y += this.view.translate.y; + var g = c.scrollLeft - a.x, + d = Math.max(g - c.scrollLeft, 0); + 0 < g ? c.scrollLeft -= g + 2 : (g = a.x + e - c.scrollLeft - c.clientWidth, 0 < g && (c.scrollLeft += g + 2)); + e = c.scrollTop - a.y; + g = Math.max(0, e - c.scrollTop); + 0 < e ? c.scrollTop -= e + 2 : (e = a.y + + f - c.scrollTop - c.clientHeight, 0 < e && (c.scrollTop += e + 2)); + !this.useScrollbarsForPanning && (0 != d || 0 != g) && this.view.setTranslate(d, g) + } else { + var g = -this.view.translate.x, + h = -this.view.translate.y, + k = this.view.scale; + a.x + e > g + c && (this.view.translate.x -= (a.x + e - c - g) / k, b = !0); + a.y + f > h + d && (this.view.translate.y -= (a.y + f - d - h) / k, b = !0); + a.x < g && (this.view.translate.x += (g - a.x) / k, b = !0); + a.y < h && (this.view.translate.y += (h - a.y) / k, b = !0); + b && (this.view.refresh(), null != this.selectionCellsHandler && this.selectionCellsHandler.refresh()) + } + } + return b +}; +mxGraph.prototype.getCellGeometry = function(a) { + return this.model.getGeometry(a) +}; +mxGraph.prototype.isCellVisible = function(a) { + return this.model.isVisible(a) +}; +mxGraph.prototype.isCellCollapsed = function(a) { + return this.model.isCollapsed(a) +}; +mxGraph.prototype.isCellConnectable = function(a) { + return this.model.isConnectable(a) +}; +mxGraph.prototype.isOrthogonal = function(a) { + var b = a.style[mxConstants.STYLE_ORTHOGONAL]; + if (null != b) return b; + a = this.view.getEdgeStyle(a); + return a == mxEdgeStyle.SegmentConnector || a == mxEdgeStyle.ElbowConnector || a == mxEdgeStyle.SideToSide || a == mxEdgeStyle.TopToBottom || a == mxEdgeStyle.EntityRelation || a == mxEdgeStyle.OrthConnector +}; +mxGraph.prototype.isLoop = function(a) { + var b = a.getVisibleTerminalState(!0); + a = a.getVisibleTerminalState(!1); + return null != b && b == a +}; +mxGraph.prototype.isCloneEvent = function(a) { + return mxEvent.isControlDown(a) +}; +mxGraph.prototype.isToggleEvent = function(a) { + return mxClient.IS_MAC ? mxEvent.isMetaDown(a) : mxEvent.isControlDown(a) +}; +mxGraph.prototype.isGridEnabledEvent = function(a) { + return null != a && !mxEvent.isAltDown(a) +}; +mxGraph.prototype.isConstrainedEvent = function(a) { + return mxEvent.isShiftDown(a) +}; +mxGraph.prototype.isForceMarqueeEvent = function(a) { + return mxEvent.isAltDown(a) +}; +mxGraph.prototype.validationAlert = function(a) { + mxUtils.alert(a) +}; +mxGraph.prototype.isEdgeValid = function(a, b, c) { + return null == this.getEdgeValidationError(a, b, c) +}; +mxGraph.prototype.getEdgeValidationError = function(a, b, c) { + if (null != a && !this.isAllowDanglingEdges() && (null == b || null == c)) return ""; + if (null != a && null == this.model.getTerminal(a, !0) && null == this.model.getTerminal(a, !1)) return null; + if (!this.allowLoops && b == c && null != b || !this.isValidConnection(b, c)) return ""; + if (null != b && null != c) { + var d = ""; + if (!this.multigraph) { + var e = this.model.getEdgesBetween(b, c, !0); + if (1 < e.length || 1 == e.length && e[0] != a) d += (mxResources.get(this.alreadyConnectedResource) || this.alreadyConnectedResource) + + "\n" + } + var e = this.model.getDirectedEdgeCount(b, !0, a), + f = this.model.getDirectedEdgeCount(c, !1, a); + if (null != this.multiplicities) + for (var g = 0; g < this.multiplicities.length; g++) { + var h = this.multiplicities[g].check(this, a, b, c, e, f); + null != h && (d += h) + } + h = this.validateEdge(a, b, c); + null != h && (d += h); + return 0 < d.length ? d : null + } + return this.allowDanglingEdges ? null : "" +}; +mxGraph.prototype.validateEdge = function(a, b, c) { + return null +}; +mxGraph.prototype.validateGraph = function(a, b) { + a = null != a ? a : this.model.getRoot(); + b = null != b ? b : {}; + for (var c = !0, d = this.model.getChildCount(a), e = 0; e < d; e++) { + var f = this.model.getChildAt(a, e), + g = b; + this.isValidRoot(f) && (g = {}); + g = this.validateGraph(f, g); + null != g ? this.setCellWarning(f, g.replace(/\n/g, "\x3cbr\x3e")) : this.setCellWarning(f, null); + c = c && null == g + } + d = ""; + this.isCellCollapsed(a) && !c && (d += (mxResources.get(this.containsValidationErrorsResource) || this.containsValidationErrorsResource) + "\n"); + d = this.model.isEdge(a) ? + d + (this.getEdgeValidationError(a, this.model.getTerminal(a, !0), this.model.getTerminal(a, !1)) || "") : d + (this.getCellValidationError(a) || ""); + e = this.validateCell(a, b); + null != e && (d += e); + null == this.model.getParent(a) && this.view.validate(); + return 0 < d.length || !c ? d : null +}; +mxGraph.prototype.getCellValidationError = function(a) { + var b = this.model.getDirectedEdgeCount(a, !0), + c = this.model.getDirectedEdgeCount(a, !1); + a = this.model.getValue(a); + var d = ""; + if (null != this.multiplicities) + for (var e = 0; e < this.multiplicities.length; e++) { + var f = this.multiplicities[e]; + if (f.source && mxUtils.isNode(a, f.type, f.attr, f.value) && (0 == f.max && 0 < b || 1 == f.min && 0 == b || 1 == f.max && 1 < b)) d += f.countError + "\n"; + else if (!f.source && mxUtils.isNode(a, f.type, f.attr, f.value) && (0 == f.max && 0 < c || 1 == f.min && 0 == c || 1 == f.max && 1 < + c)) d += f.countError + "\n" + } + return 0 < d.length ? d : null +}; +mxGraph.prototype.validateCell = function(a, b) { + return null +}; +mxGraph.prototype.getBackgroundImage = function() { + return this.backgroundImage +}; +mxGraph.prototype.setBackgroundImage = function(a) { + this.backgroundImage = a +}; +mxGraph.prototype.getFoldingImage = function(a) { + if (null != a && this.foldingEnabled && !this.getModel().isEdge(a.cell)) { + var b = this.isCellCollapsed(a.cell); + if (this.isCellFoldable(a.cell, !b)) return b ? this.collapsedImage : this.expandedImage + } + return null +}; +mxGraph.prototype.convertValueToString = function(a) { + a = this.model.getValue(a); + if (null != a) { + if (mxUtils.isNode(a)) return a.nodeName; + if ("function" == typeof a.toString) return a.toString() + } + return "" +}; +mxGraph.prototype.getLabel = function(a) { + var b = ""; + if (this.labelsVisible && null != a) { + var c = this.view.getState(a), + c = null != c ? c.style : this.getCellStyle(a); + mxUtils.getValue(c, mxConstants.STYLE_NOLABEL, !1) || (b = this.convertValueToString(a)) + } + return b +}; +mxGraph.prototype.isHtmlLabel = function(a) { + return this.isHtmlLabels() +}; +mxGraph.prototype.isHtmlLabels = function() { + return this.htmlLabels +}; +mxGraph.prototype.setHtmlLabels = function(a) { + this.htmlLabels = a +}; +mxGraph.prototype.isWrapping = function(a) { + var b = this.view.getState(a); + a = null != b ? b.style : this.getCellStyle(a); + return null != a ? "wrap" == a[mxConstants.STYLE_WHITE_SPACE] : !1 +}; +mxGraph.prototype.isLabelClipped = function(a) { + var b = this.view.getState(a); + a = null != b ? b.style : this.getCellStyle(a); + return null != a ? "hidden" == a[mxConstants.STYLE_OVERFLOW] : !1 +}; +mxGraph.prototype.getTooltip = function(a, b, c, d) { + var e = null; + if (null != a) { + if (null != a.control && (b == a.control.node || b.parentNode == a.control.node)) e = this.collapseExpandResource, e = mxResources.get(e) || e; + null == e && null != a.overlays && a.overlays.visit(function(a, c) { + if (null == e && (b == c.node || b.parentNode == c.node)) e = c.overlay.toString() + }); + null == e && (c = this.selectionCellsHandler.getHandler(a.cell), null != c && "function" == typeof c.getTooltipForNode && (e = c.getTooltipForNode(b))); + null == e && (e = this.getTooltipForCell(a.cell)) + } + return e +}; +mxGraph.prototype.getTooltipForCell = function(a) { + var b = null; + return b = null != a && null != a.getTooltip ? a.getTooltip() : this.convertValueToString(a) +}; +mxGraph.prototype.getCursorForCell = function(a) { + return null +}; +mxGraph.prototype.getStartSize = function(a) { + var b = new mxRectangle, + c = this.view.getState(a); + a = null != c ? c.style : this.getCellStyle(a); + null != a && (c = parseInt(mxUtils.getValue(a, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)), mxUtils.getValue(a, mxConstants.STYLE_HORIZONTAL, !0) ? b.height = c : b.width = c); + return b +}; +mxGraph.prototype.getImage = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_IMAGE] : null +}; +mxGraph.prototype.getVerticalAlign = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_VERTICAL_ALIGN] || mxConstants.ALIGN_MIDDLE : null +}; +mxGraph.prototype.getIndicatorColor = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_INDICATOR_COLOR] : null +}; +mxGraph.prototype.getIndicatorGradientColor = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR] : null +}; +mxGraph.prototype.getIndicatorShape = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_INDICATOR_SHAPE] : null +}; +mxGraph.prototype.getIndicatorImage = function(a) { + return null != a && null != a.style ? a.style[mxConstants.STYLE_INDICATOR_IMAGE] : null +}; +mxGraph.prototype.getBorder = function() { + return this.border +}; +mxGraph.prototype.setBorder = function(a) { + this.border = a +}; +mxGraph.prototype.isSwimlane = function(a) { + if (null != a && this.model.getParent(a) != this.model.getRoot()) { + var b = this.view.getState(a), + b = null != b ? b.style : this.getCellStyle(a); + if (null != b && !this.model.isEdge(a)) return b[mxConstants.STYLE_SHAPE] == mxConstants.SHAPE_SWIMLANE + } + return !1 +}; +mxGraph.prototype.isResizeContainer = function() { + return this.resizeContainer +}; +mxGraph.prototype.setResizeContainer = function(a) { + this.resizeContainer = a +}; +mxGraph.prototype.isEnabled = function() { + return this.enabled +}; +mxGraph.prototype.setEnabled = function(a) { + this.enabled = a +}; +mxGraph.prototype.isEscapeEnabled = function() { + return this.escapeEnabled +}; +mxGraph.prototype.setEscapeEnabled = function(a) { + this.escapeEnabled = a +}; +mxGraph.prototype.isInvokesStopCellEditing = function() { + return this.invokesStopCellEditing +}; +mxGraph.prototype.setInvokesStopCellEditing = function(a) { + this.invokesStopCellEditing = a +}; +mxGraph.prototype.isEnterStopsCellEditing = function() { + return this.enterStopsCellEditing +}; +mxGraph.prototype.setEnterStopsCellEditing = function(a) { + this.enterStopsCellEditing = a +}; +mxGraph.prototype.isCellLocked = function(a) { + var b = this.model.getGeometry(a); + return this.isCellsLocked() || null != b && this.model.isVertex(a) && b.relative +}; +mxGraph.prototype.isCellsLocked = function() { + return this.cellsLocked +}; +mxGraph.prototype.setCellsLocked = function(a) { + this.cellsLocked = a +}; +mxGraph.prototype.getCloneableCells = function(a) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.isCellCloneable(a) + })) +}; +mxGraph.prototype.isCellCloneable = function(a) { + var b = this.view.getState(a); + a = null != b ? b.style : this.getCellStyle(a); + return this.isCellsCloneable() && 0 != a[mxConstants.STYLE_CLONEABLE] +}; +mxGraph.prototype.isCellsCloneable = function() { + return this.cellsCloneable +}; +mxGraph.prototype.setCellsCloneable = function(a) { + this.cellsCloneable = a +}; +mxGraph.prototype.getExportableCells = function(a) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.canExportCell(a) + })) +}; +mxGraph.prototype.canExportCell = function(a) { + return this.exportEnabled +}; +mxGraph.prototype.getImportableCells = function(a) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.canImportCell(a) + })) +}; +mxGraph.prototype.canImportCell = function(a) { + return this.importEnabled +}; +mxGraph.prototype.isCellSelectable = function(a) { + return this.isCellsSelectable() +}; +mxGraph.prototype.isCellsSelectable = function() { + return this.cellsSelectable +}; +mxGraph.prototype.setCellsSelectable = function(a) { + this.cellsSelectable = a +}; +mxGraph.prototype.getDeletableCells = function(a) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.isCellDeletable(a) + })) +}; +mxGraph.prototype.isCellDeletable = function(a) { + var b = this.view.getState(a); + a = null != b ? b.style : this.getCellStyle(a); + return this.isCellsDeletable() && 0 != a[mxConstants.STYLE_DELETABLE] +}; +mxGraph.prototype.isCellsDeletable = function() { + return this.cellsDeletable +}; +mxGraph.prototype.setCellsDeletable = function(a) { + this.cellsDeletable = a +}; +mxGraph.prototype.isLabelMovable = function(a) { + return !this.isCellLocked(a) && (this.model.isEdge(a) && this.edgeLabelsMovable || this.model.isVertex(a) && this.vertexLabelsMovable) +}; +mxGraph.prototype.getMovableCells = function(a) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.isCellMovable(a) + })) +}; +mxGraph.prototype.isCellMovable = function(a) { + var b = this.view.getState(a), + b = null != b ? b.style : this.getCellStyle(a); + return this.isCellsMovable() && !this.isCellLocked(a) && 0 != b[mxConstants.STYLE_MOVABLE] +}; +mxGraph.prototype.isCellsMovable = function() { + return this.cellsMovable +}; +mxGraph.prototype.setCellsMovable = function(a) { + this.cellsMovable = a +}; +mxGraph.prototype.isGridEnabled = function() { + return this.gridEnabled +}; +mxGraph.prototype.setGridEnabled = function(a) { + this.gridEnabled = a +}; +mxGraph.prototype.isPortsEnabled = function() { + return this.portsEnabled +}; +mxGraph.prototype.setPortsEnabled = function(a) { + this.portsEnabled = a +}; +mxGraph.prototype.getGridSize = function() { + return this.gridSize +}; +mxGraph.prototype.setGridSize = function(a) { + this.gridSize = a +}; +mxGraph.prototype.getTolerance = function() { + return this.tolerance +}; +mxGraph.prototype.setTolerance = function(a) { + this.tolerance = a +}; +mxGraph.prototype.isVertexLabelsMovable = function() { + return this.vertexLabelsMovable +}; +mxGraph.prototype.setVertexLabelsMovable = function(a) { + this.vertexLabelsMovable = a +}; +mxGraph.prototype.isEdgeLabelsMovable = function() { + return this.edgeLabelsMovable +}; +mxGraph.prototype.setEdgeLabelsMovable = function(a) { + this.edgeLabelsMovable = a +}; +mxGraph.prototype.isSwimlaneNesting = function() { + return this.swimlaneNesting +}; +mxGraph.prototype.setSwimlaneNesting = function(a) { + this.swimlaneNesting = a +}; +mxGraph.prototype.isSwimlaneSelectionEnabled = function() { + return this.swimlaneSelectionEnabled +}; +mxGraph.prototype.setSwimlaneSelectionEnabled = function(a) { + this.swimlaneSelectionEnabled = a +}; +mxGraph.prototype.isMultigraph = function() { + return this.multigraph +}; +mxGraph.prototype.setMultigraph = function(a) { + this.multigraph = a +}; +mxGraph.prototype.isAllowLoops = function() { + return this.allowLoops +}; +mxGraph.prototype.setAllowDanglingEdges = function(a) { + this.allowDanglingEdges = a +}; +mxGraph.prototype.isAllowDanglingEdges = function() { + return this.allowDanglingEdges +}; +mxGraph.prototype.setConnectableEdges = function(a) { + this.connectableEdges = a +}; +mxGraph.prototype.isConnectableEdges = function() { + return this.connectableEdges +}; +mxGraph.prototype.setCloneInvalidEdges = function(a) { + this.cloneInvalidEdges = a +}; +mxGraph.prototype.isCloneInvalidEdges = function() { + return this.cloneInvalidEdges +}; +mxGraph.prototype.setAllowLoops = function(a) { + this.allowLoops = a +}; +mxGraph.prototype.isDisconnectOnMove = function() { + return this.disconnectOnMove +}; +mxGraph.prototype.setDisconnectOnMove = function(a) { + this.disconnectOnMove = a +}; +mxGraph.prototype.isDropEnabled = function() { + return this.dropEnabled +}; +mxGraph.prototype.setDropEnabled = function(a) { + this.dropEnabled = a +}; +mxGraph.prototype.isSplitEnabled = function() { + return this.splitEnabled +}; +mxGraph.prototype.setSplitEnabled = function(a) { + this.splitEnabled = a +}; +mxGraph.prototype.isCellResizable = function(a) { + var b = this.view.getState(a), + b = null != b ? b.style : this.getCellStyle(a); + return this.isCellsResizable() && !this.isCellLocked(a) && 0 != b[mxConstants.STYLE_RESIZABLE] +}; +mxGraph.prototype.isCellsResizable = function() { + return this.cellsResizable +}; +mxGraph.prototype.setCellsResizable = function(a) { + this.cellsResizable = a +}; +mxGraph.prototype.isTerminalPointMovable = function(a, b) { + return !0 +}; +mxGraph.prototype.isCellBendable = function(a) { + var b = this.view.getState(a), + b = null != b ? b.style : this.getCellStyle(a); + return this.isCellsBendable() && !this.isCellLocked(a) && 0 != b[mxConstants.STYLE_BENDABLE] +}; +mxGraph.prototype.isCellsBendable = function() { + return this.cellsBendable +}; +mxGraph.prototype.setCellsBendable = function(a) { + this.cellsBendable = a +}; +mxGraph.prototype.isCellEditable = function(a) { + var b = this.view.getState(a), + b = null != b ? b.style : this.getCellStyle(a); + return this.isCellsEditable() && !this.isCellLocked(a) && 0 != b[mxConstants.STYLE_EDITABLE] +}; +mxGraph.prototype.isCellsEditable = function() { + return this.cellsEditable +}; +mxGraph.prototype.setCellsEditable = function(a) { + this.cellsEditable = a +}; +mxGraph.prototype.isCellDisconnectable = function(a, b, c) { + return this.isCellsDisconnectable() && !this.isCellLocked(a) +}; +mxGraph.prototype.isCellsDisconnectable = function() { + return this.cellsDisconnectable +}; +mxGraph.prototype.setCellsDisconnectable = function(a) { + this.cellsDisconnectable = a +}; +mxGraph.prototype.isValidSource = function(a) { + return null == a && this.allowDanglingEdges || null != a && (!this.model.isEdge(a) || this.connectableEdges) && this.isCellConnectable(a) +}; +mxGraph.prototype.isValidTarget = function(a) { + return this.isValidSource(a) +}; +mxGraph.prototype.isValidConnection = function(a, b) { + return this.isValidSource(a) && this.isValidTarget(b) +}; +mxGraph.prototype.setConnectable = function(a) { + this.connectionHandler.setEnabled(a) +}; +mxGraph.prototype.isConnectable = function(a) { + return this.connectionHandler.isEnabled() +}; +mxGraph.prototype.setTooltips = function(a) { + this.tooltipHandler.setEnabled(a) +}; +mxGraph.prototype.setPanning = function(a) { + this.panningHandler.panningEnabled = a +}; +mxGraph.prototype.isEditing = function(a) { + if (null != this.cellEditor) { + var b = this.cellEditor.getEditingCell(); + return null == a ? null != b : a == b + } + return !1 +}; +mxGraph.prototype.isAutoSizeCell = function(a) { + var b = this.view.getState(a); + a = null != b ? b.style : this.getCellStyle(a); + return this.isAutoSizeCells() || 1 == a[mxConstants.STYLE_AUTOSIZE] +}; +mxGraph.prototype.isAutoSizeCells = function() { + return this.autoSizeCells +}; +mxGraph.prototype.setAutoSizeCells = function(a) { + this.autoSizeCells = a +}; +mxGraph.prototype.isExtendParent = function(a) { + return !this.getModel().isEdge(a) && this.isExtendParents() +}; +mxGraph.prototype.isExtendParents = function() { + return this.extendParents +}; +mxGraph.prototype.setExtendParents = function(a) { + this.extendParents = a +}; +mxGraph.prototype.isExtendParentsOnAdd = function() { + return this.extendParentsOnAdd +}; +mxGraph.prototype.setExtendParentsOnAdd = function(a) { + this.extendParentsOnAdd = a +}; +mxGraph.prototype.isConstrainChild = function(a) { + return this.isConstrainChildren() && !this.getModel().isEdge(this.getModel().getParent(a)) +}; +mxGraph.prototype.isConstrainChildren = function() { + return this.constrainChildren +}; +mxGraph.prototype.setConstrainChildren = function(a) { + this.constrainChildren = a +}; +mxGraph.prototype.isAllowNegativeCoordinates = function() { + return this.allowNegativeCoordinates +}; +mxGraph.prototype.setAllowNegativeCoordinates = function(a) { + this.allowNegativeCoordinates = a +}; +mxGraph.prototype.getOverlap = function(a) { + return this.isAllowOverlapParent(a) ? this.defaultOverlap : 0 +}; +mxGraph.prototype.isAllowOverlapParent = function(a) { + return !1 +}; +mxGraph.prototype.getFoldableCells = function(a, b) { + return this.model.filterCells(a, mxUtils.bind(this, function(a) { + return this.isCellFoldable(a, b) + })) +}; +mxGraph.prototype.isCellFoldable = function(a, b) { + var c = this.view.getState(a), + c = null != c ? c.style : this.getCellStyle(a); + return 0 < this.model.getChildCount(a) && 0 != c[mxConstants.STYLE_FOLDABLE] +}; +mxGraph.prototype.isValidDropTarget = function(a, b, c) { + return null != a && (this.isSplitEnabled() && this.isSplitTarget(a, b, c) || !this.model.isEdge(a) && (this.isSwimlane(a) || 0 < this.model.getChildCount(a) && !this.isCellCollapsed(a))) +}; +mxGraph.prototype.isSplitTarget = function(a, b, c) { + return this.model.isEdge(a) && null != b && 1 == b.length && this.isCellConnectable(b[0]) && null == this.getEdgeValidationError(a, this.model.getTerminal(a, !0), b[0]) ? (c = this.model.getTerminal( + a, !0), a = this.model.getTerminal(a, !1), !this.model.isAncestor(b[0], c) && !this.model.isAncestor(b[0], a)) : !1 +}; +mxGraph.prototype.getDropTarget = function(a, b, c) { + if (!this.isSwimlaneNesting()) + for (var d = 0; d < a.length; d++) + if (this.isSwimlane(a[d])) return null; + d = mxUtils.convertPoint(this.container, mxEvent.getClientX(b), mxEvent.getClientY(b)); + d.x -= this.panDx; + d.y -= this.panDy; + d = this.getSwimlaneAt(d.x, d.y); + if (null == c) c = d; + else if (null != d) { + for (var e = this.model.getParent(d); null != e && this.isSwimlane(e) && e != c;) e = this.model.getParent(e); + e == c && (c = d) + } + for (; null != c && !this.isValidDropTarget(c, a, b) && !this.model.isLayer(c);) c = this.model.getParent(c); + return !this.model.isLayer(c) && 0 > mxUtils.indexOf(a, c) ? c : null +}; +mxGraph.prototype.getDefaultParent = function() { + var a = this.defaultParent; + null == a && (a = this.getCurrentRoot(), null == a && (a = this.model.getRoot(), a = this.model.getChildAt(a, 0))); + return a +}; +mxGraph.prototype.setDefaultParent = function(a) { + this.defaultParent = a +}; +mxGraph.prototype.getSwimlane = function(a) { + for (; null != a && !this.isSwimlane(a);) a = this.model.getParent(a); + return a +}; +mxGraph.prototype.getSwimlaneAt = function(a, b, c) { + c = c || this.getDefaultParent(); + if (null != c) + for (var d = this.model.getChildCount(c), e = 0; e < d; e++) { + var f = this.model.getChildAt(c, e), + g = this.getSwimlaneAt(a, b, f); + if (null != g) return g; + if (this.isSwimlane(f) && (g = this.view.getState(f), this.intersects(g, a, b))) return f + } + return null +}; +mxGraph.prototype.getCellAt = function(a, b, c, d, e) { + d = null != d ? d : !0; + e = null != e ? e : !0; + c = null != c ? c : this.getDefaultParent(); + if (null != c) + for (var f = this.model.getChildCount(c) - 1; 0 <= f; f--) { + var g = this.model.getChildAt(c, f), + h = this.getCellAt(a, b, g, d, e); + if (null != h) return h; + if (this.isCellVisible(g) && (e && this.model.isEdge(g) || d && this.model.isVertex(g))) + if (h = this.view.getState(g), this.intersects(h, a, b)) return g + } + return null +}; +mxGraph.prototype.intersects = function(a, b, c) { + if (null != a) { + var d = a.absolutePoints; + if (null != d) { + a = this.tolerance * this.tolerance; + for (var e = d[0], f = 1; f < d.length; f++) { + var g = d[f]; + if (mxUtils.ptSegDistSq(e.x, e.y, g.x, g.y, b, c) <= a) return !0; + e = g + } + } else if (e = mxUtils.toRadians(mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION) || 0), 0 != e && (d = Math.cos(-e), e = Math.sin(-e), f = new mxPoint(a.getCenterX(), a.getCenterY()), e = + mxUtils.getRotatedPoint(new mxPoint(b, c), d, e, f), b = e.x, c = e.y), mxUtils.contains(a, b, c)) return !0 + } + return !1 +}; +mxGraph.prototype.hitsSwimlaneContent = function(a, b, c) { + var d = this.getView().getState(a); + a = this.getStartSize(a); + if (null != d) { + var e = this.getView().getScale(); + b -= d.x; + c -= d.y; + if (0 < a.width && 0 < b && b > a.width * e || 0 < a.height && 0 < c && c > a.height * e) return !0 + } + return !1 +}; +mxGraph.prototype.getChildVertices = function(a) { + return this.getChildCells(a, !0, !1) +}; +mxGraph.prototype.getChildEdges = function(a) { + return this.getChildCells(a, !1, !0) +}; +mxGraph.prototype.getChildCells = function(a, b, c) { + a = null != a ? a : this.getDefaultParent(); + a = this.model.getChildCells(a, null != b ? b : !1, null != c ? c : !1); + b = []; + for (c = 0; c < a.length; c++) this.isCellVisible(a[c]) && b.push(a[c]); + return b +}; +mxGraph.prototype.getConnections = function(a, b) { + return this.getEdges(a, b, !0, !0, !1) +}; +mxGraph.prototype.getIncomingEdges = function(a, b) { + return this.getEdges(a, b, !0, !1, !1) +}; +mxGraph.prototype.getOutgoingEdges = function(a, b) { + return this.getEdges(a, b, !1, !0, !1) +}; +mxGraph.prototype.getEdges = function(a, b, c, d, e, f) { + c = null != c ? c : !0; + d = null != d ? d : !0; + e = null != e ? e : !0; + f = null != f ? f : !1; + for (var g = [], h = this.isCellCollapsed(a), k = this.model.getChildCount(a), l = 0; l < k; l++) { + var m = this.model.getChildAt(a, l); + if (h || !this.isCellVisible(m)) g = g.concat(this.model.getEdges(m, c, d)) + } + g = g.concat(this.model.getEdges(a, c, d)); + h = []; + for (l = 0; l < g.length; l++) m = this.view.getState(g[l]), k = null != m ? m.getVisibleTerminal(!0) : this.view.getVisibleTerminal(g[l], !0), m = null != m ? m.getVisibleTerminal(!1) : this.view + .getVisibleTerminal(g[l], !1), (e && k == m || k != m && (c && m == a && (null == b || this.isValidAncestor(k, b, f)) || d && k == a && (null == b || this.isValidAncestor(m, b, f)))) && h.push( + g[l]); + return h +}; +mxGraph.prototype.isValidAncestor = function(a, b, c) { + return c ? this.model.isAncestor(b, a) : this.model.getParent(a) == b +}; +mxGraph.prototype.getOpposites = function(a, b, c, d) { + c = null != c ? c : !0; + d = null != d ? d : !0; + var e = [], + f = {}; + if (null != a) + for (var g = 0; g < a.length; g++) { + var h = this.view.getState(a[g]), + k = null != h ? h.getVisibleTerminal(!0) : this.view.getVisibleTerminal(a[g], !0), + h = null != h ? h.getVisibleTerminal(!1) : this.view.getVisibleTerminal(a[g], !1); + if (k == b && null != h && h != b && d) { + var l = mxCellPath.create(h); + null == f[l] && (f[l] = h, e.push(h)) + } else h == b && (null != k && k != b && c) && (l = mxCellPath.create(k), null == f[l] && (f[l] = k, e.push(k))) + } + return e +}; +mxGraph.prototype.getEdgesBetween = function(a, b, c) { + c = null != c ? c : !1; + for (var d = this.getEdges(a), e = [], f = 0; f < d.length; f++) { + var g = this.view.getState(d[f]), + h = null != g ? g.getVisibleTerminal(!0) : this.view.getVisibleTerminal(d[f], !0), + g = null != g ? g.getVisibleTerminal(!1) : this.view.getVisibleTerminal(d[f], !1); + (h == a && g == b || !c && h == b && g == a) && e.push(d[f]) + } + return e +}; +mxGraph.prototype.getPointForEvent = function(a, b) { + var c = mxUtils.convertPoint(this.container, mxEvent.getClientX(a), mxEvent.getClientY(a)), + d = this.view.scale, + e = this.view.translate, + f = !1 != b ? this.gridSize / 2 : 0; + c.x = this.snap(c.x / d - e.x - f); + c.y = this.snap(c.y / d - e.y - f); + return c +}; +mxGraph.prototype.getCells = function(a, b, c, d, e, f) { + f = null != f ? f : []; + if (0 < c || 0 < d) { + var g = a + c, + h = b + d; + e = e || this.getDefaultParent(); + if (null != e) + for (var k = this.model.getChildCount(e), l = 0; l < k; l++) { + var m = this.model.getChildAt(e, l), + n = this.view.getState(m); + if (this.isCellVisible(m) && null != n) { + var p = n, + n = mxUtils.getValue(n.style, mxConstants.STYLE_ROTATION) || 0; + 0 != n && (p = mxUtils.getBoundingBox(p, n)); + p.x >= a && p.y + p.height <= h && p.y >= b && p.x + p.width <= g ? f.push(m) : this.getCells(a, b, c, d, m, f) + } + } + } + return f +}; +mxGraph.prototype.getCellsBeyond = function(a, b, c, d, e) { + var f = []; + if (d || e) + if (null == c && (c = this.getDefaultParent()), null != c) + for (var g = this.model.getChildCount(c), h = 0; h < g; h++) { + var k = this.model.getChildAt(c, h), + l = this.view.getState(k); + this.isCellVisible(k) && null != l && (!d || l.x >= a) && (!e || l.y >= b) && f.push(k) + } + return f +}; +mxGraph.prototype.findTreeRoots = function(a, b, c) { + b = null != b ? b : !1; + c = null != c ? c : !1; + var d = []; + if (null != a) { + for (var e = this.getModel(), f = e.getChildCount(a), g = null, h = 0, k = 0; k < f; k++) { + var l = e.getChildAt(a, k); + if (this.model.isVertex(l) && this.isCellVisible(l)) { + for (var m = this.getConnections(l, b ? a : null), n = 0, p = 0, q = 0; q < m.length; q++) this.view.getVisibleTerminal(m[q], !0) == l ? n++ : p++; + (c && 0 == n && 0 < p || !c && 0 == p && 0 < n) && d.push(l); + m = c ? p - n : n - p; + m > h && (h = m, g = l) + } + } + 0 == d.length && null != g && d.push(g) + } + return d +}; +mxGraph.prototype.traverse = function(a, b, c, d, e) { + if (null != c && null != a) { + b = null != b ? b : !0; + e = e || []; + var f = mxCellPath.create(a); + if (null == e[f] && (e[f] = a, d = c(a, d), null == d || d)) + if (d = this.model.getEdgeCount(a), 0 < d) + for (f = 0; f < d; f++) { + var g = this.model.getEdgeAt(a, f), + h = this.model.getTerminal(g, !0) == a; + if (!b || h) h = this.model.getTerminal(g, !h), this.traverse(h, b, c, g, e) + } + } +}; +mxGraph.prototype.isCellSelected = function(a) { + return this.getSelectionModel().isSelected(a) +}; +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(a) { + this.getSelectionModel().setCell(a) +}; +mxGraph.prototype.setSelectionCells = function(a) { + this.getSelectionModel().setCells(a) +}; +mxGraph.prototype.addSelectionCell = function(a) { + this.getSelectionModel().addCell(a) +}; +mxGraph.prototype.addSelectionCells = function(a) { + this.getSelectionModel().addCells(a) +}; +mxGraph.prototype.removeSelectionCell = function(a) { + this.getSelectionModel().removeCell(a) +}; +mxGraph.prototype.removeSelectionCells = function(a) { + this.getSelectionModel().removeCells(a) +}; +mxGraph.prototype.selectRegion = function(a, b) { + var c = this.getCells(a.x, a.y, a.width, a.height); + this.selectCellsForEvent(c, b); + return c +}; +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(a, b, c) { + var d = this.selectionModel, + e = 0 < d.cells.length ? d.cells[0] : null; + 1 < d.cells.length && d.clear(); + var d = null != e ? this.model.getParent(e) : this.getDefaultParent(), + f = this.model.getChildCount(d); + null == e && 0 < f ? (a = this.model.getChildAt(d, 0), this.setSelectionCell(a)) : (null == e || b) && null != this.view.getState(d) && null != this.model.getGeometry(d) ? this.getCurrentRoot() != + d && this.setSelectionCell(d) : null != e && c ? 0 < this.model.getChildCount(e) && (a = this.model.getChildAt(e, 0), this.setSelectionCell(a)) : + 0 < f && (b = d.getIndex(e), a ? (b++, a = this.model.getChildAt(d, b % f)) : (b--, a = this.model.getChildAt(d, 0 > b ? f - 1 : b)), this.setSelectionCell(a)) +}; +mxGraph.prototype.selectAll = function(a) { + a = a || this.getDefaultParent(); + a = this.model.getChildren(a); + null != a && this.setSelectionCells(a) +}; +mxGraph.prototype.selectVertices = function(a) { + this.selectCells(!0, !1, a) +}; +mxGraph.prototype.selectEdges = function(a) { + this.selectCells(!1, !0, a) +}; +mxGraph.prototype.selectCells = function(a, b, c) { + c = c || this.getDefaultParent(); + var d = mxUtils.bind(this, function(c) { + return null != this.view.getState(c) && 0 == this.model.getChildCount(c) && (this.model.isVertex(c) && a || this.model.isEdge(c) && b) + }); + c = this.model.filterDescendants(d, c); + this.setSelectionCells(c) +}; +mxGraph.prototype.selectCellForEvent = function(a, b) { + var c = this.isCellSelected(a); + this.isToggleEvent(b) ? c ? this.removeSelectionCell(a) : this.addSelectionCell(a) : (!c || 1 != this.getSelectionCount()) && this.setSelectionCell(a) +}; +mxGraph.prototype.selectCellsForEvent = function(a, b) { + this.isToggleEvent(b) ? this.addSelectionCells(a) : this.setSelectionCells(a) +}; +mxGraph.prototype.createHandler = function(a) { + var b = null; + null != a && (this.model.isEdge(a.cell) ? (b = this.view.getEdgeStyle(a), b = this.isLoop(a) || b == mxEdgeStyle.ElbowConnector || b == mxEdgeStyle.SideToSide || b == mxEdgeStyle.TopToBottom ? + new mxElbowEdgeHandler(a) : b == mxEdgeStyle.SegmentConnector || b == mxEdgeStyle.OrthConnector ? new mxEdgeSegmentHandler(a) : new mxEdgeHandler(a)) : b = new mxVertexHandler(a)); + return b +}; +mxGraph.prototype.addMouseListener = function(a) { + null == this.mouseListeners && (this.mouseListeners = []); + this.mouseListeners.push(a) +}; +mxGraph.prototype.removeMouseListener = function(a) { + if (null != this.mouseListeners) + for (var b = 0; b < this.mouseListeners.length; b++) + if (this.mouseListeners[b] == a) { + this.mouseListeners.splice(b, 1); + break + } +}; +mxGraph.prototype.updateMouseEvent = function(a) { + if (null == a.graphX || null == a.graphY) { + var b = mxUtils.convertPoint(this.container, a.getX(), a.getY()); + a.graphX = b.x - this.panDx; + a.graphY = b.y - this.panDy + } +}; +mxGraph.prototype.fireMouseEvent = function(a, b, c) { + null == c && (c = this); + this.updateMouseEvent(b); + a == mxEvent.MOUSE_DOWN && (this.isMouseDown = !0); + if (mxClient.IS_TOUCH && this.doubleTapEnabled && a == mxEvent.MOUSE_DOWN) { + var d = (new Date).getTime(); + d - this.lastTouchTime < this.doubleTapTimeout && Math.abs(this.lastTouchX - b.getX()) < this.doubleTapTolerance && Math.abs(this.lastTouchY - b.getY()) < this.doubleTapTolerance ? (this.lastTouchTime = + 0, this.dblClick(b.getEvent(), b.getCell()), b.getEvent().cancelBubble = !0) : (this.lastTouchX = + b.getX(), this.lastTouchY = b.getY(), this.lastTouchTime = d) + } + d = 2 != b.getEvent().detail; + if (mxClient.IS_IE && "CSS1Compat" == document.compatMode) { + if (null != this.lastMouseX && Math.abs(this.lastMouseX - b.getX()) > this.doubleTapTolerance || null != this.lastMouseY && Math.abs(this.lastMouseY - b.getY()) > this.doubleTapTolerance) d = ! + 0; + a == mxEvent.MOUSE_UP && (this.lastMouseX = b.getX(), this.lastMouseY = b.getY()) + } + if ((a != mxEvent.MOUSE_UP || this.isMouseDown) && d) { + if (a == mxEvent.MOUSE_UP && (this.isMouseDown = !1), !this.isEditing() && (mxClient.IS_OP || + mxClient.IS_SF || mxClient.IS_GC || mxClient.IS_IE && mxClient.IS_SVG || b.getEvent().target != this.container)) { + a == mxEvent.MOUSE_MOVE && (this.isMouseDown && this.autoScroll) && this.scrollPointToVisible(b.getGraphX(), b.getGraphY(), this.autoExtend); + if (null != this.mouseListeners) { + c = [c, b]; + b.getEvent().returnValue = !0; + for (d = 0; d < this.mouseListeners.length; d++) { + var e = this.mouseListeners[d]; + a == mxEvent.MOUSE_DOWN ? e.mouseDown.apply(e, c) : a == mxEvent.MOUSE_MOVE ? e.mouseMove.apply(e, c) : a == mxEvent.MOUSE_UP && e.mouseUp.apply(e, c) + } + } + a == + mxEvent.MOUSE_UP && this.click(b) + } + } else a == 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) +}; + +function mxCellOverlay(a, b, c, d, e, f) { + this.image = a; + this.tooltip = b; + this.align = null != c ? c : this.align; + this.verticalAlign = null != d ? d : this.verticalAlign; + this.offset = null != e ? e : new mxPoint; + this.cursor = null != f ? f : "help" +} +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 = 0.5; +mxCellOverlay.prototype.getBounds = function(a) { + var b = a.view.graph.getModel().isEdge(a.cell), + c = a.view.scale, + d = null, + e = this.image.width, + f = this.image.height; + b ? (b = a.absolutePoints, 1 == b.length % 2 ? d = b[Math.floor(b.length / 2)] : (d = b.length / 2, a = b[d - 1], b = b[d], d = new mxPoint(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2))) : (d = + new mxPoint, d.x = this.align == mxConstants.ALIGN_LEFT ? a.x : this.align == mxConstants.ALIGN_CENTER ? a.x + a.width / 2 : a.x + a.width, d.y = this.verticalAlign == mxConstants.ALIGN_TOP ? + a.y : this.verticalAlign == mxConstants.ALIGN_MIDDLE ? + a.y + a.height / 2 : a.y + a.height); + return new mxRectangle(Math.round(d.x - (e * this.defaultOverlap - this.offset.x) * c), Math.round(d.y - (f * this.defaultOverlap - this.offset.y) * c), e * c, f * c) +}; +mxCellOverlay.prototype.toString = function() { + return this.tooltip +}; + +function mxOutline(a, b) { + this.source = a; + null != b && this.init(b) +} +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(a) { + this.outline = new mxGraph(a, this.source.getModel(), this.graphRenderHint, this.source.getStylesheet()); + this.outline.foldingEnabled = !1; + this.outline.autoScroll = !1; + var b = this.outline.graphModelChanged; + this.outline.graphModelChanged = mxUtils.bind(this, function(a) { + !this.suspended && null != this.outline && b.apply(this.outline, arguments) + }); + mxClient.IS_SVG && (a = this.outline.getView().getCanvas().parentNode, a.setAttribute("shape-rendering", "optimizeSpeed"), a.setAttribute("image-rendering", + "optimizeSpeed")); + this.outline.labelsVisible = !1; + this.outline.setEnabled(!1); + this.updateHandler = mxUtils.bind(this, function(a, b) { + !this.suspended && !this.active && this.update() + }); + this.source.getModel().addListener(mxEvent.CHANGE, this.updateHandler); + this.outline.addMouseListener(this); + a = this.source.getView(); + a.addListener(mxEvent.SCALE, this.updateHandler); + a.addListener(mxEvent.TRANSLATE, this.updateHandler); + a.addListener(mxEvent.SCALE_AND_TRANSLATE, this.updateHandler); + a.addListener(mxEvent.DOWN, this.updateHandler); + a.addListener(mxEvent.UP, this.updateHandler); + mxEvent.addListener(this.source.container, "scroll", this.updateHandler); + this.panHandler = mxUtils.bind(this, function(a) { + this.updateOnPan && this.updateHandler.apply(this, arguments) + }); + this.source.addListener(mxEvent.PAN, this.panHandler); + this.refreshHandler = mxUtils.bind(this, function(a) { + 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(a) { + this.outline.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(a)) + })); + 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(a) { + this.enabled = a +}; +mxOutline.prototype.setZoomEnabled = function(a) { + this.sizer.node.style.visibility = a ? "visible" : "hidden" +}; +mxOutline.prototype.refresh = function() { + this.update(!0) +}; +mxOutline.prototype.createSizer = function() { + var a = 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); + a.dialect = this.outline.dialect; + return a +}; +mxOutline.prototype.getSourceContainerSize = function() { + return new mxRectangle(0, 0, this.source.container.scrollWidth, this.source.container.scrollHeight) +}; +mxOutline.prototype.getOutlineOffset = function(a) { + return null +}; +mxOutline.prototype.update = function(a) { + if (null != this.source) { + var b = this.source.view.scale, + c = this.source.getGraphBounds(), + c = new mxRectangle(c.x / b + this.source.panDx, c.y / b + this.source.panDy, c.width / b, c.height / b), + d = new mxRectangle(0, 0, this.source.container.clientWidth / b, this.source.container.clientHeight / b), + e = c.clone(); + e.add(d); + var f = this.getSourceContainerSize(), + d = Math.max(f.width / b, e.width), + b = Math.max(f.height / b, e.height), + e = Math.max(0, this.outline.container.clientWidth - this.border), + f = Math.max(0, this.outline.container.clientHeight - + this.border), + e = Math.min(e / d, f / b); + if (0 < e) { + this.outline.getView().scale != e && (this.outline.getView().scale = e, a = !0); + d = this.outline.getView(); + d.currentRoot != this.source.getView().currentRoot && d.setCurrentRoot(this.source.getView().currentRoot); + var b = this.source.view.translate, + f = b.x + this.source.panDx, + g = b.y + this.source.panDy, + e = this.getOutlineOffset(e); + null != e && (f += e.x, g += e.y); + 0 > c.x && (f -= c.x); + 0 > c.y && (g -= c.y); + if (d.translate.x != f || d.translate.y != g) d.translate.x = f, d.translate.y = g, a = !0; + var c = d.translate, + e = this.source.getView().scale, + f = e / d.scale, + g = 1 / d.scale, + h = this.source.container; + this.bounds = new mxRectangle((c.x - b.x - this.source.panDx) / g, (c.y - b.y - this.source.panDy) / g, h.clientWidth / f, h.clientHeight / f); + this.bounds.x += this.source.container.scrollLeft * d.scale / e; + this.bounds.y += this.source.container.scrollTop * d.scale / e; + c = this.selectionBorder.bounds; + if (c.x != this.bounds.x || c.y != this.bounds.y || c.width != this.bounds.width || c.height != this.bounds.height) this.selectionBorder.bounds = this.bounds, this.selectionBorder.redraw(); + c = this.sizer.bounds; + d = new mxRectangle(this.bounds.x + this.bounds.width - c.width / 2, this.bounds.y + this.bounds.height - c.height / 2, c.width, c.height); + if (c.x != d.x || c.y != d.y || c.width != d.width || c.height != d.height) this.sizer.bounds = d, "hidden" != this.sizer.node.style.visibility && this.sizer.redraw(); + a && this.outline.view.revalidate() + } + } +}; +mxOutline.prototype.mouseDown = function(a, b) { + this.enabled && this.showViewport && (this.zoom = b.isSource(this.sizer), this.startX = b.getX(), this.startY = b.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); + b.consume() +}; +mxOutline.prototype.mouseMove = function(a, b) { + if (this.active) { + this.selectionBorder.node.style.display = this.showViewport ? "" : "none"; + this.sizer.node.style.display = this.selectionBorder.node.style.display; + var c = b.getX() - this.startX, + d = b.getY() - this.startY, + e = null; + if (this.zoom) e = this.source.container, d = c / (e.clientWidth / e.clientHeight), e = new mxRectangle(this.bounds.x, this.bounds.y, Math.max(1, this.bounds.width + c), Math.max(1, this.bounds + .height + d)), this.selectionBorder.bounds = e, this.selectionBorder.redraw(); + else { + var f = + this.outline.getView().scale, + e = new mxRectangle(this.bounds.x + c, this.bounds.y + d, this.bounds.width, this.bounds.height); + this.selectionBorder.bounds = e; + this.selectionBorder.redraw(); + c = c / f * this.source.getView().scale; + d = d / f * this.source.getView().scale; + this.source.panGraph(-c - this.dx0, -d - this.dy0) + } + c = this.sizer.bounds; + this.sizer.bounds = new mxRectangle(e.x + e.width - c.width / 2, e.y + e.height - c.height / 2, c.width, c.height); + "hidden" != this.sizer.node.style.visibility && this.sizer.redraw(); + b.consume() + } +}; +mxOutline.prototype.mouseUp = function(a, b) { + if (this.active) { + var c = b.getX() - this.startX, + d = b.getY() - this.startY; + if (0 < Math.abs(c) || 0 < Math.abs(d)) { + if (this.zoom) { + var d = this.selectionBorder.bounds.width, + e = this.source.getView().scale; + this.source.zoomTo(e - c * e / d, !1) + } else if (!this.source.useScrollbarsForPanning || !mxUtils.hasScrollbars(this.source.container)) this.source.panGraph(0, 0), c /= this.outline.getView().scale, d /= this.outline.getView().scale, + e = this.source.getView().translate, this.source.getView().setTranslate(e.x - + c, e.y - d); + this.update(); + b.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) +}; + +function mxMultiplicity(a, b, c, d, e, f, g, h, k, l) { + this.source = a; + this.type = b; + this.attr = c; + this.value = d; + this.min = null != e ? e : 0; + this.max = null != f ? f : "n"; + this.validNeighbors = g; + this.countError = mxResources.get(h) || h; + this.typeError = mxResources.get(k) || k; + this.validNeighborsAllowed = null != l ? l : !0 +} +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(a, b, c, d, e, f) { + var g = ""; + if (this.source && this.checkTerminal(a, c, b) || !this.source && this.checkTerminal(a, d, b)) { + if (null != this.countError && (this.source && (0 == this.max || e >= this.max) || !this.source && (0 == this.max || f >= this.max))) g += this.countError + "\n"; + null != this.validNeighbors && (null != this.typeError && 0 < this.validNeighbors.length) && (this.checkNeighbors(a, b, c, d) || (g += this.typeError + "\n")) + } + return 0 < g.length ? g : null +}; +mxMultiplicity.prototype.checkNeighbors = function(a, b, c, d) { + b = a.model.getValue(c); + d = a.model.getValue(d); + c = !this.validNeighborsAllowed; + for (var e = this.validNeighbors, f = 0; f < e.length; f++) + if (this.source && this.checkType(a, d, e[f])) { + c = this.validNeighborsAllowed; + break + } else if (!this.source && this.checkType(a, b, e[f])) { + c = this.validNeighborsAllowed; + break + } + return c +}; +mxMultiplicity.prototype.checkTerminal = function(a, b, c) { + b = a.model.getValue(b); + return this.checkType(a, b, this.type, this.attr, this.value) +}; +mxMultiplicity.prototype.checkType = function(a, b, c, d, e) { + return null != b ? isNaN(b.nodeType) ? b == c : mxUtils.isNode(b, c, d, e) : !1 +}; + +function mxLayoutManager(a) { + this.undoHandler = mxUtils.bind(this, function(a, c) { + this.isEnabled() && this.beforeUndo(c.getProperty("edit")) + }); + this.moveHandler = mxUtils.bind(this, function(a, c) { + this.isEnabled() && this.cellsMoved(c.getProperty("cells"), c.getProperty("event")) + }); + this.setGraph(a) +} +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(a) { + this.enabled = a +}; +mxLayoutManager.prototype.isBubbling = function() { + return this.bubbling +}; +mxLayoutManager.prototype.setBubbling = function(a) { + this.bubbling = a +}; +mxLayoutManager.prototype.getGraph = function() { + return this.graph +}; +mxLayoutManager.prototype.setGraph = function(a) { + if (null != this.graph) { + var b = this.graph.getModel(); + b.removeListener(this.undoHandler); + this.graph.removeListener(this.moveHandler) + } + this.graph = a; + null != this.graph && (b = this.graph.getModel(), b.addListener(mxEvent.BEFORE_UNDO, this.undoHandler), this.graph.addListener(mxEvent.MOVE_CELLS, this.moveHandler)) +}; +mxLayoutManager.prototype.getLayout = function(a) { + return null +}; +mxLayoutManager.prototype.beforeUndo = function(a) { + a = this.getCellsForChanges(a.changes); + var b = this.getGraph().getModel(); + if (this.isBubbling()) + for (var c = b.getParents(a); 0 < c.length;) a = a.concat(c), c = b.getParents(c); + this.layoutCells(mxUtils.sortCells(a, !1)) +}; +mxLayoutManager.prototype.cellsMoved = function(a, b) { + if (null != a && null != b) + for (var c = mxUtils.convertPoint(this.getGraph().container, mxEvent.getClientX(b), mxEvent.getClientY(b)), d = this.getGraph().getModel(), e = 0; e < a.length; e++) { + var f = this.getLayout(d.getParent(a[e])); + null != f && f.moveCell(a[e], c.x, c.y) + } +}; +mxLayoutManager.prototype.getCellsForChanges = function(a) { + for (var b = [], c = {}, d = 0; d < a.length; d++) { + var e = a[d]; + if (e instanceof mxRootChange) return []; + for (var e = this.getCellsForChange(e), f = 0; f < e.length; f++) + if (null != e[f]) { + var g = mxCellPath.create(e[f]); + null == c[g] && (c[g] = e[f], b.push(e[f])) + } + } + return b +}; +mxLayoutManager.prototype.getCellsForChange = function(a) { + var b = this.getGraph().getModel(); + return a instanceof mxChildChange ? [a.child, a.previous, b.getParent(a.child)] : a instanceof mxTerminalChange || a instanceof mxGeometryChange ? [a.cell, b.getParent(a.cell)] : [] +}; +mxLayoutManager.prototype.layoutCells = function(a) { + if (0 < a.length) { + var b = this.getGraph().getModel(); + b.beginUpdate(); + try { + for (var c = null, d = 0; d < a.length; d++) a[d] != b.getRoot() && a[d] != c && (c = a[d], this.executeLayout(this.getLayout(c), c)); + this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS, "cells", a)) + } finally { + b.endUpdate() + } + } +}; +mxLayoutManager.prototype.executeLayout = function(a, b) { + null != a && null != b && a.execute(b) +}; +mxLayoutManager.prototype.destroy = function() { + this.setGraph(null) +}; + +function mxSpaceManager(a, b, c, d) { + this.resizeHandler = mxUtils.bind(this, function(a, b) { + this.isEnabled() && this.cellsResized(b.getProperty("cells")) + }); + this.foldHandler = mxUtils.bind(this, function(a, b) { + this.isEnabled() && this.cellsResized(b.getProperty("cells")) + }); + this.shiftRightwards = null != b ? b : !0; + this.shiftDownwards = null != c ? c : !0; + this.extendParents = null != d ? d : !0; + this.setGraph(a) +} +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(a) { + return !this.getGraph().getModel().isVertex(a) +}; +mxSpaceManager.prototype.isCellShiftable = function(a) { + return this.getGraph().getModel().isVertex(a) && this.getGraph().isCellMovable(a) +}; +mxSpaceManager.prototype.isEnabled = function() { + return this.enabled +}; +mxSpaceManager.prototype.setEnabled = function(a) { + this.enabled = a +}; +mxSpaceManager.prototype.isShiftRightwards = function() { + return this.shiftRightwards +}; +mxSpaceManager.prototype.setShiftRightwards = function(a) { + this.shiftRightwards = a +}; +mxSpaceManager.prototype.isShiftDownwards = function() { + return this.shiftDownwards +}; +mxSpaceManager.prototype.setShiftDownwards = function(a) { + this.shiftDownwards = a +}; +mxSpaceManager.prototype.isExtendParents = function() { + return this.extendParents +}; +mxSpaceManager.prototype.setExtendParents = function(a) { + this.extendParents = a +}; +mxSpaceManager.prototype.getGraph = function() { + return this.graph +}; +mxSpaceManager.prototype.setGraph = function(a) { + null != this.graph && (this.graph.removeListener(this.resizeHandler), this.graph.removeListener(this.foldHandler)); + this.graph = a; + null != this.graph && (this.graph.addListener(mxEvent.RESIZE_CELLS, this.resizeHandler), this.graph.addListener(mxEvent.FOLD_CELLS, this.foldHandler)) +}; +mxSpaceManager.prototype.cellsResized = function(a) { + if (null != a) { + var b = this.graph.getModel(); + b.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) + if (!this.isCellIgnored(a[c])) { + this.cellResized(a[c]); + break + } + } finally { + b.endUpdate() + } + } +}; +mxSpaceManager.prototype.cellResized = function(a) { + var b = this.getGraph(), + c = b.getView(), + d = b.getModel(), + e = c.getState(a), + f = c.getState(d.getParent(a)); + if (null != e && null != f) { + var g = this.getCellsToShift(e), + h = d.getGeometry(a); + if (null != g && null != h) { + var k = c.translate, + l = c.scale, + c = e.x - f.origin.x - k.x * l, + f = e.y - f.origin.y - k.y * l, + k = e.x + e.width, + m = e.y + e.height, + n = e.width - h.width * l + c - h.x * l, + p = e.height - h.height * l + f - h.y * l, + q = 1 - h.width * l / e.width, + e = 1 - h.height * l / e.height; + d.beginUpdate(); + try { + for (h = 0; h < g.length; h++) g[h] != a && this.isCellShiftable(g[h]) && + this.shiftCell(g[h], n, p, c, f, k, m, q, e, this.isExtendParents() && b.isExtendParent(g[h])) + } finally { + d.endUpdate() + } + } + } +}; +mxSpaceManager.prototype.shiftCell = function(a, b, c, d, e, f, g, h, k, l) { + d = this.getGraph(); + var m = d.getView().getState(a); + if (null != m) { + var n = d.getModel(), + p = n.getGeometry(a); + if (null != p) { + n.beginUpdate(); + try { + if (this.isShiftRightwards()) + if (m.x >= f) p = p.clone(), p.translate(-b, 0); + else { + var q = Math.max(0, m.x - x0), + p = p.clone(); + p.translate(-h * q, 0) + } + if (this.isShiftDownwards()) + if (m.y >= g) p = p.clone(), p.translate(0, -c); + else { + var s = Math.max(0, m.y - e), + p = p.clone(); + p.translate(0, -k * s) + } + p != n.getGeometry(a) && (n.setGeometry(a, p), l && d.extendParent(a)) + } finally { + n.endUpdate() + } + } + } +}; +mxSpaceManager.prototype.getCellsToShift = function(a) { + var b = this.getGraph(), + c = b.getModel().getParent(a.cell), + d = this.isShiftDownwards(), + e = this.isShiftRightwards(); + return b.getCellsBeyond(a.x + (d ? 0 : a.width), a.y + (d && e ? 0 : a.height), c, e, d) +}; +mxSpaceManager.prototype.destroy = function() { + this.setGraph(null) +}; + +function mxSwimlaneManager(a, b, c, d) { + this.horizontal = null != b ? b : !0; + this.addEnabled = null != c ? c : !0; + this.resizeEnabled = null != d ? d : !0; + this.addHandler = mxUtils.bind(this, function(a, b) { + this.isEnabled() && this.isAddEnabled() && this.cellsAdded(b.getProperty("cells")) + }); + this.resizeHandler = mxUtils.bind(this, function(a, b) { + this.isEnabled() && this.isResizeEnabled() && this.cellsResized(b.getProperty("cells")) + }); + this.setGraph(a) +} +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(a) { + this.enabled = a +}; +mxSwimlaneManager.prototype.isHorizontal = function() { + return this.horizontal +}; +mxSwimlaneManager.prototype.setHorizontal = function(a) { + this.horizontal = a +}; +mxSwimlaneManager.prototype.isAddEnabled = function() { + return this.addEnabled +}; +mxSwimlaneManager.prototype.setAddEnabled = function(a) { + this.addEnabled = a +}; +mxSwimlaneManager.prototype.isResizeEnabled = function() { + return this.resizeEnabled +}; +mxSwimlaneManager.prototype.setResizeEnabled = function(a) { + this.resizeEnabled = a +}; +mxSwimlaneManager.prototype.getGraph = function() { + return this.graph +}; +mxSwimlaneManager.prototype.setGraph = function(a) { + null != this.graph && (this.graph.removeListener(this.addHandler), this.graph.removeListener(this.resizeHandler)); + this.graph = a; + null != this.graph && (this.graph.addListener(mxEvent.ADD_CELLS, this.addHandler), this.graph.addListener(mxEvent.CELLS_RESIZED, this.resizeHandler)) +}; +mxSwimlaneManager.prototype.isSwimlaneIgnored = function(a) { + return !this.getGraph().isSwimlane(a) +}; +mxSwimlaneManager.prototype.isCellHorizontal = function(a) { + if (this.graph.isSwimlane(a)) { + var b = this.graph.view.getState(a); + a = null != b ? b.style : this.graph.getCellStyle(a); + return 1 == mxUtils.getValue(a, mxConstants.STYLE_HORIZONTAL, 1) + } + return !this.isHorizontal() +}; +mxSwimlaneManager.prototype.cellsAdded = function(a) { + if (null != a) { + var b = this.getGraph().getModel(); + b.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) this.isSwimlaneIgnored(a[c]) || this.swimlaneAdded(a[c]) + } finally { + b.endUpdate() + } + } +}; +mxSwimlaneManager.prototype.swimlaneAdded = function(a) { + for (var b = this.getGraph().getModel(), c = b.getParent(a), d = b.getChildCount(c), e = null, f = 0; f < d; f++) { + var g = b.getChildAt(c, f); + if (g != a && !this.isSwimlaneIgnored(g) && (e = b.getGeometry(g), null != e)) break + } + null != e && this.resizeSwimlane(a, e.width, e.height) +}; +mxSwimlaneManager.prototype.cellsResized = function(a) { + if (null != a) { + var b = this.getGraph().getModel(); + b.beginUpdate(); + try { + for (var c = 0; c < a.length; c++) + if (!this.isSwimlaneIgnored(a[c])) { + var d = b.getGeometry(a[c]); + if (null != d) { + for (var e = new mxRectangle(0, 0, d.width, d.height), f = a[c], g = f; null != g;) { + var f = g, + g = b.getParent(g), + h = this.graph.isSwimlane(g) ? this.graph.getStartSize(g) : new mxRectangle; + e.width += h.width; + e.height += h.height + } + this.resizeSwimlane(f, e.width, e.height) + } + } + } finally { + b.endUpdate() + } + } +}; +mxSwimlaneManager.prototype.resizeSwimlane = function(a, b, c) { + var d = this.getGraph().getModel(); + d.beginUpdate(); + try { + if (!this.isSwimlaneIgnored(a)) { + var e = d.getGeometry(a); + if (null != e) { + var f = this.isCellHorizontal(a); + if (f && e.height != c || !f && e.width != b) e = e.clone(), f ? e.height = c : e.width = b, d.setGeometry(a, e) + } + } + var g = this.graph.isSwimlane(a) ? this.graph.getStartSize(a) : new mxRectangle; + b -= g.width; + c -= g.height; + for (var h = d.getChildCount(a), e = 0; e < h; e++) { + var k = d.getChildAt(a, e); + this.resizeSwimlane(k, b, c) + } + } finally { + d.endUpdate() + } +}; +mxSwimlaneManager.prototype.destroy = function() { + this.setGraph(null) +}; + +function mxTemporaryCellStates(a, b, c) { + this.view = a; + b = null != b ? b : 1; + this.oldBounds = a.getGraphBounds(); + this.oldStates = a.getStates(); + this.oldScale = a.getScale(); + a.setStates(new mxDictionary); + a.setScale(b); + if (null != c) { + b = a.createState(new mxCell); + for (var d = 0; d < c.length; d++) a.validateBounds(b, c[d]); + for (var e = null, d = 0; d < c.length; d++) { + var f = a.validatePoints(b, c[d]); + null == e ? e = f : e.add(f) + } + null == e && (e = new mxRectangle); + a.setGraphBounds(e) + } +} +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) +}; + +function mxCellStatePreview(a) { + this.graph = a; + this.deltas = {} +} +mxCellStatePreview.prototype.graph = null; +mxCellStatePreview.prototype.deltas = null; +mxCellStatePreview.prototype.count = 0; +mxCellStatePreview.prototype.isEmpty = function() { + return 0 == this.count +}; +mxCellStatePreview.prototype.moveState = function(a, b, c, d, e) { + d = null != d ? d : !0; + e = null != e ? e : !0; + var f = mxCellPath.create(a.cell), + g = this.deltas[f]; + null == g ? (g = new mxPoint(b, c), this.deltas[f] = g, this.count++) : d ? (g.X += b, g.Y += c) : (g.X = b, g.Y = c); + e && this.addEdges(a); + return g +}; +mxCellStatePreview.prototype.show = function(a) { + var b = this.graph.getModel(), + c = b.getRoot(), + d; + for (d in this.deltas) { + var e = mxCellPath.resolve(c, d), + f = this.graph.view.getState(e), + g = this.deltas[d], + e = this.graph.view.getState(b.getParent(e)); + this.translateState(e, f, g.x, g.y) + } + for (d in this.deltas) e = mxCellPath.resolve(c, d), f = this.graph.view.getState(e), g = this.deltas[d], e = this.graph.view.getState(b.getParent(e)), this.revalidateState(e, f, g.x, g.y, a) +}; +mxCellStatePreview.prototype.translateState = function(a, b, c, d) { + if (null != b) { + var e = this.graph.getModel(); + if (e.isVertex(b.cell)) { + b.invalid = !0; + this.graph.view.validateBounds(a, b.cell); + a = e.getGeometry(b.cell); + var f = mxCellPath.create(b.cell); + if ((0 != c || 0 != d) && null != a && (!a.relative || null != this.deltas[f])) b.x += c, b.y += d + } + a = e.getChildCount(b.cell); + for (f = 0; f < a; f++) this.translateState(b, this.graph.view.getState(e.getChildAt(b.cell, f)), c, d) + } +}; +mxCellStatePreview.prototype.revalidateState = function(a, b, c, d, e) { + if (null != b) { + b.invalid = !0; + this.graph.view.validatePoints(a, b.cell); + var f = mxCellPath.create(b.cell), + g = this.graph.getModel(), + h = this.graph.getCellGeometry(b.cell); + if ((0 != c || 0 != d) && null != h && h.relative && g.isVertex(b.cell) && (null == a || g.isVertex(a.cell) || null != this.deltas[f])) b.x += c, b.y += d, this.graph.cellRenderer.redraw(b); + null != e && e(b); + a = g.getChildCount(b.cell); + for (f = 0; f < a; f++) this.revalidateState(b, this.graph.view.getState(g.getChildAt(b.cell, + f)), c, d, e) + } +}; +mxCellStatePreview.prototype.addEdges = function(a) { + for (var b = this.graph.getModel(), c = b.getEdgeCount(a.cell), d = 0; d < c; d++) { + var e = this.graph.view.getState(b.getEdgeAt(a.cell, d)); + null != e && this.moveState(e, 0, 0) + } +}; + +function mxConnectionConstraint(a, b) { + this.point = a; + this.perimeter = null != b ? b : !0 +} +mxConnectionConstraint.prototype.point = null; +mxConnectionConstraint.prototype.perimeter = null; + +function mxGraphHandler(a) { + this.graph = a; + this.graph.addMouseListener(this); + this.panHandler = mxUtils.bind(this, function() { + this.updatePreviewShape() + }); + this.graph.addListener(mxEvent.PAN, this.panHandler) +} +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(a) { + this.enabled = a +}; +mxGraphHandler.prototype.isCloneEnabled = function() { + return this.cloneEnabled +}; +mxGraphHandler.prototype.setCloneEnabled = function(a) { + this.cloneEnabled = a +}; +mxGraphHandler.prototype.isMoveEnabled = function() { + return this.moveEnabled +}; +mxGraphHandler.prototype.setMoveEnabled = function(a) { + this.moveEnabled = a +}; +mxGraphHandler.prototype.isSelectEnabled = function() { + return this.selectEnabled +}; +mxGraphHandler.prototype.setSelectEnabled = function(a) { + this.selectEnabled = a +}; +mxGraphHandler.prototype.isRemoveCellsFromParent = function() { + return this.removeCellsFromParent +}; +mxGraphHandler.prototype.setRemoveCellsFromParent = function(a) { + this.removeCellsFromParent = a +}; +mxGraphHandler.prototype.getInitialCellForEvent = function(a) { + return a.getCell() +}; +mxGraphHandler.prototype.isDelayedSelection = function(a) { + return this.graph.isCellSelected(a) +}; +mxGraphHandler.prototype.mouseDown = function(a, b) { + if (!b.isConsumed() && this.isEnabled() && this.graph.isEnabled() && !this.graph.isForceMarqueeEvent(b.getEvent()) && null != b.getState()) { + var c = this.getInitialCellForEvent(b); + this.cell = null; + this.delayedSelection = this.isDelayedSelection(c); + this.isSelectEnabled() && !this.delayedSelection && this.graph.selectCellForEvent(c, b.getEvent()); + if (this.isMoveEnabled()) { + var d = this.graph.model, + e = d.getGeometry(c); + this.graph.isCellMovable(c) && (!d.isEdge(c) || 1 < this.graph.getSelectionCount() || + null != e.points && 0 < e.points.length || null == d.getTerminal(c, !0) || null == d.getTerminal(c, !1) || this.graph.allowDanglingEdges || this.graph.isCloneEvent(b.getEvent()) && this.graph + .isCellsCloneable()) && this.start(c, b.getX(), b.getY()); + this.cellWasClicked = !0; + !mxClient.IS_SF && !mxClient.IS_GC || "SELECT" != b.getSource().nodeName ? b.consume() : mxClient.IS_SF && "SELECT" == b.getSource().nodeName && (this.cellWasClicked = !1, this.first = null) + } + } +}; +mxGraphHandler.prototype.getGuideStates = function() { + var a = this.graph.getDefaultParent(), + b = this.graph.getModel(), + c = mxUtils.bind(this, function(a) { + return null != this.graph.view.getState(a) && b.isVertex(a) && null != b.getGeometry(a) && !b.getGeometry(a).relative + }); + return this.graph.view.getCellStates(b.filterDescendants(c, a)) +}; +mxGraphHandler.prototype.getCells = function(a) { + return !this.delayedSelection && this.graph.isCellMovable(a) ? [a] : this.graph.getMovableCells(this.graph.getSelectionCells()) +}; +mxGraphHandler.prototype.getPreviewBounds = function(a) { + a = this.getBoundingBox(a); + null != a && (a.grow(-1, -1), a.width < this.minimumSize && (a.x -= (this.minimumSize - a.width) / 2, a.width = this.minimumSize), a.height < this.minimumSize && (a.y -= (this.minimumSize - a.height) / + 2, a.height = this.minimumSize)); + return a +}; +mxGraphHandler.prototype.getBoundingBox = function(a) { + var b = null; + if (null != a && 0 < a.length) + for (var c = this.graph.getModel(), d = 0; d < a.length; d++) + if (c.isVertex(a[d]) || c.isEdge(a[d])) { + var e = this.graph.view.getState(a[d]); + if (null != e) { + var f = e; + c.isVertex(a[d]) && (null != e.shape && null != e.shape.boundingBox) && (f = e.shape.boundingBox); + null == b ? b = new mxRectangle(f.x, f.y, f.width, f.height) : b.add(f) + } + } + return b +}; +mxGraphHandler.prototype.createPreviewShape = function(a) { + a = new mxRectangleShape(a, null, this.previewColor); + a.isDashed = !0; + this.htmlPreview ? (a.dialect = mxConstants.DIALECT_STRICTHTML, a.init(this.graph.container)) : (a.dialect = this.graph.dialect != mxConstants.DIALECT_SVG ? mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG, + a.init(this.graph.getView().getOverlayPane()), a.pointerEvents = !1); + return a +}; +mxGraphHandler.prototype.start = function(a, b, c) { + this.cell = a; + this.first = mxUtils.convertPoint(this.graph.container, b, c); + 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(a) { + return null != this.guide ? this.guide.isEnabledForEvent(a.getEvent()) : !0 +}; +mxGraphHandler.prototype.snap = function(a) { + var b = this.scaleGrid ? this.graph.view.scale : 1; + a.x = this.graph.snap(a.x / b) * b; + a.y = this.graph.snap(a.y / b) * b; + return a +}; +mxGraphHandler.prototype.mouseMove = function(a, b) { + var c = this.graph; + if (!b.isConsumed() && c.isMouseDown && null != this.cell && null != this.first && null != this.bounds) { + var d = mxUtils.convertPoint(c.container, b.getX(), b.getY()), + e = d.x - this.first.x, + f = d.y - this.first.y, + d = c.tolerance; + if (null != this.shape || Math.abs(e) > d || Math.abs(f) > d) { + null == this.highlight && (this.highlight = new mxCellHighlight(this.graph, mxConstants.DROP_TARGET_COLOR, 3)); + null == this.shape && (this.shape = this.createPreviewShape(this.bounds)); + var g = c.isGridEnabledEvent(b.getEvent()), + d = !0; + if (null != this.guide && this.useGuidesForEvent(b)) f = this.guide.move(this.bounds, new mxPoint(e, f), g), d = !1, e = f.x, f = f.y; + else if (g) var h = c.getView().translate, + k = c.getView().scale, + g = this.bounds.x - (c.snap(this.bounds.x / k - h.x) + h.x) * k, + h = this.bounds.y - (c.snap(this.bounds.y / k - h.y) + h.y) * k, + f = this.snap(new mxPoint(e, f)), + e = f.x - g, + f = f.y - h; + null != this.guide && d && this.guide.hide(); + c.isConstrainedEvent(b.getEvent()) && (Math.abs(e) > Math.abs(f) ? f = 0 : e = 0); + this.currentDx = e; + this.currentDy = f; + this.updatePreviewShape(); + d = null; + f = b.getCell(); + c.isDropEnabled() && this.highlightEnabled && (d = c.getDropTarget(this.cells, b.getEvent(), f)); + g = d; + for (h = c.getModel(); null != g && g != this.cells[0];) g = h.getParent(g); + var k = c.isCloneEvent(b.getEvent()) && c.isCellsCloneable() && this.isCloneEnabled(), + e = c.getView().getState(d), + l = !1; + null != e && null == g && (h.getParent(this.cell) != d || k) ? (this.target != d && (this.target = d, this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)), l = !0) : (this.target = null, + this.connectOnDrop && (null != f && 1 == this.cells.length && c.getModel().isVertex(f) && + c.isCellConnectable(f)) && (e = c.getView().getState(f), null != e && (c = null == c.getEdgeValidationError(null, this.cell, f) ? mxConstants.VALID_COLOR : mxConstants.INVALID_CONNECT_TARGET_COLOR, + this.setHighlightColor(c), l = !0))); + null != e && l ? this.highlight.highlight(e) : this.highlight.hide() + } + b.consume(); + mxEvent.consume(b.getEvent()) + } else if ((this.isMoveEnabled() || this.isCloneEnabled()) && this.updateCursor && !b.isConsumed() && null != b.getState() && !c.isMouseDown) e = c.getCursorForCell(b.getCell()), null == e && (c.isEnabled() && + c.isCellMovable(b.getCell())) && + (e = c.getModel().isEdge(b.getCell()) ? mxConstants.CURSOR_MOVABLE_EDGE : mxConstants.CURSOR_MOVABLE_VERTEX), b.getState().setCursor(e), b.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(a) { + null != this.highlight && this.highlight.setHighlightColor(a) +}; +mxGraphHandler.prototype.mouseUp = function(a, b) { + if (!b.isConsumed()) { + var c = this.graph; + if (null != this.cell && null != this.first && null != this.shape && null != this.currentDx && null != this.currentDy) { + var d = c.getView().scale, + e = c.isCloneEvent(b.getEvent()) && c.isCellsCloneable() && this.isCloneEnabled(), + f = this.currentDx / d, + d = this.currentDy / d, + g = b.getCell(); + this.connectOnDrop && null == this.target && null != g && c.getModel().isVertex(g) && c.isCellConnectable(g) && c.isEdgeValid(null, this.cell, g) ? c.connectionHandler.connect(this.cell, + g, b.getEvent()) : (g = this.target, c.isSplitEnabled() && c.isSplitTarget(g, this.cells, b.getEvent()) ? c.splitEdge(g, this.cells, null, f, d) : this.moveCells(this.cells, f, d, e, this + .target, b.getEvent())) + } else this.isSelectEnabled() && (this.delayedSelection && null != this.cell) && this.selectDelayed(b) + } + this.cellWasClicked && b.consume(); + this.reset() +}; +mxGraphHandler.prototype.selectDelayed = function(a) { + this.graph.selectCellForEvent(this.cell, a.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(a, b, c) { + if (this.graph.getModel().isVertex(a)) { + a = this.graph.getView().getState(a); + c = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(c), mxEvent.getClientY(c)); + var d = mxUtils.toRadians(mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION) || 0); + if (0 != d) { + b = Math.cos(-d); + var d = Math.sin(-d), + e = new mxPoint(a.getCenterX(), a.getCenterY()); + c = mxUtils.getRotatedPoint(c, b, d, e) + } + return null != a && !mxUtils.contains(a, c.x, c.y) + } + return !1 +}; +mxGraphHandler.prototype.moveCells = function(a, b, c, d, e, f) { + d && (a = this.graph.getCloneableCells(a)); + null == e && (this.isRemoveCellsFromParent() && this.shouldRemoveCellsFromParent(this.graph.getModel().getParent(this.cell), a, f)) && (e = this.graph.getDefaultParent()); + a = this.graph.moveCells(a, b - this.graph.panDx / this.graph.view.scale, c - this.graph.panDy / this.graph.view.scale, d, e, f); + this.isSelectEnabled() && this.scrollOnMove && this.graph.scrollCellToVisible(a[0]); + d && this.graph.setSelectionCells(a) +}; +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() +}; + +function mxPanningHandler(a, b) { + null != a && (this.graph = a, this.factoryMethod = b, this.graph.addMouseListener(this), this.init()) +} +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(a) { + this.panningEnabled = a +}; +mxPanningHandler.prototype.init = function() { + mxPopupMenu.prototype.init.apply(this); + mxEvent.addListener(this.div, mxClient.IS_TOUCH ? "touchmove" : "mousemove", mxUtils.bind(this, function(a) { + this.graph.tooltipHandler.hide() + })) +}; +mxPanningHandler.prototype.isPanningTrigger = function(a) { + var b = a.getEvent(); + return this.useLeftButtonForPanning && (this.ignoreCell || null == a.getState()) && mxEvent.isLeftMouseButton(b) || mxEvent.isControlDown(b) && mxEvent.isShiftDown(b) || this.usePopupTrigger && + mxEvent.isPopupTrigger(b) +}; +mxPanningHandler.prototype.mouseDown = function(a, b) { + if (!b.isConsumed() && this.isEnabled()) { + this.hideMenu(); + this.dx0 = -this.graph.container.scrollLeft; + this.dy0 = -this.graph.container.scrollTop; + var c = mxUtils.convertPoint(this.graph.container, b.getX(), b.getY()); + this.triggerX = c.x; + this.triggerY = c.y; + this.popupTrigger = this.isPopupTrigger(b); + this.panningTrigger = this.isPanningEnabled() && this.isPanningTrigger(b); + this.startX = b.getX(); + this.startY = b.getY(); + this.panningTrigger && this.consumePanningTrigger(b) + } +}; +mxPanningHandler.prototype.consumePanningTrigger = function(a) { + a.consume() +}; +mxPanningHandler.prototype.mouseMove = function(a, b) { + var c = b.getX() - this.startX, + d = b.getY() - this.startY; + if (this.active) this.previewEnabled && (this.useGrid && (c = this.graph.snap(c), d = this.graph.snap(d)), this.graph.panGraph(c + this.dx0, d + this.dy0)), this.fireEvent(new mxEventObject( + mxEvent.PAN, "event", b)), b.consume(); + else if (this.panningTrigger) { + var e = this.active; + this.active = Math.abs(c) > this.graph.tolerance || Math.abs(d) > this.graph.tolerance; + !e && this.active && this.fireEvent(new mxEventObject(mxEvent.PAN_START, + "event", b)) + } +}; +mxPanningHandler.prototype.mouseUp = function(a, b) { + var c = Math.abs(b.getX() - this.startX), + d = Math.abs(b.getY() - this.startY); + if (this.active) { + if (!this.graph.useScrollbarsForPanning || !mxUtils.hasScrollbars(this.graph.container)) { + c = b.getX() - this.startX; + d = b.getY() - this.startY; + this.useGrid && (c = this.graph.snap(c), d = this.graph.snap(d)); + var e = this.graph.getView().scale, + f = this.graph.getView().translate; + this.graph.panGraph(0, 0); + this.panGraph(f.x + c / e, f.y + d / e) + } + this.active = !1; + this.fireEvent(new mxEventObject(mxEvent.PAN_END, "event", + b)); + b.consume() + } else this.popupTrigger && (c < this.graph.tolerance && d < this.graph.tolerance) && (c = this.getCellForPopupEvent(b), this.graph.isEnabled() && this.selectOnPopup && null != c && !this.graph.isCellSelected( + c) ? this.graph.setSelectionCell(c) : this.clearSelectionOnBackground && null == c && this.graph.clearSelection(), this.graph.tooltipHandler.hide(), d = mxUtils.getScrollOrigin(), d = new mxPoint( + b.getX() + d.x, b.getY() + d.y), this.popup(d.x + 1, d.y + 1, c, b.getEvent()), b.consume()); + this.popupTrigger = this.panningTrigger = !1 +}; +mxPanningHandler.prototype.getCellForPopupEvent = function(a) { + return a.getCell() +}; +mxPanningHandler.prototype.panGraph = function(a, b) { + this.graph.getView().setTranslate(a, b) +}; +mxPanningHandler.prototype.destroy = function() { + this.graph.removeMouseListener(this); + mxPopupMenu.prototype.destroy.apply(this) +}; + +function mxCellMarker(a, b, c, d) { + mxEventSource.call(this); + null != a && (this.graph = a, this.validColor = null != b ? b : mxConstants.DEFAULT_VALID_COLOR, this.invalidColor = null != b ? c : mxConstants.DEFAULT_INVALID_COLOR, this.hotspot = null != d ? d : + mxConstants.DEFAULT_HOTSPOT, this.highlight = new mxCellHighlight(a)) +} +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(a) { + this.enabled = a +}; +mxCellMarker.prototype.isEnabled = function() { + return this.enabled +}; +mxCellMarker.prototype.setHotspot = function(a) { + this.hotspot = a +}; +mxCellMarker.prototype.getHotspot = function() { + return this.hotspot +}; +mxCellMarker.prototype.setHotspotEnabled = function(a) { + this.hotspotEnabled = a +}; +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; + null != this.markedState && (this.markedState = null, this.unmark()) +}; +mxCellMarker.prototype.process = function(a) { + var b = null; + if (this.isEnabled()) { + var b = this.getState(a), + c = null != b ? this.isValidState(b) : !1; + a = this.getMarkerColor(a.getEvent(), b, c); + this.validState = c ? b : null; + if (b != this.markedState || a != this.currentColor) this.currentColor = a, null != b && null != this.currentColor ? (this.markedState = b, this.mark()) : null != this.markedState && (this.markedState = + null, this.unmark()) + } + return b +}; +mxCellMarker.prototype.markCell = function(a, b) { + var c = this.graph.getView().getState(a); + null != c && (this.currentColor = null != b ? b : this.validColor, this.markedState = c, 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(a) { + return !0 +}; +mxCellMarker.prototype.getMarkerColor = function(a, b, c) { + return c ? this.validColor : this.invalidColor +}; +mxCellMarker.prototype.getState = function(a) { + var b = this.graph.getView(); + cell = this.getCell(a); + b = this.getStateToMark(b.getState(cell)); + return null != b && this.intersects(b, a) ? b : null +}; +mxCellMarker.prototype.getCell = function(a) { + return a.getCell() +}; +mxCellMarker.prototype.getStateToMark = function(a) { + return a +}; +mxCellMarker.prototype.intersects = function(a, b) { + return this.hotspotEnabled ? mxUtils.intersectsHotspot(a, b.getGraphX(), b.getGraphY(), this.hotspot, mxConstants.MIN_HOTSPOT_SIZE, mxConstants.MAX_HOTSPOT_SIZE) : !0 +}; +mxCellMarker.prototype.destroy = function() { + this.graph.getView().removeListener(this.resetHandler); + this.graph.getModel().removeListener(this.resetHandler); + this.highlight.destroy() +}; + +function mxSelectionCellsHandler(a) { + mxEventSource.call(this); + this.graph = a; + this.handlers = new mxDictionary; + this.graph.addMouseListener(this); + this.refreshHandler = mxUtils.bind(this, function(a, c) { + 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) +} +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(a) { + this.enabled = a +}; +mxSelectionCellsHandler.prototype.getHandler = function(a) { + return this.handlers.get(a) +}; +mxSelectionCellsHandler.prototype.reset = function() { + this.handlers.visit(function(a, b) { + b.reset.apply(b) + }) +}; +mxSelectionCellsHandler.prototype.refresh = function() { + var a = this.handlers; + this.handlers = new mxDictionary; + for (var b = this.graph.getSelectionCells(), c = 0; c < b.length; c++) { + var d = this.graph.view.getState(b[c]); + if (null != d) { + var e = a.remove(b[c]); + null != e && (e.state != d ? (e.destroy(), e = null) : e.redraw()); + null == e && (e = this.graph.createHandler(d), this.fireEvent(new mxEventObject(mxEvent.ADD, "state", d))); + null != e && this.handlers.put(b[c], e) + } + } + a.visit(mxUtils.bind(this, function(a, b) { + this.fireEvent(new mxEventObject(mxEvent.REMOVE, + "state", b.state)); + b.destroy() + })) +}; +mxSelectionCellsHandler.prototype.mouseDown = function(a, b) { + if (this.graph.isEnabled() && this.isEnabled()) { + var c = [a, b]; + this.handlers.visit(function(a, b) { + b.mouseDown.apply(b, c) + }) + } +}; +mxSelectionCellsHandler.prototype.mouseMove = function(a, b) { + if (this.graph.isEnabled() && this.isEnabled()) { + var c = [a, b]; + this.handlers.visit(function(a, b) { + b.mouseMove.apply(b, c) + }) + } +}; +mxSelectionCellsHandler.prototype.mouseUp = function(a, b) { + if (this.graph.isEnabled() && this.isEnabled()) { + var c = [a, b]; + this.handlers.visit(function(a, b) { + b.mouseUp.apply(b, c) + }) + } +}; +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) +}; + +function mxConnectionHandler(a, b) { + mxEventSource.call(this); + null != a && (this.graph = a, this.factoryMethod = b, this.init()) +} +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(a) { + this.enabled = a +}; +mxConnectionHandler.prototype.isCreateTarget = function() { + return this.createTarget +}; +mxConnectionHandler.prototype.setCreateTarget = function(a) { + this.createTarget = a +}; +mxConnectionHandler.prototype.createShape = function() { + var a = new mxPolyline([], mxConstants.INVALID_COLOR); + a.dialect = this.graph.dialect != mxConstants.DIALECT_SVG ? mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; + a.init(this.graph.getView().getOverlayPane()); + a.svgStrokeTolerance = 0; + a.pointerEvents = !1; + a.isDashed = !0; + if (this.graph.dialect == mxConstants.DIALECT_SVG) a.node.setAttribute("pointer-events", "none"); + else { + var b = mxUtils.bind(this, function(a) { + a = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(a), + mxEvent.getClientY(a)); + return this.graph.view.getState(this.graph.getCellAt(a.x, a.y)) + }); + mxEvent.redirectMouseEvents(a.node, this.graph, b) + } + return a +}; +mxConnectionHandler.prototype.init = function() { + this.graph.addMouseListener(this); + this.marker = this.createMarker(); + this.constraintHandler = new mxConstraintHandler(this.graph); + this.changeHandler = mxUtils.bind(this, function(a) { + 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(a) { + 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(a) { + return !0 +}; +mxConnectionHandler.prototype.createMarker = function() { + var a = new mxCellMarker(this.graph); + a.hotspotEnabled = !0; + a.getCell = mxUtils.bind(this, function(b, c) { + c = mxCellMarker.prototype.getCell.apply(a, arguments); + this.error = null; + if (!this.isConnectableCell(c)) return null; + null != c ? this.isConnecting() ? null != this.previous && (this.error = this.validateConnection(this.previous.cell, c), null != this.error && 0 == this.error.length && (c = null, this.isCreateTarget() && + (this.error = null))) : this.isValidSource(c) || (c = null) : this.isConnecting() && + (!this.isCreateTarget() && !this.graph.allowDanglingEdges) && (this.error = ""); + return c + }); + a.isValidState = mxUtils.bind(this, function(b) { + return this.isConnecting() ? null == this.error : mxCellMarker.prototype.isValidState.apply(a, arguments) + }); + a.getMarkerColor = mxUtils.bind(this, function(b, c, d) { + return null == this.connectImage || this.isConnecting() ? mxCellMarker.prototype.getMarkerColor.apply(a, arguments) : null + }); + a.intersects = mxUtils.bind(this, function(b, c) { + return null != this.connectImage || this.isConnecting() ? !0 : mxCellMarker.prototype.intersects.apply(a, + arguments) + }); + return a +}; +mxConnectionHandler.prototype.start = function(a, b, c, d) { + this.previous = a; + this.first = new mxPoint(b, c); + this.edgeState = null != d ? d : this.createEdgeState(null); + this.marker.currentColor = this.marker.validColor; + this.marker.markedState = a; + 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(a) { + return this.graph.isValidSource(a) +}; +mxConnectionHandler.prototype.isValidTarget = function(a) { + return !0 +}; +mxConnectionHandler.prototype.validateConnection = function(a, b) { + return !this.isValidTarget(b) ? "" : this.graph.getEdgeValidationError(null, a, b) +}; +mxConnectionHandler.prototype.getConnectImage = function(a) { + return this.connectImage +}; +mxConnectionHandler.prototype.isMoveIconToFrontForState = function(a) { + return null != a.text && a.text.node.parentNode == this.graph.container ? !0 : this.moveIconFront +}; +mxConnectionHandler.prototype.createIcons = function(a) { + var b = this.getConnectImage(a); + if (null != b && null != a) { + this.iconState = a; + var c = [], + d = new mxRectangle(0, 0, b.width, b.height), + e = new mxImageShape(d, b.src, null, null, 0); + e.preserveImageAspect = !1; + this.isMoveIconToFrontForState(a) ? (e.dialect = mxConstants.DIALECT_STRICTHTML, e.init(this.graph.container)) : (e.dialect = this.graph.dialect == mxConstants.DIALECT_SVG ? mxConstants.DIALECT_SVG : + mxConstants.DIALECT_VML, e.init(this.graph.getView().getOverlayPane()), this.moveIconBack && + null != e.node.previousSibling && e.node.parentNode.insertBefore(e.node, e.node.parentNode.firstChild)); + e.node.style.cursor = mxConstants.CURSOR_CONNECT; + var f = mxUtils.bind(this, function() { + return null != this.currentState ? this.currentState : a + }), + b = mxUtils.bind(this, function(a) { + mxEvent.isConsumed(a) || (this.icon = e, this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(a, f()))) + }); + mxEvent.redirectMouseEvents(e.node, this.graph, f, b); + c.push(e); + this.redrawIcons(c, this.iconState); + return c + } + return null +}; +mxConnectionHandler.prototype.redrawIcons = function(a, b) { + if (null != a && null != a[0] && null != b) { + var c = this.getIconPosition(a[0], b); + a[0].bounds.x = c.x; + a[0].bounds.y = c.y; + a[0].redraw() + } +}; +mxConnectionHandler.prototype.getIconPosition = function(a, b) { + var c = this.graph.getView().scale, + d = b.getCenterX(), + e = b.getCenterY(); + if (this.graph.isSwimlane(b.cell)) { + var f = this.graph.getStartSize(b.cell), + d = 0 != f.width ? b.x + f.width * c / 2 : d, + e = 0 != f.height ? b.y + f.height * c / 2 : e, + f = mxUtils.toRadians(mxUtils.getValue(b.style, mxConstants.STYLE_ROTATION) || 0); + if (0 != f) var c = Math.cos(f), + f = Math.sin(f), + g = new mxPoint(b.getCenterX(), b.getCenterY()), + e = mxUtils.getRotatedPoint(new mxPoint(d, e), c, f, g), + d = e.x, + e = e.y + } + return new mxPoint(d - + a.bounds.width / 2, e - a.bounds.height / 2) +}; +mxConnectionHandler.prototype.destroyIcons = function(a) { + if (null != a) { + this.iconState = null; + for (var b = 0; b < a.length; b++) a[b].destroy() + } +}; +mxConnectionHandler.prototype.isStartEvent = function(a) { + return !this.graph.isForceMarqueeEvent(a.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(a, b) { + this.mouseDownCounter++; + if (this.isEnabled() && this.graph.isEnabled() && !b.isConsumed() && !this.isConnecting() && this.isStartEvent(b)) { + 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(b.getGraphX(), + b.getGraphY()); + this.edgeState = this.createEdgeState(b); + this.mouseDownCounter = 1; + this.waypointsEnabled && null == this.shape && (this.waypoints = null, this.shape = this.createShape()); + if (null == this.previous && null != this.edgeState) { + var c = this.graph.getPointForEvent(b.getEvent()); + this.edgeState.cell.geometry.setTerminalPoint(c, !0) + } + this.fireEvent(new mxEventObject(mxEvent.START, "state", this.previous)); + b.consume() + } else if (mxClient.IS_TOUCH && this.tapAndHoldEnabled && !this.tapAndHoldInProgress && this.isEnabled() && this.graph.isEnabled() && + !this.isConnecting()) { + this.tapAndHoldInProgress = !0; + this.initialTouchX = b.getX(); + this.initialTouchY = b.getY(); + var d = this.graph.view.getState(this.marker.getCell(b)); + this.tapAndHoldThread && window.clearTimeout(this.tapAndHoldThread); + this.tapAndHoldThread = window.setTimeout(mxUtils.bind(this, function() { + this.tapAndHoldValid && this.tapAndHold(b, d); + this.tapAndHoldValid = this.tapAndHoldInProgress = !1 + }), this.tapAndHoldDelay); + this.tapAndHoldValid = !0 + } + this.selectedIcon = this.icon; + this.icon = null +}; +mxConnectionHandler.prototype.tapAndHold = function(a, b) { + null != b && (this.marker.currentColor = this.marker.validColor, this.marker.markedState = b, this.marker.mark(), this.first = new mxPoint(a.getGraphX(), a.getGraphY()), this.edgeState = this.createEdgeState( + a), this.previous = b, this.fireEvent(new mxEventObject(mxEvent.START, "state", this.previous))) +}; +mxConnectionHandler.prototype.isImmediateConnectSource = function(a) { + return !this.graph.isCellMovable(a.cell) +}; +mxConnectionHandler.prototype.createEdgeState = function(a) { + return null +}; +mxConnectionHandler.prototype.updateCurrentState = function(a) { + var b = this.marker.process(a); + this.constraintHandler.update(a, null == this.first); + this.currentState = b +}; +mxConnectionHandler.prototype.convertWaypoint = function(a) { + var b = this.graph.getView().getScale(), + c = this.graph.getView().getTranslate(); + a.x = a.x / b - c.x; + a.y = a.y / b - c.y +}; +mxConnectionHandler.prototype.mouseMove = function(a, b) { + this.tapAndHoldValid && (this.tapAndHoldValid = Math.abs(this.initialTouchX - b.getX()) < this.tapAndHoldTolerance && Math.abs(this.initialTouchY - b.getY()) < this.tapAndHoldTolerance); + if (!b.isConsumed() && (this.ignoreMouseDown || null != this.first || !this.graph.isMouseDown)) { + !this.isEnabled() && null != this.currentState && (this.destroyIcons(this.icons), this.currentState = null); + (null != this.first || this.isEnabled() && this.graph.isEnabled()) && this.updateCurrentState(b); + if (null != this.first) { + var c = this.graph.getView().scale, + c = new mxPoint(this.graph.snap(b.getGraphX() / c) * c, this.graph.snap(b.getGraphY() / c) * c), + d = null, + e = c; + null != this.constraintHandler.currentConstraint && (null != this.constraintHandler.currentFocus && null != this.constraintHandler.currentPoint) && (d = this.constraintHandler.currentConstraint, + e = this.constraintHandler.currentPoint.clone()); + var f = this.first; + if (null != this.selectedIcon) { + var g = this.selectedIcon.bounds.width, + h = this.selectedIcon.bounds.height; + null != this.currentState && + this.targetConnectImage ? (g = this.getIconPosition(this.selectedIcon, this.currentState), this.selectedIcon.bounds.x = g.x, this.selectedIcon.bounds.y = g.y) : (g = new mxRectangle(b.getGraphX() + + this.connectIconOffset.x, b.getGraphY() + this.connectIconOffset.y, g, h), this.selectedIcon.bounds = g); + this.selectedIcon.redraw() + } + if (null != this.edgeState) { + this.edgeState.absolutePoints = [null, null != this.currentState ? null : e]; + this.graph.view.updateFixedTerminalPoint(this.edgeState, this.previous, !0, this.sourceConstraint); + null != this.currentState && + (null == d && (d = this.graph.getConnectionConstraint(this.edgeState, this.previous, !1)), this.edgeState.setAbsoluteTerminalPoint(null, !1), this.graph.view.updateFixedTerminalPoint(this + .edgeState, this.currentState, !1, d)); + f = null; + if (null != this.waypoints) { + f = []; + for (e = 0; e < this.waypoints.length; e++) d = this.waypoints[e].clone(), this.convertWaypoint(d), f[e] = d + } + this.graph.view.updatePoints(this.edgeState, f, this.previous, this.currentState); + this.graph.view.updateFloatingTerminalPoints(this.edgeState, this.previous, this.currentState); + e = this.edgeState.absolutePoints[this.edgeState.absolutePoints.length - 1]; + f = this.edgeState.absolutePoints[0] + } else null != this.currentState && null == this.constraintHandler.currentConstraint && (g = this.getTargetPerimeterPoint(this.currentState, b), null != g && (e = g)), null == this.sourceConstraint && + null != this.previous && (g = this.getSourcePerimeterPoint(this.previous, null != this.waypoints && 0 < this.waypoints.length ? this.waypoints[0] : e, b), null != g && (f = g)); + if (null == this.currentState && this.movePreviewAway) { + g = f; + null != this.edgeState && + 2 < this.edgeState.absolutePoints.length && (d = this.edgeState.absolutePoints[this.edgeState.absolutePoints.length - 2], null != d && (g = d)); + d = e.x - g.x; + g = e.y - g.y; + h = Math.sqrt(d * d + g * g); + if (0 == h) return; + e.x -= 4 * d / h; + e.y -= 4 * g / h + } + if (null == this.shape && (d = Math.abs(c.x - this.first.x), g = Math.abs(c.y - this.first.y), d > this.graph.tolerance || g > this.graph.tolerance)) this.shape = this.createShape(), this.updateCurrentState( + b); + null != this.shape && (null != this.edgeState ? this.shape.points = this.edgeState.absolutePoints : (c = [f], null != this.waypoints && + (c = c.concat(this.waypoints)), c.push(e), this.shape.points = c), this.drawPreview()); + mxEvent.consume(b.getEvent()); + b.consume() + } else !this.isEnabled() || !this.graph.isEnabled() ? this.constraintHandler.reset() : this.previous != this.currentState && null == this.edgeState ? (this.destroyIcons(this.icons), this.icons = + null, null != this.currentState && null == this.error && (this.icons = this.createIcons(this.currentState), null == this.icons && (this.currentState.setCursor(mxConstants.CURSOR_CONNECT), b + .consume())), this.previous = this.currentState) : + this.previous == this.currentState && (null != this.currentState && null == this.icons && !this.graph.isMouseDown) && b.consume(); + null != this.constraintHandler.currentConstraint && this.marker.reset(); + if (!this.graph.isMouseDown && null != this.currentState && null != this.icons) { + c = !1; + f = b.getSource(); + for (e = 0; e < this.icons.length && !c; e++) c = f == this.icons[e].node || f.parentNode == this.icons[e].node; + c || this.updateIcons(this.currentState, this.icons, b) + } + } else this.constraintHandler.reset() +}; +mxConnectionHandler.prototype.getTargetPerimeterPoint = function(a, b) { + var c = null, + d = a.view, + e = d.getPerimeterFunction(a); + if (null != e) { + var f = null != this.waypoints && 0 < this.waypoints.length ? this.waypoints[this.waypoints.length - 1] : new mxPoint(this.previous.getCenterX(), this.previous.getCenterY()), + d = e(d.getPerimeterBounds(a), this.edgeState, f, !1); + null != d && (c = d) + } else c = new mxPoint(a.getCenterX(), a.getCenterY()); + return c +}; +mxConnectionHandler.prototype.getSourcePerimeterPoint = function(a, b, c) { + c = null; + var d = a.view, + e = d.getPerimeterFunction(a), + f = new mxPoint(a.getCenterX(), a.getCenterY()); + if (null != e) { + var g = mxUtils.getValue(a.style, mxConstants.STYLE_ROTATION, 0), + h = -g * (Math.PI / 180); + 0 != g && (b = mxUtils.getRotatedPoint(new mxPoint(b.x, b.y), Math.cos(h), Math.sin(h), f)); + a = e(d.getPerimeterBounds(a), a, b, !1); + null != a && (0 != g && (a = mxUtils.getRotatedPoint(new mxPoint(a.x, a.y), Math.cos(-h), Math.sin(-h), f)), c = a) + } else c = f; + return c +}; +mxConnectionHandler.prototype.updateIcons = function(a, b, c) {}; +mxConnectionHandler.prototype.isStopEvent = function(a) { + return null != a.getState() +}; +mxConnectionHandler.prototype.addWaypointForEvent = function(a) { + var b = mxUtils.convertPoint(this.graph.container, a.getX(), a.getY()), + c = Math.abs(b.x - this.first.x), + b = Math.abs(b.y - this.first.y); + if (null != this.waypoints || 1 < this.mouseDownCounter && (c > this.graph.tolerance || b > this.graph.tolerance)) null == this.waypoints && (this.waypoints = []), c = this.graph.view.scale, b = + new mxPoint(this.graph.snap(a.getGraphX() / c) * c, this.graph.snap(a.getGraphY() / c) * c), this.waypoints.push(b) +}; +mxConnectionHandler.prototype.mouseUp = function(a, b) { + if (!b.isConsumed() && this.isConnecting()) { + if (this.waypointsEnabled && !this.isStopEvent(b)) { + this.addWaypointForEvent(b); + b.consume(); + return + } + if (null == this.error) { + var c = null != this.previous ? this.previous.cell : null, + d = null; + null != this.constraintHandler.currentConstraint && null != this.constraintHandler.currentFocus && (d = this.constraintHandler.currentFocus.cell); + null == d && this.marker.hasValidState() && (d = this.marker.validState.cell); + this.connect(c, d, b.getEvent(), + b.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); + b.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 a = null == this.error; + this.shape.strokewidth = this.getEdgeWidth(a); + a = this.getEdgeColor(a); + this.shape.stroke = a; + this.shape.redraw() +}; +mxConnectionHandler.prototype.getEdgeColor = function(a) { + return a ? mxConstants.VALID_COLOR : mxConstants.INVALID_COLOR +}; +mxConnectionHandler.prototype.getEdgeWidth = function(a) { + return a ? 3 : 1 +}; +mxConnectionHandler.prototype.connect = function(a, b, c, d) { + if (null != b || this.isCreateTarget() || this.graph.allowDanglingEdges) { + var e = this.graph.getModel(), + f = null; + e.beginUpdate(); + try { + if (null != a && (null == b && this.isCreateTarget()) && (b = this.createTargetVertex(c, a), null != b)) { + d = this.graph.getDropTarget([b], c, d); + if (null == d || !this.graph.getModel().isEdge(d)) { + var g = this.graph.getView().getState(d); + if (null != g) { + var h = e.getGeometry(b); + h.x -= g.origin.x; + h.y -= g.origin.y + } + } else d = this.graph.getDefaultParent(); + this.graph.addCell(b, + d) + } + var k = this.graph.getDefaultParent(); + null != a && (null != b && e.getParent(a) == e.getParent(b) && e.getParent(e.getParent(a)) != e.getRoot()) && (k = e.getParent(a), null != a.geometry && a.geometry.relative && (null != b.geometry && + b.geometry.relative) && (k = e.getParent(k))); + h = g = null; + null != this.edgeState && (g = this.edgeState.cell.value, h = this.edgeState.cell.style); + f = this.insertEdge(k, null, g, a, b, h); + if (null != f) { + this.graph.setConnectionConstraint(f, a, !0, this.sourceConstraint); + this.graph.setConnectionConstraint(f, b, !1, this.constraintHandler.currentConstraint); + null != this.edgeState && e.setGeometry(f, this.edgeState.cell.geometry); + var l = e.getGeometry(f); + null == l && (l = new mxGeometry, l.relative = !0, e.setGeometry(f, l)); + if (null != this.waypoints && 0 < this.waypoints.length) { + var m = this.graph.view.scale, + n = this.graph.view.translate; + l.points = []; + for (a = 0; a < this.waypoints.length; a++) { + var p = this.waypoints[a]; + l.points.push(new mxPoint(p.x / m - n.x, p.y / m - n.y)) + } + } + null == b && (p = this.graph.getPointForEvent(c, !1), p.x -= this.graph.panDx / this.graph.view.scale, p.y -= this.graph.panDy / this.graph.view.scale, + l.setTerminalPoint(p, !1)); + this.fireEvent(new mxEventObject(mxEvent.CONNECT, "cell", f, "event", c, "target", d)) + } + } catch (q) { + mxLog.show(), mxLog.debug(q.message) + } finally { + e.endUpdate() + } + this.select && this.selectCells(f, b) + } +}; +mxConnectionHandler.prototype.selectCells = function(a, b) { + this.graph.setSelectionCell(a) +}; +mxConnectionHandler.prototype.insertEdge = function(a, b, c, d, e, f) { + if (null == this.factoryMethod) return this.graph.insertEdge(a, b, c, d, e, f); + b = this.createEdge(c, d, e, f); + return b = this.graph.addEdge(b, a, d, e) +}; +mxConnectionHandler.prototype.createTargetVertex = function(a, b) { + for (var c = this.graph.getCellGeometry(b); null != c && c.relative;) b = this.graph.getModel().getParent(b), c = this.graph.getCellGeometry(b); + var d = this.graph.cloneCells([b])[0], + c = this.graph.getModel().getGeometry(d); + if (null != c) { + var e = this.graph.getPointForEvent(a); + c.x = this.graph.snap(e.x - c.width / 2) - this.graph.panDx / this.graph.view.scale; + c.y = this.graph.snap(e.y - c.height / 2) - this.graph.panDy / this.graph.view.scale; + if (null != this.first) { + var f = this.graph.view.getState(b); + if (null != f) { + var g = this.getAlignmentTolerance(); + Math.abs(this.graph.snap(this.first.x) - this.graph.snap(e.x)) <= g ? c.x = f.x : Math.abs(this.graph.snap(this.first.y) - this.graph.snap(e.y)) <= g && (c.y = f.y) + } + } + } + return d +}; +mxConnectionHandler.prototype.getAlignmentTolerance = function() { + return this.graph.isGridEnabled() ? this.graph.gridSize : this.graph.tolerance +}; +mxConnectionHandler.prototype.createEdge = function(a, b, c, d) { + var e = null; + null != this.factoryMethod && (e = this.factoryMethod(b, c, d)); + null == e && (e = new mxCell(a || ""), e.setEdge(!0), e.setStyle(d), a = new mxGeometry, a.relative = !0, e.setGeometry(a)); + return e +}; +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) +}; + +function mxConstraintHandler(a) { + this.graph = a +} +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(a) { + this.enabled = a +}; +mxConstraintHandler.prototype.reset = function() { + if (null != this.focusIcons) { + for (var a = 0; a < this.focusIcons.length; a++) this.focusIcons[a].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(a, b, c) { + return this.pointImage +}; +mxConstraintHandler.prototype.isEventIgnored = function(a, b) { + return !1 +}; +mxConstraintHandler.prototype.update = function(a, b) { + if (this.isEnabled() && !this.isEventIgnored(a)) { + var c = this.getTolerance(), + d = new mxRectangle(a.getGraphX() - c, a.getGraphY() - c, 2 * c, 2 * c), + e = null != a.getCell() ? this.graph.isCellConnectable(a.getCell()) : !1; + if (null == this.currentFocusArea || !mxUtils.intersects(this.currentFocusArea, d) || null != a.getState() && null != this.currentFocus && e) + if (this.currentFocusArea = null, a.getState() != this.currentFocus) + if (this.currentFocus = null, this.constraints = null != a.getState() && e ? this.graph.getAllConnectionConstraints(a.getState(), + b) : null, null != this.constraints) { + this.currentFocus = a.getState(); + this.currentFocusArea = new mxRectangle(a.getState().x, a.getState().y, a.getState().width, a.getState().height); + if (null != this.focusIcons) { + for (e = 0; e < this.focusIcons.length; e++) this.focusIcons[e].destroy(); + this.focusPoints = this.focusIcons = null + } + this.focusIcons = []; + this.focusPoints = []; + for (e = 0; e < this.constraints.length; e++) { + var f = this.graph.getConnectionPoint(a.getState(), this.constraints[e]), + g = this.getImageForConstraint(a.getState(), this.constraints[e], + f), + h = g.src, + g = new mxRectangle(f.x - g.width / 2, f.y - g.height / 2, g.width, g.height), + g = new mxImageShape(g, h); + g.dialect = this.graph.dialect != mxConstants.DIALECT_SVG ? mxConstants.DIALECT_MIXEDHTML : mxConstants.DIALECT_SVG; + g.preserveImageAspect = !1; + g.init(this.graph.getView().getOverlayPane()); + null != g.node.previousSibling && g.node.parentNode.insertBefore(g.node, g.node.parentNode.firstChild); + h = mxUtils.bind(this, function() { + return null != this.currentFocus ? this.currentFocus : a.getState() + }); + g.redraw(); + mxEvent.redirectMouseEvents(g.node, + this.graph, h); + this.currentFocusArea.add(g.bounds); + this.focusIcons.push(g); + this.focusPoints.push(f) + } + this.currentFocusArea.grow(c) + } else if (null != this.focusIcons) { + null != this.focusHighlight && (this.focusHighlight.destroy(), this.focusHighlight = null); + for (e = 0; e < this.focusIcons.length; e++) this.focusIcons[e].destroy(); + this.focusPoints = this.focusIcons = null + } + this.currentPoint = this.currentConstraint = null; + if (null != this.focusIcons && null != this.constraints && (null == a.getState() || this.currentFocus == a.getState())) + for (e = + 0; e < this.focusIcons.length; e++) + if (mxUtils.intersects(this.focusIcons[e].bounds, d)) { + this.currentConstraint = this.constraints[e]; + this.currentPoint = this.focusPoints[e]; + c = this.focusIcons[e].bounds.clone(); + c.grow(mxClient.IS_IE ? 3 : 2); + mxClient.IS_IE && (c.width -= 1, c.height -= 1); + null == this.focusHighlight ? (c = new mxRectangleShape(c, null, this.highlightColor, 3), c.dialect = this.graph.dialect == mxConstants.DIALECT_SVG ? mxConstants.DIALECT_SVG : mxConstants + .DIALECT_VML, c.init(this.graph.getView().getOverlayPane()), this.focusHighlight = + c, h = mxUtils.bind(this, function() { + return null != this.currentFocus ? this.currentFocus : a.getState() + }), mxEvent.redirectMouseEvents(c.node, this.graph, h)) : (this.focusHighlight.bounds = c, this.focusHighlight.redraw()); + break + } + null == this.currentConstraint && null != this.focusHighlight && (this.focusHighlight.destroy(), this.focusHighlight = null) + } +}; +mxConstraintHandler.prototype.destroy = function() { + this.reset() +}; + +function mxRubberband(a) { + null != a && (this.graph = a, 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() + }))) +} +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(a) { + this.enabled = a +}; +mxRubberband.prototype.mouseDown = function(a, b) { + if (!b.isConsumed() && this.isEnabled() && this.graph.isEnabled() && (this.graph.isForceMarqueeEvent(b.getEvent()) || null == b.getState())) { + var c = mxUtils.getOffset(this.graph.container), + d = mxUtils.getScrollOrigin(this.graph.container); + d.x -= c.x; + d.y -= c.y; + this.start(b.getX() + d.x, b.getY() + d.y); + if (mxClient.IS_NS && !mxClient.IS_SF && !mxClient.IS_GC) { + var e = this.graph.container, + f = function(a) { + a = new mxMouseEvent(a); + var b = mxUtils.convertPoint(e, a.getX(), a.getY()); + a.graphX = b.x; + a.graphY = b.y; + return a + }; + this.dragHandler = mxUtils.bind(this, function(a) { + this.mouseMove(this.graph, f(a)) + }); + this.dropHandler = mxUtils.bind(this, function(a) { + this.mouseUp(this.graph, f(a)) + }); + mxEvent.addListener(document, "mousemove", this.dragHandler); + mxEvent.addListener(document, "mouseup", this.dropHandler) + } + b.consume(!1) + } +}; +mxRubberband.prototype.start = function(a, b) { + this.first = new mxPoint(a, b) +}; +mxRubberband.prototype.mouseMove = function(a, b) { + if (!b.isConsumed() && null != this.first) { + var c = mxUtils.getScrollOrigin(this.graph.container), + d = mxUtils.getOffset(this.graph.container); + c.x -= d.x; + c.y -= d.y; + var d = b.getX() + c.x, + c = b.getY() + c.y, + e = this.first.x - d, + f = this.first.y - c, + g = this.graph.tolerance; + if (null != this.div || Math.abs(e) > g || Math.abs(f) > g) null == this.div && (this.div = this.createShape()), mxUtils.clearSelection(), this.update(d, c), b.consume() + } +}; +mxRubberband.prototype.createShape = function() { + null == this.sharedDiv && (this.sharedDiv = document.createElement("div"), this.sharedDiv.className = "mxRubberband", mxUtils.setOpacity(this.sharedDiv, this.defaultOpacity)); + this.graph.container.appendChild(this.sharedDiv); + return this.sharedDiv +}; +mxRubberband.prototype.mouseUp = function(a, b) { + var c = null != this.div; + this.reset(); + c && (c = new mxRectangle(this.x, this.y, this.width, this.height), this.graph.selectRegion(c, b.getEvent()), b.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(a, b) { + this.currentX = a; + this.currentY = b; + this.repaint() +}; +mxRubberband.prototype.repaint = function() { + if (null != this.div) { + var a = this.currentX - this.graph.panDx, + b = this.currentY - this.graph.panDy; + this.x = Math.min(this.first.x, a); + this.y = Math.min(this.first.y, b); + this.width = Math.max(this.first.x, a) - this.x; + this.height = Math.max(this.first.y, b) - this.y; + a = 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 + a + "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)) +}; + +function mxVertexHandler(a) { + null != a && (this.state = a, this.init()) +} +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() { + 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); + if (0 >= mxGraphHandler.prototype.maxCells || this.graph.getSelectionCount() < mxGraphHandler.prototype.maxCells) { + var a = this.graph.isCellResizable(this.state.cell); + this.sizers = []; + if (a || this.graph.isLabelMovable(this.state.cell) && 2 <= this.state.width && 2 <= this.state.height) { + var b = 0; + a && (this.singleSizer || (this.sizers.push(this.createSizer("nw-resize", + b++)), this.sizers.push(this.createSizer("n-resize", b++)), this.sizers.push(this.createSizer("ne-resize", b++)), this.sizers.push(this.createSizer("w-resize", b++)), this.sizers.push( + this.createSizer("e-resize", b++)), this.sizers.push(this.createSizer("sw-resize", b++)), this.sizers.push(this.createSizer("s-resize", b++))), this.sizers.push(this.createSizer( + "se-resize", b++))); + a = this.graph.model.getGeometry(this.state.cell); + null != a && (!a.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) && 2 > this.state.width && 2 > this.state.height) && (this.labelShape = this.createSizer( + mxConstants.CURSOR_MOVABLE_VERTEX, null, null, mxConstants.LABEL_HANDLE_FILLCOLOR), this.sizers.push(this.labelShape)) + } + if (this.rotationEnabled && (0 >= + mxGraphHandler.prototype.maxCells || 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(a) { + return new mxRectangle(Math.round(a.x), Math.round(a.y), Math.round(a.width), Math.round(a.height)) +}; +mxVertexHandler.prototype.createSelectionShape = function(a) { + a = new mxRectangleShape(a, null, this.getSelectionColor()); + a.strokewidth = this.getSelectionStrokeWidth(); + a.isDashed = this.isSelectionDashed(); + return a +}; +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(a, b, c, d) { + c = c || mxConstants.HANDLE_SIZE; + c = new mxRectangle(0, 0, c, c); + d = this.createSizerShape(c, b, d); + d.isHtmlAllowed() && null != this.state.text && this.state.text.node.parentNode == this.graph.container ? (d.bounds.height -= 1, d.bounds.width -= 1, d.dialect = mxConstants.DIALECT_STRICTHTML, d + .init(this.graph.container)) : (d.dialect = this.graph.dialect != mxConstants.DIALECT_SVG ? mxConstants.DIALECT_MIXEDHTML : mxConstants.DIALECT_SVG, d.init(this.graph.getView().getOverlayPane())); + mxEvent.redirectMouseEvents(d.node, this.graph, this.state); + this.graph.isEnabled() && (d.node.style.cursor = a); + this.isSizerVisible(b) || (d.node.style.visibility = "hidden"); + return d +}; +mxVertexHandler.prototype.isSizerVisible = function(a) { + return !0 +}; +mxVertexHandler.prototype.createSizerShape = function(a, b, c) { + return null != this.handleImage ? (a.width = this.handleImage.width, a.height = this.handleImage.height, new mxImageShape(a, this.handleImage.src)) : b == mxEvent.ROTATION_HANDLE ? new mxEllipse( + a, c || mxConstants.HANDLE_FILLCOLOR, mxConstants.HANDLE_STROKECOLOR) : new mxRectangleShape(a, c || mxConstants.HANDLE_FILLCOLOR, mxConstants.HANDLE_STROKECOLOR) +}; +mxVertexHandler.prototype.moveSizerTo = function(a, b, c) { + null != a && (a.bounds.x = Math.round(b - a.bounds.width / 2), a.bounds.y = Math.round(c - a.bounds.height / 2), a.redraw()) +}; +mxVertexHandler.prototype.getHandleForEvent = function(a) { + if (a.isSource(this.rotationShape)) return mxEvent.ROTATION_HANDLE; + if (a.isSource(this.labelShape)) return mxEvent.LABEL_HANDLE; + if (null != this.sizers) + for (var b = this.tolerance, b = this.allowHandleBoundsCheck && (mxClient.IS_IE || 0 < b) ? new mxRectangle(a.getGraphX() - b, a.getGraphY() - b, 2 * b, 2 * b) : null, c = 0; c < this.sizers.length; c++) + if (a.isSource(this.sizers[c]) || null != b && mxUtils.intersects(this.sizers[c].bounds, b)) return c; + return null +}; +mxVertexHandler.prototype.mouseDown = function(a, b) { + if (!b.isConsumed() && this.graph.isEnabled() && !this.graph.isForceMarqueeEvent(b.getEvent()) && (0 < this.tolerance || b.getState() == this.state)) { + var c = this.getHandleForEvent(b); + null != c && (this.start(b.getX(), b.getY(), c), b.consume()) + } +}; +mxVertexHandler.prototype.start = function(a, b, c) { + a = mxUtils.convertPoint(this.graph.container, a, b); + this.startX = a.x; + this.startY = a.y; + this.index = c; + this.selectionBorder.node.style.display = c == 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 = + mxConstants.DIALECT_STRICTHTML, this.preview.init(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())) +}; +mxVertexHandler.prototype.mouseMove = function(a, b) { + if (!b.isConsumed() && null != this.index) { + var c = new mxPoint(b.getGraphX(), b.getGraphY()), + d = this.graph.isGridEnabledEvent(b.getEvent()), + e = this.graph.getView().scale; + if (this.index == mxEvent.LABEL_HANDLE) d && (c.x = this.graph.snap(c.x / e) * e, c.y = this.graph.snap(c.y / e) * e), this.moveSizerTo(this.sizers[this.sizers.length - 1], c.x, c.y); + else if (this.index == mxEvent.ROTATION_HANDLE) { + var f = this.state.x + this.state.width / 2 - c.x, + g = this.state.y + this.state.height / 2 - c.y; + this.currentAlpha = + 0 != f ? 180 * Math.atan(g / f) / Math.PI + 90 : 0 > g ? 180 : 0; + 0 < f && (this.currentAlpha -= 180); + this.rotationRaster && (f = c.x - this.state.getCenterX(), g = c.y - this.state.getCenterY(), f = Math.abs(Math.sqrt(f * f + g * g) - this.state.height / 2 - 20), f = Math.max(1, 5 * Math.min( + 3, Math.max(0, Math.round(80 / Math.abs(f))))), this.currentAlpha = Math.round(this.currentAlpha / f) * f); + this.selectionBorder.rotation = this.currentAlpha; + this.selectionBorder.redraw() + } else { + var h = mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION] || "0"), + k = Math.cos(-h), + l = Math.sin(-h), + m = new mxPoint(this.state.getCenterX(), this.state.getCenterY()), + f = c.x - this.startX, + g = c.y - this.startY, + c = this.graph.view.translate, + n = l * f + k * g, + f = k * f - l * g; + this.bounds = this.union(this.selectionBounds, f, n, this.index, d, e, c); + k = Math.cos(h); + l = Math.sin(h); + g = new mxPoint(this.bounds.getCenterX(), this.bounds.getCenterY()); + f = g.x - m.x; + g = g.y - m.y; + m = l * f + k * g - g; + this.bounds.x += k * f - l * g - f; + this.bounds.y += m; + this.drawPreview() + } + b.consume() + } else null != this.getHandleForEvent(b) && b.consume(!1) +}; +mxVertexHandler.prototype.mouseUp = function(a, b) { + if (!b.isConsumed() && null != this.index && null != this.state) { + var c = new mxPoint(b.getGraphX(), b.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 d = this.graph.isGridEnabledEvent(b.getEvent()), + e = mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION] || "0"), + f = Math.cos(-e), + g = Math.sin(-e), + h = c.x - this.startX, + k = c.y - this.startY, + c = g * h + f * k, + h = f * h - g * k, + k = c, + l = this.graph.view.scale; + this.resizeCell(this.state.cell, h / l, k / l, this.index, d) + } + } finally { + this.graph.getModel().endUpdate() + } + this.reset(); + b.consume() + } +}; +mxVertexHandler.prototype.rotateCell = function(a, b) { + var c = this.graph.getModel(); + if (c.isVertex(a)) { + var d = a == this.state ? this.state : this.graph.view.getState(a); + null != d && this.graph.setCellStyles(mxConstants.STYLE_ROTATION, (d.style[mxConstants.STYLE_ROTATION] || 0) + b, [a]); + if (this.state.cell != a && (d = this.graph.getCellGeometry(a), null != d && !d.relative)) + if (0 != b) { + var e = this.graph.getModel().getParent(a), + f = this.graph.getCellGeometry(e); + if (!d.relative && null != f) { + var g = mxUtils.toRadians(b), + e = Math.cos(g), + g = Math.sin(g), + h = new mxPoint(d.getCenterX(), d.getCenterY()), + f = new mxPoint(f.width / 2, f.height / 2), + e = mxUtils.getRotatedPoint(h, e, g, f), + d = d.clone(); + d.x = e.x - d.width / 2; + d.y = e.y - d.height / 2; + c.setGeometry(a, d) + } + } else d = d.clone(), d.x += dx, d.y += dy, c.setGeometry(a, d); + d = c.getChildCount(a); + for (e = 0; e < d; e++) this.rotateCell(c.getChildAt(a, e), b) + } +}; +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(a, b, c, d, e) { + var f = this.graph.model.getGeometry(a); + if (null != f) + if (d == mxEvent.LABEL_HANDLE) d = this.graph.view.scale, b = (this.labelShape.bounds.getCenterX() - this.startX) / d, c = (this.labelShape.bounds.getCenterY() - this.startY) / d, f = f.clone(), + null == f.offset ? f.offset = new mxPoint(b, c) : (f.offset.x += b, f.offset.y += c), this.graph.model.setGeometry(a, f); + else { + d = this.union(f, b, c, d, e, 1, new mxPoint(0, 0)); + var g = mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION] || "0"); + if (0 != g) { + b = d.getCenterX() - f.getCenterX(); + c = d.getCenterY() - f.getCenterY(); + e = Math.cos(g); + var h = Math.sin(g), + g = e * b - h * c - b; + b = h * b + e * c - c; + c = d.x - f.x; + var k = d.y - f.y, + l = e * c - h * k; + e = h * c + e * k; + d.x += g; + d.y += b; + if (!this.graph.isCellCollapsed(a) && (0 != g || 0 != b)) c = f.x - d.x + l, k = f.y - d.y + e, this.moveChildren(a, c, k) + } + this.graph.resizeCell(a, d) + } +}; +mxVertexHandler.prototype.moveChildren = function(a, b, c) { + for (var d = this.graph.getModel(), e = d.getChildCount(a), f = 0; f < e; f++) { + var g = d.getChildAt(a, f); + if (d.isVertex(g)) { + var h = this.graph.getCellGeometry(g); + null != h && !h.relative && (h = h.clone(), h.x += b, h.y += c, d.setGeometry(g, h)) + } + } +}; +mxVertexHandler.prototype.union = function(a, b, c, d, e, f, g) { + if (this.singleSizer) { + g = a.x + a.width + b; + var h = a.y + a.height + c; + e && (g = this.graph.snap(g / f) * f, h = this.graph.snap(h / f) * f); + f = new mxRectangle(a.x, a.y, 0, 0); + f.add(new mxRectangle(g, h, 0, 0)); + return f + } + var h = a.x - g.x * f, + k = h + a.width, + l = a.y - g.y * f; + a = l + a.height; + 4 < d ? (a += c, e && (a = this.graph.snap(a / f) * f)) : 3 > d && (l += c, e && (l = this.graph.snap(l / f) * f)); + if (0 == d || 3 == d || 5 == d) h += b, e && (h = this.graph.snap(h / f) * f); + else if (2 == d || 4 == d || 7 == d) k += b, e && (k = this.graph.snap(k / f) * f); + e = k - h; + a -= + l; + 0 > e && (h += e, e = Math.abs(e)); + 0 > a && (l += a, a = Math.abs(a)); + return new mxRectangle(h + g.x * f, l + g.y * f, e, a) +}; +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 a = this.state; + if (null != this.sizers) { + var b = a.x + a.width, + c = a.y + a.height; + if (this.singleSizer) this.moveSizerTo(this.sizers[0], b, c); + else { + var d = a.x + a.width / 2, + e = a.y + a.height / 2; + if (1 < this.sizers.length) { + var f = mxUtils.toRadians(a.style[mxConstants.STYLE_ROTATION] || "0"), + g = Math.cos(f), + f = Math.sin(f), + h = new mxPoint(a.getCenterX(), + a.getCenterY()), + k = mxUtils.getRotatedPoint(new mxPoint(a.x, a.y), g, f, h); + this.moveSizerTo(this.sizers[0], k.x, k.y); + k.x = d; + k.y = a.y; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[1], k.x, k.y); + k.x = b; + k.y = a.y; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[2], k.x, k.y); + k.x = a.x; + k.y = e; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[3], k.x, k.y); + k.x = b; + k.y = e; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[4], k.x, k.y); + k.x = a.x; + k.y = c; + k = mxUtils.getRotatedPoint(k, + g, f, h); + this.moveSizerTo(this.sizers[5], k.x, k.y); + k.x = d; + k.y = c; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[6], k.x, k.y); + k.x = b; + k.y = c; + k = mxUtils.getRotatedPoint(k, g, f, h); + this.moveSizerTo(this.sizers[7], k.x, k.y); + this.moveSizerTo(this.sizers[8], d + a.absoluteOffset.x, e + a.absoluteOffset.y) + } else 2 <= this.state.width && 2 <= this.state.height ? this.moveSizerTo(this.sizers[0], d + a.absoluteOffset.x, e + a.absoluteOffset.y) : this.moveSizerTo(this.sizers[0], a.x, a.y) + } + } + null != this.rotationShape && (f = mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION] || + "0"), g = Math.cos(f), f = Math.sin(f), h = new mxPoint(this.state.getCenterX(), this.state.getCenterY()), k = mxUtils.getRotatedPoint(new mxPoint(a.x + a.width / 2, a.y - 16), g, f, h), + this.moveSizerTo(this.rotationShape, k.x, k.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() { + null != this.preview && (this.preview.destroy(), this.preview = null); + this.selectionBorder.destroy(); + this.labelShape = this.selectionBorder = null; + if (null != this.sizers) + for (var a = 0; a < this.sizers.length; a++) this.sizers[a].destroy(), this.sizers[a] = null +}; + +function mxEdgeHandler(a) { + null != a && (this.state = a, this.init()) +} +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() { + 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(a) { + this.graph.dblClick(a, this.state.cell) + })); + mxEvent.addGestureListeners(this.shape.node, mxUtils.bind(this, function(a) { + this.addEnabled && this.isAddPointEvent(a) ? this.addPoint(this.state, a) : this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(a, this.state)) + }), mxUtils.bind(this, function(a) { + var c = this.state.cell; + if (null != this.index) { + var d = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(a), + mxEvent.getClientY(a)), + c = this.graph.getCellAt(d.x, d.y); + this.graph.isSwimlane(c) && this.graph.hitsSwimlaneContent(c, d.x, d.y) && (c = null) + } + this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(a, this.graph.getView().getState(c))) + }), mxUtils.bind(this, function(a) { + this.graph.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(a, this.state)) + })); + this.preferHtml = null != this.state.text && this.state.text.node.parentNode == this.graph.container; + if (!this.preferHtml) { + var a = this.state.getVisibleTerminalState(!0); + null != a && (this.preferHtml = null != a.text && a.text.node.parentNode == this.graph.container); + this.preferHtml || (a = this.state.getVisibleTerminalState(!1), null != a && (this.preferHtml = null != a.text && a.text.node.parentNode == this.graph.container)) + } + if (this.graph.getSelectionCount() < mxGraphHandler.prototype.maxCells || 0 >= mxGraphHandler.prototype.maxCells) 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(a) { + return mxEvent.isShiftDown(a) +}; +mxEdgeHandler.prototype.isRemovePointEvent = function(a) { + return mxEvent.isShiftDown(a) +}; +mxEdgeHandler.prototype.getSelectionPoints = function(a) { + return a.absolutePoints +}; +mxEdgeHandler.prototype.createSelectionShape = function(a) { + a = new mxPolyline(a, this.getSelectionColor()); + a.strokewidth = this.getSelectionStrokeWidth(); + a.isDashed = this.isSelectionDashed(); + return a +}; +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(a) { + return !0 +}; +mxEdgeHandler.prototype.createMarker = function() { + var a = new mxCellMarker(this.graph), + b = this; + a.getCell = function(a) { + var d = mxCellMarker.prototype.getCell.apply(this, arguments); + if (!b.isConnectableCell(d)) return null; + var e = b.graph.getModel(); + if (d == b.state.cell || null != d && !b.graph.connectableEdges && e.isEdge(d)) d = null; + return d + }; + a.isValidState = function(a) { + var d = b.graph.getModel(), + d = b.graph.view.getTerminalPort(a, b.graph.view.getState(d.getTerminal(b.state.cell, !b.isSource)), !b.isSource), + d = null != d ? d.cell : null; + b.error = b.validateConnection(b.isSource ? a.cell : d, b.isSource ? d : a.cell); + return null == b.error + }; + return a +}; +mxEdgeHandler.prototype.validateConnection = function(a, b) { + return this.graph.getEdgeValidationError(this.state.cell, a, b) +}; +mxEdgeHandler.prototype.createBends = function() { + for (var a = this.state.cell, b = [], c = 0; c < this.abspoints.length; c++) + if (this.isHandleVisible(c)) { + var d = c == this.abspoints.length - 1; + if ((d = 0 == c || d) || this.graph.isCellBendable(a)) { + var e = this.createHandleShape(c); + this.initBend(e); + mxClient.IS_TOUCH && e.node.setAttribute("pointer-events", "none"); + if (this.isHandleEnabled(c)) + if (mxClient.IS_TOUCH) { + var f = mxUtils.bind(this, function(a) { + a = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(a), mxEvent.getClientY(a)); + return this.graph.view.getState(this.graph.getCellAt(a.x, a.y)) + }); + mxEvent.redirectMouseEvents(e.node, this.graph, f) + } else e.node.style.cursor = mxConstants.CURSOR_BEND_HANDLE, mxEvent.redirectMouseEvents(e.node, this.graph, this.state); + b.push(e); + d || (this.points.push(new mxPoint(0, 0)), e.node.style.visibility = "hidden") + } + } + return b +}; +mxEdgeHandler.prototype.isHandleEnabled = function(a) { + return !0 +}; +mxEdgeHandler.prototype.isHandleVisible = function(a) { + return !0 +}; +mxEdgeHandler.prototype.createHandleShape = function(a) { + if (null != this.handleImage) return new mxImageShape(new mxRectangle(0, 0, this.handleImage.width, this.handleImage.height), this.handleImage.src); + a = mxConstants.HANDLE_SIZE; + this.preferHtml && (a -= 1); + return new mxRectangleShape(new mxRectangle(0, 0, a, a), mxConstants.HANDLE_FILLCOLOR, mxConstants.HANDLE_STROKECOLOR) +}; +mxEdgeHandler.prototype.initBend = function(a) { + this.preferHtml ? (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())) +}; +mxEdgeHandler.prototype.getHandleForEvent = function(a) { + if (null != this.bends) + for (var b = this.tolerance, b = this.allowHandleBoundsCheck && (mxClient.IS_IE || 0 < b) ? new mxRectangle(a.getGraphX() - b, a.getGraphY() - b, 2 * b, 2 * b) : null, c = 0; c < this.bends.length; c++) + if ((a.isSource(this.bends[c]) || null != b && mxUtils.intersects(this.bends[c].bounds, b)) && "hidden" != this.bends[c].node.style.visibility) return c; + if (a.isSource(this.labelShape) && "hidden" != this.labelShape.node.style.visibility || a.isSource(this.state.text)) + if (!mxClient.IS_SF && + !mxClient.IS_GC || "SELECT" != a.getSource().nodeName) return mxEvent.LABEL_HANDLE; + return null +}; +mxEdgeHandler.prototype.mouseDown = function(a, b) { + var c = null, + c = this.getHandleForEvent(b); + null != c && (!b.isConsumed() && this.graph.isEnabled() && !this.graph.isForceMarqueeEvent(b.getEvent())) && (this.removeEnabled && this.isRemovePointEvent(b.getEvent()) ? this.removePoint(this.state, + c) : (c != mxEvent.LABEL_HANDLE || this.graph.isLabelMovable(b.getCell())) && this.start(b.getX(), b.getY(), c), b.consume()) +}; +mxEdgeHandler.prototype.start = function(a, b, c) { + this.startX = a; + this.startY = b; + this.isSource = null == this.bends ? !1 : 0 == c; + this.isTarget = null == this.bends ? !1 : c == this.bends.length - 1; + this.isLabel = c == mxEvent.LABEL_HANDLE; + if (this.isSource || this.isTarget) { + if (a = this.state.cell, b = this.graph.model.getTerminal(a, this.isSource), null == b && this.graph.isTerminalPointMovable(a, this.isSource) || null != b && this.graph.isCellDisconnectable(a, + b, this.isSource)) this.index = c + } else this.index = c +}; +mxEdgeHandler.prototype.clonePreviewState = function(a, b) { + return this.state.clone() +}; +mxEdgeHandler.prototype.getSnapToTerminalTolerance = function() { + return this.graph.gridSize * this.graph.view.scale / 2 +}; +mxEdgeHandler.prototype.getPointForEvent = function(a) { + var b = new mxPoint(a.getGraphX(), a.getGraphY()), + c = this.getSnapToTerminalTolerance(), + d = this.graph.getView(), + e = !1, + f = !1; + if (this.snapToTerminals && 0 < c) { + var g = function(a) { + if (null != a) { + var d = a.x; + Math.abs(b.x - d) < c && (b.x = d, e = !0); + a = a.y; + Math.abs(b.y - a) < c && (b.y = a, f = !0) + } + }, + h = function(a) { + null != a && g.call(this, new mxPoint(d.getRoutingCenterX(a), d.getRoutingCenterY(a))) + }; + h.call(this, this.state.getVisibleTerminalState(!0)); + h.call(this, this.state.getVisibleTerminalState(!1)); + if (null != this.abspoints) + for (h = 0; h < this.abspoints; h++) h != this.index && g.call(this, this.abspoints[h]) + } + this.graph.isGridEnabledEvent(a.getEvent()) && (a = d.scale, h = d.translate, e || (b.x = (this.graph.snap(b.x / a - h.x) + h.x) * a), f || (b.y = (this.graph.snap(b.y / a - h.y) + h.y) * a)); + return b +}; +mxEdgeHandler.prototype.getPreviewTerminalState = function(a) { + this.constraintHandler.update(a, this.isSource); + this.marker.process(a); + a = this.marker.getValidState(); + var b = null; + null != this.constraintHandler.currentFocus && null != this.constraintHandler.currentConstraint && this.marker.reset(); + null != a ? b = a : null != this.constraintHandler.currentConstraint && null != this.constraintHandler.currentFocus && (b = this.constraintHandler.currentFocus); + return b +}; +mxEdgeHandler.prototype.getPreviewPoints = function(a) { + var b = this.graph.getCellGeometry(this.state.cell), + b = null != b.points ? b.points.slice() : null; + !this.isSource && !this.isTarget ? (this.convertPoint(a, !1), null == b ? b = [a] : b[this.index - 1] = a) : this.graph.resetEdgesOnConnect && (b = null); + return b +}; +mxEdgeHandler.prototype.updatePreviewState = function(a, b, c) { + var d = this.isSource ? c : this.state.getVisibleTerminalState(!0), + e = this.isTarget ? c : this.state.getVisibleTerminalState(!1), + f = this.graph.getConnectionConstraint(a, d, !0), + g = this.graph.getConnectionConstraint(a, e, !1), + h = this.constraintHandler.currentConstraint; + null == h && (h = new mxConnectionConstraint); + this.isSource ? f = h : this.isTarget && (g = h); + (!this.isSource || null != d) && a.view.updateFixedTerminalPoint(a, d, !0, f); + (!this.isTarget || null != e) && a.view.updateFixedTerminalPoint(a, + e, !1, g); + if ((this.isSource || this.isTarget) && null == c) a.setAbsoluteTerminalPoint(b, this.isSource), null == this.marker.getMarkedState() && (this.error = this.graph.allowDanglingEdges ? null : ""); + a.view.updatePoints(a, this.points, d, e); + a.view.updateFloatingTerminalPoints(a, d, e) +}; +mxEdgeHandler.prototype.mouseMove = function(a, b) { + if (null != this.index && null != this.marker) { + var c = this.getPointForEvent(b); + if (this.isLabel) this.label.x = c.x, this.label.y = c.y; + else { + this.points = this.getPreviewPoints(c); + var d = this.isSource || this.isTarget ? this.getPreviewTerminalState(b) : null, + e = this.clonePreviewState(c, null != d ? d.cell : null); + this.updatePreviewState(e, c, d); + this.setPreviewColor(null == this.error ? this.marker.validColor : this.marker.invalidColor); + this.abspoints = e.absolutePoints; + this.active = !0 + } + this.drawPreview(); + mxEvent.consume(b.getEvent()); + b.consume() + } else mxClient.IS_IE && null != this.getHandleForEvent(b) && b.consume(!1) +}; +mxEdgeHandler.prototype.mouseUp = function(a, b) { + if (null != this.index && null != this.marker) { + var c = this.state.cell; + if (b.getX() != this.startX || b.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 d = null; + null != this.constraintHandler.currentConstraint && null != this.constraintHandler.currentFocus && (d = this.constraintHandler.currentFocus.cell); + null == + d && this.marker.hasValidState() && (d = this.marker.validState.cell); + if (null != d) c = this.connect(c, d, this.isSource, this.graph.isCloneEvent(b.getEvent()) && this.cloneEnabled && this.graph.isCellsCloneable(), b); + else if (this.graph.isAllowDanglingEdges()) { + d = this.abspoints[this.isSource ? 0 : this.abspoints.length - 1]; + d.x = d.x / this.graph.view.scale - this.graph.view.translate.x; + d.y = d.y / this.graph.view.scale - this.graph.view.translate.y; + var e = this.graph.getView().getState(this.graph.getModel().getParent(c)); + null != e && (d.x -= + e.origin.x, d.y -= e.origin.y); + d.x -= this.graph.panDx / this.graph.view.scale; + d.y -= this.graph.panDy / this.graph.view.scale; + this.changeTerminalPoint(c, d, this.isSource) + } + } else this.active ? this.changePoints(c, this.points) : (this.graph.getView().invalidate(this.state.cell), this.graph.getView().revalidate(this.state.cell)); + null != this.marker && (this.reset(), c != this.state.cell && this.graph.setSelectionCell(c)); + b.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(a) { + null != this.shape && (this.shape.stroke = a) +}; +mxEdgeHandler.prototype.convertPoint = function(a, b) { + var c = this.graph.getView().getScale(), + d = this.graph.getView().getTranslate(); + b && (a.x = this.graph.snap(a.x), a.y = this.graph.snap(a.y)); + a.x = Math.round(a.x / c - d.x); + a.y = Math.round(a.y / c - d.y); + c = this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)); + null != c && (a.x -= c.origin.x, a.y -= c.origin.y); + return a +}; +mxEdgeHandler.prototype.moveLabel = function(a, b, c) { + var d = this.graph.getModel(), + e = d.getGeometry(a.cell); + if (null != e) { + var e = e.clone(), + f = this.graph.getView().getRelativePoint(a, b, c); + e.x = f.x; + e.y = f.y; + var g = this.graph.getView().scale; + e.offset = new mxPoint(0, 0); + f = this.graph.view.getPoint(a, e); + e.offset = new mxPoint((b - f.x) / g, (c - f.y) / g); + d.setGeometry(a.cell, e) + } +}; +mxEdgeHandler.prototype.connect = function(a, b, c, d, e) { + e = this.graph.getModel(); + var f = e.getParent(a); + e.beginUpdate(); + try { + if (d) { + var g = a.clone(); + e.add(f, g, e.getChildCount(f)); + var h = e.getTerminal(a, !c); + this.graph.connectCell(g, h, !c); + a = g + } + var k = this.constraintHandler.currentConstraint; + null == k && (k = new mxConnectionConstraint); + this.graph.connectCell(a, b, c, k) + } finally { + e.endUpdate() + } + return a +}; +mxEdgeHandler.prototype.changeTerminalPoint = function(a, b, c) { + var d = this.graph.getModel(), + e = d.getGeometry(a); + if (null != e) { + d.beginUpdate(); + try { + e = e.clone(), e.setTerminalPoint(b, c), d.setGeometry(a, e), this.graph.connectCell(a, null, c, new mxConnectionConstraint) + } finally { + d.endUpdate() + } + } +}; +mxEdgeHandler.prototype.changePoints = function(a, b) { + var c = this.graph.getModel(), + d = c.getGeometry(a); + null != d && (d = d.clone(), d.points = b, c.setGeometry(a, d)) +}; +mxEdgeHandler.prototype.addPoint = function(a, b) { + var c = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(b), mxEvent.getClientY(b)), + d = this.graph.isGridEnabledEvent(b); + this.convertPoint(c, d); + this.addPointAt(a, c.x, c.y); + mxEvent.consume(b) +}; +mxEdgeHandler.prototype.addPointAt = function(a, b, c) { + var d = this.graph.getCellGeometry(a.cell); + b = new mxPoint(b, c); + if (null != d) { + d = d.clone(); + c = this.graph.view.translate; + var e = this.graph.view.scale; + c = mxUtils.findNearestSegment(a, (b.x + c.x) * e, (b.y + c.y) * e); + null == d.points ? d.points = [b] : d.points.splice(c, 0, b); + this.graph.getModel().setGeometry(a.cell, d); + this.destroy(); + this.init() + } +}; +mxEdgeHandler.prototype.removePoint = function(a, b) { + if (0 < b && b < this.abspoints.length - 1) { + var c = this.graph.getCellGeometry(this.state.cell); + null != c && null != c.points && (c = c.clone(), c.points.splice(b - 1, 1), this.graph.getModel().setGeometry(a.cell, c), this.destroy(), this.init()) + } +}; +mxEdgeHandler.prototype.getHandleFillColor = function(a) { + a = 0 == a; + var b = this.state.cell, + c = this.graph.getModel().getTerminal(b, a), + d = mxConstants.HANDLE_FILLCOLOR; + null != c && !this.graph.isCellDisconnectable(b, c, a) || null == c && !this.graph.isTerminalPointMovable(b, a) ? d = mxConstants.LOCKED_HANDLE_FILLCOLOR : null != c && this.graph.isCellDisconnectable( + b, c, a) && (d = mxConstants.CONNECT_HANDLE_FILLCOLOR); + return d +}; +mxEdgeHandler.prototype.redraw = function() { + this.abspoints = this.state.absolutePoints.slice(); + var a = this.state.cell, + b = mxConstants.LABEL_HANDLE_SIZE; + this.label = new mxPoint(this.state.absoluteOffset.x, this.state.absoluteOffset.y); + this.labelShape.bounds = new mxRectangle(Math.round(this.label.x - b / 2), Math.round(this.label.y - b / 2), b, b); + this.labelShape.redraw(); + b = this.graph.getLabel(a); + null != b && 0 < b.length && this.graph.isLabelMovable(a) ? this.labelShape.node.style.visibility = "visible" : this.labelShape.node.style.visibility = + "hidden"; + if (null != this.bends && 0 < this.bends.length) { + var c = this.abspoints.length - 1, + a = this.abspoints[0], + d = this.abspoints[0].y, + b = this.bends[0].bounds; + this.bends[0].bounds = new mxRectangle(Math.round(this.abspoints[0].x - b.width / 2), Math.round(d - b.height / 2), b.width, b.height); + this.bends[0].fill = this.getHandleFillColor(0); + this.bends[0].redraw(); + var d = this.abspoints[c], + e = this.abspoints[c].x, + c = this.abspoints[c].y, + f = this.bends.length - 1, + b = this.bends[f].bounds; + this.bends[f].bounds = new mxRectangle(Math.round(e - b.width / + 2), Math.round(c - b.height / 2), b.width, b.height); + this.bends[f].fill = this.getHandleFillColor(f); + this.bends[f].redraw(); + this.redrawInnerBends(a, d) + } + this.drawPreview() +}; +mxEdgeHandler.prototype.redrawInnerBends = function(a, b) { + var c = this.graph.getModel().getGeometry(this.state.cell).points; + if (null != c) { + null == this.points && (this.points = []); + for (var d = 1; d < this.bends.length - 1; d++) + if (null != this.bends[d]) + if (null != this.abspoints[d]) { + var e = this.abspoints[d].x, + f = this.abspoints[d].y, + g = this.bends[d].bounds; + this.bends[d].node.style.visibility = "visible"; + this.bends[d].bounds = new mxRectangle(Math.round(e - g.width / 2), Math.round(f - g.height / 2), g.width, g.height); + this.bends[d].redraw(); + this.points[d - + 1] = c[d - 1] + } else this.bends[d].destroy(), this.bends[d] = null + } +}; +mxEdgeHandler.prototype.drawPreview = function() { + if (this.isLabel) { + var a = mxConstants.LABEL_HANDLE_SIZE, + a = new mxRectangle(Math.round(this.label.x - a / 2), Math.round(this.label.y - a / 2), a, a); + this.labelShape.bounds = a; + this.labelShape.redraw() + } else this.shape.points = this.abspoints, this.shape.redraw() +}; +mxEdgeHandler.prototype.destroy = function() { + 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); + if (null != this.bends) + for (var a = 0; a < this.bends.length; a++) null != this.bends[a] && (this.bends[a].destroy(), this.bends[a] = null) +}; + +function mxElbowEdgeHandler(a) { + mxEdgeHandler.call(this, a) +} +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 a = [], + b = this.createHandleShape(0); + this.initBend(b); + b.node.style.cursor = mxConstants.CURSOR_BEND_HANDLE; + mxEvent.redirectMouseEvents(b.node, this.graph, this.state); + a.push(b); + mxClient.IS_TOUCH && b.node.setAttribute("pointer-events", "none"); + a.push(this.createVirtualBend()); + this.points.push(new mxPoint(0, 0)); + b = this.createHandleShape(2); + this.initBend(b); + b.node.style.cursor = mxConstants.CURSOR_BEND_HANDLE; + mxEvent.redirectMouseEvents(b.node, this.graph, this.state); + a.push(b); + mxClient.IS_TOUCH && b.node.setAttribute("pointer-events", "none"); + return a +}; +mxElbowEdgeHandler.prototype.createVirtualBend = function() { + var a = this.createHandleShape(); + this.initBend(a); + var b = this.getCursorForBend(); + a.node.style.cursor = b; + b = mxUtils.bind(this, function(a) { + !mxEvent.isConsumed(a) && this.flipEnabled && (this.graph.flipEdge(this.state.cell, a), mxEvent.consume(a)) + }); + mxEvent.redirectMouseEvents(a.node, this.graph, this.state, null, null, null, b); + this.graph.isCellBendable(this.state.cell) || (a.node.style.display = "none"); + return a +}; +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(a) { + var b = null; + if (null != this.bends && null != this.bends[1] && (a == this.bends[1].node || a.parentNode == this.bends[1].node)) b = this.doubleClickOrientationResource, b = mxResources.get(b) || b; + return b +}; +mxElbowEdgeHandler.prototype.convertPoint = function(a, b) { + var c = this.graph.getView().getScale(), + d = this.graph.getView().getTranslate(), + e = this.state.origin; + b && (a.x = this.graph.snap(a.x), a.y = this.graph.snap(a.y)); + a.x = Math.round(a.x / c - d.x - e.x); + a.y = Math.round(a.y / c - d.y - e.y) +}; +mxElbowEdgeHandler.prototype.redrawInnerBends = function(a, b) { + var c = this.graph.getModel().getGeometry(this.state.cell).points, + c = null != c ? c[0] : null, + c = null == c ? new mxPoint(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2) : new mxPoint(this.graph.getView().scale * (c.x + this.graph.getView().translate.x + this.state.origin.x), this.graph.getView() + .scale * (c.y + this.graph.getView().translate.y + this.state.origin.y)), + d = this.bends[1].bounds, + e = d.width, + d = d.height; + null == this.handleImage && (d = e = mxConstants.HANDLE_SIZE); + var f = new mxRectangle(Math.round(c.x - + e / 2), Math.round(c.y - d / 2), e, d); + null == this.handleImage && ("hidden" != this.labelShape.node.style.visibility && mxUtils.intersects(f, this.labelShape.bounds)) && (e += 3, d += 3, f = new mxRectangle(Math.round(c.x - e / 2), + Math.round(c.y - d / 2), e, d)); + this.bends[1].bounds = f; + this.bends[1].redraw() +}; + +function mxEdgeSegmentHandler(a) { + mxEdgeHandler.call(this, a) +} +mxUtils.extend(mxEdgeSegmentHandler, mxEdgeHandler); +mxEdgeSegmentHandler.prototype = new mxElbowEdgeHandler; +mxEdgeSegmentHandler.prototype.constructor = mxEdgeSegmentHandler; +mxEdgeSegmentHandler.prototype.getPreviewPoints = function(a) { + if (this.isSource || this.isTarget) return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this, arguments); + this.convertPoint(a, !1); + var b = this.state.absolutePoints, + c = b[0].clone(); + this.convertPoint(c, !1); + for (var d = [], e = 1; e < b.length; e++) { + var f = b[e].clone(); + this.convertPoint(f, !1); + e == this.index && (c.x == f.x ? (c.x = a.x, f.x = a.x) : (c.y = a.y, f.y = a.y)); + e < b.length - 1 && d.push(f); + c = f + } + if (1 == d.length) { + if (c = this.state.view, e = this.state.getVisibleTerminalState(!0), + f = this.state.getVisibleTerminalState(!1), null != f & null != e) { + var g = this.state.origin.x, + h = this.state.origin.y; + mxUtils.contains(f, d[0].x + g, d[0].y + h) ? b[1].y == b[2].y ? d[0].y = c.getRoutingCenterY(e) - h : d[0].x = c.getRoutingCenterX(e) - g : mxUtils.contains(e, d[0].x + g, d[0].y + h) && (b[ + 1].y == b[0].y ? d[0].y = c.getRoutingCenterY(f) - h : d[0].x = c.getRoutingCenterX(f) - g) + } + } else 0 == d.length && (d = [a]); + return d +}; +mxEdgeSegmentHandler.prototype.createBends = function() { + var a = [], + b = this.createHandleShape(0); + this.initBend(b); + b.node.style.cursor = mxConstants.CURSOR_BEND_HANDLE; + mxEvent.redirectMouseEvents(b.node, this.graph, this.state); + a.push(b); + mxClient.IS_TOUCH && b.node.setAttribute("pointer-events", "none"); + var c = this.state.absolutePoints; + if (this.graph.isCellBendable(this.state.cell)) { + null == this.points && (this.points = []); + for (var d = 0; d < c.length - 1; d++) b = this.createVirtualBend(), a.push(b), b.node.style.cursor = 0 == c[d].x - + c[d + 1].x ? "col-resize" : "row-resize", this.points.push(new mxPoint(0, 0)), mxClient.IS_TOUCH && b.node.setAttribute("pointer-events", "none") + } + b = this.createHandleShape(c.length); + this.initBend(b); + b.node.style.cursor = mxConstants.CURSOR_BEND_HANDLE; + mxEvent.redirectMouseEvents(b.node, this.graph, this.state); + a.push(b); + mxClient.IS_TOUCH && b.node.setAttribute("pointer-events", "none"); + return a +}; +mxEdgeSegmentHandler.prototype.redraw = function() { + this.refresh(); + mxEdgeHandler.prototype.redraw.apply(this, arguments) +}; +mxEdgeSegmentHandler.prototype.refresh = function() { + if (null != this.bends) { + for (var a = 0; a < this.bends.length; a++) null != this.bends[a] && (this.bends[a].destroy(), this.bends[a] = null); + this.bends = this.createBends() + } +}; +mxEdgeSegmentHandler.prototype.redrawInnerBends = function(a, b) { + if (this.graph.isCellBendable(this.state.cell)) { + var c = mxConstants.HANDLE_SIZE, + d = this.state.absolutePoints; + if (null != d && 1 < d.length) + for (var e = 0; e < this.state.absolutePoints.length - 1; e++) + if (null != this.bends[e + 1]) { + a = d[e]; + b = d[e + 1]; + var f = new mxPoint(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2); + this.bends[e + 1].bounds = new mxRectangle(Math.round(f.x - c / 2), Math.round(f.y - c / 2), c, c); + this.bends[e + 1].redraw() + } + } +}; +mxEdgeSegmentHandler.prototype.changePoints = function(a, b) { + b = []; + var c = this.abspoints; + if (1 < c.length) + for (var d = c[0], e = c[1], f = 2; f < c.length; f++) { + var g = c[f]; + if ((Math.round(d.x) != Math.round(e.x) || Math.round(e.x) != Math.round(g.x)) && (Math.round(d.y) != Math.round(e.y) || Math.round(e.y) != Math.round(g.y))) d = e, e = e.clone(), this.convertPoint( + e, !1), b.push(e); + e = g + } + mxElbowEdgeHandler.prototype.changePoints.apply(this, arguments) +}; + +function mxKeyHandler(a, b) { + null != a && (this.graph = a, this.target = b || document.documentElement, this.normalKeys = [], this.shiftKeys = [], this.controlKeys = [], this.controlShiftKeys = [], mxEvent.addListener(this.target, + "keydown", mxUtils.bind(this, function(a) { + this.keyDown(a) + })), mxClient.IS_IE && mxEvent.addListener(window, "unload", mxUtils.bind(this, function() { + this.destroy() + }))) +} +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(a) { + this.enabled = a +}; +mxKeyHandler.prototype.bindKey = function(a, b) { + this.normalKeys[a] = b +}; +mxKeyHandler.prototype.bindShiftKey = function(a, b) { + this.shiftKeys[a] = b +}; +mxKeyHandler.prototype.bindControlKey = function(a, b) { + this.controlKeys[a] = b +}; +mxKeyHandler.prototype.bindControlShiftKey = function(a, b) { + this.controlShiftKeys[a] = b +}; +mxKeyHandler.prototype.isControlDown = function(a) { + return mxEvent.isControlDown(a) +}; +mxKeyHandler.prototype.getFunction = function(a) { + return null != a ? this.isControlDown(a) ? mxEvent.isShiftDown(a) ? this.controlShiftKeys[a.keyCode] : this.controlKeys[a.keyCode] : mxEvent.isShiftDown(a) ? this.shiftKeys[a.keyCode] : this.normalKeys[ + a.keyCode] : null +}; +mxKeyHandler.prototype.isGraphEvent = function(a) { + a = mxEvent.getSource(a); + if (a == this.target || a.parentNode == this.target || null != this.graph.cellEditor && a == this.graph.cellEditor.textarea) return !0; + for (; null != a;) { + if (a == this.graph.container) return !0; + a = a.parentNode + } + return !1 +}; +mxKeyHandler.prototype.keyDown = function(a) { + if (this.graph.isEnabled() && !mxEvent.isConsumed(a) && this.isGraphEvent(a) && this.isEnabled()) + if (27 == a.keyCode) this.escape(a); + else if (!this.graph.isEditing()) { + var b = this.getFunction(a); + null != b && (b(a), mxEvent.consume(a)) + } +}; +mxKeyHandler.prototype.escape = function(a) { + this.graph.isEscapeEnabled() && this.graph.escape(a) +}; +mxKeyHandler.prototype.destroy = function() { + this.target = null +}; + +function mxTooltipHandler(a, b) { + null != a && (this.graph = a, this.delay = b || 500, this.graph.addMouseListener(this)) +} +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(a) { + this.enabled = a +}; +mxTooltipHandler.prototype.isHideOnHover = function() { + return this.hideOnHover +}; +mxTooltipHandler.prototype.setHideOnHover = function(a) { + this.hideOnHover = a +}; +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(a) { + this.hideTooltip() + }))) +}; +mxTooltipHandler.prototype.mouseDown = function(a, b) { + this.reset(b, !1); + this.hideTooltip() +}; +mxTooltipHandler.prototype.mouseMove = function(a, b) { + if (b.getX() != this.lastX || b.getY() != this.lastY) this.reset(b, !0), (this.isHideOnHover() || b.getState() != this.state || b.getSource() != this.node && (!this.stateSource || null != b.getState() && + this.stateSource == (b.isSource(b.getState().shape) || !b.isSource(b.getState().text)))) && this.hideTooltip(); + this.lastX = b.getX(); + this.lastY = b.getY() +}; +mxTooltipHandler.prototype.mouseUp = function(a, b) { + this.reset(b, !0); + this.hideTooltip() +}; +mxTooltipHandler.prototype.resetTimer = function() { + null != this.thread && (window.clearTimeout(this.thread), this.thread = null) +}; +mxTooltipHandler.prototype.reset = function(a, b) { + this.resetTimer(); + if (b && this.isEnabled() && null != a.getState() && (null == this.div || "hidden" == this.div.style.visibility)) { + var c = a.getState(), + d = a.getSource(), + e = a.getX(), + f = a.getY(), + g = a.isSource(c.shape) || a.isSource(c.text); + this.thread = window.setTimeout(mxUtils.bind(this, function() { + if (!this.graph.isEditing() && !this.graph.panningHandler.isMenuShowing()) { + var a = this.graph.getTooltip(c, d, e, f); + this.show(a, e, f); + this.state = c; + this.node = d; + this.stateSource = g + } + }), 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(a, b, c) { + if (null != a && 0 < a.length) { + null == this.div && this.init(); + var d = mxUtils.getScrollOrigin(); + this.div.style.left = b + d.x + "px"; + this.div.style.top = c + mxConstants.TOOLTIP_VERTICAL_OFFSET + d.y + "px"; + mxUtils.isNode(a) ? (this.div.innerHTML = "", this.div.appendChild(a)) : this.div.innerHTML = a.replace(/\n/g, "\x3cbr\x3e"); + 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 +}; + +function mxCellTracker(a, b, c) { + mxCellMarker.call(this, a, b); + this.graph.addMouseListener(this); + null != c && (this.getCell = c); + mxClient.IS_IE && mxEvent.addListener(window, "unload", mxUtils.bind(this, function() { + this.destroy() + })) +} +mxUtils.extend(mxCellTracker, mxCellMarker); +mxCellTracker.prototype.mouseDown = function(a, b) {}; +mxCellTracker.prototype.mouseMove = function(a, b) { + this.isEnabled() && this.process(b) +}; +mxCellTracker.prototype.mouseUp = function(a, b) { + this.reset() +}; +mxCellTracker.prototype.destroy = function() { + this.destroyed || (this.destroyed = !0, this.graph.removeMouseListener(this), mxCellMarker.prototype.destroy.apply(this)) +}; + +function mxCellHighlight(a, b, c, d) { + null != a && (this.graph = a, this.highlightColor = null != b ? b : mxConstants.DEFAULT_VALID_COLOR, this.strokeWidth = null != c ? c : mxConstants.HIGHLIGHT_STROKEWIDTH, this.dashed = null != d ? + d : !1, 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)) +} +mxCellHighlight.prototype.keepOnTop = !1; +mxCellHighlight.prototype.graph = !0; +mxCellHighlight.prototype.state = null; +mxCellHighlight.prototype.spacing = 2; +mxCellHighlight.prototype.resetHandler = null; +mxCellHighlight.prototype.setHighlightColor = function(a) { + this.highlightColor = a; + null != this.shape && (this.shape.stroke = a) +}; +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 a = null, + a = 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); + a.dialect = this.graph.dialect != mxConstants.DIALECT_SVG ? mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; + a.init(this.graph.getView().getOverlayPane()); + mxEvent.redirectMouseEvents(a.node, this.graph, this.state); + a.svgStrokeTolerance = 0; + a.pointerEvents = !1; + a.isDashed = this.dashed; + return a +}; +mxCellHighlight.prototype.repaint = function() { + if (null != this.state && null != this.shape) { + var a = 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), a = Number(this.state.style[mxConstants.STYLE_ROTATION] || "0")); + null != this.state.shape && this.shape.setCursor(this.state.shape.getCursor()); + 0 != a && (this.shape.rotation = a); + this.shape.redraw() + } +}; +mxCellHighlight.prototype.hide = function() { + this.highlight(null) +}; +mxCellHighlight.prototype.highlight = function(a) { + this.state != a && (null != this.shape && (this.shape.destroy(), this.shape = null), this.state = a, 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) +}; + +function mxDefaultKeyHandler(a) { + if (null != a) { + this.editor = a; + this.handler = new mxKeyHandler(a.graph); + var b = this.handler.escape; + this.handler.escape = function(c) { + b.apply(this, arguments); + a.hideProperties(); + a.fireEvent(new mxEventObject(mxEvent.ESCAPE, "event", c)) + } + } +} +mxDefaultKeyHandler.prototype.editor = null; +mxDefaultKeyHandler.prototype.handler = null; +mxDefaultKeyHandler.prototype.bindAction = function(a, b, c) { + var d = mxUtils.bind(this, function() { + this.editor.execute(b) + }); + c ? this.handler.bindControlKey(a, d) : this.handler.bindKey(a, d) +}; +mxDefaultKeyHandler.prototype.destroy = function() { + this.handler.destroy(); + this.handler = null +}; + +function mxDefaultPopupMenu(a) { + this.config = a +} +mxDefaultPopupMenu.prototype.imageBasePath = null; +mxDefaultPopupMenu.prototype.config = null; +mxDefaultPopupMenu.prototype.createMenu = function(a, b, c, d) { + if (null != this.config) { + var e = this.createConditions(a, c, d); + this.addItems(a, b, c, d, e, this.config.firstChild, null) + } +}; +mxDefaultPopupMenu.prototype.addItems = function(a, b, c, d, e, f, g) { + for (var h = !1; null != f;) { + if ("add" == f.nodeName) { + var k = f.getAttribute("if"); + if (null == k || e[k]) { + var k = f.getAttribute("as"), + k = mxResources.get(k) || k, + l = mxUtils.eval(mxUtils.getTextContent(f)), + m = f.getAttribute("action"), + n = f.getAttribute("icon"), + p = f.getAttribute("iconCls"); + h && (b.addSeparator(g), h = !1); + null != n && this.imageBasePath && (n = this.imageBasePath + n); + k = this.addAction(b, a, k, n, l, m, c, g, p); + this.addItems(a, b, c, d, e, f.firstChild, k) + } + } else "separator" == + f.nodeName && (h = !0); + f = f.nextSibling + } +}; +mxDefaultPopupMenu.prototype.addAction = function(a, b, c, d, e, f, g, h, k) { + return a.addItem(c, d, function(a) { + "function" == typeof e && e.call(b, b, g, a); + null != f && b.execute(f, g, a) + }, h, k) +}; +mxDefaultPopupMenu.prototype.createConditions = function(a, b, c) { + var d = a.graph.getModel(), + e = d.getChildCount(b), + f = []; + f.nocell = null == b; + f.ncells = 1 < a.graph.getSelectionCount(); + f.notRoot = d.getRoot() != d.getParent(a.graph.getDefaultParent()); + f.cell = null != b; + d = null != b && 1 == a.graph.getSelectionCount(); + f.nonEmpty = d && 0 < e; + f.expandable = d && a.graph.isCellFoldable(b, !1); + f.collapsable = d && a.graph.isCellFoldable(b, !0); + f.validRoot = d && a.graph.isValidRoot(b); + f.emptyValidRoot = f.validRoot && 0 == e; + f.swimlane = d && a.graph.isSwimlane(b); + e = this.config.getElementsByTagName("condition"); + for (d = 0; d < e.length; d++) { + var g = mxUtils.eval(mxUtils.getTextContent(e[d])), + h = e[d].getAttribute("name"); + null != h && "function" == typeof g && (f[h] = g(a, b, c)) + } + return f +}; + +function mxDefaultToolbar(a, b) { + this.editor = b; + null != a && null != b && this.init(a) +} +mxDefaultToolbar.prototype.editor = null; +mxDefaultToolbar.prototype.toolbar = null; +mxDefaultToolbar.prototype.resetHandler = null; +mxDefaultToolbar.prototype.spacing = 4; +mxDefaultToolbar.prototype.connectOnDrop = !1; +mxDefaultToolbar.prototype.init = function(a) { + null != a && (this.toolbar = new mxToolbar(a), this.toolbar.addListener(mxEvent.SELECT, mxUtils.bind(this, function(a, c) { + var d = c.getProperty("function"); + this.editor.insertFunction = null != d ? mxUtils.bind(this, function() { + d.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(a, b, c, d) { + var e = mxUtils.bind(this, function() { + null != c && 0 < c.length && this.editor.execute(c) + }); + return this.toolbar.addItem(a, b, e, d) +}; +mxDefaultToolbar.prototype.addSeparator = function(a) { + a = a || mxClient.imageBasePath + "/separator.gif"; + this.toolbar.addSeparator(a) +}; +mxDefaultToolbar.prototype.addCombo = function() { + return this.toolbar.addCombo() +}; +mxDefaultToolbar.prototype.addActionCombo = function(a) { + return this.toolbar.addActionCombo(a) +}; +mxDefaultToolbar.prototype.addActionOption = function(a, b, c) { + var d = mxUtils.bind(this, function() { + this.editor.execute(c) + }); + this.addOption(a, b, d) +}; +mxDefaultToolbar.prototype.addOption = function(a, b, c) { + return this.toolbar.addOption(a, b, c) +}; +mxDefaultToolbar.prototype.addMode = function(a, b, c, d, e) { + var f = mxUtils.bind(this, function() { + this.editor.setMode(c); + null != e && e(this.editor) + }); + return this.toolbar.addSwitchMode(a, b, f, d) +}; +mxDefaultToolbar.prototype.addPrototype = function(a, b, c, d, e, f) { + var g = function() { + return "function" == typeof c ? c() : null != c ? c.clone() : null + }, + h = mxUtils.bind(this, function(a, b) { + "function" == typeof e ? e(this.editor, g(), a, b) : this.drop(g(), a, b); + this.toolbar.resetMode(); + mxEvent.consume(a) + }); + a = this.toolbar.addMode(a, b, h, d, null, f); + this.installDropHandler(a, function(a, b, c) { + h(b, c) + }); + return a +}; +mxDefaultToolbar.prototype.drop = function(a, b, c) { + var d = this.editor.graph, + e = d.getModel(); + if (null == c || e.isEdge(c) || !this.connectOnDrop || !d.isCellConnectable(c)) { + for (; null != c && !d.isValidDropTarget(c, [a], b);) c = e.getParent(c); + this.insert(a, b, c) + } else this.connect(a, b, c) +}; +mxDefaultToolbar.prototype.insert = function(a, b, c) { + var d = this.editor.graph; + if (d.canImportCell(a)) { + var e = mxEvent.getClientX(b), + f = mxEvent.getClientY(b), + e = mxUtils.convertPoint(d.container, e, f); + return d.isSplitEnabled() && d.isSplitTarget(c, [a], b) ? d.splitEdge(c, [a], null, e.x, e.y) : this.editor.addVertex(c, a, e.x, e.y) + } + return null +}; +mxDefaultToolbar.prototype.connect = function(a, b, c) { + b = this.editor.graph; + var d = b.getModel(); + if (null != c && b.isCellConnectable(a) && b.isEdgeValid(null, c, a)) { + var e = null; + d.beginUpdate(); + try { + var f = d.getGeometry(c), + g = d.getGeometry(a).clone(); + g.x = f.x + (f.width - g.width) / 2; + g.y = f.y + (f.height - g.height) / 2; + var h = this.spacing * b.gridSize, + k = 20 * d.getDirectedEdgeCount(c, !0); + this.editor.horizontalFlow ? g.x += (g.width + f.width) / 2 + h + k : g.y += (g.height + f.height) / 2 + h + k; + a.setGeometry(g); + var l = d.getParent(c); + b.addCell(a, l); + b.constrainChild(a); + e = this.editor.createEdge(c, a); + if (null == d.getGeometry(e)) { + var m = new mxGeometry; + m.relative = !0; + d.setGeometry(e, m) + } + b.addEdge(e, l, c, a) + } finally { + d.endUpdate() + } + b.setSelectionCells([a, e]); + b.scrollCellToVisible(a) + } +}; +mxDefaultToolbar.prototype.installDropHandler = function(a, b) { + var c = document.createElement("img"); + c.setAttribute("src", a.getAttribute("src")); + var d = mxUtils.bind(this, function(e) { + c.style.width = 2 * a.offsetWidth + "px"; + c.style.height = 2 * a.offsetHeight + "px"; + mxUtils.makeDraggable(a, this.editor.graph, b, c); + mxEvent.removeListener(c, "load", d) + }); + mxClient.IS_IE ? d() : mxEvent.addListener(c, "load", d) +}; +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) +}; + +function mxEditor(a) { + this.actions = []; + this.addActions(); + if (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(a); + this.graph.swimlaneIndicatorColorAttribute = this.cycleAttributeName; + !mxClient.IS_LOCAL && null != this.urlInit && (this.session = this.createSession()); + if (null != this.onInit) this.onInit(); + mxClient.IS_IE && + mxEvent.addListener(window, "unload", mxUtils.bind(this, function() { + this.destroy() + })) + } +} +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 = "\x26#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(a) { + this.modified = a +}; +mxEditor.prototype.addActions = function() { + this.addAction("save", function(a) { + a.save() + }); + this.addAction("print", function(a) { + (new mxPrintPreview(a.graph, 1)).open() + }); + this.addAction("show", function(a) { + mxUtils.show(a.graph, null, 10, 10) + }); + this.addAction("exportImage", function(a) { + var b = a.getUrlImage(); + if (null == b || mxClient.IS_LOCAL) a.execute("show"); + else { + var c = mxUtils.getViewXml(a.graph, 1), + c = mxUtils.getXml(c, "\n"); + mxUtils.submit(b, a.postParameterName + "\x3d" + encodeURIComponent(c), document, "_blank") + } + }); + this.addAction("refresh", + function(a) { + a.graph.refresh() + }); + this.addAction("cut", function(a) { + a.graph.isEnabled() && mxClipboard.cut(a.graph) + }); + this.addAction("copy", function(a) { + a.graph.isEnabled() && mxClipboard.copy(a.graph) + }); + this.addAction("paste", function(a) { + a.graph.isEnabled() && mxClipboard.paste(a.graph) + }); + this.addAction("delete", function(a) { + a.graph.isEnabled() && a.graph.removeCells() + }); + this.addAction("group", function(a) { + a.graph.isEnabled() && a.graph.setSelectionCell(a.groupCells()) + }); + this.addAction("ungroup", function(a) { + a.graph.isEnabled() && + a.graph.setSelectionCells(a.graph.ungroupCells()) + }); + this.addAction("removeFromParent", function(a) { + a.graph.isEnabled() && a.graph.removeCellsFromParent() + }); + this.addAction("undo", function(a) { + a.graph.isEnabled() && a.undo() + }); + this.addAction("redo", function(a) { + a.graph.isEnabled() && a.redo() + }); + this.addAction("zoomIn", function(a) { + a.graph.zoomIn() + }); + this.addAction("zoomOut", function(a) { + a.graph.zoomOut() + }); + this.addAction("actualSize", function(a) { + a.graph.zoomActual() + }); + this.addAction("fit", function(a) { + a.graph.fit() + }); + this.addAction("showProperties", function(a, b) { + a.showProperties(b) + }); + this.addAction("selectAll", function(a) { + a.graph.isEnabled() && a.graph.selectAll() + }); + this.addAction("selectNone", function(a) { + a.graph.isEnabled() && a.graph.clearSelection() + }); + this.addAction("selectVertices", function(a) { + a.graph.isEnabled() && a.graph.selectVertices() + }); + this.addAction("selectEdges", function(a) { + a.graph.isEnabled() && a.graph.selectEdges() + }); + this.addAction("edit", function(a, b) { + a.graph.isEnabled() && a.graph.isCellEditable(b) && a.graph.startEditingAtCell(b) + }); + this.addAction("toBack", function(a, b) { + a.graph.isEnabled() && a.graph.orderCells(!0) + }); + this.addAction("toFront", function(a, b) { + a.graph.isEnabled() && a.graph.orderCells(!1) + }); + this.addAction("enterGroup", function(a, b) { + a.graph.enterGroup(b) + }); + this.addAction("exitGroup", function(a) { + a.graph.exitGroup() + }); + this.addAction("home", function(a) { + a.graph.home() + }); + this.addAction("selectPrevious", function(a) { + a.graph.isEnabled() && a.graph.selectPreviousCell() + }); + this.addAction("selectNext", function(a) { + a.graph.isEnabled() && + a.graph.selectNextCell() + }); + this.addAction("selectParent", function(a) { + a.graph.isEnabled() && a.graph.selectParentCell() + }); + this.addAction("selectChild", function(a) { + a.graph.isEnabled() && a.graph.selectChildCell() + }); + this.addAction("collapse", function(a) { + a.graph.isEnabled() && a.graph.foldCells(!0) + }); + this.addAction("collapseAll", function(a) { + if (a.graph.isEnabled()) { + var b = a.graph.getChildVertices(); + a.graph.foldCells(!0, !1, b) + } + }); + this.addAction("expand", function(a) { + a.graph.isEnabled() && a.graph.foldCells(!1) + }); + this.addAction("expandAll", function(a) { + if (a.graph.isEnabled()) { + var b = a.graph.getChildVertices(); + a.graph.foldCells(!1, !1, b) + } + }); + this.addAction("bold", function(a) { + a.graph.isEnabled() && a.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, mxConstants.FONT_BOLD) + }); + this.addAction("italic", function(a) { + a.graph.isEnabled() && a.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, mxConstants.FONT_ITALIC) + }); + this.addAction("underline", function(a) { + a.graph.isEnabled() && a.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, + mxConstants.FONT_UNDERLINE) + }); + this.addAction("shadow", function(a) { + a.graph.isEnabled() && a.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, mxConstants.FONT_SHADOW) + }); + this.addAction("alignCellsLeft", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_LEFT) + }); + this.addAction("alignCellsCenter", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_CENTER) + }); + this.addAction("alignCellsRight", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_RIGHT) + }); + this.addAction("alignCellsTop", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_TOP) + }); + this.addAction("alignCellsMiddle", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_MIDDLE) + }); + this.addAction("alignCellsBottom", function(a) { + a.graph.isEnabled() && a.graph.alignCells(mxConstants.ALIGN_BOTTOM) + }); + this.addAction("alignFontLeft", function(a) { + a.graph.setCellStyles(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_LEFT) + }); + this.addAction("alignFontCenter", function(a) { + a.graph.isEnabled() && + a.graph.setCellStyles(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER) + }); + this.addAction("alignFontRight", function(a) { + a.graph.isEnabled() && a.graph.setCellStyles(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_RIGHT) + }); + this.addAction("alignFontTop", function(a) { + a.graph.isEnabled() && a.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_TOP) + }); + this.addAction("alignFontMiddle", function(a) { + a.graph.isEnabled() && a.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE) + }); + this.addAction("alignFontBottom", function(a) { + a.graph.isEnabled() && a.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_BOTTOM) + }); + this.addAction("zoom", function(a) { + var b = 100 * a.graph.getView().scale, + b = parseFloat(mxUtils.prompt(mxResources.get(a.askZoomResource) || a.askZoomResource, b)) / 100; + isNaN(b) || a.graph.getView().setScale(b) + }); + this.addAction("toggleTasks", function(a) { + null != a.tasks ? a.tasks.setVisible(!a.tasks.isVisible()) : a.showTasks() + }); + this.addAction("toggleHelp", function(a) { + null != + a.help ? a.help.setVisible(!a.help.isVisible()) : a.showHelp() + }); + this.addAction("toggleOutline", function(a) { + null == a.outline ? a.showOutline() : a.outline.setVisible(!a.outline.isVisible()) + }); + this.addAction("toggleConsole", function(a) { + mxLog.setVisible(!mxLog.isVisible()) + }) +}; +mxEditor.prototype.createSession = function() { + var a = mxUtils.bind(this, function(a) { + this.fireEvent(new mxEventObject(mxEvent.SESSION, "session", a)) + }); + return this.connect(this.urlInit, this.urlPoll, this.urlNotify, a) +}; +mxEditor.prototype.configure = function(a) { + null != a && ((new mxCodec(a.ownerDocument)).decode(a, this), this.resetHistory()) +}; +mxEditor.prototype.resetFirstTime = function() { + document.cookie = "mxgraph\x3dseen; expires\x3dFri, 27 Jul 2001 02:47:11 UTC; path\x3d/" +}; +mxEditor.prototype.resetHistory = function() { + this.lastSnapshot = (new Date).getTime(); + this.undoManager.clear(); + this.ignoredChanges = 0; + this.setModified(!1) +}; +mxEditor.prototype.addAction = function(a, b) { + this.actions[a] = b +}; +mxEditor.prototype.execute = function(a, b, c) { + var d = this.actions[a]; + if (null != d) try { + var e = arguments; + e[0] = this; + d.apply(this, e) + } catch (f) { + throw mxUtils.error("Cannot execute " + a + ": " + f.message, 280, !0), f; + } else mxUtils.error("Cannot find action " + a, 280, !0) +}; +mxEditor.prototype.addTemplate = function(a, b) { + this.templates[a] = b +}; +mxEditor.prototype.getTemplate = function(a) { + return this.templates[a] +}; +mxEditor.prototype.createGraph = function() { + var a = new mxGraph(null, null, this.graphRenderHint); + a.setTooltips(!0); + a.setPanning(!0); + this.installDblClickHandler(a); + this.installUndoHandler(a); + this.installDrillHandler(a); + this.installChangeHandler(a); + this.installInsertHandler(a); + a.panningHandler.factoryMethod = mxUtils.bind(this, function(a, c, d) { + return this.createPopupMenu(a, c, d) + }); + a.connectionHandler.factoryMethod = mxUtils.bind(this, function(a, c) { + return this.createEdge(a, c) + }); + this.createSwimlaneManager(a); + this.createLayoutManager(a); + return a +}; +mxEditor.prototype.createSwimlaneManager = function(a) { + a = new mxSwimlaneManager(a, !1); + a.isHorizontal = mxUtils.bind(this, function() { + return this.horizontalFlow + }); + a.isEnabled = mxUtils.bind(this, function() { + return this.maintainSwimlanes + }); + return a +}; +mxEditor.prototype.createLayoutManager = function(a) { + var b = new mxLayoutManager(a), + c = this; + b.getLayout = function(b) { + var e = null, + f = c.graph.getModel(); + if (null != f.getParent(b)) + if (c.layoutSwimlanes && a.isSwimlane(b)) null == c.swimlaneLayout && (c.swimlaneLayout = c.createSwimlaneLayout()), e = c.swimlaneLayout; + else if (c.layoutDiagram && (a.isValidRoot(b) || null == f.getParent(f.getParent(b)))) null == c.diagramLayout && (c.diagramLayout = c.createDiagramLayout()), e = c.diagramLayout; + return e + }; + return b +}; +mxEditor.prototype.setGraphContainer = function(a) { + null == this.graph.container && (this.graph.init(a), this.rubberband = new mxRubberband(this.graph), this.disableContextMenu && mxEvent.disableContextMenu(a), mxClient.IS_QUIRKS && new mxDivResizer( + a)) +}; +mxEditor.prototype.installDblClickHandler = function(a) { + a.addListener(mxEvent.DOUBLE_CLICK, mxUtils.bind(this, function(b, c) { + var d = c.getProperty("cell"); + null != d && (a.isEnabled() && null != this.dblClickAction) && (this.execute(this.dblClickAction, d), c.consume()) + })) +}; +mxEditor.prototype.installUndoHandler = function(a) { + var b = mxUtils.bind(this, function(a, b) { + var e = b.getProperty("edit"); + this.undoManager.undoableEditHappened(e) + }); + a.getModel().addListener(mxEvent.UNDO, b); + a.getView().addListener(mxEvent.UNDO, b); + b = function(b, d) { + var e = d.getProperty("edit").changes; + a.setSelectionCells(a.getSelectionCellsForChanges(e)) + }; + this.undoManager.addListener(mxEvent.UNDO, b); + this.undoManager.addListener(mxEvent.REDO, b) +}; +mxEditor.prototype.installDrillHandler = function(a) { + var b = mxUtils.bind(this, function(a) { + this.fireEvent(new mxEventObject(mxEvent.ROOT)) + }); + a.getView().addListener(mxEvent.DOWN, b); + a.getView().addListener(mxEvent.UP, b) +}; +mxEditor.prototype.installChangeHandler = function(a) { + var b = mxUtils.bind(this, function(b, d) { + this.setModified(!0); + !0 == this.validating && a.validateGraph(); + for (var e = d.getProperty("edit").changes, f = 0; f < e.length; f++) { + var g = e[f]; + if (g instanceof mxRootChange || g instanceof mxValueChange && g.cell == this.graph.model.root || g instanceof mxCellAttributeChange && g.cell == this.graph.model.root) { + this.fireEvent(new mxEventObject(mxEvent.ROOT)); + break + } + } + }); + a.getModel().addListener(mxEvent.CHANGE, b) +}; +mxEditor.prototype.installInsertHandler = function(a) { + var b = this; + a.addMouseListener({ + mouseDown: function(a, d) { + if (null != b.insertFunction && !d.isPopupTrigger() && (b.forcedInserting || null == d.getState())) b.graph.clearSelection(), b.insertFunction(d.getEvent(), d.getCell()), this.isActive = ! + 0, d.consume() + }, + mouseMove: function(a, b) { + this.isActive && b.consume() + }, + mouseUp: function(a, b) { + this.isActive && (this.isActive = !1, b.consume()) + } + }) +}; +mxEditor.prototype.createDiagramLayout = function() { + var a = this.graph.gridSize, + b = new mxStackLayout(this.graph, !this.horizontalFlow, this.swimlaneSpacing, 2 * a, 2 * a); + b.isVertexIgnored = function(a) { + return !b.graph.isSwimlane(a) + }; + return b +}; +mxEditor.prototype.createSwimlaneLayout = function() { + return new mxCompactTreeLayout(this.graph, this.horizontalFlow) +}; +mxEditor.prototype.createToolbar = function() { + return new mxDefaultToolbar(null, this) +}; +mxEditor.prototype.setToolbarContainer = function(a) { + this.toolbar.init(a); + mxClient.IS_QUIRKS && new mxDivResizer(a) +}; +mxEditor.prototype.setStatusContainer = function(a) { + null == this.status && (this.status = a, this.addListener(mxEvent.SAVE, mxUtils.bind(this, function() { + var a = (new Date).toLocaleString(); + this.setStatus((mxResources.get(this.lastSavedResource) || this.lastSavedResource) + ": " + a) + })), this.addListener(mxEvent.OPEN, mxUtils.bind(this, function() { + this.setStatus((mxResources.get(this.currentFileResource) || this.currentFileResource) + ": " + this.filename) + })), mxClient.IS_QUIRKS && new mxDivResizer(a)) +}; +mxEditor.prototype.setStatus = function(a) { + null != this.status && null != a && (this.status.innerHTML = a) +}; +mxEditor.prototype.setTitleContainer = function(a) { + this.addListener(mxEvent.ROOT, mxUtils.bind(this, function(b) { + a.innerHTML = this.getTitle() + })); + mxClient.IS_QUIRKS && new mxDivResizer(a) +}; +mxEditor.prototype.treeLayout = function(a, b) { + null != a && (new mxCompactTreeLayout(this.graph, b)).execute(a) +}; +mxEditor.prototype.getTitle = function() { + for (var a = "", b = this.graph, c = b.getCurrentRoot(); null != c && null != b.getModel().getParent(b.getModel().getParent(c));) b.isValidRoot(c) && (a = " \x3e " + b.convertValueToString(c) + a), + c = b.getModel().getParent(c); + return this.getRootTitle() + a +}; +mxEditor.prototype.getRootTitle = function() { + var a = this.graph.getModel().getRoot(); + return this.graph.convertValueToString(a) +}; +mxEditor.prototype.undo = function() { + this.undoManager.undo() +}; +mxEditor.prototype.redo = function() { + this.undoManager.redo() +}; +mxEditor.prototype.groupCells = function() { + var a = null != this.groupBorderSize ? this.groupBorderSize : this.graph.gridSize; + return this.graph.groupCells(this.createGroup(), a) +}; +mxEditor.prototype.createGroup = function() { + return this.graph.getModel().cloneCell(this.defaultGroup) +}; +mxEditor.prototype.open = function(a) { + if (null != a) { + var b = mxUtils.load(a).getXml(); + this.readGraphModel(b.documentElement); + this.filename = a; + this.fireEvent(new mxEventObject(mxEvent.OPEN, "filename", a)) + } +}; +mxEditor.prototype.readGraphModel = function(a) { + (new mxCodec(a.ownerDocument)).decode(a, this.graph.getModel()); + this.resetHistory() +}; +mxEditor.prototype.save = function(a, b) { + a = a || this.getUrlPost(); + if (null != a && 0 < a.length) { + var c = this.writeGraphModel(b); + this.postDiagram(a, c); + this.setModified(!1) + } + this.fireEvent(new mxEventObject(mxEvent.SAVE, "url", a)) +}; +mxEditor.prototype.postDiagram = function(a, b) { + this.escapePostData && (b = encodeURIComponent(b)); + mxUtils.post(a, this.postParameterName + "\x3d" + b, mxUtils.bind(this, function(c) { + this.fireEvent(new mxEventObject(mxEvent.POST, "request", c, "url", a, "data", b)) + })) +}; +mxEditor.prototype.writeGraphModel = function(a) { + a = null != a ? a : this.linefeed; + var b = (new mxCodec).encode(this.graph.getModel()); + return mxUtils.getXml(b, a) +}; +mxEditor.prototype.getUrlPost = function() { + return this.urlPost +}; +mxEditor.prototype.getUrlImage = function() { + return this.urlImage +}; +mxEditor.prototype.connect = function(a, b, c, d) { + var e = null; + mxClient.IS_LOCAL || (e = new mxSession(this.graph.getModel(), a, b, c), e.addListener(mxEvent.RECEIVE, mxUtils.bind(this, function(a, b) { + null != b.getProperty("node").getAttribute("namespace") && this.resetHistory() + })), e.addListener(mxEvent.DISCONNECT, d), e.addListener(mxEvent.CONNECT, d), e.addListener(mxEvent.NOTIFY, d), e.addListener(mxEvent.GET, d), e.start()); + return e +}; +mxEditor.prototype.swapStyles = function(a, b) { + var c = this.graph.getStylesheet().styles[b]; + this.graph.getView().getStylesheet().putCellStyle(b, this.graph.getStylesheet().styles[a]); + this.graph.getStylesheet().putCellStyle(a, c); + this.graph.refresh() +}; +mxEditor.prototype.showProperties = function(a) { + a = a || this.graph.getSelectionCell(); + null == a && (a = this.graph.getCurrentRoot(), null == a && (a = this.graph.getModel().getRoot())); + if (null != a) { + this.graph.stopEditing(!0); + var b = mxUtils.getOffset(this.graph.container), + c = b.x + 10, + b = b.y; + if (null != this.properties && !this.movePropertiesDialog) c = this.properties.getX(), b = this.properties.getY(); + else { + var d = this.graph.getCellBounds(a); + null != d && (c += d.x + Math.min(200, d.width), b += d.y) + } + this.hideProperties(); + a = this.createProperties(a); + null != a && (this.properties = new mxWindow(mxResources.get(this.propertiesResource) || this.propertiesResource, a, c, b, this.propertiesWidth, this.propertiesHeight, !1), this.properties.setVisible(! + 0)) + } +}; +mxEditor.prototype.isPropertiesVisible = function() { + return null != this.properties +}; +mxEditor.prototype.createProperties = function(a) { + var b = this.graph.getModel(), + c = b.getValue(a); + if (mxUtils.isNode(c)) { + var d = new mxForm("properties"); + d.addText("ID", a.getId()).setAttribute("readonly", "true"); + var e = null, + f = null, + g = null, + h = null, + k = null; + b.isVertex(a) && (e = b.getGeometry(a), null != e && (f = d.addText("top", e.y), g = d.addText("left", e.x), h = d.addText("width", e.width), k = d.addText("height", e.height))); + for (var l = b.getStyle(a), m = d.addText("Style", l || ""), n = c.attributes, p = [], c = 0; c < n.length; c++) p[c] = d.addTextarea(n[c].nodeName, + n[c].nodeValue, "label" == n[c].nodeName ? 4 : 2); + c = mxUtils.bind(this, function() { + this.hideProperties(); + b.beginUpdate(); + try { + null != e && (e = e.clone(), e.x = parseFloat(g.value), e.y = parseFloat(f.value), e.width = parseFloat(h.value), e.height = parseFloat(k.value), b.setGeometry(a, e)); + 0 < m.value.length ? b.setStyle(a, m.value) : b.setStyle(a, null); + for (var c = 0; c < n.length; c++) { + var d = new mxCellAttributeChange(a, n[c].nodeName, p[c].value); + b.execute(d) + } + this.graph.isAutoSizeCell(a) && this.graph.updateCellSize(a) + } finally { + b.endUpdate() + } + }); + l = mxUtils.bind(this, function() { + this.hideProperties() + }); + d.addButtons(c, l); + return d.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 a = document.createElement("div"); + a.style.padding = "4px"; + a.style.paddingLeft = "20px"; + var b = document.body.clientWidth, + b = new mxWindow(mxResources.get(this.tasksResource) || this.tasksResource, a, b - 220, this.tasksTop, 200); + b.setClosable(!0); + b.destroyOnClose = !1; + var c = mxUtils.bind(this, function(b) { + mxEvent.release(a); + a.innerHTML = ""; + this.createTasks(a) + }); + this.graph.getModel().addListener(mxEvent.CHANGE, c); + this.graph.getSelectionModel().addListener(mxEvent.CHANGE, + c); + this.graph.addListener(mxEvent.ROOT, c); + null != this.tasksWindowImage && b.setImage(this.tasksWindowImage); + this.tasks = b; + this.createTasks(a) + } + this.tasks.setVisible(!0) +}; +mxEditor.prototype.refreshTasks = function(a) { + null != this.tasks && (a = this.tasks.content, mxEvent.release(a), a.innerHTML = "", this.createTasks(a)) +}; +mxEditor.prototype.createTasks = function(a) {}; +mxEditor.prototype.showHelp = function(a) { + if (null == this.help) { + var b = document.createElement("iframe"); + b.setAttribute("src", mxResources.get("urlHelp") || this.urlHelp); + b.setAttribute("height", "100%"); + b.setAttribute("width", "100%"); + b.setAttribute("frameBorder", "0"); + b.style.backgroundColor = "white"; + a = document.body.clientWidth; + var c = document.body.clientHeight || document.documentElement.clientHeight, + d = new mxWindow(mxResources.get(this.helpResource) || this.helpResource, b, (a - this.helpWidth) / 2, (c - this.helpHeight) / + 3, this.helpWidth, this.helpHeight); + d.setMaximizable(!0); + d.setClosable(!0); + d.destroyOnClose = !1; + d.setResizable(!0); + null != this.helpWindowImage && d.setImage(this.helpWindowImage); + mxClient.IS_NS && (a = function(a) { + b.setAttribute("height", d.div.offsetHeight - 26 + "px") + }, d.addListener(mxEvent.RESIZE_END, a), d.addListener(mxEvent.MAXIMIZE, a), d.addListener(mxEvent.NORMALIZE, a), d.addListener(mxEvent.SHOW, a)); + this.help = d + } + this.help.setVisible(!0) +}; +mxEditor.prototype.showOutline = function() { + if (null == this.outline) { + var a = document.createElement("div"); + a.style.overflow = "hidden"; + a.style.width = "100%"; + a.style.height = "100%"; + a.style.background = "white"; + a.style.cursor = "move"; + var b = new mxWindow(mxResources.get(this.outlineResource) || this.outlineResource, a, 600, 480, 200, 200, !1), + c = new mxOutline(this.graph, a); + b.setClosable(!0); + b.setResizable(!0); + b.destroyOnClose = !1; + b.addListener(mxEvent.RESIZE_END, function() { + c.update() + }); + this.outline = b; + this.outline.outline = c + } + this.outline.setVisible(!0); + this.outline.outline.update(!0) +}; +mxEditor.prototype.setMode = function(a) { + "select" == a ? (this.graph.panningHandler.useLeftButtonForPanning = !1, this.graph.setConnectable(!1)) : "connect" == a ? (this.graph.panningHandler.useLeftButtonForPanning = !1, this.graph.setConnectable(! + 0)) : "pan" == a && (this.graph.panningHandler.useLeftButtonForPanning = !0, this.graph.setConnectable(!1)) +}; +mxEditor.prototype.createPopupMenu = function(a, b, c) { + this.popupHandler.createMenu(this, a, b, c) +}; +mxEditor.prototype.createEdge = function(a, b) { + var c = null; + if (null != this.defaultEdge) c = this.graph.getModel().cloneCell(this.defaultEdge); + else { + c = new mxCell(""); + c.setEdge(!0); + var d = new mxGeometry; + d.relative = !0; + c.setGeometry(d) + } + d = this.getEdgeStyle(); + null != d && c.setStyle(d); + return c +}; +mxEditor.prototype.getEdgeStyle = function() { + return this.defaultEdgeStyle +}; +mxEditor.prototype.consumeCycleAttribute = function(a) { + return null != this.cycleAttributeValues && 0 < this.cycleAttributeValues.length && this.graph.isSwimlane(a) ? this.cycleAttributeValues[this.cycleAttributeIndex++ % this.cycleAttributeValues.length] : + null +}; +mxEditor.prototype.cycleAttribute = function(a) { + if (null != this.cycleAttributeName) { + var b = this.consumeCycleAttribute(a); + null != b && a.setStyle(a.getStyle() + ";" + this.cycleAttributeName + "\x3d" + b) + } +}; +mxEditor.prototype.addVertex = function(a, b, c, d) { + for (var e = this.graph.getModel(); null != a && !this.graph.isValidDropTarget(a);) a = e.getParent(a); + a = null != a ? a : this.graph.getSwimlaneAt(c, d); + var f = this.graph.getView().scale, + g = e.getGeometry(b), + h = e.getGeometry(a); + if (this.graph.isSwimlane(b) && !this.graph.swimlaneNesting) a = null; + else { + if (null == a && this.swimlaneRequired) return null; + if (null != a && null != h) { + var k = this.graph.getView().getState(a); + if (null != k) { + if (c -= k.origin.x * f, d -= k.origin.y * f, this.graph.isConstrainedMoving) { + var h = + g.width, + l = g.height, + m = k.x + k.width; + c + h > m && (c -= c + h - m); + m = k.y + k.height; + d + l > m && (d -= d + l - m) + } + } else null != h && (c -= h.x * f, d -= h.y * f) + } + } + g = g.clone(); + g.x = this.graph.snap(c / f - this.graph.getView().translate.x - this.graph.gridSize / 2); + g.y = this.graph.snap(d / f - this.graph.getView().translate.y - this.graph.gridSize / 2); + b.setGeometry(g); + null == a && (a = this.graph.getDefaultParent()); + this.cycleAttribute(b); + this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX, "vertex", b, "parent", a)); + e.beginUpdate(); + try { + b = this.graph.addCell(b, + a), null != b && (this.graph.constrainChild(b), this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX, "vertex", b))) + } finally { + e.endUpdate() + } + null != b && (this.graph.setSelectionCell(b), this.graph.scrollCellToVisible(b), this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX, "vertex", b))); + return b +}; +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(a) { + if (null != a) { + var b = a.getName(); + mxCodecRegistry.codecs[b] = a; + var c = mxUtils.getFunctionName(a.template.constructor); + c != b && mxCodecRegistry.addAlias(c, b) + } + return a + }, + addAlias: function(a, b) { + mxCodecRegistry.aliases[a] = b + }, + getCodec: function(a) { + var b = null; + if (null != a) { + var b = mxUtils.getFunctionName(a), + c = mxCodecRegistry.aliases[b]; + null != c && (b = c); + b = mxCodecRegistry.codecs[b]; + if (null == b) try { + b = new mxObjectCodec(new a), mxCodecRegistry.register(b) + } catch (d) {} + } + return b + } +}; + +function mxCodec(a) { + this.document = a || mxUtils.createXmlDocument(); + this.objects = [] +} +mxCodec.prototype.document = null; +mxCodec.prototype.objects = null; +mxCodec.prototype.encodeDefaults = !1; +mxCodec.prototype.putObject = function(a, b) { + return this.objects[a] = b +}; +mxCodec.prototype.getObject = function(a) { + var b = null; + null != a && (b = this.objects[a], null == b && (b = this.lookup(a), null == b && (a = this.getElementById(a), null != a && (b = this.decode(a))))); + return b +}; +mxCodec.prototype.lookup = function(a) { + return null +}; +mxCodec.prototype.getElementById = function(a, b) { + return mxUtils.findNodeByAttribute(this.document.documentElement, null != b ? b : "id", a) +}; +mxCodec.prototype.getId = function(a) { + var b = null; + null != a && (b = this.reference(a), null == b && a instanceof mxCell && (b = a.getId(), null == b && (b = mxCellPath.create(a), 0 == b.length && (b = "root")))); + return b +}; +mxCodec.prototype.reference = function(a) { + return null +}; +mxCodec.prototype.encode = function(a) { + var b = null; + if (null != a && null != a.constructor) { + var c = mxCodecRegistry.getCodec(a.constructor); + null != c ? b = c.encode(this, a) : mxUtils.isNode(a) ? b = mxClient.IS_IE ? a.cloneNode(!0) : this.document.importNode(a, !0) : mxLog.warn("mxCodec.encode: No codec for " + mxUtils.getFunctionName( + a.constructor)) + } + return b +}; +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 (g) { + mxLog.debug("Cannot decode " + a.nodeName + ": " + g.message) + } + } + return c +}; +mxCodec.prototype.encodeCell = function(a, b, c) { + b.appendChild(this.encode(a)); + if (null == c || c) { + c = a.getChildCount(); + for (var d = 0; d < c; d++) this.encodeCell(a.getChildAt(d), b) + } +}; +mxCodec.prototype.isCellCodec = function(a) { + return null != a && "function" == typeof a.isCellCodec ? a.isCellCodec() : !1 +}; +mxCodec.prototype.decodeCell = function(a, b) { + b = null != b ? b : !0; + var c = null; + if (null != a && a.nodeType == mxConstants.NODETYPE_ELEMENT) { + c = mxCodecRegistry.getCodec(a.nodeName); + if (!this.isCellCodec(c)) + for (var d = a.firstChild; null != d && !this.isCellCodec(c);) c = mxCodecRegistry.getCodec(d.nodeName), d = d.nextSibling; + this.isCellCodec(c) || (c = mxCodecRegistry.getCodec(mxCell)); + c = c.decode(this, a); + b && this.insertIntoGraph(c) + } + return c +}; +mxCodec.prototype.insertIntoGraph = function(a) { + var b = a.parent, + c = a.getTerminal(!0), + d = a.getTerminal(!1); + a.setTerminal(null, !1); + a.setTerminal(null, !0); + a.parent = null; + null != b && b.insert(a); + null != c && c.insertEdge(a, !0); + null != d && d.insertEdge(a, !1) +}; +mxCodec.prototype.setAttribute = function(a, b, c) { + null != b && null != c && a.setAttribute(b, c) +}; + +function mxObjectCodec(a, b, c, d) { + this.template = a; + this.exclude = null != b ? b : []; + this.idrefs = null != c ? c : []; + this.mapping = null != d ? d : []; + this.reverse = {}; + for (var e in this.mapping) this.reverse[this.mapping[e]] = e +} +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(a) { + if (null != a) { + var b = this.reverse[a]; + null != b && (a = b) + } + return a +}; +mxObjectCodec.prototype.getAttributeName = function(a) { + if (null != a) { + var b = this.mapping[a]; + null != b && (a = b) + } + return a +}; +mxObjectCodec.prototype.isExcluded = function(a, b, c, d) { + return b == mxObjectIdentity.FIELD_NAME || 0 <= mxUtils.indexOf(this.exclude, b) +}; +mxObjectCodec.prototype.isReference = function(a, b, c, d) { + return 0 <= mxUtils.indexOf(this.idrefs, b) +}; +mxObjectCodec.prototype.encode = function(a, b) { + var c = a.document.createElement(this.getName()); + b = this.beforeEncode(a, b, c); + this.encodeObject(a, b, c); + return this.afterEncode(a, b, c) +}; +mxObjectCodec.prototype.encodeObject = function(a, b, c) { + a.setAttribute(c, "id", a.getId(b)); + for (var d in b) { + var e = d, + f = b[e]; + null != f && !this.isExcluded(b, e, f, !0) && (mxUtils.isNumeric(e) && (e = null), this.encodeValue(a, b, e, f, c)) + } +}; +mxObjectCodec.prototype.encodeValue = function(a, b, c, d, e) { + if (null != d) { + if (this.isReference(b, c, d, !0)) { + var f = a.getId(d); + if (null == f) { + mxLog.warn("mxObjectCodec.encode: No ID for " + this.getName() + "." + c + "\x3d" + d); + return + } + d = f + } + f = this.template[c]; + if (null == c || a.encodeDefaults || f != d) c = this.getAttributeName(c), this.writeAttribute(a, b, c, d, e) + } +}; +mxObjectCodec.prototype.writeAttribute = function(a, b, c, d, e) { + "object" != typeof d ? this.writePrimitiveAttribute(a, b, c, d, e) : this.writeComplexAttribute(a, b, c, d, e) +}; +mxObjectCodec.prototype.writePrimitiveAttribute = function(a, b, c, d, e) { + d = this.convertValueToXml(d); + null == c ? (b = a.document.createElement("add"), "function" == typeof d ? b.appendChild(a.document.createTextNode(d)) : a.setAttribute(b, "value", d), e.appendChild(b)) : "function" != typeof d && + a.setAttribute(e, c, d) +}; +mxObjectCodec.prototype.writeComplexAttribute = function(a, b, c, d, e) { + a = a.encode(d); + null != a ? (null != c && a.setAttribute("as", c), e.appendChild(a)) : mxLog.warn("mxObjectCodec.encode: No node for " + this.getName() + "." + c + ": " + d) +}; +mxObjectCodec.prototype.convertValueToXml = function(a) { + if ("undefined" == typeof a.length && (!0 == a || !1 == a)) a = !0 == a ? "1" : "0"; + return a +}; +mxObjectCodec.prototype.convertValueFromXml = function(a) { + mxUtils.isNumeric(a) && (a = parseFloat(a)); + // + // Marco (marco.murdocca@xenialab.it) + Andrea Bianco (andrea.bianco@xcally.com) + // 2016-02-24 + // + // mxUtils.isNumeric(a) && (a = ((Number(a) === a) && (a % 1 !== 0)) ? parseFloat(a) : a); + return a +}; +mxObjectCodec.prototype.beforeEncode = function(a, b, c) { + return b +}; +mxObjectCodec.prototype.afterEncode = function(a, b, c) { + return c +}; +mxObjectCodec.prototype.decode = function(a, b, c) { + var d = b.getAttribute("id"), + e = a.objects[d]; + null == e && (e = c || this.cloneTemplate(), null != d && a.putObject(d, e)); + b = this.beforeDecode(a, b, e); + this.decodeNode(a, b, e); + return this.afterDecode(a, b, e) +}; +mxObjectCodec.prototype.decodeNode = function(a, b, c) { + null != b && (this.decodeAttributes(a, b, c), this.decodeChildren(a, b, c)) +}; +mxObjectCodec.prototype.decodeAttributes = function(a, b, c) { + b = b.attributes; + if (null != b) + for (var d = 0; d < b.length; d++) this.decodeAttribute(a, b[d], c) +}; +mxObjectCodec.prototype.decodeAttribute = function(a, b, c) { + var d = b.nodeName; + if ("as" != d && "id" != d) { + b = this.convertValueFromXml(b.nodeValue); + var e = this.getFieldName(d); + if (this.isReference(c, e, b, !1)) { + a = a.getObject(b); + if (null == a) { + mxLog.warn("mxObjectCodec.decode: No object for " + this.getName() + "." + d + "\x3d" + b); + return + } + b = a + } + this.isExcluded(c, d, b, !1) || (c[d] = b) + } +}; +mxObjectCodec.prototype.decodeChildren = function(a, b, c) { + for (b = b.firstChild; null != b;) { + var d = b.nextSibling; + b.nodeType == mxConstants.NODETYPE_ELEMENT && !this.processInclude(a, b, c) && this.decodeChild(a, b, c); + b = d + } +}; +mxObjectCodec.prototype.decodeChild = function(a, b, c) { + var d = this.getFieldName(b.getAttribute("as")); + if (null == d || !this.isExcluded(c, d, b, !1)) { + var e = this.getFieldTemplate(c, d, b), + f = null; + "add" == b.nodeName ? (f = b.getAttribute("value"), null == f && (f = mxUtils.eval(mxUtils.getTextContent(b)))) : f = a.decode(b, e); + this.addObjectValue(c, d, f, e) + } +}; +mxObjectCodec.prototype.getFieldTemplate = function(a, b, c) { + a = a[b]; + a instanceof Array && 0 < a.length && (a = null); + return a +}; +mxObjectCodec.prototype.addObjectValue = function(a, b, c, d) { + null != c && c != d && (null != b && 0 < b.length ? a[b] = c : a.push(c)) +}; +mxObjectCodec.prototype.processInclude = function(a, b, c) { + if ("include" == b.nodeName) { + b = b.getAttribute("name"); + if (null != b) try { + var d = mxUtils.load(b).getDocumentElement(); + null != d && a.decode(d, c) + } catch (e) {} + return !0 + } + return !1 +}; +mxObjectCodec.prototype.beforeDecode = function(a, b, c) { + return b +}; +mxObjectCodec.prototype.afterDecode = function(a, b, c) { + return c +}; +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxCell, ["children", "edges", "overlays", "mxTransient"], ["parent", "source", "target"]); + a.isCellCodec = function() { + return !0 + }; + a.isExcluded = function(a, c, d, e) { + return mxObjectCodec.prototype.isExcluded.apply(this, arguments) || e && "value" == c && d.nodeType == mxConstants.NODETYPE_ELEMENT + }; + a.afterEncode = function(a, c, d) { + if (null != c.value && c.value.nodeType == mxConstants.NODETYPE_ELEMENT) { + var e = d; + d = mxClient.IS_IE ? c.value.cloneNode(!0) : a.document.importNode(c.value, !0); + d.appendChild(e); + a = e.getAttribute("id"); + d.setAttribute("id", a); + e.removeAttribute("id") + } + return d + }; + a.beforeDecode = function(a, c, d) { + var e = c, + f = this.getName(); + c.nodeName != f ? (e = c.getElementsByTagName(f)[0], null != e && e.parentNode == c ? (mxUtils.removeWhitespace(e, !0), mxUtils.removeWhitespace(e, !1), e.parentNode.removeChild(e)) : e = + null, d.value = c.cloneNode(!0), c = d.value.getAttribute("id"), null != c && (d.setId(c), d.value.removeAttribute("id"))) : d.setId(c.getAttribute("id")); + if (null != e) + for (c = 0; c < this.idrefs.length; c++) { + var f = + this.idrefs[c], + g = e.getAttribute(f); + if (null != g) { + e.removeAttribute(f); + var h = a.objects[g] || a.lookup(g); + null == h && (g = a.getElementById(g), null != g && (h = (mxCodecRegistry.codecs[g.nodeName] || this).decode(a, g))); + d[f] = h + } + } + return e + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxGraphModel); + a.encodeObject = function(a, c, d) { + var e = a.document.createElement("root"); + a.encodeCell(c.getRoot(), e); + d.appendChild(e) + }; + a.decodeChild = function(a, c, d) { + "root" == c.nodeName ? this.decodeRoot(a, c, d) : mxObjectCodec.prototype.decodeChild.apply(this, arguments) + }; + a.decodeRoot = function(a, c, d) { + var e = null; + for (c = c.firstChild; null != c;) { + var f = a.decodeCell(c); + null != f && null == f.getParent() && (e = f); + c = c.nextSibling + } + null != e && d.setRoot(e) + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxRootChange, ["model", "previous", "root"]); + a.afterEncode = function(a, c, d) { + a.encodeCell(c.root, d); + return d + }; + a.beforeDecode = function(a, c, d) { + if (null != c.firstChild && c.firstChild.nodeType == mxConstants.NODETYPE_ELEMENT) { + c = c.cloneNode(!0); + var e = c.firstChild; + d.root = a.decodeCell(e, !1); + d = e.nextSibling; + e.parentNode.removeChild(e); + for (e = d; null != e;) d = e.nextSibling, a.decodeCell(e), e.parentNode.removeChild(e), e = d + } + return c + }; + a.afterDecode = function(a, c, + d) { + d.previous = d.root; + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxChildChange, ["model", "child", "previousIndex"], ["parent", "previous"]); + a.isReference = function(a, c, d, e) { + return "child" == c && (null != a.previous || !e) ? !0 : 0 <= mxUtils.indexOf(this.idrefs, c) + }; + a.afterEncode = function(a, c, d) { + this.isReference(c, "child", c.child, !0) ? d.setAttribute("child", a.getId(c.child)) : a.encodeCell(c.child, d); + return d + }; + a.beforeDecode = function(a, c, d) { + if (null != c.firstChild && c.firstChild.nodeType == mxConstants.NODETYPE_ELEMENT) { + c = c.cloneNode(!0); + var e = c.firstChild; + d.child = a.decodeCell(e, !1); + d = e.nextSibling; + e.parentNode.removeChild(e); + for (e = d; null != e;) { + d = e.nextSibling; + if (e.nodeType == mxConstants.NODETYPE_ELEMENT) { + var f = e.getAttribute("id"); + null == a.lookup(f) && a.decodeCell(e) + } + e.parentNode.removeChild(e); + e = d + } + } else e = c.getAttribute("child"), d.child = a.getObject(e); + return c + }; + a.afterDecode = function(a, c, d) { + d.child.parent = d.previous; + d.previous = d.parent; + d.previousIndex = d.index; + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxTerminalChange, ["model", "previous"], ["cell", "terminal"]); + a.afterDecode = function(a, c, d) { + d.previous = d.terminal; + return d + }; + return a +}()); +var mxGenericChangeCodec = function(a, b) { + var c = new mxObjectCodec(a, ["model", "previous"], ["cell"]); + c.afterDecode = function(a, c, f) { + mxUtils.isNode(f.cell) && (f.cell = a.decodeCell(f.cell, !1)); + f.previous = f[b]; + return f + }; + return c +}; +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(function() { + return new mxObjectCodec(new mxGraph, "graphListeners eventListeners view container cellRenderer editor selection".split(" ")) +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxGraphView); + a.encode = function(a, c) { + return this.encodeCell(a, c, c.graph.getModel().getRoot()) + }; + a.encodeCell = function(a, c, d) { + var e = c.graph.getModel(), + f = c.getState(d), + g = e.getParent(d); + if (null == g || null != f) { + var h = e.getChildCount(d), + k = c.graph.getCellGeometry(d), + l = null; + g == e.getRoot() ? l = "layer" : null == g ? l = "graph" : e.isEdge(d) ? l = "edge" : 0 < h && null != k ? l = "group" : e.isVertex(d) && (l = "vertex"); + if (null != l) { + var m = a.document.createElement(l); + null != c.graph.getLabel(d) && + (m.setAttribute("label", c.graph.getLabel(d)), c.graph.isHtmlLabel(d) && m.setAttribute("html", !0)); + if (null == g) { + var n = c.getGraphBounds(); + null != n && (m.setAttribute("x", Math.round(n.x)), m.setAttribute("y", Math.round(n.y)), m.setAttribute("width", Math.round(n.width)), m.setAttribute("height", Math.round(n.height))); + m.setAttribute("scale", c.scale) + } else if (null != f && null != k) { + for (n in f.style) g = f.style[n], "function" == typeof g && "object" == typeof g && (g = mxStyleRegistry.getName(g)), null != g && ("function" != typeof g && "object" != + typeof g) && m.setAttribute(n, g); + g = f.absolutePoints; + if (null != g && 0 < g.length) { + k = Math.round(g[0].x) + "," + Math.round(g[0].y); + for (n = 1; n < g.length; n++) k += " " + Math.round(g[n].x) + "," + Math.round(g[n].y); + m.setAttribute("points", k) + } else m.setAttribute("x", Math.round(f.x)), m.setAttribute("y", Math.round(f.y)), m.setAttribute("width", Math.round(f.width)), m.setAttribute("height", Math.round(f.height)); + n = f.absoluteOffset; + null != n && (0 != n.x && m.setAttribute("dx", Math.round(n.x)), 0 != n.y && m.setAttribute("dy", Math.round(n.y))) + } + for (n = + 0; n < h; n++) f = this.encodeCell(a, c, e.getChildAt(d, n)), null != f && m.appendChild(f) + } + } + return m + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxStylesheet); + a.encode = function(a, c) { + var d = a.document.createElement(this.getName()), + e; + for (e in c.styles) { + var f = c.styles[e], + g = a.document.createElement("add"); + if (null != e) { + g.setAttribute("as", e); + for (var h in f) { + var k = this.getStringValue(h, f[h]); + if (null != k) { + var l = a.document.createElement("add"); + l.setAttribute("value", k); + l.setAttribute("as", h); + g.appendChild(l) + } + } + 0 < g.childNodes.length && d.appendChild(g) + } + } + return d + }; + a.getStringValue = function(a, + c) { + var d = typeof c; + "function" == d ? c = mxStyleRegistry.getName(style[j]) : "object" == d && (c = null); + return c + }; + a.decode = function(a, c, d) { + d = d || new this.template.constructor; + var e = c.getAttribute("id"); + null != e && (a.objects[e] = d); + for (c = c.firstChild; null != c;) { + if (!this.processInclude(a, c, d) && "add" == c.nodeName && (e = c.getAttribute("as"), null != e)) { + var f = c.getAttribute("extend"), + g = null != f ? mxUtils.clone(d.styles[f]) : null; + null == g && (null != f && mxLog.warn("mxStylesheetCodec.decode: stylesheet " + f + " not found to extend"), g = {}); + for (f = c.firstChild; null != f;) { + if (f.nodeType == mxConstants.NODETYPE_ELEMENT) { + var h = f.getAttribute("as"); + if ("add" == f.nodeName) { + var k = mxUtils.getTextContent(f), + l = null; + null != k && 0 < k.length ? l = mxUtils.eval(k) : (l = f.getAttribute("value"), mxUtils.isNumeric(l) && (l = parseFloat(l))); + null != l && (g[h] = l) + } else "remove" == f.nodeName && delete g[h] + } + f = f.nextSibling + } + d.putCellStyle(e, g) + } + c = c.nextSibling + } + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxDefaultKeyHandler); + a.encode = function(a, c) { + return null + }; + a.decode = function(a, c, d) { + if (null != d) + for (c = c.firstChild; null != c;) { + if (!this.processInclude(a, c, d) && "add" == c.nodeName) { + var e = c.getAttribute("as"), + f = c.getAttribute("action"), + g = c.getAttribute("control"); + d.bindAction(e, f, g) + } + c = c.nextSibling + } + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxDefaultToolbar); + a.encode = function(a, c) { + return null + }; + a.decode = function(a, c, d) { + if (null != d) { + var e = d.editor; + for (c = c.firstChild; null != c;) { + if (c.nodeType == mxConstants.NODETYPE_ELEMENT && !this.processInclude(a, c, d)) + if ("separator" == c.nodeName) d.addSeparator(); + else if ("br" == c.nodeName) d.toolbar.addBreak(); + else if ("hr" == c.nodeName) d.toolbar.addLine(); + else if ("add" == c.nodeName) { + var f = c.getAttribute("as"), + f = mxResources.get(f) || f, + g = c.getAttribute("icon"), + h = c.getAttribute("pressedIcon"), + k = c.getAttribute("action"), + l = c.getAttribute("mode"), + m = c.getAttribute("template"), + n = "0" != c.getAttribute("toggle"), + p = mxUtils.getTextContent(c), + q = null; + if (null != k) q = d.addItem(f, g, k, h); + else if (null != l) var s = mxUtils.eval(p), + q = d.addMode(f, g, l, h, s); + else if (null != m || null != p && 0 < p.length) q = e.templates[m], m = c.getAttribute("style"), null != q && null != m && (q = q.clone(), q.setStyle(m)), m = null, null != p && 0 < + p.length && (m = mxUtils.eval(p)), q = d.addPrototype(f, g, q, h, m, n); + else if (h = mxUtils.getChildNodes(c), + 0 < h.length) + if (null == g) { + m = d.addActionCombo(f); + for (f = 0; f < h.length; f++) n = h[f], "separator" == n.nodeName ? d.addOption(m, "---") : "add" == n.nodeName && (g = n.getAttribute("as"), n = n.getAttribute("action"), d.addActionOption( + m, g, n)) + } else { + var r = null, + t = d.addPrototype(f, g, function() { + var a = e.templates[r.value]; + if (null != a) { + var a = a.clone(), + b = r.options[r.selectedIndex].cellStyle; + null != b && a.setStyle(b); + return a + } + mxLog.warn("Template " + a + " not found"); + return null + }, null, null, n), + r = d.addCombo(); + mxEvent.addListener(r, "change", + function() { + d.toolbar.selectMode(t, function(a) { + a = mxUtils.convertPoint(e.graph.container, mxEvent.getClientX(a), mxEvent.getClientY(a)); + return e.addVertex(null, s(), a.x, a.y) + }); + d.toolbar.noReset = !1 + }); + for (f = 0; f < h.length; f++) n = h[f], "separator" == n.nodeName ? d.addOption(r, "---") : "add" == n.nodeName && (g = n.getAttribute("as"), p = n.getAttribute("template"), d.addOption( + r, g, p || m).cellStyle = n.getAttribute("style")) + } + null != q && (m = c.getAttribute("id"), null != m && 0 < m.length && q.setAttribute("id", m)) + } + c = c.nextSibling + } + } + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxDefaultPopupMenu); + a.encode = function(a, c) { + return null + }; + a.decode = function(a, c, d) { + var e = c.getElementsByTagName("include")[0]; + null != e ? this.processInclude(a, e, d) : null != d && (d.config = c); + return d + }; + return a +}()); +mxCodecRegistry.register(function() { + var a = new mxObjectCodec(new mxEditor, "modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" ")); + a.afterDecode = function(a, c, d) { + a = c.getAttribute("defaultEdge"); + null != a && (c.removeAttribute("defaultEdge"), d.defaultEdge = d.templates[a]); + a = c.getAttribute("defaultGroup"); + null != a && (c.removeAttribute("defaultGroup"), d.defaultGroup = d.templates[a]); + return d + }; + a.decodeChild = function(a, c, d) { + if ("Array" == c.nodeName) { + if ("templates" == c.getAttribute("as")) { + this.decodeTemplates(a, + c, d); + return + } + } else if ("ui" == c.nodeName) { + this.decodeUi(a, c, d); + return + } + mxObjectCodec.prototype.decodeChild.apply(this, arguments) + }; + a.decodeUi = function(a, c, d) { + for (a = c.firstChild; null != a;) { + if ("add" == a.nodeName) { + c = a.getAttribute("as"); + var e = a.getAttribute("element"), + f = a.getAttribute("style"), + g = null; + if (null != e) g = document.getElementById(e), null != g && null != f && (g.style.cssText += ";" + f); + else { + var e = parseInt(a.getAttribute("x")), + h = parseInt(a.getAttribute("y")), + k = a.getAttribute("width"), + l = a.getAttribute("height"), + g = document.createElement("div"); + g.style.cssText = f; + (new mxWindow(mxResources.get(c) || c, g, e, h, k, l, !1, !0)).setVisible(!0) + } + "graph" == c ? d.setGraphContainer(g) : "toolbar" == c ? d.setToolbarContainer(g) : "title" == c ? d.setTitleContainer(g) : "status" == c ? d.setStatusContainer(g) : "map" == c && d.setMapContainer( + g) + } else "resource" == a.nodeName ? mxResources.add(a.getAttribute("basename")) : "stylesheet" == a.nodeName && mxClient.link("stylesheet", a.getAttribute("name")); + a = a.nextSibling + } + }; + a.decodeTemplates = function(a, c, d) { + null == d.templates && + (d.templates = []); + c = mxUtils.getChildNodes(c); + for (var e = 0; e < c.length; e++) { + for (var f = c[e].getAttribute("as"), g = c[e].firstChild; null != g && 1 != g.nodeType;) g = g.nextSibling; + null != g && (d.templates[f] = a.decodeCell(g)) + } + }; + return a +}()); diff --git a/public/assets/plugins/square/js/Actions.js b/public/assets/plugins/square/js/Actions.js index acee5a0..aeaa420 100644 --- a/public/assets/plugins/square/js/Actions.js +++ b/public/assets/plugins/square/js/Actions.js @@ -1 +1,634 @@ -var _0x7982=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x64\x69\x74\x6F\x72\x55\x69","\x61\x63\x74\x69\x6F\x6E\x73","\x69\x6E\x69\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x65\x64\x69\x74\x6F\x72","\x67\x72\x61\x70\x68","\x6E\x65\x77","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x68\x6F\x77\x44\x69\x61\x6C\x6F\x67","\x61\x64\x64\x41\x63\x74\x69\x6F\x6E","\x6F\x70\x65\x6E","\x73\x61\x76\x65","\x73\x61\x76\x65\x46\x69\x6C\x65","\x43\x74\x72\x6C\x2B\x53","\x73\x61\x76\x65\x41\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2D\x53","\x70\x75\x62\x6C\x69\x73\x68","\x70\x75\x62\x6C\x69\x73\x68\x46\x69\x6C\x65","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x50","\x76\x61\x72\x69\x61\x62\x6C\x65","\x69\x6D\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74","\x43\x74\x72\x6C\x2B\x45","\x65\x64\x69\x74\x46\x69\x6C\x65","\x65\x64\x69\x74","\x67\x65\x74","\x62\x69\x6E\x64","\x70\x75\x74","\x72\x65\x6E\x61\x6D\x65","\x70\x72\x69\x6E\x74","\x70\x72\x69\x6E\x74\x53\x63\x72\x65\x65\x6E","\x73\x70\x72\x69\x74\x65\x2D\x70\x72\x69\x6E\x74","\x43\x74\x72\x6C\x2B\x50","\x70\x72\x65\x76\x69\x65\x77","\x73\x68\x6F\x77","\x75\x6E\x64\x6F","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x73\x70\x72\x69\x74\x65\x2D\x75\x6E\x64\x6F","\x43\x74\x72\x6C\x2B\x5A","\x72\x65\x64\x6F","\x73\x70\x72\x69\x74\x65\x2D\x72\x65\x64\x6F","\x43\x74\x72\x6C\x2B\x59","\x63\x75\x74","\x73\x70\x72\x69\x74\x65\x2D\x63\x75\x74","\x43\x74\x72\x6C\x2B\x58","\x63\x6F\x70\x79","\x73\x70\x72\x69\x74\x65\x2D\x63\x6F\x70\x79","\x43\x74\x72\x6C\x2B\x43","\x70\x61\x73\x74\x65","\x73\x70\x72\x69\x74\x65\x2D\x70\x61\x73\x74\x65","\x43\x74\x72\x6C\x2B\x56","\x64\x65\x6C\x65\x74\x65","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x44\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x67\x72\x69\x64\x53\x69\x7A\x65","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x44","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x56","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x45","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x43\x74\x72\x6C\x2B\x41","\x68\x6F\x6D\x65","\x48\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x50\x61\x67\x65\x20\x55\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x50\x61\x67\x65\x20\x44\x6F\x77\x6E","\x65\x78\x70\x61\x6E\x64","\x66\x6F\x6C\x64\x43\x65\x6C\x6C\x73","\x45\x6E\x74\x65\x72","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x42\x61\x63\x6B\x73\x70\x61\x63\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x6F\x72\x64\x65\x72\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x46","\x74\x6F\x42\x61\x63\x6B","\x43\x74\x72\x6C\x2B\x42","\x67\x72\x6F\x75\x70","\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x43\x74\x72\x6C\x2B\x47","\x75\x6E\x67\x72\x6F\x75\x70","\x75\x6E\x67\x72\x6F\x75\x70\x43\x65\x6C\x6C\x73","\x43\x74\x72\x6C\x2B\x55","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x65\x64\x69\x74\x4C\x69\x6E\x6B","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","","\x65\x6E\x74\x65\x72\x56\x61\x6C\x75\x65","\x70\x72\x6F\x6D\x70\x74","\x73\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x61\x75\x74\x6F\x73\x69\x7A\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x6C\x65\x6E\x67\x74\x68","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x75\x70\x64\x61\x74\x65\x47\x72\x6F\x75\x70\x42\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x43\x65\x6C\x6C\x53\x69\x7A\x65","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x77\x6F\x72\x64\x57\x72\x61\x70","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x77\x72\x61\x70","\x53\x54\x59\x4C\x45\x5F\x57\x48\x49\x54\x45\x5F\x53\x50\x41\x43\x45","\x73\x74\x79\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x30","\x53\x54\x59\x4C\x45\x5F\x52\x4F\x54\x41\x54\x49\x4F\x4E","\x20\x28","\x20\x30\x2D\x33\x36\x30\x29","\x74\x69\x6C\x74","\x69\x73\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x43\x65\x6C\x6C\x47\x65\x6F\x6D\x65\x74\x72\x79","\x63\x6C\x6F\x6E\x65","\x78","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x79","\x73\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x76\x69\x65\x77","\x53\x54\x59\x4C\x45\x5F\x44\x49\x52\x45\x43\x54\x49\x4F\x4E","\x65\x61\x73\x74","\x73\x6F\x75\x74\x68","\x77\x65\x73\x74","\x6E\x6F\x72\x74\x68","\x43\x74\x72\x6C\x2B\x52","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x7A\x6F\x6F\x6D\x54\x6F","\x7A\x6F\x6F\x6D\x49\x6E","\x41\x64\x64","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x53\x75\x62\x74\x72\x61\x63\x74","\x66\x69\x74\x57\x69\x6E\x64\x6F\x77","\x66\x69\x74","\x66\x69\x74\x50\x61\x67\x65","\x70\x61\x67\x65\x56\x69\x73\x69\x62\x6C\x65","\x66\x75\x6E\x63\x74","\x70\x61\x67\x65\x56\x69\x65\x77","\x70\x61\x67\x65\x46\x6F\x72\x6D\x61\x74","\x70\x61\x67\x65\x53\x63\x61\x6C\x65","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x63\x6C\x69\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x6D\x69\x6E","\x66\x6C\x6F\x6F\x72","\x73\x63\x72\x6F\x6C\x6C\x4C\x65\x66\x74","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65","\x6D\x61\x78","\x72\x6F\x75\x6E\x64","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x66\x69\x74\x50\x61\x67\x65\x57\x69\x64\x74\x68","\x63\x75\x73\x74\x6F\x6D\x5A\x6F\x6F\x6D","\x63\x75\x73\x74\x6F\x6D","\x20\x28\x25\x29","\x67\x65\x74\x53\x63\x61\x6C\x65","\x67\x72\x69\x64","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x75\x70\x64\x61\x74\x65\x47\x72\x61\x70\x68\x43\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x43\x74\x72\x6C\x2B\x53\x68\x69\x66\x74\x2B\x47","\x73\x65\x74\x54\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x65\x64\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x67\x75\x69\x64\x65\x73","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x74\x6F\x6F\x6C\x74\x69\x70\x73","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x72\x65\x76\x61\x6C\x69\x64\x61\x74\x65","\x73\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x73\x63\x61\x6C\x65","\x73\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x73\x69\x7A\x65\x44\x69\x64\x43\x68\x61\x6E\x67\x65","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x61\x75\x74\x6F","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x73\x56\x69\x73\x69\x62\x6C\x65","\x70\x72\x65\x66\x65\x72\x50\x61\x67\x65\x53\x69\x7A\x65","\x76\x61\x6C\x69\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6F\x75\x74\x6C\x69\x6E\x65","\x68\x61\x73\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x63\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x43\x74\x72\x6C\x2B\x51","\x63\x6F\x70\x79\x43\x6F\x6E\x6E\x65\x63\x74","\x69\x73\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x68\x65\x6C\x70","\x6C\x61\x6E\x67\x75\x61\x67\x65","\x69\x73\x4C\x61\x6E\x67\x75\x61\x67\x65\x53\x75\x70\x70\x6F\x72\x74\x65\x64","\x5F","\x2F\x68\x65\x6C\x70","\x2E\x68\x74\x6D\x6C","\x61\x62\x6F\x75\x74","\x20\x43\x61\x6C\x6C\x79\x20\x53\x71\x75\x61\x72\x65","\x46\x31","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x46\x6C\x61\x67\x73","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x73\x68\x61\x64\x6F\x77","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x64\x61\x73\x68\x65\x64","\x72\x6F\x75\x6E\x64\x65\x64","\x63\x75\x72\x76\x65\x64","\x29","\x67\x65\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x61\x64\x64\x57\x61\x79\x70\x6F\x69\x6E\x74","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x73\x74\x61\x74\x65","\x74\x72\x69\x67\x67\x65\x72\x58","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x74\x72\x69\x67\x67\x65\x72\x59","\x61\x64\x64\x50\x6F\x69\x6E\x74\x41\x74","\x72\x65\x6D\x6F\x76\x65\x57\x61\x79\x70\x6F\x69\x6E\x74","\x68\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x64\x65\x78","\x72\x65\x6D\x6F\x76\x65\x50\x6F\x69\x6E\x74","\x69\x6D\x61\x67\x65","\x67\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x69\x6E\x73\x65\x72\x74\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x67\x65\x74\x47\x65\x6F\x6D\x65\x74\x72\x79","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x53\x54\x59\x4C\x45\x5F\x49\x4D\x41\x47\x45","\x75\x72\x6C","\x6F\x6E\x6C\x6F\x61\x64","\x6F\x6E\x65\x72\x72\x6F\x72","\x66\x69\x6C\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64","\x61\x6C\x65\x72\x74","\x73\x72\x63","\x63\x61\x6C\x6C","\x6C\x61\x62\x65\x6C","\x65\x6E\x61\x62\x6C\x65\x64","\x69\x63\x6F\x6E\x43\x6C\x73","\x73\x68\x6F\x72\x74\x63\x75\x74","\x65\x78\x74\x65\x6E\x64","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x74\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x65\x64\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x69\x73\x53\x65\x6C\x65\x63\x74\x65\x64"];_0x7982[0];function Actions(_0x74c8x2){this[_0x7982[1]]=_0x74c8x2;this[_0x7982[2]]= new Object();this[_0x7982[3]]()}Actions[_0x7982[4]][_0x7982[3]]=function(){var _0x74c8x3=this[_0x7982[1]];var _0x74c8x4=_0x74c8x3[_0x7982[5]];var _0x74c8x5=_0x74c8x4[_0x7982[6]];this[_0x7982[10]](_0x7982[7],function(){_0x74c8x3[_0x7982[9]]( new NewDialog(_0x74c8x3)[_0x7982[8]],300,180,true,true)});this[_0x7982[10]](_0x7982[11],function(){_0x74c8x3[_0x7982[9]]( new OpenDialog(_0x74c8x3)[_0x7982[8]],300,180,true,true)});this[_0x7982[10]](_0x7982[12],function(){_0x74c8x3[_0x7982[13]](false)},null,null,_0x7982[14]);this[_0x7982[10]](_0x7982[15],function(){_0x74c8x3[_0x7982[13]](true)},null,null,_0x7982[16]);this[_0x7982[10]](_0x7982[17],function(){_0x74c8x3[_0x7982[18]](false)},null,null,_0x7982[19]);this[_0x7982[10]](_0x7982[20],function(){_0x74c8x3[_0x7982[9]]( new VariableDialog(_0x74c8x3)[_0x7982[8]],300,180,true,true)});this[_0x7982[10]](_0x7982[21],function(){_0x74c8x3[_0x7982[9]]( new ImportDialog(_0x74c8x3)[_0x7982[8]],300,200,true,true)});this[_0x7982[10]](_0x7982[22],function(){_0x74c8x3[_0x7982[9]]( new ExportDialog(_0x74c8x3)[_0x7982[8]],300,200,true,true)},null,null,_0x7982[23]);this[_0x7982[28]](_0x7982[24], new Action(mxResources[_0x7982[26]](_0x7982[25]),mxUtils[_0x7982[27]](this,function(){this[_0x7982[1]][_0x7982[9]]( new EditFileDialog(_0x74c8x3)[_0x7982[8]],620,420,true,true)})));this[_0x7982[10]](_0x7982[29],function(){_0x74c8x3[_0x7982[9]]( new RenameDialog(_0x74c8x3)[_0x7982[8]],300,180,true,true)});this[_0x7982[10]](_0x7982[30],function(){mxUtils[_0x7982[31]](_0x74c8x5)},null,_0x7982[32],_0x7982[33]);this[_0x7982[10]](_0x7982[34],function(){mxUtils[_0x7982[35]](_0x74c8x5,null,10,10)});this[_0x7982[10]](_0x7982[36],function(){_0x74c8x4[_0x7982[37]][_0x7982[36]]()},null,_0x7982[38],_0x7982[39]);this[_0x7982[10]](_0x7982[40],function(){_0x74c8x4[_0x7982[37]][_0x7982[40]]()},null,_0x7982[41],_0x7982[42]);this[_0x7982[10]](_0x7982[43],function(){mxClipboard[_0x7982[43]](_0x74c8x5)},null,_0x7982[44],_0x7982[45]);this[_0x7982[10]](_0x7982[46],function(){mxClipboard[_0x7982[46]](_0x74c8x5)},null,_0x7982[47],_0x7982[48]);this[_0x7982[10]](_0x7982[49],function(){mxClipboard[_0x7982[49]](_0x74c8x5)},false,_0x7982[50],_0x7982[51]);this[_0x7982[10]](_0x7982[52],function(){_0x74c8x5[_0x7982[53]]()},null,null,_0x7982[54]);this[_0x7982[10]](_0x7982[55],function(){var _0x74c8x6=_0x74c8x5[_0x7982[56]];_0x74c8x5[_0x7982[59]](_0x74c8x5[_0x7982[58]](_0x74c8x5[_0x7982[57]](),_0x74c8x6,_0x74c8x6,true))},null,null,_0x7982[60]);this[_0x7982[10]](_0x7982[61],function(){_0x74c8x5[_0x7982[61]]()},null,null,_0x7982[62]);this[_0x7982[10]](_0x7982[63],function(){_0x74c8x5[_0x7982[63]]()},null,null,_0x7982[64]);this[_0x7982[10]](_0x7982[65],function(){_0x74c8x5[_0x7982[65]]()},null,null,_0x7982[66]);this[_0x7982[10]](_0x7982[67],function(){_0x74c8x5[_0x7982[67]]()},null,null,_0x7982[68]);this[_0x7982[10]](_0x7982[69],function(){_0x74c8x5[_0x7982[69]]()},null,null,_0x7982[70]);this[_0x7982[10]](_0x7982[71],function(){_0x74c8x5[_0x7982[71]]()},null,null,_0x7982[72]);this[_0x7982[10]](_0x7982[73],function(){_0x74c8x5[_0x7982[74]](false)},null,null,_0x7982[75]);this[_0x7982[10]](_0x7982[76],function(){_0x74c8x5[_0x7982[74]](true)},null,null,_0x7982[77]);this[_0x7982[10]](_0x7982[78],function(){_0x74c8x5[_0x7982[79]](false)},null,null,_0x7982[80]);this[_0x7982[10]](_0x7982[81],function(){_0x74c8x5[_0x7982[79]](true)},null,null,_0x7982[82]);this[_0x7982[10]](_0x7982[83],function(){_0x74c8x5[_0x7982[85]](_0x74c8x5[_0x7982[84]](null,0))},null,null,_0x7982[86]);this[_0x7982[10]](_0x7982[87],function(){_0x74c8x5[_0x7982[59]](_0x74c8x5[_0x7982[88]]())},null,null,_0x7982[89]);this[_0x7982[10]](_0x7982[90],function(){_0x74c8x5[_0x7982[91]]()});this[_0x7982[10]](_0x7982[92],function(){var _0x74c8x7=_0x74c8x5[_0x7982[93]]();var _0x74c8x8=_0x74c8x5[_0x7982[94]](_0x74c8x7);if(_0x74c8x8==null){_0x74c8x8=_0x7982[95]};_0x74c8x8=mxUtils[_0x7982[97]](mxResources[_0x7982[26]](_0x7982[96]),_0x74c8x8);if(_0x74c8x8!=null){_0x74c8x5[_0x7982[98]](_0x74c8x7,_0x74c8x8)}});this[_0x7982[10]](_0x7982[99],function(){var _0x74c8x7=_0x74c8x5[_0x7982[93]]();var _0x74c8x8=_0x74c8x5[_0x7982[94]](_0x74c8x7);if(_0x74c8x8!=null){window[_0x7982[11]](_0x74c8x8)}});this[_0x7982[10]](_0x7982[100],function(){var _0x74c8x9=_0x74c8x5[_0x7982[57]]();if(_0x74c8x9!=null){_0x74c8x5[_0x7982[102]]()[_0x7982[101]]();try{for(var _0x74c8xa=0;_0x74c8xa<_0x74c8x9[_0x7982[103]];_0x74c8xa++){var _0x74c8x7=_0x74c8x9[_0x74c8xa];if(_0x74c8x5[_0x7982[102]]()[_0x7982[104]](_0x74c8x7)){_0x74c8x5[_0x7982[105]]([_0x74c8x7],20)}else {_0x74c8x5[_0x7982[106]](_0x74c8x7)}}}finally{_0x74c8x5[_0x7982[102]]()[_0x7982[107]]()}}});this[_0x7982[10]](_0x7982[108],function(){var _0x74c8xb=_0x74c8x5[_0x7982[110]]()[_0x7982[109]](_0x74c8x5[_0x7982[93]]());var _0x74c8xc=_0x7982[111];if(_0x74c8xb!=null&&_0x74c8xb[_0x7982[113]][mxConstants[_0x7982[112]]]==_0x7982[111]){_0x74c8xc=null};_0x74c8x5[_0x7982[114]](mxConstants.STYLE_WHITE_SPACE,_0x74c8xc)});this[_0x7982[10]](_0x7982[115],function(){var _0x74c8xc=_0x7982[116];var _0x74c8xb=_0x74c8x5[_0x7982[110]]()[_0x7982[109]](_0x74c8x5[_0x7982[93]]());if(_0x74c8xb!=null){_0x74c8xc=_0x74c8xb[_0x7982[113]][mxConstants[_0x7982[117]]]||_0x74c8xc};_0x74c8xc=mxUtils[_0x7982[97]](mxResources[_0x7982[26]](_0x7982[96])+_0x7982[118]+mxResources[_0x7982[26]](_0x7982[115])+_0x7982[119],_0x74c8xc);if(_0x74c8xc!=null){_0x74c8x5[_0x7982[114]](mxConstants.STYLE_ROTATION,_0x74c8xc)}});this[_0x7982[10]](_0x7982[120],function(){var _0x74c8x9=_0x74c8x5[_0x7982[57]]();if(_0x74c8x9!=null){_0x74c8x5[_0x7982[102]]()[_0x7982[101]]();try{for(var _0x74c8xa=0;_0x74c8xa<_0x74c8x9[_0x7982[103]];_0x74c8xa++){var _0x74c8x7=_0x74c8x9[_0x74c8xa];if(_0x74c8x5[_0x7982[102]]()[_0x7982[121]](_0x74c8x7)&&_0x74c8x5[_0x7982[102]]()[_0x7982[104]](_0x74c8x7)==0){var _0x74c8xd=_0x74c8x5[_0x7982[122]](_0x74c8x7);if(_0x74c8xd!=null){_0x74c8xd=_0x74c8xd[_0x7982[123]]();_0x74c8xd[_0x7982[124]]+=_0x74c8xd[_0x7982[125]]/2-_0x74c8xd[_0x7982[126]]/2;_0x74c8xd[_0x7982[127]]+=_0x74c8xd[_0x7982[126]]/2-_0x74c8xd[_0x7982[125]]/2;var _0x74c8xe=_0x74c8xd[_0x7982[125]];_0x74c8xd[_0x7982[125]]=_0x74c8xd[_0x7982[126]];_0x74c8xd[_0x7982[126]]=_0x74c8xe;_0x74c8x5[_0x7982[102]]()[_0x7982[128]](_0x74c8x7,_0x74c8xd);var _0x74c8xb=_0x74c8x5[_0x7982[129]][_0x7982[109]](_0x74c8x7);if(_0x74c8xb!=null){var _0x74c8xf=_0x74c8xb[_0x7982[113]][mxConstants[_0x7982[130]]]||_0x7982[131];if(_0x74c8xf==_0x7982[131]){_0x74c8xf=_0x7982[132]}else {if(_0x74c8xf==_0x7982[132]){_0x74c8xf=_0x7982[133]}else {if(_0x74c8xf==_0x7982[133]){_0x74c8xf=_0x7982[134]}else {if(_0x74c8xf==_0x7982[134]){_0x74c8xf=_0x7982[131]}}}};_0x74c8x5[_0x7982[114]](mxConstants.STYLE_DIRECTION,_0x74c8xf,[_0x74c8x7])}}}}}finally{_0x74c8x5[_0x7982[102]]()[_0x7982[107]]()}}},null,null,_0x7982[135]);this[_0x7982[10]](_0x7982[136],function(){_0x74c8x5[_0x7982[137]](1)});this[_0x7982[10]](_0x7982[138],function(){_0x74c8x5[_0x7982[138]]()},null,null,_0x7982[139]);this[_0x7982[10]](_0x7982[140],function(){_0x74c8x5[_0x7982[140]]()},null,null,_0x7982[141]);this[_0x7982[10]](_0x7982[142],function(){_0x74c8x5[_0x7982[143]]()});this[_0x7982[10]](_0x7982[144],mxUtils[_0x7982[27]](this,function(){if(!_0x74c8x5[_0x7982[145]]){this[_0x7982[26]](_0x7982[147])[_0x7982[146]]()};var _0x74c8x10=_0x74c8x5[_0x7982[148]];var _0x74c8x11=_0x74c8x5[_0x7982[149]];var _0x74c8x12=_0x74c8x5[_0x7982[8]][_0x7982[150]]-20;var _0x74c8x13=_0x74c8x5[_0x7982[8]][_0x7982[151]]-20;var _0x74c8x14=Math[_0x7982[153]](100*Math[_0x7982[152]](_0x74c8x12/_0x74c8x10[_0x7982[125]]/_0x74c8x11,_0x74c8x13/_0x74c8x10[_0x7982[126]]/_0x74c8x11))/100;_0x74c8x5[_0x7982[137]](_0x74c8x14);_0x74c8x5[_0x7982[8]][_0x7982[154]]=Math[_0x7982[157]](_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[124]]*_0x74c8x14-Math[_0x7982[156]](10,(_0x74c8x5[_0x7982[8]][_0x7982[150]]-_0x74c8x10[_0x7982[125]]*_0x74c8x11*_0x74c8x14)/2));_0x74c8x5[_0x7982[8]][_0x7982[158]]=Math[_0x7982[157]](_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[127]]*_0x74c8x14-Math[_0x7982[156]](10,(_0x74c8x5[_0x7982[8]][_0x7982[151]]-_0x74c8x10[_0x7982[126]]*_0x74c8x11*_0x74c8x14)/2))}));this[_0x7982[10]](_0x7982[159],mxUtils[_0x7982[27]](this,function(){if(!_0x74c8x5[_0x7982[145]]){this[_0x7982[26]](_0x7982[147])[_0x7982[146]]()};var _0x74c8x10=_0x74c8x5[_0x7982[148]];var _0x74c8x11=_0x74c8x5[_0x7982[149]];var _0x74c8x12=_0x74c8x5[_0x7982[8]][_0x7982[150]]-20;var _0x74c8x14=Math[_0x7982[153]](100*_0x74c8x12/_0x74c8x10[_0x7982[125]]/_0x74c8x11)/100;_0x74c8x5[_0x7982[137]](_0x74c8x14);_0x74c8x5[_0x7982[8]][_0x7982[154]]=Math[_0x7982[157]](_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[124]]*_0x74c8x14-Math[_0x7982[156]](10,(_0x74c8x5[_0x7982[8]][_0x7982[150]]-_0x74c8x10[_0x7982[125]]*_0x74c8x11*_0x74c8x14)/2));_0x74c8x5[_0x7982[8]][_0x7982[158]]=Math[_0x7982[157]](_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[127]]*_0x74c8x14-Math[_0x7982[156]](10,(_0x74c8x5[_0x7982[8]][_0x7982[151]]-_0x74c8x10[_0x7982[126]]*_0x74c8x11*_0x74c8x14)/2))}));this[_0x7982[28]](_0x7982[160], new Action(mxResources[_0x7982[26]](_0x7982[161]),function(){var _0x74c8xc=mxUtils[_0x7982[97]](mxResources[_0x7982[26]](_0x7982[96])+_0x7982[162],parseInt(_0x74c8x5[_0x7982[110]]()[_0x7982[163]]()*100));if(_0x74c8xc!=null&&_0x74c8xc[_0x7982[103]]>0&&!isNaN(parseInt(_0x74c8xc))){_0x74c8x5[_0x7982[137]](parseInt(_0x74c8xc)/100)}}));var _0x74c8x15=null;_0x74c8x15=this[_0x7982[10]](_0x7982[164],function(){_0x74c8x5[_0x7982[166]](!_0x74c8x5[_0x7982[165]]());_0x74c8x4[_0x7982[167]]()},null,null,_0x7982[168]);_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[165]]()});_0x74c8x15=this[_0x7982[10]](_0x7982[171],function(){_0x74c8x5[_0x7982[173]][_0x7982[172]]=!_0x74c8x5[_0x7982[173]][_0x7982[172]]});_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[173]][_0x7982[172]]});_0x74c8x15=this[_0x7982[10]](_0x7982[174],function(){_0x74c8x5[_0x7982[176]][_0x7982[177]](!_0x74c8x5[_0x7982[176]][_0x7982[175]]())});_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[176]][_0x7982[175]]()});_0x74c8x15=this[_0x7982[10]](_0x7982[178],function(){_0x74c8x5[_0x7982[179]]=!_0x74c8x5[_0x7982[179]];_0x74c8x5[_0x7982[129]][_0x7982[180]]()});_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[179]]});_0x74c8x15=this[_0x7982[10]](_0x7982[181],function(){_0x74c8x5[_0x7982[181]]=!_0x74c8x5[_0x7982[181]];_0x74c8x4[_0x7982[167]]();if(!_0x74c8x5[_0x7982[181]]){var _0x74c8x16=_0x74c8x5[_0x7982[129]][_0x7982[155]];_0x74c8x5[_0x7982[129]][_0x7982[183]](_0x74c8x16[_0x7982[124]]-_0x74c8x5[_0x7982[8]][_0x7982[154]]/_0x74c8x5[_0x7982[129]][_0x7982[182]],_0x74c8x16[_0x7982[127]]-_0x74c8x5[_0x7982[8]][_0x7982[158]]/_0x74c8x5[_0x7982[129]][_0x7982[182]]);_0x74c8x5[_0x7982[8]][_0x7982[154]]=0;_0x74c8x5[_0x7982[8]][_0x7982[158]]=0;_0x74c8x5[_0x7982[184]]()}else {var _0x74c8x17=_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[124]];var _0x74c8x18=_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[127]];_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[124]]=0;_0x74c8x5[_0x7982[129]][_0x7982[155]][_0x7982[127]]=0;_0x74c8x5[_0x7982[184]]();_0x74c8x5[_0x7982[8]][_0x7982[154]]-=Math[_0x7982[157]](_0x74c8x17*_0x74c8x5[_0x7982[129]][_0x7982[182]]);_0x74c8x5[_0x7982[8]][_0x7982[158]]-=Math[_0x7982[157]](_0x74c8x18*_0x74c8x5[_0x7982[129]][_0x7982[182]])}},!mxClient.IS_TOUCH);_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[8]][_0x7982[113]][_0x7982[185]]==_0x7982[186]});_0x74c8x15=this[_0x7982[10]](_0x7982[147],mxUtils[_0x7982[27]](this,function(){_0x74c8x5[_0x7982[145]]=!_0x74c8x5[_0x7982[145]];_0x74c8x5[_0x7982[187]]=_0x74c8x5[_0x7982[145]];_0x74c8x5[_0x7982[188]]=_0x74c8x5[_0x7982[187]];_0x74c8x5[_0x7982[129]][_0x7982[189]]();_0x74c8x5[_0x7982[184]]();_0x74c8x4[_0x7982[167]]();_0x74c8x4[_0x7982[191]][_0x7982[190]]();if(mxUtils[_0x7982[192]](_0x74c8x5[_0x7982[8]])){if(_0x74c8x5[_0x7982[145]]){_0x74c8x5[_0x7982[8]][_0x7982[154]]-=20;_0x74c8x5[_0x7982[8]][_0x7982[158]]-=20}else {_0x74c8x5[_0x7982[8]][_0x7982[154]]+=20;_0x74c8x5[_0x7982[8]][_0x7982[158]]+=20}}}));_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[145]]});_0x74c8x15=this[_0x7982[10]](_0x7982[193],function(){_0x74c8x5[_0x7982[195]](!_0x74c8x5[_0x7982[194]][_0x7982[175]]())},null,null,_0x7982[196]);_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[194]][_0x7982[175]]()});_0x74c8x15=this[_0x7982[10]](_0x7982[197],function(){_0x74c8x5[_0x7982[194]][_0x7982[199]](!_0x74c8x5[_0x7982[194]][_0x7982[198]]())});_0x74c8x15[_0x7982[169]](true);_0x74c8x15[_0x7982[170]](function(){return _0x74c8x5[_0x7982[194]][_0x7982[198]]()});this[_0x7982[10]](_0x7982[200],function(){var _0x74c8x19=_0x7982[95];if(mxResources[_0x7982[202]](mxClient[_0x7982[201]])){_0x74c8x19=_0x7982[203]+mxClient[_0x7982[201]]};window[_0x7982[11]](RESOURCES_PATH+_0x7982[204]+_0x74c8x19+_0x7982[205])});this[_0x7982[28]](_0x7982[206], new Action(mxResources[_0x7982[26]](_0x7982[206])+_0x7982[207],function(){_0x74c8x3[_0x7982[9]]( new AboutDialog(_0x74c8x3)[_0x7982[8]],320,280,true,true)},null,null,_0x7982[208]));var _0x74c8x1a=mxUtils[_0x7982[27]](this,function(_0x74c8x1b,_0x74c8x1c){this[_0x7982[10]](_0x74c8x1b,function(){_0x74c8x5[_0x7982[209]](mxConstants.STYLE_FONTSTYLE,_0x74c8x1c)})});_0x74c8x1a(_0x7982[210],mxConstants.FONT_BOLD);_0x74c8x1a(_0x7982[211],mxConstants.FONT_ITALIC);_0x74c8x1a(_0x7982[212],mxConstants.FONT_UNDERLINE);this[_0x7982[10]](_0x7982[213],function(){_0x74c8x5[_0x7982[214]](mxConstants.STYLE_SHADOW)});this[_0x7982[10]](_0x7982[215],function(){_0x74c8x5[_0x7982[214]](mxConstants.STYLE_DASHED)});this[_0x7982[10]](_0x7982[216],function(){_0x74c8x5[_0x7982[214]](mxConstants.STYLE_ROUNDED)});this[_0x7982[10]](_0x7982[217],function(){_0x74c8x5[_0x7982[214]](mxConstants.STYLE_CURVED)});this[_0x7982[10]](_0x7982[113],function(){var _0x74c8x9=_0x74c8x5[_0x7982[57]]();if(_0x74c8x9!=null&&_0x74c8x9[_0x7982[103]]>0){var _0x74c8x1d=_0x74c8x5[_0x7982[102]]();var _0x74c8x1c=mxUtils[_0x7982[97]](mxResources[_0x7982[26]](_0x7982[96])+_0x7982[118]+mxResources[_0x7982[26]](_0x7982[113])+_0x7982[218],_0x74c8x1d[_0x7982[219]](_0x74c8x9[0])||_0x7982[95]);if(_0x74c8x1c!=null){_0x74c8x5[_0x7982[220]](_0x74c8x1c,_0x74c8x9)}}});this[_0x7982[10]](_0x7982[221],function(){_0x74c8x5[_0x7982[222]](_0x74c8x5[_0x7982[93]]())});this[_0x7982[10]](_0x7982[223],function(){var _0x74c8x7=_0x74c8x5[_0x7982[93]]();if(_0x74c8x7!=null&&_0x74c8x5[_0x7982[102]]()[_0x7982[224]](_0x74c8x7)){var _0x74c8x1e=_0x74c8x4[_0x7982[6]][_0x7982[226]][_0x7982[225]](_0x74c8x7);if(_0x74c8x1e instanceof mxEdgeHandler){var _0x74c8x16=_0x74c8x5[_0x7982[129]][_0x7982[155]];var _0x74c8x6=_0x74c8x5[_0x7982[129]][_0x7982[182]];var _0x74c8x17=_0x74c8x16[_0x7982[124]];var _0x74c8x18=_0x74c8x16[_0x7982[127]];var _0x74c8x1f=_0x74c8x5[_0x7982[102]]()[_0x7982[227]](_0x74c8x7);var _0x74c8x20=_0x74c8x5[_0x7982[122]](_0x74c8x1f);if(_0x74c8x5[_0x7982[102]]()[_0x7982[121]](_0x74c8x1f)&&_0x74c8x20!=null){_0x74c8x17+=_0x74c8x20[_0x7982[124]];_0x74c8x18+=_0x74c8x20[_0x7982[127]]};_0x74c8x1e[_0x7982[232]](_0x74c8x1e[_0x7982[228]],_0x74c8x5[_0x7982[230]][_0x7982[229]]/_0x74c8x6-_0x74c8x17,_0x74c8x5[_0x7982[230]][_0x7982[231]]/_0x74c8x6-_0x74c8x18)}}});this[_0x7982[10]](_0x7982[233],function(){var _0x74c8x21=_0x74c8x3[_0x7982[2]][_0x7982[26]](_0x7982[233]);if(_0x74c8x21[_0x7982[234]]!=null){_0x74c8x21[_0x7982[234]][_0x7982[236]](_0x74c8x21[_0x7982[234]][_0x7982[228]],_0x74c8x21[_0x7982[235]])}});this[_0x7982[10]](_0x7982[237],function(){function _0x74c8x22(_0x74c8xc,_0x74c8x23,_0x74c8x24){var _0x74c8x25=null;var _0x74c8x9=_0x74c8x5[_0x7982[57]]();_0x74c8x5[_0x7982[102]]()[_0x7982[101]]();try{if(_0x74c8x9[_0x7982[103]]==0){var _0x74c8x26=_0x74c8x5[_0x7982[238]]();_0x74c8x9=[_0x74c8x5[_0x7982[240]](_0x74c8x5[_0x7982[239]](),null,_0x7982[95],_0x74c8x26,_0x74c8x26,_0x74c8x23,_0x74c8x24)];_0x74c8x25=_0x74c8x9};_0x74c8x5[_0x7982[114]](mxConstants.STYLE_IMAGE,_0x74c8xc,_0x74c8x9);_0x74c8x5[_0x7982[114]](mxConstants.STYLE_SHAPE,_0x7982[237],_0x74c8x9);if(_0x74c8x5[_0x7982[241]]()==1){if(_0x74c8x23!=null&&_0x74c8x24!=null){var _0x74c8x7=_0x74c8x9[0];var _0x74c8xd=_0x74c8x5[_0x7982[102]]()[_0x7982[242]](_0x74c8x7);if(_0x74c8xd!=null){_0x74c8xd=_0x74c8xd[_0x7982[123]]();_0x74c8xd[_0x7982[125]]=_0x74c8x23;_0x74c8xd[_0x7982[126]]=_0x74c8x24;_0x74c8x5[_0x7982[102]]()[_0x7982[128]](_0x74c8x7,_0x74c8xd)}}}}finally{_0x74c8x5[_0x7982[102]]()[_0x7982[107]]()};if(_0x74c8x25!=null){_0x74c8x5[_0x7982[59]](_0x74c8x25);_0x74c8x5[_0x7982[243]](_0x74c8x25[0])}}var _0x74c8xc=_0x7982[95];var _0x74c8xb=_0x74c8x5[_0x7982[110]]()[_0x7982[109]](_0x74c8x5[_0x7982[93]]());if(_0x74c8xb!=null){_0x74c8xc=_0x74c8xb[_0x7982[113]][mxConstants[_0x7982[244]]]||_0x74c8xc};_0x74c8xc=mxUtils[_0x7982[97]](mxResources[_0x7982[26]](_0x7982[96])+_0x7982[118]+mxResources[_0x7982[26]](_0x7982[245])+_0x7982[218],_0x74c8xc);if(_0x74c8xc!=null){if(_0x74c8xc[_0x7982[103]]>0){var _0x74c8x27= new Image();_0x74c8x27[_0x7982[246]]=function(){_0x74c8x22(_0x74c8xc,_0x74c8x27[_0x7982[125]],_0x74c8x27[_0x7982[126]])};_0x74c8x27[_0x7982[247]]=function(){mxUtils[_0x7982[249]](mxResources[_0x7982[26]](_0x7982[248]))};_0x74c8x27[_0x7982[250]]=_0x74c8xc}}})};Actions[_0x7982[4]][_0x7982[10]]=function(_0x74c8x1b,_0x74c8x28,_0x74c8x29,_0x74c8x2a,_0x74c8x2b){return this[_0x7982[28]](_0x74c8x1b, new Action(mxResources[_0x7982[26]](_0x74c8x1b),_0x74c8x28,_0x74c8x29,_0x74c8x2a,_0x74c8x2b))};Actions[_0x7982[4]][_0x7982[28]]=function(_0x74c8x2c,_0x74c8x15){this[_0x7982[2]][_0x74c8x2c]=_0x74c8x15;return _0x74c8x15};Actions[_0x7982[4]][_0x7982[26]]=function(_0x74c8x2c){return this[_0x7982[2]][_0x74c8x2c]};function Action(_0x74c8x2e,_0x74c8x28,_0x74c8x29,_0x74c8x2a,_0x74c8x2b){mxEventSource[_0x7982[251]](this);this[_0x7982[252]]=_0x74c8x2e;this[_0x7982[146]]=_0x74c8x28;this[_0x7982[253]]=(_0x74c8x29!=null)?_0x74c8x29:true;this[_0x7982[254]]=_0x74c8x2a;this[_0x7982[255]]=_0x74c8x2b}mxUtils[_0x7982[256]](Action,mxEventSource);Action[_0x7982[4]][_0x7982[177]]=function(_0x74c8xc){if(this[_0x7982[253]]!=_0x74c8xc){this[_0x7982[253]]=_0x74c8xc;this[_0x7982[258]]( new mxEventObject(_0x7982[257]))}};Action[_0x7982[4]][_0x7982[169]]=function(_0x74c8xc){this[_0x7982[259]]=_0x74c8xc};Action[_0x7982[4]][_0x7982[170]]=function(_0x74c8x28){this[_0x7982[260]]=_0x74c8x28};Action[_0x7982[4]][_0x7982[261]]=function(){return this[_0x7982[260]]()} \ No newline at end of file +'use strict'; +/** + * $Id: Actions.js,v 1.7 2013-02-14 07:48:01 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs the actions object for the given UI. + */ +function Actions(editorUi) { + this.editorUi = editorUi; + this.actions = new Object(); + this.init(); +}; + +/** + * Adds the default actions. + */ +Actions.prototype.init = function() { + var ui = this.editorUi; + var editor = ui.editor; + var graph = editor.graph; + + // File actions + this.addAction('new', function() { + ui.showDialog(new NewDialog(ui).container, 300, 180, true, true); + }); + this.addAction('open', function() { + ui.showDialog(new OpenDialog(ui).container, 300, 180, true, true); + }); + this.addAction('save', function() { + ui.saveFile(false); + }, null, null, 'Ctrl+S'); + this.addAction('saveAs', function() { + ui.saveFile(true); + }, null, null, 'Ctrl+Shift-S'); + this.addAction('publish', function() { + ui.publishFile(false); + }, null, null, 'Ctrl+Shift+P'); + this.addAction('variable', function() { + ui.showDialog(new VariableDialog(ui).container, 300, 180, true, true); + }); + this.addAction('import', function() { + ui.showDialog(new ImportDialog(ui).container, 300, 200, true, true); + }); + this.addAction('export', function() { + ui.showDialog(new ExportDialog(ui).container, 300, 200, true, true); + }, null, null, 'Ctrl+E'); + this.put('editFile', new Action(mxResources.get('edit'), mxUtils.bind(this, + function() { + this.editorUi.showDialog(new EditFileDialog(ui).container, 620, 420, + true, true); + }))); + this.addAction('rename', function() { + ui.showDialog(new RenameDialog(ui).container, 300, 180, true, true); + }); + this.addAction('print', function() { + mxUtils.printScreen(graph); + }, null, 'sprite-print', 'Ctrl+P'); + this.addAction('preview', function() { + mxUtils.show(graph, null, 10, 10); + }); + + // Edit actions + this.addAction('undo', function() { + editor.undoManager.undo(); + }, null, 'sprite-undo', 'Ctrl+Z'); + this.addAction('redo', function() { + editor.undoManager.redo(); + }, null, 'sprite-redo', 'Ctrl+Y'); + this.addAction('cut', function() { + mxClipboard.cut(graph); + }, null, 'sprite-cut', 'Ctrl+X'); + this.addAction('copy', function() { + mxClipboard.copy(graph); + }, null, 'sprite-copy', 'Ctrl+C'); + this.addAction('paste', function() { + mxClipboard.paste(graph); + }, false, 'sprite-paste', 'Ctrl+V'); + this.addAction('delete', function() { + graph.removeCells(); + }, null, null, 'Delete'); + this.addAction('duplicate', function() { + var s = graph.gridSize; + graph.setSelectionCells(graph.moveCells(graph.getSelectionCells(), s, s, + true)); + }, null, null, 'Ctrl+D'); + this.addAction('selectVertices', function() { + graph.selectVertices(); + }, null, null, 'Ctrl+Shift+V'); + this.addAction('selectEdges', function() { + graph.selectEdges(); + }, null, null, 'Ctrl+Shift+E'); + this.addAction('selectAll', function() { + graph.selectAll(); + }, null, null, 'Ctrl+A'); + + // Navigation actions + this.addAction('home', function() { + graph.home(); + }, null, null, 'Home'); + this.addAction('exitGroup', function() { + graph.exitGroup(); + }, null, null, 'Page Up'); + this.addAction('enterGroup', function() { + graph.enterGroup(); + }, null, null, 'Page Down'); + this.addAction('expand', function() { + graph.foldCells(false); + }, null, null, 'Enter'); + this.addAction('collapse', function() { + graph.foldCells(true); + }, null, null, 'Backspace'); + + // Arrange actions + this.addAction('toFront', function() { + graph.orderCells(false); + }, null, null, 'Ctrl+F'); + this.addAction('toBack', function() { + graph.orderCells(true); + }, null, null, 'Ctrl+B'); + this.addAction('group', function() { + graph.setSelectionCell(graph.groupCells(null, 0)); + }, null, null, 'Ctrl+G'); + this.addAction('ungroup', function() { + graph.setSelectionCells(graph.ungroupCells()); + }, null, null, 'Ctrl+U'); + this.addAction('removeFromGroup', function() { + graph.removeCellsFromParent(); + }); + this.addAction('editLink', function() { + var cell = graph.getSelectionCell(); + var link = graph.getLinkForCell(cell); + + if (link == null) { + link = ''; + } + + link = mxUtils.prompt(mxResources.get('enterValue'), link); + + if (link != null) { + graph.setLinkForCell(cell, link); + } + }); + this.addAction('openLink', function() { + var cell = graph.getSelectionCell(); + var link = graph.getLinkForCell(cell); + + if (link != null) { + window.open(link); + } + }); + this.addAction('autosize', function() { + var cells = graph.getSelectionCells(); + + if (cells != null) { + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().getChildCount(cell)) { + graph.updateGroupBounds([cell], 20); + } else { + graph.updateCellSize(cell); + } + } + } finally { + graph.getModel().endUpdate(); + } + } + }); + this.addAction('wordWrap', function() { + var state = graph.getView().getState(graph.getSelectionCell()); + var value = 'wrap'; + + if (state != null && state.style[mxConstants.STYLE_WHITE_SPACE] == 'wrap') { + value = null; + } + + graph.setCellStyles(mxConstants.STYLE_WHITE_SPACE, value); + }); + this.addAction('rotation', function() { + var value = '0'; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[mxConstants.STYLE_ROTATION] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ' (' + + mxResources.get('rotation') + ' 0-360)', value); + + if (value != null) { + graph.setCellStyles(mxConstants.STYLE_ROTATION, value); + } + }); + this.addAction('tilt', function() { + var cells = graph.getSelectionCells(); + + if (cells != null) { + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().isVertex(cell) && graph.getModel().getChildCount( + cell) == 0) { + var geo = graph.getCellGeometry(cell); + + if (geo != null) { + // Rotates the size and position in the geometry + geo = geo.clone(); + geo.x += geo.width / 2 - geo.height / 2; + geo.y += geo.height / 2 - geo.width / 2; + var tmp = geo.width; + geo.width = geo.height; + geo.height = tmp; + graph.getModel().setGeometry(cell, geo); + + // Reads the current direction and advances by 90 degrees + var state = graph.view.getState(cell); + + if (state != null) { + var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east' /*default*/ ; + + if (dir == 'east') { + dir = 'south'; + } else if (dir == 'south') { + dir = 'west'; + } else if (dir == 'west') { + dir = 'north'; + } else if (dir == 'north') { + dir = 'east'; + } + + graph.setCellStyles(mxConstants.STYLE_DIRECTION, dir, [cell]); + } + } + } + } + } finally { + graph.getModel().endUpdate(); + } + } + }, null, null, 'Ctrl+R'); + + // View actions + this.addAction('actualSize', function() { + graph.zoomTo(1); + }); + this.addAction('zoomIn', function() { + graph.zoomIn(); + }, null, null, 'Add'); + this.addAction('zoomOut', function() { + graph.zoomOut(); + }, null, null, 'Subtract'); + this.addAction('fitWindow', function() { + graph.fit(); + }); + + this.addAction('fitPage', mxUtils.bind(this, function() { + if (!graph.pageVisible) { + this.get('pageView').funct(); + } + + var fmt = graph.pageFormat; + var ps = graph.pageScale; + var cw = graph.container.clientWidth - 20; + var ch = graph.container.clientHeight - 20; + + var scale = Math.floor(100 * Math.min(cw / fmt.width / ps, ch / fmt.height / + ps)) / 100; + graph.zoomTo(scale); + + graph.container.scrollLeft = Math.round(graph.view.translate.x * scale - + Math.max(10, (graph.container.clientWidth - fmt.width * ps * scale) / 2) + ); + graph.container.scrollTop = Math.round(graph.view.translate.y * scale - + Math.max(10, (graph.container.clientHeight - fmt.height * ps * scale) / + 2)); + })); + this.addAction('fitPageWidth', mxUtils.bind(this, function() { + if (!graph.pageVisible) { + this.get('pageView').funct(); + } + + var fmt = graph.pageFormat; + var ps = graph.pageScale; + var cw = graph.container.clientWidth - 20; + + var scale = Math.floor(100 * cw / fmt.width / ps) / 100; + graph.zoomTo(scale); + + graph.container.scrollLeft = Math.round(graph.view.translate.x * scale - + Math.max(10, (graph.container.clientWidth - fmt.width * ps * scale) / 2) + ); + graph.container.scrollTop = Math.round(graph.view.translate.y * scale - + Math.max(10, (graph.container.clientHeight - fmt.height * ps * scale) / + 2)); + })); + this.put('customZoom', new Action(mxResources.get('custom'), function() { + var value = mxUtils.prompt(mxResources.get('enterValue') + ' (%)', + parseInt(graph.getView().getScale() * 100)); + + if (value != null && value.length > 0 && !isNaN(parseInt(value))) { + graph.zoomTo(parseInt(value) / 100); + } + })); + + // Option actions + var action = null; + action = this.addAction('grid', function() { + graph.setGridEnabled(!graph.isGridEnabled()); + editor.updateGraphComponents(); + }, null, null, 'Ctrl+Shift+G'); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.isGridEnabled(); + }); + action = this.addAction('guides', function() { + graph.graphHandler.guidesEnabled = !graph.graphHandler.guidesEnabled; + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.graphHandler.guidesEnabled; + }); + action = this.addAction('tooltips', function() { + graph.tooltipHandler.setEnabled(!graph.tooltipHandler.isEnabled()); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.tooltipHandler.isEnabled(); + }); + action = this.addAction('navigation', function() { + graph.foldingEnabled = !graph.foldingEnabled; + graph.view.revalidate(); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.foldingEnabled; + }); + action = this.addAction('scrollbars', function() { + graph.scrollbars = !graph.scrollbars; + editor.updateGraphComponents(); + + if (!graph.scrollbars) { + var t = graph.view.translate; + graph.view.setTranslate(t.x - graph.container.scrollLeft / graph.view.scale, + t.y - graph.container.scrollTop / graph.view.scale); + graph.container.scrollLeft = 0; + graph.container.scrollTop = 0; + graph.sizeDidChange(); + } else { + var dx = graph.view.translate.x; + var dy = graph.view.translate.y; + + graph.view.translate.x = 0; + graph.view.translate.y = 0; + graph.sizeDidChange(); + graph.container.scrollLeft -= Math.round(dx * graph.view.scale); + graph.container.scrollTop -= Math.round(dy * graph.view.scale); + } + }, !mxClient.IS_TOUCH); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.container.style.overflow == 'auto'; + }); + action = this.addAction('pageView', mxUtils.bind(this, function() { + graph.pageVisible = !graph.pageVisible; + graph.pageBreaksVisible = graph.pageVisible; + graph.preferPageSize = graph.pageBreaksVisible; + graph.view.validate(); + graph.sizeDidChange(); + + editor.updateGraphComponents(); + editor.outline.update(); + + if (mxUtils.hasScrollbars(graph.container)) { + if (graph.pageVisible) { + graph.container.scrollLeft -= 20; + graph.container.scrollTop -= 20; + } else { + graph.container.scrollLeft += 20; + graph.container.scrollTop += 20; + } + } + })); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.pageVisible; + }); + action = this.addAction('connect', function() { + graph.setConnectable(!graph.connectionHandler.isEnabled()); + }, null, null, 'Ctrl+Q'); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.connectionHandler.isEnabled(); + }); + action = this.addAction('copyConnect', function() { + graph.connectionHandler.setCreateTarget(!graph.connectionHandler.isCreateTarget()); + }); + action.setToggleAction(true); + action.setSelectedCallback(function() { + return graph.connectionHandler.isCreateTarget(); + }); + + // Help actions + this.addAction('help', function() { + var ext = ''; + + if (mxResources.isLanguageSupported(mxClient.language)) { + ext = '_' + mxClient.language; + } + + window.open(RESOURCES_PATH + '/help' + ext + '.html'); + }); + this.put('about', new Action(mxResources.get('about') + ' Cally Square', + function() { + ui.showDialog(new AboutDialog(ui).container, 320, 280, true, true); + }, null, null, 'F1')); + + // Font style actions + var toggleFontStyle = mxUtils.bind(this, function(key, style) { + this.addAction(key, function() { + graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, style); + }); + }); + + toggleFontStyle('bold', mxConstants.FONT_BOLD); + toggleFontStyle('italic', mxConstants.FONT_ITALIC); + toggleFontStyle('underline', mxConstants.FONT_UNDERLINE); + + // Format actions + this.addAction('shadow', function() { + graph.toggleCellStyles(mxConstants.STYLE_SHADOW); + }); + this.addAction('dashed', function() { + graph.toggleCellStyles(mxConstants.STYLE_DASHED); + }); + this.addAction('rounded', function() { + graph.toggleCellStyles(mxConstants.STYLE_ROUNDED); + }); + this.addAction('curved', function() { + graph.toggleCellStyles(mxConstants.STYLE_CURVED); + }); + this.addAction('style', function() { + var cells = graph.getSelectionCells(); + + if (cells != null && cells.length > 0) { + var model = graph.getModel(); + var style = mxUtils.prompt(mxResources.get('enterValue') + ' (' + + mxResources.get('style') + ')', + model.getStyle(cells[0]) || ''); + + if (style != null) { + graph.setCellStyle(style, cells); + } + } + }); + this.addAction('setAsDefaultEdge', function() { + graph.setDefaultEdge(graph.getSelectionCell()); + }); + this.addAction('addWaypoint', function() { + var cell = graph.getSelectionCell(); + + if (cell != null && graph.getModel().isEdge(cell)) { + var handler = editor.graph.selectionCellsHandler.getHandler(cell); + + if (handler instanceof mxEdgeHandler) { + var t = graph.view.translate; + var s = graph.view.scale; + var dx = t.x; + var dy = t.y; + + var parent = graph.getModel().getParent(cell); + var pgeo = graph.getCellGeometry(parent); + + if (graph.getModel().isVertex(parent) && pgeo != null) { + dx += pgeo.x; + dy += pgeo.y; + } + + handler.addPointAt(handler.state, graph.panningHandler.triggerX / s - dx, + graph.panningHandler.triggerY / s - dy); + } + } + }); + this.addAction('removeWaypoint', function() { + // TODO: Action should run with "this" set to action + var rmWaypointAction = ui.actions.get('removeWaypoint'); + + if (rmWaypointAction.handler != null) { + // NOTE: Popupevent handled and action updated in Menus.createPopupMenu + rmWaypointAction.handler.removePoint(rmWaypointAction.handler.state, + rmWaypointAction.index); + } + }); + this.addAction('image', function() { + function updateImage(value, w, h) { + var select = null; + var cells = graph.getSelectionCells(); + + graph.getModel().beginUpdate(); + try { + // Inserts new cell if no cell is selected + if (cells.length == 0) { + var gs = graph.getGridSize(); + cells = [graph.insertVertex(graph.getDefaultParent(), null, '', gs, gs, + w, h)]; + select = cells; + } + + graph.setCellStyles(mxConstants.STYLE_IMAGE, value, cells); + graph.setCellStyles(mxConstants.STYLE_SHAPE, 'image', cells); + + if (graph.getSelectionCount() == 1) { + if (w != null && h != null) { + var cell = cells[0]; + var geo = graph.getModel().getGeometry(cell); + + if (geo != null) { + geo = geo.clone(); + geo.width = w; + geo.height = h; + graph.getModel().setGeometry(cell, geo); + } + } + } + } finally { + graph.getModel().endUpdate(); + } + + if (select != null) { + graph.setSelectionCells(select); + graph.scrollCellToVisible(select[0]); + } + }; + + var value = ''; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[mxConstants.STYLE_IMAGE] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ' (' + mxResources.get( + 'url') + ')', value); + + if (value != null) { + if (value.length > 0) { + var img = new Image(); + + img.onload = function() { + updateImage(value, img.width, img.height); + }; + img.onerror = function() { + mxUtils.alert(mxResources.get('fileNotFound')); + }; + + img.src = value; + } + } + }); +}; + +/** + * Registers the given action under the given name. + */ +Actions.prototype.addAction = function(key, funct, enabled, iconCls, shortcut) { + return this.put(key, new Action(mxResources.get(key), funct, enabled, iconCls, + shortcut)); +}; + +/** + * Registers the given action under the given name. + */ +Actions.prototype.put = function(name, action) { + this.actions[name] = action; + + return action; +}; + +/** + * Returns the action for the given name or null if no such action exists. + */ +Actions.prototype.get = function(name) { + return this.actions[name]; +}; + +/** + * Constructs a new action for the given parameters. + */ +function Action(label, funct, enabled, iconCls, shortcut) { + mxEventSource.call(this); + this.label = label; + this.funct = funct; + this.enabled = (enabled != null) ? enabled : true; + this.iconCls = iconCls; + this.shortcut = shortcut; +}; + +// Action inherits from mxEventSource +mxUtils.extend(Action, mxEventSource); + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setEnabled = function(value) { + if (this.enabled != value) { + this.enabled = value; + this.fireEvent(new mxEventObject('stateChanged')); + } +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setToggleAction = function(value) { + this.toggleAction = value; +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.setSelectedCallback = function(funct) { + this.selectedCallback = funct; +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Action.prototype.isSelected = function() { + return this.selectedCallback(); +}; diff --git a/public/assets/plugins/square/js/Dialogs.js b/public/assets/plugins/square/js/Dialogs.js index 82e2cb3..c78d34e 100644 --- a/public/assets/plugins/square/js/Dialogs.js +++ b/public/assets/plugins/square/js/Dialogs.js @@ -1 +1,1048 @@ -var _0xd3eb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x69\x6E\x70\x75\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x63\x68\x65\x63\x6B\x62\x6F\x78","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x68\x65\x63\x6B\x65\x64","\x47\x45\x54","\x6F\x70\x65\x6E","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x65\x61\x72\x65\x72\x20","\x74\x6F\x6B\x65\x6E","\x64\x61\x74\x61","\x65\x64\x69\x74\x6F\x72","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x70\x61\x72\x73\x65","\x73\x65\x6C\x65\x63\x74","\x6F\x70\x74\x69\x6F\x6E","\x74\x65\x78\x74","\x2D\x2D\x20\x4E\x6F\x6E\x65\x20\x2D\x2D","\x76\x61\x6C\x75\x65","\x2D\x31","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x25","\x72\x65\x70\x6C\x61\x63\x65","\x66\x6F\x72\x45\x61\x63\x68","\x73\x65\x6C\x65\x63\x74\x65\x64","\x72\x6F\x77\x73","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x66\x6F\x72\x6D\x2D\x63\x6F\x6E\x74\x72\x6F\x6C\x20\x73\x65\x6C\x65\x63\x74\x32","\x30","\x66\x69\x6C\x74\x65\x72","\x73\x65\x6C\x65\x63\x74\x2D\x67\x72\x6F\x75\x70\x2D\x66\x61\x74\x68\x65\x72","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x73\x65\x6C\x65\x63\x74\x2D\x67\x72\x6F\x75\x70\x2D\x73\x6F\x6E","\x2D","\x63\x61\x70\x69\x74\x61\x6C\x69\x7A\x65","","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x73\x63\x72\x6F\x6C\x6C\x57\x69\x64\x74\x68","\x62\x6F\x64\x79","\x72\x6F\x75\x6E\x64","\x6D\x61\x78","\x73\x63\x72\x6F\x6C\x6C\x48\x65\x69\x67\x68\x74","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x44\x69\x61\x6C\x6F\x67","\x63\x72\x65\x61\x74\x65\x44\x69\x76","\x6D\x6F\x64\x61\x6C\x20\x66\x61\x64\x65\x20\x69\x6E\x20\x63\x65\x6E\x74\x65\x72","\x64\x69\x73\x70\x6C\x61\x79","\x73\x74\x79\x6C\x65","\x62\x6C\x6F\x63\x6B","\x70\x61\x64\x64\x69\x6E\x67\x52\x69\x67\x68\x74","\x31\x32\x70\x78","\x67\x65\x4D\x6F\x64\x61\x6C\x44\x69\x61\x6C\x6F\x67","\x6D\x6F\x64\x61\x6C\x2D\x64\x69\x61\x6C\x6F\x67","\x62\x67","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x6D\x6F\x64\x61\x6C\x2D\x62\x61\x63\x6B\x64\x72\x6F\x70\x20\x66\x61\x64\x65\x20\x69\x6E","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x6F\x6E\x44\x69\x61\x6C\x6F\x67\x43\x6C\x6F\x73\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x6C\x6F\x73\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x6D\x6F\x64\x61\x6C\x2D\x63\x6F\x6E\x74\x65\x6E\x74","\x6D\x6F\x64\x61\x6C\x2D\x68\x65\x61\x64\x65\x72","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79","\x6D\x6F\x64\x61\x6C\x2D\x66\x6F\x6F\x74\x65\x72","\x68\x34","\x63\x72\x65\x61\x74\x65\x48\x65\x61\x64\x65\x72","\x69\x6D\x70\x6F\x72\x74","\x67\x65\x74","\x20\x58\x4D\x4C","\x77\x72\x69\x74\x65","\x68\x69\x64\x65\x44\x69\x61\x6C\x6F\x67","\x62\x75\x74\x74\x6F\x6E","\x72\x6F\x77","\x63\x6F\x6C\x2D\x6D\x64\x2D\x31\x32","\x74\x65\x78\x74\x61\x72\x65\x61","\x77\x69\x64\x74\x68","\x31\x30\x30\x25","\x68\x65\x69\x67\x68\x74","\x33\x37\x34\x70\x78","\x66\x69\x6C\x65","\x61\x63\x63\x65\x70\x74","\x74\x65\x78\x74\x2F\x78\x6D\x6C","\x63\x68\x61\x6E\x67\x65","\x66\x69\x6C\x65\x73","\x74\x61\x72\x67\x65\x74","\x6C\x6F\x67","\x6F\x6E\x6C\x6F\x61\x64","\x72\x65\x73\x75\x6C\x74","\x72\x65\x61\x64\x41\x73\x54\x65\x78\x74","\x46\x61\x69\x6C\x65\x64\x20\x74\x6F\x20\x6C\x6F\x61\x64\x20\x66\x6F\x72\x6D\x61\x74\x20\x66\x69\x6C\x65","\x46\x61\x69\x6C\x65\x64\x20\x74\x6F\x20\x6C\x6F\x61\x64\x20\x66\x69\x6C\x65","\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x72\x73\x65\x58\x6D\x6C","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x62\x69\x6E\x64","\x62\x74\x6E\x20\x62\x6C\x75\x65","\x63\x61\x6E\x63\x65\x6C","\x62\x74\x6E\x20\x64\x65\x66\x61\x75\x6C\x74","\x61\x62\x6F\x75\x74","\x20\x43\x61\x6C\x6C\x79\x20\x53\x71\x75\x61\x72\x65","\x69\x6D\x67","\x62\x6F\x72\x64\x65\x72","\x30\x70\x78","\x31\x37\x36","\x31\x35\x31","\x73\x72\x63","\x2F\x6C\x6F\x67\x6F\x2E\x70\x6E\x67","\x62\x72","\x50\x6F\x77\x65\x72\x65\x64\x20\x62\x79\x20\x58\x65\x6E\x69\x61\x6C\x61\x62\x20","\x56\x45\x52\x53\x49\x4F\x4E","\x61","\x68\x72\x65\x66","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65\x2E\x63\x6F\x6D\x2F","\x5F\x62\x6C\x61\x6E\x6B","\x77\x77\x77\x2E\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65\x2E\x63\x6F\x6D","\x73\x61\x76\x65\x41\x73","\x6E\x61\x6D\x65","\x5F","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x63\x6F\x6C\x2D\x6D\x64\x2D\x34","\x63\x6F\x6C\x2D\x6D\x64\x2D\x38","\x6C\x61\x62\x65\x6C","\x63\x6F\x6E\x74\x72\x6F\x6C\x2D\x6C\x61\x62\x65\x6C\x20\x70\x75\x6C\x6C\x2D\x72\x69\x67\x68\x74","\x5F\x63\x6F\x70\x79","\x69\x64","\x66\x6F\x72\x6D\x2D\x63\x6F\x6E\x74\x72\x6F\x6C","\x73\x61\x76\x65","\x6E\x65\x77","\x5F\x6E\x65\x77","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x20\x6E\x61\x6D\x65","\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x2F","\x72\x65\x6E\x61\x6D\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x50\x55\x54","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x78\x2D\x77\x77\x77\x2D\x66\x6F\x72\x6D\x2D\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x6E\x61\x6D\x65\x3D","\x50\x72\x6F\x6A\x65\x63\x74\x20\x73\x75\x63\x63\x65\x73\x73\x66\x75\x6C\x6C\x79\x20\x72\x65\x6E\x61\x6D\x65\x64","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x6D\x65\x73\x73\x61\x67\x65","\x65\x72\x72\x6F\x72\x73","\x6F\x6E\x65\x72\x72\x6F\x72","\x73\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x61\x6C\x65\x72\x74","\x65\x64\x69\x74","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x67\x65\x74\x50\x72\x65\x74\x74\x79\x58\x6D\x6C","\x73\x74\x6F\x70\x50\x72\x6F\x70\x61\x67\x61\x74\x69\x6F\x6E","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x64\x61\x74\x61\x54\x72\x61\x6E\x73\x66\x65\x72","\x64\x72\x61\x67\x6F\x76\x65\x72","\x64\x72\x6F\x70","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x20\x66\x6F\x72\x6D","\x65\x78\x70\x6F\x72\x74","\x66\x6F\x72\x6D\x2D\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x20\x66\x6F\x72\x6D\x2D\x72\x6F\x77\x2D\x73\x65\x70\x65\x72\x61\x74\x65\x64","\x66\x6F\x72\x6D\x2D\x67\x72\x6F\x75\x70\x20\x6C\x61\x73\x74","\x63\x6F\x6C\x2D\x73\x6D\x2D\x34\x20\x63\x6F\x6E\x74\x72\x6F\x6C\x2D\x6C\x61\x62\x65\x6C","\x63\x6F\x6C\x2D\x73\x6D\x2D\x38","\x67\x65\x74\x58\x6D\x6C","\x73\x69\x6D\x75\x6C\x61\x74\x65","\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D","\x67\x72\x61\x70\x68","\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x20\x66\x6F\x72\x6D\x20\x6D\x6F\x64\x61\x6C\x2D\x62\x6F\x64\x79\x2D\x73\x63\x72\x6F\x6C\x6C","\x20","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x6F\x72\x6D\x2D\x67\x72\x6F\x75\x70","\x2F\x61\x70\x69\x2F\x61\x67\x65\x6E\x74\x73","\x73\x69\x70\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x71\x75\x65\x75\x65\x73","\x71\x75\x65\x75\x65\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x74\x72\x75\x6E\x6B\x73","\x74\x72\x75\x6E\x6B\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x63\x6F\x6E\x74\x65\x78\x74\x73","\x63\x6F\x6E\x74\x65\x78\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x6D\x61\x69\x6C\x62\x6F\x78","\x25\x6D\x61\x69\x6C\x62\x6F\x78\x25\x40\x25\x63\x6F\x6E\x74\x65\x78\x74\x25","\x6D\x6F\x64\x65\x6C","\x69\x73\x70\x65\x65\x63\x68\x5F\x61\x73\x72\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x69\x73\x70\x65\x65\x63\x68\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x67\x6F\x6F\x67\x6C\x65\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x69\x6E\x74\x65\x72\x76\x61\x6C\x5F\x69\x64","\x70\x72\x6F\x6A\x65\x63\x74\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x6F\x64\x62\x63","\x6F\x64\x62\x63\x5F\x69\x64","\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64\x73","\x64\x69\x73\x70\x6C\x61\x79\x5F\x6E\x61\x6D\x65","\x66\x69\x6C\x65\x5F\x69\x64","\x74\x69\x6D\x65\x6F\x75\x74","\x64\x69\x67\x69\x74","\x6D\x69\x6E\x64\x69\x67\x69\x74","\x6D\x61\x78\x64\x69\x67\x69\x74","\x6E\x75\x6D\x62\x65\x72","\x6D\x69\x6E","\x72\x65\x74\x72\x79","\x6B\x65\x79","\x71\x75\x65\x72\x79","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x63\x6F\x6D\x6D\x61\x6E\x64","\x68\x65\x6C\x70\x5F","\x70","\x68\x65\x6C\x70\x2D\x62\x6C\x6F\x63\x6B","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x72\x65\x66\x72\x65\x73\x68"];_0xd3eb[0];function createCheckbox(_0xa701x2){var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[5]](_0xd3eb[3],_0xd3eb[4]);if(_0xa701x2){_0xa701x3[_0xd3eb[5]](_0xd3eb[6],true)};return _0xa701x3}function createDropdownFromApi(_0xa701x5,_0xa701x2,_0xa701x6,_0xa701x7,_0xa701x8,_0xa701x9,_0xa701xa){var _0xa701xb= new XMLHttpRequest();_0xa701xb[_0xd3eb[8]](_0xd3eb[7],_0xa701x5,false);_0xa701xb[_0xd3eb[14]](_0xd3eb[9],_0xd3eb[10]+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[11]]);_0xa701xb[_0xd3eb[15]](null);var _0xa701xc=[];if(_0xa701xb[_0xd3eb[16]]===200){_0xa701xc=JSON[_0xd3eb[18]](_0xa701xb[_0xd3eb[17]])};var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[19]);var _0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[21]]=_0xd3eb[22];_0xa701xd[_0xd3eb[23]]=_0xd3eb[24];_0xa701x3[_0xd3eb[25]](_0xa701xd);_0xa701xc[_0xd3eb[30]][_0xd3eb[28]](function(_0xa701xe){_0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[21]]=_0xa701xe[_0xa701x6];if(_0xa701x9&&_0xa701xa){_0xa701x9[_0xd3eb[28]](function(_0xa701xf){_0xa701xa=_0xa701xa[_0xd3eb[27]](_0xd3eb[26]+_0xa701xf+_0xd3eb[26],_0xa701xe[_0xa701xf])});_0xa701xd[_0xd3eb[23]]=_0xa701xa;_0xa701xd[_0xd3eb[29]]=(_0xa701xa==_0xa701x2)}else {_0xa701xd[_0xd3eb[23]]=_0xa701xe[_0xa701x7];_0xa701xd[_0xd3eb[29]]=(_0xa701xe[_0xa701x7]==_0xa701x2)};_0xa701x3[_0xd3eb[25]](_0xa701xd)});_0xa701x3[_0xd3eb[31]]=_0xd3eb[32];return _0xa701x3}function createGroupedDropdownFromApi(_0xa701x5,_0xa701x2,_0xa701x6,_0xa701x7,_0xa701x8,_0xa701x11){var _0xa701xb= new XMLHttpRequest();_0xa701xb[_0xd3eb[8]](_0xd3eb[7],_0xa701x5,false);_0xa701xb[_0xd3eb[14]](_0xd3eb[9],_0xd3eb[10]+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[11]]);_0xa701xb[_0xd3eb[15]](null);var _0xa701xc=[];if(_0xa701xb[_0xd3eb[16]]===200){_0xa701xc=JSON[_0xd3eb[18]](_0xa701xb[_0xd3eb[17]])};var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[19]);var _0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[21]]=_0xd3eb[22];_0xa701xd[_0xd3eb[23]]=_0xd3eb[33];_0xa701x3[_0xd3eb[25]](_0xa701xd);var _0xa701x12={};var _0xa701x13={};_0xa701x12[_0xa701x11]=null;var _0xa701x14=_[_0xd3eb[34]](_0xa701xc[_0xd3eb[30]],_0xa701x12);var _0xa701x15={};_0xa701x14[_0xd3eb[28]](function(_0xa701xe){_0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[31]]=_0xd3eb[35];_0xa701xd[_0xd3eb[21]]=_0xa701xe[_0xa701x6][_0xd3eb[36]]();_0xa701xd[_0xd3eb[23]]=_0xa701xe[_0xa701x7];_0xa701xd[_0xd3eb[29]]=(_0xa701xe[_0xa701x7]==_0xa701x2);_0xa701x3[_0xd3eb[25]](_0xa701xd);_0xa701x13[_0xa701x11]=_0xa701xe[_0xa701x7];_0xa701x15=_[_0xd3eb[34]](_0xa701xc[_0xd3eb[30]],_0xa701x13);_0xa701x15[_0xd3eb[28]](function(_0xa701xe){_0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[31]]=_0xd3eb[37];_0xa701xd[_0xd3eb[21]]=_0xd3eb[38]+_[_0xd3eb[39]](_0xa701xe[_0xa701x6]);_0xa701xd[_0xd3eb[23]]=_0xa701xe[_0xa701x7];_0xa701xd[_0xd3eb[29]]=(_0xa701xe[_0xa701x7]==_0xa701x2);_0xa701x3[_0xd3eb[25]](_0xa701xd)})});_0xa701x3[_0xd3eb[31]]=_0xd3eb[32];return _0xa701x3}function createDropdownFromArray(_0xa701x17,_0xa701x2){var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[19]);for(var _0xa701x18 in _0xa701x17){var _0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[21]]=_0xa701x17[_0xa701x18];_0xa701xd[_0xd3eb[23]]=_0xa701x18;if(_0xa701x2>0||_0xa701x2!=_0xd3eb[40]){_0xa701xd[_0xd3eb[29]]=(_0xa701x2===_0xa701x18)?true:false};_0xa701x3[_0xd3eb[25]](_0xa701xd)};_0xa701x3[_0xd3eb[31]]=_0xd3eb[32];return _0xa701x3}function Dialog(_0xa701x8,_0xa701x1a,_0xa701x1b,_0xa701x1c,_0xa701x1d,_0xa701x1e,_0xa701x1f){var _0xa701x20=0;if(mxClient[_0xd3eb[41]]&&document[_0xd3eb[42]]!=9){_0xa701x20=60};_0xa701x1b+=_0xa701x20;_0xa701x1c+=_0xa701x20;var _0xa701x21=Math[_0xd3eb[46]](0,Math[_0xd3eb[45]]((document[_0xd3eb[44]][_0xd3eb[43]]-_0xa701x1b)/2));var _0xa701x22=Math[_0xd3eb[46]](0,Math[_0xd3eb[45]]((Math[_0xd3eb[46]](document[_0xd3eb[44]][_0xd3eb[47]],document[_0xd3eb[48]][_0xd3eb[47]])-_0xa701x1c)/3));var _0xa701x23=_0xa701x8[_0xd3eb[50]](_0xd3eb[49]);_0xa701x23[_0xd3eb[31]]=_0xd3eb[51];_0xa701x23[_0xd3eb[53]][_0xd3eb[52]]=_0xd3eb[54];_0xa701x23[_0xd3eb[53]][_0xd3eb[55]]=_0xd3eb[56];var _0xa701x24=_0xa701x8[_0xd3eb[50]](_0xd3eb[57]);_0xa701x24[_0xd3eb[31]]=_0xd3eb[58];_0xa701x24[_0xd3eb[25]](_0xa701x1a);_0xa701x23[_0xd3eb[25]](_0xa701x24);if(this[_0xd3eb[59]]==null){this[_0xd3eb[59]]=_0xa701x8[_0xd3eb[50]](_0xd3eb[60]);this[_0xd3eb[59]][_0xd3eb[31]]=_0xd3eb[61];if(mxClient[_0xd3eb[62]]){ new mxDivResizer(this[_0xd3eb[59]])}};if(_0xa701x1d){document[_0xd3eb[44]][_0xd3eb[25]](this[_0xd3eb[59]])};document[_0xd3eb[44]][_0xd3eb[25]](_0xa701x23);this[_0xd3eb[63]]=_0xa701x1f;this[_0xd3eb[64]]=_0xa701x23}Dialog[_0xd3eb[66]][_0xd3eb[65]]=function(){if(this[_0xd3eb[63]]!=null){this[_0xd3eb[63]]();this[_0xd3eb[63]]=null};this[_0xd3eb[64]][_0xd3eb[68]][_0xd3eb[67]](this[_0xd3eb[64]]);this[_0xd3eb[59]][_0xd3eb[68]][_0xd3eb[67]](this[_0xd3eb[59]])};function ImportDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[75])+_0xd3eb[77]);var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[82]);var _0xa701x2e=document[_0xd3eb[2]](_0xd3eb[83]);_0xa701x2e[_0xd3eb[53]][_0xd3eb[84]]=_0xd3eb[85];_0xa701x2e[_0xd3eb[53]][_0xd3eb[86]]=_0xd3eb[87];var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[3]]=_0xd3eb[88];_0xa701x3[_0xd3eb[5]](_0xd3eb[89],_0xd3eb[90]);_0xa701x3[_0xd3eb[100]](_0xd3eb[91],function _0xa701x2f(_0xa701x30){var _0xa701x31=_0xa701x30[_0xd3eb[93]][_0xd3eb[92]][0];console[_0xd3eb[94]](_0xa701x31);if(_0xa701x31){if(_0xa701x31[_0xd3eb[3]]===_0xd3eb[90]){var _0xa701x32= new FileReader();_0xa701x32[_0xd3eb[95]]=function(_0xa701x33){var _0xa701x34=_0xa701x33[_0xd3eb[93]][_0xd3eb[96]];mxUtils[_0xd3eb[78]](_0xa701x2e,_0xa701x34)};_0xa701x32[_0xd3eb[97]](_0xa701x31)}else {alert(_0xd3eb[98])}}else {alert(_0xd3eb[99])}},false);_0xa701x2d[_0xd3eb[25]](_0xa701x3);_0xa701x2d[_0xd3eb[25]](_0xa701x2e);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[75]),mxUtils[_0xd3eb[103]](this,function(_0xa701x36){var _0xa701x37=mxUtils[_0xd3eb[101]](_0xa701x2e[_0xd3eb[23]]);_0xa701x8[_0xd3eb[13]][_0xd3eb[102]](_0xa701x37[_0xd3eb[48]]);_0xa701x8[_0xd3eb[79]]()}));_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function AboutDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[107])+_0xd3eb[108]);var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x3a=document[_0xd3eb[2]](_0xd3eb[109]);_0xa701x3a[_0xd3eb[53]][_0xd3eb[110]]=_0xd3eb[111];_0xa701x3a[_0xd3eb[5]](_0xd3eb[84],_0xd3eb[112]);_0xa701x3a[_0xd3eb[5]](_0xd3eb[84],_0xd3eb[113]);_0xa701x3a[_0xd3eb[5]](_0xd3eb[114],IMAGE_PATH+_0xd3eb[115]);_0xa701x28[_0xd3eb[25]](_0xa701x3a);mxUtils[_0xd3eb[116]](_0xa701x28);mxUtils[_0xd3eb[78]](_0xa701x28,_0xd3eb[117]+mxClient[_0xd3eb[118]]);mxUtils[_0xd3eb[116]](_0xa701x28);var _0xa701x3b=document[_0xd3eb[2]](_0xd3eb[119]);_0xa701x3b[_0xd3eb[5]](_0xd3eb[120],_0xd3eb[121]);_0xa701x3b[_0xd3eb[5]](_0xd3eb[93],_0xd3eb[122]);mxUtils[_0xd3eb[78]](_0xa701x3b,_0xd3eb[123]);_0xa701x28[_0xd3eb[25]](_0xa701x3b);mxUtils[_0xd3eb[116]](_0xa701x28);mxUtils[_0xd3eb[116]](_0xa701x28);var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[65]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function SaveDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[124]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x3d=_0xd3eb[125];var _0xa701x3e=_0xd3eb[126]+_0xa701x3d;var _0xa701x2=_0xa701x8[_0xd3eb[13]][_0xd3eb[127]]();var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[128]);var _0xa701x3f=_0xa701x8[_0xd3eb[50]](_0xd3eb[129]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[131];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xa701x3d));_0xa701x2d[_0xd3eb[25]](_0xa701x40);var _0xa701x41=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x41[_0xd3eb[5]](_0xd3eb[23],_0xa701x2+_0xd3eb[132]);_0xa701x41[_0xd3eb[5]](_0xd3eb[133],_0xa701x3e);_0xa701x41[_0xd3eb[31]]=_0xd3eb[134];_0xa701x3f[_0xd3eb[25]](_0xa701x41);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x2c[_0xd3eb[25]](_0xa701x3f);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[135]),function(){_0xa701x8[_0xd3eb[124]](_0xa701x41[_0xd3eb[23]]);_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function NewDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[136]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x3d=_0xd3eb[125];var _0xa701x3e=_0xd3eb[126]+_0xa701x3d;var _0xa701x2=_0xa701x8[_0xd3eb[13]][_0xd3eb[127]]();var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[128]);var _0xa701x3f=_0xa701x8[_0xd3eb[50]](_0xd3eb[129]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[131];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xa701x3d));_0xa701x2d[_0xd3eb[25]](_0xa701x40);var _0xa701x41=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x41[_0xd3eb[5]](_0xd3eb[23],_0xa701x2+_0xd3eb[137]);_0xa701x41[_0xd3eb[5]](_0xd3eb[133],_0xa701x3e);_0xa701x41[_0xd3eb[31]]=_0xd3eb[134];_0xa701x3f[_0xd3eb[25]](_0xa701x41);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x2c[_0xd3eb[25]](_0xa701x3f);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[136]),function(){_0xa701x8[_0xd3eb[136]](_0xa701x41[_0xd3eb[23]]);_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function VariableDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[138]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x3d=_0xd3eb[125];var _0xa701x3e=_0xd3eb[126]+_0xa701x3d;var _0xa701x2=_0xa701x8[_0xd3eb[13]][_0xd3eb[127]]();var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[128]);var _0xa701x3f=_0xa701x8[_0xd3eb[50]](_0xd3eb[129]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[131];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xa701x3d));_0xa701x2d[_0xd3eb[25]](_0xa701x40);var _0xa701x41=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x41[_0xd3eb[5]](_0xd3eb[23],_0xd3eb[139]);_0xa701x41[_0xd3eb[5]](_0xd3eb[133],_0xa701x3e);_0xa701x41[_0xd3eb[31]]=_0xd3eb[134];_0xa701x3f[_0xd3eb[25]](_0xa701x41);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x2c[_0xd3eb[25]](_0xa701x3f);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[136]),function(){_0xa701x8[_0xd3eb[138]](_0xa701x41[_0xd3eb[23]]);_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function OpenDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[8]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[128]);var _0xa701x3f=_0xa701x8[_0xd3eb[50]](_0xd3eb[129]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[131];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xd3eb[125]));_0xa701x2d[_0xd3eb[25]](_0xa701x40);var _0xa701xb= new XMLHttpRequest();_0xa701xb[_0xd3eb[8]](_0xd3eb[7],_0xd3eb[140],false);_0xa701xb[_0xd3eb[14]](_0xd3eb[9],_0xd3eb[10]+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[11]]);_0xa701xb[_0xd3eb[15]](null);var _0xa701xc=[];if(_0xa701xb[_0xd3eb[16]]===200){_0xa701xc=JSON[_0xd3eb[18]](_0xa701xb[_0xd3eb[17]])};var _0xa701x41=document[_0xd3eb[2]](_0xd3eb[19]);for(var _0xa701x45=0;_0xa701x45<_0xa701xc[_0xd3eb[141]];_0xa701x45++){var _0xa701xd=document[_0xd3eb[2]](_0xd3eb[20]);_0xa701xd[_0xd3eb[21]]=_0xa701xc[_0xa701x45][_0xd3eb[125]];_0xa701xd[_0xd3eb[23]]=_0xa701xc[_0xa701x45][_0xd3eb[133]];_0xa701x41[_0xd3eb[25]](_0xa701xd)};_0xa701x41[_0xd3eb[31]]=_0xd3eb[134];_0xa701x3f[_0xd3eb[25]](_0xa701x41);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x2c[_0xd3eb[25]](_0xa701x3f);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[8]),function(){console[_0xd3eb[94]](_0xa701x41);console[_0xd3eb[94]](_0xa701x41[_0xd3eb[23]]);window[_0xd3eb[8]](_0xd3eb[142]+_0xa701x41[_0xd3eb[23]],_0xd3eb[122]);_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function RenameDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[143]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[128]);var _0xa701x3f=_0xa701x8[_0xd3eb[50]](_0xd3eb[129]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[131];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xd3eb[125]));_0xa701x2d[_0xd3eb[25]](_0xa701x40);var _0xa701x3d=_0xa701x8[_0xd3eb[13]][_0xd3eb[144]];var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[5]](_0xd3eb[23],_0xa701x3d);_0xa701x3[_0xd3eb[31]]=_0xd3eb[134];_0xa701x3f[_0xd3eb[25]](_0xa701x3);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x2c[_0xd3eb[25]](_0xa701x3f);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[135]),function(){var _0xa701xb= new XMLHttpRequest();_0xa701xb[_0xd3eb[8]](_0xd3eb[145],SAVE_URL+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[133]],true);_0xa701xb[_0xd3eb[14]](_0xd3eb[146],_0xd3eb[147]);_0xa701xb[_0xd3eb[14]](_0xd3eb[9],_0xd3eb[10]+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[11]]);_0xa701xb[_0xd3eb[15]](_0xd3eb[148]+_0xa701x3[_0xd3eb[23]]);_0xa701xb[_0xd3eb[95]]=function(_0xa701x33){if(_0xa701xb[_0xd3eb[16]]===200){_0xa701x8[_0xd3eb[13]][_0xd3eb[150]](_0xd3eb[149]);_0xa701x8[_0xd3eb[13]][_0xd3eb[144]]=_0xa701x3[_0xd3eb[23]]}else {console[_0xd3eb[94]](_0xa701xb[_0xd3eb[17]]);_0xa701x8[_0xd3eb[13]][_0xd3eb[150]](JSON[_0xd3eb[18]](_0xa701xb[_0xd3eb[17]])[_0xd3eb[152]][0][_0xd3eb[151]])}};_0xa701xb[_0xd3eb[153]]=function(_0xa701x33){mxUtils[_0xd3eb[155]](_0xa701xb[_0xd3eb[154]])};_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function EditFileDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[71]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[156]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x2c=_0xa701x8[_0xd3eb[50]](_0xd3eb[81]);var _0xa701x2d=_0xa701x8[_0xd3eb[50]](_0xd3eb[82]);var _0xa701x2e=document[_0xd3eb[2]](_0xd3eb[83]);_0xa701x2e[_0xd3eb[53]][_0xd3eb[84]]=_0xd3eb[85];_0xa701x2e[_0xd3eb[53]][_0xd3eb[86]]=_0xd3eb[87];_0xa701x2e[_0xd3eb[23]]=mxUtils[_0xd3eb[158]](_0xa701x8[_0xd3eb[13]][_0xd3eb[157]]());if(fileSupport){function _0xa701x48(_0xa701x30){_0xa701x30[_0xd3eb[159]]();_0xa701x30[_0xd3eb[160]]();if(_0xa701x30[_0xd3eb[161]][_0xd3eb[92]][_0xd3eb[141]]>0){var _0xa701x49=_0xa701x30[_0xd3eb[161]][_0xd3eb[92]][0];var _0xa701x4a= new FileReader();_0xa701x4a[_0xd3eb[95]]=function(_0xa701x33){_0xa701x2e[_0xd3eb[23]]=_0xa701x33[_0xd3eb[93]][_0xd3eb[96]]};_0xa701x4a[_0xd3eb[97]](_0xa701x49)}}function _0xa701x4b(_0xa701x30){_0xa701x30[_0xd3eb[159]]();_0xa701x30[_0xd3eb[160]]()}_0xa701x2e[_0xd3eb[100]](_0xd3eb[162],_0xa701x4b,false);_0xa701x2e[_0xd3eb[100]](_0xd3eb[163],_0xa701x48,false)};_0xa701x2d[_0xd3eb[25]](_0xa701x2e);_0xa701x2c[_0xd3eb[25]](_0xa701x2d);_0xa701x28[_0xd3eb[25]](_0xa701x2c);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[135]),function(){var _0xa701x37=mxUtils[_0xd3eb[101]](_0xa701x2e[_0xd3eb[23]]);_0xa701x8[_0xd3eb[13]][_0xd3eb[102]](_0xa701x37[_0xd3eb[48]]);_0xa701x8[_0xd3eb[79]]()});_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function ExportDialog(_0xa701x8){var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[164]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[165])+_0xd3eb[77]);var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x4d=_0xa701x8[_0xd3eb[50]](_0xd3eb[166]);var _0xa701x4e=_0xa701x8[_0xd3eb[50]](_0xd3eb[167]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[168];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xd3eb[144]));var _0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[5]](_0xd3eb[23],_0xa701x8[_0xd3eb[13]][_0xd3eb[127]]());_0xa701x3[_0xd3eb[31]]=_0xd3eb[134];var _0xa701x23=_0xa701x8[_0xd3eb[50]](_0xd3eb[169]);_0xa701x23[_0xd3eb[25]](_0xa701x3);_0xa701x4e[_0xd3eb[25]](_0xa701x40);_0xa701x4e[_0xd3eb[25]](_0xa701x23);_0xa701x4d[_0xd3eb[25]](_0xa701x4e);_0xa701x28[_0xd3eb[25]](_0xa701x4d);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[165]),mxUtils[_0xd3eb[103]](this,function(_0xa701x36){_0xa701x8[_0xd3eb[135]](false);var _0xa701x4f=encodeURIComponent(mxUtils[_0xd3eb[170]](_0xa701x8[_0xd3eb[13]][_0xd3eb[157]]())); new mxXmlRequest(SAVE_URL+_0xa701x8[_0xd3eb[13]][_0xd3eb[12]][_0xd3eb[133]]+_0xd3eb[172],_0xd3eb[173]+_0xa701x3[_0xd3eb[23]],_0xd3eb[7])[_0xd3eb[171]](document,_0xd3eb[122]);_0xa701x8[_0xd3eb[79]]()}));_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26}function GeneralDialog(_0xa701x8,_0xa701x51){var _0xa701x52=_0xa701x8[_0xd3eb[13]][_0xd3eb[174]];var _0xa701x26=_0xa701x8[_0xd3eb[50]](_0xd3eb[69]);var _0xa701x27=_0xa701x8[_0xd3eb[50]](_0xd3eb[70]);var _0xa701x28=_0xa701x8[_0xd3eb[50]](_0xd3eb[175]);var _0xa701x29=_0xa701x8[_0xd3eb[50]](_0xd3eb[72]);var _0xa701x2a=_0xa701x8[_0xd3eb[74]](_0xd3eb[73]);mxUtils[_0xd3eb[78]](_0xa701x2a,mxResources[_0xd3eb[76]](_0xd3eb[156])+_0xd3eb[176]+mxResources[_0xd3eb[76]](_0xa701x51[_0xd3eb[23]][_0xd3eb[177]]));var _0xa701x2b=mxUtils[_0xd3eb[80]](_0xd3eb[40],function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x2b[_0xd3eb[31]]=_0xd3eb[65];_0xa701x27[_0xd3eb[25]](_0xa701x2b);_0xa701x27[_0xd3eb[25]](_0xa701x2a);var _0xa701x53=_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xd3eb[141]];var _0xa701x4d=_0xa701x8[_0xd3eb[50]](_0xd3eb[166]);for(var _0xa701x54=0;_0xa701x54<_0xa701x53;_0xa701x54++){var _0xa701x3d=_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xa701x54][_0xd3eb[125]];var _0xa701x3e=_0xd3eb[126]+_0xa701x3d;var _0xa701x2=_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xa701x54][_0xd3eb[23]];var _0xa701x4e=_0xa701x8[_0xd3eb[50]]((_0xa701x54==_0xa701x53-1)?_0xd3eb[167]:_0xd3eb[179]);var _0xa701x40=document[_0xd3eb[2]](_0xd3eb[130]);_0xa701x40[_0xd3eb[31]]=_0xd3eb[168];mxUtils[_0xd3eb[78]](_0xa701x40,mxResources[_0xd3eb[76]](_0xa701x3d));_0xa701x4e[_0xd3eb[25]](_0xa701x40);var _0xa701x3;switch(_0xa701x3d){case _0xd3eb[181]:_0xa701x3=createDropdownFromApi(_0xd3eb[180],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[183]:_0xa701x3=createDropdownFromApi(_0xd3eb[182],_0xa701x2,_0xd3eb[125],_0xd3eb[125],_0xa701x8);break;case _0xd3eb[185]:_0xa701x3=createDropdownFromApi(_0xd3eb[184],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[187]:_0xa701x3=createDropdownFromApi(_0xd3eb[186],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[189]:_0xa701x3=createDropdownFromApi(_0xd3eb[188],_0xa701x2,_0xd3eb[125],_0xd3eb[125],_0xa701x8);break;case _0xd3eb[191]:_0xa701x3=createDropdownFromApi(_0xd3eb[190],_0xa701x2,_0xd3eb[191],_0xd3eb[133],_0xa701x8,[_0xd3eb[191],_0xd3eb[189]],_0xd3eb[192]);break;case _0xd3eb[193]:_0xa701x3=createDropdownFromArray(ISPEECHASRMODEL,_0xa701x2);break;case _0xd3eb[194]:_0xa701x3=createDropdownFromArray(ISPEECHASRLANG,_0xa701x2);break;case _0xd3eb[195]:_0xa701x3=createDropdownFromArray(ISPEECHLANG,_0xa701x2);break;case _0xd3eb[196]:_0xa701x3=createDropdownFromArray(GOOGLETTSLANG,_0xa701x2);break;case _0xd3eb[199]:_0xa701x3=createGroupedDropdownFromApi(_0xd3eb[197],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8,_0xd3eb[198]);break;case _0xd3eb[200]:_0xa701x3=createDropdownFromApi(_0xd3eb[140],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[202]:_0xa701x3=createDropdownFromApi(_0xd3eb[201],_0xa701x2,_0xd3eb[125],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[205]:_0xa701x3=createDropdownFromApi(_0xd3eb[203],_0xa701x2,_0xd3eb[204],_0xd3eb[133],_0xa701x8);break;case _0xd3eb[206]:;case _0xd3eb[207]:;case _0xd3eb[208]:;case _0xd3eb[209]:;case _0xd3eb[17]:;case _0xd3eb[212]:_0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[5]](_0xd3eb[3],_0xd3eb[210]);_0xa701x3[_0xd3eb[5]](_0xd3eb[211],0);_0xa701x3[_0xd3eb[5]](_0xd3eb[46],1000);_0xa701x3[_0xd3eb[5]](_0xd3eb[23],_0xa701x2);_0xa701x3[_0xd3eb[31]]=_0xd3eb[134];break;case _0xd3eb[21]:;case _0xd3eb[213]:;case _0xd3eb[214]:;case _0xd3eb[215]:;case _0xd3eb[217]:_0xa701x3=document[_0xd3eb[2]](_0xd3eb[83]);_0xa701x3[_0xd3eb[216]]=_0xa701x2;_0xa701x3[_0xd3eb[31]]=_0xd3eb[134];break;default:_0xa701x3=document[_0xd3eb[2]](_0xd3eb[1]);_0xa701x3[_0xd3eb[5]](_0xd3eb[23],_0xa701x2);_0xa701x3[_0xd3eb[31]]=_0xd3eb[134];break};_0xa701x3[_0xd3eb[5]](_0xd3eb[133],_0xa701x3e);var _0xa701x23=_0xa701x8[_0xd3eb[50]](_0xd3eb[169]);_0xa701x23[_0xd3eb[25]](_0xa701x3);if(mxResources[_0xd3eb[76]](_0xd3eb[218]+_0xa701x3d)){var _0xa701x55=_0xa701x8[_0xd3eb[50]](_0xd3eb[219]);_0xa701x55[_0xd3eb[31]]=_0xd3eb[220];mxUtils[_0xd3eb[78]](_0xa701x55,mxResources[_0xd3eb[76]](_0xd3eb[218]+_0xa701x3d));_0xa701x23[_0xd3eb[25]](_0xa701x55)};_0xa701x4e[_0xd3eb[25]](_0xa701x23);_0xa701x4d[_0xd3eb[25]](_0xa701x4e)};_0xa701x28[_0xd3eb[25]](_0xa701x4d);var _0xa701x35=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[135]),mxUtils[_0xd3eb[103]](this,function(_0xa701x36){for(var _0xa701x54=0;_0xa701x54<_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xd3eb[141]];_0xa701x54++){var _0xa701x3e=_0xd3eb[126]+_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xa701x54][_0xd3eb[125]];var _0xa701x3d=_0xa701x51[_0xd3eb[23]][_0xd3eb[178]][_0xa701x54][_0xd3eb[125]];console[_0xd3eb[94]](_0xa701x3d,document[_0xd3eb[221]](_0xa701x3e)[_0xd3eb[23]]);_0xa701x51[_0xd3eb[5]](_0xa701x3d,document[_0xd3eb[221]](_0xa701x3e)[_0xd3eb[23]])};_0xa701x52[_0xd3eb[222]](_0xa701x51);_0xa701x8[_0xd3eb[79]]()}));_0xa701x35[_0xd3eb[31]]=_0xd3eb[104];var _0xa701x38=mxUtils[_0xd3eb[80]](mxResources[_0xd3eb[76]](_0xd3eb[105]),function(){_0xa701x8[_0xd3eb[79]]()});_0xa701x38[_0xd3eb[31]]=_0xd3eb[106];_0xa701x29[_0xd3eb[25]](_0xa701x35);_0xa701x29[_0xd3eb[25]](_0xa701x38);_0xa701x26[_0xd3eb[25]](_0xa701x27);_0xa701x26[_0xd3eb[25]](_0xa701x28);_0xa701x26[_0xd3eb[25]](_0xa701x29);this[_0xd3eb[64]]=_0xa701x26} \ No newline at end of file +'use strict'; +/** + * $Id: Dialogs.js,v 1.5 2013-01-29 17:23:31 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new dialog. + */ + +function createCheckbox(value) { + var input = document.createElement('input'); + input.setAttribute('type', 'checkbox'); + if (value) { + input.setAttribute('checked', true); + } + return input; +} + +function createDropdownFromApi(path, value, option_name, option_value, editorUi, keys, pattern) { + var req = new XMLHttpRequest(); + req.open('GET', path, false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + var input = document.createElement('select'); + var option = document.createElement('option'); + option.text = '-- None --'; + option.value = '-1'; + input.appendChild(option); + res.rows.forEach(function(elem) { + option = document.createElement('option'); + option.text = elem[option_name]; + if (keys && pattern) { + keys.forEach(function(key) { + pattern = pattern.replace('%' + key + '%', elem[key]); + }); + option.value = pattern; + option.selected = (pattern == value); + } else { + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + } + input.appendChild(option); + }); + input.className = 'form-control select2'; + + return input; +} + +function createGroupedDropdownFromApi(path, value, option_name, option_value, editorUi, associationField) { + var req = new XMLHttpRequest(); + req.open('GET', path, false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + var input = document.createElement('select'); + var option = document.createElement('option'); + option.text = '-- None --'; + option.value = '0'; + input.appendChild(option); + var mainFilter = {}; + var groupFilter = {}; + mainFilter[associationField] = null; + var mainValues = _.filter(res.rows, mainFilter); + var groupValues = {}; + mainValues.forEach(function(elem) { + option = document.createElement('option'); + option.className = 'select-group-father'; + option.text = elem[option_name].toUpperCase(); + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + input.appendChild(option); + groupFilter[associationField] = elem[option_value]; + groupValues = _.filter(res.rows, groupFilter); + groupValues.forEach(function(elem) { + option = document.createElement('option'); + option.className = 'select-group-son'; + option.text = '-' + _.capitalize(elem[option_name]); + option.value = elem[option_value]; + option.selected = (elem[option_value] == value); + input.appendChild(option); + }); + }) + input.className = 'form-control select2'; + + return input; +} + +function createDropdownFromArray(array, value) { + var input = document.createElement('select'); + + for (var item in array) { + var option = document.createElement('option'); + option.text = array[item]; + option.value = item; + if (value > 0 || value != '') + option.selected = (value === item) ? true : false; + + input.appendChild(option); + } + + input.className = 'form-control select2'; + + return input; +} + +function Dialog(editorUi, elt, w, h, modal, closable, onClose) { + var dx = 0; + + if (mxClient.IS_IE && document.documentMode != 9) { + dx = 60; + } + + w += dx; + h += dx; + + var left = Math.max(0, Math.round((document.body.scrollWidth - w) / 2)); + var top = Math.max(0, Math.round((Math.max(document.body.scrollHeight, + document.documentElement.scrollHeight) - h) / 3)); + + var div = editorUi.createDiv('geDialog'); + div.className = 'modal fade in center'; + div.style.display = 'block'; + div.style.paddingRight = '12px'; + // div.style.width = w + 'px'; + // div.style.height = h + 'px'; + // div.style.left = left + 'px'; + // div.style.top = top + 'px'; + + var divModalDialog = editorUi.createDiv('geModalDialog'); + divModalDialog.className = 'modal-dialog'; + + divModalDialog.appendChild(elt); + div.appendChild(divModalDialog); + + if (this.bg == null) { + this.bg = editorUi.createDiv('background'); + this.bg.className = 'modal-backdrop fade in'; + + if (mxClient.IS_QUIRKS) { + new mxDivResizer(this.bg); + } + } + + if (modal) { + document.body.appendChild(this.bg); + } + + document.body.appendChild(div); + + this.onDialogClose = onClose; + this.container = div; +}; + +/** + * Removes the dialog from the DOM. + */ +Dialog.prototype.close = function() { + if (this.onDialogClose != null) { + this.onDialogClose(); + this.onDialogClose = null; + } + + this.container.parentNode.removeChild(this.container); + this.bg.parentNode.removeChild(this.bg); +}; + +/** + * Constructs a new open dialog. + */ +function ImportDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('import') + ' XML'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-12'); + + var textarea = document.createElement('textarea'); + textarea.style.width = '100%'; + textarea.style.height = '374px'; + + var input = document.createElement('input'); + input.type = 'file'; + input.setAttribute('accept', 'text/xml'); + + input.addEventListener('change', function readSingleFile(evt) { + //Retrieve the first (and only!) File from the FileList object + var f = evt.target.files[0]; + console.log(f); + if (f) { + if (f.type === 'text/xml') { + var r = new FileReader(); + r.onload = function(e) { + var contents = e.target.result; + mxUtils.write(textarea, contents); + }; + r.readAsText(f); + } else { + alert('Failed to load format file'); + } + } else { + alert('Failed to load file'); + } + }, false); + + col1.appendChild(input); + col1.appendChild(textarea); + + row.appendChild(col1); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('import'), mxUtils.bind(this, + function(data) { + var doc = mxUtils.parseXml(textarea.value); + editorUi.editor.setGraphXml(doc.documentElement); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + +}; + +/** + * Constructs a new about dialog. + */ +function AboutDialog(editorUi) { + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('about') + ' Cally Square'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var img = document.createElement('img'); + img.style.border = '0px'; + img.setAttribute('width', '176'); + img.setAttribute('width', '151'); + img.setAttribute('src', IMAGE_PATH + '/logo.png'); + body.appendChild(img); + mxUtils.br(body); + mxUtils.write(body, 'Powered by Xenialab ' + mxClient.VERSION); + mxUtils.br(body); + var link = document.createElement('a'); + link.setAttribute('href', 'http://www.callysquare.com/'); + link.setAttribute('target', '_blank'); + mxUtils.write(link, 'www.callysquare.com'); + body.appendChild(link); + mxUtils.br(body); + mxUtils.br(body); + //--- END BODY + + var close = mxUtils.button(mxResources.get('close'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Constructs a new save dialog. + */ +function SaveDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('saveAs')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', value + '_copy'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + editorUi.saveAs(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function NewDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('new')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', value + '_new'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('new'), function() { + editorUi.new(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function VariableDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('variable')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var name = 'name'; + var id = '_' + name; + var value = editorUi.editor.getOrCreateFilename(); + + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get(name)); + col1.appendChild(label); + + var select = document.createElement('input'); + select.setAttribute('value', 'variable name'); + select.setAttribute('id', id) + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('new'), function() { + editorUi.variable(select.value); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new save dialog. + */ +function OpenDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('open')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get('name')); + col1.appendChild(label); + + var req = new XMLHttpRequest(); + req.open('GET', '/api/square/projects', false); // `false` makes the request synchronous + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send(null); + var res = []; + if (req.status === 200) { + res = JSON.parse(req.response); + } + + var select = document.createElement('select'); + + for (var j = 0; j < res.length; j++) { + var option = document.createElement('option'); + option.text = res[j].name; + option.value = res[j].id; + select.appendChild(option); + } + select.className = 'form-control'; + col2.appendChild(select); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('open'), function() { + console.log(select); + console.log(select.value); + window.open('square/project/' + select.value, '_blank'); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; +/** + * Constructs a new rename dialog. + */ +function RenameDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('rename')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-4'); + var col2 = editorUi.createDiv('col-md-8'); + + var label = document.createElement('label'); + label.className = 'control-label pull-right'; + mxUtils.write(label, mxResources.get('name')); + col1.appendChild(label); + var name = editorUi.editor.filename; + var input = document.createElement('input'); + input.setAttribute('value', name); + input.className = 'form-control'; + + col2.appendChild(input); + + row.appendChild(col1); + row.appendChild(col2); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + var req = new XMLHttpRequest(); + + req.open("PUT", SAVE_URL + editorUi.editor.data.id, true); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + req.setRequestHeader('Authorization', 'Bearer ' + editorUi.editor.data.token); + req.send('name=' + input.value); + + req.onload = function(e) { + if (req.status === 200) { + editorUi.editor.setStatus('Project successfully renamed'); + editorUi.editor.filename = input.value; + + } else { + console.log(req.response); + editorUi.editor.setStatus(JSON.parse(req.response).errors[0].message); + } + } + req.onerror = function(e) { + mxUtils.alert(req.statusText); + }; + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; + //nameInput.setAttribute('value', editorUi.editor.getOrCreateFilename()); +}; + +/** + * Constructs a new edit file dialog. + */ +function EditFileDialog(editorUi) { + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('edit')); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var row = editorUi.createDiv('row'); + var col1 = editorUi.createDiv('col-md-12'); + + var textarea = document.createElement('textarea'); + textarea.style.width = '100%'; + textarea.style.height = '374px'; + textarea.value = mxUtils.getPrettyXml(editorUi.editor.getGraphXml()); + + // Enables dropping files + if (fileSupport) { + function handleDrop(evt) { + evt.stopPropagation(); + evt.preventDefault(); + + if (evt.dataTransfer.files.length > 0) { + var file = evt.dataTransfer.files[0]; + + var reader = new FileReader(); + reader.onload = function(e) { + textarea.value = e.target.result; + }; + reader.readAsText(file); + } + }; + + function handleDragOver(evt) { + evt.stopPropagation(); + evt.preventDefault(); + }; + + // Setup the dnd listeners. + textarea.addEventListener('dragover', handleDragOver, false); + textarea.addEventListener('drop', handleDrop, false); + } + col1.appendChild(textarea); + + row.appendChild(col1); + body.appendChild(row); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), function() { + var doc = mxUtils.parseXml(textarea.value); + editorUi.editor.setGraphXml(doc.documentElement); + editorUi.hideDialog(); + }); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Constructs a new export dialog. + */ +function ExportDialog(editorUi) { + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body form'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('export') + ' XML'); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var form = editorUi.createDiv('form-horizontal form-row-seperated'); + var group = editorUi.createDiv('form-group last'); + + var label = document.createElement('label'); + label.className = 'col-sm-4 control-label'; + mxUtils.write(label, mxResources.get('filename')); + + var input = document.createElement('input'); + input.setAttribute('value', editorUi.editor.getOrCreateFilename()); + input.className = 'form-control'; + + var div = editorUi.createDiv('col-sm-8'); + div.appendChild(input); + + group.appendChild(label); + group.appendChild(div); + form.appendChild(group); + + body.appendChild(form); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('export'), mxUtils.bind(this, + function(data) { + editorUi.save(false); + + var xml = encodeURIComponent(mxUtils.getXml(editorUi.editor.getGraphXml())); + new mxXmlRequest(SAVE_URL + editorUi.editor.data.id + '/download', + 'filename=' + input.value, 'GET').simulate(document, "_blank"); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; + +/** + * Giuseppe Careri + * Constructs a new general dialog. + */ +function GeneralDialog(editorUi, cell) { + var graph = editorUi.editor.graph; + + var content = editorUi.createDiv('modal-content'); + var header = editorUi.createDiv('modal-header'); + var body = editorUi.createDiv('modal-body form modal-body-scroll'); + var footer = editorUi.createDiv('modal-footer'); + + //--- START HEADER + var title = editorUi.createHeader('h4'); + mxUtils.write(title, mxResources.get('edit') + ' ' + mxResources.get(cell.value + .nodeName)); + + var x = mxUtils.button('', function() { + editorUi.hideDialog(); + }); + x.className = 'close'; + + header.appendChild(x); + header.appendChild(title); + //--- END HEADER + + //--- START BODY + var length = cell.value.attributes.length; + var form = editorUi.createDiv('form-horizontal form-row-seperated'); + + for (var i = 0; i < length; i++) { + var name = cell.value.attributes[i].name; + var id = '_' + name; + var value = cell.value.attributes[i].value; + + var group = editorUi.createDiv((i == length - 1) ? 'form-group last' : + 'form-group'); + + var label = document.createElement('label'); + label.className = 'col-sm-4 control-label'; + mxUtils.write(label, mxResources.get(name)); + group.appendChild(label); + + var input; + + switch (name) { + case 'sip_id': + input = createDropdownFromApi('/api/agents', value, 'name', 'id', editorUi); + break; + case 'queue_id': + input = createDropdownFromApi('/api/voice/queues', value, 'name', 'name', editorUi); + break; + case 'trunk_id': + input = createDropdownFromApi('/api/trunks', value, 'name', 'id', editorUi); + break; + case 'variable_id': + input = createDropdownFromApi('/api/variables', value, 'name', 'id', editorUi); + break; + case 'context': + input = createDropdownFromApi('/api/voice/contexts', value, 'name', 'name', editorUi); + break; + case 'mailbox': + input = createDropdownFromApi('/api/voice/voicemails', value, 'mailbox', 'id', editorUi, ['mailbox', 'context'], '%mailbox%@%context%'); + break; + case 'model': + input = createDropdownFromArray(ISPEECHASRMODEL, value); + break; + case 'ispeech_asr_language': + input = createDropdownFromArray(ISPEECHASRLANG, value); + break; + case 'ispeech_tts_language': + input = createDropdownFromArray(ISPEECHLANG, value); + break; + case 'google_tts_language': + input = createDropdownFromArray(GOOGLETTSLANG, value); + break; + case 'interval_id': + input = createGroupedDropdownFromApi('/api/intervals', value, 'name', 'id', editorUi, 'IntervalId'); + break; + case 'project_id': + input = createDropdownFromApi('/api/square/projects', value, 'name', 'id', editorUi); + break; + case 'odbc_id': + input = createDropdownFromApi('/api/square/odbc', value, 'name', 'id', editorUi); + break; + case 'file_id': + input = createDropdownFromApi('/api/sounds', value, 'display_name', 'id', editorUi); + break; + case 'timeout': + case 'digit': + case 'mindigit': + case 'maxdigit': + case 'response': + case 'retry': + input = document.createElement('input'); + input.setAttribute('type', 'number'); + input.setAttribute('min', 0); + input.setAttribute('max', 1000); + input.setAttribute('value', value); + input.className = 'form-control'; + break; + case 'text': + case 'key': + case 'query': + case 'condition': + case 'command': + input = document.createElement('textarea'); + input.innerHTML = value; + input.className = 'form-control'; + break; + default: + input = document.createElement('input'); + input.setAttribute('value', value); + input.className = 'form-control'; + break; + } + + input.setAttribute('id', id) + + var div = editorUi.createDiv('col-sm-8'); + div.appendChild(input); + + // Help + if (mxResources.get('help_' + name)) { + var help = editorUi.createDiv('p'); + help.className = 'help-block'; + mxUtils.write(help, mxResources.get('help_' + name)); + div.appendChild(help); + } + + group.appendChild(div); + form.appendChild(group); + } + body.appendChild(form); + //--- END BODY + + //--- START FOOTER + var save = mxUtils.button(mxResources.get('save'), mxUtils.bind(this, + function(data) { + for (var i = 0; i < cell.value.attributes.length; i++) { + var id = '_' + cell.value.attributes[i].name; + var name = cell.value.attributes[i].name; + console.log(name, document.getElementById(id).value); + cell.setAttribute(name, document.getElementById(id).value); + }; + graph.refresh(cell); + editorUi.hideDialog(); + })); + save.className = 'btn blue'; + + var close = mxUtils.button(mxResources.get('cancel'), function() { + editorUi.hideDialog(); + }); + close.className = 'btn default'; + + footer.appendChild(save); + footer.appendChild(close); + //--- END FOOTER + + //--- START CONTENT + content.appendChild(header); + content.appendChild(body); + content.appendChild(footer); + //--- END CONTENT + + this.container = content; +}; diff --git a/public/assets/plugins/square/js/Editor.js b/public/assets/plugins/square/js/Editor.js index 1fbd323..9858989 100644 --- a/public/assets/plugins/square/js/Editor.js +++ b/public/assets/plugins/square/js/Editor.js @@ -1 +1,888 @@ -var _0xc0ec=["\x49\x53\x5F\x54\x4F\x55\x43\x48","\x73\x74\x6F\x72\x61\x67\x65","\x6C\x6F\x63\x61\x6C","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x46\x69\x6C\x65","\x46\x69\x6C\x65\x52\x65\x61\x64\x65\x72","\x46\x69\x6C\x65\x4C\x69\x73\x74","\x74\x6F\x75\x63\x68","\x31","\x6F\x70\x65\x6E\x65\x72","\x63\x6F\x75\x6E\x74\x65\x72","\x63\x61\x6C\x6C","\x69\x6E\x69\x74","\x69\x6E\x69\x74\x53\x74\x65\x6E\x63\x69\x6C\x52\x65\x67\x69\x73\x74\x72\x79","\x67\x72\x61\x70\x68","\x6F\x75\x74\x6C\x69\x6E\x65","\x75\x70\x64\x61\x74\x65\x4F\x6E\x50\x61\x6E","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x63\x72\x65\x61\x74\x65\x55\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x73\x74\x61\x74\x75\x73","","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x64\x72\x61\x77\x69\x6E\x67","\x67\x65\x74","\x2E\x78\x6D\x6C","\x67\x65\x74\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x6D\x6F\x64\x69\x66\x69\x65\x64","\x67\x72\x61\x70\x68\x43\x68\x61\x6E\x67\x65\x4C\x69\x73\x74\x65\x6E\x65\x72","\x61\x70\x70\x6C\x79","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x6F\x6E\x62\x65\x66\x6F\x72\x65\x75\x6E\x6C\x6F\x61\x64","\x61\x6C\x6C\x43\x68\x61\x6E\x67\x65\x73\x4C\x6F\x73\x74","\x72\x65\x73\x65\x74\x56\x69\x65\x77\x4F\x6E\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x73\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x65\x78\x74\x65\x6E\x64","\x67\x72\x69\x64\x49\x6D\x61\x67\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x2F\x67\x72\x69\x64\x2E\x67\x69\x66","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x49\x6D\x61\x67\x65","\x2F\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x2E\x67\x69\x66","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x6D\x78\x47\x72\x61\x70\x68\x4D\x6F\x64\x65\x6C","\x73\x63\x61\x6C\x65","\x76\x69\x65\x77","\x67\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x69\x64","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x30","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x67\x75\x69\x64\x65\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x63\x6F\x6E\x6E\x65\x63\x74","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x66\x6F\x6C\x64","\x73\x63\x72\x6F\x6C\x6C\x4C\x65\x66\x74","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x78","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65","\x64\x78","\x79","\x64\x79","\x70\x61\x67\x65\x56\x69\x73\x69\x62\x6C\x65","\x70\x61\x67\x65","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x73\x56\x69\x73\x69\x62\x6C\x65","\x70\x72\x65\x66\x65\x72\x50\x61\x67\x65\x53\x69\x7A\x65","\x70\x61\x67\x65\x53\x63\x61\x6C\x65","\x70\x61\x67\x65\x57\x69\x64\x74\x68","\x70\x61\x67\x65\x48\x65\x69\x67\x68\x74","\x70\x61\x67\x65\x46\x6F\x72\x6D\x61\x74","\x6C\x65\x6E\x67\x74\x68","\x64\x65\x63\x6F\x64\x65","\x75\x70\x64\x61\x74\x65\x47\x72\x61\x70\x68\x43\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x65\x6E\x63\x6F\x64\x65","\x72\x6F\x75\x6E\x64","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x6E\x6F\x6E\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x73\x74\x79\x6C\x65","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x66\x69\x6C\x6C","\x72\x65\x63\x6F\x6E\x66\x69\x67\x75\x72\x65","\x23\x65\x62\x65\x62\x65\x62","\x62\x6F\x72\x64\x65\x72\x53\x74\x79\x6C\x65","\x73\x6F\x6C\x69\x64","\x62\x6F\x72\x64\x65\x72\x43\x6F\x6C\x6F\x72","\x23\x65\x35\x65\x35\x65\x35","\x62\x6F\x72\x64\x65\x72\x54\x6F\x70\x57\x69\x64\x74\x68","\x31\x70\x78","\x62\x6F\x72\x64\x65\x72\x4C\x65\x66\x74\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72\x52\x69\x67\x68\x74\x57\x69\x64\x74\x68","\x30\x70\x78","\x62\x6F\x72\x64\x65\x72\x42\x6F\x74\x74\x6F\x6D\x57\x69\x64\x74\x68","\x62\x6F\x72\x64\x65\x72","\x76\x61\x6C\x69\x64\x61\x74\x65","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x68\x69\x64\x64\x65\x6E","\x61\x75\x74\x6F","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x75\x72\x6C\x28","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x6E\x6F\x64\x65","\x49\x53\x5F\x49\x45\x36","\x73\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x2F\x67\x72\x61\x70\x68\x65\x64\x69\x74\x6F\x72\x2D\x69\x65\x36\x2E\x63\x73\x73","\x6C\x69\x6E\x6B","\x6C\x6F\x61\x64\x44\x65\x66\x61\x75\x6C\x74\x42\x75\x6E\x64\x6C\x65","\x61\x64\x64","\x44\x45\x46\x41\x55\x4C\x54\x5F\x48\x4F\x54\x53\x50\x4F\x54","\x63\x72\x65\x61\x74\x65\x4D\x61\x72\x6B\x65\x72","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x73","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6E\x67","\x53\x48\x41\x44\x4F\x57\x43\x4F\x4C\x4F\x52","\x23\x64\x30\x64\x30\x64\x30","\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x23\x39\x39\x63\x63\x66\x66","\x48\x41\x4E\x44\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x43\x4F\x4C\x4F\x52","\x23\x30\x30\x38\x38\x63\x66","\x56\x45\x52\x54\x45\x58\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x23\x30\x30\x61\x38\x66\x66","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x43\x4F\x4C\x4F\x52","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x4F\x55\x54\x4C\x49\x4E\x45\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x43\x4F\x4C\x4F\x52","\x43\x4F\x4E\x4E\x45\x43\x54\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x23\x63\x65\x65\x37\x66\x66","\x45\x44\x47\x45\x5F\x53\x45\x4C\x45\x43\x54\x49\x4F\x4E\x5F\x43\x4F\x4C\x4F\x52","\x44\x45\x46\x41\x55\x4C\x54\x5F\x56\x41\x4C\x49\x44\x5F\x43\x4F\x4C\x4F\x52","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x46\x49\x4C\x4C\x43\x4F\x4C\x4F\x52","\x47\x55\x49\x44\x45\x5F\x43\x4F\x4C\x4F\x52","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x43\x6F\x6C\x6F\x72","\x23\x63\x30\x63\x30\x63\x30","\x64\x65\x66\x61\x75\x6C\x74\x4F\x70\x61\x63\x69\x74\x79","\x63\x72\x65\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x53\x68\x61\x70\x65","\x77\x68\x69\x74\x65","\x23\x63\x61\x63\x61\x63\x61","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65\x42\x6F\x75\x6E\x64\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x6D\x69\x6E","\x66\x6C\x6F\x6F\x72","\x6D\x61\x78","\x63\x65\x69\x6C","\x70\x61\x6E\x47\x72\x61\x70\x68","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x75\x73\x65\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x68\x61\x73\x53\x63\x72\x6F\x6C\x6C\x62\x61\x72\x73","\x6D\x61\x72\x67\x69\x6E\x4C\x65\x66\x74","\x70\x78","\x6D\x61\x72\x67\x69\x6E\x54\x6F\x70","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x69\x6D\x61\x67\x65","\x73\x72\x63","\x64\x65\x73\x74\x72\x6F\x79","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x6E\x65","\x72\x65\x64\x72\x61\x77","\x72\x65\x64\x72\x61\x77\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x69\x73\x53\x68\x61\x64\x6F\x77","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x54\x52\x49\x43\x54\x48\x54\x4D\x4C","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x69\x6E\x73\x65\x72\x74\x42\x65\x66\x6F\x72\x65","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x2D\x31\x70\x78\x20\x2D\x31\x70\x78","\x64\x62\x6C\x63\x6C\x69\x63\x6B","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x69\x73\x48\x69\x64\x65\x4F\x6E\x48\x6F\x76\x65\x72","\x68\x69\x64\x65","\x69\x73\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x62\x6F\x75\x6E\x64\x73","\x75\x70\x64\x61\x74\x65\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x6D\x69\x6E\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x69\x73\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x70\x6F\x69\x6E\x74\x73","\x69\x73\x44\x61\x73\x68\x65\x64","\x70\x61\x67\x65\x42\x72\x65\x61\x6B\x44\x61\x73\x68\x65\x64","\x61\x64\x64\x50\x69\x70\x65","\x73\x70\x6C\x69\x63\x65","\x76\x65\x72\x74\x69\x63\x61\x6C\x50\x61\x67\x65\x42\x72\x65\x61\x6B\x73","\x73\x6E\x61\x70\x54\x6F\x54\x65\x72\x6D\x69\x6E\x61\x6C\x73","\x73\x68\x6F\x75\x6C\x64\x52\x65\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73\x46\x72\x6F\x6D\x50\x61\x72\x65\x6E\x74","\x69\x73\x56\x65\x72\x74\x65\x78","\x67\x65\x74\x43\x65\x6C\x6C\x47\x65\x6F\x6D\x65\x74\x72\x79","\x72\x65\x6C\x61\x74\x69\x76\x65","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x41\x6C\x74\x44\x6F\x77\x6E","\x61\x64\x64\x49\x74\x65\x6D","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x63\x6F\x6E\x73\x75\x6D\x65","\x67\x65\x74\x49\x6E\x69\x74\x69\x61\x6C\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x69\x73\x44\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x73\x65\x6C\x65\x63\x74\x44\x65\x6C\x61\x79\x65\x64","\x67\x65\x74\x43\x65\x6C\x6C","\x63\x65\x6C\x6C","\x67\x65\x74\x45\x76\x65\x6E\x74","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x46\x6F\x72\x45\x76\x65\x6E\x74","\x67\x65\x74\x43\x65\x6C\x6C\x46\x6F\x72\x50\x6F\x70\x75\x70\x45\x76\x65\x6E\x74","\x65\x64\x69\x74","\x67\x65\x74\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x6E\x64\x6F\x61\x62\x6C\x65\x45\x64\x69\x74\x48\x61\x70\x70\x65\x6E\x65\x64","\x67\x65\x74\x56\x69\x65\x77","\x63\x68\x61\x6E\x67\x65\x73","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x46\x6F\x72\x43\x68\x61\x6E\x67\x65\x73","\x67\x65\x74\x53\x74\x61\x74\x65","\x70\x75\x73\x68","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x2F\x67\x65\x6E\x65\x72\x61\x6C\x2E\x78\x6D\x6C","\x6C\x6F\x61\x64\x53\x74\x65\x6E\x63\x69\x6C\x53\x65\x74","\x6C\x69\x62\x72\x61\x72\x69\x65\x73","\x70\x61\x63\x6B\x61\x67\x65\x73","\x67\x65\x74\x53\x74\x65\x6E\x63\x69\x6C","\x73\x74\x65\x6E\x63\x69\x6C\x73","\x67\x65\x74\x42\x61\x73\x65\x6E\x61\x6D\x65\x46\x6F\x72\x53\x74\x65\x6E\x63\x69\x6C","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x2E\x6A\x73","\x6C\x6F\x61\x64","\x67\x65\x74\x54\x65\x78\x74","\x2F","\x2E","\x73\x70\x6C\x69\x74","\x6D\x78\x67\x72\x61\x70\x68","\x67\x65\x74\x58\x6D\x6C","\x70\x61\x72\x73\x65\x53\x74\x65\x6E\x63\x69\x6C\x53\x65\x74","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x6E\x61\x6D\x65","\x6E\x6F\x64\x65\x54\x79\x70\x65","\x4E\x4F\x44\x45\x54\x59\x50\x45\x5F\x45\x4C\x45\x4D\x45\x4E\x54","\x5F","\x72\x65\x70\x6C\x61\x63\x65","\x61\x64\x64\x53\x74\x65\x6E\x63\x69\x6C","\x77","\x68","\x6E\x65\x78\x74\x53\x69\x62\x6C\x69\x6E\x67","\x70\x72\x6F\x64\x75\x63\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65\x72","\x64\x6F\x6E\x65","\x73\x65\x74\x43\x6F\x6E\x73\x75\x6D\x65\x72","\x65\x78\x65\x63\x75\x74\x65","\x73\x65\x74\x44\x61\x74\x61","\x64\x61\x74\x61","\x65\x72\x72\x6F\x72","\x63\x61\x6E\x63\x65\x6C","\x61\x6C\x65\x72\x74"];var useLocalStorage=(mxClient[_0xc0ec[0]]||urlParams[_0xc0ec[1]]==_0xc0ec[2])&& typeof (localStorage)!=_0xc0ec[3];var fileSupport=window[_0xc0ec[4]]!=null&&window[_0xc0ec[5]]!=null&&window[_0xc0ec[6]]!=null;var touchStyle=mxClient[_0xc0ec[0]]||urlParams[_0xc0ec[7]]==_0xc0ec[8];var counter=0;try{var op=window;while(op[_0xc0ec[9]]!=null&&!isNaN(op[_0xc0ec[9]][_0xc0ec[10]])){op=op[_0xc0ec[9]]};if(op!=null){op[_0xc0ec[10]]++;counter=op[_0xc0ec[10]]}}catch(e){};Editor=function(){mxEventSource[_0xc0ec[11]](this);this[_0xc0ec[12]]();this[_0xc0ec[13]]();this[_0xc0ec[14]]= new Graph();this[_0xc0ec[15]]= new mxOutline(this[_0xc0ec[14]]);this[_0xc0ec[15]][_0xc0ec[16]]=true;this[_0xc0ec[17]]=this[_0xc0ec[18]]();this[_0xc0ec[19]]=_0xc0ec[20];this[_0xc0ec[21]]=null;this[_0xc0ec[22]]=function(){return this[_0xc0ec[21]]||mxResources[_0xc0ec[24]](_0xc0ec[23],[counter])+_0xc0ec[25]};this[_0xc0ec[26]]=function(){return this[_0xc0ec[21]]};this[_0xc0ec[27]]=function(_0x742cx6){this[_0xc0ec[19]]=_0x742cx6;this[_0xc0ec[29]]( new mxEventObject(_0xc0ec[28]))};this[_0xc0ec[30]]=function(){return this[_0xc0ec[19]]};this[_0xc0ec[31]]=false;this[_0xc0ec[32]]=function(){this[_0xc0ec[31]]=true};this[_0xc0ec[14]][_0xc0ec[36]]()[_0xc0ec[35]](mxEvent.CHANGE,mxUtils[_0xc0ec[34]](this,function(){this[_0xc0ec[32]][_0xc0ec[33]](this,arguments)}));window[_0xc0ec[37]]=mxUtils[_0xc0ec[34]](this,function(){if(this[_0xc0ec[31]]){return mxResources[_0xc0ec[24]](_0xc0ec[38])}});this[_0xc0ec[14]][_0xc0ec[39]]=false;this[_0xc0ec[14]][_0xc0ec[40]]=true;this[_0xc0ec[14]][_0xc0ec[41]]=null};mxUtils[_0xc0ec[42]](Editor,mxEventSource);Editor[_0xc0ec[44]][_0xc0ec[43]]=IMAGE_PATH+_0xc0ec[45];Editor[_0xc0ec[44]][_0xc0ec[46]]=IMAGE_PATH+_0xc0ec[47];Editor[_0xc0ec[44]][_0xc0ec[48]]=function(_0x742cx7){var _0x742cx8= new mxCodec(_0x742cx7[_0xc0ec[49]]);if(_0x742cx7[_0xc0ec[50]]==_0xc0ec[51]){this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[52]]=1;this[_0xc0ec[14]][_0xc0ec[54]]=_0x742cx7[_0xc0ec[56]](_0xc0ec[55])!=_0xc0ec[57];this[_0xc0ec[14]][_0xc0ec[59]][_0xc0ec[58]]=_0x742cx7[_0xc0ec[56]](_0xc0ec[60])!=_0xc0ec[57];this[_0xc0ec[14]][_0xc0ec[62]](_0x742cx7[_0xc0ec[56]](_0xc0ec[61])!=_0xc0ec[57]);this[_0xc0ec[14]][_0xc0ec[64]](_0x742cx7[_0xc0ec[56]](_0xc0ec[63])!=_0xc0ec[57]);this[_0xc0ec[14]][_0xc0ec[65]]=_0x742cx7[_0xc0ec[56]](_0xc0ec[66])!=_0xc0ec[57];this[_0xc0ec[14]][_0xc0ec[40]]=_0x742cx7[_0xc0ec[56]](_0xc0ec[40])!=_0xc0ec[57];if(!this[_0xc0ec[14]][_0xc0ec[40]]){this[_0xc0ec[14]][_0xc0ec[68]][_0xc0ec[67]]=0;this[_0xc0ec[14]][_0xc0ec[68]][_0xc0ec[69]]=0;this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[70]]=Number(_0x742cx7[_0xc0ec[56]](_0xc0ec[72])||0);this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[73]]=Number(_0x742cx7[_0xc0ec[56]](_0xc0ec[74])||0)};this[_0xc0ec[14]][_0xc0ec[75]]=_0x742cx7[_0xc0ec[56]](_0xc0ec[76])==_0xc0ec[8];this[_0xc0ec[14]][_0xc0ec[77]]=this[_0xc0ec[14]][_0xc0ec[75]];this[_0xc0ec[14]][_0xc0ec[78]]=this[_0xc0ec[14]][_0xc0ec[77]];var _0x742cx9=_0x742cx7[_0xc0ec[56]](_0xc0ec[79]);if(_0x742cx9!=null){this[_0xc0ec[14]][_0xc0ec[79]]=_0x742cx9}else {this[_0xc0ec[14]][_0xc0ec[79]]=1.5};var _0x742cxa=_0x742cx7[_0xc0ec[56]](_0xc0ec[80]);var _0x742cxb=_0x742cx7[_0xc0ec[56]](_0xc0ec[81]);if(_0x742cxa!=null&&_0x742cxb!=null){this[_0xc0ec[14]][_0xc0ec[82]]= new mxRectangle(0,0,parseFloat(_0x742cxa),parseFloat(_0x742cxb));this[_0xc0ec[15]][_0xc0ec[15]][_0xc0ec[82]]=this[_0xc0ec[14]][_0xc0ec[82]]};var _0x742cxc=_0x742cx7[_0xc0ec[56]](_0xc0ec[41]);if(_0x742cxc!=null&&_0x742cxc[_0xc0ec[83]]>0){this[_0xc0ec[14]][_0xc0ec[41]]=_0x742cxc};_0x742cx8[_0xc0ec[84]](_0x742cx7,this[_0xc0ec[14]][_0xc0ec[36]]());this[_0xc0ec[85]]()}};Editor[_0xc0ec[44]][_0xc0ec[86]]=function(){var _0x742cxd= new mxCodec(mxUtils[_0xc0ec[87]]());var _0x742cx7=_0x742cxd[_0xc0ec[88]](this[_0xc0ec[14]][_0xc0ec[36]]());if(this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[70]]!=0||this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[73]]!=0){_0x742cx7[_0xc0ec[90]](_0xc0ec[72],Math[_0xc0ec[89]](this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[70]]*100)/100);_0x742cx7[_0xc0ec[90]](_0xc0ec[74],Math[_0xc0ec[89]](this[_0xc0ec[14]][_0xc0ec[53]][_0xc0ec[71]][_0xc0ec[73]]*100)/100)};_0x742cx7[_0xc0ec[90]](_0xc0ec[55],(this[_0xc0ec[14]][_0xc0ec[91]]())?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[60],(this[_0xc0ec[14]][_0xc0ec[59]][_0xc0ec[58]])?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[60],(this[_0xc0ec[14]][_0xc0ec[59]][_0xc0ec[58]])?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[61],(this[_0xc0ec[14]][_0xc0ec[93]][_0xc0ec[92]]())?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[63],(this[_0xc0ec[14]][_0xc0ec[94]][_0xc0ec[92]]())?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[66],(this[_0xc0ec[14]][_0xc0ec[65]])?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[76],(this[_0xc0ec[14]][_0xc0ec[75]])?_0xc0ec[8]:_0xc0ec[57]);_0x742cx7[_0xc0ec[90]](_0xc0ec[79],this[_0xc0ec[14]][_0xc0ec[79]]);_0x742cx7[_0xc0ec[90]](_0xc0ec[80],this[_0xc0ec[14]][_0xc0ec[82]][_0xc0ec[95]]);_0x742cx7[_0xc0ec[90]](_0xc0ec[81],this[_0xc0ec[14]][_0xc0ec[82]][_0xc0ec[96]]);if(!this[_0xc0ec[14]][_0xc0ec[40]]){_0x742cx7[_0xc0ec[90]](_0xc0ec[40],_0xc0ec[57])};if(this[_0xc0ec[14]][_0xc0ec[41]]!=null){_0x742cx7[_0xc0ec[90]](_0xc0ec[41],this[_0xc0ec[14]][_0xc0ec[41]])};return _0x742cx7};Editor[_0xc0ec[44]][_0xc0ec[85]]=function(){var _0x742cxe=this[_0xc0ec[14]];var _0x742cxf=this[_0xc0ec[15]];if(_0x742cxe[_0xc0ec[68]]!=null&&_0x742cxf[_0xc0ec[15]][_0xc0ec[68]]!=null){if(_0x742cxe[_0xc0ec[41]]!=null){if(_0x742cxe[_0xc0ec[41]]==_0xc0ec[97]){_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]]=_0xc0ec[100]}else {if(_0x742cxe[_0xc0ec[53]][_0xc0ec[101]]!=null){_0x742cxe[_0xc0ec[53]][_0xc0ec[101]][_0xc0ec[102]]=_0x742cxe[_0xc0ec[41]];_0x742cxe[_0xc0ec[53]][_0xc0ec[101]][_0xc0ec[103]]()};_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]]=_0x742cxe[_0xc0ec[41]]}}else {_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]]=_0xc0ec[20]};if(_0x742cxe[_0xc0ec[75]]){_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]]=_0xc0ec[104];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[105]]=_0xc0ec[106];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[107]]=_0xc0ec[108];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[109]]=_0xc0ec[110];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[111]]=_0xc0ec[110];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[112]]=_0xc0ec[113];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[114]]=_0xc0ec[113]}else {_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[115]]=_0xc0ec[20]};_0x742cxf[_0xc0ec[15]][_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]]=_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[98]];if(_0x742cxf[_0xc0ec[15]][_0xc0ec[75]]!=_0x742cxe[_0xc0ec[75]]||_0x742cxf[_0xc0ec[15]][_0xc0ec[79]]!=_0x742cxe[_0xc0ec[79]]){_0x742cxf[_0xc0ec[15]][_0xc0ec[79]]=_0x742cxe[_0xc0ec[79]];_0x742cxf[_0xc0ec[15]][_0xc0ec[75]]=_0x742cxe[_0xc0ec[75]];_0x742cxf[_0xc0ec[15]][_0xc0ec[53]][_0xc0ec[116]]()};if(_0x742cxe[_0xc0ec[40]]&&_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[117]]==_0xc0ec[118]&& !touchStyle){_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[117]]=_0xc0ec[119]}else {if(!_0x742cxe[_0xc0ec[40]]||touchStyle){_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[117]]=_0xc0ec[118]}};var _0x742cx10=(mxClient[_0xc0ec[120]]&&document[_0xc0ec[121]]>=9)?_0xc0ec[122]+this[_0xc0ec[46]]+_0xc0ec[123]:_0xc0ec[97];_0x742cxe[_0xc0ec[68]][_0xc0ec[99]][_0xc0ec[124]]=(!_0x742cxe[_0xc0ec[75]]&&_0x742cxe[_0xc0ec[91]]())?_0xc0ec[122]+this[_0xc0ec[43]]+_0xc0ec[123]:_0x742cx10;if(_0x742cxe[_0xc0ec[53]][_0xc0ec[101]]!=null){_0x742cxe[_0xc0ec[53]][_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[99]][_0xc0ec[124]]=(this[_0xc0ec[14]][_0xc0ec[91]]())?_0xc0ec[122]+this[_0xc0ec[43]]+_0xc0ec[123]:_0xc0ec[97]}}};Editor[_0xc0ec[44]][_0xc0ec[12]]=function(){if(mxClient[_0xc0ec[126]]){mxClient[_0xc0ec[129]](_0xc0ec[127],CSS_PATH+_0xc0ec[128])};mxResources[_0xc0ec[130]]=false;mxResources[_0xc0ec[131]](RESOURCE_BASE);mxConstants[_0xc0ec[132]]=0.3;var _0x742cx11=mxConnectionHandler[_0xc0ec[44]][_0xc0ec[133]];mxConnectionHandler[_0xc0ec[44]][_0xc0ec[133]]=function(){var _0x742cx12=_0x742cx11[_0xc0ec[33]](this,arguments);_0x742cx12[_0xc0ec[134]]=mxUtils[_0xc0ec[34]](this,function(_0x742cx13,_0x742cx14){if(this[_0xc0ec[135]]()){return true};return mxCellMarker[_0xc0ec[44]][_0xc0ec[134]][_0xc0ec[33]](_0x742cx12,arguments)});return _0x742cx12};mxConstants[_0xc0ec[136]]=_0xc0ec[137];mxConstants[_0xc0ec[138]]=_0xc0ec[139];mxConstants[_0xc0ec[140]]=_0xc0ec[141];mxConstants[_0xc0ec[142]]=_0xc0ec[143];mxConstants[_0xc0ec[144]]=_0xc0ec[143];mxConstants[_0xc0ec[145]]=_0xc0ec[139];mxConstants[_0xc0ec[146]]=_0xc0ec[143];mxConstants[_0xc0ec[147]]=_0xc0ec[148];mxConstants[_0xc0ec[149]]=_0xc0ec[143];mxConstants[_0xc0ec[150]]=_0xc0ec[143];mxConstants[_0xc0ec[151]]=_0xc0ec[148];mxConstants[_0xc0ec[152]]=_0xc0ec[141];mxGraph[_0xc0ec[44]][_0xc0ec[153]]=_0xc0ec[154];mxGraph[_0xc0ec[44]][_0xc0ec[79]]=1;mxRubberband[_0xc0ec[44]][_0xc0ec[155]]=30;mxGraphView[_0xc0ec[44]][_0xc0ec[156]]=function(_0x742cx15){return new mxRectangleShape(_0x742cx15,this[_0xc0ec[14]][_0xc0ec[41]]||_0xc0ec[157],_0xc0ec[158])};mxGraphView[_0xc0ec[44]][_0xc0ec[159]]=function(){var _0x742cx16=this[_0xc0ec[160]]();var _0x742cx17=(_0x742cx16[_0xc0ec[95]]>0)?_0x742cx16[_0xc0ec[70]]/this[_0xc0ec[52]]-this[_0xc0ec[71]][_0xc0ec[70]]:0;var _0x742cx18=(_0x742cx16[_0xc0ec[96]]>0)?_0x742cx16[_0xc0ec[73]]/this[_0xc0ec[52]]-this[_0xc0ec[71]][_0xc0ec[73]]:0;var _0x742cx19=_0x742cx16[_0xc0ec[95]]/this[_0xc0ec[52]];var _0x742cx1a=_0x742cx16[_0xc0ec[96]]/this[_0xc0ec[52]];var _0x742cx1b=this[_0xc0ec[14]][_0xc0ec[82]];var _0x742cx9=this[_0xc0ec[14]][_0xc0ec[79]];var _0x742cxa=_0x742cx1b[_0xc0ec[95]]*_0x742cx9;var _0x742cxb=_0x742cx1b[_0xc0ec[96]]*_0x742cx9;var _0x742cx1c=Math[_0xc0ec[162]](Math[_0xc0ec[161]](0,_0x742cx17)/_0x742cxa);var _0x742cx1d=Math[_0xc0ec[162]](Math[_0xc0ec[161]](0,_0x742cx18)/_0x742cxb);var _0x742cx1e=Math[_0xc0ec[164]](Math[_0xc0ec[163]](1,_0x742cx17+_0x742cx19)/_0x742cxa);var _0x742cx1f=Math[_0xc0ec[164]](Math[_0xc0ec[163]](1,_0x742cx18+_0x742cx1a)/_0x742cxb);var _0x742cx20=_0x742cx1e-_0x742cx1c;var _0x742cx21=_0x742cx1f-_0x742cx1d;var _0x742cx15= new mxRectangle(this[_0xc0ec[52]]*(this[_0xc0ec[71]][_0xc0ec[70]]+_0x742cx1c*_0x742cxa),this[_0xc0ec[52]]*(this[_0xc0ec[71]][_0xc0ec[73]]+_0x742cx1d*_0x742cxb),this[_0xc0ec[52]]*_0x742cx20*_0x742cxa,this[_0xc0ec[52]]*_0x742cx21*_0x742cxb);return _0x742cx15};var _0x742cx22=mxGraph[_0xc0ec[44]][_0xc0ec[165]];mxGraph[_0xc0ec[44]][_0xc0ec[165]]=function(_0x742cx23,_0x742cx24){_0x742cx22[_0xc0ec[33]](this,arguments);if((this[_0xc0ec[166]]!=mxConstants[_0xc0ec[167]]&&this[_0xc0ec[53]][_0xc0ec[101]]!=null)&&(!this[_0xc0ec[168]]||!mxUtils[_0xc0ec[169]](this[_0xc0ec[68]]))){this[_0xc0ec[53]][_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[99]][_0xc0ec[170]]=_0x742cx23+_0xc0ec[171];this[_0xc0ec[53]][_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[99]][_0xc0ec[172]]=_0x742cx24+_0xc0ec[171]}};var _0x742cx25=this;mxGraphView[_0xc0ec[44]][_0xc0ec[173]]=function(){var _0x742cxc=this[_0xc0ec[14]][_0xc0ec[174]]();if(_0x742cxc!=null){if(this[_0xc0ec[124]]==null||this[_0xc0ec[124]][_0xc0ec[175]]!=_0x742cxc[_0xc0ec[176]]){if(this[_0xc0ec[124]]!=null){this[_0xc0ec[124]][_0xc0ec[177]]()};var _0x742cx15= new mxRectangle(0,0,1,1);this[_0xc0ec[124]]= new mxImageShape(_0x742cx15,_0x742cxc[_0xc0ec[176]]);this[_0xc0ec[124]][_0xc0ec[166]]=this[_0xc0ec[14]][_0xc0ec[166]];this[_0xc0ec[124]][_0xc0ec[12]](this[_0xc0ec[178]]);this[_0xc0ec[124]][_0xc0ec[179]]()};this[_0xc0ec[180]](this[_0xc0ec[124]],_0x742cxc)}else {if(this[_0xc0ec[124]]!=null){this[_0xc0ec[124]][_0xc0ec[177]]();this[_0xc0ec[124]]=null}};if(this[_0xc0ec[14]][_0xc0ec[75]]){var _0x742cx15=this[_0xc0ec[159]]();if(this[_0xc0ec[101]]==null){this[_0xc0ec[101]]=this[_0xc0ec[156]](_0x742cx15);this[_0xc0ec[101]][_0xc0ec[52]]=1;this[_0xc0ec[101]][_0xc0ec[181]]=true;this[_0xc0ec[101]][_0xc0ec[166]]=mxConstants[_0xc0ec[182]];this[_0xc0ec[101]][_0xc0ec[12]](this[_0xc0ec[14]][_0xc0ec[68]]);this[_0xc0ec[14]][_0xc0ec[68]][_0xc0ec[184]][_0xc0ec[99]][_0xc0ec[183]]=_0xc0ec[185];this[_0xc0ec[14]][_0xc0ec[68]][_0xc0ec[186]](this[_0xc0ec[101]][_0xc0ec[125]],this[_0xc0ec[14]][_0xc0ec[68]][_0xc0ec[184]]);this[_0xc0ec[101]][_0xc0ec[179]]();this[_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[187]]=_0xc0ec[188];this[_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[99]][_0xc0ec[189]]=_0xc0ec[190];mxEvent[_0xc0ec[35]](this[_0xc0ec[101]][_0xc0ec[125]],_0xc0ec[191],mxUtils[_0xc0ec[34]](this,function(_0x742cx14){this[_0xc0ec[14]][_0xc0ec[192]](_0x742cx14)}));mxEvent[_0xc0ec[198]](this[_0xc0ec[101]][_0xc0ec[125]],mxUtils[_0xc0ec[34]](this,function(_0x742cx14){this[_0xc0ec[14]][_0xc0ec[193]](mxEvent.MOUSE_DOWN, new mxMouseEvent(_0x742cx14))}),mxUtils[_0xc0ec[34]](this,function(_0x742cx14){if(this[_0xc0ec[14]][_0xc0ec[93]]!=null&&this[_0xc0ec[14]][_0xc0ec[93]][_0xc0ec[194]]()){this[_0xc0ec[14]][_0xc0ec[93]][_0xc0ec[195]]()};if(this[_0xc0ec[14]][_0xc0ec[196]]&&!mxEvent[_0xc0ec[197]](_0x742cx14)){this[_0xc0ec[14]][_0xc0ec[193]](mxEvent.MOUSE_MOVE, new mxMouseEvent(_0x742cx14))}}),mxUtils[_0xc0ec[34]](this,function(_0x742cx14){this[_0xc0ec[14]][_0xc0ec[193]](mxEvent.MOUSE_UP, new mxMouseEvent(_0x742cx14))}))}else {this[_0xc0ec[101]][_0xc0ec[52]]=1;this[_0xc0ec[101]][_0xc0ec[199]]=_0x742cx15;this[_0xc0ec[101]][_0xc0ec[179]]()};this[_0xc0ec[101]][_0xc0ec[125]][_0xc0ec[99]][_0xc0ec[124]]=(this[_0xc0ec[14]][_0xc0ec[91]]())?_0xc0ec[122]+_0x742cx25[_0xc0ec[43]]+_0xc0ec[123]:_0xc0ec[97]}else {if(this[_0xc0ec[101]]!=null){this[_0xc0ec[101]][_0xc0ec[177]]();this[_0xc0ec[101]]=null}}};mxGraph[_0xc0ec[44]][_0xc0ec[200]]=function(_0x742cx26,_0x742cx27,_0x742cx28){var _0x742cx29=this[_0xc0ec[53]][_0xc0ec[52]];var _0x742cx2a=this[_0xc0ec[53]][_0xc0ec[71]];var _0x742cx1b=this[_0xc0ec[82]];var _0x742cx9=_0x742cx29*this[_0xc0ec[79]];var _0x742cx2b=this[_0xc0ec[53]][_0xc0ec[159]]();_0x742cx27=_0x742cx2b[_0xc0ec[95]];_0x742cx28=_0x742cx2b[_0xc0ec[96]];var _0x742cx15= new mxRectangle(_0x742cx29*_0x742cx2a[_0xc0ec[70]],_0x742cx29*_0x742cx2a[_0xc0ec[73]],_0x742cx1b[_0xc0ec[95]]*_0x742cx9,_0x742cx1b[_0xc0ec[96]]*_0x742cx9);_0x742cx26=_0x742cx26&&Math[_0xc0ec[161]](_0x742cx15[_0xc0ec[95]],_0x742cx15[_0xc0ec[96]])>this[_0xc0ec[201]];var _0x742cx2c=(_0x742cx26)?Math[_0xc0ec[164]](_0x742cx27/_0x742cx15[_0xc0ec[95]])-1:0;var _0x742cx2d=(_0x742cx26)?Math[_0xc0ec[164]](_0x742cx28/_0x742cx15[_0xc0ec[96]])-1:0;var _0x742cx2e=_0x742cx2b[_0xc0ec[70]]+_0x742cx27;var _0x742cx2f=_0x742cx2b[_0xc0ec[73]]+_0x742cx28;if(this[_0xc0ec[202]]==null&&_0x742cx2c>0){this[_0xc0ec[202]]=[]};if(this[_0xc0ec[202]]!=null){for(var _0x742cx30=0;_0x742cx30<=_0x742cx2c;_0x742cx30++){var _0x742cx31=[ new mxPoint(_0x742cx2b[_0xc0ec[70]]+(_0x742cx30+1)*_0x742cx15[_0xc0ec[95]],_0x742cx2b[_0xc0ec[73]]), new mxPoint(_0x742cx2b[_0xc0ec[70]]+(_0x742cx30+1)*_0x742cx15[_0xc0ec[95]],_0x742cx2f)];if(this[_0xc0ec[202]][_0x742cx30]!=null){this[_0xc0ec[202]][_0x742cx30][_0xc0ec[52]]=1;this[_0xc0ec[202]][_0x742cx30][_0xc0ec[203]]=_0x742cx31;this[_0xc0ec[202]][_0x742cx30][_0xc0ec[179]]()}else {var _0x742cx32= new mxPolyline(_0x742cx31,this[_0xc0ec[153]],this[_0xc0ec[52]]);_0x742cx32[_0xc0ec[166]]=this[_0xc0ec[166]];_0x742cx32[_0xc0ec[204]]=this[_0xc0ec[205]];_0x742cx32[_0xc0ec[206]]=false;_0x742cx32[_0xc0ec[52]]=_0x742cx29;_0x742cx32[_0xc0ec[12]](this[_0xc0ec[53]][_0xc0ec[178]]);_0x742cx32[_0xc0ec[179]]();this[_0xc0ec[202]][_0x742cx30]=_0x742cx32}};for(var _0x742cx30=_0x742cx2c;_0x742cx300){this[_0xc0ec[208]]=[]};if(this[_0xc0ec[208]]!=null){for(var _0x742cx30=0;_0x742cx30<=_0x742cx2d;_0x742cx30++){var _0x742cx31=[ new mxPoint(_0x742cx2b[_0xc0ec[70]],_0x742cx2b[_0xc0ec[73]]+(_0x742cx30+1)*_0x742cx15[_0xc0ec[96]]), new mxPoint(_0x742cx2e,_0x742cx2b[_0xc0ec[73]]+(_0x742cx30+1)*_0x742cx15[_0xc0ec[96]])];if(this[_0xc0ec[208]][_0x742cx30]!=null){this[_0xc0ec[208]][_0x742cx30][_0xc0ec[52]]=1;this[_0xc0ec[208]][_0x742cx30][_0xc0ec[203]]=_0x742cx31;this[_0xc0ec[208]][_0x742cx30][_0xc0ec[179]]()}else {var _0x742cx32= new mxPolyline(_0x742cx31,this[_0xc0ec[153]],_0x742cx29);_0x742cx32[_0xc0ec[166]]=this[_0xc0ec[166]];_0x742cx32[_0xc0ec[204]]=this[_0xc0ec[205]];_0x742cx32[_0xc0ec[206]]=false;_0x742cx32[_0xc0ec[52]]=_0x742cx29;_0x742cx32[_0xc0ec[12]](this[_0xc0ec[53]][_0xc0ec[178]]);_0x742cx32[_0xc0ec[179]]();this[_0xc0ec[208]][_0x742cx30]=_0x742cx32}};for(var _0x742cx30=_0x742cx2d;_0x742cx300&&_0x742cx4d[0]==_0xc0ec[255]){_0x742cx4e=_0x742cx4d[1];for(var _0x742cx30=2;_0x742cx30<_0x742cx4d[_0xc0ec[83]]-1;_0x742cx30++){_0x742cx4e+=_0xc0ec[252]+_0x742cx4d[_0x742cx30]}};return _0x742cx4e};mxStencilRegistry[_0xc0ec[241]]=function(_0x742cx4f,_0x742cx50,_0x742cx51){_0x742cx51=(_0x742cx51!=null)?_0x742cx51:false;var _0x742cx52=mxStencilRegistry[_0xc0ec[243]][_0x742cx4f];if(_0x742cx51||_0x742cx52==null){var _0x742cx53=false;if(_0x742cx52==null){var _0x742cx4c=mxUtils[_0xc0ec[250]](_0x742cx4f);_0x742cx52=_0x742cx4c[_0xc0ec[256]]();mxStencilRegistry[_0xc0ec[243]][_0x742cx4f]=_0x742cx52;_0x742cx53=true};mxStencilRegistry[_0xc0ec[257]](_0x742cx52,_0x742cx50,_0x742cx53)}};mxStencilRegistry[_0xc0ec[257]]=function(_0x742cx54,_0x742cx50,_0x742cx53){_0x742cx53=(_0x742cx53!=null)?_0x742cx53:true;var _0x742cx55=_0x742cx54[_0xc0ec[258]];var _0x742cx56=_0x742cx55[_0xc0ec[184]];var _0x742cx57=_0xc0ec[20];var _0x742cx48=_0x742cx55[_0xc0ec[56]](_0xc0ec[259]);if(_0x742cx48!=null){_0x742cx57=_0x742cx48+_0xc0ec[253]};while(_0x742cx56!=null){if(_0x742cx56[_0xc0ec[260]]==mxConstants[_0xc0ec[261]]){_0x742cx48=_0x742cx56[_0xc0ec[56]](_0xc0ec[259]);if(_0x742cx48!=null){_0x742cx57=_0x742cx57[_0xc0ec[248]]();var _0x742cx58=_0x742cx48[_0xc0ec[263]](/ /g,_0xc0ec[262]);if(_0x742cx53){mxStencilRegistry[_0xc0ec[264]](_0x742cx57+_0x742cx58[_0xc0ec[248]](), new mxStencil(_0x742cx56))};if(_0x742cx50!=null){var _0x742cx19=_0x742cx56[_0xc0ec[56]](_0xc0ec[265]);var _0x742cx1a=_0x742cx56[_0xc0ec[56]](_0xc0ec[266]);_0x742cx19=(_0x742cx19==null)?80:parseInt(_0x742cx19,10);_0x742cx1a=(_0x742cx1a==null)?80:parseInt(_0x742cx1a,10);_0x742cx50(_0x742cx57,_0x742cx58,_0x742cx48,_0x742cx19,_0x742cx1a)}}};_0x742cx56=_0x742cx56[_0xc0ec[267]]}}})();OpenFile=function(_0x742cx59){this[_0xc0ec[268]]=null;this[_0xc0ec[269]]=null;this[_0xc0ec[270]]=_0x742cx59};OpenFile[_0xc0ec[44]][_0xc0ec[271]]=function(_0x742cx6){this[_0xc0ec[269]]=_0x742cx6;this[_0xc0ec[272]]()};OpenFile[_0xc0ec[44]][_0xc0ec[273]]=function(_0x742cx6,_0x742cx5a){this[_0xc0ec[274]]=_0x742cx6;this[_0xc0ec[21]]=_0x742cx5a;this[_0xc0ec[272]]()};OpenFile[_0xc0ec[44]][_0xc0ec[275]]=function(_0x742cx5b){this[_0xc0ec[276]]();mxUtils[_0xc0ec[277]](_0x742cx5b)};OpenFile[_0xc0ec[44]][_0xc0ec[272]]=function(){if(this[_0xc0ec[269]]!=null&&this[_0xc0ec[274]]!=null){this[_0xc0ec[269]](this[_0xc0ec[274]],this[_0xc0ec[21]]);this[_0xc0ec[276]]()}};OpenFile[_0xc0ec[44]][_0xc0ec[276]]=function(){if(this[_0xc0ec[270]]!=null){this[_0xc0ec[270]]()}} \ No newline at end of file +/** + * $Id: Editor.js,v 1.14 2013/03/06 17:57:10 boris Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +// Specifies if local storage should be used (eg. on the iPad which has no filesystem) +var useLocalStorage = (mxClient.IS_TOUCH || urlParams['storage'] == 'local') && typeof(localStorage) != 'undefined'; +var fileSupport = window.File != null && window.FileReader != null && window.FileList != null; + +// Specifies if connector should be shown on selected cells +var touchStyle = mxClient.IS_TOUCH || urlParams['touch'] == '1'; + +// Counts open editor tabs (must be global for cross-window access) +var counter = 0; + +// Cross-domain window access is not allowed in FF, so if we +// were opened from another domain then this will fail. +try { + var op = window; + + while (op.opener != null && !isNaN(op.opener.counter)) { + op = op.opener; + } + + // Increments the counter in the first opener in the chain + if (op != null) { + op.counter++; + counter = op.counter; + } +} catch (e) { + // ignore +} + +/** + * Editor constructor executed on page load. + */ +Editor = function() { + mxEventSource.call(this); + this.init(); + this.initStencilRegistry(); + this.graph = new Graph(); + this.outline = new mxOutline(this.graph); + this.outline.updateOnPan = true; + this.undoManager = this.createUndoManager(); + this.status = ''; + + // Contains the name which was used for the last save. Default value is null. + this.filename = null; + + this.getOrCreateFilename = function() { + return this.filename || mxResources.get('drawing', [counter]) + '.xml'; + }; + + this.getFilename = function() { + return this.filename; + }; + + // Sets the status and fires a statusChanged event + this.setStatus = function(value) { + this.status = value; + this.fireEvent(new mxEventObject('statusChanged')); + }; + + // Returns the current status + this.getStatus = function() { + return this.status; + }; + + // Contains the current modified state of the diagram. This is false for + // new diagrams and after the diagram was saved. + this.modified = false; + + // Updates modified state if graph changes + this.graphChangeListener = function() { + this.modified = true; + }; + this.graph.getModel().addListener(mxEvent.CHANGE, mxUtils.bind(this, function() { + this.graphChangeListener.apply(this, arguments); + })); + + // Installs dialog if browser window is closed without saving + // This must be disabled during save and image export + window.onbeforeunload = mxUtils.bind(this, function() { + if (this.modified) { + return mxResources.get('allChangesLost'); + } + }); + + // Sets persistent graph state defaults + this.graph.resetViewOnRootChange = false; + this.graph.scrollbars = true; + this.graph.background = null; +}; + +// Editor inherits from mxEventSource +mxUtils.extend(Editor, mxEventSource); + +/** + * Specifies the image URL to be used for the grid. + */ +Editor.prototype.gridImage = IMAGE_PATH + '/grid.gif'; + +/** + * Specifies the image URL to be used for the transparent background. + */ +Editor.prototype.transparentImage = IMAGE_PATH + '/transparent.gif'; + +/** + * Sets the XML node for the current diagram. + */ +Editor.prototype.setGraphXml = function(node) { + var dec = new mxCodec(node.ownerDocument); + + if (node.nodeName == 'mxGraphModel') { + this.graph.view.scale = 1; + this.graph.gridEnabled = node.getAttribute('grid') != '0'; + this.graph.graphHandler.guidesEnabled = node.getAttribute('guides') != '0'; + this.graph.setTooltips(node.getAttribute('tooltips') != '0'); + this.graph.setConnectable(node.getAttribute('connect') != '0'); + this.graph.foldingEnabled = node.getAttribute('fold') != '0'; + this.graph.scrollbars = node.getAttribute('scrollbars') != '0'; + + if (!this.graph.scrollbars) { + this.graph.container.scrollLeft = 0; + this.graph.container.scrollTop = 0; + this.graph.view.translate.x = Number(node.getAttribute('dx') || 0); + this.graph.view.translate.y = Number(node.getAttribute('dy') || 0); + } + + this.graph.pageVisible = node.getAttribute('page') == '1'; + this.graph.pageBreaksVisible = this.graph.pageVisible; + this.graph.preferPageSize = this.graph.pageBreaksVisible; + + // Loads the persistent state settings + var ps = node.getAttribute('pageScale'); + + if (ps != null) { + this.graph.pageScale = ps; + } else { + this.graph.pageScale = 1.5; + } + + var pw = node.getAttribute('pageWidth'); + var ph = node.getAttribute('pageHeight'); + + if (pw != null && ph != null) { + this.graph.pageFormat = new mxRectangle(0, 0, parseFloat(pw), parseFloat(ph)); + this.outline.outline.pageFormat = this.graph.pageFormat; + } + + // Loads the persistent state settings + var bg = node.getAttribute('background'); + + if (bg != null && bg.length > 0) { + this.graph.background = bg; + } + + dec.decode(node, this.graph.getModel()); + this.updateGraphComponents(); + } +}; + +/** + * Returns the XML node that represents the current diagram. + */ +Editor.prototype.getGraphXml = function() { + var enc = new mxCodec(mxUtils.createXmlDocument()); + var node = enc.encode(this.graph.getModel()); + + if (this.graph.view.translate.x != 0 || this.graph.view.translate.y != 0) { + node.setAttribute('dx', Math.round(this.graph.view.translate.x * 100) / 100); + node.setAttribute('dy', Math.round(this.graph.view.translate.y * 100) / 100); + } + + node.setAttribute('grid', (this.graph.isGridEnabled()) ? '1' : '0'); + node.setAttribute('guides', (this.graph.graphHandler.guidesEnabled) ? '1' : '0'); + node.setAttribute('guides', (this.graph.graphHandler.guidesEnabled) ? '1' : '0'); + node.setAttribute('tooltips', (this.graph.tooltipHandler.isEnabled()) ? '1' : '0'); + node.setAttribute('connect', (this.graph.connectionHandler.isEnabled()) ? '1' : '0'); + node.setAttribute('fold', (this.graph.foldingEnabled) ? '1' : '0'); + node.setAttribute('page', (this.graph.pageVisible) ? '1' : '0'); + node.setAttribute('pageScale', this.graph.pageScale); + node.setAttribute('pageWidth', this.graph.pageFormat.width); + node.setAttribute('pageHeight', this.graph.pageFormat.height); + + if (!this.graph.scrollbars) { + node.setAttribute('scrollbars', '0'); + } + + if (this.graph.background != null) { + node.setAttribute('background', this.graph.background); + } + + return node; +}; + +/** + * Keeps the graph container in sync with the persistent graph state + */ +Editor.prototype.updateGraphComponents = function() { + var graph = this.graph; + var outline = this.outline; + + if (graph.container != null && outline.outline.container != null) { + if (graph.background != null) { + if (graph.background == 'none') { + graph.container.style.backgroundColor = 'transparent'; + } else { + if (graph.view.backgroundPageShape != null) { + graph.view.backgroundPageShape.fill = graph.background; + graph.view.backgroundPageShape.reconfigure(); + } + + graph.container.style.backgroundColor = graph.background; + } + } else { + graph.container.style.backgroundColor = ''; + } + + if (graph.pageVisible) { + graph.container.style.backgroundColor = '#ebebeb'; + graph.container.style.borderStyle = 'solid'; + graph.container.style.borderColor = '#e5e5e5'; + graph.container.style.borderTopWidth = '1px'; + graph.container.style.borderLeftWidth = '1px'; + graph.container.style.borderRightWidth = '0px'; + graph.container.style.borderBottomWidth = '0px'; + } else { + graph.container.style.border = ''; + } + + outline.outline.container.style.backgroundColor = graph.container.style.backgroundColor; + + if (outline.outline.pageVisible != graph.pageVisible || + outline.outline.pageScale != graph.pageScale) { + outline.outline.pageScale = graph.pageScale; + outline.outline.pageVisible = graph.pageVisible; + outline.outline.view.validate(); + } + + if (graph.scrollbars && graph.container.style.overflow == 'hidden' && !touchStyle) { + graph.container.style.overflow = 'auto'; + } else if (!graph.scrollbars || touchStyle) { + graph.container.style.overflow = 'hidden'; + } + + // Transparent.gif is a workaround for focus repaint problems in IE + var noBackground = (mxClient.IS_IE && document.documentMode >= 9) ? 'url(' + this.transparentImage + ')' : 'none'; + graph.container.style.backgroundImage = (!graph.pageVisible && graph.isGridEnabled()) ? 'url(' + this.gridImage + ')' : noBackground; + + if (graph.view.backgroundPageShape != null) { + graph.view.backgroundPageShape.node.style.backgroundImage = (this.graph.isGridEnabled()) ? 'url(' + this.gridImage + ')' : 'none'; + } + } +}; + +/** + * Initializes the environment. + */ +Editor.prototype.init = function() { + // Adds stylesheet for IE6 + if (mxClient.IS_IE6) { + mxClient.link('stylesheet', CSS_PATH + '/grapheditor-ie6.css'); + } + + // Adds required resources (disables loading of fallback properties, this can only + // be used if we know that all keys are defined in the language specific file) + mxResources.loadDefaultBundle = false; + mxResources.add(RESOURCE_BASE); + + // Makes the connection hotspot smaller + mxConstants.DEFAULT_HOTSPOT = 0.3; + + var mxConnectionHandlerCreateMarker = mxConnectionHandler.prototype.createMarker; + mxConnectionHandler.prototype.createMarker = function() { + var marker = mxConnectionHandlerCreateMarker.apply(this, arguments); + + // Overrides to ignore hotspot only for target terminal + marker.intersects = mxUtils.bind(this, function(state, evt) { + if (this.isConnecting()) { + return true; + } + + return mxCellMarker.prototype.intersects.apply(marker, arguments); + }); + + return marker; + }; + + // Makes the shadow brighter + mxConstants.SHADOWCOLOR = '#d0d0d0'; + + // Changes some default colors + 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; + + // Increases default rubberband opacity (default is 20) + mxRubberband.prototype.defaultOpacity = 30; + + // Changes border color of background page shape + mxGraphView.prototype.createBackgroundPageShape = function(bounds) { + return new mxRectangleShape(bounds, this.graph.background || 'white', '#cacaca'); + }; + + // Fits the number of background pages to the graph + mxGraphView.prototype.getBackgroundPageBounds = function() { + var gb = this.getGraphBounds(); + + // Computes unscaled, untranslated graph bounds + var x = (gb.width > 0) ? gb.x / this.scale - this.translate.x : 0; + var y = (gb.height > 0) ? gb.y / this.scale - this.translate.y : 0; + var w = gb.width / this.scale; + var h = gb.height / this.scale; + + var fmt = this.graph.pageFormat; + var ps = this.graph.pageScale; + + var pw = fmt.width * ps; + var ph = fmt.height * ps; + + var x0 = Math.floor(Math.min(0, x) / pw); + var y0 = Math.floor(Math.min(0, y) / ph); + var xe = Math.ceil(Math.max(1, x + w) / pw); + var ye = Math.ceil(Math.max(1, y + h) / ph); + + var rows = xe - x0; + var cols = ye - y0; + + var bounds = new mxRectangle(this.scale * (this.translate.x + x0 * pw), this.scale * + (this.translate.y + y0 * ph), this.scale * rows * pw, this.scale * cols * ph); + + return bounds; + }; + + // Add panning for background page in VML + var graphPanGraph = mxGraph.prototype.panGraph; + mxGraph.prototype.panGraph = function(dx, dy) { + graphPanGraph.apply(this, arguments); + + if ((this.dialect != mxConstants.DIALECT_SVG && this.view.backgroundPageShape != null) && + (!this.useScrollbarsForPanning || !mxUtils.hasScrollbars(this.container))) { + this.view.backgroundPageShape.node.style.marginLeft = dx + 'px'; + this.view.backgroundPageShape.node.style.marginTop = dy + 'px'; + } + }; + + var editor = this; + + // Uses HTML for background pages (to support grid background image) + mxGraphView.prototype.validateBackground = function() { + var bg = this.graph.getBackgroundImage(); + + if (bg != null) { + if (this.backgroundImage == null || this.backgroundImage.image != bg.src) { + if (this.backgroundImage != null) { + this.backgroundImage.destroy(); + } + + var bounds = new mxRectangle(0, 0, 1, 1); + + this.backgroundImage = new mxImageShape(bounds, bg.src); + this.backgroundImage.dialect = this.graph.dialect; + this.backgroundImage.init(this.backgroundPane); + this.backgroundImage.redraw(); + } + + this.redrawBackgroundImage(this.backgroundImage, bg); + } else if (this.backgroundImage != null) { + this.backgroundImage.destroy(); + this.backgroundImage = null; + } + + if (this.graph.pageVisible) { + var bounds = this.getBackgroundPageBounds(); + + if (this.backgroundPageShape == null) { + this.backgroundPageShape = this.createBackgroundPageShape(bounds); + this.backgroundPageShape.scale = 1; + this.backgroundPageShape.isShadow = true; + this.backgroundPageShape.dialect = mxConstants.DIALECT_STRICTHTML; + this.backgroundPageShape.init(this.graph.container); + // Required for the browser to render the background page in correct order + 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'; + + // Adds listener for double click handling on background + mxEvent.addListener(this.backgroundPageShape.node, 'dblclick', + mxUtils.bind(this, function(evt) { + this.graph.dblClick(evt); + }) + ); + + // Adds basic listeners for graph event dispatching outside of the + // container and finishing the handling of a single gesture + mxEvent.addGestureListeners(this.backgroundPageShape.node, + mxUtils.bind(this, function(evt) { + this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(evt)); + }), + mxUtils.bind(this, function(evt) { + // Hides the tooltip if mouse is outside container + if (this.graph.tooltipHandler != null && + this.graph.tooltipHandler.isHideOnHover()) { + this.graph.tooltipHandler.hide(); + } + + if (this.graph.isMouseDown && + !mxEvent.isConsumed(evt)) { + this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE, + new mxMouseEvent(evt)); + } + }), + mxUtils.bind(this, function(evt) { + this.graph.fireMouseEvent(mxEvent.MOUSE_UP, + new mxMouseEvent(evt)); + })); + } else { + this.backgroundPageShape.scale = 1; + this.backgroundPageShape.bounds = bounds; + this.backgroundPageShape.redraw(); + } + + this.backgroundPageShape.node.style.backgroundImage = (this.graph.isGridEnabled()) ? + 'url(' + editor.gridImage + ')' : 'none'; + } else if (this.backgroundPageShape != null) { + this.backgroundPageShape.destroy(); + this.backgroundPageShape = null; + } + }; + + // Draws page breaks only within the page + mxGraph.prototype.updatePageBreaks = function(visible, width, height) { + var scale = this.view.scale; + var tr = this.view.translate; + var fmt = this.pageFormat; + var ps = scale * this.pageScale; + + var bounds2 = this.view.getBackgroundPageBounds(); + + width = bounds2.width; + height = bounds2.height; + var bounds = new mxRectangle(scale * tr.x, scale * tr.y, + fmt.width * ps, fmt.height * ps); + + // Does not show page breaks if the scale is too small + visible = visible && Math.min(bounds.width, bounds.height) > this.minPageBreakDist; + + var horizontalCount = (visible) ? Math.ceil(width / bounds.width) - 1 : 0; + var verticalCount = (visible) ? Math.ceil(height / bounds.height) - 1 : 0; + var right = bounds2.x + width; + var bottom = bounds2.y + height; + + if (this.horizontalPageBreaks == null && horizontalCount > 0) { + this.horizontalPageBreaks = []; + } + + if (this.horizontalPageBreaks != null) { + for (var i = 0; i <= horizontalCount; i++) { + var pts = [new mxPoint(bounds2.x + (i + 1) * bounds.width, bounds2.y), + new mxPoint(bounds2.x + (i + 1) * bounds.width, bottom) + ]; + + if (this.horizontalPageBreaks[i] != null) { + this.horizontalPageBreaks[i].scale = 1; + this.horizontalPageBreaks[i].points = pts; + this.horizontalPageBreaks[i].redraw(); + } else { + var pageBreak = new mxPolyline(pts, this.pageBreakColor, this.scale); + pageBreak.dialect = this.dialect; + pageBreak.isDashed = this.pageBreakDashed; + pageBreak.addPipe = false; + pageBreak.scale = scale; + pageBreak.init(this.view.backgroundPane); + pageBreak.redraw(); + + this.horizontalPageBreaks[i] = pageBreak; + } + } + + for (var i = horizontalCount; i < this.horizontalPageBreaks.length; i++) { + this.horizontalPageBreaks[i].destroy(); + } + + this.horizontalPageBreaks.splice(horizontalCount, this.horizontalPageBreaks.length - horizontalCount); + } + + if (this.verticalPageBreaks == null && verticalCount > 0) { + this.verticalPageBreaks = []; + } + + if (this.verticalPageBreaks != null) { + for (var i = 0; i <= verticalCount; i++) { + var pts = [new mxPoint(bounds2.x, bounds2.y + (i + 1) * bounds.height), + new mxPoint(right, bounds2.y + (i + 1) * bounds.height) + ]; + + if (this.verticalPageBreaks[i] != null) { + this.verticalPageBreaks[i].scale = 1; //scale; + this.verticalPageBreaks[i].points = pts; + this.verticalPageBreaks[i].redraw(); + } else { + var pageBreak = new mxPolyline(pts, this.pageBreakColor, scale); + pageBreak.dialect = this.dialect; + pageBreak.isDashed = this.pageBreakDashed; + pageBreak.addPipe = false; + pageBreak.scale = scale; + pageBreak.init(this.view.backgroundPane); + pageBreak.redraw(); + + this.verticalPageBreaks[i] = pageBreak; + } + } + + for (var i = verticalCount; i < this.verticalPageBreaks.length; i++) { + this.verticalPageBreaks[i].destroy(); + } + + this.verticalPageBreaks.splice(verticalCount, this.verticalPageBreaks.length - verticalCount); + } + }; + + // Enables snapping to off-grid terminals for edge waypoints + mxEdgeHandler.prototype.snapToTerminals = true; + + // Enables guides + mxGraphHandler.prototype.guidesEnabled = true; + + // Disables removing relative children from parents + var mxGraphHandlerShouldRemoveCellsFromParent = mxGraphHandler.prototype.shouldRemoveCellsFromParent; + mxGraphHandler.prototype.shouldRemoveCellsFromParent = function(parent, cells, evt) { + for (var i = 0; i < cells.length; i++) { + if (this.graph.getModel().isVertex(cells[i])) { + var geo = this.graph.getCellGeometry(cells[i]); + + if (geo != null && geo.relative) { + return false; + } + } + } + + return mxGraphHandlerShouldRemoveCellsFromParent.apply(this, arguments); + }; + + // Alt-move disables guides + mxGuide.prototype.isEnabledForEvent = function(evt) { + return !mxEvent.isAltDown(evt); + }; + + // Consumes click events for disabled menu items + mxPopupMenuAddItem = mxPopupMenu.prototype.addItem; + mxPopupMenu.prototype.addItem = function(title, image, funct, parent, iconCls, enabled) { + var result = mxPopupMenuAddItem.apply(this, arguments); + + if (enabled != null && !enabled) { + mxEvent.addListener(result, 'mousedown', function(evt) { + mxEvent.consume(evt); + }); + } + + return result; + }; + + // Selects descendants before children selection mode + var graphHandlerGetInitialCellForEvent = mxGraphHandler.prototype.getInitialCellForEvent; + mxGraphHandler.prototype.getInitialCellForEvent = function(me) { + var model = this.graph.getModel(); + var psel = model.getParent(this.graph.getSelectionCell()); + var cell = graphHandlerGetInitialCellForEvent.apply(this, arguments); + var parent = model.getParent(cell); + + if (psel == null || (psel != cell && psel != parent)) { + while (!this.graph.isCellSelected(cell) && !this.graph.isCellSelected(parent) && + model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + cell = parent; + parent = this.graph.getModel().getParent(cell); + } + } + + return cell; + }; + + // Selection is delayed to mouseup if child selected + var graphHandlerIsDelayedSelection = mxGraphHandler.prototype.isDelayedSelection; + mxGraphHandler.prototype.isDelayedSelection = function(cell) { + var result = graphHandlerIsDelayedSelection.apply(this, arguments); + var model = this.graph.getModel(); + var psel = model.getParent(this.graph.getSelectionCell()); + var parent = model.getParent(cell); + + if (psel == null || (psel != cell && psel != parent)) { + if (!this.graph.isCellSelected(cell) && model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + result = true; + } + } + + return result; + }; + + // Delayed selection of parent group + mxGraphHandler.prototype.selectDelayed = function(me) { + var cell = me.getCell(); + + if (cell == null) { + cell = this.cell; + } + + var model = this.graph.getModel(); + var parent = model.getParent(cell); + + while (this.graph.isCellSelected(cell) && model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + cell = parent; + parent = model.getParent(cell); + } + + this.graph.selectCellForEvent(cell, me.getEvent()); + }; + + // Returns last selected ancestor + mxPanningHandler.prototype.getCellForPopupEvent = function(me) { + var cell = me.getCell(); + var model = this.graph.getModel(); + var parent = model.getParent(cell); + + while (model.isVertex(parent) && !this.graph.isValidRoot(parent)) { + if (this.graph.isCellSelected(parent)) { + cell = parent; + } + + parent = model.getParent(parent); + } + + return cell; + }; +}; + +/** + * Creates and returns a new undo manager. + */ +Editor.prototype.createUndoManager = function() { + var graph = this.graph; + var undoMgr = new mxUndoManager(); + + // Installs the command history + var listener = function(sender, evt) { + undoMgr.undoableEditHappened(evt.getProperty('edit')); + }; + + graph.getModel().addListener(mxEvent.UNDO, listener); + graph.getView().addListener(mxEvent.UNDO, listener); + + // Keeps the selection in sync with the history + var undoHandler = function(sender, evt) { + var cand = graph.getSelectionCellsForChanges(evt.getProperty('edit').changes); + var cells = []; + + for (var i = 1; i < cand.length; i++) { + if (graph.view.getState(cand[i]) != null) { + cells.push(cand[i]); + } + } + + graph.setSelectionCells(cells); + }; + + undoMgr.addListener(mxEvent.UNDO, undoHandler); + undoMgr.addListener(mxEvent.REDO, undoHandler); + + return undoMgr; +}; + +/** + * Adds basic stencil set (no namespace). + */ +Editor.prototype.initStencilRegistry = function() { + // Loads default stencils + mxStencilRegistry.loadStencilSet(STENCIL_PATH + '/general.xml'); +}; + +/** + * Overrides stencil registry for dynamic loading of stencils. + */ +(function() { + /** + * Maps from library names to an array of Javascript filenames, + * which are synchronously loaded. Currently only stencil files + * (.xml) and JS files (.js) are supported. + * IMPORTANT: For embedded diagrams to work entries must also + * be added in EmbedServlet.java. + */ + mxStencilRegistry.libraries = {}; + + /** + * Stores all package names that have been dynamically loaded. + * Each package is only loaded once. + */ + mxStencilRegistry.packages = []; + + // Extends the default stencil registry to add dynamic loading + mxStencilRegistry.getStencil = function(name) { + var result = mxStencilRegistry.stencils[name]; + + if (result == null) { + var basename = mxStencilRegistry.getBasenameForStencil(name); + + // Loads stencil files and tries again + if (basename != null) { + var libs = mxStencilRegistry.libraries[basename]; + + if (libs != null) { + if (mxStencilRegistry.packages[basename] == null) { + mxStencilRegistry.packages[basename] = 1; + + for (var i = 0; i < libs.length; i++) { + var fname = libs[i]; + + if (fname.toLowerCase().substring(fname.length - 4, fname.length) == '.xml') { + mxStencilRegistry.loadStencilSet(fname, null); + } else if (fname.toLowerCase().substring(fname.length - 3, fname.length) == '.js') { + var req = mxUtils.load(fname); + + if (req != null) { + eval.call(window, req.getText()); + } + } else { + // FIXME: This does not yet work as the loading is triggered after + // the shape was used in the graph, at which point the keys have + // typically been translated in the calling method. + //mxResources.add(fname); + } + } + } + } else { + mxStencilRegistry.loadStencilSet(STENCIL_PATH + '/' + basename + '.xml', null); + } + + result = mxStencilRegistry.stencils[name]; + } + } + + return result; + }; + + // Returns the basename for the given stencil or null if no file must be + // loaded to render the given stencil. + mxStencilRegistry.getBasenameForStencil = function(name) { + var parts = name.split('.'); + var tmp = null; + + if (parts.length > 0 && parts[0] == 'mxgraph') { + tmp = parts[1]; + + for (var i = 2; i < parts.length - 1; i++) { + tmp += '/' + parts[i]; + } + } + + return tmp; + }; + + // Loads the given stencil set + mxStencilRegistry.loadStencilSet = function(stencilFile, postStencilLoad, force) { + force = (force != null) ? force : false; + + // Uses additional cache for detecting previous load attempts + var xmlDoc = mxStencilRegistry.packages[stencilFile]; + + if (force || xmlDoc == null) { + var install = false; + + if (xmlDoc == null) { + var req = mxUtils.load(stencilFile); + xmlDoc = req.getXml(); + mxStencilRegistry.packages[stencilFile] = xmlDoc; + install = true; + } + + mxStencilRegistry.parseStencilSet(xmlDoc, postStencilLoad, install); + } + }; + + // Parses the given stencil set + mxStencilRegistry.parseStencilSet = function(xmlDocument, postStencilLoad, install) { + install = (install != null) ? install : true; + var root = xmlDocument.documentElement; + var shape = root.firstChild; + var packageName = ''; + var name = root.getAttribute('name'); + + if (name != null) { + packageName = name + '.'; + } + + while (shape != null) { + if (shape.nodeType == mxConstants.NODETYPE_ELEMENT) { + name = shape.getAttribute('name'); + + if (name != null) { + packageName = packageName.toLowerCase(); + var stencilName = name.replace(/ /g, "_"); + + if (install) { + mxStencilRegistry.addStencil(packageName + stencilName.toLowerCase(), new mxStencil(shape)); + } + + if (postStencilLoad != null) { + var w = shape.getAttribute('w'); + var h = shape.getAttribute('h'); + + w = (w == null) ? 80 : parseInt(w, 10); + h = (h == null) ? 80 : parseInt(h, 10); + + postStencilLoad(packageName, stencilName, name, w, h); + } + } + } + + shape = shape.nextSibling; + } + }; +})(); + +/** + * Class for asynchronously opening a new window and loading a file at the same + * time. This acts as a bridge between the open dialog and the new editor. + */ +OpenFile = function(done) { + this.producer = null; + this.consumer = null; + this.done = done; +}; + +/** + * Registers the editor from the new window. + */ +OpenFile.prototype.setConsumer = function(value) { + this.consumer = value; + this.execute(); +}; + +/** + * Sets the data from the loaded file. + */ +OpenFile.prototype.setData = function(value, filename) { + this.data = value; + this.filename = filename; + this.execute(); +}; + +/** + * Displays an error message. + */ +OpenFile.prototype.error = function(msg) { + this.cancel(); + mxUtils.alert(msg); +}; + +/** + * Consumes the data. + */ +OpenFile.prototype.execute = function() { + if (this.consumer != null && this.data != null) { + this.consumer(this.data, this.filename); + this.cancel(); + } +}; + +/** + * Cancels the operation. + */ +OpenFile.prototype.cancel = function() { + if (this.done != null) { + this.done(); + } +}; diff --git a/public/assets/plugins/square/js/EditorUi.js b/public/assets/plugins/square/js/EditorUi.js index f68281a..4104913 100644 --- a/public/assets/plugins/square/js/EditorUi.js +++ b/public/assets/plugins/square/js/EditorUi.js @@ -1 +1,1484 @@ -var _0x37a3=["\x65\x64\x69\x74\x6F\x72","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x45\x64\x69\x74\x6F\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x67\x72\x61\x70\x68","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x73\x74\x79\x6C\x65","\x68\x69\x64\x64\x65\x6E","\x73\x72\x63","\x73\x75\x62\x6D\x65\x6E\x75\x49\x6D\x61\x67\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x61\x63\x74\x69\x6F\x6E\x73","\x6D\x65\x6E\x75\x73","\x63\x72\x65\x61\x74\x65\x44\x69\x76\x73","\x72\x65\x66\x72\x65\x73\x68","\x63\x72\x65\x61\x74\x65\x55\x69","\x65\x76\x65\x6E\x74","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x41\x6C\x6C\x6F\x77\x65\x64","\x69\x73\x45\x64\x69\x74\x69\x6E\x67","\x62\x69\x6E\x64","\x62\x6F\x64\x79","\x6F\x6E\x73\x65\x6C\x65\x63\x74\x73\x74\x61\x72\x74","\x6D\x65\x6E\x75\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6F\x6E\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x74\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x64\x69\x61\x67\x72\x61\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x69\x64\x65\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x66\x6F\x6F\x74\x65\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x49\x53\x5F\x49\x45","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x4D\x6F\x64\x65","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x6F\x6E\x63\x6F\x6E\x74\x65\x78\x74\x6D\x65\x6E\x75","\x69\x6E\x69\x74","\x74\x61\x62\x69\x6E\x64\x65\x78","\x30","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x75\x72\x73\x6F\x72","\x64\x65\x66\x61\x75\x6C\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x67\x72\x69\x64\x49\x6D\x61\x67\x65","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x2D\x31\x70\x78\x20\x2D\x31\x70\x78","\x66\x6F\x63\x75\x73","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x4D\x4F\x55\x53\x45\x5F\x44\x4F\x57\x4E","\x61\x70\x70\x6C\x79","\x6D\x75\x6C\x74\x69\x70\x6C\x69\x63\x69\x74\x69\x65\x73","\x73\x74\x61\x72\x74","\x66\x69\x6E\x61\x6C\x6C\x79","\x65\x6E\x64","\x6E","\x63\x72\x65\x61\x74\x65\x4D\x75\x6C\x74\x69\x70\x6C\x69\x63\x69\x74\x69\x65\x73","\x61\x6E\x73\x77\x65\x72","\x68\x61\x6E\x67\x75\x70","\x64\x69\x61\x6C","\x65\x78\x74\x5F\x64\x69\x61\x6C","\x71\x75\x65\x75\x65","\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x73\x65\x74","\x6D\x61\x74\x68","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x70\x6C\x61\x79\x62\x61\x63\x6B","\x6D\x65\x6E\x75","\x73\x61\x79\x64\x69\x67\x69\x74\x73","\x73\x61\x79\x6E\x75\x6D\x62\x65\x72","\x73\x61\x79\x70\x68\x6F\x6E\x65\x74\x69\x63","\x74\x74\x73","\x69\x73\x70\x65\x65\x63\x68\x74\x74\x73","\x67\x65\x74\x64\x69\x67\x69\x74\x73","\x72\x65\x63\x6F\x72\x64","\x64\x61\x74\x61\x62\x61\x73\x65","\x69\x73\x70\x65\x65\x63\x68\x61\x73\x72","\x67\x6F\x74\x6F\x63","\x67\x6F\x74\x6F\x69\x66","\x67\x6F\x74\x6F\x69\x66\x74\x69\x6D\x65","\x67\x6F\x74\x6F\x69\x66\x6D\x75\x6C\x74\x69\x74\x69\x6D\x65","\x76\x73\x77\x69\x74\x63\x68","\x71\x75\x65\x75\x65\x6C\x6F\x67","\x67\x6F\x61\x6C","\x6E\x6F\x6F\x70","\x73\x79\x73\x74\x65\x6D","\x61\x67\x69","\x73\x75\x62\x70\x72\x6F\x6A\x65\x63\x74","\x63\x75\x73\x74\x6F\x6D\x5F\x61\x70\x70","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x63\x65\x6C\x6C","\x66\x69\x72\x65\x45\x76\x65\x6E\x74","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x74\x61\x67\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x73\x6F\x75\x72\x63\x65","\x69\x6E\x64\x65\x78\x4F\x66","\x73\x74\x61\x72\x74\x45\x64\x69\x74\x69\x6E\x67\x41\x74\x43\x65\x6C\x6C","\x69\x73\x56\x65\x72\x74\x65\x78","\x6C\x6F\x67","\x73\x68\x6F\x77\x44\x69\x61\x6C\x6F\x67","\x63\x6F\x6E\x73\x75\x6D\x65","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x66\x61\x63\x74\x6F\x72\x79\x4D\x65\x74\x68\x6F\x64","\x63\x72\x65\x61\x74\x65\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x6F\x75\x74\x6C\x69\x6E\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6F\x75\x74\x6C\x69\x6E\x65","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x67\x65\x73\x74\x75\x72\x65\x63\x68\x61\x6E\x67\x65","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x73\x63\x61\x6C\x65\x28","\x73\x63\x61\x6C\x65","\x67\x65\x74\x44\x72\x61\x77\x50\x61\x6E\x65","\x76\x69\x65\x77","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x67\x65\x73\x74\x75\x72\x65\x65\x6E\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x7A\x6F\x6F\x6D\x54\x6F\x43\x65\x6E\x74\x65\x72","\x7A\x6F\x6F\x6D","\x76\x69\x73\x69\x62\x6C\x65","\x63\x72\x65\x61\x74\x65\x4B\x65\x79\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x4B\x65\x79\x48\x61\x6E\x64\x6C\x65\x72","\x72\x65\x73\x69\x7A\x65","\x73\x69\x7A\x65\x44\x69\x64\x43\x68\x61\x6E\x67\x65","\x75\x70\x64\x61\x74\x65","\x6F\x70\x65\x6E","\x73\x70\x6C\x69\x74\x53\x69\x7A\x65","\x6D\x65\x6E\x75\x62\x61\x72\x48\x65\x69\x67\x68\x74","\x74\x6F\x6F\x6C\x62\x61\x72\x48\x65\x69\x67\x68\x74","\x66\x6F\x6F\x74\x65\x72\x48\x65\x69\x67\x68\x74","\x68\x73\x70\x6C\x69\x74\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x76\x73\x70\x6C\x69\x74\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x64\x64\x55\x6E\x64\x6F\x4C\x69\x73\x74\x65\x6E\x65\x72","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x73\x74\x65","\x67\x65\x74","\x69\x73\x45\x6D\x70\x74\x79","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x75\x74","\x63\x6F\x70\x79","\x6F\x70\x65\x6E\x65\x72","\x6F\x70\x65\x6E\x46\x69\x6C\x65","\x70\x61\x72\x73\x65\x58\x6D\x6C","\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x73\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x6D\x6F\x64\x69\x66\x69\x65\x64","\x63\x6C\x65\x61\x72","\x75\x6E\x64\x6F\x4D\x61\x6E\x61\x67\x65\x72","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x69\x6E\x76\x61\x6C\x69\x64\x4F\x72\x4D\x69\x73\x73\x69\x6E\x67\x46\x69\x6C\x65","\x3A\x20","\x6D\x65\x73\x73\x61\x67\x65","\x61\x6C\x65\x72\x74","\x73\x65\x74\x43\x6F\x6E\x73\x75\x6D\x65\x72","\x6F\x70\x65\x6E\x53\x74\x72\x69\x6E\x67","\x64\x61\x74\x61","\x6E\x65\x77","\x67\x65\x74\x47\x72\x61\x70\x68\x58\x6D\x6C","\x67\x65\x74\x50\x72\x65\x74\x74\x79\x58\x6D\x6C","\x67\x65\x74\x49\x74\x65\x6D","\x72\x65\x70\x6C\x61\x63\x65","\x63\x6F\x6E\x66\x69\x72\x6D","\x73\x65\x74\x49\x74\x65\x6D","\x73\x61\x76\x65\x64","\x20","\x73\x65\x74\x53\x74\x61\x74\x75\x73","\x6C\x65\x6E\x67\x74\x68","\x50\x4F\x53\x54","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x78\x2D\x77\x77\x77\x2D\x66\x6F\x72\x6D\x2D\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x73\x65\x74\x52\x65\x71\x75\x65\x73\x74\x48\x65\x61\x64\x65\x72","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x65\x61\x72\x65\x72\x20","\x74\x6F\x6B\x65\x6E","\x6F\x6E\x6C\x6F\x61\x64","\x72\x65\x61\x64\x79\x53\x74\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x50\x72\x6F\x6A\x65\x63\x74\x20","\x6E\x61\x6D\x65","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x70\x61\x72\x73\x65","\x20\x69\x73\x20\x6F\x70\x65\x6E\x69\x6E\x67\x20\x69\x6E\x20\x6E\x65\x77\x20\x77\x69\x6E\x64\x6F\x77\x21","\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x2F","\x69\x64","\x5F\x62\x6C\x61\x6E\x6B","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x65\x72\x72\x6F\x72\x73","\x6F\x6E\x65\x72\x72\x6F\x72","\x73\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x3D\x70\x72\x6F\x6A\x65\x63\x74\x5F\x6E\x65\x77\x26\x6E\x61\x6D\x65\x3D","\x73\x65\x6E\x64","\x64\x72\x61\x77\x69\x6E\x67\x54\x6F\x6F\x4C\x61\x72\x67\x65","\x70\x6F\x70\x75\x70","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74","\x73\x61\x76\x65","\x50\x55\x54","\x55\x70\x64\x61\x74\x65\x64\x20\x61\x74\x20","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x20\x28","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x70\x72\x65\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E\x3D","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x66\x69\x6C\x65","\x73\x61\x76\x65\x41\x73","\x45\x72\x72\x6F\x72\x20\x63\x6C\x6F\x6E\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x3D\x70\x72\x6F\x6A\x65\x63\x74\x5F\x63\x6C\x6F\x6E\x65\x64\x26\x6E\x61\x6D\x65\x3D","\x26\x70\x72\x65\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E\x3D","\x26\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E\x3D","\x76\x61\x6C\x69\x64\x61\x74\x65","\x67\x65\x74\x52\x6F\x6F\x74","\x6D\x6F\x64\x65\x6C","\x67\x65\x74\x43\x68\x69\x6C\x64\x43\x6F\x75\x6E\x74","\x67\x65\x74\x43\x68\x69\x6C\x64\x41\x74","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x3C\x62\x72\x3E","\x73\x65\x74\x43\x65\x6C\x6C\x57\x61\x72\x6E\x69\x6E\x67","","\x76\x61\x6C\x69\x64\x61\x74\x65\x42\x6C\x6F\x63\x6B","\x4F\x6E\x6C\x79\x20\x6F\x6E\x65\x20\x53\x74\x61\x72\x74\x20\x62\x6C\x6F\x63\x6B\x20\x69\x73\x20\x61\x6C\x6C\x6F\x77\x65\x64","\x0A","\x4F\x6E\x6C\x79\x20\x6F\x6E\x65\x20\x46\x69\x6E\x61\x6C\x6C\x79\x20\x62\x6C\x6F\x63\x6B\x20\x69\x73\x20\x61\x6C\x6C\x6F\x77\x65\x64","\x66\x69\x6C\x65\x5F\x69\x64","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6E\x6F\x41\x75\x64\x69\x6F\x53\x65\x6C\x65\x63\x74\x65\x64","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x69\x64","\x6E\x6F\x56\x61\x72\x69\x61\x62\x6C\x65\x53\x65\x6C\x65\x63\x74\x65\x64","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6F\x64\x62\x63\x5F\x69\x64","\x6E\x6F\x44\x61\x74\x61\x62\x61\x73\x65\x53\x65\x6C\x65\x63\x74\x65\x64","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x6E\x6F\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x53\x65\x6C\x65\x63\x74\x65\x64","\x63\x6F\x6D\x6D\x61\x6E\x64","\x6E\x6F\x43\x6F\x6D\x6D\x61\x6E\x64\x53\x65\x6C\x65\x63\x74\x65\x64","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x6E\x6F\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x53\x65\x6C\x65\x63\x74\x65\x64","\x64\x69\x67\x69\x74\x73","\x6E\x6F\x44\x69\x67\x69\x74\x73\x53\x65\x6C\x65\x63\x74\x65\x64","\x6E\x75\x6D\x62\x65\x72","\x6E\x6F\x4E\x75\x6D\x62\x65\x72\x53\x65\x6C\x65\x63\x74\x65\x64","\x74\x65\x78\x74","\x6E\x6F\x54\x65\x78\x74\x53\x65\x6C\x65\x63\x74\x65\x64","\x6E\x6F\x46\x69\x6C\x65\x53\x65\x6C\x65\x63\x74\x65\x64","\x67\x6F\x61\x6C\x6E\x61\x6D\x65","\x6E\x6F\x47\x6F\x61\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x70\x68\x6F\x6E\x65","\x6E\x6F\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x53\x65\x6C\x65\x63\x74\x65\x64","\x73\x69\x70\x5F\x69\x64","\x71\x75\x65\x75\x65\x5F\x69\x64","\x2D\x31","\x6E\x6F\x51\x75\x65\x75\x65\x53\x65\x6C\x65\x63\x74\x65\x64","\x6C\x69\x73\x74\x5F\x69\x64","\x6E\x6F\x4C\x69\x73\x74\x53\x65\x6C\x65\x63\x74\x65\x64","\x69\x6E\x74\x65\x72\x76\x61\x6C\x5F\x69\x64","\x6E\x6F\x49\x6E\x74\x65\x72\x76\x61\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x6D\x61\x69\x6C\x62\x6F\x78","\x6E\x6F\x42\x6F\x78\x4E\x75\x6D\x62\x65\x72\x53\x65\x6C\x65\x63\x74\x65\x64","\x70\x72\x6F\x6A\x65\x63\x74\x5F\x69\x64","\x6E\x6F\x50\x72\x6F\x6A\x65\x63\x74\x53\x65\x6C\x65\x63\x74\x65\x64","\x6B\x65\x79","\x6E\x6F\x4B\x65\x79\x53\x65\x6C\x65\x63\x74\x65\x64","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x67\x65\x74\x49\x64","\x67\x65\x74\x43\x65\x6C\x6C","\x67\x65\x74\x56\x61\x6C\x75\x65","\x74\x65\x73\x74","\x6E\x75\x6D\x62\x65\x72\x4F\x72\x49\x6E\x76\x61\x6C\x69\x64\x4F\x72\x54\x69\x6D\x65\x6F\x75\x74","\x2C","\x73\x70\x6C\x69\x74","\x6E\x75\x6D\x62\x65\x72\x4F\x72\x41\x6C\x6C","\x66\x6F\x72\x45\x61\x63\x68","\x6E\x75\x6D\x62\x65\x72\x4F\x72\x49\x6E\x76\x61\x6C\x69\x64\x4F\x72\x44\x65\x66\x61\x75\x6C\x74","\x74\x72\x75\x65\x4F\x72\x46\x61\x6C\x73\x65","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6C\x6C\x61\x70\x73\x65\x64","\x63\x6F\x6E\x74\x61\x69\x6E\x73\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72\x73\x52\x65\x73\x6F\x75\x72\x63\x65","\x67\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C","\x67\x65\x74\x45\x64\x67\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x67\x65\x74\x43\x65\x6C\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E\x45\x72\x72\x6F\x72","\x76\x61\x6C\x69\x64\x61\x74\x65\x43\x65\x6C\x6C","\x67\x65\x74\x50\x61\x72\x65\x6E\x74","\x67\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x50\x61\x72\x65\x6E\x74","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x70\x75\x62\x6C\x69\x73\x68","\x50\x75\x62\x6C\x69\x73\x68\x65\x64\x20\x61\x74\x20","\x45\x72\x72\x6F\x72\x20\x70\x75\x62\x6C\x69\x73\x68\x69\x6E\x67\x20\x66\x69\x6C\x65","\x45\x72\x72\x6F\x72\x20\x70\x75\x62\x6C\x69\x73\x68\x69\x6E\x67\x20\x70\x72\x6F\x6A\x65\x63\x74\x3A\x20","\x56\x61\x72\x69\x61\x62\x6C\x65\x20\x63\x72\x65\x61\x74\x65\x64\x20\x61\x74\x20","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x3A\x20","\x6E\x61\x6D\x65\x3D","\x45\x72\x72\x6F\x72\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65","\x67\x65\x74\x55\x72\x6C","\x70\x61\x74\x68\x6E\x61\x6D\x65","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x3F","\x26","\x3D","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x61\x6E\x55\x6E\x64\x6F","\x63\x61\x6E\x52\x65\x64\x6F","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x74\x6F\x42\x61\x63\x6B","\x64\x61\x73\x68\x65\x64","\x72\x6F\x75\x6E\x64\x65\x64","\x73\x68\x61\x64\x6F\x77","\x74\x69\x6C\x74","\x61\x75\x74\x6F\x73\x69\x7A\x65","\x63\x75\x72\x76\x65\x64","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x77\x6F\x72\x64\x57\x72\x61\x70","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x67\x72\x6F\x75\x70","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x75\x6E\x67\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x61\x6C\x69\x67\x6E\x6D\x65\x6E\x74","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x66\x6F\x72\x6D\x61\x74","\x61\x72\x72\x61\x6E\x67\x65","\x6C\x69\x6E\x65\x77\x69\x64\x74\x68","\x73\x70\x61\x63\x69\x6E\x67","\x6C\x69\x6E\x65","\x6C\x69\x6E\x65\x65\x6E\x64","\x6C\x69\x6E\x65\x73\x74\x61\x72\x74","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x61\x6C\x69\x67\x6E","\x67\x65\x74\x53\x74\x61\x74\x65","\x69\x73\x4C\x6F\x6F\x70","\x64\x69\x72\x65\x63\x74\x69\x6F\x6E","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x63\x75\x72\x72\x65\x6E\x74\x52\x6F\x6F\x74","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x68\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x65\x78\x70\x61\x6E\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x65\x64\x69\x74\x4C\x69\x6E\x6B","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x63\x6C\x69\x65\x6E\x74\x48\x65\x69\x67\x68\x74","\x6D\x69\x6E","\x6D\x61\x78","\x68\x65\x69\x67\x68\x74","\x70\x78","\x74\x6F\x70","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x77\x69\x64\x74\x68","\x62\x6F\x74\x74\x6F\x6D","\x6C\x65\x66\x74","\x64\x69\x73\x70\x6C\x61\x79","\x6E\x6F\x6E\x65","\x68\x73\x70\x6C\x69\x74","\x76\x73\x70\x6C\x69\x74","\x67\x65\x4D\x65\x6E\x75\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x72\x65\x61\x74\x65\x44\x69\x76","\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x53\x69\x64\x65\x62\x61\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x4F\x75\x74\x6C\x69\x6E\x65\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x44\x69\x61\x67\x72\x61\x6D\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x46\x6F\x6F\x74\x65\x72\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x67\x65\x48\x73\x70\x6C\x69\x74","\x67\x65\x56\x73\x70\x6C\x69\x74","\x30\x70\x78","\x72\x69\x67\x68\x74","\x6D\x65\x6E\x75\x62\x61\x72","\x67\x65\x4D\x65\x6E\x75\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x4D\x65\x6E\x75\x62\x61\x72","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x74\x6F\x6F\x6C\x62\x61\x72","\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x54\x6F\x6F\x6C\x62\x61\x72","\x73\x69\x64\x65\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x53\x69\x64\x65\x62\x61\x72","\x63\x72\x65\x61\x74\x65\x46\x6F\x6F\x74\x65\x72","\x73\x74\x61\x74\x75\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x63\x72\x65\x61\x74\x65\x53\x74\x61\x74\x75\x73\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x73\x74\x61\x74\x75\x73\x43\x68\x61\x6E\x67\x65\x64","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x65\x74\x53\x74\x61\x74\x75\x73\x54\x65\x78\x74","\x61\x64\x64\x53\x70\x6C\x69\x74\x48\x61\x6E\x64\x6C\x65\x72","\x61","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x49\x74\x65\x6D\x20\x67\x65\x53\x74\x61\x74\x75\x73","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x67\x65\x46\x6F\x6F\x74\x65\x72","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x48\x65\x61\x64\x65\x72","\x63\x72\x65\x61\x74\x65\x46\x6F\x72\x6D","\x66\x6F\x72\x6D","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x78","\x79","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x74\x6F\x75\x63\x68\x6D\x6F\x76\x65","\x6D\x6F\x75\x73\x65\x75\x70","\x74\x6F\x75\x63\x68\x65\x6E\x64","\x68\x69\x64\x65\x44\x69\x61\x6C\x6F\x67","\x64\x69\x61\x6C\x6F\x67","\x49\x53\x5F\x56\x4D\x4C","\x63\x6C\x6F\x73\x65","\x73\x61\x76\x65\x46\x69\x6C\x65","\x67\x65\x74\x4F\x72\x43\x72\x65\x61\x74\x65\x46\x69\x6C\x65\x6E\x61\x6D\x65","\x70\x75\x62\x6C\x69\x73\x68\x46\x69\x6C\x65","\x65\x78\x65\x63\x75\x74\x65\x4C\x61\x79\x6F\x75\x74","\x61\x6E\x69\x6D\x61\x74\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x65\x78\x65\x63\x75\x74\x65","\x43\x61\x6D\x69\x6E\x6F","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x72\x74\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x69\x73\x43\x6F\x6E\x74\x72\x6F\x6C\x44\x6F\x77\x6E","\x49\x53\x5F\x4D\x41\x43","\x6D\x65\x74\x61\x4B\x65\x79","\x6D\x6F\x76\x65\x43\x65\x6C\x6C\x73","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x65\x6E\x61\x62\x6C\x65\x64","\x66\x75\x6E\x63\x74","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x53\x68\x69\x66\x74\x4B\x65\x79","\x62\x69\x6E\x64\x43\x6F\x6E\x74\x72\x6F\x6C\x4B\x65\x79","\x62\x69\x6E\x64\x53\x68\x69\x66\x74\x4B\x65\x79","\x62\x69\x6E\x64\x4B\x65\x79","\x65\x73\x63\x61\x70\x65","\x65\x6E\x74\x65\x72","\x66\x6F\x6C\x64\x43\x65\x6C\x6C\x73","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x65\x78\x70\x6F\x72\x74","\x63\x6F\x6E\x6E\x65\x63\x74","\x67\x72\x69\x64","\x61\x62\x6F\x75\x74","\x6D\x75\x73\x74\x68\x61\x76\x65","\x6F\x75\x74\x67\x6F\x69\x6E\x67\x65\x64\x67\x65","\x70\x75\x73\x68","\x69\x6E\x63\x6F\x6D\x69\x6E\x67\x65\x64\x67\x65"];EditorUi=function(_0xcd70x1,_0xcd70x2){this[_0x37a3[0]]=_0xcd70x1|| new Editor();this[_0x37a3[1]]=_0xcd70x2||document[_0x37a3[3]](_0x37a3[2]);var _0xcd70x3=_0xcd70x1[_0x37a3[4]];var _0xcd70x4=this;this[_0x37a3[1]][_0x37a3[6]][_0x37a3[5]]=_0x37a3[7]; new Image()[_0x37a3[8]]=mxPopupMenu[_0x37a3[10]][_0x37a3[9]];if(mxConnectionHandler[_0x37a3[10]][_0x37a3[11]]!=null){ new Image()[_0x37a3[8]]=mxConnectionHandler[_0x37a3[10]][_0x37a3[11]][_0x37a3[8]]};this[_0x37a3[12]]= new Actions(this);this[_0x37a3[13]]= new Menus(this);this[_0x37a3[14]]();this[_0x37a3[15]]();this[_0x37a3[16]]();var _0xcd70x5=mxUtils[_0x37a3[20]](this,function(_0xcd70x6){if(_0xcd70x6==null){_0xcd70x6=window[_0x37a3[17]]};if(this[_0x37a3[18]](_0xcd70x6)){return true};return _0xcd70x3[_0x37a3[19]]()});if(this[_0x37a3[1]]==document[_0x37a3[21]]){this[_0x37a3[23]][_0x37a3[22]]=_0xcd70x5;this[_0x37a3[23]][_0x37a3[24]]=_0xcd70x5;this[_0x37a3[25]][_0x37a3[22]]=_0xcd70x5;this[_0x37a3[25]][_0x37a3[24]]=_0xcd70x5;this[_0x37a3[26]][_0x37a3[22]]=_0xcd70x5;this[_0x37a3[26]][_0x37a3[24]]=_0xcd70x5;this[_0x37a3[27]][_0x37a3[22]]=_0xcd70x5;this[_0x37a3[27]][_0x37a3[24]]=_0xcd70x5;this[_0x37a3[28]][_0x37a3[22]]=_0xcd70x5;this[_0x37a3[28]][_0x37a3[24]]=_0xcd70x5};if(mxClient[_0x37a3[29]]&&( typeof (document[_0x37a3[30]])===_0x37a3[31]||document[_0x37a3[30]]<9)){mxEvent[_0x37a3[33]](this[_0x37a3[26]],_0x37a3[32],_0xcd70x5);mxEvent[_0x37a3[33]](this[_0x37a3[27]],_0x37a3[32],_0xcd70x5)}else {this[_0x37a3[26]][_0x37a3[34]]=_0xcd70x5;this[_0x37a3[27]][_0x37a3[34]]=_0xcd70x5};_0xcd70x3[_0x37a3[35]](this[_0x37a3[26]]);_0xcd70x3[_0x37a3[15]]();_0xcd70x3[_0x37a3[1]][_0x37a3[38]](_0x37a3[36],_0x37a3[37]);_0xcd70x3[_0x37a3[1]][_0x37a3[6]][_0x37a3[39]]=_0x37a3[40];_0xcd70x3[_0x37a3[1]][_0x37a3[6]][_0x37a3[41]]=_0x37a3[42]+_0xcd70x1[_0x37a3[43]]+_0x37a3[44];_0xcd70x3[_0x37a3[1]][_0x37a3[6]][_0x37a3[45]]=_0x37a3[46];_0xcd70x3[_0x37a3[1]][_0x37a3[47]]();var _0xcd70x7=_0xcd70x3[_0x37a3[48]];_0xcd70x3[_0x37a3[48]]=function(_0xcd70x8,_0xcd70x9,_0xcd70xa){if(_0xcd70x8==mxEvent[_0x37a3[49]]){this[_0x37a3[1]][_0x37a3[47]]()};_0xcd70x7[_0x37a3[50]](this,arguments)};this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[52],_0x37a3[53],_0x37a3[54]],[[1,1],[1,1],[0,0]],[[0,0],[0,0],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[57],_0x37a3[58],_0x37a3[59],_0x37a3[60],_0x37a3[61],_0x37a3[62],_0x37a3[63]],[[1,1],[0,0],[0,1],[0,1],[0,1],[1,1],[0,1]],[[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[64],_0x37a3[65]],[[1,1],[1,1]],[[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[66],_0x37a3[67],_0x37a3[68],_0x37a3[69],_0x37a3[70],_0x37a3[71],_0x37a3[72],_0x37a3[73],_0x37a3[74]],[[1,_0x37a3[55]],[1,1],[1,_0x37a3[55]],[1,1],[1,1],[1,1],[1,1],[1,1],[1,_0x37a3[55]]],[[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[75]],[[1,1]],[[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[76],_0x37a3[77]],[[1,1],[1,1]],[[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[78],_0x37a3[79],_0x37a3[80],_0x37a3[81],_0x37a3[82]],[[0,0],[1,2],[1,2],[1,2],[1,_0x37a3[55]]],[[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[83],_0x37a3[84]],[[1,1],[1,1]],[[1,_0x37a3[55]],[1,_0x37a3[55]]]);this[_0x37a3[56]](_0xcd70x3[_0x37a3[51]],[_0x37a3[85],_0x37a3[86],_0x37a3[87],_0x37a3[88],_0x37a3[89]],[[1,1],[1,1],[0,1],[0,1],[0,1]],[[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]],[1,_0x37a3[55]]]);_0xcd70x3[_0x37a3[90]]=function(_0xcd70x6,_0xcd70xb){var _0xcd70xc=[_0x37a3[66],_0x37a3[79],_0x37a3[80],_0x37a3[68],_0x37a3[74],_0x37a3[82]];var _0xcd70xd= new mxEventObject(mxEvent.DOUBLE_CLICK,_0x37a3[17],_0xcd70x6,_0x37a3[91],_0xcd70xb);this[_0x37a3[92]](_0xcd70xd);if(this[_0x37a3[93]]()&&!mxEvent[_0x37a3[94]](_0xcd70x6)&&!_0xcd70xd[_0x37a3[94]]()){if(this[_0x37a3[96]]()[_0x37a3[95]](_0xcd70xb)){if(_0xcd70xc[_0x37a3[100]](_0xcd70xb[_0x37a3[99]][_0x37a3[98]][_0x37a3[97]])>=0){this[_0x37a3[101]](_0xcd70xb)}}else {if(this[_0x37a3[96]]()[_0x37a3[102]](_0xcd70xb)){console[_0x37a3[103]](_0xcd70x4);console[_0x37a3[103]](_0xcd70xb);_0xcd70x4[_0x37a3[104]]( new GeneralDialog(_0xcd70x4,_0xcd70xb)[_0x37a3[1]],320,280,true,true)}};_0xcd70xd[_0x37a3[105]]()}};_0xcd70x3[_0x37a3[107]][_0x37a3[106]]=true;_0xcd70x3[_0x37a3[107]][_0x37a3[108]]=mxUtils[_0x37a3[20]](this,function(_0xcd70xe,_0xcd70xb,_0xcd70x6){this[_0x37a3[13]][_0x37a3[109]](_0xcd70xe,_0xcd70xb,_0xcd70x6)});_0xcd70x1[_0x37a3[111]][_0x37a3[35]](this[_0x37a3[110]]);mxEvent[_0x37a3[113]](document,mxUtils[_0x37a3[20]](this,function(_0xcd70x6){_0xcd70x3[_0x37a3[107]][_0x37a3[112]]()}));if(mxClient[_0x37a3[114]]){mxEvent[_0x37a3[33]](_0xcd70x3[_0x37a3[1]],_0x37a3[115],mxUtils[_0x37a3[20]](this,function(_0xcd70x6){_0xcd70x3[_0x37a3[120]][_0x37a3[119]]()[_0x37a3[38]](_0x37a3[116],_0x37a3[117]+_0xcd70x6[_0x37a3[118]]+_0x37a3[44]);_0xcd70x3[_0x37a3[120]][_0x37a3[122]]()[_0x37a3[6]][_0x37a3[121]]=_0x37a3[7]}));mxEvent[_0x37a3[33]](_0xcd70x3[_0x37a3[1]],_0x37a3[123],mxUtils[_0x37a3[20]](this,function(_0xcd70x6){_0xcd70x3[_0x37a3[120]][_0x37a3[119]]()[_0x37a3[124]](_0x37a3[116]);_0xcd70x3[_0x37a3[125]]=true;_0xcd70x3[_0x37a3[126]](_0xcd70x6[_0x37a3[118]]);_0xcd70x3[_0x37a3[120]][_0x37a3[122]]()[_0x37a3[6]][_0x37a3[121]]=_0x37a3[127]}))};var _0xcd70xf=this[_0x37a3[128]](_0xcd70x1);this[_0x37a3[129]]=function(){return _0xcd70xf};mxEvent[_0x37a3[33]](window,_0x37a3[130],mxUtils[_0x37a3[20]](this,function(){this[_0x37a3[15]]();_0xcd70x3[_0x37a3[131]]();this[_0x37a3[0]][_0x37a3[111]][_0x37a3[132]](false);this[_0x37a3[0]][_0x37a3[111]][_0x37a3[111]][_0x37a3[131]]()}));this[_0x37a3[35]]();this[_0x37a3[133]]()};EditorUi[_0x37a3[10]][_0x37a3[134]]=(mxClient[_0x37a3[114]])?16:8;EditorUi[_0x37a3[10]][_0x37a3[135]]=33;EditorUi[_0x37a3[10]][_0x37a3[136]]=36;EditorUi[_0x37a3[10]][_0x37a3[137]]=28;EditorUi[_0x37a3[10]][_0x37a3[138]]=204;EditorUi[_0x37a3[10]][_0x37a3[139]]=190;EditorUi[_0x37a3[10]][_0x37a3[35]]=function(){this[_0x37a3[140]]();this[_0x37a3[141]]();var _0xcd70x10=this[_0x37a3[12]][_0x37a3[143]](_0x37a3[142]);var _0xcd70x11=function(){_0xcd70x10[_0x37a3[145]](!mxClipboard[_0x37a3[144]]())};var _0xcd70x12=mxClipboard[_0x37a3[146]];mxClipboard[_0x37a3[146]]=function(){_0xcd70x12[_0x37a3[50]](this,arguments);_0xcd70x11()};var _0xcd70x13=mxClipboard[_0x37a3[147]];mxClipboard[_0x37a3[147]]=function(){_0xcd70x13[_0x37a3[50]](this,arguments);_0xcd70x11()}};EditorUi[_0x37a3[10]][_0x37a3[18]]=function(_0xcd70x6){return false};EditorUi[_0x37a3[10]][_0x37a3[133]]=function(){try{if(window[_0x37a3[148]]!=null&&window[_0x37a3[148]][_0x37a3[149]]!=null){window[_0x37a3[148]][_0x37a3[149]][_0x37a3[161]](mxUtils[_0x37a3[20]](this,function(_0xcd70x14,_0xcd70x15){try{var _0xcd70x16=mxUtils[_0x37a3[150]](_0xcd70x14);this[_0x37a3[0]][_0x37a3[152]](_0xcd70x16[_0x37a3[151]]);this[_0x37a3[0]][_0x37a3[153]]=false;this[_0x37a3[0]][_0x37a3[155]][_0x37a3[154]]();if(_0xcd70x15!=null){this[_0x37a3[0]][_0x37a3[156]]=_0xcd70x15}}catch(e){mxUtils[_0x37a3[160]](mxResources[_0x37a3[143]](_0x37a3[157])+_0x37a3[158]+e[_0x37a3[159]])}}))}}catch(e){}};EditorUi[_0x37a3[10]][_0x37a3[162]]=function(_0xcd70x14,_0xcd70x15,_0xcd70x17){try{var _0xcd70x16=mxUtils[_0x37a3[150]](_0xcd70x14);this[_0x37a3[0]][_0x37a3[152]](_0xcd70x16[_0x37a3[151]]);this[_0x37a3[0]][_0x37a3[153]]=false;this[_0x37a3[0]][_0x37a3[155]][_0x37a3[154]]();if(_0xcd70x15!=null){this[_0x37a3[0]][_0x37a3[156]]=_0xcd70x15};if(_0xcd70x17!=null){this[_0x37a3[0]][_0x37a3[163]]=_0xcd70x17}}catch(e){mxUtils[_0x37a3[160]](mxResources[_0x37a3[143]](_0x37a3[157])+_0x37a3[158]+e[_0x37a3[159]])}};EditorUi[_0x37a3[10]][_0x37a3[164]]=function(_0xcd70x18){var _0xcd70x1=this[_0x37a3[0]];if(_0xcd70x18!=null){var _0xcd70x14=mxUtils[_0x37a3[166]](this[_0x37a3[0]][_0x37a3[165]]());try{if(useLocalStorage){if(localStorage[_0x37a3[167]](_0xcd70x18)!=null&&!mxUtils[_0x37a3[169]](mxResources[_0x37a3[143]](_0x37a3[168],[_0xcd70x18]))){return};localStorage[_0x37a3[170]](_0xcd70x18,_0xcd70x14);this[_0x37a3[0]][_0x37a3[173]](mxResources[_0x37a3[143]](_0x37a3[171])+_0x37a3[172]+ new Date())}else {console[_0x37a3[103]](_0xcd70x14[_0x37a3[174]]);console[_0x37a3[103]](MAX_REQUEST_SIZE);if(_0xcd70x14[_0x37a3[174]]0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[230])+_0x37a3[226];break;case _0x37a3[66]:;case _0x37a3[68]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[228])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[230])+_0x37a3[226];_0xcd70x1e+=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[231])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[232])+_0x37a3[226];break;case _0x37a3[74]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[228])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[230])+_0x37a3[226];_0xcd70x1e+=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[231])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[232])+_0x37a3[226];break;case _0x37a3[82]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[233])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[232])+_0x37a3[226];break;case _0x37a3[76]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[234])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[235])+_0x37a3[226];break;case _0x37a3[64]:;case _0x37a3[65]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[231])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[232])+_0x37a3[226];break;case _0x37a3[78]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[236])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[237])+_0x37a3[226];break;case _0x37a3[86]:;case _0x37a3[87]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[238])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[239])+_0x37a3[226];break;case _0x37a3[79]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[240])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[241])+_0x37a3[226];break;case _0x37a3[69]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[242])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[243])+_0x37a3[226];break;case _0x37a3[70]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[244])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[245])+_0x37a3[226];break;case _0x37a3[71]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[246])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[247])+_0x37a3[226];break;case _0x37a3[75]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[156])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[248])+_0x37a3[226];break;case _0x37a3[84]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[249])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[250])+_0x37a3[226];break;case _0x37a3[60]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[251])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[252])+_0x37a3[226];break;case _0x37a3[59]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[253])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[252])+_0x37a3[226];break;case _0x37a3[61]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[254])!==_0x37a3[255])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[256])+_0x37a3[226];break;case _0x37a3[63]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[257])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[258])+_0x37a3[226];break;case _0x37a3[80]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[259])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[260])+_0x37a3[226];break;case _0x37a3[81]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[259])!=_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[260])+_0x37a3[226];break;case _0x37a3[62]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[261])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[262])+_0x37a3[226];break;case _0x37a3[88]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[263])>0)?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[264])+_0x37a3[226];break;case _0x37a3[72]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[246])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[247])+_0x37a3[226];break;case _0x37a3[73]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[246])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[247])+_0x37a3[226];_0xcd70x1e+=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[265])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[266])+_0x37a3[226];break;case _0x37a3[77]:_0xcd70x1e=(_0xcd70x1b[_0x37a3[98]][_0x37a3[229]](_0x37a3[265])!==_0x37a3[223])?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[266])+_0x37a3[226];break}};if(_0xcd70x3[_0x37a3[217]][_0x37a3[95]](_0xcd70x1b)){var _0xcd70x21=_0xcd70x3[_0x37a3[217]][_0x37a3[269]](_0xcd70x1b[_0x37a3[99]][_0x37a3[268]]());switch(_0xcd70x21[_0x37a3[98]][_0x37a3[267]]){case _0x37a3[66]:var _0xcd70x22=/^[0-9]{1,45}$|^[i]{1}$|^[t]{1}|^[#]{1}|^[*]{1}$/;_0xcd70x1e=_0xcd70x1e+((_0xcd70x22[_0x37a3[271]](String(_0xcd70x1b[_0x37a3[270]]())))?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[272])+_0x37a3[226]);break;case _0x37a3[68]:var _0xcd70x22=/^[0-9]{1,45}$|^[-]{1}$|^[i]{1}$|^[t]{1}|^[#]{1}|^[*]{1}$/;var _0xcd70x23=String(_0xcd70x1b[_0x37a3[270]]());var _0xcd70x24=_0xcd70x23[_0x37a3[274]](_0x37a3[273]);_0xcd70x24[_0x37a3[276]](function(_0xcd70x25){_0xcd70x1e=_0xcd70x1e+((_0xcd70x22[_0x37a3[271]](_0xcd70x25))?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[275])+_0x37a3[226])});break;case _0x37a3[74]:var _0xcd70x22=/^(x|i|-)$/;var _0xcd70x23=String(_0xcd70x1b[_0x37a3[270]]());_0xcd70x1e=_0xcd70x1e+((_0xcd70x22[_0x37a3[271]](_0xcd70x23))?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[277])+_0x37a3[226]);break;case _0x37a3[79]:;case _0x37a3[80]:;case _0x37a3[81]:var _0xcd70x22=/^(true){1}$|^(false){1}$/;_0xcd70x1e=_0xcd70x1e+((_0xcd70x22[_0x37a3[271]](String(_0xcd70x1b[_0x37a3[270]]())))?_0x37a3[223]:mxResources[_0x37a3[143]](_0x37a3[278])+_0x37a3[226]);break}};_0xcd70x3[_0x37a3[279]](_0xcd70x1b)&&!_0xcd70x1d&&(_0xcd70x1e=_0xcd70x1e+((mxResources[_0x37a3[143]](_0xcd70x3[_0x37a3[280]])||_0xcd70x3[_0x37a3[280]])+_0x37a3[226]));_0xcd70x1e=_0xcd70x3[_0x37a3[217]][_0x37a3[95]](_0xcd70x1b)?_0xcd70x1e+(_0xcd70x3[_0x37a3[282]](_0xcd70x1b,_0xcd70x3[_0x37a3[217]][_0x37a3[281]](_0xcd70x1b,true),_0xcd70x3[_0x37a3[217]][_0x37a3[281]](_0xcd70x1b,false))||_0x37a3[223]):_0xcd70x1e+(_0xcd70x3[_0x37a3[283]](_0xcd70x1b)||_0x37a3[223]);_0xcd70x1a=_0xcd70x3[_0x37a3[284]](_0xcd70x1b,_0xcd70x1c);_0xcd70x1a!=null&&(_0xcd70x1e=_0xcd70x1e+_0xcd70x1a);_0xcd70x3[_0x37a3[217]][_0x37a3[285]](_0xcd70x1b)==null&&_0xcd70x3[_0x37a3[120]][_0x37a3[215]]();return _0xcd70x1e[_0x37a3[174]]>0||!_0xcd70x1d?_0xcd70x1e:null};EditorUi[_0x37a3[10]][_0x37a3[224]]=function(_0xcd70x26){var _0xcd70x3=this[_0x37a3[0]][_0x37a3[4]];var _0xcd70x27=_0xcd70x3[_0x37a3[286]]();var _0xcd70x28=0;_0xcd70x27[_0x37a3[287]][_0x37a3[276]](function(_0xcd70x29){if(_0xcd70x3[_0x37a3[217]][_0x37a3[102]](_0xcd70x29)&&_0xcd70x29[_0x37a3[98]][_0x37a3[267]]==_0xcd70x26){_0xcd70x28++}});return _0xcd70x28>1?false:true};EditorUi[_0x37a3[10]][_0x37a3[288]]=function(_0xcd70x18){var _0xcd70x1=this[_0x37a3[0]];if(_0xcd70x18!=null){var _0xcd70x2a=this[_0x37a3[215]]();if(_0xcd70x2a===null){var _0xcd70x14=mxUtils[_0x37a3[166]](this[_0x37a3[0]][_0x37a3[165]]());try{if(useLocalStorage){if(localStorage[_0x37a3[167]](_0xcd70x18)!=null&&!mxUtils[_0x37a3[169]](mxResources[_0x37a3[143]](_0x37a3[168],[_0xcd70x18]))){return};localStorage[_0x37a3[170]](_0xcd70x18,_0xcd70x14);this[_0x37a3[0]][_0x37a3[173]](mxResources[_0x37a3[143]](_0x37a3[171])+_0x37a3[172]+ new Date())}else {console[_0x37a3[103]](_0xcd70x14[_0x37a3[174]]);console[_0x37a3[103]](MAX_REQUEST_SIZE);if(_0xcd70x14[_0x37a3[174]]0)?1:0;for(var _0xcd70x2e in urlParams){if(_0xcd70x2d==0){_0xcd70x2c+=_0x37a3[300]}else {_0xcd70x2c+=_0x37a3[301]};_0xcd70x2c+=_0xcd70x2e+_0x37a3[302]+urlParams[_0xcd70x2e];_0xcd70x2d++};return _0xcd70x2c};EditorUi[_0x37a3[10]][_0x37a3[140]]=function(){var _0xcd70x2f=this[_0x37a3[12]][_0x37a3[143]](_0x37a3[303]);var _0xcd70x30=this[_0x37a3[12]][_0x37a3[143]](_0x37a3[304]);var _0xcd70x31=this[_0x37a3[0]][_0x37a3[155]];var _0xcd70x32=function(){_0xcd70x2f[_0x37a3[145]](_0xcd70x31[_0x37a3[305]]());_0xcd70x30[_0x37a3[145]](_0xcd70x31[_0x37a3[306]]())};_0xcd70x31[_0x37a3[33]](mxEvent.ADD,_0xcd70x32);_0xcd70x31[_0x37a3[33]](mxEvent.UNDO,_0xcd70x32);_0xcd70x31[_0x37a3[33]](mxEvent.REDO,_0xcd70x32);_0xcd70x31[_0x37a3[33]](mxEvent.CLEAR,_0xcd70x32);_0xcd70x32()};EditorUi[_0x37a3[10]][_0x37a3[141]]=function(){var _0xcd70x33=mxUtils[_0x37a3[20]](this,function(){var _0xcd70x3=this[_0x37a3[0]][_0x37a3[4]];var _0xcd70x34=!_0xcd70x3[_0x37a3[307]]();var _0xcd70x35=false;var _0xcd70x36=false;var _0xcd70x37=_0xcd70x3[_0x37a3[308]]();if(_0xcd70x37!=null){for(var _0xcd70x38=0;_0xcd70x38<_0xcd70x37[_0x37a3[174]];_0xcd70x38++){var _0xcd70xb=_0xcd70x37[_0xcd70x38];if(_0xcd70x3[_0x37a3[96]]()[_0x37a3[95]](_0xcd70xb)){_0xcd70x36=true};if(_0xcd70x3[_0x37a3[96]]()[_0x37a3[102]](_0xcd70xb)){_0xcd70x35=true};if(_0xcd70x36&&_0xcd70x35){break}}};var _0xcd70x39=[_0x37a3[146],_0x37a3[147],_0x37a3[309],_0x37a3[310],_0x37a3[311],_0x37a3[312],_0x37a3[6],_0x37a3[313],_0x37a3[314],_0x37a3[315],_0x37a3[316],_0x37a3[317],_0x37a3[318],_0x37a3[319],_0x37a3[320]];for(var _0xcd70x38=0;_0xcd70x38<_0xcd70x39[_0x37a3[174]];_0xcd70x38++){this[_0x37a3[12]][_0x37a3[143]](_0xcd70x39[_0xcd70x38])[_0x37a3[145]](_0xcd70x34)};this[_0x37a3[12]][_0x37a3[143]](_0x37a3[321])[_0x37a3[145]](_0xcd70x36);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[322])[_0x37a3[145]](_0xcd70x35);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[323])[_0x37a3[145]](_0xcd70x35);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[325])[_0x37a3[145]](_0xcd70x3[_0x37a3[324]]()>1);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[327])[_0x37a3[145]](_0xcd70x3[_0x37a3[324]]()==1&&_0xcd70x3[_0x37a3[96]]()[_0x37a3[218]](_0xcd70x3[_0x37a3[326]]())>0);var _0xcd70x3a=_0xcd70x35&&_0xcd70x3[_0x37a3[324]]()==1;this[_0x37a3[12]][_0x37a3[143]](_0x37a3[328])[_0x37a3[145]](_0xcd70x3a&&_0xcd70x3[_0x37a3[96]]()[_0x37a3[102]](_0xcd70x3[_0x37a3[96]]()[_0x37a3[285]](_0xcd70x3[_0x37a3[326]]())));var _0xcd70x3b=[_0x37a3[329],_0x37a3[330],_0x37a3[331],_0x37a3[332],_0x37a3[246],_0x37a3[333],_0x37a3[334],_0x37a3[335],_0x37a3[336]];for(var _0xcd70x38=0;_0xcd70x38<_0xcd70x3b[_0x37a3[174]];_0xcd70x38++){this[_0x37a3[13]][_0x37a3[143]](_0xcd70x3b[_0xcd70x38])[_0x37a3[145]](_0xcd70x34)};_0xcd70x3b=[_0x37a3[337],_0x37a3[338],_0x37a3[339]];for(var _0xcd70x38=0;_0xcd70x38<_0xcd70x3b[_0x37a3[174]];_0xcd70x38++){this[_0x37a3[13]][_0x37a3[143]](_0xcd70x3b[_0xcd70x38])[_0x37a3[145]](_0xcd70x36)};this[_0x37a3[12]][_0x37a3[143]](_0x37a3[340])[_0x37a3[145]](_0xcd70x36);this[_0x37a3[13]][_0x37a3[143]](_0x37a3[341])[_0x37a3[145]](_0xcd70x3[_0x37a3[324]]()>1);this[_0x37a3[13]][_0x37a3[143]](_0x37a3[344])[_0x37a3[145]](_0xcd70x35||(_0xcd70x36&&_0xcd70x3[_0x37a3[343]](_0xcd70x3[_0x37a3[120]][_0x37a3[342]](_0xcd70x3[_0x37a3[326]]()))));this[_0x37a3[13]][_0x37a3[143]](_0x37a3[347])[_0x37a3[145]](_0xcd70x3[_0x37a3[345]]&&((_0xcd70x3[_0x37a3[120]][_0x37a3[346]]!=null)||(_0xcd70x3[_0x37a3[324]]()==1&&_0xcd70x3[_0x37a3[220]](_0xcd70x3[_0x37a3[326]]()))));this[_0x37a3[12]][_0x37a3[143]](_0x37a3[348])[_0x37a3[145]](_0xcd70x3[_0x37a3[120]][_0x37a3[346]]!=null);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[349])[_0x37a3[145]](_0xcd70x3[_0x37a3[120]][_0x37a3[346]]!=null);var _0xcd70x3c=_0xcd70x3[_0x37a3[324]]()==1&&_0xcd70x3[_0x37a3[220]](_0xcd70x3[_0x37a3[326]]());this[_0x37a3[12]][_0x37a3[143]](_0x37a3[350])[_0x37a3[145]](_0xcd70x3c);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[351])[_0x37a3[145]](_0xcd70x3c);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[352])[_0x37a3[145]](_0xcd70x3c);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[353])[_0x37a3[145]](_0xcd70x3[_0x37a3[324]]()==1);this[_0x37a3[12]][_0x37a3[143]](_0x37a3[355])[_0x37a3[145]](_0xcd70x3[_0x37a3[324]]()==1&&_0xcd70x3[_0x37a3[354]](_0xcd70x3[_0x37a3[326]]())!=null)});this[_0x37a3[0]][_0x37a3[4]][_0x37a3[356]]()[_0x37a3[33]](mxEvent.CHANGE,_0xcd70x33);_0xcd70x33()};EditorUi[_0x37a3[10]][_0x37a3[15]]=function(){var _0xcd70x3d=mxClient[_0x37a3[29]]&&(document[_0x37a3[30]]==null||document[_0x37a3[30]]==5);var _0xcd70x3e=this[_0x37a3[1]][_0x37a3[357]];var _0xcd70x3f=this[_0x37a3[1]][_0x37a3[358]];if(this[_0x37a3[1]]==document[_0x37a3[21]]){_0xcd70x3e=document[_0x37a3[21]][_0x37a3[357]]||document[_0x37a3[151]][_0x37a3[357]];_0xcd70x3f=(_0xcd70x3d)?document[_0x37a3[21]][_0x37a3[358]]||document[_0x37a3[151]][_0x37a3[358]]:document[_0x37a3[151]][_0x37a3[358]]};var _0xcd70x40=Math[_0x37a3[360]](0,Math[_0x37a3[359]](this[_0x37a3[138]],_0xcd70x3e-this[_0x37a3[134]]-20));var _0xcd70x41=Math[_0x37a3[360]](0,Math[_0x37a3[359]](this[_0x37a3[139]],_0xcd70x3f-this[_0x37a3[135]]-this[_0x37a3[136]]-this[_0x37a3[137]]-this[_0x37a3[134]]-1));this[_0x37a3[23]][_0x37a3[6]][_0x37a3[361]]=this[_0x37a3[135]]+_0x37a3[362];this[_0x37a3[25]][_0x37a3[6]][_0x37a3[363]]=this[_0x37a3[135]]+_0x37a3[362];this[_0x37a3[25]][_0x37a3[6]][_0x37a3[361]]=this[_0x37a3[136]]+_0x37a3[362];var _0xcd70x42=this[_0x37a3[135]]+this[_0x37a3[136]];if(!mxClient[_0x37a3[364]]){_0xcd70x42+=1};this[_0x37a3[27]][_0x37a3[6]][_0x37a3[363]]=_0xcd70x42+_0x37a3[362];this[_0x37a3[27]][_0x37a3[6]][_0x37a3[365]]=_0xcd70x40+_0x37a3[362];this[_0x37a3[110]][_0x37a3[6]][_0x37a3[365]]=_0xcd70x40+_0x37a3[362];this[_0x37a3[110]][_0x37a3[6]][_0x37a3[361]]=_0xcd70x41+_0x37a3[362];this[_0x37a3[110]][_0x37a3[6]][_0x37a3[366]]=this[_0x37a3[137]]+_0x37a3[362];this[_0x37a3[26]][_0x37a3[6]][_0x37a3[367]]=(_0xcd70x40+this[_0x37a3[134]])+_0x37a3[362];this[_0x37a3[26]][_0x37a3[6]][_0x37a3[363]]=this[_0x37a3[27]][_0x37a3[6]][_0x37a3[363]];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[361]]=this[_0x37a3[137]]+_0x37a3[362];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[368]]=_0x37a3[369];this[_0x37a3[370]][_0x37a3[6]][_0x37a3[363]]=this[_0x37a3[27]][_0x37a3[6]][_0x37a3[363]];this[_0x37a3[370]][_0x37a3[6]][_0x37a3[366]]=this[_0x37a3[110]][_0x37a3[6]][_0x37a3[366]];this[_0x37a3[370]][_0x37a3[6]][_0x37a3[367]]=_0xcd70x40+_0x37a3[362];this[_0x37a3[371]][_0x37a3[6]][_0x37a3[365]]=this[_0x37a3[27]][_0x37a3[6]][_0x37a3[365]];this[_0x37a3[371]][_0x37a3[6]][_0x37a3[366]]=(_0xcd70x41+this[_0x37a3[137]])+_0x37a3[362];if(_0xcd70x3d){this[_0x37a3[23]][_0x37a3[6]][_0x37a3[365]]=_0xcd70x3e+_0x37a3[362];this[_0x37a3[25]][_0x37a3[6]][_0x37a3[365]]=this[_0x37a3[23]][_0x37a3[6]][_0x37a3[365]];var _0xcd70x43=(_0xcd70x3f-_0xcd70x41-this[_0x37a3[134]]-this[_0x37a3[137]]-this[_0x37a3[135]]-this[_0x37a3[136]]);this[_0x37a3[27]][_0x37a3[6]][_0x37a3[361]]=_0xcd70x43+_0x37a3[362];this[_0x37a3[26]][_0x37a3[6]][_0x37a3[365]]=(_0xcd70x3e-_0xcd70x40-this[_0x37a3[134]])+_0x37a3[362];var _0xcd70x44=(_0xcd70x3f-this[_0x37a3[137]]-this[_0x37a3[135]]-this[_0x37a3[136]]);this[_0x37a3[26]][_0x37a3[6]][_0x37a3[361]]=_0xcd70x44+_0x37a3[362];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[365]]=this[_0x37a3[23]][_0x37a3[6]][_0x37a3[365]];this[_0x37a3[370]][_0x37a3[6]][_0x37a3[361]]=_0xcd70x44+_0x37a3[362]}else {this[_0x37a3[27]][_0x37a3[6]][_0x37a3[366]]=(_0xcd70x41+this[_0x37a3[134]]+this[_0x37a3[137]])+_0x37a3[362];this[_0x37a3[26]][_0x37a3[6]][_0x37a3[366]]=this[_0x37a3[110]][_0x37a3[6]][_0x37a3[366]]}};EditorUi[_0x37a3[10]][_0x37a3[14]]=function(){this[_0x37a3[23]]=this[_0x37a3[373]](_0x37a3[372]);this[_0x37a3[25]]=this[_0x37a3[373]](_0x37a3[374]);this[_0x37a3[27]]=this[_0x37a3[373]](_0x37a3[375]);this[_0x37a3[110]]=this[_0x37a3[373]](_0x37a3[376]);this[_0x37a3[26]]=this[_0x37a3[373]](_0x37a3[377]);this[_0x37a3[28]]=this[_0x37a3[373]](_0x37a3[378]);this[_0x37a3[370]]=this[_0x37a3[373]](_0x37a3[379]);this[_0x37a3[371]]=this[_0x37a3[373]](_0x37a3[380]);this[_0x37a3[23]][_0x37a3[6]][_0x37a3[363]]=_0x37a3[381];this[_0x37a3[23]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[23]][_0x37a3[6]][_0x37a3[382]]=_0x37a3[381];this[_0x37a3[25]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[25]][_0x37a3[6]][_0x37a3[382]]=_0x37a3[381];this[_0x37a3[27]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[110]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[26]][_0x37a3[6]][_0x37a3[382]]=_0x37a3[381];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[382]]=_0x37a3[381];this[_0x37a3[28]][_0x37a3[6]][_0x37a3[366]]=_0x37a3[381];this[_0x37a3[371]][_0x37a3[6]][_0x37a3[367]]=_0x37a3[381];this[_0x37a3[371]][_0x37a3[6]][_0x37a3[361]]=this[_0x37a3[134]]+_0x37a3[362];this[_0x37a3[370]][_0x37a3[6]][_0x37a3[365]]=this[_0x37a3[134]]+_0x37a3[362]};EditorUi[_0x37a3[10]][_0x37a3[16]]=function(){this[_0x37a3[383]]=this[_0x37a3[13]][_0x37a3[385]](this[_0x37a3[373]](_0x37a3[384]));this[_0x37a3[23]][_0x37a3[386]](this[_0x37a3[383]][_0x37a3[1]]);this[_0x37a3[387]]=this[_0x37a3[389]](this[_0x37a3[373]](_0x37a3[388]));this[_0x37a3[25]][_0x37a3[386]](this[_0x37a3[387]][_0x37a3[1]]);this[_0x37a3[390]]=this[_0x37a3[391]](this[_0x37a3[27]]);this[_0x37a3[28]][_0x37a3[386]](this[_0x37a3[392]]());this[_0x37a3[393]]=this[_0x37a3[394]]();this[_0x37a3[0]][_0x37a3[33]](_0x37a3[395],mxUtils[_0x37a3[20]](this,function(){this[_0x37a3[397]](this[_0x37a3[0]][_0x37a3[396]]())}));this[_0x37a3[397]](this[_0x37a3[0]][_0x37a3[396]]());this[_0x37a3[383]][_0x37a3[1]][_0x37a3[386]](this[_0x37a3[393]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[23]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[25]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[27]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[110]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[26]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[28]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[370]]);this[_0x37a3[1]][_0x37a3[386]](this[_0x37a3[371]]);this[_0x37a3[398]](this[_0x37a3[370]],true,0,mxUtils[_0x37a3[20]](this,function(_0xcd70x45){this[_0x37a3[138]]=_0xcd70x45;this[_0x37a3[15]]();this[_0x37a3[0]][_0x37a3[4]][_0x37a3[131]]();this[_0x37a3[0]][_0x37a3[111]][_0x37a3[132]](false);this[_0x37a3[0]][_0x37a3[111]][_0x37a3[111]][_0x37a3[131]]()}));this[_0x37a3[398]](this[_0x37a3[371]],false,this[_0x37a3[137]],mxUtils[_0x37a3[20]](this,function(_0xcd70x45){this[_0x37a3[139]]=_0xcd70x45;this[_0x37a3[15]]();this[_0x37a3[0]][_0x37a3[111]][_0x37a3[132]](false);this[_0x37a3[0]][_0x37a3[111]][_0x37a3[111]][_0x37a3[131]]()}))};EditorUi[_0x37a3[10]][_0x37a3[394]]=function(){var _0xcd70x2=document[_0x37a3[400]](_0x37a3[399]);_0xcd70x2[_0x37a3[401]]=_0x37a3[402];return _0xcd70x2};EditorUi[_0x37a3[10]][_0x37a3[394]]=function(){var _0xcd70x2=document[_0x37a3[400]](_0x37a3[399]);_0xcd70x2[_0x37a3[401]]=_0x37a3[402];return _0xcd70x2};EditorUi[_0x37a3[10]][_0x37a3[397]]=function(_0xcd70x45){this[_0x37a3[393]][_0x37a3[403]]=_0xcd70x45};EditorUi[_0x37a3[10]][_0x37a3[389]]=function(_0xcd70x2){return new Toolbar(this,_0xcd70x2)};EditorUi[_0x37a3[10]][_0x37a3[391]]=function(_0xcd70x2){return new Sidebar(this,_0xcd70x2)};EditorUi[_0x37a3[10]][_0x37a3[392]]=function(){return this[_0x37a3[373]](_0x37a3[404])};EditorUi[_0x37a3[10]][_0x37a3[373]]=function(_0xcd70x46){var _0xcd70x47=document[_0x37a3[400]](_0x37a3[405]);_0xcd70x47[_0x37a3[401]]=_0xcd70x46;return _0xcd70x47};EditorUi[_0x37a3[10]][_0x37a3[406]]=function(_0xcd70x46){var _0xcd70x47=document[_0x37a3[400]](_0xcd70x46);return _0xcd70x47};EditorUi[_0x37a3[10]][_0x37a3[407]]=function(_0xcd70x46){var _0xcd70x47=document[_0x37a3[400]](_0x37a3[408]);_0xcd70x47[_0x37a3[401]]=_0xcd70x46;return _0xcd70x47};EditorUi[_0x37a3[10]][_0x37a3[398]]=function(_0xcd70x47,_0xcd70x48,_0xcd70x49,_0xcd70x4a){var _0xcd70x4b=null;var _0xcd70x4c=null;function _0xcd70x4d(){return parseInt(((_0xcd70x48)?_0xcd70x47[_0x37a3[6]][_0x37a3[367]]:_0xcd70x47[_0x37a3[6]][_0x37a3[366]]))}function _0xcd70x4e(_0xcd70x6){if(_0xcd70x4b!=null){var _0xcd70x4f= new mxPoint(mxEvent[_0x37a3[409]](_0xcd70x6),mxEvent[_0x37a3[410]](_0xcd70x6));_0xcd70x4a(Math[_0x37a3[360]](0,_0xcd70x4c+((_0xcd70x48)?(_0xcd70x4f[_0x37a3[411]]-_0xcd70x4b[_0x37a3[411]]):(_0xcd70x4b[_0x37a3[412]]-_0xcd70x4f[_0x37a3[412]]))-_0xcd70x49));mxEvent[_0x37a3[105]](_0xcd70x6)}}function _0xcd70x50(_0xcd70x6){_0xcd70x4e(_0xcd70x6);_0xcd70x4b=null;_0xcd70x4c=null}mxEvent[_0x37a3[113]](_0xcd70x47,function(_0xcd70x6){_0xcd70x4b= new mxPoint(mxEvent[_0x37a3[409]](_0xcd70x6),mxEvent[_0x37a3[410]](_0xcd70x6));_0xcd70x4c=_0xcd70x4d();mxEvent[_0x37a3[105]](_0xcd70x6)});mxEvent[_0x37a3[33]](document,_0x37a3[413],_0xcd70x4e);mxEvent[_0x37a3[33]](document,_0x37a3[414],_0xcd70x4e);mxEvent[_0x37a3[33]](document,_0x37a3[415],_0xcd70x50);mxEvent[_0x37a3[33]](document,_0x37a3[416],_0xcd70x50)};EditorUi[_0x37a3[10]][_0x37a3[104]]=function(_0xcd70x47,_0xcd70x3e,_0xcd70x3f,_0xcd70x51,_0xcd70x52,_0xcd70x53){this[_0x37a3[417]]();this[_0x37a3[418]]= new Dialog(this,_0xcd70x47,_0xcd70x3e,(mxClient[_0x37a3[419]])?_0xcd70x3f-12:_0xcd70x3f,_0xcd70x51,_0xcd70x52,_0xcd70x53)};EditorUi[_0x37a3[10]][_0x37a3[417]]=function(){if(this[_0x37a3[418]]!=null){this[_0x37a3[418]][_0x37a3[420]]();this[_0x37a3[418]]=null;this[_0x37a3[0]][_0x37a3[4]][_0x37a3[1]][_0x37a3[47]]()}};EditorUi[_0x37a3[10]][_0x37a3[421]]=function(_0xcd70x54){if(!_0xcd70x54&&this[_0x37a3[0]][_0x37a3[156]]!=null){this[_0x37a3[202]](this[_0x37a3[0]][_0x37a3[422]]())}else {this[_0x37a3[104]]( new SaveDialog(this)[_0x37a3[1]],300,100,true,true)}};EditorUi[_0x37a3[10]][_0x37a3[423]]=function(_0xcd70x54){if(!_0xcd70x54&&this[_0x37a3[0]][_0x37a3[156]]!=null){this[_0x37a3[288]](this[_0x37a3[0]][_0x37a3[422]]())}else {}};EditorUi[_0x37a3[10]][_0x37a3[424]]=function(_0xcd70x55,_0xcd70x56,_0xcd70x57){var _0xcd70x3=this[_0x37a3[0]][_0x37a3[4]];var _0xcd70xb=_0xcd70x3[_0x37a3[326]]();_0xcd70x56=this[_0x37a3[425]]!=null?this[_0x37a3[425]]:_0xcd70x56;_0xcd70x3[_0x37a3[96]]()[_0x37a3[426]]();try{_0xcd70x55[_0x37a3[427]](_0xcd70x3[_0x37a3[286]](),_0xcd70xb)}catch(e){throw e}finally{if(_0xcd70x56&&navigator[_0x37a3[429]][_0x37a3[100]](_0x37a3[428])<0){var _0xcd70x58= new mxMorphing(_0xcd70x3);_0xcd70x58[_0x37a3[33]](mxEvent.DONE,mxUtils[_0x37a3[20]](this,function(){_0xcd70x3[_0x37a3[96]]()[_0x37a3[430]]()}));_0xcd70x58[_0x37a3[431]]()}else {_0xcd70x3[_0x37a3[96]]()[_0x37a3[430]]()}}};EditorUi[_0x37a3[10]][_0x37a3[128]]=function(_0xcd70x1){var _0xcd70x3=this[_0x37a3[0]][_0x37a3[4]];var _0xcd70xf= new mxKeyHandler(_0xcd70x3);_0xcd70xf[_0x37a3[432]]=function(_0xcd70x6){return mxEvent[_0x37a3[432]](_0xcd70x6)||(mxClient[_0x37a3[433]]&&_0xcd70x6[_0x37a3[434]])};function _0xcd70x59(_0xcd70x5a){if(!_0xcd70x3[_0x37a3[307]]()){var _0xcd70x49=0;var _0xcd70x5b=0;if(_0xcd70x5a==37){_0xcd70x49= -1}else {if(_0xcd70x5a==38){_0xcd70x5b= -1}else {if(_0xcd70x5a==39){_0xcd70x49=1}else {if(_0xcd70x5a==40){_0xcd70x5b=1}}}};_0xcd70x3[_0x37a3[435]](_0xcd70x3[_0x37a3[308]](),_0xcd70x49,_0xcd70x5b);_0xcd70x3[_0x37a3[436]](_0xcd70x3[_0x37a3[326]]())}}var _0xcd70x5c=mxUtils[_0x37a3[20]](this,function(_0xcd70x5d,_0xcd70x5e,_0xcd70x2e,_0xcd70x5f){var _0xcd70x60=this[_0x37a3[12]][_0x37a3[143]](_0xcd70x2e);if(_0xcd70x60!=null){var _0xcd70x1f=function(){if(_0xcd70x60[_0x37a3[437]]){_0xcd70x60[_0x37a3[438]]()}};if(_0xcd70x5e){if(_0xcd70x5f){_0xcd70xf[_0x37a3[439]](_0xcd70x5d,_0xcd70x1f)}else {_0xcd70xf[_0x37a3[440]](_0xcd70x5d,_0xcd70x1f)}}else {if(_0xcd70x5f){_0xcd70xf[_0x37a3[441]](_0xcd70x5d,_0xcd70x1f)}else {_0xcd70xf[_0x37a3[442]](_0xcd70x5d,_0xcd70x1f)}}}});var _0xcd70x61=this;var _0xcd70x62=_0xcd70xf[_0x37a3[443]];_0xcd70xf[_0x37a3[443]]=function(_0xcd70x6){_0xcd70x61[_0x37a3[417]]();_0xcd70x62[_0x37a3[50]](this,arguments)};_0xcd70xf[_0x37a3[444]]=function(){};_0xcd70xf[_0x37a3[442]](8,function(){_0xcd70x3[_0x37a3[445]](true)});_0xcd70xf[_0x37a3[442]](13,function(){_0xcd70x3[_0x37a3[445]](false)});_0xcd70xf[_0x37a3[442]](33,function(){_0xcd70x3[_0x37a3[349]]()});_0xcd70xf[_0x37a3[442]](34,function(){_0xcd70x3[_0x37a3[350]]()});_0xcd70xf[_0x37a3[442]](36,function(){_0xcd70x3[_0x37a3[348]]()});_0xcd70xf[_0x37a3[442]](35,function(){_0xcd70x3[_0x37a3[15]]()});_0xcd70xf[_0x37a3[442]](37,function(){_0xcd70x59(37)});_0xcd70xf[_0x37a3[442]](38,function(){_0xcd70x59(38)});_0xcd70xf[_0x37a3[442]](39,function(){_0xcd70x59(39)});_0xcd70xf[_0x37a3[442]](40,function(){_0xcd70x59(40)});_0xcd70xf[_0x37a3[442]](113,function(){_0xcd70x3[_0x37a3[101]]()});_0xcd70x5c(46,false,_0x37a3[309]);_0xcd70x5c(82,true,_0x37a3[319]);_0xcd70x5c(83,true,_0x37a3[202]);_0xcd70x5c(83,true,_0x37a3[210],true);_0xcd70x5c(107,false,_0x37a3[446]);_0xcd70x5c(109,false,_0x37a3[447]);_0xcd70x5c(65,true,_0x37a3[448]);_0xcd70x5c(86,true,_0x37a3[449],true);_0xcd70x5c(69,true,_0x37a3[450],true);_0xcd70x5c(69,true,_0x37a3[451]);_0xcd70x5c(66,true,_0x37a3[315]);_0xcd70x5c(70,true,_0x37a3[314]);_0xcd70x5c(68,true,_0x37a3[310]);_0xcd70x5c(90,true,_0x37a3[303]);_0xcd70x5c(89,true,_0x37a3[304]);_0xcd70x5c(88,true,_0x37a3[146]);_0xcd70x5c(67,true,_0x37a3[147]);_0xcd70x5c(81,true,_0x37a3[452]);_0xcd70x5c(86,true,_0x37a3[142]);_0xcd70x5c(71,true,_0x37a3[325]);_0xcd70x5c(71,true,_0x37a3[453],true);_0xcd70x5c(85,true,_0x37a3[327]);_0xcd70x5c(112,false,_0x37a3[454]);_0xcd70x5c(80,true,_0x37a3[288],true);return _0xcd70xf};EditorUi[_0x37a3[10]][_0x37a3[56]]=function(_0xcd70x3,_0xcd70x37,_0xcd70x63,_0xcd70x64){for(var _0xcd70x38=0;_0xcd70x38<_0xcd70x37[_0x37a3[174]];_0xcd70x38++){_0xcd70x3[_0x37a3[457]]( new mxMultiplicity(true,_0xcd70x37[_0xcd70x38],null,null,_0xcd70x63[_0xcd70x38][0],_0xcd70x63[_0xcd70x38][1],null,mxResources[_0x37a3[143]](_0xcd70x37[_0xcd70x38])+mxResources[_0x37a3[143]](_0x37a3[455])+_0xcd70x63[_0xcd70x38][0]+mxResources[_0x37a3[143]](_0x37a3[456]),null));_0xcd70x3[_0x37a3[457]]( new mxMultiplicity(false,_0xcd70x37[_0xcd70x38],null,null,_0xcd70x64[_0xcd70x38][0],_0xcd70x64[_0xcd70x38][1],null,mxResources[_0x37a3[143]](_0xcd70x37[_0xcd70x38])+mxResources[_0x37a3[143]](_0x37a3[455])+_0xcd70x64[_0xcd70x38][0]+mxResources[_0x37a3[143]](_0x37a3[458]),null))}} \ No newline at end of file +/** + * $Id: EditorUi.js,v 1.21 2013/03/14 20:46:36 david Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph editor + */ +EditorUi = function(editor, container) { + this.editor = editor || new Editor(); + this.container = container || document.getElementById('geEditor'); + var graph = editor.graph; + var self = this; + + // Disables scrollbars + this.container.style.overflow = 'hidden'; + + // Pre-fetches submenu image + new Image().src = mxPopupMenu.prototype.submenuImage; + + // Pre-fetches connect image + if (mxConnectionHandler.prototype.connectImage != null) { + new Image().src = mxConnectionHandler.prototype.connectImage.src; + } + + // Creates the user interface + this.actions = new Actions(this); + this.menus = new Menus(this); + this.createDivs(); + this.refresh(); + this.createUi(); + + // Disables HTML and text selection + var textEditing = mxUtils.bind(this, function(evt) { + if (evt == null) { + evt = window.event; + } + + if (this.isSelectionAllowed(evt)) { + return true; + } + + return graph.isEditing(); + }); + + // Disables text selection while not editing and no dialog visible + if (this.container == document.body) { + this.menubarContainer.onselectstart = textEditing; + this.menubarContainer.onmousedown = textEditing; + this.toolbarContainer.onselectstart = textEditing; + this.toolbarContainer.onmousedown = textEditing; + this.diagramContainer.onselectstart = textEditing; + this.diagramContainer.onmousedown = textEditing; + this.sidebarContainer.onselectstart = textEditing; + this.sidebarContainer.onmousedown = textEditing; + this.footerContainer.onselectstart = textEditing; + this.footerContainer.onmousedown = textEditing; + } + + // And uses built-in context menu while editing + if (mxClient.IS_IE && (typeof(document.documentMode) === 'undefined' || + document.documentMode < 9)) { + mxEvent.addListener(this.diagramContainer, 'contextmenu', textEditing); + mxEvent.addListener(this.sidebarContainer, 'contextmenu', textEditing); + } else { + // Allows browser context menu outside of diagram and sidebar + this.diagramContainer.oncontextmenu = textEditing; + this.sidebarContainer.oncontextmenu = textEditing; + } + + // Contains the main graph instance inside the given panel + graph.init(this.diagramContainer); + graph.refresh(); + + // Enables scrollbars and sets cursor style for the container + graph.container.setAttribute('tabindex', '0'); + // graph.container.style.overflow = (touchStyle) ? 'hidden' : 'auto'; + graph.container.style.cursor = 'default'; + graph.container.style.backgroundImage = 'url(' + editor.gridImage + ')'; + graph.container.style.backgroundPosition = '-1px -1px'; + graph.container.focus(); + + // Keeps graph container focused on mouse down + var graphFireMouseEvent = graph.fireMouseEvent; + graph.fireMouseEvent = function(evtName, me, sender) { + if (evtName == mxEvent.MOUSE_DOWN) { + this.container.focus(); + } + + graphFireMouseEvent.apply(this, arguments); + }; + + // Giuseppe Careri + // Defines invalid connections along with the error messages that they produce. + this.createMultiplicities(graph.multiplicities, ['start', 'finally', 'end'], [ + [1, 1], + [1, 1], + [0, 0] + ], [ + [0, 0], + [0, 0], + [1, 'n'] + ]); + this.createMultiplicities(graph.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(graph.multiplicities, ['set', 'math'], [ + [1, 1], + [1, 1] + ], [ + [1, 'n'], + [1, 'n'] + ]); + this.createMultiplicities(graph.multiplicities, ['background', 'playback', + 'menu', 'saydigits', 'saynumber', 'sayphonetic', 'tts', 'ispeechtts', 'getdigits' + ], [ + [1, 'n'], + [1, 1], + [1, 'n'], + [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'] + ]); + this.createMultiplicities(graph.multiplicities, ['record'], [ + [1, 1] + ], [ + [1, 'n'] + ]); + this.createMultiplicities(graph.multiplicities, ['database', 'ispeechasr'], [ + [1, 1], + [1, 1] + ], [ + [1, 'n'], + [1, 'n'] + ]); + this.createMultiplicities(graph.multiplicities, ['gotoc', 'gotoif', + 'gotoiftime', 'gotoifmultitime', 'vswitch' + ], [ + [0, 0], + [1, 2], + [1, 2], + [1, 2], + [1, 'n'] + ], [ + [1, 'n'], + [1, 'n'], + [1, 'n'], + [1, 'n'], + [1, 'n'] + ]); + this.createMultiplicities(graph.multiplicities, ['queuelog', 'goal'], [ + [1, 1], + [1, 1] + ], [ + [1, 'n'], + [1, 'n'] + ]); + this.createMultiplicities(graph.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'] + ]); + + // Giuseppe Careri + // Processes a doubleclick on an optional cell and fires a event. + // The event is fired initially. + // If the graph is enabled and the event has not been consumed, then is called with the given cell. + // The event is ignored if no cell was specified. + graph.dblClick = function(evt, cell) { + var edges = ['background', 'gotoif', 'gotoiftime', 'menu', 'getdigits', 'vswitch']; + var mxe = new mxEventObject(mxEvent.DOUBLE_CLICK, 'event', evt, 'cell', + cell); + this.fireEvent(mxe); + + if (this.isEnabled() && !mxEvent.isConsumed(evt) && !mxe.isConsumed()) { + // Override dblClick Vertices and Edges + if (this.getModel().isEdge(cell)) { + if (edges.indexOf(cell.source.value.tagName) >= 0) + this.startEditingAtCell(cell); + } else if (this.getModel().isVertex(cell)) { + console.log(self); + console.log(cell); + self.showDialog(new GeneralDialog(self, cell).container, 320, 280, true, + true); + } + mxe.consume(); + } + } + + // Configures automatic expand on mouseover + graph.panningHandler.autoExpand = true; + + // Installs context menu + graph.panningHandler.factoryMethod = mxUtils.bind(this, function(menu, cell, + evt) { + this.menus.createPopupMenu(menu, cell, evt); + }); + + // Initializes the outline + editor.outline.init(this.outlineContainer); + + // Hides context menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) { + graph.panningHandler.hideMenu(); + })); + + // Adds gesture handling (pinch to zoom) + if (mxClient.IS_TOUCH) { + mxEvent.addListener(graph.container, 'gesturechange', + mxUtils.bind(this, function(evt) { + graph.view.getDrawPane().setAttribute('transform', 'scale(' + evt.scale + + ')'); + graph.view.getOverlayPane().style.visibility = 'hidden'; + }) + ); + + mxEvent.addListener(graph.container, 'gestureend', + mxUtils.bind(this, function(evt) { + graph.view.getDrawPane().removeAttribute('transform'); + graph.zoomToCenter = true; + graph.zoom(evt.scale); + graph.view.getOverlayPane().style.visibility = 'visible'; + }) + ); + } + + // Create handler for key events + var keyHandler = this.createKeyHandler(editor); + + // Getter for key handler + this.getKeyHandler = function() { + return keyHandler; + }; + + // Updates the editor UI after the window has been resized + mxEvent.addListener(window, 'resize', mxUtils.bind(this, function() { + this.refresh(); + graph.sizeDidChange(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); + + // Updates action and menu states + this.init(); + this.open(); +}; + +/** + * Specifies the size of the split bar. + */ +EditorUi.prototype.splitSize = (mxClient.IS_TOUCH) ? 16 : 8; + +/** + * Specifies the height of the menubar. Default is 34. + */ +EditorUi.prototype.menubarHeight = 33; + +/** + * Specifies the height of the toolbar. Default is 36. + */ +EditorUi.prototype.toolbarHeight = 36; + +/** + * Specifies the height of the footer. Default is 28. + */ +EditorUi.prototype.footerHeight = 28; + +/** + * Specifies the position of the horizontal split bar. Default is 212. + */ +EditorUi.prototype.hsplitPosition = 204; + +/** + * Specifies the position of the vertical split bar. Default is 190. + */ +EditorUi.prototype.vsplitPosition = 190; + +/** + * Installs the listeners to update the action states. + */ +EditorUi.prototype.init = function() { + // Updates action states + this.addUndoListener(); + this.addSelectionListener(); + + // Overrides clipboard to update paste action state + var paste = this.actions.get('paste'); + + var updatePaste = function() { + paste.setEnabled(!mxClipboard.isEmpty()); + }; + + var mxClipboardCut = mxClipboard.cut; + mxClipboard.cut = function() { + mxClipboardCut.apply(this, arguments); + updatePaste(); + }; + + var mxClipboardCopy = mxClipboard.copy; + mxClipboard.copy = function() { + mxClipboardCopy.apply(this, arguments); + updatePaste(); + }; +}; + +/** + * Hook for allowing selection and context menu for certain events. + */ +EditorUi.prototype.isSelectionAllowed = function(evt) { + return false; +}; + +/** + * Opens the current diagram via the window.opener if one exists. + */ +EditorUi.prototype.open = function() { + // Cross-domain window access is not allowed in FF, so if we + // were opened from another domain then this will fail. + try { + if (window.opener != null && window.opener.openFile != null) { + window.opener.openFile.setConsumer(mxUtils.bind(this, function(xml, + filename) { + try { + var doc = mxUtils.parseXml(xml); + this.editor.setGraphXml(doc.documentElement); + this.editor.modified = false; + this.editor.undoManager.clear(); + + if (filename != null) { + this.editor.filename = filename; + } + } catch (e) { + mxUtils.alert(mxResources.get('invalidOrMissingFile') + ': ' + e.message); + } + })); + } + } catch (e) { + // ignore + } +}; + +/** + * Giuseppe Careri + * Opens the current diagram via string. + */ +EditorUi.prototype.openString = function(xml, filename, data) { + try { + var doc = mxUtils.parseXml(xml); + this.editor.setGraphXml(doc.documentElement); + this.editor.modified = false; + this.editor.undoManager.clear(); + + if (filename != null) { + this.editor.filename = filename; + } + + if (data != null) { + this.editor.data = data; + } + } catch (e) { + mxUtils.alert(mxResources.get('invalidOrMissingFile') + ': ' + e.message); + } +}; + +/** + * Saves As the current graph under the given project name. + */ +EditorUi.prototype.new = function(name) { + var editor = this.editor; + + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + name = encodeURIComponent(name); + + var xhr = new XMLHttpRequest(); + xhr.open("POST", SAVE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Project ' + JSON.parse(xhr.response).name + + ' is opening in new window!'); + setTimeout(function() { + window.open('square/project/' + JSON.parse(xhr.response).id, + '_blank'); + }, 1500); + } else { + editor.setStatus('Error creating project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('description=project_new&name=' + name); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error creating project'); + } + } else { + this.editor.setStatus('Error creating project'); + } +}; + + +/** + * Saves the current graph under the given project name. + */ +EditorUi.prototype.save = function(name) { + var editor = this.editor; + + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + + var xhr = new XMLHttpRequest(); + xhr.open("PUT", SAVE_URL + this.editor.data.id, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + editor.setStatus('Updated at ' + JSON.parse(xhr.response).updatedAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error saving project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('preproduction=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error saving file'); + } + } else { + this.editor.setStatus('Error saving file'); + } +}; + +/** + * Saves As the current graph under the given project name. + */ +EditorUi.prototype.saveAs = function(name) { + var editor = this.editor; + + if (name != null) { + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + name = encodeURIComponent(name); + + var xhr = new XMLHttpRequest(); + xhr.open("POST", SAVE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Project ' + JSON.parse(xhr.response).name + + ' is opening in new window!'); + setTimeout(function() { + window.open('square/project/' + JSON.parse(xhr.response).id, + '_blank'); + }, 1500); + } else { + editor.setStatus('Error cloning project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('description=project_cloned&name=' + name + + '&preproduction=' + xml + '&production=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error saving file'); + } + } else { + this.editor.setStatus('Error saving file'); + } +}; + +/** + * Plush the current graph under the given project name. + */ +EditorUi.prototype.validate = function(a, b) { + var graph = this.editor.graph; + for (var a = a != null ? a : graph.model.getRoot(), b = b != null ? b : {}, c = true, d = graph.model.getChildCount(a), e = 0; e < d; e++) { + var f = graph.model.getChildAt(a, e), + g = b; + graph.isValidRoot(f) && (g = {}); + g = this.validate(f, g); + g != null ? graph.setCellWarning(f, g.replace(/\n/g, "
")) : graph.setCellWarning(f, null); + c = c && g == null + } + + d = ""; + + //--- Giuseppe Careri - Modify 12/12/2013 - giuseppe.careri@gmail.com + if (graph.model.isVertex(a)) { + switch (a.value.nodeName) { + case 'start': + d = this.validateBlock('start') ? '' : "Only one Start block is allowed" + "\n"; + break; + case 'finally': + d = this.validateBlock('finally') ? '' : "Only one Finally block is allowed" + "\n"; + break; + case 'playback': + d = (a.value.getAttribute('file_id') > 0) ? "" : mxResources.get('noAudioSelected') + "\n"; + break; + case 'background': + case 'menu': + d = (a.value.getAttribute('file_id') > 0) ? "" : mxResources.get('noAudioSelected') + "\n"; + d += (a.value.getAttribute('variable_id') > 0) ? "" : mxResources.get('noVariableSelected') + "\n"; + break; + case 'getdigits': + d = (a.value.getAttribute('file_id') > 0) ? "" : mxResources.get('noAudioSelected') + "\n"; + d += (a.value.getAttribute('variable_id') > 0) ? "" : mxResources.get('noVariableSelected') + "\n"; + break; + case 'vswitch': + d = (a.value.getAttribute('variable') !== "") ? "" : mxResources.get('noVariableSelected') + "\n"; + break; + case 'database': + d = (a.value.getAttribute('odbc_id') > 0) ? "" : mxResources.get('noDatabaseSelected') + "\n"; + break; + case 'set': + case 'math': + d = (a.value.getAttribute('variable_id') > 0) ? "" : mxResources.get('noVariableSelected') + "\n"; + break; + case 'gotoc': + d = (a.value.getAttribute('extension') !== "") ? "" : mxResources.get('noExtensionSelected') + "\n"; + break; + case 'system': + case 'agi': + d = (a.value.getAttribute('command') !== "") ? "" : mxResources.get('noCommandSelected') + "\n"; + break; + case 'gotoif': + d = (a.value.getAttribute('condition') !== "") ? "" : mxResources.get('noConditionSelected') + "\n"; + break; + case 'saydigits': + d = (a.value.getAttribute('digits') !== "") ? "" : mxResources.get('noDigitsSelected') + "\n"; + break; + case 'saynumber': + d = (a.value.getAttribute('number') !== "") ? "" : mxResources.get('noNumberSelected') + "\n"; + break; + case 'sayphonetic': + d = (a.value.getAttribute('text') !== "") ? "" : mxResources.get('noTextSelected') + "\n"; + break; + case 'record': + d = (a.value.getAttribute('filename') !== "") ? "" : mxResources.get('noFileSelected') + "\n"; + break; + case 'goal': + d = (a.value.getAttribute('goalname') !== "") ? "" : mxResources.get('noGoalSelected') + "\n"; + break; + case 'ext_dial': + d = (a.value.getAttribute('phone') !== "") ? "" : mxResources.get('noIdentifierSelected') + "\n"; + break; + case 'dial': + d = (a.value.getAttribute('sip_id') > 0) ? "" : mxResources.get('noIdentifierSelected') + "\n"; + break; + case 'queue': + d = (a.value.getAttribute('queue_id') !== "-1") ? "" : mxResources.get('noQueueSelected') + "\n"; + break; + case 'callback': + d = (a.value.getAttribute('list_id') > 0) ? "" : mxResources.get('noListSelected') + "\n"; + break; + case 'gotoiftime': + d = (a.value.getAttribute('interval_id') > 0) ? "" : mxResources.get('noIntervalSelected') + "\n"; + break; + case 'gotoifmultitime': + d = (a.value.getAttribute('interval_id') != "") ? "" : mxResources.get('noIntervalSelected') + "\n"; + break; + case 'voicemail': + d = (a.value.getAttribute('mailbox') !== "") ? "" : mxResources.get('noBoxNumberSelected') + "\n"; + break; + case 'subproject': + d = (a.value.getAttribute('project_id') > 0) ? "" : mxResources.get('noProjectSelected') + "\n"; + break; + case 'tts': + d = (a.value.getAttribute('text') !== "") ? "" : mxResources.get('noTextSelected') + "\n"; + break; + case 'ispeechtts': + d = (a.value.getAttribute('text') !== "") ? "" : mxResources.get('noTextSelected') + "\n"; + d += (a.value.getAttribute('key') !== "") ? "" : mxResources.get('noKeySelected') + "\n"; + break; + case 'ispeechasr': + d = (a.value.getAttribute('key') !== "") ? "" : mxResources.get('noKeySelected') + "\n"; + break; + } + } + + if (graph.model.isEdge(a)) { + var z = graph.model.getCell(a.source.getId()); + switch (z.value.nodeName) { + case 'background': + var patt = /^[0-9]{1,45}$|^[i]{1}$|^[t]{1}|^[#]{1}|^[*]{1}$/; + d = d + ((patt.test(String(a.getValue()))) ? "" : mxResources.get('numberOrInvalidOrTimeout') + "\n"); + break; + case 'menu': + var patt = /^[0-9]{1,45}$|^[-]{1}$|^[i]{1}$|^[t]{1}|^[#]{1}|^[*]{1}$/; + var str = String(a.getValue()); + var res = str.split(","); + res.forEach(function(entry) { + d = d + ((patt.test(entry)) ? "" : mxResources.get('numberOrAll') + "\n"); + }); + break; + case 'getdigits': + var patt = /^(x|i|-)$/; + var str = String(a.getValue()); + d = d + ((patt.test(str)) ? "" : mxResources.get('numberOrInvalidOrDefault') + "\n"); + break; + case 'gotoif': + case 'gotoiftime': + case 'gotoifmultitime': + var patt = /^(true){1}$|^(false){1}$/; + d = d + ((patt.test(String(a.getValue()))) ? "" : mxResources.get('trueOrFalse') + "\n"); + break; + + } + } + // ----------------------------------------------------------------- + + + graph.isCellCollapsed(a) && !c && (d = d + ((mxResources.get(graph.containsValidationErrorsResource) || graph.containsValidationErrorsResource) + "\n")); + d = graph.model.isEdge(a) ? + d + (graph.getEdgeValidationError(a, graph.model.getTerminal(a, true), graph.model.getTerminal(a, false)) || "") : d + (graph.getCellValidationError(a) || ""); + e = graph.validateCell(a, b); + e != null && (d = d + e); + graph.model.getParent(a) == null && graph.view.validate(); + return d.length > 0 || !c ? d : null +}; +EditorUi.prototype.validateBlock = function(blockName) { + var graph = this.editor.graph; + var parent = graph.getDefaultParent(); + var count = 0; + // var model = graph.getModel(); + //We can also use model.getChildren(parent) + parent.children.forEach(function(n) { + if (graph.model.isVertex(n) && n.value.nodeName == blockName) { + count++; + } + }); + return count > 1 ? false : true; +} +EditorUi.prototype.publish = function(name) { + var editor = this.editor; + + if (name != null) { + var response = this.validate(); + if (response === null) { + + var xml = mxUtils.getPrettyXml(this.editor.getGraphXml()); + try { + if (useLocalStorage) { + if (localStorage.getItem(name) != null && + !mxUtils.confirm(mxResources.get('replace', [name]))) { + return; + } + + localStorage.setItem(name, xml); + this.editor.setStatus(mxResources.get('saved') + ' ' + new Date()); + } else { + console.log(xml.length); + console.log(MAX_REQUEST_SIZE); + if (xml.length < MAX_REQUEST_SIZE) { + xml = encodeURIComponent(xml); + + var xhr = new XMLHttpRequest(); + xhr.open("PUT", SAVE_URL + this.editor.data.id, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + editor.setStatus('Published at ' + JSON.parse(xhr.response).updatedAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error saving project: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('preproduction=' + xml + '&production=' + xml); + } else { + mxUtils.alert(mxResources.get('drawingTooLarge')); + mxUtils.popup(xml); + + return; + } + } + + this.editor.filename = name; + this.editor.modified = false; + } catch (e) { + this.editor.setStatus('Error publishing file'); + } + } else { + editor.setStatus('Error publishing project: '); + } + } else { + this.editor.setStatus('Error publishing file'); + } +}; + + +/** + * Create variable + */ +EditorUi.prototype.variable = function(name) { + var editor = this.editor; + + if (name != null) { + try { + + var xhr = new XMLHttpRequest(); + xhr.open("POST", VARIABLE_URL, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('Authorization', 'Bearer ' + editor.data.token); + xhr.onload = function(e) { + if (xhr.readyState === 4) { + if (xhr.status === 201) { + editor.setStatus('Variable created at ' + JSON.parse(xhr.response).createdAt + + ' (' + xhr.status + ' ' + xhr.statusText + ')'); + } else { + editor.setStatus('Error creating variable: ' + + JSON.parse(xhr.response).errors[0].message); + } + } + }; + xhr.onerror = function(e) { + mxUtils.alert(xhr.statusText); + }; + xhr.send('name=' + name); + } catch (e) { + this.editor.setStatus('Error creating variable'); + } + } else { + this.editor.setStatus('Error creating variable'); + } +}; + +/** + * Returns the URL for a copy of this editor with no state. + */ +EditorUi.prototype.getUrl = function(pathname) { + var href = (pathname != null) ? pathname : window.location.pathname; + var parms = (href.indexOf('?') > 0) ? 1 : 0; + + // Removes template URL parameter for new blank diagram + for (var key in urlParams) { + if (parms == 0) { + href += '?'; + } else { + href += '&'; + } + + href += key + '=' + urlParams[key]; + parms++; + } + + return href; +}; + +/** + * Updates the states of the given undo/redo items. + */ +EditorUi.prototype.addUndoListener = function() { + var undo = this.actions.get('undo'); + var redo = this.actions.get('redo'); + + var undoMgr = this.editor.undoManager; + + var undoListener = function() { + undo.setEnabled(undoMgr.canUndo()); + redo.setEnabled(undoMgr.canRedo()); + }; + + undoMgr.addListener(mxEvent.ADD, undoListener); + undoMgr.addListener(mxEvent.UNDO, undoListener); + undoMgr.addListener(mxEvent.REDO, undoListener); + undoMgr.addListener(mxEvent.CLEAR, undoListener); + + // Updates the button states once + undoListener(); +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +EditorUi.prototype.addSelectionListener = function() { + var selectionListener = mxUtils.bind(this, function() { + var graph = this.editor.graph; + var selected = !graph.isSelectionEmpty(); + var vertexSelected = false; + var edgeSelected = false; + + var cells = graph.getSelectionCells(); + + if (cells != null) { + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + + if (graph.getModel().isEdge(cell)) { + edgeSelected = true; + } + + if (graph.getModel().isVertex(cell)) { + vertexSelected = true; + } + + if (edgeSelected && vertexSelected) { + break; + } + } + } + + // Updates action states + var actions = ['cut', 'copy', 'delete', 'duplicate', 'bold', 'italic', + 'style', 'underline', 'toFront', 'toBack', 'dashed', 'rounded', + 'shadow', + 'tilt', 'autosize' + ]; + + for (var i = 0; i < actions.length; i++) { + this.actions.get(actions[i]).setEnabled(selected); + } + + this.actions.get('curved').setEnabled(edgeSelected); + this.actions.get('rotation').setEnabled(vertexSelected); + this.actions.get('wordWrap').setEnabled(vertexSelected); + this.actions.get('group').setEnabled(graph.getSelectionCount() > 1); + this.actions.get('ungroup').setEnabled(graph.getSelectionCount() == 1 && + graph.getModel().getChildCount(graph.getSelectionCell()) > 0); + var oneVertexSelected = vertexSelected && graph.getSelectionCount() == 1; + this.actions.get('removeFromGroup').setEnabled(oneVertexSelected && + graph.getModel().isVertex(graph.getModel().getParent(graph.getSelectionCell())) + ); + + // Updates menu states + var menus = ['fontFamily', 'fontSize', 'alignment', 'position', 'text', + 'format', + 'arrange', 'linewidth', 'spacing' + ]; + + for (var i = 0; i < menus.length; i++) { + this.menus.get(menus[i]).setEnabled(selected); + } + + menus = ['line', 'lineend', 'linestart']; + + for (var i = 0; i < menus.length; i++) { + this.menus.get(menus[i]).setEnabled(edgeSelected); + } + + this.actions.get('setAsDefaultEdge').setEnabled(edgeSelected); + + this.menus.get('align').setEnabled(graph.getSelectionCount() > 1); + this.menus.get('direction').setEnabled(vertexSelected || (edgeSelected && + graph.isLoop(graph.view.getState(graph.getSelectionCell())))); + this.menus.get('navigation').setEnabled(graph.foldingEnabled && ((graph.view + .currentRoot != null) || + (graph.getSelectionCount() == 1 && graph.isValidRoot(graph.getSelectionCell())) + )); + this.actions.get('home').setEnabled(graph.view.currentRoot != null); + this.actions.get('exitGroup').setEnabled(graph.view.currentRoot != null); + var groupEnabled = graph.getSelectionCount() == 1 && graph.isValidRoot( + graph.getSelectionCell()); + this.actions.get('enterGroup').setEnabled(groupEnabled); + this.actions.get('expand').setEnabled(groupEnabled); + this.actions.get('collapse').setEnabled(groupEnabled); + this.actions.get('editLink').setEnabled(graph.getSelectionCount() == 1); + this.actions.get('openLink').setEnabled(graph.getSelectionCount() == 1 && + graph.getLinkForCell(graph.getSelectionCell()) != null); + }); + + this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE, + selectionListener); + selectionListener(); +}; + +/** + * Refreshes the viewport. + */ +EditorUi.prototype.refresh = function() { + var quirks = mxClient.IS_IE && (document.documentMode == null || document.documentMode == + 5); + var w = this.container.clientWidth; + var h = this.container.clientHeight; + + if (this.container == document.body) { + w = document.body.clientWidth || document.documentElement.clientWidth; + h = (quirks) ? document.body.clientHeight || document.documentElement.clientHeight : + document.documentElement.clientHeight; + } + + var effHsplitPosition = Math.max(0, Math.min(this.hsplitPosition, w - this.splitSize - + 20)); + var effVsplitPosition = Math.max(0, Math.min(this.vsplitPosition, h - this.menubarHeight - + this.toolbarHeight - this.footerHeight - 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 tmp = this.menubarHeight + this.toolbarHeight; + + if (!mxClient.IS_QUIRKS) { + tmp += 1; + } + + this.sidebarContainer.style.top = tmp + 'px'; + this.sidebarContainer.style.width = effHsplitPosition + 'px'; + this.outlineContainer.style.width = effHsplitPosition + 'px'; + this.outlineContainer.style.height = effVsplitPosition + 'px'; + this.outlineContainer.style.bottom = this.footerHeight + 'px'; + this.diagramContainer.style.left = (effHsplitPosition + this.splitSize) + + 'px'; + this.diagramContainer.style.top = this.sidebarContainer.style.top; + this.footerContainer.style.height = this.footerHeight + 'px'; + this.footerContainer.style.display = 'none'; + this.hsplit.style.top = this.sidebarContainer.style.top; + this.hsplit.style.bottom = this.outlineContainer.style.bottom; + this.hsplit.style.left = effHsplitPosition + 'px'; + this.vsplit.style.width = this.sidebarContainer.style.width; + this.vsplit.style.bottom = (effVsplitPosition + this.footerHeight) + 'px'; + + if (quirks) { + this.menubarContainer.style.width = w + 'px'; + this.toolbarContainer.style.width = this.menubarContainer.style.width; + var sidebarHeight = (h - effVsplitPosition - this.splitSize - this.footerHeight - + this.menubarHeight - this.toolbarHeight); + this.sidebarContainer.style.height = sidebarHeight + 'px'; + this.diagramContainer.style.width = (w - effHsplitPosition - this.splitSize) + + 'px'; + var diagramHeight = (h - this.footerHeight - this.menubarHeight - this.toolbarHeight); + this.diagramContainer.style.height = diagramHeight + 'px'; + this.footerContainer.style.width = this.menubarContainer.style.width; + this.hsplit.style.height = diagramHeight + 'px'; + } else { + this.sidebarContainer.style.bottom = (effVsplitPosition + this.splitSize + + this.footerHeight) + 'px'; + this.diagramContainer.style.bottom = this.outlineContainer.style.bottom; + } +}; + +/** + * Creates the required containers. + */ +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'); + + // Sets static style for containers + 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.left = '0px'; + 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'; +}; + +/** + * Creates the required containers. + */ +EditorUi.prototype.createUi = function() { + // Creates menubar + this.menubar = this.menus.createMenubar(this.createDiv('geMenubar')); + this.menubarContainer.appendChild(this.menubar.container); + + // Creates toolbar + this.toolbar = this.createToolbar(this.createDiv('geToolbar')); + this.toolbarContainer.appendChild(this.toolbar.container); + + // Creates the sidebar + this.sidebar = this.createSidebar(this.sidebarContainer); + + // Creates the footer + this.footerContainer.appendChild(this.createFooter()); + + // Adds status bar in menubar + this.statusContainer = this.createStatusContainer(); + + // Connects the status bar to the editor status + this.editor.addListener('statusChanged', mxUtils.bind(this, function() { + this.setStatusText(this.editor.getStatus()); + })); + + this.setStatusText(this.editor.getStatus()); + this.menubar.container.appendChild(this.statusContainer); + + // Inserts into DOM + this.container.appendChild(this.menubarContainer); + this.container.appendChild(this.toolbarContainer); + this.container.appendChild(this.sidebarContainer); + this.container.appendChild(this.outlineContainer); + this.container.appendChild(this.diagramContainer); + this.container.appendChild(this.footerContainer); + this.container.appendChild(this.hsplit); + this.container.appendChild(this.vsplit); + + // HSplit + this.addSplitHandler(this.hsplit, true, 0, mxUtils.bind(this, function( + value) { + this.hsplitPosition = value; + this.refresh(); + this.editor.graph.sizeDidChange(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); + + // VSplit + this.addSplitHandler(this.vsplit, false, this.footerHeight, mxUtils.bind( + this, + function(value) { + this.vsplitPosition = value; + this.refresh(); + this.editor.outline.update(false); + this.editor.outline.outline.sizeDidChange(); + })); +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createStatusContainer = function() { + var container = document.createElement('a'); + container.className = 'geItem geStatus'; + + return container; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createStatusContainer = function() { + var container = document.createElement('a'); + container.className = 'geItem geStatus'; + + return container; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.setStatusText = function(value) { + this.statusContainer.innerHTML = value; +}; + +/** + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createToolbar = function(container) { + return new Toolbar(this, container); +}; + +/** + * Creates a new sidebar for the given container. + */ +EditorUi.prototype.createSidebar = function(container) { + return new Sidebar(this, container); +}; + +/** + * Creates and returns a new footer. + */ +EditorUi.prototype.createFooter = function() { + return this.createDiv('geFooter'); +}; + +/** + * Creates the actual toolbar for the toolbar container. + */ +EditorUi.prototype.createDiv = function(classname) { + var elt = document.createElement('div'); + elt.className = classname; + + return elt; +}; + +/** + * Creates the custom header. + */ +EditorUi.prototype.createHeader = function(classname) { + var elt = document.createElement(classname); + return elt; +}; + +/** + * Creates the custom header. + */ +EditorUi.prototype.createForm = function(classname) { + var elt = document.createElement('form'); + elt.className = classname; + + return elt; +}; + +/** + * Updates the states of the given undo/redo items. + */ +EditorUi.prototype.addSplitHandler = function(elt, horizontal, dx, onChange) { + var start = null; + var initial = null; + + function getValue() { + return parseInt(((horizontal) ? elt.style.left : elt.style.bottom)); + }; + + function moveHandler(evt) { + if (start != null) { + var pt = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + onChange(Math.max(0, initial + ((horizontal) ? (pt.x - start.x) : (start.y - + pt.y)) - dx)); + mxEvent.consume(evt); + } + }; + + function dropHandler(evt) { + moveHandler(evt); + start = null; + initial = null; + }; + + mxEvent.addGestureListeners(elt, function(evt) { + start = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + initial = getValue(); + mxEvent.consume(evt); + }); + + mxEvent.addListener(document, 'mousemove', moveHandler); + mxEvent.addListener(document, 'touchmove', moveHandler); + mxEvent.addListener(document, 'mouseup', dropHandler); + mxEvent.addListener(document, 'touchend', dropHandler); +}; + +/** + * Displays a print dialog. + */ +EditorUi.prototype.showDialog = function(elt, w, h, modal, closable, onClose) { + this.hideDialog(); + this.dialog = new Dialog(this, elt, w, (mxClient.IS_VML) ? h - 12 : h, + modal, + closable, onClose); +}; + +/** + * Displays a print dialog. + */ +EditorUi.prototype.hideDialog = function() { + if (this.dialog != null) { + this.dialog.close(); + this.dialog = null; + this.editor.graph.container.focus(); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +EditorUi.prototype.saveFile = function(forceDialog) { + if (!forceDialog && this.editor.filename != null) { + this.save(this.editor.getOrCreateFilename()); + } else { + this.showDialog(new SaveDialog(this).container, 300, 100, true, true); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +EditorUi.prototype.publishFile = function(forceDialog) { + if (!forceDialog && this.editor.filename != null) { + this.publish(this.editor.getOrCreateFilename()); + } else { + //this.showDialog(new SaveDialog(this).container, 300, 100, true, true); + } +}; + +/** + * Executes the given layout. + */ +EditorUi.prototype.executeLayout = function(layout, animate, ignoreChildCount) { + var graph = this.editor.graph; + var cell = graph.getSelectionCell(); + + // Allow global overridding of animation + animate = this.animate != null ? this.animate : animate; + + graph.getModel().beginUpdate(); + try { + layout.execute(graph.getDefaultParent(), cell); + } catch (e) { + throw e; + } finally { + // Animates the changes in the graph model except + // for Camino, where animation is too slow + if (animate && navigator.userAgent.indexOf('Camino') < 0) { + // New API for animating graph layout results asynchronously + var morph = new mxMorphing(graph); + morph.addListener(mxEvent.DONE, mxUtils.bind(this, function() { + graph.getModel().endUpdate(); + })); + + morph.startAnimation(); + } else { + graph.getModel().endUpdate(); + } + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +EditorUi.prototype.createKeyHandler = function(editor) { + var graph = this.editor.graph; + var keyHandler = new mxKeyHandler(graph); + + // Routes command-key to control-key on Mac + keyHandler.isControlDown = function(evt) { + return mxEvent.isControlDown(evt) || (mxClient.IS_MAC && evt.metaKey); + }; + + // Helper function to move cells with the cursor keys + function nudge(keyCode) { + if (!graph.isSelectionEmpty()) { + var dx = 0; + var dy = 0; + + if (keyCode == 37) { + dx = -1; + } else if (keyCode == 38) { + dy = -1; + } else if (keyCode == 39) { + dx = 1; + } else if (keyCode == 40) { + dy = 1; + } + + graph.moveCells(graph.getSelectionCells(), dx, dy); + graph.scrollCellToVisible(graph.getSelectionCell()); + } + }; + + // Binds keystrokes to actions + var bindAction = mxUtils.bind(this, function(code, control, key, shift) { + var action = this.actions.get(key); + + if (action != null) { + var f = function() { + if (action.enabled) { + action.funct(); + } + }; + + if (control) { + if (shift) { + keyHandler.bindControlShiftKey(code, f); + } else { + keyHandler.bindControlKey(code, f); + } + } else { + if (shift) { + keyHandler.bindShiftKey(code, f); + } else { + keyHandler.bindKey(code, f); + } + } + } + }); + + var ui = this; + var keyHandleEscape = keyHandler.escape; + keyHandler.escape = function(evt) { + ui.hideDialog(); + keyHandleEscape.apply(this, arguments); + }; + + // Ignores enter keystroke. Remove this line if you want the + // enter keystroke to stop editing. + keyHandler.enter = function() {}; + keyHandler.bindKey(8, function() { + graph.foldCells(true); + }); // Backspace + keyHandler.bindKey(13, function() { + graph.foldCells(false); + }); // Enter + keyHandler.bindKey(33, function() { + graph.exitGroup(); + }); // Page Up + keyHandler.bindKey(34, function() { + graph.enterGroup(); + }); // Page Down + keyHandler.bindKey(36, function() { + graph.home(); + }); // Home + keyHandler.bindKey(35, function() { + graph.refresh(); + }); // End + keyHandler.bindKey(37, function() { + nudge(37); + }); // Left arrow + keyHandler.bindKey(38, function() { + nudge(38); + }); // Up arrow + keyHandler.bindKey(39, function() { + nudge(39); + }); // Right arrow + keyHandler.bindKey(40, function() { + nudge(40); + }); // Down arrow + keyHandler.bindKey(113, function() { + graph.startEditingAtCell(); + }); + bindAction(46, false, 'delete'); // Delete + bindAction(82, true, 'tilt'); // Ctrl+R + bindAction(83, true, 'save'); // Ctrl+S + bindAction(83, true, 'saveAs', true); // Ctrl+Shift+S + bindAction(107, false, 'zoomIn'); // Add + bindAction(109, false, 'zoomOut'); // Subtract + bindAction(65, true, 'selectAll'); // Ctrl+A + bindAction(86, true, 'selectVertices', true); // Ctrl+Shift+V + bindAction(69, true, 'selectEdges', true); // Ctrl+Shift+E + bindAction(69, true, 'export'); // Ctrl+Shift+E + bindAction(66, true, 'toBack'); // Ctrl+B + bindAction(70, true, 'toFront'); // Ctrl+F + bindAction(68, true, 'duplicate'); // Ctrl+D + bindAction(90, true, 'undo'); // Ctrl+Z + bindAction(89, true, 'redo'); // Ctrl+Y + bindAction(88, true, 'cut'); // Ctrl+X + bindAction(67, true, 'copy'); // Ctrl+C + bindAction(81, true, 'connect'); // Ctrl+Q + bindAction(86, true, 'paste'); // Ctrl+V + bindAction(71, true, 'group'); // Ctrl+G + bindAction(71, true, 'grid', true); // Ctrl+Shift+G + bindAction(85, true, 'ungroup'); // Ctrl+U + bindAction(112, false, 'about'); // F1 + bindAction(80, true, 'publish', true); // Ctrl+Shift+P + + return keyHandler; +}; + +/** + * Giuseppe Careri + * Creates a new toolbar for the given container. + */ +EditorUi.prototype.createMultiplicities = function(graph, cells, source, + target) { + for (var i = 0; i < cells.length; i++) { + + graph.push(new mxMultiplicity(true, cells[i], null, null, source[i][0], + source[i][1], null, mxResources.get(cells[i]) + mxResources.get('musthave') + source[i][0] + mxResources.get('outgoingedge'), null)); + graph.push(new mxMultiplicity(false, cells[i], null, null, target[i][0], + target[i][1], null, mxResources.get(cells[i]) + mxResources.get('musthave') + target[i][0] + mxResources.get('incomingedge'), null)); + }; +}; diff --git a/public/assets/plugins/square/js/Graph.js b/public/assets/plugins/square/js/Graph.js index 476abae..46f34e4 100644 --- a/public/assets/plugins/square/js/Graph.js +++ b/public/assets/plugins/square/js/Graph.js @@ -1 +1,748 @@ -var _0x16e3=["\x63\x61\x6C\x6C","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x73\x65\x74\x44\x72\x6F\x70\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x50\x61\x6E\x6E\x69\x6E\x67","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x4C\x6F\x6F\x70\x73","\x73\x65\x74\x4D\x75\x6C\x74\x69\x67\x72\x61\x70\x68","\x61\x6C\x6C\x6F\x77\x41\x75\x74\x6F\x50\x61\x6E\x6E\x69\x6E\x67","\x72\x65\x73\x65\x74\x45\x64\x67\x65\x73\x4F\x6E\x43\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x43\x68\x69\x6C\x64\x72\x65\x6E","\x74\x61\x72\x67\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x41\x6C\x6C\x6F\x77\x44\x61\x6E\x67\x6C\x69\x6E\x67\x45\x64\x67\x65\x73","\x73\x65\x74\x43\x72\x65\x61\x74\x65\x54\x61\x72\x67\x65\x74","\x69\x73\x56\x61\x6C\x69\x64\x53\x6F\x75\x72\x63\x65","\x61\x70\x70\x6C\x79","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x6E\x65\x63\x74","\x32","\x61\x6C\x74\x65\x72\x6E\x61\x74\x65\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x76\x65\x72\x74\x69\x63\x61\x6C","\x6C\x6F\x61\x64\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x67\x65\x74\x52\x75\x62\x62\x65\x72\x62\x61\x6E\x64","\x63\x75\x72\x73\x6F\x72","\x73\x74\x79\x6C\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x70\x6F\x69\x6E\x74\x65\x72","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x64\x65\x66\x61\x75\x6C\x74","\x69\x73\x48\x74\x6D\x6C\x4C\x61\x62\x65\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x76\x69\x65\x77","\x67\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65","\x68\x74\x6D\x6C","\x31","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x77\x72\x61\x70","\x67\x65\x74\x4C\x61\x62\x65\x6C\x56\x61\x6C\x75\x65","\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x68\x74\x6D\x6C\x45\x6E\x74\x69\x74\x69\x65\x73","\x69\x73\x43\x65\x6C\x6C\x4C\x6F\x63\x6B\x65\x64","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64\x54\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x74\x61\x70\x41\x6E\x64\x48\x6F\x6C\x64","\x61\x63\x74\x69\x76\x65","\x67\x72\x61\x70\x68","\x67\x65\x74\x47\x72\x61\x70\x68\x58","\x67\x65\x74\x47\x72\x61\x70\x68\x59","\x73\x74\x61\x72\x74","\x70\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x63\x65\x6C\x6C","\x69\x73\x43\x65\x6C\x6C\x53\x65\x6C\x65\x63\x74\x65\x64","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x72\x65\x6D\x6F\x76\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x69\x6E\x69\x74\x54\x6F\x75\x63\x68","\x65\x78\x74\x65\x6E\x64","\x6D\x69\x6E\x46\x69\x74\x53\x63\x61\x6C\x65","\x6D\x61\x78\x46\x69\x74\x53\x63\x61\x6C\x65","\x67\x65\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x2F\x64\x65\x66\x61\x75\x6C\x74\x2E\x78\x6D\x6C","\x6C\x6F\x61\x64","\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x67\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x64\x65\x63\x6F\x64\x65","\x66\x6C\x69\x70\x45\x64\x67\x65","\x67\x65\x74\x56\x61\x6C\x75\x65","\x45\x4C\x42\x4F\x57\x5F\x48\x4F\x52\x49\x5A\x4F\x4E\x54\x41\x4C","\x45\x4C\x42\x4F\x57\x5F\x56\x45\x52\x54\x49\x43\x41\x4C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x69\x73\x45\x64\x67\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x63\x6C\x6F\x6E\x65\x43\x65\x6C\x6C\x73","\x67\x65\x6F\x6D\x65\x74\x72\x79","\x70\x6F\x69\x6E\x74\x73","\x67\x65\x74\x53\x74\x79\x6C\x65","\x73\x65\x74\x53\x74\x79\x6C\x65","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x53\x74\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x53\x74\x61\x74\x65","\x66\x61\x63\x74\x6F\x72\x79\x4D\x65\x74\x68\x6F\x64","\x69\x73\x43\x65\x6C\x6C\x46\x6F\x6C\x64\x61\x62\x6C\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x77\x69\x6D\x6C\x61\x6E\x65","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x63\x72\x65\x61\x74\x65\x47\x72\x6F\x75\x70\x43\x65\x6C\x6C","\x67\x72\x6F\x75\x70","\x67\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x46\x6F\x72\x43\x65\x6C\x6C","","\x69\x73\x56\x65\x72\x74\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x5F","\x6E\x6F\x64\x65\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x67\x65\x74","\x63\x6F\x6E\x76\x65\x72\x74\x56\x61\x6C\x75\x65\x54\x6F\x53\x74\x72\x69\x6E\x67","\x6F\x62\x6A\x65\x63\x74","\x6C\x61\x62\x65\x6C","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x65\x6C\x6C\x4C\x61\x62\x65\x6C\x43\x68\x61\x6E\x67\x65\x64","\x63\x6C\x6F\x6E\x65\x4E\x6F\x64\x65","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x73\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x55\x73\x65\x72\x4F\x62\x6A\x65\x63\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6E\x6B","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x73\x65\x74\x56\x61\x6C\x75\x65","\x6D\x6F\x64\x65\x6C","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x6D\x61\x72\x6B\x65\x72","\x66\x69\x72\x73\x74","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x75\x70\x64\x61\x74\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x67\x72\x61\x70\x68\x58","\x67\x72\x61\x70\x68\x59","\x67\x65\x74\x43\x65\x6C\x6C\x41\x74","\x73\x74\x61\x74\x65","\x73\x68\x61\x70\x65","\x6E\x6F\x64\x65","\x66\x69\x72\x65\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74","\x4D\x4F\x55\x53\x45\x5F\x44\x4F\x57\x4E","\x69\x73\x4D\x65\x6E\x75\x53\x68\x6F\x77\x69\x6E\x67","\x67\x65\x74\x43\x65\x6C\x6C","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x4D\x4F\x55\x53\x45\x5F\x55\x50","\x69\x73\x45\x64\x69\x74\x69\x6E\x67","\x67\x65\x74\x45\x76\x65\x6E\x74","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x70\x6F\x70\x75\x70","\x63\x6F\x6E\x73\x75\x6D\x65","\x4D\x4F\x55\x53\x45\x5F\x4D\x4F\x56\x45","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x72\x6F\x74\x61\x74\x69\x6F\x6E\x45\x6E\x61\x62\x6C\x65\x64","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x54\x6F\x70","\x62\x61\x73\x65\x53\x70\x61\x63\x69\x6E\x67\x42\x6F\x74\x74\x6F\x6D","\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x4C\x41\x42\x45\x4C\x5F\x48\x41\x4E\x44\x4C\x45\x5F\x53\x49\x5A\x45","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x74\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x67\x72\x69\x64\x53\x69\x7A\x65","\x73\x65\x6C\x65\x63\x74\x4F\x6E\x50\x6F\x70\x75\x70","\x75\x73\x65\x4C\x65\x66\x74\x42\x75\x74\x74\x6F\x6E\x46\x6F\x72\x50\x61\x6E\x6E\x69\x6E\x67","\x69\x73\x50\x61\x6E\x6E\x69\x6E\x67\x54\x72\x69\x67\x67\x65\x72","\x69\x67\x6E\x6F\x72\x65\x43\x65\x6C\x6C","\x69\x73\x43\x6F\x6E\x74\x72\x6F\x6C\x44\x6F\x77\x6E","\x69\x73\x53\x68\x69\x66\x74\x44\x6F\x77\x6E","\x75\x73\x65\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x69\x73\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x6D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x64\x65\x6C\x61\x79\x65\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x43\x65\x6C\x6C\x73","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x64\x62\x6C\x43\x6C\x69\x63\x6B","\x63\x6F\x6E\x76\x65\x72\x74\x50\x6F\x69\x6E\x74","\x78","\x79","\x2F\x74\x6F\x75\x63\x68\x2D\x68\x61\x6E\x64\x6C\x65\x2E\x70\x6E\x67","\x68\x61\x6E\x64\x6C\x65\x49\x6D\x61\x67\x65","\x73\x69\x7A\x65\x72\x49\x6D\x61\x67\x65","\x73\x72\x63","\x2F\x74\x6F\x75\x63\x68\x2D\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x2E\x70\x6E\x67","\x69\x6E\x69\x74","\x69\x73\x43\x65\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x49\x6D\x67","\x63\x72\x65\x61\x74\x65\x49\x6D\x61\x67\x65","\x77\x69\x64\x74\x68","\x32\x39\x70\x78","\x68\x65\x69\x67\x68\x74","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x74\x69\x74\x6C\x65","\x72\x65\x64\x69\x72\x65\x63\x74\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73","\x70\x61\x64\x64\x69\x6E\x67","\x32\x70\x78","\x69\x73\x4D\x6F\x75\x73\x65\x44\x6F\x77\x6E","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x72\x65\x64\x72\x61\x77\x54\x6F\x6F\x6C\x73","\x72\x65\x64\x72\x61\x77","\x73\x69\x6E\x67\x6C\x65\x53\x69\x7A\x65\x72","\x6C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x70\x78","\x74\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x2F\x63\x6F\x6E\x6E\x65\x63\x74\x6F\x72\x2E\x70\x6E\x67","\x63\x6F\x6E\x6E\x65\x63\x74\x49\x6D\x61\x67\x65","\x49\x53\x5F\x49\x45","\x49\x53\x5F\x53\x56\x47","\x64\x69\x76","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x63\x65\x6E\x74\x65\x72","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x64\x69\x73\x70\x6C\x61\x79","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x69\x6E\x6C\x69\x6E\x65","\x69\x6E\x6C\x69\x6E\x65\x2D\x62\x6C\x6F\x63\x6B","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E"];Graph=function(_0xde98x1,_0xde98x2,_0xde98x3,_0xde98x4){mxGraph[_0x16e3[0]](this,_0xde98x1,_0xde98x2,_0xde98x3,_0xde98x4);this[_0x16e3[1]](true);this[_0x16e3[2]](false);this[_0x16e3[3]](true);this[_0x16e3[4]](!mxClient.IS_TOUCH);this[_0x16e3[5]](false);this[_0x16e3[6]](false);this[_0x16e3[7]]=true;this[_0x16e3[8]]=false;this[_0x16e3[9]]=false;this[_0x16e3[11]][_0x16e3[10]]=true;this[_0x16e3[12]](false);this[_0x16e3[11]][_0x16e3[13]](false);this[_0x16e3[11]][_0x16e3[14]]=function(){return mxConnectionHandler[_0x16e3[16]][_0x16e3[14]][_0x16e3[15]](this,arguments)&&urlParams[_0x16e3[17]]!=_0x16e3[18]};this[_0x16e3[19]]=_0x16e3[20];if(_0xde98x4==null){this[_0x16e3[21]]()};var _0xde98x5= new mxRubberband(this);this[_0x16e3[22]]=function(){return _0xde98x5};this[_0x16e3[29]][_0x16e3[28]](mxEvent.PAN_START,mxUtils[_0x16e3[27]](this,function(){this[_0x16e3[25]][_0x16e3[24]][_0x16e3[23]]=_0x16e3[26]}));this[_0x16e3[29]][_0x16e3[28]](mxEvent.PAN_END,mxUtils[_0x16e3[27]](this,function(){this[_0x16e3[25]][_0x16e3[24]][_0x16e3[23]]=_0x16e3[30]}));this[_0x16e3[31]]=function(_0xde98x6){var _0xde98x7=this[_0x16e3[33]][_0x16e3[32]](_0xde98x6);var _0xde98x8=(_0xde98x7!=null)?_0xde98x7[_0x16e3[24]]:this[_0x16e3[34]](_0xde98x6);return _0xde98x8[_0x16e3[35]]==_0x16e3[36]||_0xde98x8[_0x16e3[37]]==_0x16e3[38]};this[_0x16e3[40]][_0x16e3[39]]=function(_0xde98x7){var _0xde98x9=mxCellRenderer[_0x16e3[16]][_0x16e3[39]][_0x16e3[15]](this,arguments);if(_0xde98x7[_0x16e3[24]][_0x16e3[37]]==_0x16e3[38]&&_0xde98x7[_0x16e3[24]][_0x16e3[35]]!=1){_0xde98x9=mxUtils[_0x16e3[41]](_0xde98x9,false)};return _0xde98x9};this[_0x16e3[42]]=function(_0xde98x6){return false};this[_0x16e3[11]][_0x16e3[43]]=16;var _0xde98xa=this[_0x16e3[11]][_0x16e3[44]];this[_0x16e3[11]][_0x16e3[44]]=function(_0xde98xb,_0xde98x7){if(_0xde98x7==null){if(!this[_0x16e3[46]][_0x16e3[29]][_0x16e3[45]]){_0xde98x5[_0x16e3[49]](_0xde98xb[_0x16e3[47]](),_0xde98xb[_0x16e3[48]]());this[_0x16e3[46]][_0x16e3[29]][_0x16e3[50]]=false}}else {if(tapAndHoldStartsConnection){_0xde98xa[_0x16e3[15]](this,arguments)}else {if(this[_0x16e3[46]][_0x16e3[52]](_0xde98x7[_0x16e3[51]])&&this[_0x16e3[46]][_0x16e3[53]]()>1){this[_0x16e3[46]][_0x16e3[54]](_0xde98x7[_0x16e3[51]])}}}};if(touchStyle){this[_0x16e3[55]]()}};mxUtils[_0x16e3[56]](Graph,mxGraph);Graph[_0x16e3[16]][_0x16e3[57]]=null;Graph[_0x16e3[16]][_0x16e3[58]]=null;Graph[_0x16e3[16]][_0x16e3[21]]=function(){var _0xde98xc=mxUtils[_0x16e3[61]](STYLE_PATH+_0x16e3[60])[_0x16e3[59]]();var _0xde98xd= new mxCodec(_0xde98xc[_0x16e3[62]]);_0xde98xd[_0x16e3[64]](_0xde98xc,this[_0x16e3[63]]())};Graph[_0x16e3[16]][_0x16e3[65]]=function(_0xde98xe){if(_0xde98xe!=null){var _0xde98x7=this[_0x16e3[33]][_0x16e3[32]](_0xde98xe);var _0xde98x8=(_0xde98x7!=null)?_0xde98x7[_0x16e3[24]]:this[_0x16e3[34]](_0xde98xe);if(_0xde98x8!=null){var _0xde98xf=mxUtils[_0x16e3[66]](_0xde98x8,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL);var _0xde98x10=(_0xde98xf==mxConstants[_0x16e3[67]])?mxConstants[_0x16e3[68]]:mxConstants[_0x16e3[67]];this[_0x16e3[69]](mxConstants.STYLE_ELBOW,_0xde98x10,[_0xde98xe])}}};Graph[_0x16e3[16]][_0x16e3[70]]=function(_0xde98x6){if(_0xde98x6!=null&&this[_0x16e3[72]]()[_0x16e3[71]](_0xde98x6)){var _0xde98x11=this[_0x16e3[72]]()[_0x16e3[73]]([_0xde98x6])[0];if(_0xde98x11[_0x16e3[74]]!=null){_0xde98x11[_0x16e3[74]][_0x16e3[75]]=null};var _0xde98x8=_0xde98x11[_0x16e3[76]]();_0xde98x8=mxUtils[_0x16e3[77]](_0xde98x8,mxConstants.STYLE_ENTRY_X,null);_0xde98x8=mxUtils[_0x16e3[77]](_0xde98x8,mxConstants.STYLE_ENTRY_Y,null);_0xde98x8=mxUtils[_0x16e3[77]](_0xde98x8,mxConstants.STYLE_EXIT_X,null);_0xde98x8=mxUtils[_0x16e3[77]](_0xde98x8,mxConstants.STYLE_EXIT_Y,null);_0xde98x11[_0x16e3[77]](_0xde98x8);this[_0x16e3[11]][_0x16e3[78]]=function(_0xde98xb){return this[_0x16e3[46]][_0x16e3[33]][_0x16e3[79]](_0xde98x11)};this[_0x16e3[11]][_0x16e3[80]]=function(){return this[_0x16e3[46]][_0x16e3[73]]([_0xde98x11])[0]}}};Graph[_0x16e3[16]][_0x16e3[81]]=function(_0xde98x6){return this[_0x16e3[82]]&&this[_0x16e3[83]](_0xde98x6)};Graph[_0x16e3[16]][_0x16e3[84]]=function(_0xde98x6){return this[_0x16e3[83]](_0xde98x6)};Graph[_0x16e3[16]][_0x16e3[85]]=function(){var _0xde98x12=mxGraph[_0x16e3[16]][_0x16e3[85]][_0x16e3[15]](this,arguments);_0xde98x12[_0x16e3[77]](_0x16e3[86]);return _0xde98x12};Graph[_0x16e3[16]][_0x16e3[87]]=function(_0xde98x6){var _0xde98x13=_0x16e3[88];if(this[_0x16e3[72]]()[_0x16e3[89]](_0xde98x6)){_0xde98x13+=mxResources[_0x16e3[93]](_0x16e3[90]+_0xde98x6[_0x16e3[92]][_0x16e3[91]])}else {if(this[_0x16e3[72]]()[_0x16e3[71]](_0xde98x6)){_0xde98x13=mxGraph[_0x16e3[16]][_0x16e3[87]][_0x16e3[15]](this,arguments)}};return _0xde98x13};Graph[_0x16e3[16]][_0x16e3[94]]=function(_0xde98x6){if(_0xde98x6[_0x16e3[92]]!=null&& typeof (_0xde98x6[_0x16e3[92]])==_0x16e3[95]){return _0xde98x6[_0x16e3[92]][_0x16e3[97]](_0x16e3[96])};return mxGraph[_0x16e3[16]][_0x16e3[94]][_0x16e3[15]](this,arguments)};Graph[_0x16e3[16]][_0x16e3[98]]=function(_0xde98x6,_0xde98x10,_0xde98x14){if(_0xde98x6[_0x16e3[92]]!=null&& typeof (_0xde98x6[_0x16e3[92]])==_0x16e3[95]){var _0xde98x15=_0xde98x6[_0x16e3[92]][_0x16e3[99]](true);_0xde98x15[_0x16e3[100]](_0x16e3[96],_0xde98x10);_0xde98x10=_0xde98x15};mxGraph[_0x16e3[16]][_0x16e3[98]][_0x16e3[15]](this,arguments)};Graph[_0x16e3[16]][_0x16e3[101]]=function(_0xde98x6,_0xde98x16){var _0xde98x10=null;if(_0xde98x6[_0x16e3[92]]!=null&& typeof (_0xde98x6[_0x16e3[92]])==_0x16e3[95]){_0xde98x10=_0xde98x6[_0x16e3[92]][_0x16e3[99]](true)}else {var _0xde98x17=mxUtils[_0x16e3[102]]();_0xde98x10=_0xde98x17[_0x16e3[104]](_0x16e3[103]);_0xde98x10[_0x16e3[100]](_0x16e3[96],_0xde98x6[_0x16e3[92]])};if(_0xde98x16!=null&&_0xde98x16[_0x16e3[105]]>0){_0xde98x10[_0x16e3[100]](_0x16e3[106],_0xde98x16)}else {_0xde98x10[_0x16e3[107]](_0x16e3[106])};this[_0x16e3[109]][_0x16e3[108]](_0xde98x6,_0xde98x10)};Graph[_0x16e3[16]][_0x16e3[110]]=function(_0xde98x6){if(_0xde98x6[_0x16e3[92]]!=null&& typeof (_0xde98x6[_0x16e3[92]])==_0x16e3[95]){return _0xde98x6[_0x16e3[92]][_0x16e3[97]](_0x16e3[106])};return null};Graph[_0x16e3[16]][_0x16e3[55]]=function(){this[_0x16e3[11]][_0x16e3[112]][_0x16e3[111]]=function(){return this[_0x16e3[46]][_0x16e3[11]][_0x16e3[113]]!=null};this[_0x16e3[28]](mxEvent.START_EDITING,function(_0xde98x18,_0xde98x19){this[_0x16e3[29]][_0x16e3[114]]()});var _0xde98x1a=false;var _0xde98x1b=null;this[_0x16e3[115]]=function(_0xde98xb){mxGraph[_0x16e3[16]][_0x16e3[115]][_0x16e3[15]](this,arguments);if(_0xde98xb[_0x16e3[32]]()==null){var _0xde98x6=this[_0x16e3[118]](_0xde98xb[_0x16e3[116]],_0xde98xb[_0x16e3[117]]);if(this[_0x16e3[72]]()[_0x16e3[71]](_0xde98x6)){_0xde98xb[_0x16e3[119]]=this[_0x16e3[33]][_0x16e3[32]](_0xde98x6);if(_0xde98xb[_0x16e3[119]]!=null&&_0xde98xb[_0x16e3[119]][_0x16e3[120]]!=null){this[_0x16e3[25]][_0x16e3[24]][_0x16e3[23]]=_0xde98xb[_0x16e3[119]][_0x16e3[120]][_0x16e3[121]][_0x16e3[24]][_0x16e3[23]]}}};if(_0xde98xb[_0x16e3[32]]()==null){this[_0x16e3[25]][_0x16e3[24]][_0x16e3[23]]=_0x16e3[30]}};this[_0x16e3[122]]=function(_0xde98x1c,_0xde98xb,_0xde98x18){if(_0xde98x1c==mxEvent[_0x16e3[123]]){if(!this[_0x16e3[29]][_0x16e3[124]]()){_0xde98x1b=_0xde98xb[_0x16e3[125]]();_0xde98x1a=(_0xde98x1b!=null)?this[_0x16e3[52]](_0xde98x1b):this[_0x16e3[126]]()}else {_0xde98x1a=false;_0xde98x1b=null}}else {if(_0xde98x1c==mxEvent[_0x16e3[127]]){if(_0xde98x1a&&!this[_0x16e3[128]]()){if(!this[_0x16e3[29]][_0x16e3[124]]()){var _0xde98x1d=mxEvent[_0x16e3[130]](_0xde98xb[_0x16e3[129]]());var _0xde98x1e=mxEvent[_0x16e3[131]](_0xde98xb[_0x16e3[129]]());this[_0x16e3[29]][_0x16e3[132]](_0xde98x1d+16,_0xde98x1e,_0xde98x1b,_0xde98xb[_0x16e3[129]]())};_0xde98x1a=false;_0xde98x1b=null;_0xde98xb[_0x16e3[133]]();return};_0xde98x1a=false;_0xde98x1b=null}};mxGraph[_0x16e3[16]][_0x16e3[122]][_0x16e3[15]](this,arguments);if(_0xde98x1c==mxEvent[_0x16e3[134]]&&_0xde98xb[_0x16e3[135]]()){_0xde98x1a=false;_0xde98x1b=null}}};(function(){mxVertexHandler[_0x16e3[16]][_0x16e3[136]]=true;mxText[_0x16e3[16]][_0x16e3[137]]=5;mxText[_0x16e3[16]][_0x16e3[138]]=1;if(touchStyle){mxConstants[_0x16e3[139]]=16;mxConstants[_0x16e3[140]]=7;if(mxClient[_0x16e3[141]]){mxVertexHandler[_0x16e3[16]][_0x16e3[142]]=4;mxEdgeHandler[_0x16e3[16]][_0x16e3[142]]=6;Graph[_0x16e3[16]][_0x16e3[142]]=14;Graph[_0x16e3[16]][_0x16e3[143]]=20;mxPanningHandler[_0x16e3[16]][_0x16e3[144]]=false;mxPanningHandler[_0x16e3[16]][_0x16e3[145]]=true;mxPanningHandler[_0x16e3[16]][_0x16e3[146]]=function(_0xde98xb){var _0xde98x19=_0xde98xb[_0x16e3[129]]();return (this[_0x16e3[145]]&&(this[_0x16e3[147]]||_0xde98xb[_0x16e3[32]]()==null))||(mxEvent[_0x16e3[148]](_0xde98x19)&&mxEvent[_0x16e3[149]](_0xde98x19))||(this[_0x16e3[150]]&&mxEvent[_0x16e3[151]](_0xde98x19))}};var _0xde98x1f=mxGraphHandler[_0x16e3[16]][_0x16e3[152]];mxGraphHandler[_0x16e3[16]][_0x16e3[152]]=function(_0xde98x18,_0xde98xb){_0xde98x1f[_0x16e3[15]](this,arguments);if(this[_0x16e3[46]][_0x16e3[52]](_0xde98xb[_0x16e3[125]]())&&this[_0x16e3[46]][_0x16e3[53]]()>1){this[_0x16e3[153]]=false}};Graph[_0x16e3[16]][_0x16e3[154]]=function(_0xde98x1){this[_0x16e3[155]]= new mxTooltipHandler(this);this[_0x16e3[155]][_0x16e3[156]](false);this[_0x16e3[157]]= new mxSelectionCellsHandler(this);this[_0x16e3[29]]= new mxPanningHandler(this);this[_0x16e3[29]][_0x16e3[158]]=false;this[_0x16e3[11]]= new mxConnectionHandler(this);this[_0x16e3[11]][_0x16e3[156]](false);this[_0x16e3[159]]= new mxGraphHandler(this)};mxConnectionHandler[_0x16e3[16]][_0x16e3[160]]=function(_0xde98xe,_0xde98x20){if(touchStyle&&_0xde98x20!=null){this[_0x16e3[46]][_0x16e3[161]](_0xde98x20)}else {this[_0x16e3[46]][_0x16e3[161]](_0xde98xe)}};var _0xde98x21=mxGraph[_0x16e3[16]][_0x16e3[162]];Graph[_0x16e3[16]][_0x16e3[162]]=function(_0xde98x19,_0xde98x6){if(_0xde98x6==null){var _0xde98x22=mxUtils[_0x16e3[163]](this[_0x16e3[25]],mxEvent[_0x16e3[130]](_0xde98x19),mxEvent[_0x16e3[131]](_0xde98x19));_0xde98x6=this[_0x16e3[118]](_0xde98x22[_0x16e3[164]],_0xde98x22[_0x16e3[165]])};_0xde98x21[_0x16e3[0]](this,_0xde98x19,_0xde98x6)};var _0xde98x23= new mxImage(IMAGE_PATH+_0x16e3[166],16,16);mxVertexHandler[_0x16e3[16]][_0x16e3[167]]=_0xde98x23;mxEdgeHandler[_0x16e3[16]][_0x16e3[167]]=_0xde98x23;mxOutline[_0x16e3[16]][_0x16e3[168]]=_0xde98x23; new Image()[_0x16e3[169]]=_0xde98x23[_0x16e3[169]];var _0xde98x24=IMAGE_PATH+_0x16e3[170];var _0xde98x25=mxVertexHandler[_0x16e3[16]][_0x16e3[171]];mxVertexHandler[_0x16e3[16]][_0x16e3[171]]=function(){_0xde98x25[_0x16e3[15]](this,arguments);if(showConnectorImg&&this[_0x16e3[46]][_0x16e3[11]][_0x16e3[111]]()&&this[_0x16e3[46]][_0x16e3[172]](this[_0x16e3[119]][_0x16e3[51]])&&!this[_0x16e3[46]][_0x16e3[84]](this[_0x16e3[119]][_0x16e3[51]])&&this[_0x16e3[46]][_0x16e3[53]]()==1){this[_0x16e3[173]]=mxUtils[_0x16e3[174]](_0xde98x24);this[_0x16e3[173]][_0x16e3[24]][_0x16e3[23]]=_0x16e3[26];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[175]]=_0x16e3[176];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[177]]=_0x16e3[176];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[178]]=_0x16e3[179];if(!mxClient[_0x16e3[141]]){this[_0x16e3[173]][_0x16e3[100]](_0x16e3[180],mxResources[_0x16e3[93]](_0x16e3[17]));mxEvent[_0x16e3[181]](this[_0x16e3[173]],this[_0x16e3[46]],this[_0x16e3[119]])};this[_0x16e3[173]][_0x16e3[24]][_0x16e3[182]]=_0x16e3[183];mxEvent[_0x16e3[185]](this[_0x16e3[173]],mxUtils[_0x16e3[27]](this,function(_0xde98x19){this[_0x16e3[46]][_0x16e3[29]][_0x16e3[114]]();var _0xde98x22=mxUtils[_0x16e3[163]](this[_0x16e3[46]][_0x16e3[25]],mxEvent[_0x16e3[130]](_0xde98x19),mxEvent[_0x16e3[131]](_0xde98x19));this[_0x16e3[46]][_0x16e3[11]][_0x16e3[49]](this[_0x16e3[119]],_0xde98x22[_0x16e3[164]],_0xde98x22[_0x16e3[165]]);this[_0x16e3[46]][_0x16e3[184]]=true;mxEvent[_0x16e3[133]](_0xde98x19)}));this[_0x16e3[46]][_0x16e3[25]][_0x16e3[186]](this[_0x16e3[173]])};this[_0x16e3[187]]()};var _0xde98x26=mxVertexHandler[_0x16e3[16]][_0x16e3[188]];mxVertexHandler[_0x16e3[16]][_0x16e3[188]]=function(){_0xde98x26[_0x16e3[15]](this);this[_0x16e3[187]]()};mxVertexHandler[_0x16e3[16]][_0x16e3[187]]=function(){if(this[_0x16e3[119]]!=null&&this[_0x16e3[173]]!=null){if(mxVertexHandler[_0x16e3[16]][_0x16e3[189]]){this[_0x16e3[173]][_0x16e3[24]][_0x16e3[190]]=(this[_0x16e3[119]][_0x16e3[164]]+this[_0x16e3[119]][_0x16e3[175]]-this[_0x16e3[173]][_0x16e3[191]]/2)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[193]]=(this[_0x16e3[119]][_0x16e3[165]]-this[_0x16e3[173]][_0x16e3[194]]/2)+_0x16e3[192]}else {this[_0x16e3[173]][_0x16e3[24]][_0x16e3[190]]=(this[_0x16e3[119]][_0x16e3[164]]+this[_0x16e3[119]][_0x16e3[175]]+mxConstants[_0x16e3[139]]/2+4)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[193]]=(this[_0x16e3[119]][_0x16e3[165]]+(this[_0x16e3[119]][_0x16e3[177]]-this[_0x16e3[173]][_0x16e3[194]])/2)+_0x16e3[192]}}};var _0xde98x27=mxVertexHandler[_0x16e3[16]][_0x16e3[195]];mxVertexHandler[_0x16e3[16]][_0x16e3[195]]=function(_0xde98x18,_0xde98xb){_0xde98x27[_0x16e3[15]](this,arguments);if(this[_0x16e3[173]]!=null){this[_0x16e3[173]][_0x16e3[197]][_0x16e3[196]](this[_0x16e3[173]]);this[_0x16e3[173]]=null}}; new Image()[_0x16e3[169]]=_0xde98x24}else {var _0xde98x28= new mxImage(IMAGE_PATH+_0x16e3[198],15,15);mxConnectionHandler[_0x16e3[16]][_0x16e3[199]]=_0xde98x28; new Image()[_0x16e3[169]]=_0xde98x28[_0x16e3[169]];if(urlParams[_0x16e3[17]]==_0x16e3[18]){var _0xde98x28= new mxImage(IMAGE_PATH+_0x16e3[198],15,15);var _0xde98x25=mxVertexHandler[_0x16e3[16]][_0x16e3[171]];mxVertexHandler[_0x16e3[16]][_0x16e3[171]]=function(){_0xde98x25[_0x16e3[15]](this,arguments);if(showConnectorImg&&this[_0x16e3[46]][_0x16e3[11]][_0x16e3[111]]()&&this[_0x16e3[46]][_0x16e3[172]](this[_0x16e3[119]][_0x16e3[51]])&&!this[_0x16e3[46]][_0x16e3[84]](this[_0x16e3[119]][_0x16e3[51]])&&this[_0x16e3[46]][_0x16e3[53]]()==1){if(mxClient[_0x16e3[200]]&&!mxClient[_0x16e3[201]]){this[_0x16e3[173]]=document[_0x16e3[104]](_0x16e3[202]);this[_0x16e3[173]][_0x16e3[24]][_0x16e3[203]]=_0x16e3[204]+_0xde98x28[_0x16e3[169]]+_0x16e3[205];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[206]]=_0x16e3[207];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[208]]=_0x16e3[209];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[175]]=(_0xde98x28[_0x16e3[175]]+4)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[177]]=(_0xde98x28[_0x16e3[177]]+4)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[210]]=(mxClient[_0x16e3[211]])?_0x16e3[212]:_0x16e3[213]}else {this[_0x16e3[173]]=mxUtils[_0x16e3[174]](_0xde98x28[_0x16e3[169]]);this[_0x16e3[173]][_0x16e3[24]][_0x16e3[175]]=_0xde98x28[_0x16e3[175]]+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[177]]=_0xde98x28[_0x16e3[177]]+_0x16e3[192]};this[_0x16e3[173]][_0x16e3[24]][_0x16e3[23]]=_0x16e3[26];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[178]]=_0x16e3[179];this[_0x16e3[173]][_0x16e3[100]](_0x16e3[180],mxResources[_0x16e3[93]](_0x16e3[17]));mxEvent[_0x16e3[181]](this[_0x16e3[173]],this[_0x16e3[46]],this[_0x16e3[119]]);this[_0x16e3[173]][_0x16e3[24]][_0x16e3[182]]=_0x16e3[183];mxEvent[_0x16e3[28]](this[_0x16e3[173]],_0x16e3[214],mxUtils[_0x16e3[27]](this,function(_0xde98x19){this[_0x16e3[46]][_0x16e3[29]][_0x16e3[114]]();var _0xde98x22=mxUtils[_0x16e3[163]](this[_0x16e3[46]][_0x16e3[25]],mxEvent[_0x16e3[130]](_0xde98x19),mxEvent[_0x16e3[131]](_0xde98x19));this[_0x16e3[46]][_0x16e3[11]][_0x16e3[49]](this[_0x16e3[119]],_0xde98x22[_0x16e3[164]],_0xde98x22[_0x16e3[165]]);this[_0x16e3[46]][_0x16e3[184]]=true;mxEvent[_0x16e3[133]](_0xde98x19)}));this[_0x16e3[46]][_0x16e3[25]][_0x16e3[186]](this[_0x16e3[173]])};this[_0x16e3[187]]()};var _0xde98x26=mxVertexHandler[_0x16e3[16]][_0x16e3[188]];mxVertexHandler[_0x16e3[16]][_0x16e3[188]]=function(){_0xde98x26[_0x16e3[15]](this);this[_0x16e3[187]]()};mxVertexHandler[_0x16e3[16]][_0x16e3[187]]=function(){if(this[_0x16e3[119]]!=null&&this[_0x16e3[173]]!=null){if(mxVertexHandler[_0x16e3[16]][_0x16e3[189]]){this[_0x16e3[173]][_0x16e3[24]][_0x16e3[190]]=(this[_0x16e3[119]][_0x16e3[164]]+this[_0x16e3[119]][_0x16e3[175]]-this[_0x16e3[173]][_0x16e3[191]]/2)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[193]]=(this[_0x16e3[119]][_0x16e3[165]]-this[_0x16e3[173]][_0x16e3[194]]/2)+_0x16e3[192]}else {this[_0x16e3[173]][_0x16e3[24]][_0x16e3[190]]=(this[_0x16e3[119]][_0x16e3[164]]+this[_0x16e3[119]][_0x16e3[175]]+mxConstants[_0x16e3[139]]/2+2)+_0x16e3[192];this[_0x16e3[173]][_0x16e3[24]][_0x16e3[193]]=(this[_0x16e3[119]][_0x16e3[165]]+(this[_0x16e3[119]][_0x16e3[177]]-this[_0x16e3[173]][_0x16e3[194]])/2)+_0x16e3[192]}}};var _0xde98x27=mxVertexHandler[_0x16e3[16]][_0x16e3[195]];mxVertexHandler[_0x16e3[16]][_0x16e3[195]]=function(_0xde98x18,_0xde98xb){_0xde98x27[_0x16e3[15]](this,arguments);if(this[_0x16e3[173]]!=null){this[_0x16e3[173]][_0x16e3[197]][_0x16e3[196]](this[_0x16e3[173]]);this[_0x16e3[173]]=null}}}}})() \ No newline at end of file +/** + * $Id: Graph.js,v 1.14 2013-02-16 10:19:54 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph instance. Note that the constructor does not take a + * container because the graph instance is needed for creating the UI, which + * in turn will create the container for the graph. Hence, the container is + * assigned later in EditorUi. + */ +Graph = function(container, model, renderHint, stylesheet) +{ + mxGraph.call(this, container, model, renderHint, stylesheet); + + this.setConnectable(true); + this.setDropEnabled(false); + this.setPanning(true); + this.setTooltips(!mxClient.IS_TOUCH); + this.setAllowLoops(false); + this.setMultigraph(false); + this.allowAutoPanning = true; + this.resetEdgesOnConnect = false; + this.constrainChildren = false; + + // Centers the port icon on the target port + this.connectionHandler.targetConnectImage = true; + + // Does not allow dangling edges + this.setAllowDanglingEdges(false); + + // Enables cloning of connection sources + this.connectionHandler.setCreateTarget(false); + + // Disables built-in connection starts + this.connectionHandler.isValidSource = function() + { + return mxConnectionHandler.prototype.isValidSource.apply(this, arguments) && urlParams['connect'] != '2'; + }; + + // Sets the style to be used when an elbow edge is double clicked + this.alternateEdgeStyle = 'vertical'; + + if (stylesheet == null) + { + this.loadStylesheet(); + } + + // Creates rubberband selection + var rubberband = new mxRubberband(this); + + this.getRubberband = function() + { + return rubberband; + }; + + // Shows hand cursor while panning + 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'; + })); + + // Adds support for HTML labels via style. Note: Currently, only the Java + // backend supports HTML labels but CSS support is limited to the following: + // http://docs.oracle.com/javase/6/docs/api/index.html?javax/swing/text/html/CSS.html + this.isHtmlLabel = function(cell) + { + var state = this.view.getState(cell); + var style = (state != null) ? state.style : this.getCellStyle(cell); + + return style['html'] == '1' || style['whiteSpace'] == 'wrap'; + }; + + // HTML entities are displayed as plain text in wrapped plain text labels + this.cellRenderer.getLabelValue = function(state) + { + var result = mxCellRenderer.prototype.getLabelValue.apply(this, arguments); + + if (state.style['whiteSpace'] == 'wrap' && state.style['html'] != 1) + { + result = mxUtils.htmlEntities(result, false); + } + + return result; + }; + + // Unlocks all cells + this.isCellLocked = function(cell) + { + return false; + }; + + // Tap and hold brings up context menu. + // Tolerance slightly below graph tolerance is better. + this.connectionHandler.tapAndHoldTolerance = 16; + + // Tap and hold on background starts rubberband on cell starts connecting + var connectionHandlerTapAndHold = this.connectionHandler.tapAndHold; + this.connectionHandler.tapAndHold = function(me, state) + { + if (state == null) + { + if (!this.graph.panningHandler.active) + { + rubberband.start(me.getGraphX(), me.getGraphY()); + this.graph.panningHandler.panningTrigger = false; + } + } + else if (tapAndHoldStartsConnection) + { + connectionHandlerTapAndHold.apply(this, arguments); + } + else if (this.graph.isCellSelected(state.cell) && this.graph.getSelectionCount() > 1) + { + this.graph.removeSelectionCell(state.cell); + } + }; + + if (touchStyle) + { + this.initTouch(); + } +}; + +// Graph inherits from mxGraph +mxUtils.extend(Graph, mxGraph); + +/** + * Allows to all values in fit. + */ +Graph.prototype.minFitScale = null; + +/** + * Allows to all values in fit. + */ +Graph.prototype.maxFitScale = null; + +/** + * Loads the stylesheet for this graph. + */ +Graph.prototype.loadStylesheet = function() +{ + var node = mxUtils.load(STYLE_PATH + '/default.xml').getDocumentElement(); + var dec = new mxCodec(node.ownerDocument); + dec.decode(node, this.getStylesheet()); +}; + +/** + * Inverts the elbow edge style without removing existing styles. + */ +Graph.prototype.flipEdge = function(edge) +{ + if (edge != null) + { + var state = this.view.getState(edge); + var style = (state != null) ? state.style : this.getCellStyle(edge); + + if (style != null) + { + var elbow = mxUtils.getValue(style, mxConstants.STYLE_ELBOW, + mxConstants.ELBOW_HORIZONTAL); + var value = (elbow == mxConstants.ELBOW_HORIZONTAL) ? + mxConstants.ELBOW_VERTICAL : mxConstants.ELBOW_HORIZONTAL; + this.setCellStyles(mxConstants.STYLE_ELBOW, value, [edge]); + } + } +}; + +/** + * Sets the default edge for future connections. + */ +Graph.prototype.setDefaultEdge = function(cell) +{ + if (cell != null && this.getModel().isEdge(cell)) + { + // Take a snapshot of the cell at the moment of calling + var proto = this.getModel().cloneCells([cell])[0]; + + // Delete existing points + if (proto.geometry != null) + { + proto.geometry.points = null; + } + + // Delete entry-/exitXY styles + var style = proto.getStyle(); + style = mxUtils.setStyle(style, mxConstants.STYLE_ENTRY_X, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_ENTRY_Y, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_EXIT_X, null); + style = mxUtils.setStyle(style, mxConstants.STYLE_EXIT_Y, null); + proto.setStyle(style); + + // Uses edge template for connect preview + this.connectionHandler.createEdgeState = function(me) + { + return this.graph.view.createState(proto); + }; + + // Creates new connections from edge template + this.connectionHandler.factoryMethod = function() + { + return this.graph.cloneCells([proto])[0]; + }; + } +}; + +/** + * Disables folding for non-swimlanes. + */ +Graph.prototype.isCellFoldable = function(cell) +{ + return this.foldingEnabled && this.isSwimlane(cell); +}; + +/** + * Disables drill-down for non-swimlanes. + */ +Graph.prototype.isValidRoot = function(cell) +{ + return this.isSwimlane(cell); +}; + +/** + * Overrides createGroupCell to set the group style for new groups to 'group'. + */ +Graph.prototype.createGroupCell = function() +{ + var group = mxGraph.prototype.createGroupCell.apply(this, arguments); + group.setStyle('group'); + + return group; +}; + +/** + * Giuseppe Careri + * Overrides tooltips to show position and size + */ +Graph.prototype.getTooltipForCell = function(cell) +{ + var tip = ''; + + if (this.getModel().isVertex(cell)) + { + // var geo = this.getCellGeometry(cell); + + // var f2 = function(x) + // { + // return Math.round(parseFloat(x) * 100) / 100; + // }; + + // if (geo != null) + // { + // if (tip == null) + // { + // tip = ''; + // } + // else if (tip.length > 0) + // { + // tip += '\n'; + // } + + // tip += 'X: ' + f2(geo.x) + '\nY: ' + f2(geo.y) + '\nW: ' + f2(geo.width) + '\nH: ' + f2(geo.height); + // } + + tip += mxResources.get('description_' + cell.value.nodeName); + } + else if (this.getModel().isEdge(cell)) + { + tip = mxGraph.prototype.getTooltipForCell.apply(this, arguments); + } + + return tip; +}; + +/** + * Giuseppe Careri + * Returns the label for the given cell. + */ +Graph.prototype.convertValueToString = function(cell) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + return cell.value.getAttribute('label'); + } + + return mxGraph.prototype.convertValueToString.apply(this, arguments); +}; + +/** + * Giuseppe Careri + * Handles label changes for XML user objects. + */ +Graph.prototype.cellLabelChanged = function(cell, value, autoSize) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + var tmp = cell.value.cloneNode(true); + tmp.setAttribute('label', value); + value = tmp; + } + + mxGraph.prototype.cellLabelChanged.apply(this, arguments); +}; + +/** + * Sets the link for the given cell. + */ +Graph.prototype.setLinkForCell = function(cell, link) +{ + var value = null; + + if (cell.value != null && typeof(cell.value) == 'object') + { + value = cell.value.cloneNode(true); + } + else + { + var doc = mxUtils.createXmlDocument(); + + value = doc.createElement('UserObject'); + value.setAttribute('label', cell.value); + } + + if (link != null && link.length > 0) + { + value.setAttribute('link', link); + } + else + { + value.removeAttribute('link'); + } + + this.model.setValue(cell, value); +}; + +/** + * Returns the link for the given cell. + */ +Graph.prototype.getLinkForCell = function(cell) +{ + if (cell.value != null && typeof(cell.value) == 'object') + { + return cell.value.getAttribute('link'); + } + + return null; +}; + +/** + * Customized graph for touch devices. + */ +Graph.prototype.initTouch = function() +{ + // Disables new connections via "hotspot" + this.connectionHandler.marker.isEnabled = function() + { + return this.graph.connectionHandler.first != null; + }; + + // Hides menu when editing starts + this.addListener(mxEvent.START_EDITING, function(sender, evt) + { + this.panningHandler.hideMenu(); + }); + + // Context menu for touchstyle + var showMenu = false; + var menuCell = null; + + // Checks if native hit detection did not return anything and does custom + // hit detection for edges to take into account the tolerance + this.updateMouseEvent = function(me) + { + mxGraph.prototype.updateMouseEvent.apply(this, arguments); + + if (me.getState() == null) + { + var cell = this.getCellAt(me.graphX, me.graphY); + + if (this.getModel().isEdge(cell)) + { + me.state = this.view.getState(cell); + + if (me.state != null && me.state.shape != null) + { + this.container.style.cursor = me.state.shape.node.style.cursor; + } + } + } + + if (me.getState() == null) + { + this.container.style.cursor = 'default'; + } + }; + + // Handles popup menu on touch devices (tap selected cell) + this.fireMouseEvent = function(evtName, me, sender) + { + if (evtName == mxEvent.MOUSE_DOWN) + { + if (!this.panningHandler.isMenuShowing()) + { + menuCell = me.getCell(); + showMenu = (menuCell != null) ? this.isCellSelected(menuCell) : this.isSelectionEmpty(); + } + else + { + showMenu = false; + menuCell = null; + } + } + else if (evtName == mxEvent.MOUSE_UP) + { + if (showMenu && !this.isEditing()) + { + if (!this.panningHandler.isMenuShowing()) + { + var x = mxEvent.getClientX(me.getEvent()); + var y = mxEvent.getClientY(me.getEvent()); + + this.panningHandler.popup(x + 16, y, menuCell, me.getEvent()); + } + + showMenu = false; + menuCell = null; + me.consume(); + + return; + } + + showMenu = false; + menuCell = null; + } + + mxGraph.prototype.fireMouseEvent.apply(this, arguments); + + if (evtName == mxEvent.MOUSE_MOVE && me.isConsumed()) + { + showMenu = false; + menuCell = null; + } + }; +}; + +/** + * Implements touch devices. + */ +(function() +{ + // Enables rotation handle + mxVertexHandler.prototype.rotationEnabled = true; + + // Matches label positions of mxGraph 1.x + mxText.prototype.baseSpacingTop = 5; + mxText.prototype.baseSpacingBottom = 1; + + // Touch-specific static overrides + if (touchStyle) + { + // Sets constants for touch style + mxConstants.HANDLE_SIZE = 16; + mxConstants.LABEL_HANDLE_SIZE = 7; + + // Larger tolerance and grid for real touch devices + if (mxClient.IS_TOUCH) + { + mxVertexHandler.prototype.tolerance = 4; + mxEdgeHandler.prototype.tolerance = 6; + Graph.prototype.tolerance = 14; + Graph.prototype.gridSize = 20; + + // One finger pans (no rubberband selection) must start regardless of mouse button + mxPanningHandler.prototype.selectOnPopup = false; + mxPanningHandler.prototype.useLeftButtonForPanning = true; + mxPanningHandler.prototype.isPanningTrigger = function(me) + { + var evt = me.getEvent(); + + return (this.useLeftButtonForPanning && (this.ignoreCell || me.getState() == null)/* && + mxEvent.isLeftMouseButton(evt)*/) || (mxEvent.isControlDown(evt) && + mxEvent.isShiftDown(evt)) || (this.usePopupTrigger && + mxEvent.isPopupTrigger(evt)); + }; + } + + // Don't clear selection if multiple cells selected + var graphHandlerMouseDown = mxGraphHandler.prototype.mouseDown; + mxGraphHandler.prototype.mouseDown = function(sender, me) + { + graphHandlerMouseDown.apply(this, arguments); + + if (this.graph.isCellSelected(me.getCell()) && this.graph.getSelectionCount() > 1) + { + this.delayedSelection = false; + } + }; + + // Changes order of panninghandler + Graph.prototype.createHandlers = function(container) + { + this.tooltipHandler = new mxTooltipHandler(this); + this.tooltipHandler.setEnabled(false); + // Selection cells first + this.selectionCellsHandler = new mxSelectionCellsHandler(this); + this.panningHandler = new mxPanningHandler(this); + this.panningHandler.panningEnabled = false; + this.connectionHandler = new mxConnectionHandler(this); + this.connectionHandler.setEnabled(false); + this.graphHandler = new mxGraphHandler(this); + }; + + // On connect the target is selected and we clone the cell of the preview edge for insert + mxConnectionHandler.prototype.selectCells = function(edge, target) + { + if (touchStyle && target != null) + { + this.graph.setSelectionCell(target); + } + else + { + this.graph.setSelectionCell(edge); + } + }; + + // Overrides double click handling to use the tolerance + // FIXME: Double click on edges in iPad needs focus on textarea + var graphDblClick = mxGraph.prototype.dblClick; + Graph.prototype.dblClick = function(evt, cell) + { + if (cell == null) + { + var pt = mxUtils.convertPoint(this.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + cell = this.getCellAt(pt.x, pt.y); + } + + graphDblClick.call(this, evt, cell); + }; + + // Rounded edge and vertex handles + var touchHandle = new mxImage(IMAGE_PATH + '/touch-handle.png', 16, 16); + mxVertexHandler.prototype.handleImage = touchHandle; + mxEdgeHandler.prototype.handleImage = touchHandle; + mxOutline.prototype.sizerImage = touchHandle; + + // Pre-fetches touch handle + new Image().src = touchHandle.src; + + // Adds connect icon to selected vertices + var connectorSrc = IMAGE_PATH + '/touch-connector.png'; + + var vertexHandlerInit = mxVertexHandler.prototype.init; + mxVertexHandler.prototype.init = function() + { + vertexHandlerInit.apply(this, arguments); + + // Only show connector image on one cell and do not show on containers + if (showConnectorImg && this.graph.connectionHandler.isEnabled() && + this.graph.isCellConnectable(this.state.cell) && + !this.graph.isValidRoot(this.state.cell) && + this.graph.getSelectionCount() == 1) + { + this.connectorImg = mxUtils.createImage(connectorSrc); + this.connectorImg.style.cursor = 'pointer'; + this.connectorImg.style.width = '29px'; + this.connectorImg.style.height = '29px'; + this.connectorImg.style.position = 'absolute'; + + if (!mxClient.IS_TOUCH) + { + this.connectorImg.setAttribute('title', mxResources.get('connect')); + mxEvent.redirectMouseEvents(this.connectorImg, this.graph, this.state); + } + + // Adds 2px tolerance + this.connectorImg.style.padding = '2px'; + + // Starts connecting on touch/mouse down + mxEvent.addGestureListeners(this.connectorImg, + mxUtils.bind(this, function(evt) + { + this.graph.panningHandler.hideMenu(); + var pt = mxUtils.convertPoint(this.graph.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + this.graph.connectionHandler.start(this.state, pt.x, pt.y); + this.graph.isMouseDown = true; + mxEvent.consume(evt); + }) + ); + + this.graph.container.appendChild(this.connectorImg); + } + + this.redrawTools(); + }; + + var vertexHandlerRedraw = mxVertexHandler.prototype.redraw; + mxVertexHandler.prototype.redraw = function() + { + vertexHandlerRedraw.apply(this); + this.redrawTools(); + }; + + mxVertexHandler.prototype.redrawTools = function() + { + if (this.state != null && this.connectorImg != null) + { + // Top right for single-sizer + if (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'; + } + else + { + this.connectorImg.style.left = (this.state.x + this.state.width + mxConstants.HANDLE_SIZE / 2 + 4/* - 2 padding*/) + 'px'; + this.connectorImg.style.top = (this.state.y + (this.state.height - this.connectorImg.offsetHeight) / 2) + 'px'; + } + } + }; + + var vertexHandlerDestroy = mxVertexHandler.prototype.destroy; + mxVertexHandler.prototype.destroy = function(sender, me) + { + vertexHandlerDestroy.apply(this, arguments); + + if (this.connectorImg != null) + { + this.connectorImg.parentNode.removeChild(this.connectorImg); + this.connectorImg = null; + } + }; + + // Pre-fetches touch connector + new Image().src = connectorSrc; + } + else + { + var img = new mxImage(IMAGE_PATH + '/connector.png', 15, 15); + mxConnectionHandler.prototype.connectImage = img; + + // Pre-fetches img + new Image().src = img.src; + + if (urlParams['connect'] == '2') // not touchStyle + { + var img = new mxImage(IMAGE_PATH + '/connector.png', 15, 15); + + var vertexHandlerInit = mxVertexHandler.prototype.init; + mxVertexHandler.prototype.init = function() + { + vertexHandlerInit.apply(this, arguments); + + // Only show connector image on one cell and do not show on containers + if (showConnectorImg && this.graph.connectionHandler.isEnabled() && + this.graph.isCellConnectable(this.state.cell) && + !this.graph.isValidRoot(this.state.cell) && + this.graph.getSelectionCount() == 1) + { + // Workaround for event redirection via image tag in quirks and IE8 + if (mxClient.IS_IE && !mxClient.IS_SVG) + { + this.connectorImg = document.createElement('div'); + this.connectorImg.style.backgroundImage = 'url(' + img.src + ')'; + this.connectorImg.style.backgroundPosition = 'center'; + this.connectorImg.style.backgroundRepeat = 'no-repeat'; + this.connectorImg.style.width = (img.width + 4) + 'px'; + this.connectorImg.style.height = (img.height + 4) + 'px'; + this.connectorImg.style.display = (mxClient.IS_QUIRKS) ? 'inline' : 'inline-block'; + } + else + { + this.connectorImg = mxUtils.createImage(img.src); + this.connectorImg.style.width = img.width + 'px'; + this.connectorImg.style.height = img.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); + + // Adds 2px tolerance + this.connectorImg.style.padding = '2px'; + + // Starts connecting on touch/mouse down + mxEvent.addListener(this.connectorImg, 'mousedown', + mxUtils.bind(this, function(evt) + { + this.graph.panningHandler.hideMenu(); + var pt = mxUtils.convertPoint(this.graph.container, + mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + this.graph.connectionHandler.start(this.state, pt.x, pt.y); + this.graph.isMouseDown = true; + mxEvent.consume(evt); + }) + ); + + this.graph.container.appendChild(this.connectorImg); + } + + this.redrawTools(); + }; + + var vertexHandlerRedraw = mxVertexHandler.prototype.redraw; + mxVertexHandler.prototype.redraw = function() + { + vertexHandlerRedraw.apply(this); + this.redrawTools(); + }; + + mxVertexHandler.prototype.redrawTools = function() + { + if (this.state != null && this.connectorImg != null) + { + // Top right for single-sizer + if (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'; + } + else + { + this.connectorImg.style.left = (this.state.x + this.state.width + mxConstants.HANDLE_SIZE / 2 + 2/* - 2 padding*/) + 'px'; + this.connectorImg.style.top = (this.state.y + (this.state.height - this.connectorImg.offsetHeight) / 2) + 'px'; + } + } + }; + + var vertexHandlerDestroy = mxVertexHandler.prototype.destroy; + mxVertexHandler.prototype.destroy = function(sender, me) + { + vertexHandlerDestroy.apply(this, arguments); + + if (this.connectorImg != null) + { + this.connectorImg.parentNode.removeChild(this.connectorImg); + this.connectorImg = null; + } + }; + } + } +})(); diff --git a/public/assets/plugins/square/js/Menus.js b/public/assets/plugins/square/js/Menus.js index ca1246e..8ef4252 100644 --- a/public/assets/plugins/square/js/Menus.js +++ b/public/assets/plugins/square/js/Menus.js @@ -1 +1,716 @@ -var _0xe88f=["\x65\x64\x69\x74\x6F\x72\x55\x69","\x6D\x65\x6E\x75\x73","\x69\x6E\x69\x74","\x73\x72\x63","\x2F\x63\x68\x65\x63\x6B\x6D\x61\x72\x6B\x2E\x67\x69\x66","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x67\x72\x61\x70\x68","\x65\x64\x69\x74\x6F\x72","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x48\x65\x6C\x76\x65\x74\x69\x63\x61","\x56\x65\x72\x64\x61\x6E\x61","\x54\x69\x6D\x65\x73\x20\x4E\x65\x77\x20\x52\x6F\x6D\x61\x6E","\x47\x61\x72\x61\x6D\x6F\x6E\x64","\x43\x6F\x6D\x69\x63\x20\x53\x61\x6E\x73\x20\x4D\x53","\x43\x6F\x75\x72\x69\x65\x72\x20\x4E\x65\x77","\x47\x65\x6F\x72\x67\x69\x61","\x4C\x75\x63\x69\x64\x61\x20\x43\x6F\x6E\x73\x6F\x6C\x65","\x54\x61\x68\x6F\x6D\x61","\x6C\x65\x6E\x67\x74\x68","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x73\x74\x79\x6C\x65\x43\x68\x61\x6E\x67\x65","\x73\x74\x79\x6C\x65","\x6E\x65\x78\x74\x53\x69\x62\x6C\x69\x6E\x67","\x66\x69\x72\x73\x74\x43\x68\x69\x6C\x64","\x61\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x63\x75\x73\x74\x6F\x6D","\x67\x65\x74","","\x70\x72\x6F\x6D\x70\x74\x43\x68\x61\x6E\x67\x65","\x62\x69\x6E\x64","\x70\x75\x74","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x28\x70\x74\x29","\x31\x32","\x6C\x69\x6E\x65\x77\x69\x64\x74\x68","\x70\x78","\x53\x54\x59\x4C\x45\x5F\x53\x54\x52\x4F\x4B\x45\x57\x49\x44\x54\x48","\x28\x70\x78\x29","\x31","\x6C\x69\x6E\x65","\x73\x74\x72\x61\x69\x67\x68\x74","\x53\x54\x59\x4C\x45\x5F\x45\x44\x47\x45","\x65\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E","\x65\x6E\x74\x69\x74\x79\x52\x65\x6C\x61\x74\x69\x6F\x6E\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x53\x54\x59\x4C\x45\x5F\x45\x4C\x42\x4F\x57","\x65\x6C\x62\x6F\x77\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x76\x65\x72\x74\x69\x63\x61\x6C","\x6D\x61\x6E\x75\x61\x6C","\x73\x65\x67\x6D\x65\x6E\x74\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x61\x75\x74\x6F\x6D\x61\x74\x69\x63","\x6F\x72\x74\x68\x6F\x67\x6F\x6E\x61\x6C\x45\x64\x67\x65\x53\x74\x79\x6C\x65","\x6C\x69\x6E\x65\x65\x6E\x64","\x63\x6C\x61\x73\x73\x69\x63","\x53\x54\x59\x4C\x45\x5F\x45\x4E\x44\x41\x52\x52\x4F\x57","\x41\x52\x52\x4F\x57\x5F\x43\x4C\x41\x53\x53\x49\x43","\x6F\x70\x65\x6E\x41\x72\x72\x6F\x77","\x41\x52\x52\x4F\x57\x5F\x4F\x50\x45\x4E","\x62\x6C\x6F\x63\x6B","\x41\x52\x52\x4F\x57\x5F\x42\x4C\x4F\x43\x4B","\x6F\x76\x61\x6C","\x41\x52\x52\x4F\x57\x5F\x4F\x56\x41\x4C","\x64\x69\x61\x6D\x6F\x6E\x64","\x41\x52\x52\x4F\x57\x5F\x44\x49\x41\x4D\x4F\x4E\x44","\x64\x69\x61\x6D\x6F\x6E\x64\x54\x68\x69\x6E","\x41\x52\x52\x4F\x57\x5F\x44\x49\x41\x4D\x4F\x4E\x44\x5F\x54\x48\x49\x4E","\x6E\x6F\x6E\x65","\x4E\x4F\x4E\x45","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74","\x65\x6E\x64\x46\x69\x6C\x6C","\x74\x6F\x67\x67\x6C\x65\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x61\x64\x64\x49\x74\x65\x6D","\x73\x69\x7A\x65","\x6C\x69\x6E\x65\x73\x74\x61\x72\x74","\x53\x54\x59\x4C\x45\x5F\x53\x54\x41\x52\x54\x41\x52\x52\x4F\x57","\x73\x74\x61\x72\x74\x46\x69\x6C\x6C","\x73\x70\x61\x63\x69\x6E\x67","\x65\x6E\x61\x62\x6C\x65\x64","\x73\x68\x61\x64\x6F\x77","\x61\x63\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x44\x69\x73\x61\x62\x6C\x65\x64","\x74\x6F\x70","\x30","\x72\x69\x67\x68\x74","\x62\x6F\x74\x74\x6F\x6D","\x6C\x65\x66\x74","\x67\x6C\x6F\x62\x61\x6C","\x70\x65\x72\x69\x6D\x65\x74\x65\x72","\x73\x6F\x75\x72\x63\x65\x53\x70\x61\x63\x69\x6E\x67","\x74\x61\x72\x67\x65\x74\x53\x70\x61\x63\x69\x6E\x67","\x66\x6F\x72\x6D\x61\x74","\x61\x64\x64\x4D\x65\x6E\x75\x49\x74\x65\x6D","\x74\x65\x78\x74","\x61\x64\x64\x53\x75\x62\x6D\x65\x6E\x75","\x2D","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x61\x64\x64\x4D\x65\x6E\x75\x49\x74\x65\x6D\x73","\x61\x6C\x69\x67\x6E\x6D\x65\x6E\x74","\x77\x6F\x72\x64\x57\x72\x61\x70","\x74\x65\x78\x74\x4F\x70\x61\x63\x69\x74\x79","\x28\x25\x29","\x31\x30\x30","\x68\x69\x64\x65","\x6C\x65\x66\x74\x41\x6C\x69\x67\x6E","\x53\x54\x59\x4C\x45\x5F\x41\x4C\x49\x47\x4E","\x41\x4C\x49\x47\x4E\x5F\x4C\x45\x46\x54","\x63\x65\x6E\x74\x65\x72","\x41\x4C\x49\x47\x4E\x5F\x43\x45\x4E\x54\x45\x52","\x72\x69\x67\x68\x74\x41\x6C\x69\x67\x6E","\x41\x4C\x49\x47\x4E\x5F\x52\x49\x47\x48\x54","\x74\x6F\x70\x41\x6C\x69\x67\x6E","\x53\x54\x59\x4C\x45\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x41\x4C\x49\x47\x4E","\x41\x4C\x49\x47\x4E\x5F\x54\x4F\x50","\x6D\x69\x64\x64\x6C\x65","\x41\x4C\x49\x47\x4E\x5F\x4D\x49\x44\x44\x4C\x45","\x62\x6F\x74\x74\x6F\x6D\x41\x6C\x69\x67\x6E","\x41\x4C\x49\x47\x4E\x5F\x42\x4F\x54\x54\x4F\x4D","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x53\x54\x59\x4C\x45\x5F\x4C\x41\x42\x45\x4C\x5F\x50\x4F\x53\x49\x54\x49\x4F\x4E","\x53\x54\x59\x4C\x45\x5F\x56\x45\x52\x54\x49\x43\x41\x4C\x5F\x4C\x41\x42\x45\x4C\x5F\x50\x4F\x53\x49\x54\x49\x4F\x4E","\x64\x69\x72\x65\x63\x74\x69\x6F\x6E","\x66\x6C\x69\x70\x48","\x66\x6C\x69\x70\x56","\x74\x69\x6C\x74","\x72\x6F\x74\x61\x74\x69\x6F\x6E","\x61\x6C\x69\x67\x6E","\x61\x6C\x69\x67\x6E\x43\x65\x6C\x6C\x73","\x6C\x61\x79\x6F\x75\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C\x46\x6C\x6F\x77","\x65\x78\x65\x63\x75\x74\x65\x4C\x61\x79\x6F\x75\x74","\x76\x65\x72\x74\x69\x63\x61\x6C\x46\x6C\x6F\x77","\x6E\x61\x76\x69\x67\x61\x74\x69\x6F\x6E","\x68\x6F\x6D\x65","\x65\x78\x69\x74\x47\x72\x6F\x75\x70","\x65\x6E\x74\x65\x72\x47\x72\x6F\x75\x70","\x65\x78\x70\x61\x6E\x64","\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x61\x72\x72\x61\x6E\x67\x65","\x74\x6F\x46\x72\x6F\x6E\x74","\x74\x6F\x42\x61\x63\x6B","\x67\x72\x6F\x75\x70","\x75\x6E\x67\x72\x6F\x75\x70","\x72\x65\x6D\x6F\x76\x65\x46\x72\x6F\x6D\x47\x72\x6F\x75\x70","\x76\x69\x65\x77","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x25","\x7A\x6F\x6F\x6D\x54\x6F","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x66\x69\x74\x57\x69\x6E\x64\x6F\x77","\x63\x75\x73\x74\x6F\x6D\x5A\x6F\x6F\x6D","\x66\x69\x74\x50\x61\x67\x65","\x66\x69\x74\x50\x61\x67\x65\x57\x69\x64\x74\x68","\x66\x69\x6C\x65","\x6E\x65\x77","\x6F\x70\x65\x6E","\x73\x61\x76\x65","\x73\x61\x76\x65\x41\x73","\x70\x75\x62\x6C\x69\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x69\x6D\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74","\x65\x64\x69\x74\x46\x69\x6C\x65","\x72\x65\x6E\x61\x6D\x65","\x70\x72\x69\x6E\x74","\x65\x64\x69\x74","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x75\x74","\x63\x6F\x70\x79","\x70\x61\x73\x74\x65","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x73\x65\x6C\x65\x63\x74\x56\x65\x72\x74\x69\x63\x65\x73","\x73\x65\x6C\x65\x63\x74\x45\x64\x67\x65\x73","\x73\x65\x6C\x65\x63\x74\x41\x6C\x6C","\x68\x65\x6C\x70","\x61\x62\x6F\x75\x74","\x61\x64\x64\x4D\x65\x6E\x75","\x65\x78\x65\x63\x75\x74\x65","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x65\x6E\x74\x65\x72\x56\x61\x6C\x75\x65","\x20","\x70\x72\x6F\x6D\x70\x74","\x6C\x61\x62\x65\x6C","\x66\x75\x6E\x63\x74","\x74\x6F\x67\x67\x6C\x65\x41\x63\x74\x69\x6F\x6E","\x69\x73\x53\x65\x6C\x65\x63\x74\x65\x64","\x61\x64\x64\x43\x68\x65\x63\x6B\x6D\x61\x72\x6B","\x61\x64\x64\x53\x68\x6F\x72\x74\x63\x75\x74","\x73\x68\x6F\x72\x74\x63\x75\x74","\x73\x70\x61\x6E","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6F\x6C\x6F\x72","\x67\x72\x61\x79","\x77\x72\x69\x74\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x2F\x63\x68\x65\x63\x6B\x6D\x61\x72\x6B\x2E\x67\x69\x66\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x32\x70\x78\x20\x35\x30\x25","\x63\x72\x65\x61\x74\x65\x50\x6F\x70\x75\x70\x4D\x65\x6E\x75","\x73\x6D\x61\x72\x74\x53\x65\x70\x61\x72\x61\x74\x6F\x72\x73","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x6F\x75\x6E\x74","\x69\x73\x45\x64\x67\x65","\x73\x65\x74\x41\x73\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x72","\x73\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73\x48\x61\x6E\x64\x6C\x65\x72","\x62\x65\x6E\x64\x73","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x6F\x72\x45\x76\x65\x6E\x74","\x72\x65\x6D\x6F\x76\x65\x57\x61\x79\x70\x6F\x69\x6E\x74","\x68\x61\x6E\x64\x6C\x65\x72","\x69\x6E\x64\x65\x78","\x61\x64\x64\x57\x61\x79\x70\x6F\x69\x6E\x74","\x67\x65\x74\x4C\x69\x6E\x6B\x46\x6F\x72\x43\x65\x6C\x6C","\x6F\x70\x65\x6E\x4C\x69\x6E\x6B","\x63\x72\x65\x61\x74\x65\x4D\x65\x6E\x75\x62\x61\x72","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x63\x75\x72\x72\x65\x6E\x74\x4D\x65\x6E\x75","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x49\x74\x65\x6D","\x61\x64\x64\x4D\x65\x6E\x75\x48\x61\x6E\x64\x6C\x65\x72","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x64\x69\x76","\x20\x67\x65\x4D\x65\x6E\x75\x62\x61\x72\x4D\x65\x6E\x75","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x61\x70\x70\x6C\x79","\x64\x65\x73\x74\x72\x6F\x79","\x63\x75\x72\x72\x65\x6E\x74\x45\x6C\x74","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x70\x61\x67\x65\x2D\x73\x69\x64\x65\x62\x61\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x70\x6F\x70\x75\x70","\x63\x6F\x6E\x73\x75\x6D\x65","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x63\x6C\x69\x63\x6B","\x63\x61\x6C\x6C","\x65\x78\x74\x65\x6E\x64","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x66\x69\x72\x65\x45\x76\x65\x6E\x74"];Menus=function(_0x125fx1){this[_0xe88f[0]]=_0x125fx1;this[_0xe88f[1]]= new Object();this[_0xe88f[2]](); new Image()[_0xe88f[3]]=IMAGE_PATH+_0xe88f[4]};Menus[_0xe88f[5]][_0xe88f[2]]=function(){var _0x125fx2=this[_0xe88f[0]][_0xe88f[7]][_0xe88f[6]];this[_0xe88f[30]](_0xe88f[8], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){var _0x125fx5=[_0xe88f[9],_0xe88f[10],_0xe88f[11],_0xe88f[12],_0xe88f[13],_0xe88f[14],_0xe88f[15],_0xe88f[16],_0xe88f[17]];for(var _0x125fx6=0;_0x125fx6<_0x125fx5[_0xe88f[18]];_0x125fx6++){var _0x125fx7=this[_0xe88f[20]](_0x125fx3,_0x125fx5[_0x125fx6],[mxConstants[_0xe88f[19]]],[_0x125fx5[_0x125fx6]],null,_0x125fx4);_0x125fx7[_0xe88f[23]][_0xe88f[22]][_0xe88f[21]][_0xe88f[8]]=_0x125fx5[_0x125fx6]};_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[25]),_0xe88f[27],mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[31], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){var _0x125fx8=[6,8,9,10,11,12,14,18,24,36,48,72];for(var _0x125fx6=0;_0x125fx6<_0x125fx8[_0xe88f[18]];_0x125fx6++){this[_0xe88f[20]](_0x125fx3,_0x125fx8[_0x125fx6],[mxConstants[_0xe88f[32]]],[_0x125fx8[_0x125fx6]],null,_0x125fx4)};_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[25]),_0xe88f[33],_0xe88f[34],mxConstants.STYLE_FONTSIZE,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[35], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){var _0x125fx8=[1,2,3,4,8,12,16,24];for(var _0x125fx6=0;_0x125fx6<_0x125fx8[_0xe88f[18]];_0x125fx6++){this[_0xe88f[20]](_0x125fx3,_0x125fx8[_0x125fx6]+_0xe88f[36],[mxConstants[_0xe88f[37]]],[_0x125fx8[_0x125fx6]],null,_0x125fx4)};_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[25]),_0xe88f[38],_0xe88f[39],mxConstants.STYLE_STROKEWIDTH,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[40], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[41]),[mxConstants[_0xe88f[42]]],[null],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[43]),[mxConstants[_0xe88f[42]]],[_0xe88f[44]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[45]),[mxConstants[_0xe88f[42]],mxConstants[_0xe88f[46]]],[_0xe88f[47],_0xe88f[45]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[48]),[mxConstants[_0xe88f[42]],mxConstants[_0xe88f[46]]],[_0xe88f[47],_0xe88f[48]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[49]),[mxConstants[_0xe88f[42]]],[_0xe88f[50]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[51]),[mxConstants[_0xe88f[42]]],[_0xe88f[52]],null,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[53], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[54]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[56]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[57]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[58]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[59]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[60]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[61]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[62]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[63]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[64]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[65]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[66]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[67]),[mxConstants[_0xe88f[55]]],[mxConstants[_0xe88f[68]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[69]),null,function(){_0x125fx2[_0xe88f[71]](_0xe88f[70],true)},_0x125fx4,null,true);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[73]),_0xe88f[38],mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[74], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[54]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[56]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[57]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[58]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[59]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[60]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[61]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[62]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[63]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[64]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[65]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[66]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[67]),[mxConstants[_0xe88f[75]]],[mxConstants[_0xe88f[68]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[69]),null,function(){_0x125fx2[_0xe88f[71]](_0xe88f[76],true)},_0x125fx4,null,true);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[73]),_0xe88f[38],mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[77], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){var _0x125fx9=this[_0xe88f[0]][_0xe88f[80]][_0xe88f[26]](_0xe88f[79])[_0xe88f[78]];var _0x125fxa=this[_0xe88f[26]](_0xe88f[40])[_0xe88f[78]];if(_0x125fx9||_0x125fx3[_0xe88f[81]]){this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[82]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SPACING_TOP,_0x125fx4,_0x125fx9);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[84]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SPACING_RIGHT,_0x125fx4,_0x125fx9);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[85]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SPACING_BOTTOM,_0x125fx4,_0x125fx9);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[86]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SPACING_LEFT,_0x125fx4,_0x125fx9);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[87]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SPACING,_0x125fx4,_0x125fx9);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[88]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_PERIMETER_SPACING,_0x125fx4,_0x125fx9)};if(_0x125fxa||_0x125fx3[_0xe88f[81]]){_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[89]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_SOURCE_PERIMETER_SPACING,_0x125fx4,_0x125fxa);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[90]),_0xe88f[38],_0xe88f[83],mxConstants.STYLE_TARGET_PERIMETER_SPACING,_0x125fx4,_0x125fxa)}})));this[_0xe88f[30]](_0xe88f[91], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[92]](_0x125fx3,_0xe88f[21],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[93], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){var _0x125fxb=this[_0xe88f[26]](_0xe88f[93])[_0xe88f[78]];_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[94]](_0xe88f[8],_0x125fx3,_0x125fx4);this[_0xe88f[94]](_0xe88f[31],_0x125fx3,_0x125fx4);this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],_0xe88f[96],_0xe88f[97],_0xe88f[98],_0xe88f[95]],_0x125fx4);this[_0xe88f[94]](_0xe88f[100],_0x125fx3,_0x125fx4);this[_0xe88f[92]](_0x125fx3,_0xe88f[101],_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[28]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[102]),_0xe88f[103],_0xe88f[104],mxConstants.STYLE_TEXT_OPACITY,_0x125fx4,_0x125fxb);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[105]),null,function(){_0x125fx2[_0xe88f[71]](mxConstants.STYLE_NOLABEL,false)},_0x125fx4,null,_0x125fxb)})));this[_0xe88f[30]](_0xe88f[100], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[106]),[mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[108]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[109]),[mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[110]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[111]),[mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[112]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[113]),[mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[115]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[116]),[mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[117]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[118]),[mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[119]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[94]](_0xe88f[120],_0x125fx3,_0x125fx4);this[_0xe88f[94]](_0xe88f[77],_0x125fx3,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);var _0x125fxb=this[_0xe88f[26]](_0xe88f[93])[_0xe88f[78]];_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[48]),null,function(){_0x125fx2[_0xe88f[71]](mxConstants.STYLE_HORIZONTAL,true)},_0x125fx4,null,_0x125fxb)})));this[_0xe88f[30]](_0xe88f[120], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[86]),[mxConstants[_0xe88f[121]],mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[108]],mxConstants[_0xe88f[112]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[109]),[mxConstants[_0xe88f[121]],mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[110]],mxConstants[_0xe88f[110]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[84]),[mxConstants[_0xe88f[121]],mxConstants[_0xe88f[107]]],[mxConstants[_0xe88f[112]],mxConstants[_0xe88f[108]]],null,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[82]),[mxConstants[_0xe88f[122]],mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[115]],mxConstants[_0xe88f[119]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[116]),[mxConstants[_0xe88f[122]],mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[117]],mxConstants[_0xe88f[117]]],null,_0x125fx4);this[_0xe88f[20]](_0x125fx3,mxResources[_0xe88f[26]](_0xe88f[85]),[mxConstants[_0xe88f[122]],mxConstants[_0xe88f[114]]],[mxConstants[_0xe88f[119]],mxConstants[_0xe88f[115]]],null,_0x125fx4)})));this[_0xe88f[30]](_0xe88f[123], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[124]),null,function(){_0x125fx2[_0xe88f[71]](mxConstants.STYLE_FLIPH,false)},_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[125]),null,function(){_0x125fx2[_0xe88f[71]](mxConstants.STYLE_FLIPV,false)},_0x125fx4);this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],_0xe88f[126],_0xe88f[127]],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[128], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[106]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_LEFT)},_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[109]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_CENTER)},_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[111]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_RIGHT)},_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[113]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_TOP)},_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[116]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_MIDDLE)},_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[118]),null,function(){_0x125fx2[_0xe88f[129]](mxConstants.ALIGN_BOTTOM)},_0x125fx4)})));this[_0xe88f[30]](_0xe88f[130], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[131]),null,mxUtils[_0xe88f[29]](this,function(){var _0x125fxc= new mxHierarchicalLayout(_0x125fx2,mxConstants.DIRECTION_WEST);this[_0xe88f[0]][_0xe88f[132]](_0x125fxc,true,true)}),_0x125fx4);_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0xe88f[133]),null,mxUtils[_0xe88f[29]](this,function(){var _0x125fxc= new mxHierarchicalLayout(_0x125fx2,mxConstants.DIRECTION_NORTH);this[_0xe88f[0]][_0xe88f[132]](_0x125fxc,true,true)}),_0x125fx4)})));this[_0xe88f[30]](_0xe88f[134], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[135],_0xe88f[95],_0xe88f[136],_0xe88f[137],_0xe88f[95],_0xe88f[138],_0xe88f[139]],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[140], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[141],_0xe88f[142],_0xe88f[95]],_0x125fx4);this[_0xe88f[94]](_0xe88f[130],_0x125fx3,_0x125fx4);_0x125fx3[_0xe88f[24]](_0x125fx4);this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],_0xe88f[143],_0xe88f[144],_0xe88f[145]],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[146], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[147]],_0x125fx4);_0x125fx3[_0xe88f[24]]();var _0x125fxd=[0.25,0.5,0.75,1,2,4];for(var _0x125fx6=0;_0x125fx6<_0x125fxd[_0xe88f[18]];_0x125fx6++){(function(_0x125fxe){_0x125fx3[_0xe88f[72]]((_0x125fxe*100)+_0xe88f[148],null,function(){_0x125fx2[_0xe88f[149]](_0x125fxe)},_0x125fx4)})(_0x125fxd[_0x125fx6])};this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],_0xe88f[150],_0xe88f[151],_0xe88f[95],_0xe88f[152],_0xe88f[153],_0xe88f[95],_0xe88f[154],_0xe88f[155]],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[156], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[157],_0xe88f[158],_0xe88f[95],_0xe88f[159],_0xe88f[160],_0xe88f[161],_0xe88f[95],_0xe88f[162],_0xe88f[95],_0xe88f[163],_0xe88f[164],_0xe88f[95],_0xe88f[165],_0xe88f[166],_0xe88f[95],_0xe88f[167]],_0x125fx4)})));this[_0xe88f[30]](_0xe88f[168], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[169],_0xe88f[170],_0xe88f[95],_0xe88f[171],_0xe88f[172],_0xe88f[173],_0xe88f[174],_0xe88f[95],_0xe88f[175],_0xe88f[95],_0xe88f[176],_0xe88f[177],_0xe88f[178]])})));this[_0xe88f[30]](_0xe88f[179], new Menu(mxUtils[_0xe88f[29]](this,function(_0x125fx3,_0x125fx4){this[_0xe88f[99]](_0x125fx3,[_0xe88f[179],_0xe88f[95],_0xe88f[180]])})))};Menus[_0xe88f[5]][_0xe88f[30]]=function(_0x125fxf,_0x125fx3){this[_0xe88f[1]][_0x125fxf]=_0x125fx3};Menus[_0xe88f[5]][_0xe88f[26]]=function(_0x125fxf){return this[_0xe88f[1]][_0x125fxf]};Menus[_0xe88f[5]][_0xe88f[94]]=function(_0x125fxf,_0x125fx3,_0x125fx4){var _0x125fxb=this[_0xe88f[26]](_0x125fxf)[_0xe88f[78]];if(_0x125fx3[_0xe88f[81]]||_0x125fxb){var _0x125fx10=_0x125fx3[_0xe88f[72]](mxResources[_0xe88f[26]](_0x125fxf),null,null,_0x125fx4,null,_0x125fxb);this[_0xe88f[181]](_0x125fxf,_0x125fx3,_0x125fx10)}};Menus[_0xe88f[5]][_0xe88f[181]]=function(_0x125fxf,_0x125fx11,_0x125fx4){var _0x125fx3=this[_0xe88f[26]](_0x125fxf);if(_0x125fx3!=null&&(_0x125fx11[_0xe88f[81]]||_0x125fx3[_0xe88f[78]])){this[_0xe88f[26]](_0x125fxf)[_0xe88f[182]](_0x125fx11,_0x125fx4)}};Menus[_0xe88f[5]][_0xe88f[20]]=function(_0x125fx3,_0x125fx12,_0x125fx13,_0x125fx14,_0x125fx15,_0x125fx4){return _0x125fx3[_0xe88f[72]](_0x125fx12,null,mxUtils[_0xe88f[29]](this,function(){var _0x125fx2=this[_0xe88f[0]][_0xe88f[7]][_0xe88f[6]];_0x125fx2[_0xe88f[184]]()[_0xe88f[183]]();try{for(var _0x125fx6=0;_0x125fx6<_0x125fx13[_0xe88f[18]];_0x125fx6++){_0x125fx2[_0xe88f[185]](_0x125fx13[_0x125fx6],_0x125fx14[_0x125fx6])}}finally{_0x125fx2[_0xe88f[184]]()[_0xe88f[186]]()}}),_0x125fx4,_0x125fx15)};Menus[_0xe88f[5]][_0xe88f[28]]=function(_0x125fx3,_0x125fx12,_0x125fx16,_0x125fx17,_0x125fx18,_0x125fx4,_0x125fxb){return _0x125fx3[_0xe88f[72]](_0x125fx12,null,mxUtils[_0xe88f[29]](this,function(){var _0x125fx2=this[_0xe88f[0]][_0xe88f[7]][_0xe88f[6]];var _0x125fx19=_0x125fx17;var _0x125fx1a=_0x125fx2[_0xe88f[189]]()[_0xe88f[188]](_0x125fx2[_0xe88f[187]]());if(_0x125fx1a!=null){_0x125fx19=_0x125fx1a[_0xe88f[21]][_0x125fx18]||_0x125fx19};_0x125fx19=mxUtils[_0xe88f[192]](mxResources[_0xe88f[26]](_0xe88f[190])+((_0x125fx16[_0xe88f[18]]>0)?(_0xe88f[191]+_0x125fx16):_0xe88f[27]),_0x125fx19);if(_0x125fx19!=null&&_0x125fx19[_0xe88f[18]]>0){_0x125fx2[_0xe88f[185]](_0x125fx18,_0x125fx19)}}),_0x125fx4,null,_0x125fxb)};Menus[_0xe88f[5]][_0xe88f[92]]=function(_0x125fx3,_0x125fx18,_0x125fx4){var _0x125fx1b=this[_0xe88f[0]][_0xe88f[80]][_0xe88f[26]](_0x125fx18);if(_0x125fx1b!=null&&(_0x125fx3[_0xe88f[81]]||_0x125fx1b[_0xe88f[78]])){var _0x125fx1c=_0x125fx3[_0xe88f[72]](_0x125fx1b[_0xe88f[193]],null,_0x125fx1b[_0xe88f[194]],_0x125fx4,null,_0x125fx1b[_0xe88f[78]]);if(_0x125fx1b[_0xe88f[195]]&&_0x125fx1b[_0xe88f[196]]()){this[_0xe88f[197]](_0x125fx1c)};this[_0xe88f[198]](_0x125fx1c,_0x125fx1b);return _0x125fx1c};return null};Menus[_0xe88f[5]][_0xe88f[198]]=function(_0x125fx1c,_0x125fx1b){if(_0x125fx1b[_0xe88f[199]]!=null){var _0x125fx1d=_0x125fx1c[_0xe88f[23]][_0xe88f[22]][_0xe88f[22]];var _0x125fx1e=document[_0xe88f[201]](_0xe88f[200]);_0x125fx1e[_0xe88f[21]][_0xe88f[202]]=_0xe88f[203];mxUtils[_0xe88f[204]](_0x125fx1e,_0x125fx1b[_0xe88f[199]]);_0x125fx1d[_0xe88f[205]](_0x125fx1e)}};Menus[_0xe88f[5]][_0xe88f[197]]=function(_0x125fx1c){var _0x125fx1d=_0x125fx1c[_0xe88f[23]][_0xe88f[22]];_0x125fx1d[_0xe88f[21]][_0xe88f[206]]=_0xe88f[207]+IMAGE_PATH+_0xe88f[208];_0x125fx1d[_0xe88f[21]][_0xe88f[209]]=_0xe88f[210];_0x125fx1d[_0xe88f[21]][_0xe88f[211]]=_0xe88f[212]};Menus[_0xe88f[5]][_0xe88f[99]]=function(_0x125fx3,_0x125fx13,_0x125fx4){for(var _0x125fx6=0;_0x125fx6<_0x125fx13[_0xe88f[18]];_0x125fx6++){if(_0x125fx13[_0x125fx6]==_0xe88f[95]){_0x125fx3[_0xe88f[24]](_0x125fx4)}else {this[_0xe88f[92]](_0x125fx3,_0x125fx13[_0x125fx6],_0x125fx4)}}};Menus[_0xe88f[5]][_0xe88f[213]]=function(_0x125fx3,_0x125fx1f,_0x125fx20){var _0x125fx2=this[_0xe88f[0]][_0xe88f[7]][_0xe88f[6]];_0x125fx3[_0xe88f[214]]=true;if(_0x125fx2[_0xe88f[215]]()){this[_0xe88f[99]](_0x125fx3,[_0xe88f[169],_0xe88f[170],_0xe88f[95],_0xe88f[173],_0xe88f[95]])}else {this[_0xe88f[99]](_0x125fx3,[_0xe88f[174],_0xe88f[95],_0xe88f[171],_0xe88f[172],_0xe88f[95],_0xe88f[175]]);if(_0x125fx2[_0xe88f[216]]()==1&&_0x125fx2[_0xe88f[184]]()[_0xe88f[217]](_0x125fx2[_0xe88f[187]]())){this[_0xe88f[99]](_0x125fx3,[_0xe88f[218]])};_0x125fx3[_0xe88f[24]]()};if(_0x125fx2[_0xe88f[216]]()>0){this[_0xe88f[99]](_0x125fx3,[_0xe88f[141],_0xe88f[142],_0xe88f[95]]);if(_0x125fx2[_0xe88f[184]]()[_0xe88f[217]](_0x125fx2[_0xe88f[187]]())){var _0x125fx21=false;var _0x125fx1f=_0x125fx2[_0xe88f[187]]();if(_0x125fx1f!=null&&_0x125fx2[_0xe88f[184]]()[_0xe88f[217]](_0x125fx1f)){var _0x125fx22=_0x125fx2[_0xe88f[220]][_0xe88f[219]](_0x125fx1f);if(_0x125fx22 instanceof mxEdgeHandler&&_0x125fx22[_0xe88f[221]]!=null&&_0x125fx22[_0xe88f[221]][_0xe88f[18]]>2){var _0x125fx23=_0x125fx22[_0xe88f[222]]( new mxMouseEvent(_0x125fx20));var _0x125fx24=this[_0xe88f[0]][_0xe88f[80]][_0xe88f[26]](_0xe88f[223]);_0x125fx24[_0xe88f[224]]=_0x125fx22;_0x125fx24[_0xe88f[225]]=_0x125fx23;_0x125fx21=_0x125fx23>0&&_0x125fx23<_0x125fx22[_0xe88f[221]][_0xe88f[18]]}};this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],(_0x125fx21)?_0xe88f[223]:_0xe88f[226]])}else {if(_0x125fx2[_0xe88f[216]]()>1){_0x125fx3[_0xe88f[24]]();this[_0xe88f[99]](_0x125fx3,[_0xe88f[143]])}};_0x125fx3[_0xe88f[24]]();if(_0x125fx2[_0xe88f[216]]()==1){var _0x125fx25=_0x125fx2[_0xe88f[227]](_0x125fx2[_0xe88f[187]]());if(_0x125fx25!=null){this[_0xe88f[99]](_0x125fx3,[_0xe88f[228]])}}}else {this[_0xe88f[99]](_0x125fx3,[_0xe88f[95],_0xe88f[176],_0xe88f[177],_0xe88f[95],_0xe88f[178]])}};Menus[_0xe88f[5]][_0xe88f[229]]=function(_0x125fx26){var _0x125fx27= new Menubar(this[_0xe88f[0]],_0x125fx26);var _0x125fx28=[_0xe88f[156],_0xe88f[168],_0xe88f[146],_0xe88f[91],_0xe88f[93],_0xe88f[140],_0xe88f[179]];for(var _0x125fx6=0;_0x125fx6<_0x125fx28[_0xe88f[18]];_0x125fx6++){_0x125fx27[_0xe88f[181]](mxResources[_0xe88f[26]](_0x125fx28[_0x125fx6]),this[_0xe88f[26]](_0x125fx28[_0x125fx6])[_0xe88f[194]])};return _0x125fx27};function Menubar(_0x125fx1,_0x125fx26){this[_0xe88f[0]]=_0x125fx1;this[_0xe88f[230]]=_0x125fx26;mxEvent[_0xe88f[232]](document,mxUtils[_0xe88f[29]](this,function(_0x125fx20){this[_0xe88f[231]]()}))}Menubar[_0xe88f[5]][_0xe88f[231]]=function(){if(this[_0xe88f[233]]!=null){this[_0xe88f[233]][_0xe88f[231]]()}};Menubar[_0xe88f[5]][_0xe88f[181]]=function(_0x125fx12,_0x125fx2a){var _0x125fx2b=document[_0xe88f[201]](_0xe88f[234]);_0x125fx2b[_0xe88f[237]](_0xe88f[235],_0xe88f[236]);_0x125fx2b[_0xe88f[238]]=_0xe88f[239];mxUtils[_0xe88f[204]](_0x125fx2b,_0x125fx12);this[_0xe88f[240]](_0x125fx2b,_0x125fx2a);this[_0xe88f[230]][_0xe88f[205]](_0x125fx2b);return _0x125fx2b};Menubar[_0xe88f[5]][_0xe88f[240]]=function(_0x125fx2b,_0x125fx2a){if(_0x125fx2a!=null){var _0x125fx2c=true;var _0x125fx2d=mxUtils[_0xe88f[29]](this,function(_0x125fx20){if(_0x125fx2c&&_0x125fx2b[_0xe88f[78]]==null||_0x125fx2b[_0xe88f[78]]){this[_0xe88f[0]][_0xe88f[7]][_0xe88f[6]][_0xe88f[241]][_0xe88f[231]]();var _0x125fx3= new mxPopupMenu(_0x125fx2a);_0x125fx3[_0xe88f[242]][_0xe88f[238]]+=_0xe88f[243];_0x125fx3[_0xe88f[214]]=true;_0x125fx3[_0xe88f[81]]=true;_0x125fx3[_0xe88f[244]]=true;_0x125fx3[_0xe88f[231]]=mxUtils[_0xe88f[29]](this,function(){mxPopupMenu[_0xe88f[5]][_0xe88f[231]][_0xe88f[245]](_0x125fx3,arguments);_0x125fx3[_0xe88f[246]]();this[_0xe88f[233]]=null;this[_0xe88f[247]]=null});var _0x125fx2e=_0x125fx2b[_0xe88f[248]]+document[_0xe88f[251]](_0xe88f[250])[_0xe88f[249]]+22;var _0x125fx2f=_0x125fx2b[_0xe88f[252]]+_0x125fx2b[_0xe88f[253]]+140;_0x125fx3[_0xe88f[254]](_0x125fx2e,_0x125fx2f,null,_0x125fx20);this[_0xe88f[233]]=_0x125fx3;this[_0xe88f[247]]=_0x125fx2b};_0x125fx2c=true;mxEvent[_0xe88f[255]](_0x125fx20)});mxEvent[_0xe88f[257]](_0x125fx2b,_0xe88f[256],mxUtils[_0xe88f[29]](this,function(_0x125fx20){if(this[_0xe88f[233]]!=null&&this[_0xe88f[247]]!=_0x125fx2b){this[_0xe88f[231]]();_0x125fx2d(_0x125fx20)}}));mxEvent[_0xe88f[257]](_0x125fx2b,_0xe88f[258],mxUtils[_0xe88f[29]](this,function(){_0x125fx2c=this[_0xe88f[247]]!=_0x125fx2b}));mxEvent[_0xe88f[257]](_0x125fx2b,_0xe88f[259],_0x125fx2d)}};function Menu(_0x125fx2a,_0x125fxb){mxEventSource[_0xe88f[260]](this);this[_0xe88f[194]]=_0x125fx2a;this[_0xe88f[78]]=(_0x125fxb!=null)?_0x125fxb:true}mxUtils[_0xe88f[261]](Menu,mxEventSource);Menu[_0xe88f[5]][_0xe88f[262]]=function(_0x125fx19){if(this[_0xe88f[78]]!=_0x125fx19){this[_0xe88f[78]]=_0x125fx19;this[_0xe88f[264]]( new mxEventObject(_0xe88f[263]))}};Menu[_0xe88f[5]][_0xe88f[182]]=function(_0x125fx3,_0x125fx4){this[_0xe88f[194]](_0x125fx3,_0x125fx4)} \ No newline at end of file +/** + * $Id: Menus.js,v 1.13 2013-02-20 16:21:29 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Constructs a new graph editor + */ +Menus = function(editorUi) { + this.editorUi = editorUi; + this.menus = new Object(); + this.init(); + + // Pre-fetches checkmark image + new Image().src = IMAGE_PATH + '/checkmark.gif'; +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.init = function() { + var graph = this.editorUi.editor.graph; + + this.put('fontFamily', new Menu(mxUtils.bind(this, function(menu, parent) { + var fonts = ['Helvetica', 'Verdana', 'Times New Roman', 'Garamond', + 'Comic Sans MS', + 'Courier New', 'Georgia', 'Lucida Console', 'Tahoma' + ]; + + for (var i = 0; i < fonts.length; i++) { + var tr = this.styleChange(menu, fonts[i], [mxConstants.STYLE_FONTFAMILY], [ + fonts[i] + ], null, parent); + tr.firstChild.nextSibling.style.fontFamily = fonts[i]; + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '', mxConstants.DEFAULT_FONTFAMILY, + mxConstants.STYLE_FONTFAMILY, parent); + }))); + this.put('fontSize', new Menu(mxUtils.bind(this, function(menu, parent) { + var sizes = [6, 8, 9, 10, 11, 12, 14, 18, 24, 36, 48, 72]; + + for (var i = 0; i < sizes.length; i++) { + this.styleChange(menu, sizes[i], [mxConstants.STYLE_FONTSIZE], [sizes[i]], + null, parent); + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '(pt)', '12', + mxConstants.STYLE_FONTSIZE, parent); + }))); + this.put('linewidth', new Menu(mxUtils.bind(this, function(menu, parent) { + var sizes = [1, 2, 3, 4, 8, 12, 16, 24]; + + for (var i = 0; i < sizes.length; i++) { + this.styleChange(menu, sizes[i] + 'px', [mxConstants.STYLE_STROKEWIDTH], [ + sizes[i] + ], null, parent); + } + + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('custom'), '(px)', '1', + mxConstants.STYLE_STROKEWIDTH, parent); + }))); + this.put('line', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('straight'), [mxConstants.STYLE_EDGE], [ + null + ], null, parent); + this.styleChange(menu, mxResources.get('entityRelation'), [mxConstants.STYLE_EDGE], [ + 'entityRelationEdgeStyle' + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('horizontal'), [mxConstants.STYLE_EDGE, + mxConstants.STYLE_ELBOW + ], ['elbowEdgeStyle', 'horizontal'], null, parent); + this.styleChange(menu, mxResources.get('vertical'), [mxConstants.STYLE_EDGE, + mxConstants.STYLE_ELBOW + ], ['elbowEdgeStyle', 'vertical'], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('manual'), [mxConstants.STYLE_EDGE], [ + 'segmentEdgeStyle' + ], null, parent); + this.styleChange(menu, mxResources.get('automatic'), [mxConstants.STYLE_EDGE], [ + 'orthogonalEdgeStyle' + ], null, parent); + }))); + this.put('lineend', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('classic'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_CLASSIC + ], null, parent); + this.styleChange(menu, mxResources.get('openArrow'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_OPEN + ], null, parent); + this.styleChange(menu, mxResources.get('block'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_BLOCK + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('oval'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_OVAL + ], null, parent); + this.styleChange(menu, mxResources.get('diamond'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_DIAMOND + ], null, parent); + this.styleChange(menu, mxResources.get('diamondThin'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.ARROW_DIAMOND_THIN + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('none'), [mxConstants.STYLE_ENDARROW], [ + mxConstants.NONE + ], null, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('transparent'), null, function() { + graph.toggleCellStyles('endFill', true); + }, parent, null, true); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('size'), '(px)', mxConstants.DEFAULT_MARKERSIZE, + mxConstants.STYLE_ENDSIZE, parent); + }))); + this.put('linestart', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('classic'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_CLASSIC + ], null, parent); + this.styleChange(menu, mxResources.get('openArrow'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_OPEN + ], null, parent); + this.styleChange(menu, mxResources.get('block'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_BLOCK + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('oval'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_OVAL + ], null, parent); + this.styleChange(menu, mxResources.get('diamond'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_DIAMOND + ], null, parent); + this.styleChange(menu, mxResources.get('diamondThin'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.ARROW_DIAMOND_THIN + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('none'), [mxConstants.STYLE_STARTARROW], [ + mxConstants.NONE + ], null, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('transparent'), null, function() { + graph.toggleCellStyles('startFill', true); + }, parent, null, true); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('size'), '(px)', mxConstants.DEFAULT_MARKERSIZE, + mxConstants.STYLE_STARTSIZE, parent); + }))); + this.put('spacing', new Menu(mxUtils.bind(this, function(menu, parent) { + // Uses shadow action and line menu to analyze selection + var vertexSelected = this.editorUi.actions.get('shadow').enabled; + var edgeSelected = this.get('line').enabled; + + if (vertexSelected || menu.showDisabled) { + this.promptChange(menu, mxResources.get('top'), '(px)', '0', + mxConstants.STYLE_SPACING_TOP, parent, vertexSelected); + this.promptChange(menu, mxResources.get('right'), '(px)', '0', + mxConstants.STYLE_SPACING_RIGHT, parent, vertexSelected); + this.promptChange(menu, mxResources.get('bottom'), '(px)', '0', + mxConstants.STYLE_SPACING_BOTTOM, parent, vertexSelected); + this.promptChange(menu, mxResources.get('left'), '(px)', '0', + mxConstants.STYLE_SPACING_LEFT, parent, vertexSelected); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('global'), '(px)', '0', + mxConstants.STYLE_SPACING, parent, vertexSelected); + this.promptChange(menu, mxResources.get('perimeter'), '(px)', '0', + mxConstants.STYLE_PERIMETER_SPACING, parent, vertexSelected); + } + + if (edgeSelected || menu.showDisabled) { + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('sourceSpacing'), '(px)', '0', + mxConstants.STYLE_SOURCE_PERIMETER_SPACING, parent, edgeSelected); + this.promptChange(menu, mxResources.get('targetSpacing'), '(px)', '0', + mxConstants.STYLE_TARGET_PERIMETER_SPACING, parent, edgeSelected); + } + }))); + this.put('format', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItem(menu, 'style', parent); + }))); + this.put('text', new Menu(mxUtils.bind(this, function(menu, parent) { + var enabled = this.get('text').enabled; + menu.addSeparator(parent); + this.addSubmenu('fontFamily', menu, parent); + this.addSubmenu('fontSize', menu, parent); + this.addMenuItems(menu, ['-', 'bold', 'italic', 'underline', '-'], + parent); + this.addSubmenu('alignment', menu, parent); + this.addMenuItem(menu, 'wordWrap', parent); + menu.addSeparator(parent); + this.promptChange(menu, mxResources.get('textOpacity'), '(%)', '100', + mxConstants.STYLE_TEXT_OPACITY, parent, enabled); + menu.addItem(mxResources.get('hide'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_NOLABEL, false); + }, parent, null, enabled); + }))); + this.put('alignment', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('leftAlign'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_LEFT + ], null, parent); + this.styleChange(menu, mxResources.get('center'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_CENTER + ], null, parent); + this.styleChange(menu, mxResources.get('rightAlign'), [mxConstants.STYLE_ALIGN], [ + mxConstants.ALIGN_RIGHT + ], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('topAlign'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_TOP + ], null, parent); + this.styleChange(menu, mxResources.get('middle'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_MIDDLE + ], null, parent); + this.styleChange(menu, mxResources.get('bottomAlign'), [mxConstants.STYLE_VERTICAL_ALIGN], [ + mxConstants.ALIGN_BOTTOM + ], null, parent); + menu.addSeparator(parent); + this.addSubmenu('position', menu, parent); + this.addSubmenu('spacing', menu, parent); + menu.addSeparator(parent); + var enabled = this.get('text').enabled; + menu.addItem(mxResources.get('vertical'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_HORIZONTAL, true); + }, parent, null, enabled); + }))); + this.put('position', new Menu(mxUtils.bind(this, function(menu, parent) { + this.styleChange(menu, mxResources.get('left'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_LEFT, mxConstants.ALIGN_RIGHT], null, parent); + this.styleChange(menu, mxResources.get('center'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_CENTER, mxConstants.ALIGN_CENTER], null, parent); + this.styleChange(menu, mxResources.get('right'), [mxConstants.STYLE_LABEL_POSITION, + mxConstants.STYLE_ALIGN + ], [mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_LEFT], null, parent); + menu.addSeparator(parent); + this.styleChange(menu, mxResources.get('top'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_TOP, mxConstants.ALIGN_BOTTOM], null, parent); + this.styleChange(menu, mxResources.get('middle'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_MIDDLE, mxConstants.ALIGN_MIDDLE], null, parent); + this.styleChange(menu, mxResources.get('bottom'), [mxConstants.STYLE_VERTICAL_LABEL_POSITION, + mxConstants.STYLE_VERTICAL_ALIGN + ], [mxConstants.ALIGN_BOTTOM, mxConstants.ALIGN_TOP], null, parent); + }))); + this.put('direction', new Menu(mxUtils.bind(this, function(menu, parent) { + menu.addItem(mxResources.get('flipH'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_FLIPH, false); + }, parent); + menu.addItem(mxResources.get('flipV'), null, function() { + graph.toggleCellStyles(mxConstants.STYLE_FLIPV, false); + }, parent); + this.addMenuItems(menu, ['-', 'tilt', 'rotation'], parent); + }))); + this.put('align', new Menu(mxUtils.bind(this, function(menu, parent) { + menu.addItem(mxResources.get('leftAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_LEFT); + }, parent); + menu.addItem(mxResources.get('center'), null, function() { + graph.alignCells(mxConstants.ALIGN_CENTER); + }, parent); + menu.addItem(mxResources.get('rightAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_RIGHT); + }, parent); + menu.addSeparator(parent); + menu.addItem(mxResources.get('topAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_TOP); + }, parent); + menu.addItem(mxResources.get('middle'), null, function() { + graph.alignCells(mxConstants.ALIGN_MIDDLE); + }, parent); + menu.addItem(mxResources.get('bottomAlign'), null, function() { + graph.alignCells(mxConstants.ALIGN_BOTTOM); + }, parent); + }))); + this.put('layout', new Menu(mxUtils.bind(this, function(menu, parent) { + // menu.addItem(mxResources.get('horizontalTree'), null, mxUtils.bind(this, function() + // { + // if (!graph.isSelectionEmpty()) + // { + // var layout = new mxCompactTreeLayout(graph, true); + // layout.edgeRouting = false; + // layout.levelDistance = 30; + // this.editorUi.executeLayout(layout, true, true); + // } + // }), parent); + // menu.addItem(mxResources.get('verticalTree'), null, mxUtils.bind(this, function() + // { + // if (!graph.isSelectionEmpty()) + // { + // var layout = new mxCompactTreeLayout(graph, false); + // layout.edgeRouting = false; + // layout.levelDistance = 30; + // this.editorUi.executeLayout(layout, true, true); + // } + // }), parent); + // menu.addSeparator(parent); + menu.addItem(mxResources.get('horizontalFlow'), null, mxUtils.bind(this, + function() { + var layout = new mxHierarchicalLayout(graph, mxConstants.DIRECTION_WEST); + this.editorUi.executeLayout(layout, true, true); + }), parent); + menu.addItem(mxResources.get('verticalFlow'), null, mxUtils.bind(this, + function() { + var layout = new mxHierarchicalLayout(graph, mxConstants.DIRECTION_NORTH); + this.editorUi.executeLayout(layout, true, true); + }), parent); + //menu.addSeparator(parent); + // menu.addItem(mxResources.get('organic'), null, mxUtils.bind(this, function() + // { + // var layout = new mxFastOrganicLayout(graph); + // this.editorUi.executeLayout(layout, true, true); + // }), parent); + // menu.addItem(mxResources.get('circle'), null, mxUtils.bind(this, function() + // { + // var layout = new mxCircleLayout(graph); + // this.editorUi.executeLayout(layout, true, true, graph.getSelectionCells()); + // }), parent); + }))); + this.put('navigation', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['home', '-', 'exitGroup', 'enterGroup', '-', + 'expand', 'collapse' + ], parent); + }))); + this.put('arrange', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['toFront', 'toBack', '-'], parent); + //this.addSubmenu('direction', menu, parent); + this.addSubmenu('layout', menu, parent); + //this.addSubmenu('align', menu, parent); + menu.addSeparator(parent); + //this.addSubmenu('navigation', menu, parent); + this.addMenuItems(menu, ['-', 'group', 'ungroup', 'removeFromGroup'], + parent); + //this.addMenuItems(menu, ['-', 'group', 'ungroup', 'removeFromGroup', '-', 'autosize'], parent); + }))); + this.put('view', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['actualSize'], parent); + menu.addSeparator(); + var scales = [0.25, 0.5, 0.75, 1, 2, 4]; + + for (var i = 0; i < scales.length; i++) { + (function(scale) { + menu.addItem((scale * 100) + '%', null, function() { + graph.zoomTo(scale); + }, parent); + })(scales[i]); + } + + this.addMenuItems(menu, ['-', 'zoomIn', 'zoomOut', '-', 'fitWindow', + 'customZoom', '-', 'fitPage', 'fitPageWidth' + ], parent); + }))); + this.put('file', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['new', 'open', '-', 'save', 'saveAs', 'publish', + '-', 'variable', '-', 'import', 'export', '-', 'editFile', 'rename', '-', + 'print' + ], parent); + }))); + this.put('edit', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['undo', 'redo', '-', 'cut', 'copy', 'paste', + 'delete', '-', 'duplicate', '-', + 'selectVertices', 'selectEdges', 'selectAll' + ]); + }))); + this.put('help', new Menu(mxUtils.bind(this, function(menu, parent) { + this.addMenuItems(menu, ['help', '-', 'about']); + }))); +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.put = function(name, menu) { + this.menus[name] = menu; +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.get = function(name) { + return this.menus[name]; +}; + +/** + * Adds the given submenu. + */ +Menus.prototype.addSubmenu = function(name, menu, parent) { + var enabled = this.get(name).enabled; + + if (menu.showDisabled || enabled) { + var submenu = menu.addItem(mxResources.get(name), null, null, parent, null, + enabled); + this.addMenu(name, menu, submenu); + } +}; + +/** + * Adds the label menu items to the given menu and parent. + */ +Menus.prototype.addMenu = function(name, popupMenu, parent) { + var menu = this.get(name); + + if (menu != null && (popupMenu.showDisabled || menu.enabled)) { + this.get(name).execute(popupMenu, parent); + } +}; + +/** + * Adds a style change item to the given menu. + */ +Menus.prototype.styleChange = function(menu, label, keys, values, sprite, + parent) { + return menu.addItem(label, null, mxUtils.bind(this, function() { + var graph = this.editorUi.editor.graph; + + graph.getModel().beginUpdate(); + try { + for (var i = 0; i < keys.length; i++) { + graph.setCellStyles(keys[i], values[i]); + } + } finally { + graph.getModel().endUpdate(); + } + }), parent, sprite); +}; + +/** + * Adds a style change item with a prompt to the given menu. + */ +Menus.prototype.promptChange = function(menu, label, hint, defaultValue, key, + parent, enabled) { + return menu.addItem(label, null, mxUtils.bind(this, function() { + var graph = this.editorUi.editor.graph; + var value = defaultValue; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) { + value = state.style[key] || value; + } + + value = mxUtils.prompt(mxResources.get('enterValue') + ((hint.length > 0) ? + (' ' + hint) : ''), value); + + if (value != null && value.length > 0) { + graph.setCellStyles(key, value); + } + }), parent, null, enabled); +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.addMenuItem = function(menu, key, parent) { + var action = this.editorUi.actions.get(key); + + if (action != null && (menu.showDisabled || action.enabled)) { + var item = menu.addItem(action.label, null, action.funct, parent, null, + action.enabled); + + // Adds checkmark image + if (action.toggleAction && action.isSelected()) { + this.addCheckmark(item); + } + + this.addShortcut(item, action); + + return item; + } + + return null; +}; + +/** + * Adds a checkmark to the given menuitem. + */ +Menus.prototype.addShortcut = function(item, action) { + if (action.shortcut != null) { + var td = item.firstChild.nextSibling.nextSibling; + var span = document.createElement('span'); + span.style.color = 'gray'; + mxUtils.write(span, action.shortcut); + td.appendChild(span); + } +}; + +/** + * Adds a checkmark to the given menuitem. + */ +Menus.prototype.addCheckmark = function(item) { + var td = item.firstChild.nextSibling; + td.style.backgroundImage = 'url(' + IMAGE_PATH + '/checkmark.gif)'; + td.style.backgroundRepeat = 'no-repeat'; + td.style.backgroundPosition = '2px 50%'; +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.addMenuItems = function(menu, keys, parent) { + for (var i = 0; i < keys.length; i++) { + if (keys[i] == '-') { + menu.addSeparator(parent); + } else { + this.addMenuItem(menu, keys[i], parent); + } + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.createPopupMenu = function(menu, cell, evt) { + var graph = this.editorUi.editor.graph; + menu.smartSeparators = true; + + if (graph.isSelectionEmpty()) { + this.addMenuItems(menu, ['undo', 'redo', '-', 'paste', '-']); + } else { + this.addMenuItems(menu, ['delete', '-', 'cut', 'copy', '-', 'duplicate']); + + if (graph.getSelectionCount() == 1 && graph.getModel().isEdge(graph.getSelectionCell())) { + this.addMenuItems(menu, ['setAsDefaultEdge']); + } + + menu.addSeparator(); + } + + if (graph.getSelectionCount() > 0) { + this.addMenuItems(menu, ['toFront', 'toBack', '-']); + + if (graph.getModel().isEdge(graph.getSelectionCell())) { + var isWaypoint = false; + var cell = graph.getSelectionCell(); + + if (cell != null && graph.getModel().isEdge(cell)) { + var handler = graph.selectionCellsHandler.getHandler(cell); + + if (handler instanceof mxEdgeHandler && handler.bends != null && handler.bends + .length > 2) { + var index = handler.getHandleForEvent(new mxMouseEvent(evt)); + + // Configures removeWaypoint action before execution + var rmWaypointAction = this.editorUi.actions.get('removeWaypoint'); + rmWaypointAction.handler = handler; + rmWaypointAction.index = index; + + isWaypoint = index > 0 && index < handler.bends.length; + } + } + + this.addMenuItems(menu, ['-', (isWaypoint) ? 'removeWaypoint' : + 'addWaypoint' + ]); + } else if (graph.getSelectionCount() > 1) { + menu.addSeparator(); + this.addMenuItems(menu, ['group']); + } + + menu.addSeparator(); + + if (graph.getSelectionCount() == 1) { + var link = graph.getLinkForCell(graph.getSelectionCell()); + + if (link != null) { + this.addMenuItems(menu, ['openLink']); + } + } + } else { + this.addMenuItems(menu, ['-', 'selectVertices', 'selectEdges', '-', + 'selectAll' + ]); + } +}; + +/** + * Creates the keyboard event handler for the current graph and history. + */ +Menus.prototype.createMenubar = function(container) { + var menubar = new Menubar(this.editorUi, container); + var menus = ['file', 'edit', 'view', 'format', 'text', 'arrange', + 'help' + ]; + + for (var i = 0; i < menus.length; i++) { + menubar.addMenu(mxResources.get(menus[i]), this.get(menus[i]).funct); + } + + return menubar; +}; + +/** + * Construcs a new menubar for the given editor. + */ +function Menubar(editorUi, container) { + this.editorUi = editorUi; + this.container = container; + + // Global handler to hide the current menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) { + this.hideMenu(); + })); +}; + +/** + * Adds the menubar elements. + */ +Menubar.prototype.hideMenu = function() { + if (this.currentMenu != null) { + this.currentMenu.hideMenu(); + } +}; + +/** + * Adds a submenu to this menubar. + */ +Menubar.prototype.addMenu = function(label, funct) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geItem'; + mxUtils.write(elt, label); + + this.addMenuHandler(elt, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds a handler for showing a menu in the given element. + */ +Menubar.prototype.addMenuHandler = function(elt, funct) { + if (funct != null) { + var show = true; + + var clickHandler = mxUtils.bind(this, function(evt) { + if (show && elt.enabled == null || elt.enabled) { + this.editorUi.editor.graph.panningHandler.hideMenu(); + var menu = new mxPopupMenu(funct); + menu.div.className += ' geMenubarMenu'; + menu.smartSeparators = true; + menu.showDisabled = true; + menu.autoExpand = true; + + // Disables autoexpand and destroys menu when hidden + menu.hideMenu = mxUtils.bind(this, function() { + mxPopupMenu.prototype.hideMenu.apply(menu, arguments); + menu.destroy(); + this.currentMenu = null; + this.currentElt = null; + }); + + // Added width of the page-sidebar + var x = elt.offsetLeft + document.getElementById('page-sidebar').offsetWidth + + 22; + // Added static height of the page-navbar + var y = elt.offsetTop + elt.offsetHeight + 140; + + menu.popup(x, y, null, evt); + + //menu.popup(elt.offsetLeft + 4, elt.offsetTop + elt.offsetHeight + 4, null, evt); + this.currentMenu = menu; + this.currentElt = elt; + } + + show = true; + mxEvent.consume(evt); + }); + + // Shows menu automatically while in expanded state + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + if (this.currentMenu != null && this.currentElt != elt) { + this.hideMenu(); + clickHandler(evt); + } + })); + + // Hides menu if already showing + mxEvent.addListener(elt, 'mousedown', mxUtils.bind(this, function() { + show = this.currentElt != elt; + })); + + mxEvent.addListener(elt, 'click', clickHandler); + } +}; + +/** + * Constructs a new action for the given parameters. + */ +function Menu(funct, enabled) { + mxEventSource.call(this); + this.funct = funct; + this.enabled = (enabled != null) ? enabled : true; +}; + +// Menu inherits from mxEventSource +mxUtils.extend(Menu, mxEventSource); + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Menu.prototype.setEnabled = function(value) { + if (this.enabled != value) { + this.enabled = value; + this.fireEvent(new mxEventObject('stateChanged')); + } +}; + +/** + * Sets the enabled state of the action and fires a stateChanged event. + */ +Menu.prototype.execute = function(menu, parent) { + this.funct(menu, parent); +}; diff --git a/public/assets/plugins/square/js/Shapes.js b/public/assets/plugins/square/js/Shapes.js index 8c205d8..42e13ca 100644 --- a/public/assets/plugins/square/js/Shapes.js +++ b/public/assets/plugins/square/js/Shapes.js @@ -1 +1,1234 @@ -var _0x653f=["\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x6F\x6E\x73\x74\x72\x75\x63\x74\x6F\x72","\x73\x69\x7A\x65","\x72\x65\x64\x72\x61\x77\x50\x61\x74\x68","\x73\x74\x79\x6C\x65","\x67\x65\x74\x56\x61\x6C\x75\x65","\x6D\x69\x6E","\x6D\x6F\x76\x65\x54\x6F","\x6C\x69\x6E\x65\x54\x6F","\x65\x6E\x64","\x63\x6C\x6F\x73\x65","\x63\x75\x62\x65","\x64\x65\x66\x61\x75\x6C\x74\x53\x68\x61\x70\x65\x73","\x6E\x6F\x74\x65","\x74\x61\x62\x57\x69\x64\x74\x68","\x74\x61\x62\x48\x65\x69\x67\x68\x74","\x74\x61\x62\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x72\x69\x67\x68\x74","\x6C\x65\x66\x74","\x66\x6F\x6C\x64\x65\x72","\x63\x61\x72\x64","\x71\x75\x61\x64\x54\x6F","\x74\x61\x70\x65","\x73\x74\x65\x70","\x63\x61\x6C\x6C","\x65\x78\x74\x65\x6E\x64","\x69\x73\x48\x74\x6D\x6C\x41\x6C\x6C\x6F\x77\x65\x64","\x70\x61\x69\x6E\x74\x46\x6F\x72\x65\x67\x72\x6F\x75\x6E\x64","\x62\x65\x67\x69\x6E","\x73\x74\x72\x6F\x6B\x65","\x61\x70\x70\x6C\x79","\x70\x6C\x75\x73","\x64\x6F\x75\x62\x6C\x65","\x73\x74\x72\x6F\x6B\x65\x77\x69\x64\x74\x68","\x6D\x61\x78","\x70\x61\x69\x6E\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x73\x65\x74\x44\x61\x73\x68\x65\x64","\x73\x79\x6D\x62\x6F\x6C","\x41\x6C\x69\x67\x6E","\x56\x65\x72\x74\x69\x63\x61\x6C\x41\x6C\x69\x67\x6E","\x57\x69\x64\x74\x68","\x48\x65\x69\x67\x68\x74","\x53\x70\x61\x63\x69\x6E\x67","\x41\x72\x63\x53\x70\x61\x63\x69\x6E\x67","\x67\x65\x74\x41\x72\x63\x53\x69\x7A\x65","\x41\x4C\x49\x47\x4E\x5F\x43\x45\x4E\x54\x45\x52","\x41\x4C\x49\x47\x4E\x5F\x52\x49\x47\x48\x54","\x41\x4C\x49\x47\x4E\x5F\x4D\x49\x44\x44\x4C\x45","\x41\x4C\x49\x47\x4E\x5F\x42\x4F\x54\x54\x4F\x4D","\x73\x61\x76\x65","\x70\x61\x69\x6E\x74\x56\x65\x72\x74\x65\x78\x53\x68\x61\x70\x65","\x72\x65\x73\x74\x6F\x72\x65","\x65\x78\x74","\x6D\x65\x73\x73\x61\x67\x65","\x61\x64\x64\x50\x69\x70\x65","\x63\x75\x72\x76\x65\x54\x6F","\x75\x6D\x6C\x41\x63\x74\x6F\x72","\x6C\x6F\x6C\x6C\x69\x70\x6F\x70","\x6A\x65\x74\x74\x79\x57\x69\x64\x74\x68","\x6A\x65\x74\x74\x79\x48\x65\x69\x67\x68\x74","\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74","\x6F\x75\x74\x65\x72\x53\x74\x72\x6F\x6B\x65","\x65\x6C\x6C\x69\x70\x73\x65","\x66\x69\x6C\x6C\x41\x6E\x64\x53\x74\x72\x6F\x6B\x65","\x73\x65\x74\x53\x68\x61\x64\x6F\x77","\x65\x6E\x64\x53\x74\x61\x74\x65","\x73\x74\x61\x72\x74\x53\x74\x61\x74\x65","\x69\x6E\x69\x74\x53\x68\x61\x70\x65\x73","\x78","\x79","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x73\x68\x61\x70\x65\x73","\x70\x61\x69\x6E\x74\x45\x64\x67\x65\x53\x68\x61\x70\x65","\x6C\x65\x6E\x67\x74\x68","\x73\x71\x72\x74","\x6C\x69\x6E\x6B","\x64\x61\x73\x68","\x61\x64\x64\x4D\x61\x72\x6B\x65\x72","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x75\x73\x65\x47\x72\x69\x64\x46\x6F\x72\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65","\x69\x6E\x69\x74","\x68\x6F\x72\x69\x7A\x6F\x6E\x74\x61\x6C","\x73\x74\x61\x74\x65","\x67\x72\x61\x70\x68","\x76\x69\x65\x77","\x68\x61\x6E\x64\x6C\x65\x49\x6D\x61\x67\x65","\x73\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65","\x73\x72\x63","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x44\x49\x41\x4C\x45\x43\x54\x5F\x56\x4D\x4C","\x67\x65\x74\x4F\x76\x65\x72\x6C\x61\x79\x50\x61\x6E\x65","\x67\x65\x74\x56\x69\x65\x77","\x63\x75\x72\x73\x6F\x72","\x6E\x6F\x64\x65","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x43\x75\x72\x73\x6F\x72","\x72\x65\x64\x69\x72\x65\x63\x74\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73","\x64\x65\x66\x61\x75\x6C\x74","\x72\x65\x64\x72\x61\x77","\x62\x6F\x75\x6E\x64\x73","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x42\x6F\x75\x6E\x64\x73","\x64\x65\x73\x74\x72\x6F\x79","\x67\x65\x74\x48\x61\x6E\x64\x6C\x65\x46\x6F\x72\x45\x76\x65\x6E\x74","\x69\x73\x53\x6F\x75\x72\x63\x65","\x6D\x6F\x75\x73\x65\x4D\x6F\x76\x65","\x69\x73\x43\x6F\x6E\x73\x75\x6D\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74\x47\x72\x61\x70\x68\x58","\x67\x65\x74\x47\x72\x61\x70\x68\x59","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x50\x6F\x69\x6E\x74","\x67\x65\x74\x45\x76\x65\x6E\x74","\x69\x73\x47\x72\x69\x64\x45\x6E\x61\x62\x6C\x65\x64\x45\x76\x65\x6E\x74","\x73\x63\x61\x6C\x65","\x73\x6E\x61\x70","\x75\x70\x64\x61\x74\x65\x53\x74\x79\x6C\x65","\x6D\x6F\x76\x65\x53\x69\x7A\x65\x72\x54\x6F","\x63\x65\x6C\x6C\x52\x65\x6E\x64\x65\x72\x65\x72","\x63\x6F\x6E\x73\x75\x6D\x65","\x6D\x6F\x75\x73\x65\x55\x70","\x61\x70\x70\x6C\x79\x53\x74\x79\x6C\x65","\x72\x65\x73\x65\x74","\x67\x65\x74\x53\x68\x61\x70\x65\x52\x6F\x74\x61\x74\x69\x6F\x6E","\x73\x68\x61\x70\x65","\x74\x6F\x52\x61\x64\x69\x61\x6E\x73","\x63\x6F\x73","\x73\x69\x6E","\x69\x73\x50\x61\x69\x6E\x74\x42\x6F\x75\x6E\x64\x73\x49\x6E\x76\x65\x72\x74\x65\x64","\x67\x65\x74\x53\x70\x65\x63\x69\x61\x6C\x48\x61\x6E\x64\x6C\x65\x50\x6F\x69\x6E\x74","\x66\x6C\x69\x70\x48","\x66\x6C\x69\x70\x56","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x58","\x67\x65\x74\x43\x65\x6E\x74\x65\x72\x59","\x67\x65\x74\x52\x6F\x74\x61\x74\x65\x64\x50\x6F\x69\x6E\x74","\x75\x70\x64\x61\x74\x65\x53\x74\x79\x6C\x65\x55\x6E\x72\x6F\x74\x61\x74\x65\x64","\x72\x6F\x75\x6E\x64","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x62\x65\x67\x69\x6E\x55\x70\x64\x61\x74\x65","\x63\x65\x6C\x6C","\x73\x65\x74\x43\x65\x6C\x6C\x53\x74\x79\x6C\x65\x73","\x65\x6E\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x72\x74\x53\x69\x7A\x65","\x64\x65\x66\x61\x75\x6C\x74\x56\x61\x6C\x75\x65","\x73\x63\x61\x6C\x65\x46\x61\x63\x74\x6F\x72","\x63\x72\x65\x61\x74\x65\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x41\x6C\x6C\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73","\x73\x74\x65\x6E\x63\x69\x6C","\x63\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x73"];(function(){function _0x4d9cx1(){}_0x4d9cx1[_0x653f[0]]= new mxCylinder();_0x4d9cx1[_0x653f[0]][_0x653f[1]]=_0x4d9cx1;_0x4d9cx1[_0x653f[0]][_0x653f[2]]=20;_0x4d9cx1[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx8=Math[_0x653f[6]](_0x4d9cx5,Math[_0x653f[6]](_0x4d9cx6,mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]])));if(_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx8,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](_0x4d9cx8,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](0,0);_0x4d9cx2[_0x653f[7]](_0x4d9cx8,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx8);_0x4d9cx2[_0x653f[9]]()}else {_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cx8,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](_0x4d9cx8,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6-_0x4d9cx8);_0x4d9cx2[_0x653f[8]](0,0);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[11]]=_0x4d9cx1;function _0x4d9cx9(){}_0x4d9cx9[_0x653f[0]]= new mxCylinder();_0x4d9cx9[_0x653f[0]][_0x653f[1]]=_0x4d9cx9;_0x4d9cx9[_0x653f[0]][_0x653f[2]]=30;_0x4d9cx9[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx8=Math[_0x653f[6]](_0x4d9cx5,Math[_0x653f[6]](_0x4d9cx6,mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]])));if(_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx5-_0x4d9cx8,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cx8,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx8);_0x4d9cx2[_0x653f[9]]()}else {_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cx8,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,0);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[13]]=_0x4d9cx9;function _0x4d9cxa(){}_0x4d9cxa[_0x653f[0]]= new mxCylinder();_0x4d9cxa[_0x653f[0]][_0x653f[1]]=_0x4d9cxa;_0x4d9cxa[_0x653f[0]][_0x653f[14]]=60;_0x4d9cxa[_0x653f[0]][_0x653f[15]]=20;_0x4d9cxa[_0x653f[0]][_0x653f[16]]=_0x653f[17];_0x4d9cxa[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cxb=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[14],this[_0x653f[14]]);var _0x4d9cxc=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[15],this[_0x653f[15]]);var _0x4d9cxd=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[16],this[_0x653f[16]]);var _0x4d9cxe=Math[_0x653f[6]](_0x4d9cx5,_0x4d9cxb);var _0x4d9cxf=Math[_0x653f[6]](_0x4d9cx6,_0x4d9cxc);if(_0x4d9cx7){if(_0x4d9cxd==_0x653f[18]){_0x4d9cx2[_0x653f[7]](0,_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cxe,_0x4d9cxf)}else {_0x4d9cx2[_0x653f[7]](_0x4d9cx5-_0x4d9cxe,_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cxf)};_0x4d9cx2[_0x653f[9]]()}else {if(_0x4d9cxd==_0x653f[18]){_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cxe,0);_0x4d9cx2[_0x653f[8]](_0x4d9cxe,_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cxf)}else {_0x4d9cx2[_0x653f[7]](0,_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cxe,_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cxe,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,0)};_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cxf);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[19]]=_0x4d9cxa;function _0x4d9cx10(){}_0x4d9cx10[_0x653f[0]]= new mxCylinder();_0x4d9cx10[_0x653f[0]][_0x653f[1]]=_0x4d9cx10;_0x4d9cx10[_0x653f[0]][_0x653f[2]]=30;_0x4d9cx10[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx8=Math[_0x653f[6]](_0x4d9cx5,Math[_0x653f[6]](_0x4d9cx6,mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]])));if(!_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx8,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx8);_0x4d9cx2[_0x653f[8]](_0x4d9cx8,0);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[20]]=_0x4d9cx10;function _0x4d9cx11(){}_0x4d9cx11[_0x653f[0]]= new mxCylinder();_0x4d9cx11[_0x653f[0]][_0x653f[1]]=_0x4d9cx11;_0x4d9cx11[_0x653f[0]][_0x653f[2]]=0.4;_0x4d9cx11[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx8=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]]);var _0x4d9cxf=_0x4d9cx6*_0x4d9cx8;var _0x4d9cx12=1.4;if(!_0x4d9cx7){_0x4d9cx2[_0x653f[7]](0,_0x4d9cxf/2);_0x4d9cx2[_0x653f[21]](_0x4d9cx5/4,_0x4d9cxf*_0x4d9cx12,_0x4d9cx5/2,_0x4d9cxf/2);_0x4d9cx2[_0x653f[21]](_0x4d9cx5*3/4,_0x4d9cxf*(1-_0x4d9cx12),_0x4d9cx5,_0x4d9cxf/2);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6-_0x4d9cxf/2);_0x4d9cx2[_0x653f[21]](_0x4d9cx5*3/4,_0x4d9cx6-_0x4d9cxf*_0x4d9cx12,_0x4d9cx5/2,_0x4d9cx6-_0x4d9cxf/2);_0x4d9cx2[_0x653f[21]](_0x4d9cx5/4,_0x4d9cx6-_0x4d9cxf*(1-_0x4d9cx12),0,_0x4d9cx6-_0x4d9cxf/2);_0x4d9cx2[_0x653f[8]](0,_0x4d9cxf/2);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[22]]=_0x4d9cx11;function _0x4d9cx13(){}_0x4d9cx13[_0x653f[0]]= new mxCylinder();_0x4d9cx13[_0x653f[0]][_0x653f[1]]=_0x4d9cx13;_0x4d9cx13[_0x653f[0]][_0x653f[2]]=0.2;_0x4d9cx13[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx8=_0x4d9cx5*mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]]);if(!_0x4d9cx7){_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cx8,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6/2);_0x4d9cx2[_0x653f[8]](_0x4d9cx5-_0x4d9cx8,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](_0x4d9cx8,_0x4d9cx6/2);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[23]]=_0x4d9cx13;function _0x4d9cx14(){mxRectangleShape[_0x653f[24]](this)}mxUtils[_0x653f[25]](_0x4d9cx14,mxRectangleShape);_0x4d9cx14[_0x653f[0]][_0x653f[26]]=function(){return false};_0x4d9cx14[_0x653f[0]][_0x653f[27]]=function(_0x4d9cx15,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6){var _0x4d9cx16=Math[_0x653f[6]](_0x4d9cx5/5,_0x4d9cx6/5)+1;_0x4d9cx15[_0x653f[28]]();_0x4d9cx15[_0x653f[7]](_0x4d9cx3+_0x4d9cx5/2,_0x4d9cx4+_0x4d9cx16);_0x4d9cx15[_0x653f[8]](_0x4d9cx3+_0x4d9cx5/2,_0x4d9cx4+_0x4d9cx6-_0x4d9cx16);_0x4d9cx15[_0x653f[7]](_0x4d9cx3+_0x4d9cx16,_0x4d9cx4+_0x4d9cx6/2);_0x4d9cx15[_0x653f[8]](_0x4d9cx3+_0x4d9cx5-_0x4d9cx16,_0x4d9cx4+_0x4d9cx6/2);_0x4d9cx15[_0x653f[9]]();_0x4d9cx15[_0x653f[29]]();mxRectangleShape[_0x653f[0]][_0x653f[27]][_0x653f[30]](this,arguments)};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[31]]=_0x4d9cx14;function _0x4d9cx17(){mxRectangleShape[_0x653f[24]](this)}mxUtils[_0x653f[25]](_0x4d9cx17,mxRectangleShape);_0x4d9cx17[_0x653f[0]][_0x653f[26]]=function(){return false};_0x4d9cx17[_0x653f[0]][_0x653f[27]]=function(_0x4d9cx15,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6){if(this[_0x653f[4]]!=null){if(this[_0x653f[4]][_0x653f[32]]==1){var _0x4d9cx18=Math[_0x653f[34]](2,this[_0x653f[33]]+1);mxRectangleShape[_0x653f[0]][_0x653f[35]][_0x653f[24]](this,_0x4d9cx15,_0x4d9cx3+_0x4d9cx18,_0x4d9cx4+_0x4d9cx18,_0x4d9cx5-2*_0x4d9cx18,_0x4d9cx6-2*_0x4d9cx18);mxRectangleShape[_0x653f[0]][_0x653f[27]][_0x653f[30]](this,arguments);_0x4d9cx3+=_0x4d9cx18;_0x4d9cx4+=_0x4d9cx18;_0x4d9cx5-=2*_0x4d9cx18;_0x4d9cx6-=2*_0x4d9cx18};_0x4d9cx15[_0x653f[36]](false);var _0x4d9cx19=0;var _0x4d9cx1a=null;do{_0x4d9cx1a=mxCellRenderer[_0x653f[0]][_0x653f[12]][this[_0x653f[4]][_0x653f[37]+_0x4d9cx19]];if(_0x4d9cx1a!=null){var _0x4d9cx1b=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[38]];var _0x4d9cx1c=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[39]];var _0x4d9cx1d=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[40]];var _0x4d9cx1e=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[41]];var _0x4d9cx1f=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[42]]||0;var _0x4d9cx20=this[_0x653f[4]][_0x653f[37]+_0x4d9cx19+_0x653f[43]];if(_0x4d9cx20!=null){_0x4d9cx1f+=this[_0x653f[44]](_0x4d9cx5+this[_0x653f[33]],_0x4d9cx6+this[_0x653f[33]])*_0x4d9cx20};var _0x4d9cx21=_0x4d9cx3;var _0x4d9cx22=_0x4d9cx4;if(_0x4d9cx1b==mxConstants[_0x653f[45]]){_0x4d9cx21+=(_0x4d9cx5-_0x4d9cx1d)/2}else {if(_0x4d9cx1b==mxConstants[_0x653f[46]]){_0x4d9cx21+=_0x4d9cx5-_0x4d9cx1d-_0x4d9cx1f}else {_0x4d9cx21+=_0x4d9cx1f}};if(_0x4d9cx1c==mxConstants[_0x653f[47]]){_0x4d9cx22+=(_0x4d9cx6-_0x4d9cx1e)/2}else {if(_0x4d9cx1c==mxConstants[_0x653f[48]]){_0x4d9cx22+=_0x4d9cx6-_0x4d9cx1e-_0x4d9cx1f}else {_0x4d9cx22+=_0x4d9cx1f}};_0x4d9cx15[_0x653f[49]]();var _0x4d9cx23= new _0x4d9cx1a();_0x4d9cx23[_0x653f[4]]=this[_0x653f[4]];_0x4d9cx1a[_0x653f[0]][_0x653f[50]][_0x653f[24]](_0x4d9cx23,_0x4d9cx15,_0x4d9cx21,_0x4d9cx22,_0x4d9cx1d,_0x4d9cx1e);_0x4d9cx15[_0x653f[51]]()};_0x4d9cx19++}while(_0x4d9cx1a!=null);}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[52]]=_0x4d9cx17;function _0x4d9cx24(){}_0x4d9cx24[_0x653f[0]]= new mxCylinder();_0x4d9cx24[_0x653f[0]][_0x653f[1]]=_0x4d9cx24;_0x4d9cx24[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){if(_0x4d9cx7){_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5/2,_0x4d9cx6/2);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,0);_0x4d9cx2[_0x653f[9]]()}else {_0x4d9cx2[_0x653f[7]](0,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[10]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[53]]=_0x4d9cx24;function _0x4d9cx25(){}_0x4d9cx25[_0x653f[0]]= new mxCylinder();_0x4d9cx25[_0x653f[0]][_0x653f[1]]=_0x4d9cx25;_0x4d9cx25[_0x653f[0]][_0x653f[54]]=true;_0x4d9cx25[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx1d=_0x4d9cx5/3;var _0x4d9cx1e=_0x4d9cx6/4;if(!_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[55]](_0x4d9cx5/2-_0x4d9cx1d,_0x4d9cx1e,_0x4d9cx5/2-_0x4d9cx1d,0,_0x4d9cx5/2,0);_0x4d9cx2[_0x653f[55]](_0x4d9cx5/2+_0x4d9cx1d,0,_0x4d9cx5/2+_0x4d9cx1d,_0x4d9cx1e,_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[8]](_0x4d9cx5/2,2*_0x4d9cx6/3);_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx6/3);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6/3);_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx6/3);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6/3);_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,2*_0x4d9cx6/3);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx6);_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,2*_0x4d9cx6/3);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[56]]=_0x4d9cx25;function _0x4d9cx26(){}_0x4d9cx26[_0x653f[0]]= new mxCylinder();_0x4d9cx26[_0x653f[0]][_0x653f[1]]=_0x4d9cx26;_0x4d9cx26[_0x653f[0]][_0x653f[2]]=10;_0x4d9cx26[_0x653f[0]][_0x653f[54]]=true;_0x4d9cx26[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cx27=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[2],this[_0x653f[2]]);var _0x4d9cx1d=_0x4d9cx27*2/3;var _0x4d9cx1e=_0x4d9cx27;if(!_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[55]](_0x4d9cx5/2-_0x4d9cx1d,_0x4d9cx1e,_0x4d9cx5/2-_0x4d9cx1d,0,_0x4d9cx5/2,0);_0x4d9cx2[_0x653f[55]](_0x4d9cx5/2+_0x4d9cx1d,0,_0x4d9cx5/2+_0x4d9cx1d,_0x4d9cx1e,_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[7]](_0x4d9cx5/2,_0x4d9cx1e);_0x4d9cx2[_0x653f[8]](_0x4d9cx5/2,_0x4d9cx6);_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[57]]=_0x4d9cx26;function _0x4d9cx28(){}_0x4d9cx28[_0x653f[0]]= new mxCylinder();_0x4d9cx28[_0x653f[0]][_0x653f[1]]=_0x4d9cx28;_0x4d9cx28[_0x653f[0]][_0x653f[58]]=32;_0x4d9cx28[_0x653f[0]][_0x653f[59]]=12;_0x4d9cx28[_0x653f[0]][_0x653f[3]]=function(_0x4d9cx2,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6,_0x4d9cx7){var _0x4d9cxe=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[58],this[_0x653f[58]]);var _0x4d9cxf=mxUtils[_0x653f[5]](this[_0x653f[4]],_0x653f[59],this[_0x653f[59]]);var _0x4d9cx29=_0x4d9cxe/2;var _0x4d9cx2a=_0x4d9cx29+_0x4d9cxe/2;var _0x4d9cx2b=0.3*_0x4d9cx6-_0x4d9cxf/2;var _0x4d9cx2c=0.7*_0x4d9cx6-_0x4d9cxf/2;if(_0x4d9cx7){_0x4d9cx2[_0x653f[7]](_0x4d9cx29,_0x4d9cx2b);_0x4d9cx2[_0x653f[8]](_0x4d9cx2a,_0x4d9cx2b);_0x4d9cx2[_0x653f[8]](_0x4d9cx2a,_0x4d9cx2b+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2b+_0x4d9cxf);_0x4d9cx2[_0x653f[7]](_0x4d9cx29,_0x4d9cx2c);_0x4d9cx2[_0x653f[8]](_0x4d9cx2a,_0x4d9cx2c);_0x4d9cx2[_0x653f[8]](_0x4d9cx2a,_0x4d9cx2c+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2c+_0x4d9cxf);_0x4d9cx2[_0x653f[9]]()}else {_0x4d9cx2[_0x653f[7]](_0x4d9cx29,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,0);_0x4d9cx2[_0x653f[8]](_0x4d9cx5,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx6);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2c+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx2c+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx2c);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2c);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2b+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx2b+_0x4d9cxf);_0x4d9cx2[_0x653f[8]](0,_0x4d9cx2b);_0x4d9cx2[_0x653f[8]](_0x4d9cx29,_0x4d9cx2b);_0x4d9cx2[_0x653f[10]]();_0x4d9cx2[_0x653f[9]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[60]]=_0x4d9cx28;function _0x4d9cx2d(){}_0x4d9cx2d[_0x653f[0]]= new mxDoubleEllipse();_0x4d9cx2d[_0x653f[0]][_0x653f[1]]=_0x4d9cx2d;_0x4d9cx2d[_0x653f[0]][_0x653f[61]]=true;_0x4d9cx2d[_0x653f[0]][_0x653f[50]]=function(_0x4d9cx15,_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6){var _0x4d9cx18=Math[_0x653f[6]](4,Math[_0x653f[6]](_0x4d9cx5/5,_0x4d9cx6/5));if(_0x4d9cx5>0&&_0x4d9cx6>0){_0x4d9cx15[_0x653f[62]](_0x4d9cx3+_0x4d9cx18,_0x4d9cx4+_0x4d9cx18,_0x4d9cx5-2*_0x4d9cx18,_0x4d9cx6-2*_0x4d9cx18);_0x4d9cx15[_0x653f[63]]()};_0x4d9cx15[_0x653f[64]](false);if(this[_0x653f[61]]){_0x4d9cx15[_0x653f[62]](_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6);_0x4d9cx15[_0x653f[29]]()}};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[65]]=_0x4d9cx2d;function _0x4d9cx2e(){}_0x4d9cx2e[_0x653f[0]]= new _0x4d9cx2d();_0x4d9cx2e[_0x653f[0]][_0x653f[1]]=_0x4d9cx2e;_0x4d9cx2e[_0x653f[0]][_0x653f[61]]=false;mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[66]]=_0x4d9cx2e;var _0x4d9cx2f=mxImageExport[_0x653f[0]][_0x653f[67]];mxImageExport[_0x653f[0]][_0x653f[67]]=function(){_0x4d9cx2f[_0x653f[30]](this,arguments);function _0x4d9cx30(_0x4d9cx31){return {drawShape:function(_0x4d9cx32,_0x4d9cx33,_0x4d9cx34,_0x4d9cx35){var _0x4d9cx3=_0x4d9cx34[_0x653f[68]];var _0x4d9cx4=_0x4d9cx34[_0x653f[69]];var _0x4d9cx5=_0x4d9cx34[_0x653f[70]];var _0x4d9cx6=_0x4d9cx34[_0x653f[71]];if(_0x4d9cx35){var _0x4d9cx18=Math[_0x653f[6]](4,Math[_0x653f[6]](_0x4d9cx5/5,_0x4d9cx6/5));_0x4d9cx3+=_0x4d9cx18;_0x4d9cx4+=_0x4d9cx18;_0x4d9cx5-=2*_0x4d9cx18;_0x4d9cx6-=2*_0x4d9cx18;if(_0x4d9cx5>0&&_0x4d9cx6>0){_0x4d9cx32[_0x653f[62]](_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6)};return true}else {_0x4d9cx32[_0x653f[63]]();if(_0x4d9cx31){_0x4d9cx32[_0x653f[62]](_0x4d9cx3,_0x4d9cx4,_0x4d9cx5,_0x4d9cx6);_0x4d9cx32[_0x653f[29]]()}}}}}this[_0x653f[72]][_0x653f[65]]=_0x4d9cx30(true);this[_0x653f[72]][_0x653f[66]]=_0x4d9cx30(false)};function _0x4d9cx36(){mxArrow[_0x653f[24]](this)}mxUtils[_0x653f[25]](_0x4d9cx36,mxArrow);_0x4d9cx36[_0x653f[0]][_0x653f[73]]=function(_0x4d9cx15,_0x4d9cx37){var _0x4d9cx1d=10;var _0x4d9cx38=_0x4d9cx37[0];var _0x4d9cx39=_0x4d9cx37[_0x4d9cx37[_0x653f[74]]-1];var _0x4d9cxe=_0x4d9cx39[_0x653f[68]]-_0x4d9cx38[_0x653f[68]];var _0x4d9cxf=_0x4d9cx39[_0x653f[69]]-_0x4d9cx38[_0x653f[69]];var _0x4d9cx3a=Math[_0x653f[75]](_0x4d9cxe*_0x4d9cxe+_0x4d9cxf*_0x4d9cxf);var _0x4d9cx3b=_0x4d9cx3a;var _0x4d9cx3c=_0x4d9cxe/_0x4d9cx3a;var _0x4d9cx3d=_0x4d9cxf/_0x4d9cx3a;var _0x4d9cx3e=_0x4d9cx3b*_0x4d9cx3c;var _0x4d9cx3f=_0x4d9cx3b*_0x4d9cx3d;var _0x4d9cx40=_0x4d9cx1d*_0x4d9cx3d/3;var _0x4d9cx41=-_0x4d9cx1d*_0x4d9cx3c/3;var _0x4d9cx42=_0x4d9cx38[_0x653f[68]]-_0x4d9cx40/2;var _0x4d9cx43=_0x4d9cx38[_0x653f[69]]-_0x4d9cx41/2;var _0x4d9cx44=_0x4d9cx42+_0x4d9cx40;var _0x4d9cx45=_0x4d9cx43+_0x4d9cx41;var _0x4d9cx46=_0x4d9cx44+_0x4d9cx3e;var _0x4d9cx47=_0x4d9cx45+_0x4d9cx3f;var _0x4d9cx48=_0x4d9cx46+_0x4d9cx40;var _0x4d9cx49=_0x4d9cx47+_0x4d9cx41;var _0x4d9cx4a=_0x4d9cx48-3*_0x4d9cx40;var _0x4d9cx4b=_0x4d9cx49-3*_0x4d9cx41;_0x4d9cx15[_0x653f[28]]();_0x4d9cx15[_0x653f[7]](_0x4d9cx44,_0x4d9cx45);_0x4d9cx15[_0x653f[8]](_0x4d9cx46,_0x4d9cx47);_0x4d9cx15[_0x653f[7]](_0x4d9cx4a+_0x4d9cx40,_0x4d9cx4b+_0x4d9cx41);_0x4d9cx15[_0x653f[8]](_0x4d9cx42,_0x4d9cx43);_0x4d9cx15[_0x653f[29]]()};mxCellRenderer[_0x653f[0]][_0x653f[12]][_0x653f[76]]=_0x4d9cx36;mxMarker[_0x653f[78]](_0x653f[77],function(_0x4d9cx32,_0x4d9cx1a,_0x4d9cx4c,_0x4d9cx39,_0x4d9cx4d,_0x4d9cx4e,_0x4d9cx4f,_0x4d9cx50,_0x4d9cx51,_0x4d9cx52){var _0x4d9cx3c=_0x4d9cx4d*(_0x4d9cx4f+_0x4d9cx51+1);var _0x4d9cx3d=_0x4d9cx4e*(_0x4d9cx4f+_0x4d9cx51+1);return function(){_0x4d9cx32[_0x653f[28]]();_0x4d9cx32[_0x653f[7]](_0x4d9cx39[_0x653f[68]]-_0x4d9cx3c/2-_0x4d9cx3d/2,_0x4d9cx39[_0x653f[69]]-_0x4d9cx3d/2+_0x4d9cx3c/2);_0x4d9cx32[_0x653f[8]](_0x4d9cx39[_0x653f[68]]+_0x4d9cx3d/2-3*_0x4d9cx3c/2,_0x4d9cx39[_0x653f[69]]-3*_0x4d9cx3d/2-_0x4d9cx3c/2);_0x4d9cx32[_0x653f[29]]()}});var _0x4d9cx53=-99;if( typeof (mxVertexHandler)!=_0x653f[79]){function _0x4d9cx54(_0x4d9cx33){mxVertexHandler[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx54,mxVertexHandler);_0x4d9cx54[_0x653f[0]][_0x653f[80]]=false;_0x4d9cx54[_0x653f[0]][_0x653f[81]]=function(){this[_0x653f[82]]=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],mxConstants.STYLE_HORIZONTAL,true);var _0x4d9cx55=this[_0x653f[83]][_0x653f[85]][_0x653f[84]];if(this[_0x653f[86]]!=null){var _0x4d9cx34= new mxRectangle(0,0,this[_0x653f[86]][_0x653f[70]],this[_0x653f[86]][_0x653f[71]]);this[_0x653f[87]]= new mxImageShape(_0x4d9cx34,this[_0x653f[86]][_0x653f[88]])}else {var _0x4d9cx4f=10;var _0x4d9cx34= new mxRectangle(0,0,_0x4d9cx4f,_0x4d9cx4f);this[_0x653f[87]]= new mxRhombus(_0x4d9cx34,mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)};this[_0x653f[87]][_0x653f[89]]=(_0x4d9cx55[_0x653f[89]]!=mxConstants[_0x653f[90]])?mxConstants[_0x653f[91]]:mxConstants[_0x653f[90]];this[_0x653f[87]][_0x653f[81]](_0x4d9cx55[_0x653f[93]]()[_0x653f[92]]());this[_0x653f[87]][_0x653f[95]][_0x653f[4]][_0x653f[94]]=this[_0x653f[96]]();mxEvent[_0x653f[97]](this[_0x653f[87]][_0x653f[95]],_0x4d9cx55,this[_0x653f[83]]);mxVertexHandler[_0x653f[0]][_0x653f[81]][_0x653f[30]](this,arguments)};_0x4d9cx54[_0x653f[0]][_0x653f[96]]=function(){return _0x653f[98]};_0x4d9cx54[_0x653f[0]][_0x653f[99]]=function(){mxVertexHandler[_0x653f[0]][_0x653f[99]][_0x653f[30]](this,arguments);var _0x4d9cx4f=this[_0x653f[87]][_0x653f[100]][_0x653f[70]];this[_0x653f[87]][_0x653f[100]]=this[_0x653f[101]](_0x4d9cx4f);this[_0x653f[87]][_0x653f[99]]()};_0x4d9cx54[_0x653f[0]][_0x653f[102]]=function(){mxVertexHandler[_0x653f[0]][_0x653f[102]][_0x653f[30]](this,arguments);if(this[_0x653f[87]]!=null){this[_0x653f[87]][_0x653f[102]]();this[_0x653f[87]]=null}};_0x4d9cx54[_0x653f[0]][_0x653f[103]]=function(_0x4d9cx56){if(_0x4d9cx56[_0x653f[104]](this[_0x653f[87]])){return _0x4d9cx53};return mxVertexHandler[_0x653f[0]][_0x653f[103]][_0x653f[30]](this,arguments)};_0x4d9cx54[_0x653f[0]][_0x653f[105]]=function(_0x4d9cx57,_0x4d9cx56){if(!_0x4d9cx56[_0x653f[106]]()&&this[_0x653f[107]]==_0x4d9cx53){var _0x4d9cx58= new mxPoint(_0x4d9cx56[_0x653f[108]](),_0x4d9cx56[_0x653f[109]]());this[_0x653f[110]](_0x4d9cx58);var _0x4d9cx59=this[_0x653f[84]][_0x653f[112]](_0x4d9cx56[_0x653f[111]]());var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];if(_0x4d9cx59&&this[_0x653f[80]]){_0x4d9cx58[_0x653f[68]]=this[_0x653f[84]][_0x653f[114]](_0x4d9cx58[_0x653f[68]]/_0x4d9cx5a)*_0x4d9cx5a;_0x4d9cx58[_0x653f[69]]=this[_0x653f[84]][_0x653f[114]](_0x4d9cx58[_0x653f[69]]/_0x4d9cx5a)*_0x4d9cx5a};this[_0x653f[115]](_0x4d9cx58);this[_0x653f[116]](this[_0x653f[87]],_0x4d9cx58[_0x653f[68]],_0x4d9cx58[_0x653f[69]]);this[_0x653f[83]][_0x653f[85]][_0x653f[84]][_0x653f[117]][_0x653f[99]](this[_0x653f[83]],true);_0x4d9cx56[_0x653f[118]]()}else {mxVertexHandler[_0x653f[0]][_0x653f[105]][_0x653f[30]](this,arguments)}};_0x4d9cx54[_0x653f[0]][_0x653f[119]]=function(_0x4d9cx57,_0x4d9cx56){if(!_0x4d9cx56[_0x653f[106]]()&&this[_0x653f[107]]==_0x4d9cx53){this[_0x653f[120]]();this[_0x653f[121]]();_0x4d9cx56[_0x653f[118]]()}else {mxVertexHandler[_0x653f[0]][_0x653f[119]][_0x653f[30]](this,arguments)}};_0x4d9cx54[_0x653f[0]][_0x653f[101]]=function(_0x4d9cx4f){var _0x4d9cx5b=this[_0x653f[83]][_0x653f[123]][_0x653f[122]]();var _0x4d9cx5c=mxUtils[_0x653f[124]](_0x4d9cx5b);var _0x4d9cx5d=Math[_0x653f[125]](_0x4d9cx5c);var _0x4d9cx5e=Math[_0x653f[126]](_0x4d9cx5c);var _0x4d9cx34= new mxRectangle(this[_0x653f[83]][_0x653f[68]],this[_0x653f[83]][_0x653f[69]],this[_0x653f[83]][_0x653f[70]],this[_0x653f[83]][_0x653f[71]]);if(this[_0x653f[83]][_0x653f[123]][_0x653f[127]]()){var _0x4d9cx5f=(_0x4d9cx34[_0x653f[70]]-_0x4d9cx34[_0x653f[71]])/2;_0x4d9cx34[_0x653f[68]]+=_0x4d9cx5f;_0x4d9cx34[_0x653f[69]]-=_0x4d9cx5f;var _0x4d9cx23=_0x4d9cx34[_0x653f[70]];_0x4d9cx34[_0x653f[70]]=_0x4d9cx34[_0x653f[71]];_0x4d9cx34[_0x653f[71]]=_0x4d9cx23};var _0x4d9cx60=this[_0x653f[128]](_0x4d9cx34);if(this[_0x653f[83]][_0x653f[123]][_0x653f[129]]){_0x4d9cx60[_0x653f[68]]=2*_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx60[_0x653f[68]]};if(this[_0x653f[83]][_0x653f[123]][_0x653f[130]]){_0x4d9cx60[_0x653f[69]]=2*_0x4d9cx34[_0x653f[69]]+_0x4d9cx34[_0x653f[71]]-_0x4d9cx60[_0x653f[69]]};_0x4d9cx60=mxUtils[_0x653f[133]](_0x4d9cx60,_0x4d9cx5d,_0x4d9cx5e, new mxPoint(this[_0x653f[83]][_0x653f[131]](),this[_0x653f[83]][_0x653f[132]]()));return new mxRectangle(_0x4d9cx60[_0x653f[68]]-_0x4d9cx4f/2,_0x4d9cx60[_0x653f[69]]-_0x4d9cx4f/2,_0x4d9cx4f,_0x4d9cx4f)};_0x4d9cx54[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){return null};_0x4d9cx54[_0x653f[0]][_0x653f[115]]=function(_0x4d9cx58){};_0x4d9cx54[_0x653f[0]][_0x653f[110]]=function(_0x4d9cx58){_0x4d9cx58[_0x653f[68]]=Math[_0x653f[34]](this[_0x653f[83]][_0x653f[68]],Math[_0x653f[6]](this[_0x653f[83]][_0x653f[68]]+this[_0x653f[83]][_0x653f[70]],_0x4d9cx58[_0x653f[68]]));_0x4d9cx58[_0x653f[69]]=Math[_0x653f[34]](this[_0x653f[83]][_0x653f[69]],Math[_0x653f[6]](this[_0x653f[83]][_0x653f[69]]+this[_0x653f[83]][_0x653f[71]],_0x4d9cx58[_0x653f[69]]))};_0x4d9cx54[_0x653f[0]][_0x653f[120]]=function(){};function _0x4d9cx61(_0x4d9cx33){_0x4d9cx54[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx61,_0x4d9cx54);_0x4d9cx61[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];var _0x4d9cxb=Math[_0x653f[6]](_0x4d9cx34[_0x653f[70]],mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[14],60)*_0x4d9cx5a);var _0x4d9cxc=Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]],mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[15],20)*_0x4d9cx5a);var _0x4d9cxd=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[16],_0x653f[17]);var _0x4d9cx3=(_0x4d9cxd==_0x653f[18])?_0x4d9cx34[_0x653f[68]]+_0x4d9cxb:_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cxb;return new mxPoint(_0x4d9cx3,_0x4d9cx34[_0x653f[69]]+_0x4d9cxc)};_0x4d9cx61[_0x653f[0]][_0x653f[115]]=function(_0x4d9cx58){var _0x4d9cx5b=this[_0x653f[83]][_0x653f[123]][_0x653f[122]]();var _0x4d9cx5c=mxUtils[_0x653f[124]](_0x4d9cx5b);var _0x4d9cx5d=Math[_0x653f[125]](-_0x4d9cx5c);var _0x4d9cx5e=Math[_0x653f[126]](-_0x4d9cx5c);var _0x4d9cx34= new mxRectangle(this[_0x653f[83]][_0x653f[68]],this[_0x653f[83]][_0x653f[69]],this[_0x653f[83]][_0x653f[70]],this[_0x653f[83]][_0x653f[71]]);if(this[_0x653f[83]][_0x653f[123]][_0x653f[127]]()){var _0x4d9cx5f=(_0x4d9cx34[_0x653f[70]]-_0x4d9cx34[_0x653f[71]])/2;_0x4d9cx34[_0x653f[68]]+=_0x4d9cx5f;_0x4d9cx34[_0x653f[69]]-=_0x4d9cx5f;var _0x4d9cx23=_0x4d9cx34[_0x653f[70]];_0x4d9cx34[_0x653f[70]]=_0x4d9cx34[_0x653f[71]];_0x4d9cx34[_0x653f[71]]=_0x4d9cx23};var _0x4d9cx60= new mxPoint(_0x4d9cx58[_0x653f[68]],_0x4d9cx58[_0x653f[69]]);_0x4d9cx60=mxUtils[_0x653f[133]](_0x4d9cx60,_0x4d9cx5d,_0x4d9cx5e, new mxPoint(this[_0x653f[83]][_0x653f[131]](),this[_0x653f[83]][_0x653f[132]]()));if(this[_0x653f[83]][_0x653f[123]][_0x653f[129]]){_0x4d9cx60[_0x653f[68]]=2*_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx60[_0x653f[68]]};if(this[_0x653f[83]][_0x653f[123]][_0x653f[130]]){_0x4d9cx60[_0x653f[69]]=2*_0x4d9cx34[_0x653f[69]]+_0x4d9cx34[_0x653f[71]]-_0x4d9cx60[_0x653f[69]]};var _0x4d9cx62=this[_0x653f[134]](_0x4d9cx60,_0x4d9cx34);if(_0x4d9cx62!=null){if(this[_0x653f[83]][_0x653f[123]][_0x653f[129]]){_0x4d9cx62[_0x653f[68]]=2*_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx62[_0x653f[68]]};if(this[_0x653f[83]][_0x653f[123]][_0x653f[130]]){_0x4d9cx62[_0x653f[69]]=2*_0x4d9cx34[_0x653f[69]]+_0x4d9cx34[_0x653f[71]]-_0x4d9cx62[_0x653f[69]]};_0x4d9cx5d=Math[_0x653f[125]](_0x4d9cx5c);_0x4d9cx5e=Math[_0x653f[126]](_0x4d9cx5c);_0x4d9cx62=mxUtils[_0x653f[133]](_0x4d9cx62,_0x4d9cx5d,_0x4d9cx5e, new mxPoint(this[_0x653f[83]][_0x653f[131]](),this[_0x653f[83]][_0x653f[132]]()));_0x4d9cx58[_0x653f[68]]=_0x4d9cx62[_0x653f[68]];_0x4d9cx58[_0x653f[69]]=_0x4d9cx62[_0x653f[69]]}};_0x4d9cx61[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx60,_0x4d9cx34){var _0x4d9cxd=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[16],_0x653f[17]);var _0x4d9cxb=(_0x4d9cxd==_0x653f[18])?_0x4d9cx60[_0x653f[68]]-_0x4d9cx34[_0x653f[68]]:_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx60[_0x653f[68]];var _0x4d9cxc=_0x4d9cx60[_0x653f[69]]-_0x4d9cx34[_0x653f[69]];var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];this[_0x653f[83]][_0x653f[4]][_0x653f[14]]=Math[_0x653f[135]](Math[_0x653f[34]](1,_0x4d9cxb)/_0x4d9cx5a);this[_0x653f[83]][_0x653f[4]][_0x653f[15]]=Math[_0x653f[135]](Math[_0x653f[34]](1,_0x4d9cxc)/_0x4d9cx5a)};_0x4d9cx61[_0x653f[0]][_0x653f[120]]=function(){var _0x4d9cx63=this[_0x653f[84]][_0x653f[136]]();_0x4d9cx63[_0x653f[137]]();try{this[_0x653f[83]][_0x653f[85]][_0x653f[84]][_0x653f[139]](_0x653f[14],this[_0x653f[83]][_0x653f[4]][_0x653f[14]],[this[_0x653f[83]][_0x653f[138]]]);this[_0x653f[83]][_0x653f[85]][_0x653f[84]][_0x653f[139]](_0x653f[15],this[_0x653f[83]][_0x653f[4]][_0x653f[15]],[this[_0x653f[83]][_0x653f[138]]])}finally{_0x4d9cx63[_0x653f[140]]()}};function _0x4d9cx64(_0x4d9cx33){_0x4d9cx61[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx64,_0x4d9cx61);_0x4d9cx64[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];var _0x4d9cx65=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]/2,_0x4d9cx34[_0x653f[69]]+Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]],_0x4d9cx65*_0x4d9cx5a))};_0x4d9cx64[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx58,_0x4d9cx34){_0x4d9cx58[_0x653f[68]]=_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]/2;startSize=_0x4d9cx58[_0x653f[69]]-_0x4d9cx34[_0x653f[69]];var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];this[_0x653f[83]][_0x653f[4]][_0x653f[141]]=Math[_0x653f[135]](Math[_0x653f[34]](1,startSize)/_0x4d9cx5a);return _0x4d9cx58};_0x4d9cx64[_0x653f[0]][_0x653f[120]]=function(){this[_0x653f[83]][_0x653f[85]][_0x653f[84]][_0x653f[139]](_0x653f[141],this[_0x653f[83]][_0x653f[4]][_0x653f[141]],[this[_0x653f[83]][_0x653f[138]]])};function _0x4d9cx66(_0x4d9cx33){_0x4d9cx61[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx66,_0x4d9cx61);_0x4d9cx66[_0x653f[0]][_0x653f[142]]=20;_0x4d9cx66[_0x653f[0]][_0x653f[143]]=1;_0x4d9cx66[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];var _0x4d9cx67=Math[_0x653f[6]](_0x4d9cx34[_0x653f[70]],Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]],mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[2],this[_0x653f[142]])*_0x4d9cx5a/this[_0x653f[143]]));return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx67,_0x4d9cx34[_0x653f[69]]+_0x4d9cx67)};_0x4d9cx66[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx60,_0x4d9cx34){var _0x4d9cx4f=Math[_0x653f[34]](0,Math[_0x653f[6]](Math[_0x653f[6]](_0x4d9cx34[_0x653f[70]]/this[_0x653f[143]],_0x4d9cx60[_0x653f[68]]-_0x4d9cx34[_0x653f[68]]),Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]]/this[_0x653f[143]],_0x4d9cx60[_0x653f[69]]-_0x4d9cx34[_0x653f[69]])));var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];this[_0x653f[83]][_0x653f[4]][_0x653f[2]]=Math[_0x653f[135]](Math[_0x653f[34]](1,_0x4d9cx4f)/_0x4d9cx5a)*this[_0x653f[143]];return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx4f,_0x4d9cx34[_0x653f[69]]+_0x4d9cx4f)};_0x4d9cx66[_0x653f[0]][_0x653f[120]]=function(){this[_0x653f[83]][_0x653f[85]][_0x653f[84]][_0x653f[139]](_0x653f[2],this[_0x653f[83]][_0x653f[4]][_0x653f[2]],[this[_0x653f[83]][_0x653f[138]]])};function _0x4d9cx68(_0x4d9cx33){_0x4d9cx66[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx68,_0x4d9cx66);_0x4d9cx68[_0x653f[0]][_0x653f[142]]=30;_0x4d9cx68[_0x653f[0]][_0x653f[143]]=2;function _0x4d9cx69(_0x4d9cx33){_0x4d9cx66[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx69,_0x4d9cx66);_0x4d9cx69[_0x653f[0]][_0x653f[142]]=30;_0x4d9cx69[_0x653f[0]][_0x653f[143]]=1;_0x4d9cx69[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];var _0x4d9cx67=Math[_0x653f[6]](_0x4d9cx34[_0x653f[70]],Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]],mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[2],this[_0x653f[142]])*_0x4d9cx5a/this[_0x653f[143]]));return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx67,_0x4d9cx34[_0x653f[69]]+_0x4d9cx67)};_0x4d9cx69[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx60,_0x4d9cx34){var _0x4d9cx4f=Math[_0x653f[34]](0,Math[_0x653f[6]](Math[_0x653f[6]](_0x4d9cx34[_0x653f[70]]/this[_0x653f[143]],_0x4d9cx60[_0x653f[68]]-_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]),Math[_0x653f[6]](_0x4d9cx34[_0x653f[71]]/this[_0x653f[143]],_0x4d9cx60[_0x653f[69]]-_0x4d9cx34[_0x653f[69]])));var _0x4d9cx5a=this[_0x653f[84]][_0x653f[93]]()[_0x653f[113]];this[_0x653f[83]][_0x653f[4]][_0x653f[2]]=Math[_0x653f[135]](Math[_0x653f[34]](1,_0x4d9cx4f)/_0x4d9cx5a)*this[_0x653f[143]];return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]-_0x4d9cx4f,_0x4d9cx34[_0x653f[69]]+_0x4d9cx4f)};function _0x4d9cx6a(_0x4d9cx33){_0x4d9cx66[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx6a,_0x4d9cx66);_0x4d9cx6a[_0x653f[0]][_0x653f[142]]=0.2;_0x4d9cx6a[_0x653f[0]][_0x653f[143]]=1;_0x4d9cx6a[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx67=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[2],this[_0x653f[142]]);return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]*_0x4d9cx67,_0x4d9cx34[_0x653f[69]]+_0x4d9cx34[_0x653f[71]]/2)};_0x4d9cx6a[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx60,_0x4d9cx34){var _0x4d9cx4f=Math[_0x653f[6]](1,(_0x4d9cx60[_0x653f[68]]-_0x4d9cx34[_0x653f[68]])/_0x4d9cx34[_0x653f[70]]);this[_0x653f[83]][_0x653f[4]][_0x653f[2]]=_0x4d9cx4f;return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx4f*_0x4d9cx34[_0x653f[70]],_0x4d9cx34[_0x653f[69]]+_0x4d9cx34[_0x653f[71]]/2)};function _0x4d9cx6b(_0x4d9cx33){_0x4d9cx66[_0x653f[24]](this,_0x4d9cx33)}mxUtils[_0x653f[25]](_0x4d9cx6b,_0x4d9cx66);_0x4d9cx6b[_0x653f[0]][_0x653f[142]]=0.4;_0x4d9cx6b[_0x653f[0]][_0x653f[143]]=1;_0x4d9cx6b[_0x653f[0]][_0x653f[128]]=function(_0x4d9cx34){var _0x4d9cx67=mxUtils[_0x653f[5]](this[_0x653f[83]][_0x653f[4]],_0x653f[2],this[_0x653f[142]]);return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]/2,_0x4d9cx34[_0x653f[69]]+_0x4d9cx67*_0x4d9cx34[_0x653f[71]]/2)};_0x4d9cx6b[_0x653f[0]][_0x653f[134]]=function(_0x4d9cx60,_0x4d9cx34){var _0x4d9cx4f=Math[_0x653f[34]](0,Math[_0x653f[6]](1,((_0x4d9cx60[_0x653f[69]]-_0x4d9cx34[_0x653f[69]])/_0x4d9cx34[_0x653f[71]])*2));this[_0x653f[83]][_0x653f[4]][_0x653f[2]]=_0x4d9cx4f;return new mxPoint(_0x4d9cx34[_0x653f[68]]+_0x4d9cx34[_0x653f[70]]/2,_0x4d9cx34[_0x653f[69]]+_0x4d9cx4f*_0x4d9cx34[_0x653f[71]]/2)};var _0x4d9cx6c={"\x73\x77\x69\x6D\x6C\x61\x6E\x65":_0x4d9cx64,"\x66\x6F\x6C\x64\x65\x72":_0x4d9cx61,"\x63\x75\x62\x65":_0x4d9cx66,"\x63\x61\x72\x64":_0x4d9cx68,"\x6E\x6F\x74\x65":_0x4d9cx69,"\x73\x74\x65\x70":_0x4d9cx6a,"\x74\x61\x70\x65":_0x4d9cx6b};var _0x4d9cx6d=mxGraph[_0x653f[0]][_0x653f[144]];mxGraph[_0x653f[0]][_0x653f[144]]=function(_0x4d9cx33){if(_0x4d9cx33!=null){var _0x4d9cx6e=_0x4d9cx6c[_0x4d9cx33[_0x653f[4]][_0x653f[123]]];if(_0x4d9cx6e!=null){return new _0x4d9cx6e(_0x4d9cx33)}};return _0x4d9cx6d[_0x653f[30]](this,arguments)}};mxGraph[_0x653f[0]][_0x653f[145]]=function(_0x4d9cx6f,_0x4d9cx50){if(_0x4d9cx6f!=null&&_0x4d9cx6f[_0x653f[123]]!=null){if(_0x4d9cx6f[_0x653f[123]][_0x653f[146]]!=null){if(_0x4d9cx6f[_0x653f[123]][_0x653f[146]]!=null){return _0x4d9cx6f[_0x653f[123]][_0x653f[146]][_0x653f[147]]}}else {if(_0x4d9cx6f[_0x653f[123]][_0x653f[147]]!=null){return _0x4d9cx6f[_0x653f[123]][_0x653f[147]]}}};return null};mxRectangleShape[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0,0.25),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(1,0.25),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];mxLabel[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];mxImageShape[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];mxSwimlane[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];_0x4d9cx14[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];_0x4d9cx9[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];_0x4d9cx10[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];_0x4d9cx1[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];_0x4d9cxa[_0x653f[0]][_0x653f[147]]=mxRectangleShape[_0x653f[0]][_0x653f[147]];mxCylinder[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.15,0.05),false), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.85,0.05),false), new mxConnectionConstraint( new mxPoint(0,0.3),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.7),true), new mxConnectionConstraint( new mxPoint(1,0.3),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.7),true), new mxConnectionConstraint( new mxPoint(0.15,0.95),false), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.85,0.95),false)];_0x4d9cx25[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0.1),false), new mxConnectionConstraint( new mxPoint(0.5,0),false), new mxConnectionConstraint( new mxPoint(0.75,0.1),false), new mxConnectionConstraint( new mxPoint(0,1/3),false), new mxConnectionConstraint( new mxPoint(0,1),false), new mxConnectionConstraint( new mxPoint(1,1/3),false), new mxConnectionConstraint( new mxPoint(1,1),false), new mxConnectionConstraint( new mxPoint(0.5,0.5),false)];_0x4d9cx28[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0,0.3),true), new mxConnectionConstraint( new mxPoint(0,0.7),true), new mxConnectionConstraint( new mxPoint(1,0.25),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];mxActor[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.25,0.2),false), new mxConnectionConstraint( new mxPoint(0.1,0.5),false), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(0.75,0.25),false), new mxConnectionConstraint( new mxPoint(0.9,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.75),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true)];_0x4d9cx11[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.35),false), new mxConnectionConstraint( new mxPoint(0,0.5),false), new mxConnectionConstraint( new mxPoint(0,0.65),false), new mxConnectionConstraint( new mxPoint(1,0.35),false), new mxConnectionConstraint( new mxPoint(1,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.65),false), new mxConnectionConstraint( new mxPoint(0.25,1),false), new mxConnectionConstraint( new mxPoint(0.75,0),false)];_0x4d9cx13[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.75,0),true), new mxConnectionConstraint( new mxPoint(0.25,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.75,1),true), new mxConnectionConstraint( new mxPoint(0.1,0.25),false), new mxConnectionConstraint( new mxPoint(0.2,0.5),false), new mxConnectionConstraint( new mxPoint(0.1,0.75),false), new mxConnectionConstraint( new mxPoint(0.9,0.25),false), new mxConnectionConstraint( new mxPoint(1,0.5),false), new mxConnectionConstraint( new mxPoint(0.9,0.75),false)];mxLine[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.5),false), new mxConnectionConstraint( new mxPoint(0.25,0.5),false), new mxConnectionConstraint( new mxPoint(0.75,0.5),false), new mxConnectionConstraint( new mxPoint(1,0.5),false)];_0x4d9cx26[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.5,0),false), new mxConnectionConstraint( new mxPoint(0.5,1),false)];mxEllipse[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0,0),true), new mxConnectionConstraint( new mxPoint(1,0),true), new mxConnectionConstraint( new mxPoint(0,1),true), new mxConnectionConstraint( new mxPoint(1,1),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.5))];mxDoubleEllipse[_0x653f[0]][_0x653f[147]]=mxEllipse[_0x653f[0]][_0x653f[147]];mxRhombus[_0x653f[0]][_0x653f[147]]=mxEllipse[_0x653f[0]][_0x653f[147]];mxTriangle[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0,0.25),true), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0,0.75),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(1,0.5),true)];mxHexagon[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.375,0),true), new mxConnectionConstraint( new mxPoint(0.5,0),true), new mxConnectionConstraint( new mxPoint(0.625,0),true), new mxConnectionConstraint( new mxPoint(0.125,0.25),false), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(0.125,0.75),false), new mxConnectionConstraint( new mxPoint(0.875,0.25),false), new mxConnectionConstraint( new mxPoint(0,0.5),true), new mxConnectionConstraint( new mxPoint(1,0.5),true), new mxConnectionConstraint( new mxPoint(0.875,0.75),false), new mxConnectionConstraint( new mxPoint(0.375,1),true), new mxConnectionConstraint( new mxPoint(0.5,1),true), new mxConnectionConstraint( new mxPoint(0.625,1),true)];mxCloud[_0x653f[0]][_0x653f[147]]=[ new mxConnectionConstraint( new mxPoint(0.25,0.25),false), new mxConnectionConstraint( new mxPoint(0.4,0.1),false), new mxConnectionConstraint( new mxPoint(0.16,0.55),false), new mxConnectionConstraint( new mxPoint(0.07,0.4),false), new mxConnectionConstraint( new mxPoint(0.31,0.8),false), new mxConnectionConstraint( new mxPoint(0.13,0.77),false), new mxConnectionConstraint( new mxPoint(0.8,0.8),false), new mxConnectionConstraint( new mxPoint(0.55,0.95),false), new mxConnectionConstraint( new mxPoint(0.875,0.5),false), new mxConnectionConstraint( new mxPoint(0.96,0.7),false), new mxConnectionConstraint( new mxPoint(0.625,0.2),false), new mxConnectionConstraint( new mxPoint(0.88,0.25),false)];mxArrow[_0x653f[0]][_0x653f[147]]=null})() \ No newline at end of file +/** + * $Id: Shapes.js,v 1.13 2013-02-02 06:44:30 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ + +/** + * Registers shapes. + */ +(function() +{ + // Cube Shape, supports size style + function CubeShape() { }; + CubeShape.prototype = new mxCylinder(); + CubeShape.prototype.constructor = CubeShape; + CubeShape.prototype.size = 20; + CubeShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (isForeground) + { + path.moveTo(s, h); + path.lineTo(s, s); + path.lineTo(0, 0); + path.moveTo(s, s); + path.lineTo(w, s); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, s); + path.lineTo(w, h); + path.lineTo(s, h); + path.lineTo(0, h - s); + path.lineTo(0, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['cube'] = CubeShape; + + // Note Shape, supports size style + function NoteShape() { }; + NoteShape.prototype = new mxCylinder(); + NoteShape.prototype.constructor = NoteShape; + NoteShape.prototype.size = 30; + NoteShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (isForeground) + { + path.moveTo(w - s, 0); + path.lineTo(w - s, s); + path.lineTo(w, s); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, s); + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['note'] = NoteShape; + + // Folder Shape, supports tabWidth, tabHeight styles + function FolderShape() { }; + FolderShape.prototype = new mxCylinder(); + FolderShape.prototype.constructor = FolderShape; + FolderShape.prototype.tabWidth = 60; + FolderShape.prototype.tabHeight = 20; + FolderShape.prototype.tabPosition = 'right'; + FolderShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var tw = mxUtils.getValue(this.style, 'tabWidth', this.tabWidth); + var th = mxUtils.getValue(this.style, 'tabHeight', this.tabHeight); + var tp = mxUtils.getValue(this.style, 'tabPosition', this.tabPosition); + var dx = Math.min(w, tw); + var dy = Math.min(h, th); + + if (isForeground) + { + if (tp == 'left') + { + path.moveTo(0, dy); + path.lineTo(dx, dy); + } + // Right is default + else + { + path.moveTo(w - dx, dy); + path.lineTo(w, dy); + } + + path.end(); + } + else + { + if (tp == 'left') + { + path.moveTo(0, 0); + path.lineTo(dx, 0); + path.lineTo(dx, dy); + path.lineTo(w, dy); + } + // Right is default + else + { + path.moveTo(0, dy); + path.lineTo(w - dx, dy); + path.lineTo(w - dx, 0); + path.lineTo(w, 0); + } + + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, dy); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['folder'] = FolderShape; + + // Card Shape, supports size style + function CardShape() { }; + CardShape.prototype = new mxCylinder(); + CardShape.prototype.constructor = CardShape; + CardShape.prototype.size = 30; + CardShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = Math.min(w, Math.min(h, mxUtils.getValue(this.style, 'size', this.size))); + + if (!isForeground) + { + path.moveTo(s, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(0, h); + path.lineTo(0, s); + path.lineTo(s, 0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['card'] = CardShape; + + // Tape Shape, supports size style + function TapeShape() { }; + TapeShape.prototype = new mxCylinder(); + TapeShape.prototype.constructor = TapeShape; + TapeShape.prototype.size = 0.4; + TapeShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = mxUtils.getValue(this.style, 'size', this.size); + var dy = h * s; + var fy = 1.4; + + if (!isForeground) + { + path.moveTo(0, dy / 2); + path.quadTo(w / 4, dy * fy, w / 2, dy / 2); + path.quadTo(w * 3 / 4, dy * (1 - fy), w, dy / 2); + path.lineTo(w, h - dy / 2); + path.quadTo(w * 3 / 4, h - dy * fy, w / 2, h - dy / 2); + path.quadTo(w / 4, h - dy * (1 - fy), 0, h - dy / 2); + path.lineTo(0, dy / 2); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['tape'] = TapeShape; + + // Tape Shape, supports size style + function StepShape() { }; + StepShape.prototype = new mxCylinder(); + StepShape.prototype.constructor = StepShape; + StepShape.prototype.size = 0.2; + StepShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var s = w * mxUtils.getValue(this.style, 'size', this.size); + + if (!isForeground) + { + path.moveTo(0, 0); + path.lineTo(w - s, 0); + path.lineTo(w, h / 2); + path.lineTo(w - s, h); + path.lineTo(0, h); + path.lineTo(s, h / 2); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['step'] = StepShape; + + // Plus Shape + function PlusShape() + { + mxRectangleShape.call(this); + }; + mxUtils.extend(PlusShape, mxRectangleShape); + PlusShape.prototype.isHtmlAllowed = function() + { + return false; + }; + PlusShape.prototype.paintForeground = function(c, x, y, w, h) + { + var border = Math.min(w / 5, h / 5) + 1; + + c.begin(); + c.moveTo(x + w / 2, y + border); + c.lineTo(x + w / 2, y + h - border); + c.moveTo(x + border, y + h / 2); + c.lineTo(x + w - border, y + h / 2); + c.end(); + c.stroke(); + mxRectangleShape.prototype.paintForeground.apply(this, arguments); + }; + + mxCellRenderer.prototype.defaultShapes['plus'] = PlusShape; + + // CompositeShape + function ExtendedShape() + { + mxRectangleShape.call(this); + }; + mxUtils.extend(ExtendedShape, mxRectangleShape); + ExtendedShape.prototype.isHtmlAllowed = function() + { + return false; + }; + ExtendedShape.prototype.paintForeground = function(c, x, y, w, h) + { + if (this.style != null) + { + if (this.style['double'] == 1) + { + var inset = Math.max(2, this.strokewidth + 1); + + mxRectangleShape.prototype.paintBackground.call(this, c, x + inset, y + inset, w - 2 * inset, h - 2 * inset); + mxRectangleShape.prototype.paintForeground.apply(this, arguments); + + x += inset; + y += inset; + w -= 2 * inset; + h -= 2 * inset; + } + + c.setDashed(false); + + // Draws the symbols defined in the style. The symbols are + // numbered from 1...n. Possible postfixes are align, + // verticalAlign, spacing, arcSpacing, width, height + var counter = 0; + var shape = null; + + do + { + shape = mxCellRenderer.prototype.defaultShapes[this.style['symbol' + counter]]; + + if (shape != null) + { + var align = this.style['symbol' + counter + 'Align']; + var valign = this.style['symbol' + counter + 'VerticalAlign']; + var width = this.style['symbol' + counter + 'Width']; + var height = this.style['symbol' + counter + 'Height']; + var spacing = this.style['symbol' + counter + 'Spacing'] || 0; + var arcspacing = this.style['symbol' + counter + 'ArcSpacing']; + + if (arcspacing != null) + { + spacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing; + } + + var x2 = x; + var y2 = y; + + if (align == mxConstants.ALIGN_CENTER) + { + x2 += (w - width) / 2; + } + else if (align == mxConstants.ALIGN_RIGHT) + { + x2 += w - width - spacing; + } + else + { + x2 += spacing; + } + + if (valign == mxConstants.ALIGN_MIDDLE) + { + y2 += (h - height) / 2; + } + else if (valign == mxConstants.ALIGN_BOTTOM) + { + y2 += h - height - spacing; + } + else + { + y2 += spacing; + } + + c.save(); + + // Small hack to pass style along into subshape + var tmp = new shape(); + // TODO: Clone style and override settings (eg. strokewidth) + tmp.style = this.style; + shape.prototype.paintVertexShape.call(tmp, c, x2, y2, width, height); + c.restore(); + } + + counter++; + } + while (shape != null); + } + }; + + mxCellRenderer.prototype.defaultShapes['ext'] = ExtendedShape; + + // Tape Shape, supports size style + function MessageShape() { }; + MessageShape.prototype = new mxCylinder(); + MessageShape.prototype.constructor = MessageShape; + MessageShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + if (isForeground) + { + path.moveTo(0, 0); + path.lineTo(w / 2, h / 2); + path.lineTo(w, 0); + path.end(); + } + else + { + path.moveTo(0, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(0, h); + path.close(); + } + }; + + mxCellRenderer.prototype.defaultShapes['message'] = MessageShape; + + // New Actor Shape + function UmlActorShape() { }; + UmlActorShape.prototype = new mxCylinder(); + UmlActorShape.prototype.constructor = UmlActorShape; + UmlActorShape.prototype.addPipe = true; + UmlActorShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var width = w / 3; + var height = h / 4; + + if (!isForeground) + { + path.moveTo(w / 2, height); + path.curveTo(w / 2 - width, height, w / 2 - width, 0, w / 2, 0); + path.curveTo(w / 2 + width, 0, w / 2 + width, height, w / 2, height); + path.close(); + + path.moveTo(w / 2, height); + path.lineTo(w / 2, 2 * h / 3); + + // Arms + path.moveTo(w / 2, h / 3); + path.lineTo(0, h / 3); + path.moveTo(w / 2, h / 3); + path.lineTo(w, h / 3); + + // Legs + path.moveTo(w / 2, 2 * h / 3); + path.lineTo(0, h); + path.moveTo(w / 2, 2 * h / 3); + path.lineTo(w, h); + path.end(); + } + }; + + // Replaces existing actor shape + mxCellRenderer.prototype.defaultShapes['umlActor'] = UmlActorShape; + + // New Actor Shape + function LollipopShape() { }; + LollipopShape.prototype = new mxCylinder(); + LollipopShape.prototype.constructor = LollipopShape; + LollipopShape.prototype.size = 10; + LollipopShape.prototype.addPipe = true; + LollipopShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var ss = mxUtils.getValue(this.style, 'size', this.size); + var width = ss * 2 / 3; + var height = ss; + + if (!isForeground) + { + path.moveTo(w / 2, height); + path.curveTo(w / 2 - width, height, w / 2 - width, 0, w / 2, 0); + path.curveTo(w / 2 + width, 0, w / 2 + width, height, w / 2, height); + path.close(); + + path.moveTo(w / 2, height); + path.lineTo(w / 2, h); + path.end(); + } + }; + + // Replaces existing actor shape + mxCellRenderer.prototype.defaultShapes['lollipop'] = LollipopShape; + + // Folder Shape, supports tabWidth, tabHeight styles + function ComponentShape() { }; + ComponentShape.prototype = new mxCylinder(); + ComponentShape.prototype.constructor = ComponentShape; + ComponentShape.prototype.jettyWidth = 32; + ComponentShape.prototype.jettyHeight = 12; + ComponentShape.prototype.redrawPath = function(path, x, y, w, h, isForeground) + { + var dx = mxUtils.getValue(this.style, 'jettyWidth', this.jettyWidth); + var dy = mxUtils.getValue(this.style, 'jettyHeight', this.jettyHeight); + var x0 = dx / 2; + var x1 = x0 + dx / 2; + var y0 = 0.3 * h - dy / 2; + var y1 = 0.7 * h - dy / 2; + + if (isForeground) + { + path.moveTo(x0, y0); + path.lineTo(x1, y0); + path.lineTo(x1, y0 + dy); + path.lineTo(x0, y0 + dy); + path.moveTo(x0, y1); + path.lineTo(x1, y1); + path.lineTo(x1, y1 + dy); + path.lineTo(x0, y1 + dy); + path.end(); + } + else + { + path.moveTo(x0, 0); + path.lineTo(w, 0); + path.lineTo(w, h); + path.lineTo(x0, h); + path.lineTo(x0, y1 + dy); + path.lineTo(0, y1 + dy); + path.lineTo(0, y1); + path.lineTo(x0, y1); + path.lineTo(x0, y0 + dy); + path.lineTo(0, y0 + dy); + path.lineTo(0, y0); + path.lineTo(x0, y0); + path.close(); + path.end(); + } + }; + + mxCellRenderer.prototype.defaultShapes['component'] = ComponentShape; + + // State Shapes derives from double ellipse + function StateShape() { }; + StateShape.prototype = new mxDoubleEllipse(); + StateShape.prototype.constructor = StateShape; + StateShape.prototype.outerStroke = true; + StateShape.prototype.paintVertexShape = function(c, x, y, w, h) + { + var inset = Math.min(4, Math.min(w / 5, h / 5)); + + if (w > 0 && h > 0) + { + c.ellipse(x + inset, y + inset, w - 2 * inset, h - 2 * inset); + c.fillAndStroke(); + } + + c.setShadow(false); + + if (this.outerStroke) + { + c.ellipse(x, y, w, h); + c.stroke(); + } + }; + + mxCellRenderer.prototype.defaultShapes['endState'] = StateShape; + + function StartStateShape() { }; + StartStateShape.prototype = new StateShape(); + StartStateShape.prototype.constructor = StartStateShape; + StartStateShape.prototype.outerStroke = false; + + mxCellRenderer.prototype.defaultShapes['startState'] = StartStateShape; + + // Image export for state shapes + var imageExportInitShapes = mxImageExport.prototype.initShapes; + mxImageExport.prototype.initShapes = function() + { + imageExportInitShapes.apply(this, arguments); + + function createStateShape(outerStroke) + { + return { + drawShape: function(canvas, state, bounds, background) + { + var x = bounds.x; + var y = bounds.y; + var w = bounds.width; + var h = bounds.height; + + if (background) + { + var inset = Math.min(4, Math.min(w / 5, h / 5)); + x += inset; + y += inset; + w -= 2 * inset; + h -= 2 * inset; + + if (w > 0 && h > 0) + { + canvas.ellipse(x, y, w, h); + } + + return true; + } + else + { + canvas.fillAndStroke(); + + if (outerStroke) + { + canvas.ellipse(x, y, w, h); + canvas.stroke(); + } + } + } + }; + }; + + this.shapes['endState'] = createStateShape(true); + this.shapes['startState'] = createStateShape(false); + }; + + // Defines custom edge shape + function LinkShape() + { + mxArrow.call(this); + }; + mxUtils.extend(LinkShape, mxArrow); + LinkShape.prototype.paintEdgeShape = function(c, pts) + { + var width = 10; + + // Base vector (between end points) + var p0 = pts[0]; + var pe = pts[pts.length - 1]; + + var dx = pe.x - p0.x; + var dy = pe.y - p0.y; + var dist = Math.sqrt(dx * dx + dy * dy); + var length = dist; + + // Computes the norm and the inverse norm + var nx = dx / dist; + var ny = dy / dist; + var basex = length * nx; + var basey = length * ny; + var floorx = width * ny/3; + var floory = -width * nx/3; + + // Computes points + var p0x = p0.x - floorx / 2; + var p0y = p0.y - floory / 2; + var p1x = p0x + floorx; + var p1y = p0y + floory; + var p2x = p1x + basex; + var p2y = p1y + basey; + var p3x = p2x + floorx; + var p3y = p2y + floory; + // p4 not necessary + var p5x = p3x - 3 * floorx; + var p5y = p3y - 3 * floory; + + c.begin(); + c.moveTo(p1x, p1y); + c.lineTo(p2x, p2y); + c.moveTo(p5x + floorx, p5y + floory); + c.lineTo(p0x, p0y); + c.stroke(); + }; + + // Registers the link shape + mxCellRenderer.prototype.defaultShapes['link'] = LinkShape; + + // Registers and defines the custom marker + mxMarker.addMarker('dash', function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) + { + var nx = unitX * (size + sw + 1); + var ny = unitY * (size + sw + 1); + + return function() + { + canvas.begin(); + canvas.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2); + canvas.lineTo(pe.x + ny / 2 - 3 * nx / 2, pe.y - 3 * ny / 2 - nx / 2); + canvas.stroke(); + }; + }); + + // Implements custom handlers + var SPECIAL_HANDLE_INDEX = -99; + + // Handlers are only added if mxVertexHandler is defined (ie. not in embedded graph) + if (typeof(mxVertexHandler) != 'undefined') + { + function mxExtVertexHandler(state) + { + mxVertexHandler.call(this, state); + }; + + mxUtils.extend(mxExtVertexHandler, mxVertexHandler); + + mxExtVertexHandler.prototype.useGridForSpecialHandle = false; + + mxExtVertexHandler.prototype.init = function() + { + this.horizontal = mxUtils.getValue(this.state.style, mxConstants.STYLE_HORIZONTAL, true); + var graph = this.state.view.graph; + + if (this.handleImage != null) + { + var bounds = new mxRectangle(0, 0, this.handleImage.width, this.handleImage.height); + this.specialHandle = new mxImageShape(bounds, this.handleImage.src); + } + else + { + var size = 10; + var bounds = new mxRectangle(0, 0, size, size); + this.specialHandle = new mxRhombus(bounds, mxConstants.HANDLE_FILLCOLOR, mxConstants.HANDLE_STROKECOLOR); + } + + this.specialHandle.dialect = (graph.dialect != mxConstants.DIALECT_SVG) ? + mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; + this.specialHandle.init(graph.getView().getOverlayPane()); + this.specialHandle.node.style.cursor = this.getSpecialHandleCursor(); + + mxEvent.redirectMouseEvents(this.specialHandle.node, graph, this.state); + mxVertexHandler.prototype.init.apply(this, arguments); + }; + + mxExtVertexHandler.prototype.getSpecialHandleCursor = function() + { + return 'default'; + }; + + mxExtVertexHandler.prototype.redraw = function() + { + mxVertexHandler.prototype.redraw.apply(this, arguments); + + var size = this.specialHandle.bounds.width; + this.specialHandle.bounds = this.getSpecialHandleBounds(size); + this.specialHandle.redraw(); + }; + + mxExtVertexHandler.prototype.destroy = function() + { + mxVertexHandler.prototype.destroy.apply(this, arguments); + + if (this.specialHandle != null) + { + this.specialHandle.destroy(); + this.specialHandle = null; + } + }; + + mxExtVertexHandler.prototype.getHandleForEvent = function(me) + { + if (me.isSource(this.specialHandle)) + { + return SPECIAL_HANDLE_INDEX; + } + + return mxVertexHandler.prototype.getHandleForEvent.apply(this, arguments); + }; + + mxExtVertexHandler.prototype.mouseMove = function(sender, me) + { + if (!me.isConsumed() && this.index == SPECIAL_HANDLE_INDEX) + { + var point = new mxPoint(me.getGraphX(), me.getGraphY()); + this.constrainPoint(point); + var gridEnabled = this.graph.isGridEnabledEvent(me.getEvent()); + var scale = this.graph.getView().scale; + + if (gridEnabled && this.useGridForSpecialHandle) + { + point.x = this.graph.snap(point.x / scale) * scale; + point.y = this.graph.snap(point.y / scale) * scale; + } + + this.updateStyle(point); + this.moveSizerTo(this.specialHandle, point.x, point.y); + this.state.view.graph.cellRenderer.redraw(this.state, true); + me.consume(); + } + else + { + mxVertexHandler.prototype.mouseMove.apply(this, arguments); + } + }; + + mxExtVertexHandler.prototype.mouseUp = function(sender, me) + { + if (!me.isConsumed() && this.index == SPECIAL_HANDLE_INDEX) + { + this.applyStyle(); + this.reset(); + me.consume(); + } + else + { + mxVertexHandler.prototype.mouseUp.apply(this, arguments); + } + }; + + mxExtVertexHandler.prototype.getSpecialHandleBounds = function(size) + { + var rotation = this.state.shape.getShapeRotation(); + var alpha = mxUtils.toRadians(rotation); + var cos = Math.cos(alpha); + var sin = Math.sin(alpha); + + var bounds = new mxRectangle(this.state.x, this.state.y, this.state.width, this.state.height); + + if (this.state.shape.isPaintBoundsInverted()) + { + var t = (bounds.width - bounds.height) / 2; + bounds.x += t; + bounds.y -= t; + var tmp = bounds.width; + bounds.width = bounds.height; + bounds.height = tmp; + } + + var pt = this.getSpecialHandlePoint(bounds); + + if (this.state.shape.flipH) + { + pt.x = 2 * bounds.x + bounds.width - pt.x; + } + + if (this.state.shape.flipV) + { + pt.y = 2 * bounds.y + bounds.height - pt.y; + } + + pt = mxUtils.getRotatedPoint(pt, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + + return new mxRectangle(pt.x - size / 2, pt.y - size / 2, size, size); + }; + + mxExtVertexHandler.prototype.getSpecialHandlePoint = function(bounds) + { + // Hook for subclassers + return null; + }; + + mxExtVertexHandler.prototype.updateStyle = function(point) + { + // Hook for subclassers + }; + + mxExtVertexHandler.prototype.constrainPoint = function(point) + { + point.x = Math.max(this.state.x, Math.min(this.state.x + this.state.width, point.x)); + point.y = Math.max(this.state.y, Math.min(this.state.y + this.state.height, point.y)); + }; + + mxExtVertexHandler.prototype.applyStyle = function() + { + // Hook for subclassers + }; + + // Folder Handler + function mxFolderHandler(state) + { + mxExtVertexHandler.call(this, state); + }; + + mxUtils.extend(mxFolderHandler, mxExtVertexHandler); + + mxFolderHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var tw = Math.min(bounds.width, mxUtils.getValue(this.state.style, 'tabWidth', 60) * scale); + var th = Math.min(bounds.height, mxUtils.getValue(this.state.style, 'tabHeight', 20) * scale); + + var tp = mxUtils.getValue(this.state.style, 'tabPosition', 'right'); + var x = (tp == 'left') ? bounds.x + tw : bounds.x + bounds.width - tw; + + return new mxPoint(x, bounds.y + th); + }; + + mxFolderHandler.prototype.updateStyle = function(point) + { + var rotation = this.state.shape.getShapeRotation(); + var alpha = mxUtils.toRadians(rotation); + var cos = Math.cos(-alpha); + var sin = Math.sin(-alpha); + + var bounds = new mxRectangle(this.state.x, this.state.y, this.state.width, this.state.height); + + if (this.state.shape.isPaintBoundsInverted()) + { + var t = (bounds.width - bounds.height) / 2; + bounds.x += t; + bounds.y -= t; + var tmp = bounds.width; + bounds.width = bounds.height; + bounds.height = tmp; + } + + var pt = new mxPoint(point.x, point.y); + pt = mxUtils.getRotatedPoint(pt, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + + if (this.state.shape.flipH) + { + pt.x = 2 * bounds.x + bounds.width - pt.x; + } + + if (this.state.shape.flipV) + { + pt.y = 2 * bounds.y + bounds.height - pt.y; + } + + var result = this.updateStyleUnrotated(pt, bounds); + + // Modifies point to use rotated coordinates of return value + if (result != null) + { + if (this.state.shape.flipH) + { + result.x = 2 * bounds.x + bounds.width - result.x; + } + + if (this.state.shape.flipV) + { + result.y = 2 * bounds.y + bounds.height - result.y; + } + + cos = Math.cos(alpha); + sin = Math.sin(alpha); + result = mxUtils.getRotatedPoint(result, cos, sin, + new mxPoint(this.state.getCenterX(), this.state.getCenterY())); + point.x = result.x; + point.y = result.y; + } + }; + + mxFolderHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var tp = mxUtils.getValue(this.state.style, 'tabPosition', 'right'); + var tw = (tp == 'left') ? pt.x - bounds.x : bounds.x + bounds.width - pt.x; + var th = pt.y - bounds.y; + + var scale = this.graph.getView().scale; + this.state.style['tabWidth'] = Math.round(Math.max(1, tw) / scale); + this.state.style['tabHeight'] = Math.round(Math.max(1, th) / scale); + }; + + mxFolderHandler.prototype.applyStyle = function() + { + var model = this.graph.getModel(); + model.beginUpdate(); + try + { + this.state.view.graph.setCellStyles('tabWidth', this.state.style['tabWidth'], [this.state.cell]); + this.state.view.graph.setCellStyles('tabHeight', this.state.style['tabHeight'], [this.state.cell]); + } + finally + { + model.endUpdate(); + } + }; + + // Swimlane Handler + function mxSwimlaneHandler(state) + { + mxFolderHandler.call(this, state); + }; + + mxUtils.extend(mxSwimlaneHandler, mxFolderHandler); + + mxSwimlaneHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var startSize = mxUtils.getValue(this.state.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE); + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + Math.min(bounds.height, startSize * scale)); + }; + + mxSwimlaneHandler.prototype.updateStyleUnrotated = function(point, bounds) + { + point.x = bounds.x + bounds.width / 2; + startSize = point.y - bounds.y; + var scale = this.graph.getView().scale; + this.state.style['startSize'] = Math.round(Math.max(1, startSize) / scale); + + return point; + }; + + mxSwimlaneHandler.prototype.applyStyle = function() + { + this.state.view.graph.setCellStyles('startSize', this.state.style['startSize'], [this.state.cell]); + }; + + // Cube Handler + function mxCubeHandler(state) + { + mxFolderHandler.call(this, state); + }; + + mxUtils.extend(mxCubeHandler, mxFolderHandler); + + mxCubeHandler.prototype.defaultValue = 20; + + mxCubeHandler.prototype.scaleFactor = 1; + + mxCubeHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var sz = Math.min(bounds.width, Math.min(bounds.height, + mxUtils.getValue(this.state.style, 'size', this.defaultValue) * scale / this.scaleFactor)); + + return new mxPoint(bounds.x + sz, bounds.y + sz); + }; + + mxCubeHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(Math.min(bounds.width / this.scaleFactor, pt.x - bounds.x), + Math.min(bounds.height / this.scaleFactor, pt.y - bounds.y))); + var scale = this.graph.getView().scale; + this.state.style['size'] = Math.round(Math.max(1, size) / scale) * this.scaleFactor; + + // Stays on the diagonal + return new mxPoint(bounds.x + size, bounds.y + size); + }; + + mxCubeHandler.prototype.applyStyle = function() + { + this.state.view.graph.setCellStyles('size', this.state.style['size'], [this.state.cell]); + }; + + // Card Handler + function mxCardHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxCardHandler, mxCubeHandler); + + mxCardHandler.prototype.defaultValue = 30; + + mxCardHandler.prototype.scaleFactor = 2; + + // Note Handler + function mxNoteHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxNoteHandler, mxCubeHandler); + + mxNoteHandler.prototype.defaultValue = 30; + + mxNoteHandler.prototype.scaleFactor = 1; + + mxNoteHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var scale = this.graph.getView().scale; + var sz = Math.min(bounds.width, Math.min(bounds.height, + mxUtils.getValue(this.state.style, 'size', this.defaultValue) * scale / this.scaleFactor)); + + return new mxPoint(bounds.x + bounds.width - sz, bounds.y + sz); + }; + + mxNoteHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(Math.min(bounds.width / this.scaleFactor, pt.x - bounds.x + bounds.width), + Math.min(bounds.height / this.scaleFactor, pt.y - bounds.y))); + var scale = this.graph.getView().scale; + this.state.style['size'] = Math.round(Math.max(1, size) / scale) * this.scaleFactor; + + // Stays on the diagonal + return new mxPoint(bounds.x + bounds.width - size, bounds.y + size); + }; + + // Step Handler + function mxStepHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxStepHandler, mxCubeHandler); + + mxStepHandler.prototype.defaultValue = 0.2; + + mxStepHandler.prototype.scaleFactor = 1; + + mxStepHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var sz = mxUtils.getValue(this.state.style, 'size', this.defaultValue); + + return new mxPoint(bounds.x + bounds.width * sz, bounds.y + bounds.height / 2); + }; + + mxStepHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.min(1, (pt.x - bounds.x) / bounds.width); + this.state.style['size'] = size; + + return new mxPoint(bounds.x + size * bounds.width, bounds.y + bounds.height / 2); + }; + + // Tape Handler + function mxTapeHandler(state) + { + mxCubeHandler.call(this, state); + }; + + mxUtils.extend(mxTapeHandler, mxCubeHandler); + + mxTapeHandler.prototype.defaultValue = 0.4; + + mxTapeHandler.prototype.scaleFactor = 1; + + mxTapeHandler.prototype.getSpecialHandlePoint = function(bounds) + { + var sz = mxUtils.getValue(this.state.style, 'size', this.defaultValue); + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + sz * bounds.height / 2); + }; + + mxTapeHandler.prototype.updateStyleUnrotated = function(pt, bounds) + { + var size = Math.max(0, Math.min(1, ((pt.y - bounds.y) / bounds.height) * 2)); + this.state.style['size'] = size; + + return new mxPoint(bounds.x + bounds.width / 2, bounds.y + size * bounds.height / 2); + }; + + var handlers = {'swimlane': mxSwimlaneHandler, 'folder': mxFolderHandler, 'cube': mxCubeHandler, + 'card': mxCardHandler, 'note': mxNoteHandler, 'step': mxStepHandler, 'tape': mxTapeHandler}; + + var mxGraphCreateHandler = mxGraph.prototype.createHandler; + mxGraph.prototype.createHandler = function(state) + { + if (state != null) + { + var ctor = handlers[state.style['shape']]; + + if (ctor != null) + { + return new ctor(state); + } + } + + return mxGraphCreateHandler.apply(this, arguments); + }; + } + + // Constraints + mxGraph.prototype.getAllConnectionConstraints = function(terminal, source) + { + if (terminal != null && terminal.shape != null) + { + if (terminal.shape.stencil != null) + { + if (terminal.shape.stencil != null) + { + return terminal.shape.stencil.constraints; + } + } + else if (terminal.shape.constraints != null) + { + return terminal.shape.constraints; + } + } + + return null; + }; + + mxRectangleShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0, 0.25), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(1, 0.25), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + mxLabel.prototype.constraints = mxRectangleShape.prototype.constraints; + mxImageShape.prototype.constraints = mxRectangleShape.prototype.constraints; + mxSwimlane.prototype.constraints = mxRectangleShape.prototype.constraints; + PlusShape.prototype.constraints = mxRectangleShape.prototype.constraints; + NoteShape.prototype.constraints = mxRectangleShape.prototype.constraints; + CardShape.prototype.constraints = mxRectangleShape.prototype.constraints; + CubeShape.prototype.constraints = mxRectangleShape.prototype.constraints; + FolderShape.prototype.constraints = mxRectangleShape.prototype.constraints; + mxCylinder.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.15, 0.05), false), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.85, 0.05), false), + new mxConnectionConstraint(new mxPoint(0, 0.3), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.7), true), + new mxConnectionConstraint(new mxPoint(1, 0.3), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.7), true), + new mxConnectionConstraint(new mxPoint(0.15, 0.95), false), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.85, 0.95), false)]; + UmlActorShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0.1), false), + new mxConnectionConstraint(new mxPoint(0.5, 0), false), + new mxConnectionConstraint(new mxPoint(0.75, 0.1), false), + new mxConnectionConstraint(new mxPoint(0, 1/3), false), + new mxConnectionConstraint(new mxPoint(0, 1), false), + new mxConnectionConstraint(new mxPoint(1, 1/3), false), + new mxConnectionConstraint(new mxPoint(1, 1), false), + new mxConnectionConstraint(new mxPoint(0.5, 0.5), false)]; + ComponentShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0, 0.3), true), + new mxConnectionConstraint(new mxPoint(0, 0.7), true), + new mxConnectionConstraint(new mxPoint(1, 0.25), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + mxActor.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.25, 0.2), false), + new mxConnectionConstraint(new mxPoint(0.1, 0.5), false), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.75, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true)]; + TapeShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.35), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), false), + new mxConnectionConstraint(new mxPoint(0, 0.65), false), + new mxConnectionConstraint(new mxPoint(1, 0.35), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.65), false), + new mxConnectionConstraint(new mxPoint(0.25, 1), false), + new mxConnectionConstraint(new mxPoint(0.75, 0), false)]; + // TODO: Relative ports + StepShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.75, 0), true), + new mxConnectionConstraint(new mxPoint(0.25, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.75, 1), true), + new mxConnectionConstraint(new mxPoint(0.1, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.2, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.1, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.25), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.9, 0.75), false)]; + mxLine.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.25, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.75, 0.5), false), + new mxConnectionConstraint(new mxPoint(1, 0.5), false)]; + LollipopShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.5, 0), false), + new mxConnectionConstraint(new mxPoint(0.5, 1), false)]; + mxEllipse.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0), true), new mxConnectionConstraint(new mxPoint(1, 0), true), + new mxConnectionConstraint(new mxPoint(0, 1), true), new mxConnectionConstraint(new mxPoint(1, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), new mxConnectionConstraint(new mxPoint(1, 0.5))]; + mxDoubleEllipse.prototype.constraints = mxEllipse.prototype.constraints; + mxRhombus.prototype.constraints = mxEllipse.prototype.constraints; + mxTriangle.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0, 0.25), true), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0, 0.75), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true)]; + mxHexagon.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.375, 0), true), + new mxConnectionConstraint(new mxPoint(0.5, 0), true), + new mxConnectionConstraint(new mxPoint(0.625, 0), true), + new mxConnectionConstraint(new mxPoint(0.125, 0.25), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(0.125, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.875, 0.25), false), + new mxConnectionConstraint(new mxPoint(0, 0.5), true), + new mxConnectionConstraint(new mxPoint(1, 0.5), true), + new mxConnectionConstraint(new mxPoint(0.875, 0.75), false), + new mxConnectionConstraint(new mxPoint(0.375, 1), true), + new mxConnectionConstraint(new mxPoint(0.5, 1), true), + new mxConnectionConstraint(new mxPoint(0.625, 1), true)]; + mxCloud.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0.25), false), + new mxConnectionConstraint(new mxPoint(0.4, 0.1), false), + new mxConnectionConstraint(new mxPoint(0.16, 0.55), false), + new mxConnectionConstraint(new mxPoint(0.07, 0.4), false), + new mxConnectionConstraint(new mxPoint(0.31, 0.8), false), + new mxConnectionConstraint(new mxPoint(0.13, 0.77), false), + new mxConnectionConstraint(new mxPoint(0.8, 0.8), false), + new mxConnectionConstraint(new mxPoint(0.55, 0.95), false), + new mxConnectionConstraint(new mxPoint(0.875, 0.5), false), + new mxConnectionConstraint(new mxPoint(0.96, 0.7), false), + new mxConnectionConstraint(new mxPoint(0.625, 0.2), false), + new mxConnectionConstraint(new mxPoint(0.88, 0.25), false)]; + mxArrow.prototype.constraints = null; +})(); diff --git a/public/assets/plugins/square/js/Sidebar.js b/public/assets/plugins/square/js/Sidebar.js index 5051f3a..bdcb8ea 100644 --- a/public/assets/plugins/square/js/Sidebar.js +++ b/public/assets/plugins/square/js/Sidebar.js @@ -1 +1,904 @@ -var _0xdb7c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x64\x69\x74\x6F\x72\x55\x69","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x70\x61\x6C\x65\x74\x74\x65\x73","\x73\x68\x6F\x77\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x67\x72\x61\x70\x68","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x74\x53\x74\x79\x6C\x65\x73\x68\x65\x65\x74","\x65\x64\x69\x74\x6F\x72","\x72\x65\x73\x65\x74\x56\x69\x65\x77\x4F\x6E\x52\x6F\x6F\x74\x43\x68\x61\x6E\x67\x65","\x66\x6F\x6C\x64\x69\x6E\x67\x45\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x43\x6F\x6E\x6E\x65\x63\x74\x61\x62\x6C\x65","\x61\x75\x74\x6F\x53\x63\x72\x6F\x6C\x6C","\x73\x65\x74\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x73\x74\x79\x6C\x65","\x68\x69\x64\x64\x65\x6E","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x73\x6F\x6C\x75\x74\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79","\x49\x53\x5F\x54\x4F\x55\x43\x48","\x6D\x6F\x75\x73\x65\x75\x70","\x62\x69\x6E\x64","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x73\x63\x72\x6F\x6C\x6C","\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E","\x68\x69\x64\x65\x54\x6F\x6F\x6C\x74\x69\x70","\x6D\x6F\x75\x73\x65\x6D\x6F\x76\x65","\x67\x65\x74\x53\x6F\x75\x72\x63\x65","\x63\x75\x72\x72\x65\x6E\x74\x45\x6C\x74","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x6D\x6F\x75\x73\x65\x6F\x75\x74","\x74\x6F\x45\x6C\x65\x6D\x65\x6E\x74","\x72\x65\x6C\x61\x74\x65\x64\x54\x61\x72\x67\x65\x74","\x69\x6E\x69\x74","\x73\x72\x63","\x2F\x74\x6F\x6F\x6C\x74\x69\x70\x2E\x70\x6E\x67","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x6C\x6F\x67","\x65\x6E\x74\x72\x79","\x67\x65\x74","\x2F\x65\x6E\x74\x72\x79\x2F","\x5F\x31\x32\x38\x78\x31\x32\x38\x2E\x70\x6E\x67","\x73\x74\x61\x72\x74","\x66\x69\x6E\x61\x6C\x6C\x79","\x65\x6E\x64","\x61\x64\x64\x49\x6D\x61\x67\x65\x50\x61\x6C\x65\x74\x74\x65","\x63\x61\x6C\x6C\x5F\x6D\x61\x6E\x61\x67\x65\x6D\x65\x6E\x74","\x2F\x63\x61\x6C\x6C\x5F\x6D\x61\x6E\x61\x67\x65\x6D\x65\x6E\x74\x2F","\x61\x6E\x73\x77\x65\x72","\x68\x61\x6E\x67\x75\x70","\x64\x69\x61\x6C","\x65\x78\x74\x5F\x64\x69\x61\x6C","\x71\x75\x65\x75\x65","\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x76\x61\x72\x69\x61\x62\x6C\x65","\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x2F","\x73\x65\x74","\x6D\x61\x74\x68","\x70\x6C\x61\x79\x62\x61\x63\x6B","\x2F\x70\x6C\x61\x79\x62\x61\x63\x6B\x2F","\x6D\x65\x6E\x75","\x73\x61\x79\x64\x69\x67\x69\x74\x73","\x73\x61\x79\x6E\x75\x6D\x62\x65\x72","\x73\x61\x79\x70\x68\x6F\x6E\x65\x74\x69\x63","\x74\x74\x73","\x69\x73\x70\x65\x65\x63\x68\x74\x74\x73","\x67\x65\x74\x64\x69\x67\x69\x74\x73","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2F","\x72\x65\x63\x6F\x72\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x53\x65\x72\x76\x65\x72","\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5F\x73\x65\x72\x76\x65\x72\x2F","\x64\x61\x74\x61\x62\x61\x73\x65","\x69\x73\x70\x65\x65\x63\x68\x61\x73\x72","\x63\x61\x6C\x6C\x66\x6C\x6F\x77","\x2F\x63\x61\x6C\x6C\x66\x6C\x6F\x77\x2F","\x67\x6F\x74\x6F\x63","\x67\x6F\x74\x6F\x69\x66","\x67\x6F\x74\x6F\x69\x66\x74\x69\x6D\x65","\x76\x73\x77\x69\x74\x63\x68","\x73\x74\x61\x74\x73","\x2F\x73\x74\x61\x74\x73\x2F","\x67\x6F\x61\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x2F\x67\x65\x6E\x65\x72\x61\x6C\x2F","\x6E\x6F\x6F\x70","\x73\x79\x73\x74\x65\x6D","\x61\x67\x69","\x73\x75\x62\x70\x72\x6F\x6A\x65\x63\x74","\x63\x75\x73\x74\x6F\x6D\x5F\x61\x70\x70","\x65\x6E\x61\x62\x6C\x65\x54\x6F\x6F\x6C\x74\x69\x70\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x42\x6F\x72\x64\x65\x72","\x74\x68\x75\x6D\x62\x42\x6F\x72\x64\x65\x72","\x74\x6F\x6F\x6C\x74\x69\x70\x44\x65\x6C\x61\x79","\x69\x6E\x73\x74\x61\x6C\x6C\x45\x64\x67\x65\x73","\x67\x65\x61\x72\x49\x6D\x61\x67\x65","\x2F\x63\x6C\x69\x70\x61\x72\x74\x2F\x47\x65\x61\x72\x5F\x31\x32\x38\x78\x31\x32\x38\x2E\x70\x6E\x67","\x74\x68\x75\x6D\x62\x57\x69\x64\x74\x68","\x74\x68\x75\x6D\x62\x48\x65\x69\x67\x68\x74","\x74\x68\x75\x6D\x62\x50\x61\x64\x64\x69\x6E\x67","\x73\x69\x64\x65\x62\x61\x72\x54\x69\x74\x6C\x65\x53\x69\x7A\x65","\x73\x69\x64\x65\x62\x61\x72\x54\x69\x74\x6C\x65\x73","\x74\x6F\x6F\x6C\x74\x69\x70\x54\x69\x74\x6C\x65\x73","\x73\x68\x6F\x77\x54\x6F\x6F\x6C\x74\x69\x70","\x74\x68\x72\x65\x61\x64","\x63\x6C\x65\x61\x72\x54\x69\x6D\x65\x6F\x75\x74","\x74\x6F\x6F\x6C\x74\x69\x70","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x53\x69\x64\x65\x62\x61\x72\x54\x6F\x6F\x6C\x74\x69\x70","\x67\x72\x61\x70\x68\x32","\x73\x65\x74\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x76\x69\x65\x77","\x49\x53\x5F\x53\x56\x47","\x63\x61\x6E\x76\x61\x73","\x72\x65\x6C\x61\x74\x69\x76\x65","\x74\x6F\x6F\x6C\x74\x69\x70\x49\x6D\x61\x67\x65","\x63\x72\x65\x61\x74\x65\x49\x6D\x61\x67\x65","\x77\x69\x64\x74\x68","\x31\x34\x70\x78","\x68\x65\x69\x67\x68\x74","\x32\x37\x70\x78","\x64\x69\x73\x70\x6C\x61\x79","\x62\x6C\x6F\x63\x6B","\x6C\x61\x62\x65\x6C\x73\x56\x69\x73\x69\x62\x6C\x65","\x63\x6C\x65\x61\x72","\x6D\x6F\x64\x65\x6C","\x61\x64\x64\x43\x65\x6C\x6C\x73","\x67\x65\x74\x47\x72\x61\x70\x68\x42\x6F\x75\x6E\x64\x73","\x49\x53\x5F\x51\x55\x49\x52\x4B\x53","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x76\x69\x73\x69\x62\x6C\x65","\x70\x78","\x6C\x65\x6E\x67\x74\x68","\x74\x6F\x6F\x6C\x74\x69\x70\x54\x69\x74\x6C\x65","\x62\x6F\x72\x64\x65\x72\x54\x6F\x70","\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20\x67\x72\x61\x79","\x74\x65\x78\x74\x41\x6C\x69\x67\x6E","\x63\x65\x6E\x74\x65\x72","\x31\x30\x30\x25","\x70\x61\x64\x64\x69\x6E\x67\x54\x6F\x70","\x32\x70\x78","\x36\x70\x78","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","","\x77\x72\x69\x74\x65","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x6D\x61\x72\x67\x69\x6E\x54\x6F\x70","\x74\x6F\x70","\x6E\x6F\x6E\x65","\x78","\x6D\x69\x6E","\x79","\x63\x6C\x69\x65\x6E\x74\x57\x69\x64\x74\x68","\x73\x70\x6C\x69\x74\x53\x69\x7A\x65","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x6D\x61\x78","\x74\x72\x61\x6E\x73\x66\x6F\x72\x6D","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x28","\x2C","\x29","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6C\x65\x66\x74","\x64\x72\x61\x77\x50\x61\x6E\x65","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x70\x61\x67\x65\x2D\x73\x69\x64\x65\x62\x61\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x73\x65\x74\x54\x69\x6D\x65\x6F\x75\x74","\x63\x72\x65\x61\x74\x65\x54\x69\x74\x6C\x65","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x67\x65\x54\x69\x74\x6C\x65","\x63\x72\x65\x61\x74\x65\x54\x68\x75\x6D\x62","\x73\x63\x61\x6C\x65\x41\x6E\x64\x54\x72\x61\x6E\x73\x6C\x61\x74\x65","\x66\x6C\x6F\x6F\x72","\x64\x69\x61\x6C\x65\x63\x74","\x44\x49\x41\x4C\x45\x43\x54\x5F\x53\x56\x47","\x4E\x4F\x5F\x46\x4F","\x63\x6C\x6F\x6E\x65\x4E\x6F\x64\x65","\x6F\x77\x6E\x65\x72\x53\x56\x47\x45\x6C\x65\x6D\x65\x6E\x74","\x67\x65\x74\x43\x61\x6E\x76\x61\x73","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x49\x53\x5F\x49\x45\x36","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x49\x6D\x61\x67\x65","\x75\x72\x6C\x28","\x74\x72\x61\x6E\x73\x70\x61\x72\x65\x6E\x74\x49\x6D\x61\x67\x65","\x63\x75\x72\x73\x6F\x72","\x70\x6F\x69\x6E\x74\x65\x72","\x6D\x69\x6E\x57\x69\x64\x74\x68","\x6D\x69\x6E\x48\x65\x69\x67\x68\x74","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x6E\x6F\x77\x72\x61\x70","\x49\x53\x5F\x49\x45","\x34\x70\x78","\x63\x72\x65\x61\x74\x65\x49\x74\x65\x6D","\x67\x65\x49\x74\x65\x6D","\x70\x61\x64\x64\x69\x6E\x67","\x63\x6C\x69\x63\x6B","\x63\x6F\x6E\x73\x75\x6D\x65","\x63\x72\x65\x61\x74\x65\x44\x72\x6F\x70\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x65\x74\x49\x6D\x70\x6F\x72\x74\x61\x62\x6C\x65\x43\x65\x6C\x6C\x73","\x69\x73\x56\x61\x6C\x69\x64\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x69\x73\x53\x70\x6C\x69\x74\x45\x6E\x61\x62\x6C\x65\x64","\x69\x73\x53\x70\x6C\x69\x74\x54\x61\x72\x67\x65\x74","\x73\x70\x6C\x69\x74\x45\x64\x67\x65","\x69\x6D\x70\x6F\x72\x74\x43\x65\x6C\x6C\x73","\x73\x63\x72\x6F\x6C\x6C\x43\x65\x6C\x6C\x54\x6F\x56\x69\x73\x69\x62\x6C\x65","\x73\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x63\x72\x65\x61\x74\x65\x44\x72\x61\x67\x50\x72\x65\x76\x69\x65\x77","\x62\x6F\x72\x64\x65\x72","\x31\x70\x78\x20\x64\x61\x73\x68\x65\x64\x20\x62\x6C\x61\x63\x6B","\x63\x72\x65\x61\x74\x65\x44\x72\x61\x67\x53\x6F\x75\x72\x63\x65","\x61\x75\x74\x6F\x73\x63\x72\x6F\x6C\x6C","\x6D\x61\x6B\x65\x44\x72\x61\x67\x67\x61\x62\x6C\x65","\x67\x65\x74\x44\x72\x6F\x70\x54\x61\x72\x67\x65\x74","\x61\x70\x70\x6C\x79","\x69\x73\x56\x61\x6C\x69\x64\x52\x6F\x6F\x74","\x61\x64\x64\x43\x6C\x69\x63\x6B\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x58","\x67\x65\x74\x43\x6C\x69\x65\x6E\x74\x59","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x6D\x6F\x75\x73\x65\x55\x70","\x69\x73\x50\x6F\x70\x75\x70\x54\x72\x69\x67\x67\x65\x72","\x63\x75\x72\x72\x65\x6E\x74\x47\x72\x61\x70\x68","\x74\x6F\x6C\x65\x72\x61\x6E\x63\x65","\x61\x62\x73","\x67\x65\x74\x47\x72\x69\x64\x53\x69\x7A\x65","\x64\x72\x6F\x70","\x63\x72\x65\x61\x74\x65\x58\x6D\x6C\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x6C\x61\x62\x65\x6C","\x66\x6F\x72\x45\x61\x63\x68","\x63\x72\x65\x61\x74\x65\x56\x65\x72\x74\x65\x78\x54\x65\x6D\x70\x6C\x61\x74\x65","\x6B\x65\x79","\x69\x73\x70\x65\x65\x63\x68\x5F\x61\x73\x72\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x69\x74\x2D\x49\x54","\x66\x69\x6C\x65\x5F\x69\x64","\x6F\x70\x74\x73","\x30","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x64\x69\x67\x69\x74","\x35","\x31","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64","\x72\x65\x74\x72\x79","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x69\x64","\x6D\x69\x6E\x64\x69\x67\x69\x74","\x6D\x61\x78\x64\x69\x67\x69\x74","\x31\x30","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x6F\x70\x74\x69\x6F\x6E\x73","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x76\x61\x6C\x75\x65","\x6F\x64\x62\x63\x5F\x69\x64","\x71\x75\x65\x72\x79","\x6F\x75\x74\x70\x75\x74","\x63\x6F\x6E\x74\x65\x78\x74","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x63\x6F\x6D\x6D\x61\x6E\x64","\x61\x72\x67\x73","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x69\x6E\x74\x65\x72\x76\x61\x6C\x5F\x69\x64","\x67\x6F\x74\x6F\x69\x66\x6D\x75\x6C\x74\x69\x74\x69\x6D\x65","\x64\x69\x67\x69\x74\x73","\x65\x73\x63\x61\x70\x65\x5F\x64\x69\x67\x69\x74\x73","\x23","\x6E\x75\x6D\x62\x65\x72","\x74\x65\x78\x74","\x66\x69\x6C\x65","\x74\x69\x6D\x65\x6F\x75\x74","\x2D\x31","\x73\x69\x70\x5F\x69\x64","\x75\x72\x6C","\x36\x30","\x70\x68\x6F\x6E\x65","\x74\x72\x75\x6E\x6B\x5F\x69\x64","\x67\x6F\x6F\x67\x6C\x65\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x69\x74","\x69\x73\x70\x65\x65\x63\x68\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x65\x75\x72\x69\x74\x61\x6C\x69\x61\x6E\x66\x65\x6D\x61\x6C\x65","\x71\x75\x65\x75\x65\x5F\x69\x64","\x6D\x61\x63\x72\x6F","\x67\x6F\x73\x75\x62","\x33\x30\x30","\x6D\x61\x69\x6C\x62\x6F\x78","\x70\x72\x6F\x6A\x65\x63\x74\x5F\x69\x64","\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x61\x67\x65\x6E\x74","\x71\x75\x65\x75\x65\x5F\x65\x76\x65\x6E\x74","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x64\x61\x74\x61\x34","\x64\x61\x74\x61\x35","\x71\x75\x65\x75\x65\x6C\x6F\x67","\x67\x6F\x61\x6C\x6E\x61\x6D\x65","\x6C\x69\x73\x74\x5F\x69\x64","\x7B\x43\x41\x4C\x4C\x45\x52\x49\x44\x28\x6E\x75\x6D\x29\x7D","\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x76\x65\x72\x74\x65\x78","\x63\x72\x65\x61\x74\x65\x56\x65\x72\x74\x65\x78\x54\x65\x6D\x70\x6C\x61\x74\x65\x46\x72\x6F\x6D\x43\x65\x6C\x6C\x73","\x69\x73\x47\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x75\x69\x64\x65\x73\x45\x6E\x61\x62\x6C\x65\x64","\x67\x72\x61\x70\x68\x48\x61\x6E\x64\x6C\x65\x72","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x54\x65\x6D\x70\x6C\x61\x74\x65","\x73\x65\x74\x54\x65\x72\x6D\x69\x6E\x61\x6C\x50\x6F\x69\x6E\x74","\x67\x65\x6F\x6D\x65\x74\x72\x79","\x65\x64\x67\x65","\x63\x72\x65\x61\x74\x65\x45\x64\x67\x65\x54\x65\x6D\x70\x6C\x61\x74\x65\x46\x72\x6F\x6D\x43\x65\x6C\x6C\x73","\x73\x65\x74\x44\x65\x66\x61\x75\x6C\x74\x45\x64\x67\x65","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x43\x6F\x6C\x6F\x72","\x23\x66\x66\x66\x66\x66\x66","\x61\x64\x64\x50\x61\x6C\x65\x74\x74\x65","\x67\x65\x53\x69\x64\x65\x62\x61\x72","\x61\x64\x64\x46\x6F\x6C\x64\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x2F\x63\x6F\x6C\x6C\x61\x70\x73\x65\x64\x2E\x67\x69\x66\x29","\x2F\x65\x78\x70\x61\x6E\x64\x65\x64\x2E\x67\x69\x66\x29","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x52\x65\x70\x65\x61\x74","\x6E\x6F\x2D\x72\x65\x70\x65\x61\x74","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x6F\x73\x69\x74\x69\x6F\x6E","\x31\x30\x30\x25\x20\x35\x30\x25","\x77\x61\x69\x74","\x72\x65\x6D\x6F\x76\x65\x50\x61\x6C\x65\x74\x74\x65","\x72\x65\x6D\x6F\x76\x65\x43\x68\x69\x6C\x64","\x69\x6D\x61\x67\x65\x3B\x69\x6D\x61\x67\x65\x3D"];_0xdb7c[0];function Sidebar(_0xa1dex2,_0xa1dex3){this[_0xdb7c[1]]=_0xa1dex2;this[_0xdb7c[2]]=_0xa1dex3;this[_0xdb7c[3]]= new Object();this[_0xdb7c[4]]=true;this[_0xdb7c[5]]= new Graph(document[_0xdb7c[7]](_0xdb7c[6]),null,null,this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]][_0xdb7c[8]]());this[_0xdb7c[5]][_0xdb7c[10]]=false;this[_0xdb7c[5]][_0xdb7c[11]]=false;this[_0xdb7c[5]][_0xdb7c[12]](false);this[_0xdb7c[5]][_0xdb7c[13]]=false;this[_0xdb7c[5]][_0xdb7c[14]](false);this[_0xdb7c[5]][_0xdb7c[15]](false);this[_0xdb7c[5]][_0xdb7c[2]][_0xdb7c[17]][_0xdb7c[16]]=_0xdb7c[18];this[_0xdb7c[5]][_0xdb7c[2]][_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[20];document[_0xdb7c[22]][_0xdb7c[21]](this[_0xdb7c[5]][_0xdb7c[2]]);if(!mxClient[_0xdb7c[23]]){mxEvent[_0xdb7c[26]](document,_0xdb7c[24],mxUtils[_0xdb7c[25]](this,function(){this[_0xdb7c[4]]=true}));mxEvent[_0xdb7c[26]](_0xa1dex3,_0xdb7c[27],mxUtils[_0xdb7c[25]](this,function(){this[_0xdb7c[4]]=true}));mxEvent[_0xdb7c[26]](document,_0xdb7c[28],mxUtils[_0xdb7c[25]](this,function(){this[_0xdb7c[4]]=false;this[_0xdb7c[29]]()}));mxEvent[_0xdb7c[26]](document,_0xdb7c[30],mxUtils[_0xdb7c[25]](this,function(_0xa1dex4){var _0xa1dex5=mxEvent[_0xdb7c[31]](_0xa1dex4);while(_0xa1dex5!=null){if(_0xa1dex5==this[_0xdb7c[32]]){return};_0xa1dex5=_0xa1dex5[_0xdb7c[33]]};this[_0xdb7c[29]]()}));mxEvent[_0xdb7c[26]](document,_0xdb7c[34],mxUtils[_0xdb7c[25]](this,function(_0xa1dex4){if(_0xa1dex4[_0xdb7c[35]]==null&&_0xa1dex4[_0xdb7c[36]]==null){this[_0xdb7c[29]]()}}))};this[_0xdb7c[37]](); new Image()[_0xdb7c[38]]=IMAGE_PATH+_0xdb7c[39]}Sidebar[_0xdb7c[40]][_0xdb7c[37]]=function(){var _0xa1dex6=STENCIL_PATH;console[_0xdb7c[41]](_0xa1dex6);this[_0xdb7c[49]](_0xdb7c[42],mxResources[_0xdb7c[43]](_0xdb7c[42]),_0xa1dex6+_0xdb7c[44],_0xdb7c[45],[_0xdb7c[46],_0xdb7c[47],_0xdb7c[48]],[mxResources[_0xdb7c[43]](_0xdb7c[46]),mxResources[_0xdb7c[43]](_0xdb7c[47]),mxResources[_0xdb7c[43]](_0xdb7c[48])]);this[_0xdb7c[49]](_0xdb7c[50],mxResources[_0xdb7c[43]](_0xdb7c[50]),_0xa1dex6+_0xdb7c[51],_0xdb7c[45],[_0xdb7c[52],_0xdb7c[53],_0xdb7c[54],_0xdb7c[55],_0xdb7c[56],_0xdb7c[57]],[mxResources[_0xdb7c[43]](_0xdb7c[52]),mxResources[_0xdb7c[43]](_0xdb7c[53]),mxResources[_0xdb7c[43]](_0xdb7c[54]),mxResources[_0xdb7c[43]](_0xdb7c[55]),mxResources[_0xdb7c[43]](_0xdb7c[56]),mxResources[_0xdb7c[43]](_0xdb7c[57])]);this[_0xdb7c[49]](_0xdb7c[58],mxResources[_0xdb7c[43]](_0xdb7c[58]),_0xa1dex6+_0xdb7c[59],_0xdb7c[45],[_0xdb7c[60],_0xdb7c[61]],[mxResources[_0xdb7c[43]](_0xdb7c[60]),mxResources[_0xdb7c[43]](_0xdb7c[61])]);this[_0xdb7c[49]](_0xdb7c[62],mxResources[_0xdb7c[43]](_0xdb7c[62]),_0xa1dex6+_0xdb7c[63],_0xdb7c[45],[_0xdb7c[62],_0xdb7c[64],_0xdb7c[65],_0xdb7c[66],_0xdb7c[67],_0xdb7c[68],_0xdb7c[69],_0xdb7c[70]],[mxResources[_0xdb7c[43]](_0xdb7c[62]),mxResources[_0xdb7c[43]](_0xdb7c[64]),mxResources[_0xdb7c[43]](_0xdb7c[65]),mxResources[_0xdb7c[43]](_0xdb7c[66]),mxResources[_0xdb7c[43]](_0xdb7c[67]),mxResources[_0xdb7c[43]](_0xdb7c[68]),mxResources[_0xdb7c[43]](_0xdb7c[69]),mxResources[_0xdb7c[43]](_0xdb7c[70])]);this[_0xdb7c[49]](_0xdb7c[71],mxResources[_0xdb7c[43]](_0xdb7c[71]),_0xa1dex6+_0xdb7c[72],_0xdb7c[45],[_0xdb7c[73]],[mxResources[_0xdb7c[43]](_0xdb7c[73])]);this[_0xdb7c[49]](_0xdb7c[74],mxResources[_0xdb7c[43]](_0xdb7c[74]),_0xa1dex6+_0xdb7c[75],_0xdb7c[45],[_0xdb7c[76],_0xdb7c[77]],[mxResources[_0xdb7c[43]](_0xdb7c[76]),mxResources[_0xdb7c[43]](_0xdb7c[77])]);this[_0xdb7c[49]](_0xdb7c[78],mxResources[_0xdb7c[43]](_0xdb7c[78]),_0xa1dex6+_0xdb7c[79],_0xdb7c[45],[_0xdb7c[80],_0xdb7c[81],_0xdb7c[82],_0xdb7c[83]],[mxResources[_0xdb7c[43]](_0xdb7c[80]),mxResources[_0xdb7c[43]](_0xdb7c[81]),mxResources[_0xdb7c[43]](_0xdb7c[82]),mxResources[_0xdb7c[43]](_0xdb7c[83])]);this[_0xdb7c[49]](_0xdb7c[84],mxResources[_0xdb7c[43]](_0xdb7c[84]),_0xa1dex6+_0xdb7c[85],_0xdb7c[45],[_0xdb7c[86]],[mxResources[_0xdb7c[43]](_0xdb7c[86])]);this[_0xdb7c[49]](_0xdb7c[87],mxResources[_0xdb7c[43]](_0xdb7c[87]),_0xa1dex6+_0xdb7c[88],_0xdb7c[45],[_0xdb7c[89],_0xdb7c[90],_0xdb7c[91],_0xdb7c[92],_0xdb7c[93]],[mxResources[_0xdb7c[43]](_0xdb7c[89]),mxResources[_0xdb7c[43]](_0xdb7c[90]),mxResources[_0xdb7c[43]](_0xdb7c[91]),mxResources[_0xdb7c[43]](_0xdb7c[92]),mxResources[_0xdb7c[43]](_0xdb7c[93])])};Sidebar[_0xdb7c[40]][_0xdb7c[94]]=!mxClient[_0xdb7c[23]];Sidebar[_0xdb7c[40]][_0xdb7c[95]]=16;Sidebar[_0xdb7c[40]][_0xdb7c[96]]=3;Sidebar[_0xdb7c[40]][_0xdb7c[97]]=300;Sidebar[_0xdb7c[40]][_0xdb7c[98]]=true;Sidebar[_0xdb7c[40]][_0xdb7c[99]]=STENCIL_PATH+_0xdb7c[100];Sidebar[_0xdb7c[40]][_0xdb7c[101]]=34;Sidebar[_0xdb7c[40]][_0xdb7c[102]]=34;Sidebar[_0xdb7c[40]][_0xdb7c[103]]=2;Sidebar[_0xdb7c[40]][_0xdb7c[104]]=9;Sidebar[_0xdb7c[40]][_0xdb7c[105]]=false;Sidebar[_0xdb7c[40]][_0xdb7c[106]]=false;Sidebar[_0xdb7c[40]][_0xdb7c[107]]=function(_0xa1dex7,_0xa1dex8,_0xa1dex9,_0xa1dexa){if(this[_0xdb7c[94]]&&this[_0xdb7c[4]]){if(this[_0xdb7c[32]]!=_0xa1dex7){if(this[_0xdb7c[108]]!=null){window[_0xdb7c[109]](this[_0xdb7c[108]]);this[_0xdb7c[108]]=null};var _0xa1dexb=mxUtils[_0xdb7c[25]](this,function(){if(this[_0xdb7c[110]]==null){this[_0xdb7c[110]]=document[_0xdb7c[7]](_0xdb7c[6]);this[_0xdb7c[110]][_0xdb7c[111]]=_0xdb7c[112];document[_0xdb7c[22]][_0xdb7c[21]](this[_0xdb7c[110]]);this[_0xdb7c[113]]= new Graph(this[_0xdb7c[110]],null,null,this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]][_0xdb7c[8]]());this[_0xdb7c[113]][_0xdb7c[115]][_0xdb7c[114]](this[_0xdb7c[95]],this[_0xdb7c[95]]);this[_0xdb7c[113]][_0xdb7c[10]]=false;this[_0xdb7c[113]][_0xdb7c[11]]=false;this[_0xdb7c[113]][_0xdb7c[13]]=false;this[_0xdb7c[113]][_0xdb7c[14]](false);this[_0xdb7c[113]][_0xdb7c[12]](false);this[_0xdb7c[113]][_0xdb7c[15]](false);if(!mxClient[_0xdb7c[116]]){this[_0xdb7c[113]][_0xdb7c[115]][_0xdb7c[117]][_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[118]};this[_0xdb7c[119]]=mxUtils[_0xdb7c[120]](IMAGE_PATH+_0xdb7c[39]);this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[20];this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[121]]=_0xdb7c[122];this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[123]]=_0xdb7c[124];document[_0xdb7c[22]][_0xdb7c[21]](this[_0xdb7c[119]])};this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[126];this[_0xdb7c[113]][_0xdb7c[127]]=(_0xa1dexa==null||_0xa1dexa);this[_0xdb7c[113]][_0xdb7c[129]][_0xdb7c[128]]();this[_0xdb7c[113]][_0xdb7c[130]](_0xa1dex8);var _0xa1dexc=this[_0xdb7c[113]][_0xdb7c[131]]();var _0xa1dexd=_0xa1dexc[_0xdb7c[121]]+2*this[_0xdb7c[95]];var _0xa1dexe=_0xa1dexc[_0xdb7c[123]]+2*this[_0xdb7c[95]];if(mxClient[_0xdb7c[132]]){_0xa1dexd+=4;_0xa1dexe+=4;this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[133]]=_0xdb7c[18]}else {this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[133]]=_0xdb7c[134]};this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[16]]=_0xdb7c[134];this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[121]]=_0xa1dexd+_0xdb7c[135];if(this[_0xdb7c[106]]&&_0xa1dex9!=null&&_0xa1dex9[_0xdb7c[136]]>0){if(this[_0xdb7c[137]]==null){this[_0xdb7c[137]]=document[_0xdb7c[7]](_0xdb7c[6]);this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[138]]=_0xdb7c[139];this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[140]]=_0xdb7c[141];this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[121]]=_0xdb7c[142];this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[133]]=_0xdb7c[18];if(mxClient[_0xdb7c[116]]){this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[143]]=_0xdb7c[144]}else {this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[20];this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[143]]=_0xdb7c[145]};this[_0xdb7c[110]][_0xdb7c[21]](this[_0xdb7c[137]])}else {this[_0xdb7c[137]][_0xdb7c[146]]=_0xdb7c[147]};this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[147];mxUtils[_0xdb7c[148]](this[_0xdb7c[137]],_0xa1dex9);var _0xa1dexf=this[_0xdb7c[137]][_0xdb7c[149]]+10;_0xa1dexe+=_0xa1dexf;if(mxClient[_0xdb7c[116]]){this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[150]]=(-_0xa1dexf)+_0xdb7c[135]}else {_0xa1dexe-=6;this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[151]]=(_0xa1dexe-_0xa1dexf)+_0xdb7c[135]}}else {if(this[_0xdb7c[137]]!=null&&this[_0xdb7c[137]][_0xdb7c[33]]!=null){this[_0xdb7c[137]][_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[152]}};this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[123]]=_0xa1dexe+_0xdb7c[135];var _0xa1dex10=-Math[_0xdb7c[154]](0,_0xa1dexc[_0xdb7c[153]]-this[_0xdb7c[95]]);var _0xa1dex11=-Math[_0xdb7c[154]](0,_0xa1dexc[_0xdb7c[155]]-this[_0xdb7c[95]]);var _0xa1dex12=this[_0xdb7c[2]][_0xdb7c[156]]+this[_0xdb7c[1]][_0xdb7c[157]]+3;var _0xa1dex13=Math[_0xdb7c[160]](0,(this[_0xdb7c[2]][_0xdb7c[158]]+_0xa1dex7[_0xdb7c[158]]-this[_0xdb7c[2]][_0xdb7c[159]]-_0xa1dexe/2+16));if(mxClient[_0xdb7c[116]]){this[_0xdb7c[113]][_0xdb7c[115]][_0xdb7c[117]][_0xdb7c[165]](_0xdb7c[161],_0xdb7c[162]+_0xa1dex10+_0xdb7c[163]+_0xa1dex11+_0xdb7c[164])}else {this[_0xdb7c[113]][_0xdb7c[115]][_0xdb7c[167]][_0xdb7c[17]][_0xdb7c[166]]=_0xa1dex10+_0xdb7c[135];this[_0xdb7c[113]][_0xdb7c[115]][_0xdb7c[167]][_0xdb7c[17]][_0xdb7c[151]]=_0xa1dex11+_0xdb7c[135]};_0xa1dex12+=document[_0xdb7c[170]](_0xdb7c[169])[_0xdb7c[168]];_0xa1dex13+=90;this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[20];this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[166]]=_0xa1dex12+_0xdb7c[135];this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[151]]=_0xa1dex13+_0xdb7c[135];this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[166]]=(_0xa1dex12-13)+_0xdb7c[135];this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[151]]=(_0xa1dex13+_0xa1dexe/2-13)+_0xdb7c[135]});if(this[_0xdb7c[110]]!=null&&this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[125]]!=_0xdb7c[152]){_0xa1dexb()}else {this[_0xdb7c[108]]=window[_0xdb7c[171]](_0xa1dexb,this[_0xdb7c[97]])};this[_0xdb7c[32]]=_0xa1dex7}}};Sidebar[_0xdb7c[40]][_0xdb7c[29]]=function(){if(this[_0xdb7c[108]]!=null){window[_0xdb7c[109]](this[_0xdb7c[108]]);this[_0xdb7c[108]]=null};if(this[_0xdb7c[110]]!=null){this[_0xdb7c[110]][_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[152];this[_0xdb7c[119]][_0xdb7c[17]][_0xdb7c[16]]=_0xdb7c[18];this[_0xdb7c[32]]=null}};Sidebar[_0xdb7c[40]][_0xdb7c[172]]=function(_0xa1dex14){var _0xa1dex7=document[_0xdb7c[7]](_0xdb7c[173]);_0xa1dex7[_0xdb7c[165]](_0xdb7c[174],_0xdb7c[175]);_0xa1dex7[_0xdb7c[111]]=_0xdb7c[176];mxUtils[_0xdb7c[148]](_0xa1dex7,_0xa1dex14);return _0xa1dex7};Sidebar[_0xdb7c[40]][_0xdb7c[177]]=function(_0xa1dex8,_0xa1dexd,_0xa1dexe,_0xa1dex15,_0xa1dex9,_0xa1dexa){this[_0xdb7c[5]][_0xdb7c[127]]=(_0xa1dexa==null||_0xa1dexa);this[_0xdb7c[5]][_0xdb7c[115]][_0xdb7c[178]](1,0,0);this[_0xdb7c[5]][_0xdb7c[130]](_0xa1dex8);var _0xa1dexc=this[_0xdb7c[5]][_0xdb7c[131]]();var _0xa1dex16=this[_0xdb7c[96]];var _0xa1dex17=Math[_0xdb7c[154]]((_0xa1dexd-2)/(_0xa1dexc[_0xdb7c[121]]-_0xa1dexc[_0xdb7c[153]]+_0xa1dex16),(_0xa1dexe-2)/(_0xa1dexc[_0xdb7c[123]]-_0xa1dexc[_0xdb7c[155]]+_0xa1dex16));var _0xa1dex10=-Math[_0xdb7c[154]](_0xa1dexc[_0xdb7c[153]],0);var _0xa1dex11=-Math[_0xdb7c[154]](_0xa1dexc[_0xdb7c[155]],0);this[_0xdb7c[5]][_0xdb7c[115]][_0xdb7c[178]](_0xa1dex17,_0xa1dex10,_0xa1dex11);_0xa1dexc=this[_0xdb7c[5]][_0xdb7c[131]]();var _0xa1dex18=Math[_0xdb7c[160]](0,Math[_0xdb7c[179]]((_0xa1dexd-_0xa1dexc[_0xdb7c[121]]-_0xa1dexc[_0xdb7c[153]])/2));var _0xa1dexf=Math[_0xdb7c[160]](0,Math[_0xdb7c[179]]((_0xa1dexe-_0xa1dexc[_0xdb7c[123]]-_0xa1dexc[_0xdb7c[155]])/2));var _0xa1dex19=null;if(this[_0xdb7c[5]][_0xdb7c[180]]==mxConstants[_0xdb7c[181]]&&!mxClient[_0xdb7c[182]]){_0xa1dex19=this[_0xdb7c[5]][_0xdb7c[115]][_0xdb7c[185]]()[_0xdb7c[184]][_0xdb7c[183]](true)}else {_0xa1dex19=this[_0xdb7c[5]][_0xdb7c[2]][_0xdb7c[183]](false);_0xa1dex19[_0xdb7c[146]]=this[_0xdb7c[5]][_0xdb7c[2]][_0xdb7c[146]]};this[_0xdb7c[5]][_0xdb7c[186]]()[_0xdb7c[128]]();if(mxClient[_0xdb7c[187]]){_0xa1dex15[_0xdb7c[17]][_0xdb7c[188]]=_0xdb7c[189]+this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[190]]+_0xdb7c[164]};var _0xa1dex1a=3;_0xa1dex19[_0xdb7c[17]][_0xdb7c[19]]=_0xdb7c[118];_0xa1dex19[_0xdb7c[17]][_0xdb7c[133]]=_0xdb7c[18];_0xa1dex19[_0xdb7c[17]][_0xdb7c[191]]=_0xdb7c[192];_0xa1dex19[_0xdb7c[17]][_0xdb7c[166]]=(_0xa1dex18+_0xa1dex1a)+_0xdb7c[135];_0xa1dex19[_0xdb7c[17]][_0xdb7c[151]]=(_0xa1dexf+_0xa1dex1a)+_0xdb7c[135];_0xa1dex19[_0xdb7c[17]][_0xdb7c[121]]=_0xa1dexd+_0xdb7c[135];_0xa1dex19[_0xdb7c[17]][_0xdb7c[123]]=_0xa1dexe+_0xdb7c[135];_0xa1dex19[_0xdb7c[17]][_0xdb7c[16]]=_0xdb7c[147];_0xa1dex19[_0xdb7c[17]][_0xdb7c[193]]=_0xdb7c[147];_0xa1dex19[_0xdb7c[17]][_0xdb7c[194]]=_0xdb7c[147];_0xa1dex15[_0xdb7c[21]](_0xa1dex19);if(this[_0xdb7c[105]]&&_0xa1dex9!=null){var _0xa1dex1b=(mxClient[_0xdb7c[132]])?2*this[_0xdb7c[103]]+2:0;_0xa1dex15[_0xdb7c[17]][_0xdb7c[123]]=(this[_0xdb7c[102]]+_0xa1dex1b+this[_0xdb7c[104]]+8)+_0xdb7c[135];var _0xa1dex1c=document[_0xdb7c[7]](_0xdb7c[6]);_0xa1dex1c[_0xdb7c[17]][_0xdb7c[195]]=this[_0xdb7c[104]]+_0xdb7c[135];_0xa1dex1c[_0xdb7c[17]][_0xdb7c[140]]=_0xdb7c[141];_0xa1dex1c[_0xdb7c[17]][_0xdb7c[196]]=_0xdb7c[197];if(mxClient[_0xdb7c[198]]){_0xa1dex1c[_0xdb7c[17]][_0xdb7c[123]]=(this[_0xdb7c[104]]+12)+_0xdb7c[135]};_0xa1dex1c[_0xdb7c[17]][_0xdb7c[143]]=_0xdb7c[199];mxUtils[_0xdb7c[148]](_0xa1dex1c,_0xa1dex9);_0xa1dex15[_0xdb7c[21]](_0xa1dex1c)}};Sidebar[_0xdb7c[40]][_0xdb7c[200]]=function(_0xa1dex8,_0xa1dex9,_0xa1dexa){var _0xa1dex7=document[_0xdb7c[7]](_0xdb7c[173]);_0xa1dex7[_0xdb7c[165]](_0xdb7c[174],_0xdb7c[175]);_0xa1dex7[_0xdb7c[111]]=_0xdb7c[201];_0xa1dex7[_0xdb7c[17]][_0xdb7c[133]]=_0xdb7c[18];var _0xa1dex1b=(mxClient[_0xdb7c[132]])?8+2*this[_0xdb7c[103]]:6;_0xa1dex7[_0xdb7c[17]][_0xdb7c[121]]=(this[_0xdb7c[101]]+_0xa1dex1b)+_0xdb7c[135];_0xa1dex7[_0xdb7c[17]][_0xdb7c[123]]=(this[_0xdb7c[102]]+_0xa1dex1b)+_0xdb7c[135];_0xa1dex7[_0xdb7c[17]][_0xdb7c[202]]=this[_0xdb7c[103]]+_0xdb7c[135];mxEvent[_0xdb7c[26]](_0xa1dex7,_0xdb7c[203],function(_0xa1dex4){mxEvent[_0xdb7c[204]](_0xa1dex4)});this[_0xdb7c[177]](_0xa1dex8,this[_0xdb7c[101]],this[_0xdb7c[102]],_0xa1dex7,_0xa1dex9,_0xa1dexa);return _0xa1dex7};Sidebar[_0xdb7c[40]][_0xdb7c[205]]=function(_0xa1dex8,_0xa1dex1d){return function(_0xa1dex1e,_0xa1dex4,_0xa1dex1f,_0xa1dex20,_0xa1dex21){if(_0xa1dex1e[_0xdb7c[206]]()){_0xa1dex8=_0xa1dex1e[_0xdb7c[207]](_0xa1dex8);if(_0xa1dex8[_0xdb7c[136]]>0){var _0xa1dex22=(_0xa1dex1f!=null)?_0xa1dex1e[_0xdb7c[208]](_0xa1dex1f,_0xa1dex8,_0xa1dex4):false;var _0xa1dex23=null;if(_0xa1dex1f!=null&& !_0xa1dex22){_0xa1dex1f=null};if(_0xa1dex1d&&_0xa1dex1e[_0xdb7c[209]]()&&_0xa1dex1e[_0xdb7c[210]](_0xa1dex1f,_0xa1dex8,_0xa1dex4)){_0xa1dex1e[_0xdb7c[211]](_0xa1dex1f,_0xa1dex8,null,_0xa1dex20,_0xa1dex21);_0xa1dex23=_0xa1dex8}else {if(_0xa1dex8[_0xdb7c[136]]>0){_0xa1dex23=_0xa1dex1e[_0xdb7c[212]](_0xa1dex8,_0xa1dex20,_0xa1dex21,_0xa1dex1f)}};if(_0xa1dex23!=null&&_0xa1dex23[_0xdb7c[136]]>0){_0xa1dex1e[_0xdb7c[213]](_0xa1dex23[0]);_0xa1dex1e[_0xdb7c[214]](_0xa1dex23)}}}}};Sidebar[_0xdb7c[40]][_0xdb7c[215]]=function(_0xa1dexd,_0xa1dexe){var _0xa1dex7=document[_0xdb7c[7]](_0xdb7c[6]);_0xa1dex7[_0xdb7c[17]][_0xdb7c[216]]=_0xdb7c[217];_0xa1dex7[_0xdb7c[17]][_0xdb7c[121]]=_0xa1dexd+_0xdb7c[135];_0xa1dex7[_0xdb7c[17]][_0xdb7c[123]]=_0xa1dexe+_0xdb7c[135];return _0xa1dex7};Sidebar[_0xdb7c[40]][_0xdb7c[218]]=function(_0xa1dex7,_0xa1dex24,_0xa1dex25){var _0xa1dex26=mxUtils[_0xdb7c[220]](_0xa1dex7,this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]],_0xa1dex24,_0xa1dex25,0,0,this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]][_0xdb7c[219]],true,true);_0xa1dex26[_0xdb7c[221]]=function(_0xa1dex1e,_0xa1dex20,_0xa1dex21){var _0xa1dex1f=mxDragSource[_0xdb7c[40]][_0xdb7c[221]][_0xdb7c[222]](this,arguments);if(!_0xa1dex1e[_0xdb7c[223]](_0xa1dex1f)){_0xa1dex1f=null};return _0xa1dex1f};return _0xa1dex26};Sidebar[_0xdb7c[40]][_0xdb7c[224]]=function(_0xa1dex7,_0xa1dex27){var _0xa1dex1e=this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]];var _0xa1dex28=null;mxEvent[_0xdb7c[227]](_0xa1dex7,function(_0xa1dex4){_0xa1dex28= new mxPoint(mxEvent[_0xdb7c[225]](_0xa1dex4),mxEvent[_0xdb7c[226]](_0xa1dex4))});var _0xa1dex29=_0xa1dex27[_0xdb7c[228]];_0xa1dex27[_0xdb7c[228]]=function(_0xa1dex4){if(!mxEvent[_0xdb7c[229]](_0xa1dex4)&&this[_0xdb7c[230]]==null&&_0xa1dex28!=null){var _0xa1dex2a=_0xa1dex1e[_0xdb7c[231]];if(Math[_0xdb7c[232]](_0xa1dex28[_0xdb7c[153]]-mxEvent[_0xdb7c[225]](_0xa1dex4))<=_0xa1dex2a&&Math[_0xdb7c[232]](_0xa1dex28[_0xdb7c[155]]-mxEvent[_0xdb7c[226]](_0xa1dex4))<=_0xa1dex2a){var _0xa1dex2b=_0xa1dex1e[_0xdb7c[233]]();_0xa1dex27[_0xdb7c[234]](_0xa1dex1e,_0xa1dex4,null,_0xa1dex2b,_0xa1dex2b)}};_0xa1dex29[_0xdb7c[222]](this,arguments);_0xa1dex28=null}};Sidebar[_0xdb7c[40]][_0xdb7c[235]]=function(_0xa1dex2c,_0xa1dex14,_0xa1dex2d,_0xa1dex2e){var _0xa1dex2f=mxUtils[_0xdb7c[235]]();var _0xa1dex19=_0xa1dex2f[_0xdb7c[7]](_0xa1dex2c);_0xa1dex19[_0xdb7c[165]](_0xdb7c[236],_0xa1dex14);_0xa1dex2d[_0xdb7c[237]](function(_0xa1dex30,_0xa1dex31){_0xa1dex19[_0xdb7c[165]](_0xa1dex30,_0xa1dex2e[_0xa1dex31]?_0xa1dex2e[_0xa1dex31]:_0xdb7c[147])});return _0xa1dex19};Sidebar[_0xdb7c[40]][_0xdb7c[238]]=function(_0xa1dex32,_0xa1dexd,_0xa1dexe,_0xa1dex33,_0xa1dex9,_0xa1dexa){var _0xa1dex2d=[];var _0xa1dex2e=[];switch(_0xa1dex33){case _0xdb7c[52]:break;case _0xdb7c[77]:_0xa1dex2d=[_0xdb7c[239],_0xdb7c[129],_0xdb7c[240]];_0xa1dex2e=[_0xdb7c[147],0,_0xdb7c[241]];break;case _0xdb7c[62]:_0xa1dex2d=[_0xdb7c[242],_0xdb7c[243]];_0xa1dex2e=[_0xdb7c[244]];break;case _0xdb7c[249]:_0xa1dex2d=[_0xdb7c[242],_0xdb7c[245],_0xdb7c[246]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[247],_0xdb7c[248]];break;case _0xdb7c[64]:_0xa1dex2d=[_0xdb7c[242],_0xdb7c[245],_0xdb7c[246],_0xdb7c[250],_0xdb7c[251]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[247],_0xdb7c[248],_0xdb7c[248],_0xdb7c[244]];break;case _0xdb7c[70]:_0xa1dex2d=[_0xdb7c[242],_0xdb7c[245],_0xdb7c[252],_0xdb7c[253],_0xdb7c[250],_0xdb7c[251]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[247],_0xdb7c[248],_0xdb7c[254],_0xdb7c[248],_0xdb7c[244]];break;case _0xdb7c[93]:_0xa1dex2d=[_0xdb7c[255],_0xdb7c[256]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[147]];break;case _0xdb7c[60]:_0xa1dex2d=[_0xdb7c[251],_0xdb7c[257]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[147]];break;case _0xdb7c[76]:_0xa1dex2d=[_0xdb7c[258],_0xdb7c[259],_0xdb7c[251]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[147],_0xdb7c[244]];break;case _0xdb7c[89]:_0xa1dex2d=[_0xdb7c[260]];_0xa1dex2e=[];break;case _0xdb7c[80]:_0xa1dex2d=[_0xdb7c[261],_0xdb7c[262]];_0xa1dex2e=[];break;case _0xdb7c[90]:_0xa1dex2d=[_0xdb7c[251],_0xdb7c[263]];_0xa1dex2e=[];break;case _0xdb7c[91]:_0xa1dex2d=[_0xdb7c[264],_0xdb7c[263]];_0xa1dex2e=[];break;case _0xdb7c[81]:_0xa1dex2d=[_0xdb7c[265]];_0xa1dex2e=[];break;case _0xdb7c[82]:_0xa1dex2d=[_0xdb7c[266]];_0xa1dex2e=[_0xdb7c[244]];break;case _0xdb7c[267]:_0xa1dex2d=[_0xdb7c[266]];_0xa1dex2e=[_0xdb7c[244]];break;case _0xdb7c[83]:_0xa1dex2d=[_0xdb7c[251]];_0xa1dex2e=[_0xdb7c[244]];break;case _0xdb7c[65]:_0xa1dex2d=[_0xdb7c[268],_0xdb7c[269]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[270]];break;case _0xdb7c[66]:_0xa1dex2d=[_0xdb7c[271],_0xdb7c[269]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[270]];break;case _0xdb7c[67]:_0xa1dex2d=[_0xdb7c[272],_0xdb7c[269]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[270]];break;case _0xdb7c[73]:_0xa1dex2d=[_0xdb7c[273],_0xdb7c[274],_0xdb7c[269]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[275],_0xdb7c[270]];break;case _0xdb7c[54]:_0xa1dex2d=[_0xdb7c[276],_0xdb7c[274],_0xdb7c[93],_0xdb7c[277]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[278]];break;case _0xdb7c[55]:_0xa1dex2d=[_0xdb7c[279],_0xdb7c[280],_0xdb7c[274],_0xdb7c[243],_0xdb7c[277]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[244],_0xdb7c[278]];break;case _0xdb7c[68]:_0xa1dex2d=[_0xdb7c[272],_0xdb7c[281]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[282]];break;case _0xdb7c[69]:_0xa1dex2d=[_0xdb7c[272],_0xdb7c[239],_0xdb7c[283]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[147],_0xdb7c[284]];break;case _0xdb7c[56]:_0xa1dex2d=[_0xdb7c[285],_0xdb7c[243],_0xdb7c[277],_0xdb7c[242],_0xdb7c[274],_0xdb7c[91],_0xdb7c[286],_0xdb7c[287],_0xdb7c[19]];_0xa1dex2e=[_0xdb7c[275],_0xdb7c[147],_0xdb7c[147],_0xdb7c[244],_0xdb7c[288]];break;case _0xdb7c[57]:_0xa1dex2d=[_0xdb7c[289],_0xdb7c[256]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[147]];break;case _0xdb7c[92]:_0xa1dex2d=[_0xdb7c[290]];_0xa1dex2e=[_0xdb7c[244]];break;case _0xdb7c[61]:_0xa1dex2d=[_0xdb7c[291],_0xdb7c[251]];_0xa1dex2e=[_0xdb7c[147],_0xdb7c[244]];break;case _0xdb7c[300]:_0xa1dex2d=[_0xdb7c[292],_0xdb7c[293],_0xdb7c[294],_0xdb7c[295],_0xdb7c[296],_0xdb7c[297],_0xdb7c[298],_0xdb7c[299]];_0xa1dex2e=[];break;case _0xdb7c[86]:_0xa1dex2d=[_0xdb7c[301]];_0xa1dex2e=[];break;case _0xdb7c[304]:_0xa1dex2d=[_0xdb7c[302]];_0xa1dex2e=[_0xdb7c[244],_0xdb7c[303]];break;default:_0xa1dex2d=[];_0xa1dex2e=[];break};var _0xa1dex19=this[_0xdb7c[235]](_0xa1dex33,_0xa1dex9,_0xa1dex2d,_0xa1dex2e);var _0xa1dex8=[ new mxCell(_0xa1dex19, new mxGeometry(0,0,_0xa1dexd,_0xa1dexe),_0xa1dex32)];_0xa1dex8[0][_0xdb7c[305]]=true;return this[_0xdb7c[306]](_0xa1dex8,_0xa1dexd,_0xa1dexe,_0xa1dex9,_0xa1dexa)};Sidebar[_0xdb7c[40]][_0xdb7c[306]]=function(_0xa1dex8,_0xa1dexd,_0xa1dexe,_0xa1dex9,_0xa1dexa){var _0xa1dex7=this[_0xdb7c[200]](_0xa1dex8,_0xa1dex9,_0xa1dexa);var _0xa1dex27=this[_0xdb7c[218]](_0xa1dex7,this[_0xdb7c[205]](_0xa1dex8,true),this[_0xdb7c[215]](_0xa1dexd,_0xa1dexe));this[_0xdb7c[224]](_0xa1dex7,_0xa1dex27);_0xa1dex27[_0xdb7c[307]]=mxUtils[_0xdb7c[25]](this,function(){return this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]][_0xdb7c[309]][_0xdb7c[308]]});if(!touchStyle){mxEvent[_0xdb7c[26]](_0xa1dex7,_0xdb7c[30],mxUtils[_0xdb7c[25]](this,function(_0xa1dex4){this[_0xdb7c[107]](_0xa1dex7,_0xa1dex8,_0xa1dex9,_0xa1dexa)}))};return _0xa1dex7};Sidebar[_0xdb7c[40]][_0xdb7c[310]]=function(_0xa1dex32,_0xa1dexd,_0xa1dexe,_0xa1dex33,_0xa1dex9,_0xa1dexa){var _0xa1dex8=[ new mxCell((_0xa1dex33!=null)?_0xa1dex33:_0xdb7c[147], new mxGeometry(0,0,_0xa1dexd,_0xa1dexe),_0xa1dex32)];_0xa1dex8[0][_0xdb7c[312]][_0xdb7c[311]]( new mxPoint(0,_0xa1dexe),true);_0xa1dex8[0][_0xdb7c[312]][_0xdb7c[311]]( new mxPoint(_0xa1dexd,0),false);_0xa1dex8[0][_0xdb7c[312]][_0xdb7c[118]]=true;_0xa1dex8[0][_0xdb7c[313]]=true;return this[_0xdb7c[314]](_0xa1dex8,_0xa1dexd,_0xa1dexe,_0xa1dex9,_0xa1dexa)};Sidebar[_0xdb7c[40]][_0xdb7c[314]]=function(_0xa1dex8,_0xa1dexd,_0xa1dexe,_0xa1dex9,_0xa1dexa){var _0xa1dex7=this[_0xdb7c[200]](_0xa1dex8,_0xa1dex9,_0xa1dexa);this[_0xdb7c[218]](_0xa1dex7,this[_0xdb7c[205]](_0xa1dex8,false),this[_0xdb7c[215]](_0xa1dexd,_0xa1dexe));var _0xa1dex1e=this[_0xdb7c[1]][_0xdb7c[9]][_0xdb7c[5]];mxEvent[_0xdb7c[26]](_0xa1dex7,_0xdb7c[203],mxUtils[_0xdb7c[25]](this,function(_0xa1dex4){if(this[_0xdb7c[98]]){_0xa1dex1e[_0xdb7c[315]](_0xa1dex8[0])};_0xa1dex7[_0xdb7c[17]][_0xdb7c[316]]=_0xdb7c[317];window[_0xdb7c[171]](function(){_0xa1dex7[_0xdb7c[17]][_0xdb7c[316]]=_0xdb7c[147]},300);mxEvent[_0xdb7c[204]](_0xa1dex4)}));if(!touchStyle){mxEvent[_0xdb7c[26]](_0xa1dex7,_0xdb7c[30],mxUtils[_0xdb7c[25]](this,function(_0xa1dex4){this[_0xdb7c[107]](_0xa1dex7,_0xa1dex8,_0xa1dex9,_0xa1dexa)}))};return _0xa1dex7};Sidebar[_0xdb7c[40]][_0xdb7c[318]]=function(_0xa1dex34,_0xa1dex9,_0xa1dex35,_0xa1dex36){var _0xa1dex7=this[_0xdb7c[172]](_0xa1dex9);this[_0xdb7c[2]][_0xdb7c[21]](_0xa1dex7);var _0xa1dex1c=document[_0xdb7c[7]](_0xdb7c[6]);_0xa1dex1c[_0xdb7c[111]]=_0xdb7c[319];if(_0xa1dex35){_0xa1dex36(_0xa1dex1c);_0xa1dex36=null}else {_0xa1dex1c[_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[152]};this[_0xdb7c[320]](_0xa1dex7,_0xa1dex1c,_0xa1dex36);var _0xa1dex37=document[_0xdb7c[7]](_0xdb7c[6]);_0xa1dex37[_0xdb7c[21]](_0xa1dex1c);this[_0xdb7c[2]][_0xdb7c[21]](_0xa1dex37);if(_0xa1dex34!=null){this[_0xdb7c[3]][_0xa1dex34]=[_0xa1dex7,_0xa1dex37]}};Sidebar[_0xdb7c[40]][_0xdb7c[320]]=function(_0xa1dex9,_0xa1dex38,_0xa1dex39){var _0xa1dex3a=false;_0xa1dex9[_0xdb7c[17]][_0xdb7c[188]]=(_0xa1dex38[_0xdb7c[17]][_0xdb7c[125]]==_0xdb7c[152])?_0xdb7c[189]+IMAGE_PATH+_0xdb7c[321]:_0xdb7c[189]+IMAGE_PATH+_0xdb7c[322];_0xa1dex9[_0xdb7c[17]][_0xdb7c[323]]=_0xdb7c[324];_0xa1dex9[_0xdb7c[17]][_0xdb7c[325]]=_0xdb7c[326];mxEvent[_0xdb7c[26]](_0xa1dex9,_0xdb7c[203],function(_0xa1dex4){if(_0xa1dex38[_0xdb7c[17]][_0xdb7c[125]]==_0xdb7c[152]){if(!_0xa1dex3a){_0xa1dex3a=true;if(_0xa1dex39!=null){_0xa1dex9[_0xdb7c[17]][_0xdb7c[191]]=_0xdb7c[327];window[_0xdb7c[171]](function(){_0xa1dex39(_0xa1dex38);_0xa1dex9[_0xdb7c[17]][_0xdb7c[191]]=_0xdb7c[147]},0)}};_0xa1dex9[_0xdb7c[17]][_0xdb7c[188]]=_0xdb7c[189]+IMAGE_PATH+_0xdb7c[322];_0xa1dex38[_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[126]}else {_0xa1dex9[_0xdb7c[17]][_0xdb7c[188]]=_0xdb7c[189]+IMAGE_PATH+_0xdb7c[321];_0xa1dex38[_0xdb7c[17]][_0xdb7c[125]]=_0xdb7c[152]};mxEvent[_0xdb7c[204]](_0xa1dex4)})};Sidebar[_0xdb7c[40]][_0xdb7c[328]]=function(_0xa1dex34){var _0xa1dex3b=this[_0xdb7c[3]][_0xa1dex34];if(_0xa1dex3b!=null){this[_0xdb7c[3]][_0xa1dex34]=null;for(var _0xa1dex3c=0;_0xa1dex3c<_0xa1dex3b[_0xdb7c[136]];_0xa1dex3c++){this[_0xdb7c[2]][_0xdb7c[329]](_0xa1dex3b[_0xa1dex3c])};return true};return false};Sidebar[_0xdb7c[40]][_0xdb7c[49]]=function(_0xa1dex34,_0xa1dex9,_0xa1dex3d,_0xa1dex3e,_0xa1dex3f,_0xa1dex40){this[_0xdb7c[318]](_0xa1dex34,_0xa1dex9,(_0xa1dex34===_0xdb7c[42]),mxUtils[_0xdb7c[25]](this,function(_0xa1dex38){var _0xa1dex41=_0xa1dex40!=null;for(var _0xa1dex3c=0;_0xa1dex3c<_0xa1dex3f[_0xdb7c[136]];_0xa1dex3c++){var _0xa1dex42=_0xa1dex3d+_0xa1dex3f[_0xa1dex3c]+_0xa1dex3e;_0xa1dex38[_0xdb7c[21]](this[_0xdb7c[238]](_0xdb7c[330]+_0xa1dex42,80,80,_0xa1dex3f[_0xa1dex3c],(_0xa1dex41)?_0xa1dex40[_0xa1dex3c]:null,_0xa1dex41))}}))} \ No newline at end of file +'use strict'; + +/** + * Construcs a new sidebar for the given editor. + */ +function Sidebar(editorUi, container) { + this.editorUi = editorUi; + this.container = container; + this.palettes = new Object(); + this.showTooltips = true; + this.graph = new Graph(document.createElement('div'), null, null, this.editorUi + .editor.graph.getStylesheet()); + this.graph.resetViewOnRootChange = false; + this.graph.foldingEnabled = false; + this.graph.setConnectable(false); + this.graph.autoScroll = false; + this.graph.setTooltips(false); + this.graph.setEnabled(false); + + // Container must be in the DOM for correct HTML rendering + this.graph.container.style.visibility = 'hidden'; + this.graph.container.style.position = 'absolute'; + document.body.appendChild(this.graph.container); + + if (!mxClient.IS_TOUCH) { + mxEvent.addListener(document, 'mouseup', mxUtils.bind(this, function() { + this.showTooltips = true; + })); + + // Enables tooltips after scroll + mxEvent.addListener(container, 'scroll', mxUtils.bind(this, function() { + this.showTooltips = true; + })); + + mxEvent.addListener(document, 'mousedown', mxUtils.bind(this, function() { + this.showTooltips = false; + this.hideTooltip(); + })); + + mxEvent.addListener(document, 'mousemove', mxUtils.bind(this, function(evt) { + var src = mxEvent.getSource(evt); + + while (src != null) { + if (src == this.currentElt) { + return; + } + + src = src.parentNode; + } + + this.hideTooltip(); + })); + + // Handles mouse leaving the window + mxEvent.addListener(document, 'mouseout', mxUtils.bind(this, function(evt) { + if (evt.toElement == null && evt.relatedTarget == null) { + this.hideTooltip(); + } + })); + } + + this.init(); + + // Pre-fetches tooltip image + new Image().src = IMAGE_PATH + '/tooltip.png'; +}; + +/** + * Adds all palettes to the sidebar. + */ +Sidebar.prototype.init = function() { + var dir = STENCIL_PATH; + console.log(dir); + + this.addImagePalette('entry', mxResources.get('entry'), dir + '/entry/', + '_128x128.png', ['start', 'finally', 'end'], [mxResources.get('start'), + mxResources.get('finally'), mxResources.get('end') + ]); + this.addImagePalette('call_management', mxResources.get('call_management'), + dir + '/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('variable', mxResources.get('variable'), dir + + '/variable/', '_128x128.png', ['set', 'math'], [mxResources.get('set'), + mxResources.get('math') + ]); + this.addImagePalette('playback', mxResources.get('playback'), dir + + '/playback/', '_128x128.png', ['playback', 'menu', + 'saydigits', 'saynumber', 'sayphonetic', 'tts', 'ispeechtts', 'getdigits' + ], [mxResources.get('playback'), mxResources + .get('menu'), mxResources.get('saydigits'), mxResources.get('saynumber'), + mxResources.get('sayphonetic'), mxResources.get('tts'), mxResources.get('ispeechtts'), mxResources.get('getdigits') + ]); + this.addImagePalette('recording', mxResources.get('recording'), dir + + '/recording/', '_128x128.png', ['record'], [mxResources.get('record')]); + this.addImagePalette('integrationServer', mxResources.get('integrationServer'), + dir + '/integration_server/', '_128x128.png', ['database', 'ispeechasr'], [ + mxResources.get('database'), mxResources.get('ispeechasr') + ]); + this.addImagePalette('callflow', mxResources.get('callflow'), dir + + '/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'), dir + '/stats/', + '_128x128.png', [ + // 'queuelog', + 'goal' + ], [ + // mxResources.get('queuelog'), + mxResources.get('goal') + ]); + this.addImagePalette('general', mxResources.get('general'), dir + '/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')]); + +}; + +/** + * Specifies if tooltips should be visible. Default is true. + */ +Sidebar.prototype.enableTooltips = !mxClient.IS_TOUCH; + +/** + * Specifies the delay for the tooltip. Default is 16 px. + */ +Sidebar.prototype.tooltipBorder = 16; + +/** + * Specifies the delay for the tooltip. Default is 3 px. + */ +Sidebar.prototype.thumbBorder = 3; + +/** + * Specifies the delay for the tooltip. Default is 300 ms. + */ +Sidebar.prototype.tooltipDelay = 300; + +/** + * Specifies if edges should be used as templates if clicked. Default is true. + */ +Sidebar.prototype.installEdges = true; + +/** + * Specifies the URL of the gear image. + */ +Sidebar.prototype.gearImage = STENCIL_PATH + '/clipart/Gear_128x128.png'; + +/** + * Specifies the width of the thumbnails. + */ +Sidebar.prototype.thumbWidth = 34; + +/** + * Specifies the height of the thumbnails. + */ +Sidebar.prototype.thumbHeight = 34; + +/** + * Specifies the padding for the thumbnails. Default is 3. + */ +Sidebar.prototype.thumbPadding = 2; + +/** + * Specifies the size of the sidebar titles. + */ +Sidebar.prototype.sidebarTitleSize = 9; + +/** + * Specifies if titles in the sidebar should be enabled. + */ +Sidebar.prototype.sidebarTitles = false; + +/** + * Specifies if titles in the tooltips should be enabled. + */ +Sidebar.prototype.tooltipTitles = false; + +/** + * Adds all palettes to the sidebar. + */ +Sidebar.prototype.showTooltip = function(elt, cells, title, showLabel) { + if (this.enableTooltips && this.showTooltips) { + if (this.currentElt != elt) { + if (this.thread != null) { + window.clearTimeout(this.thread); + this.thread = null; + } + + var show = mxUtils.bind(this, function() { + // Lazy creation of the DOM nodes and graph instance + if (this.tooltip == null) { + this.tooltip = document.createElement('div'); + this.tooltip.className = 'geSidebarTooltip'; + document.body.appendChild(this.tooltip); + + this.graph2 = new Graph(this.tooltip, null, null, this.editorUi.editor.graph + .getStylesheet()); + this.graph2.view.setTranslate(this.tooltipBorder, this.tooltipBorder); + this.graph2.resetViewOnRootChange = false; + this.graph2.foldingEnabled = false; + this.graph2.autoScroll = false; + this.graph2.setTooltips(false); + this.graph2.setConnectable(false); + this.graph2.setEnabled(false); + + if (!mxClient.IS_SVG) { + this.graph2.view.canvas.style.position = 'relative'; + } + + this.tooltipImage = mxUtils.createImage(IMAGE_PATH + '/tooltip.png'); + this.tooltipImage.style.position = 'absolute'; + this.tooltipImage.style.width = '14px'; + this.tooltipImage.style.height = '27px'; + + document.body.appendChild(this.tooltipImage); + } + + this.tooltip.style.display = 'block'; + this.graph2.labelsVisible = (showLabel == null || showLabel); + this.graph2.model.clear(); + this.graph2.addCells(cells); + + var bounds = this.graph2.getGraphBounds(); + var width = bounds.width + 2 * this.tooltipBorder; + var height = bounds.height + 2 * this.tooltipBorder; + + if (mxClient.IS_QUIRKS) { + width += 4; + height += 4; + this.tooltip.style.overflow = 'hidden'; + } else { + this.tooltip.style.overflow = 'visible'; + } + + this.tooltipImage.style.visibility = 'visible'; + this.tooltip.style.width = width + 'px'; + + // Adds title for entry + if (this.tooltipTitles && title != null && title.length > 0) { + if (this.tooltipTitle == null) { + this.tooltipTitle = document.createElement('div'); + this.tooltipTitle.style.borderTop = '1px solid gray'; + this.tooltipTitle.style.textAlign = 'center'; + this.tooltipTitle.style.width = '100%'; + + // Oversize titles are cut-off currently. Should make tooltip wider later. + this.tooltipTitle.style.overflow = 'hidden'; + + if (mxClient.IS_SVG) { + this.tooltipTitle.style.paddingTop = '2px'; + } else { + this.tooltipTitle.style.position = 'absolute'; + this.tooltipTitle.style.paddingTop = '6px'; + } + + this.tooltip.appendChild(this.tooltipTitle); + } else { + this.tooltipTitle.innerHTML = ''; + } + + this.tooltipTitle.style.display = ''; + mxUtils.write(this.tooltipTitle, title); + + var dy = this.tooltipTitle.offsetHeight + 10; + height += dy; + + if (mxClient.IS_SVG) { + this.tooltipTitle.style.marginTop = (-dy) + 'px'; + } else { + height -= 6; + this.tooltipTitle.style.top = (height - dy) + 'px'; + } + } else if (this.tooltipTitle != null && this.tooltipTitle.parentNode != + null) { + this.tooltipTitle.style.display = 'none'; + } + + this.tooltip.style.height = height + 'px'; + var x0 = -Math.min(0, bounds.x - this.tooltipBorder); + var y0 = -Math.min(0, bounds.y - this.tooltipBorder); + + var left = this.container.clientWidth + this.editorUi.splitSize + 3; + var top = Math.max(0, (this.container.offsetTop + elt.offsetTop - this.container + .scrollTop - height / 2 + 16)); + + if (mxClient.IS_SVG) { + this.graph2.view.canvas.setAttribute('transform', 'translate(' + x0 + + ',' + y0 + ')'); + } else { + this.graph2.view.drawPane.style.left = x0 + 'px'; + this.graph2.view.drawPane.style.top = y0 + 'px'; + } + + // Workaround for ignored position CSS style in IE9 + // (changes to relative without the following line) + // Added width of the page-sidebar + left += document.getElementById('page-sidebar').offsetWidth; + // Added static height of the page-navbar + top += 90; + + this.tooltip.style.position = 'absolute'; + this.tooltip.style.left = left + 'px'; + this.tooltip.style.top = top + 'px'; + this.tooltipImage.style.left = (left - 13) + 'px'; + this.tooltipImage.style.top = (top + height / 2 - 13) + 'px'; + }); + + if (this.tooltip != null && this.tooltip.style.display != 'none') { + show(); + } else { + this.thread = window.setTimeout(show, this.tooltipDelay); + } + + this.currentElt = elt; + } + } +}; + +/** + * Hides the current tooltip. + */ +Sidebar.prototype.hideTooltip = function() { + if (this.thread != null) { + window.clearTimeout(this.thread); + this.thread = null; + } + + if (this.tooltip != null) { + this.tooltip.style.display = 'none'; + this.tooltipImage.style.visibility = 'hidden'; + this.currentElt = null; + } +}; + +/** + * Creates and returns the given title element. + */ +Sidebar.prototype.createTitle = function(label) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geTitle'; + mxUtils.write(elt, label); + + return elt; +}; + +/** + * Creates a thumbnail for the given cells. + */ +Sidebar.prototype.createThumb = function(cells, width, height, parent, title, + showLabel) { + this.graph.labelsVisible = (showLabel == null || showLabel); + this.graph.view.scaleAndTranslate(1, 0, 0); + this.graph.addCells(cells); + var bounds = this.graph.getGraphBounds(); + var corr = this.thumbBorder; + var s = Math.min((width - 2) / (bounds.width - bounds.x + corr), (height - 2) / + (bounds.height - bounds.y + corr)); + var x0 = -Math.min(bounds.x, 0); + var y0 = -Math.min(bounds.y, 0); + this.graph.view.scaleAndTranslate(s, x0, y0); + + bounds = this.graph.getGraphBounds(); + var dx = Math.max(0, Math.floor((width - bounds.width - bounds.x) / 2)); + var dy = Math.max(0, Math.floor((height - bounds.height - bounds.y) / 2)); + + var node = null; + + // For supporting HTML labels in IE9 standards mode the container is cloned instead + if (this.graph.dialect == mxConstants.DIALECT_SVG && !mxClient.NO_FO) { + node = this.graph.view.getCanvas().ownerSVGElement.cloneNode(true); + } + // LATER: Check if deep clone can be used for quirks if container in DOM + else { + node = this.graph.container.cloneNode(false); + node.innerHTML = this.graph.container.innerHTML; + } + + this.graph.getModel().clear(); + + // Catch-all event handling + if (mxClient.IS_IE6) { + parent.style.backgroundImage = 'url(' + this.editorUi.editor.transparentImage + + ')'; + } + + var dd = 3; + node.style.position = 'relative'; + node.style.overflow = 'hidden'; + node.style.cursor = 'pointer'; + node.style.left = (dx + dd) + 'px'; + node.style.top = (dy + dd) + 'px'; + node.style.width = width + 'px'; + node.style.height = height + 'px'; + node.style.visibility = ''; + node.style.minWidth = ''; + node.style.minHeight = ''; + + parent.appendChild(node); + + // Adds title for sidebar entries + if (this.sidebarTitles && title != null) { + var border = (mxClient.IS_QUIRKS) ? 2 * this.thumbPadding + 2 : 0; + parent.style.height = (this.thumbHeight + border + this.sidebarTitleSize + 8) + + 'px'; + + var div = document.createElement('div'); + div.style.fontSize = this.sidebarTitleSize + 'px'; + div.style.textAlign = 'center'; + div.style.whiteSpace = 'nowrap'; + + if (mxClient.IS_IE) { + div.style.height = (this.sidebarTitleSize + 12) + 'px'; + } + + div.style.paddingTop = '4px'; + mxUtils.write(div, title); + parent.appendChild(div); + } +}; + +/** + * Creates and returns a new palette item for the given image. + */ +Sidebar.prototype.createItem = function(cells, title, showLabel) { + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geItem'; + elt.style.overflow = 'hidden'; + var border = (mxClient.IS_QUIRKS) ? 8 + 2 * this.thumbPadding : 6; + elt.style.width = (this.thumbWidth + border) + 'px'; + elt.style.height = (this.thumbHeight + border) + 'px'; + elt.style.padding = this.thumbPadding + 'px'; + + // Blocks default click action + mxEvent.addListener(elt, 'click', function(evt) { + mxEvent.consume(evt); + }); + + this.createThumb(cells, this.thumbWidth, this.thumbHeight, elt, title, + showLabel); + + return elt; +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createDropHandler = function(cells, allowSplit) { + return function(graph, evt, target, x, y) { + if (graph.isEnabled()) { + cells = graph.getImportableCells(cells); + + if (cells.length > 0) { + var validDropTarget = (target != null) ? + graph.isValidDropTarget(target, cells, evt) : false; + var select = null; + + if (target != null && !validDropTarget) { + target = null; + } + + // Splits the target edge or inserts into target group + if (allowSplit && graph.isSplitEnabled() && graph.isSplitTarget(target, + cells, evt)) { + graph.splitEdge(target, cells, null, x, y); + select = cells; + } else if (cells.length > 0) { + select = graph.importCells(cells, x, y, target); + } + + if (select != null && select.length > 0) { + graph.scrollCellToVisible(select[0]); + graph.setSelectionCells(select); + } + } + } + }; +}; + +/** + * Creates and returns a preview element for the given width and height. + */ +Sidebar.prototype.createDragPreview = function(width, height) { + var elt = document.createElement('div'); + elt.style.border = '1px dashed black'; + elt.style.width = width + 'px'; + elt.style.height = height + 'px'; + + return elt; +}; + +/** + * Creates a drag source for the given element. + */ +Sidebar.prototype.createDragSource = function(elt, dropHandler, preview) { + var dragSource = mxUtils.makeDraggable(elt, this.editorUi.editor.graph, + dropHandler, + preview, 0, 0, this.editorUi.editor.graph.autoscroll, true, true); + + // Allows drop into cell only if target is a valid root + dragSource.getDropTarget = function(graph, x, y) { + var target = mxDragSource.prototype.getDropTarget.apply(this, arguments); + + if (!graph.isValidRoot(target)) { + target = null; + } + + return target; + }; + + return dragSource; +}; + +/** + * Adds a handler for inserting the cell with a single click. + */ +Sidebar.prototype.addClickHandler = function(elt, ds) { + var graph = this.editorUi.editor.graph; + var first = null; + + mxEvent.addGestureListeners(elt, function(evt) { + first = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)); + }); + + var oldMouseUp = ds.mouseUp; + ds.mouseUp = function(evt) { + if (!mxEvent.isPopupTrigger(evt) && this.currentGraph == null && first != + null) { + var tol = graph.tolerance; + + if (Math.abs(first.x - mxEvent.getClientX(evt)) <= tol && + Math.abs(first.y - mxEvent.getClientY(evt)) <= tol) { + var gs = graph.getGridSize(); + ds.drop(graph, evt, null, gs, gs); + } + } + + oldMouseUp.apply(this, arguments); + first = null; + }; +}; + +/** + * Giuseppe Careri + * Create xml document vertex + */ +Sidebar.prototype.createXmlDocument = function(element, label, variables, + values) { + var doc = mxUtils.createXmlDocument(); + var node = doc.createElement(element) + node.setAttribute('label', label); + + variables.forEach(function(variable, index) { + node.setAttribute(variable, values[index] ? values[index] : ''); + }); + + return node; +} + +/** + * Giuseppe Careri + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createVertexTemplate = function(style, width, height, value, + title, showLabel) { + var variables = []; + var values = []; + + switch (value) { + case 'answer': + break; + case 'ispeechasr': + variables = ['key', 'model', 'ispeech_asr_language']; + values = ['', 0, 'it-IT']; + break; + case 'playback': + variables = ['file_id', 'opts']; + values = ['0']; + break; + case 'background': + variables = ['file_id', 'response', 'digit']; + values = ['0', '5', '1']; + break; + case 'menu': + variables = ['file_id', 'response', 'digit', 'retry', 'variable_id']; + values = ['0', '5', '1', '1', '0']; + break; + case 'getdigits': + variables = ['file_id', 'response', 'mindigit', 'maxdigit', 'retry', 'variable_id']; + values = ['0', '5', '1', '10', '1', '0']; + break; + case 'custom_app': + variables = ['application', 'options']; + values = ['', '']; + break; + case 'set': + variables = ['variable_id', 'variable_value']; + values = ['0', '']; + break; + case 'database': + variables = ['odbc_id', 'query', 'variable_id']; + values = ['0', '', '0']; + break; + case 'noop': + variables = ['output']; + values = []; + break; + case 'gotoc': + variables = ['context', 'extension']; + values = []; + break; + case 'system': + variables = ['variable_id', 'command']; + values = []; + break; + case 'agi': + variables = ['args', 'command']; + values = []; + break; + case 'gotoif': + variables = ['condition']; + values = []; + break; + case 'gotoiftime': + variables = ['interval_id']; + values = ['0']; + break; + case 'gotoifmultitime': + variables = ['interval_id']; + values = ['0']; + break; + case 'vswitch': + variables = ['variable_id']; + values = ['0']; + break; + case 'saydigits': + variables = ['digits', 'escape_digits']; + values = ['', '#']; + break; + case 'saynumber': + variables = ['number', 'escape_digits']; + values = ['', '#']; + break; + case 'sayphonetic': + variables = ['text', 'escape_digits']; + values = ['', '#']; + break; + case 'record': + variables = ['file', 'timeout', 'escape_digits']; + values = ['', '-1', '#']; + break; + case 'dial': + variables = ['sip_id', 'timeout', 'custom_app', 'url']; + values = ['0', '60']; + break; + case 'ext_dial': + variables = ['phone', 'trunk_id', 'timeout', 'opts', 'url']; + values = ['', '0', '60']; + break; + case 'tts': + variables = ['text', 'google_tts_language']; + values = ['', 'it']; + break; + case 'ispeechtts': + variables = ['text', 'key', 'ispeech_tts_language']; + values = ['', '', 'euritalianfemale']; + break; + case 'queue': + variables = ['queue_id', 'opts', 'url', 'file_id', 'timeout', 'agi', + 'macro', 'gosub', 'position' + ]; + values = ['-1', '', '', '0', '300']; + break; + case 'voicemail': + variables = ['mailbox', 'options']; + values = ['', '']; + break; + case 'subproject': + variables = ['project_id']; + values = ['0']; + break; + case 'math': + variables = ['operation', 'variable_id']; + values = ['', '0']; + break; + case 'queuelog': + variables = ['queuename', 'agent', 'queue_event', 'data1', 'data2', 'data3', + 'data4', 'data5' + ]; + values = []; + break; + case 'goal': + variables = ['goalname']; + values = []; + break; + case 'callback': + variables = ['list_id']; + values = ['0', '{CALLERID(num)}']; + break; + default: + variables = []; + values = []; + break; + } + + var node = this.createXmlDocument(value, title, variables, values); + + //var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, width, height), style)]; + var cells = [new mxCell(node, new mxGeometry(0, 0, width, height), style)]; + cells[0].vertex = true; + + return this.createVertexTemplateFromCells(cells, width, height, title, + showLabel); +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createVertexTemplateFromCells = function(cells, width, height, + title, showLabel) { + var elt = this.createItem(cells, title, showLabel); + var ds = this.createDragSource(elt, this.createDropHandler(cells, true), this + .createDragPreview(width, height)); + this.addClickHandler(elt, ds); + + // Uses guides for vertices only if enabled in graph + ds.isGuidesEnabled = mxUtils.bind(this, function() { + return this.editorUi.editor.graph.graphHandler.guidesEnabled; + }); + + // Shows a tooltip with the rendered cell + if (!touchStyle) { + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + this.showTooltip(elt, cells, title, showLabel); + })); + } + + return elt; +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createEdgeTemplate = function(style, width, height, value, + title, showLabel) { + var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, + width, height), style)]; + cells[0].geometry.setTerminalPoint(new mxPoint(0, height), true); + cells[0].geometry.setTerminalPoint(new mxPoint(width, 0), false); + cells[0].geometry.relative = true; + cells[0].edge = true; + + return this.createEdgeTemplateFromCells(cells, width, height, title, + showLabel); +}; + +/** + * Creates a drop handler for inserting the given cells. + */ +Sidebar.prototype.createEdgeTemplateFromCells = function(cells, width, height, + title, showLabel) { + var elt = this.createItem(cells, title, showLabel); + this.createDragSource(elt, this.createDropHandler(cells, false), this.createDragPreview( + width, height)); + + // Installs the default edge + var graph = this.editorUi.editor.graph; + mxEvent.addListener(elt, 'click', mxUtils.bind(this, function(evt) { + if (this.installEdges) { + graph.setDefaultEdge(cells[0]); + } + + // Highlights the entry for 200ms + elt.style.backgroundColor = '#ffffff'; + + window.setTimeout(function() { + elt.style.backgroundColor = ''; + }, 300); + + mxEvent.consume(evt); + })); + + // Shows a tooltip with the rendered cell + if (!touchStyle) { + mxEvent.addListener(elt, 'mousemove', mxUtils.bind(this, function(evt) { + this.showTooltip(elt, cells, title, showLabel); + })); + } + + return elt; +}; + +/** + * Adds the given palette. + */ +Sidebar.prototype.addPalette = function(id, title, expanded, onInit) { + var elt = this.createTitle(title); + this.container.appendChild(elt); + + var div = document.createElement('div'); + div.className = 'geSidebar'; + + if (expanded) { + onInit(div); + onInit = null; + } else { + div.style.display = 'none'; + } + + this.addFoldingHandler(elt, div, onInit); + + var outer = document.createElement('div'); + outer.appendChild(div); + this.container.appendChild(outer); + + // Keeps references to the DOM nodes + if (id != null) { + this.palettes[id] = [elt, outer]; + } +}; + +/** + * Create the given title element. + */ +Sidebar.prototype.addFoldingHandler = function(title, content, funct) { + var initialized = false; + + title.style.backgroundImage = (content.style.display == 'none') ? + 'url(' + IMAGE_PATH + '/collapsed.gif)' : 'url(' + IMAGE_PATH + + '/expanded.gif)'; + title.style.backgroundRepeat = 'no-repeat'; + title.style.backgroundPosition = '100% 50%'; + + mxEvent.addListener(title, 'click', function(evt) { + if (content.style.display == 'none') { + if (!initialized) { + initialized = true; + + if (funct != null) { + title.style.cursor = 'wait'; + window.setTimeout(function() { + funct(content); + title.style.cursor = ''; + }, 0); + } + } + + title.style.backgroundImage = 'url(' + IMAGE_PATH + '/expanded.gif)'; + content.style.display = 'block'; + } else { + title.style.backgroundImage = 'url(' + IMAGE_PATH + '/collapsed.gif)'; + content.style.display = 'none'; + } + + mxEvent.consume(evt); + }); +}; + +/** + * Removes the palette for the given ID. + */ +Sidebar.prototype.removePalette = function(id) { + var elts = this.palettes[id]; + + if (elts != null) { + this.palettes[id] = null; + + for (var i = 0; i < elts.length; i++) { + this.container.removeChild(elts[i]); + } + + return true; + } + + return false; +}; + +/** + * Adds the given image palette. + */ +Sidebar.prototype.addImagePalette = function(id, title, prefix, postfix, items, + titles) { + // Giuseppe Careri + // Expanded Sidebar only entry + this.addPalette(id, title, (id === 'entry'), mxUtils.bind(this, function( + content) { + var showTitles = titles != null; + + for (var i = 0; i < items.length; i++) { + var icon = prefix + items[i] + postfix; + content.appendChild(this.createVertexTemplate('image;image=' + icon, 80, + 80, items[i], (showTitles) ? titles[i] : null, showTitles)); + } + })); +}; diff --git a/public/assets/plugins/square/js/Toolbar.js b/public/assets/plugins/square/js/Toolbar.js index 91ab96d..7eab562 100644 --- a/public/assets/plugins/square/js/Toolbar.js +++ b/public/assets/plugins/square/js/Toolbar.js @@ -1 +1,407 @@ -var _0x81d3=["\x65\x64\x69\x74\x6F\x72\x55\x69","\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x69\x6E\x69\x74","\x68\x69\x64\x65\x4D\x65\x6E\x75","\x62\x69\x6E\x64","\x61\x64\x64\x47\x65\x73\x74\x75\x72\x65\x4C\x69\x73\x74\x65\x6E\x65\x72\x73","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x73\x61\x76\x65","\x70\x75\x62\x6C\x69\x73\x68","\x2D","\x70\x72\x69\x6E\x74","\x75\x6E\x64\x6F","\x72\x65\x64\x6F","\x63\x6F\x70\x79","\x63\x75\x74","\x70\x61\x73\x74\x65","\x64\x65\x6C\x65\x74\x65","\x64\x75\x70\x6C\x69\x63\x61\x74\x65","\x61\x63\x74\x75\x61\x6C\x53\x69\x7A\x65","\x7A\x6F\x6F\x6D\x49\x6E","\x7A\x6F\x6F\x6D\x4F\x75\x74","\x61\x64\x64\x49\x74\x65\x6D\x73","\x48\x65\x6C\x76\x65\x74\x69\x63\x61","\x66\x6F\x6E\x74\x46\x61\x6D\x69\x6C\x79","\x67\x65\x74","\x61\x64\x64\x4D\x65\x6E\x75","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x73\x74\x79\x6C\x65","\x6E\x6F\x77\x72\x61\x70","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x68\x69\x64\x64\x65\x6E","\x77\x69\x64\x74\x68","\x37\x30\x70\x78","\x61\x64\x64\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x31\x32","\x66\x6F\x6E\x74\x53\x69\x7A\x65","\x33\x30\x70\x78","\x62\x6F\x6C\x64","\x69\x74\x61\x6C\x69\x63","\x75\x6E\x64\x65\x72\x6C\x69\x6E\x65","\x67\x72\x61\x70\x68","\x65\x64\x69\x74\x6F\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C","\x67\x65\x74\x53\x74\x61\x74\x65","\x67\x65\x74\x56\x69\x65\x77","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x46\x41\x4D\x49\x4C\x59","\x53\x54\x59\x4C\x45\x5F\x46\x4F\x4E\x54\x53\x49\x5A\x45","\x6C\x65\x6E\x67\x74\x68","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2E","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x61\x64\x64\x4C\x69\x73\x74\x65\x6E\x65\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x4D\x6F\x64\x65\x6C","\x67\x65\x74\x4D\x6F\x64\x65\x6C","\x63\x75\x72\x72\x65\x6E\x74\x4D\x65\x6E\x75","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x6E\x75\x73","\x66\x75\x6E\x63\x74","\x61\x64\x64\x4D\x65\x6E\x75\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x73\x74\x61\x74\x65\x43\x68\x61\x6E\x67\x65\x64","\x65\x6E\x61\x62\x6C\x65\x64","\x73\x65\x74\x45\x6E\x61\x62\x6C\x65\x64","\x63\x72\x65\x61\x74\x65\x4C\x61\x62\x65\x6C","\x63\x72\x65\x61\x74\x65\x42\x75\x74\x74\x6F\x6E","\x69\x6E\x69\x74\x45\x6C\x65\x6D\x65\x6E\x74","\x61\x64\x64\x4D\x65\x6E\x75\x48\x61\x6E\x64\x6C\x65\x72","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x63\x6C\x61\x73\x73\x4E\x61\x6D\x65","\x67\x65\x53\x65\x70\x61\x72\x61\x74\x6F\x72","\x67\x65\x53\x70\x72\x69\x74\x65\x2D","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x61\x64\x64\x49\x74\x65\x6D","\x61\x63\x74\x69\x6F\x6E\x73","\x6C\x61\x62\x65\x6C","\x61\x64\x64\x42\x75\x74\x74\x6F\x6E","\x61\x64\x64\x43\x6C\x69\x63\x6B\x48\x61\x6E\x64\x6C\x65\x72","\x61\x64\x64\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x69\x73\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x45\x6D\x70\x74\x79","\x61\x64\x64\x45\x64\x67\x65\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x48\x61\x6E\x64\x6C\x65\x72","\x67\x65\x74\x53\x65\x6C\x65\x63\x74\x69\x6F\x6E\x43\x65\x6C\x6C\x73","\x69\x73\x45\x64\x67\x65","\x74\x61\x62\x69\x6E\x64\x65\x78","\x30","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x74\x69\x74\x6C\x65","\x61\x64\x64\x45\x6E\x61\x62\x6C\x65\x64\x53\x74\x61\x74\x65","\x20\x67\x65\x44\x69\x73\x61\x62\x6C\x65\x64","\x63\x6C\x69\x63\x6B","\x63\x6F\x6E\x73\x75\x6D\x65","\x61","\x68\x72\x65\x66","\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x76\x6F\x69\x64\x28\x30\x29\x3B","\x67\x65\x42\x75\x74\x74\x6F\x6E","\x67\x65\x53\x70\x72\x69\x74\x65\x20","\x67\x65\x4C\x61\x62\x65\x6C","\x77\x72\x69\x74\x65","\x70\x61\x6E\x6E\x69\x6E\x67\x48\x61\x6E\x64\x6C\x65\x72","\x20\x67\x65\x54\x6F\x6F\x6C\x62\x61\x72\x4D\x65\x6E\x75","\x73\x68\x6F\x77\x44\x69\x73\x61\x62\x6C\x65\x64","\x6C\x61\x62\x65\x6C\x73","\x61\x75\x74\x6F\x45\x78\x70\x61\x6E\x64","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x6F\x66\x66\x73\x65\x74\x54\x6F\x70","\x6F\x66\x66\x73\x65\x74\x48\x65\x69\x67\x68\x74","\x70\x6F\x70\x75\x70"];function Toolbar(_0x315cx2,_0x315cx3){this[_0x81d3[0]]=_0x315cx2;this[_0x81d3[1]]=_0x315cx3;this[_0x81d3[2]]();mxEvent[_0x81d3[5]](document,mxUtils[_0x81d3[4]](this,function(_0x315cx4){this[_0x81d3[3]]()}))}Toolbar[_0x81d3[6]][_0x81d3[2]]=function(){this[_0x81d3[21]]([_0x81d3[7],_0x81d3[8],_0x81d3[9],_0x81d3[10],_0x81d3[11],_0x81d3[12],_0x81d3[9],_0x81d3[13],_0x81d3[14],_0x81d3[15],_0x81d3[16],_0x81d3[9],_0x81d3[17],_0x81d3[9],_0x81d3[18],_0x81d3[19],_0x81d3[20],_0x81d3[9]]);var _0x315cx5=this[_0x81d3[25]](_0x81d3[22],mxResources[_0x81d3[24]](_0x81d3[23]),true,_0x81d3[23]);_0x315cx5[_0x81d3[27]][_0x81d3[26]]=_0x81d3[28];_0x315cx5[_0x81d3[27]][_0x81d3[29]]=_0x81d3[30];_0x315cx5[_0x81d3[27]][_0x81d3[31]]=_0x81d3[32];this[_0x81d3[33]]();var _0x315cx6=this[_0x81d3[25]](_0x81d3[34],mxResources[_0x81d3[24]](_0x81d3[35]),true,_0x81d3[35]);_0x315cx6[_0x81d3[27]][_0x81d3[26]]=_0x81d3[28];_0x315cx6[_0x81d3[27]][_0x81d3[29]]=_0x81d3[30];_0x315cx6[_0x81d3[27]][_0x81d3[31]]=_0x81d3[36];this[_0x81d3[21]]([_0x81d3[9],_0x81d3[37],_0x81d3[38],_0x81d3[39]]);var _0x315cx7=this[_0x81d3[0]][_0x81d3[41]][_0x81d3[40]];var _0x315cx8=mxUtils[_0x81d3[4]](this,function(){var _0x315cx9=_0x81d3[22];var _0x315cxa=_0x81d3[34];var _0x315cxb=_0x315cx7[_0x81d3[44]]()[_0x81d3[43]](_0x315cx7[_0x81d3[42]]());if(_0x315cxb!=null){_0x315cx9=_0x315cxb[_0x81d3[27]][mxConstants[_0x81d3[45]]]||_0x315cx9;_0x315cxa=_0x315cxb[_0x81d3[27]][mxConstants[_0x81d3[46]]]||_0x315cxa;if(_0x315cx9[_0x81d3[47]]>10){_0x315cx9=_0x315cx9[_0x81d3[48]](0,8)+_0x81d3[49]};_0x315cx5[_0x81d3[50]]=_0x315cx9;_0x315cx6[_0x81d3[50]]=_0x315cxa}});_0x315cx7[_0x81d3[52]]()[_0x81d3[51]](mxEvent.CHANGE,_0x315cx8);_0x315cx7[_0x81d3[53]]()[_0x81d3[51]](mxEvent.CHANGE,_0x315cx8)};Toolbar[_0x81d3[6]][_0x81d3[3]]=function(){if(this[_0x81d3[54]]!=null){this[_0x81d3[54]][_0x81d3[3]]();this[_0x81d3[54]][_0x81d3[55]]();this[_0x81d3[54]]=null}};Toolbar[_0x81d3[6]][_0x81d3[25]]=function(_0x315cxc,_0x315cxd,_0x315cxe,_0x315cxf){var _0x315cx10=this[_0x81d3[0]][_0x81d3[56]][_0x81d3[24]](_0x315cxf);var _0x315cx11=this[_0x81d3[58]](_0x315cxc,_0x315cxd,_0x315cxe,_0x315cx10[_0x81d3[57]]);_0x315cx10[_0x81d3[51]](_0x81d3[59],function(){_0x315cx11[_0x81d3[61]](_0x315cx10[_0x81d3[60]])});return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[58]]=function(_0x315cxc,_0x315cxd,_0x315cxe,_0x315cx12){var _0x315cx11=(_0x315cxe)?this[_0x81d3[62]](_0x315cxc):this[_0x81d3[63]](_0x315cxc);this[_0x81d3[64]](_0x315cx11,_0x315cxd);this[_0x81d3[65]](_0x315cx11,_0x315cxe,_0x315cx12);this[_0x81d3[1]][_0x81d3[66]](_0x315cx11);return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[33]]=function(){var _0x315cx11=document[_0x81d3[68]](_0x81d3[67]);_0x315cx11[_0x81d3[69]]=_0x81d3[70];this[_0x81d3[1]][_0x81d3[66]](_0x315cx11);return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[21]]=function(_0x315cx13){for(var _0x315cx14=0;_0x315cx14<_0x315cx13[_0x81d3[47]];_0x315cx14++){var _0x315cx15=_0x315cx13[_0x315cx14];if(_0x315cx15==_0x81d3[9]){this[_0x81d3[33]]()}else {this[_0x81d3[73]](_0x81d3[71]+_0x315cx15[_0x81d3[72]](),_0x315cx15)}}};Toolbar[_0x81d3[6]][_0x81d3[73]]=function(_0x315cx16,_0x315cx15){var _0x315cx17=this[_0x81d3[0]][_0x81d3[74]][_0x81d3[24]](_0x315cx15);var _0x315cx11=null;if(_0x315cx17!=null){_0x315cx11=this[_0x81d3[76]](_0x315cx16,_0x315cx17[_0x81d3[75]],_0x315cx17[_0x81d3[57]]);_0x315cx11[_0x81d3[61]](_0x315cx17[_0x81d3[60]]);_0x315cx17[_0x81d3[51]](_0x81d3[59],function(){_0x315cx11[_0x81d3[61]](_0x315cx17[_0x81d3[60]])})};return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[76]]=function(_0x315cx18,_0x315cxd,_0x315cx12){var _0x315cx11=this[_0x81d3[63]](_0x315cx18);this[_0x81d3[64]](_0x315cx11,_0x315cxd);this[_0x81d3[77]](_0x315cx11,_0x315cx12);this[_0x81d3[1]][_0x81d3[66]](_0x315cx11);return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[78]]=function(_0x315cx19){var _0x315cx7=this[_0x81d3[0]][_0x81d3[41]][_0x81d3[40]];var _0x315cx1a=function(){var _0x315cx1b=!_0x315cx7[_0x81d3[79]]();for(var _0x315cx14=0;_0x315cx14<_0x315cx19[_0x81d3[47]];_0x315cx14++){_0x315cx19[_0x315cx14][_0x81d3[61]](_0x315cx1b)}};_0x315cx7[_0x81d3[52]]()[_0x81d3[51]](mxEvent.CHANGE,_0x315cx1a);_0x315cx1a()};Toolbar[_0x81d3[6]][_0x81d3[80]]=function(_0x315cx19){var _0x315cx7=this[_0x81d3[0]][_0x81d3[41]][_0x81d3[40]];var _0x315cx1a=function(){var _0x315cx1c=false;if(!_0x315cx7[_0x81d3[79]]()){var _0x315cx1d=_0x315cx7[_0x81d3[81]]();for(var _0x315cx14=0;_0x315cx14<_0x315cx1d[_0x81d3[47]];_0x315cx14++){if(_0x315cx7[_0x81d3[53]]()[_0x81d3[82]](_0x315cx1d[_0x315cx14])){_0x315cx1c=true;break}}};for(var _0x315cx14=0;_0x315cx14<_0x315cx19[_0x81d3[47]];_0x315cx14++){_0x315cx19[_0x315cx14][_0x81d3[61]](_0x315cx1c)}};_0x315cx7[_0x81d3[52]]()[_0x81d3[51]](mxEvent.CHANGE,_0x315cx1a);_0x315cx1a()};Toolbar[_0x81d3[6]][_0x81d3[64]]=function(_0x315cx11,_0x315cxd){_0x315cx11[_0x81d3[85]](_0x81d3[83],_0x81d3[84]);if(_0x315cxd!=null){_0x315cx11[_0x81d3[85]](_0x81d3[86],_0x315cxd)};this[_0x81d3[87]](_0x315cx11)};Toolbar[_0x81d3[6]][_0x81d3[87]]=function(_0x315cx11){var _0x315cx18=_0x315cx11[_0x81d3[69]];_0x315cx11[_0x81d3[61]]=function(_0x315cx1e){_0x315cx11[_0x81d3[60]]=_0x315cx1e;if(_0x315cx1e){_0x315cx11[_0x81d3[69]]=_0x315cx18}else {_0x315cx11[_0x81d3[69]]=_0x315cx18+_0x81d3[88]}};_0x315cx11[_0x81d3[61]](true)};Toolbar[_0x81d3[6]][_0x81d3[77]]=function(_0x315cx11,_0x315cx12){if(_0x315cx12!=null){mxEvent[_0x81d3[51]](_0x315cx11,_0x81d3[89],function(_0x315cx4){if(_0x315cx11[_0x81d3[60]]){_0x315cx12(_0x315cx4)};mxEvent[_0x81d3[90]](_0x315cx4)})}};Toolbar[_0x81d3[6]][_0x81d3[63]]=function(_0x315cx18){var _0x315cx11=document[_0x81d3[68]](_0x81d3[91]);_0x315cx11[_0x81d3[85]](_0x81d3[92],_0x81d3[93]);_0x315cx11[_0x81d3[69]]=_0x81d3[94];var _0x315cx1f=document[_0x81d3[68]](_0x81d3[67]);_0x315cx1f[_0x81d3[69]]=_0x81d3[95]+_0x315cx18;_0x315cx11[_0x81d3[66]](_0x315cx1f);return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[62]]=function(_0x315cxc,_0x315cxd){var _0x315cx11=document[_0x81d3[68]](_0x81d3[91]);_0x315cx11[_0x81d3[85]](_0x81d3[92],_0x81d3[93]);_0x315cx11[_0x81d3[69]]=_0x81d3[96];mxUtils[_0x81d3[97]](_0x315cx11,_0x315cxc);return _0x315cx11};Toolbar[_0x81d3[6]][_0x81d3[65]]=function(_0x315cx11,_0x315cxe,_0x315cx12,_0x315cx20){if(_0x315cx12!=null){var _0x315cx7=this[_0x81d3[0]][_0x81d3[41]][_0x81d3[40]];var _0x315cx10=null;mxEvent[_0x81d3[51]](_0x315cx11,_0x81d3[89],mxUtils[_0x81d3[4]](this,function(_0x315cx4){if(_0x315cx11[_0x81d3[60]]==null||_0x315cx11[_0x81d3[60]]){_0x315cx7[_0x81d3[98]][_0x81d3[3]]();_0x315cx10= new mxPopupMenu(_0x315cx12);_0x315cx10[_0x81d3[67]][_0x81d3[69]]+=_0x81d3[99];_0x315cx10[_0x81d3[100]]=_0x315cx20;_0x315cx10[_0x81d3[101]]=_0x315cxe;_0x315cx10[_0x81d3[102]]=true;_0x315cx10[_0x81d3[106]](_0x315cx11[_0x81d3[103]],_0x315cx11[_0x81d3[104]]+_0x315cx11[_0x81d3[105]]+34,null,_0x315cx4);this[_0x81d3[54]]=_0x315cx10};mxEvent[_0x81d3[90]](_0x315cx4)}))}} \ No newline at end of file +/** + * $Id: Toolbar.js,v 1.3 2013-02-20 16:21:29 gaudenz Exp $ + * Copyright (c) 2006-2012, JGraph Ltd + */ +/** + * Construcs a new toolbar for the given editor. + */ +function Toolbar(editorUi, container) +{ + this.editorUi = editorUi; + this.container = container; + this.init(); + + // Global handler to hide the current menu + mxEvent.addGestureListeners(document, mxUtils.bind(this, function(evt) + { + this.hideMenu(); + })); +}; + +/** + * Adds the toolbar elements. + */ +Toolbar.prototype.init = function() +{ + this.addItems(['save', 'publish', '-', 'print', 'undo', 'redo', '-', 'copy', 'cut', 'paste', 'delete', '-', 'duplicate', '-', 'actualSize', 'zoomIn', 'zoomOut', '-']); + var fontElt = this.addMenu('Helvetica', mxResources.get('fontFamily'), true, 'fontFamily'); + fontElt.style.whiteSpace = 'nowrap'; + fontElt.style.overflow = 'hidden'; + fontElt.style.width = '70px'; + this.addSeparator(); + var sizeElt = this.addMenu('12', mxResources.get('fontSize'), true, 'fontSize'); + sizeElt.style.whiteSpace = 'nowrap'; + sizeElt.style.overflow = 'hidden'; + sizeElt.style.width = '30px'; + + this.addItems(['-', 'bold', 'italic', 'underline']); + // Giuseppe Careri + // var align = this.addMenuFunction('geSprite-left', mxResources.get('align'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_LEFT], 'geIcon geSprite geSprite-left', null).setAttribute('title', mxResources.get('left')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_CENTER], 'geIcon geSprite geSprite-center', null).setAttribute('title', mxResources.get('center')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ALIGN], [mxConstants.ALIGN_RIGHT], 'geIcon geSprite geSprite-right', null).setAttribute('title', mxResources.get('right')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_TOP], 'geIcon geSprite geSprite-top', null).setAttribute('title', mxResources.get('top')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_MIDDLE], 'geIcon geSprite geSprite-middle', null).setAttribute('title', mxResources.get('middle')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_VERTICAL_ALIGN], [mxConstants.ALIGN_BOTTOM], 'geIcon geSprite geSprite-bottom', null).setAttribute('title', mxResources.get('bottom')); + // })); + // this.addItems(['fontColor', '-']); + // var line = this.addMenuFunction('geSprite-straight', mxResources.get('line'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], [null], 'geIcon geSprite geSprite-straight', null).setAttribute('title', mxResources.get('straight')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['entityRelationEdgeStyle'], 'geIcon geSprite geSprite-entity', null).setAttribute('title', mxResources.get('entityRelation')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE, mxConstants.STYLE_ELBOW], ['elbowEdgeStyle', 'horizontal'], 'geIcon geSprite geSprite-helbow', null).setAttribute('title', mxResources.get('horizontal')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE, mxConstants.STYLE_ELBOW], ['elbowEdgeStyle', 'vertical'], 'geIcon geSprite geSprite-velbow', null).setAttribute('title', mxResources.get('vertical')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['segmentEdgeStyle'], 'geIcon geSprite geSprite-segment', null).setAttribute('title', mxResources.get('manual')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_EDGE], ['orthogonalEdgeStyle'], 'geIcon geSprite geSprite-orthogonal', null).setAttribute('title', mxResources.get('automatic')); + // })); + // var linestart = this.addMenuFunction('geSprite-startclassic', mxResources.get('lineend'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.NONE, 0], 'geIcon geSprite geSprite-noarrow', null).setAttribute('title', mxResources.get('none')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_CLASSIC, 1], 'geIcon geSprite geSprite-startclassic', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OPEN, 1], 'geIcon geSprite geSprite-startopen', null).setAttribute('title', mxResources.get('openArrow')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_BLOCK, 1], 'geIcon geSprite geSprite-startblock', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OVAL, 1], 'geIcon geSprite geSprite-startoval', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND, 1], 'geIcon geSprite geSprite-startdiamond', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND_THIN, 1], 'geIcon geSprite geSprite-startthindiamond', null).setAttribute('title', mxResources.get('diamondThin')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_CLASSIC, 0], 'geIcon geSprite geSprite-startclassictrans', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_BLOCK, 0], 'geIcon geSprite geSprite-startblocktrans', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_OVAL, 0], 'geIcon geSprite geSprite-startovaltrans', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND, 0], 'geIcon geSprite geSprite-startdiamondtrans', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_STARTARROW, 'startFill'], [mxConstants.ARROW_DIAMOND_THIN, 0], 'geIcon geSprite geSprite-startthindiamondtrans', null).setAttribute('title', mxResources.get('diamondThin')); + // })); + // var lineend = this.addMenuFunction('geSprite-endclassic', mxResources.get('lineend'), false, mxUtils.bind(this, function(menu) + // { + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.NONE, 0], 'geIcon geSprite geSprite-noarrow', null).setAttribute('title', mxResources.get('none')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_CLASSIC, 1], 'geIcon geSprite geSprite-endclassic', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OPEN, 1], 'geIcon geSprite geSprite-endopen', null).setAttribute('title', mxResources.get('openArrow')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_BLOCK, 1], 'geIcon geSprite geSprite-endblock', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OVAL, 1], 'geIcon geSprite geSprite-endoval', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND, 1], 'geIcon geSprite geSprite-enddiamond', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND_THIN, 1], 'geIcon geSprite geSprite-endthindiamond', null).setAttribute('title', mxResources.get('diamondThin')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_CLASSIC, 0], 'geIcon geSprite geSprite-endclassictrans', null).setAttribute('title', mxResources.get('classic')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_BLOCK, 0], 'geIcon geSprite geSprite-endblocktrans', null).setAttribute('title', mxResources.get('block')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_OVAL, 0], 'geIcon geSprite geSprite-endovaltrans', null).setAttribute('title', mxResources.get('oval')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND, 0], 'geIcon geSprite geSprite-enddiamondtrans', null).setAttribute('title', mxResources.get('diamond')); + // this.editorUi.menus.styleChange(menu, '', [mxConstants.STYLE_ENDARROW, 'endFill'], [mxConstants.ARROW_DIAMOND_THIN, 0], 'geIcon geSprite geSprite-endthindiamondtrans', null).setAttribute('title', mxResources.get('diamondThin')); + // })); + // this.addItems(['-', 'strokeColor', 'image', 'fillColor']); + // this.addItem('geSprite-gradientcolor', 'gradientColor').setAttribute('title', mxResources.get('gradient')); + // this.addItems(['shadow']); + + var graph = this.editorUi.editor.graph; + + // Update font size and font family labels + var update = mxUtils.bind(this, function() + { + var ff = 'Helvetica'; + var fs = '12'; + var state = graph.getView().getState(graph.getSelectionCell()); + + if (state != null) + { + ff = state.style[mxConstants.STYLE_FONTFAMILY] || ff; + fs = state.style[mxConstants.STYLE_FONTSIZE] || fs; + + if (ff.length > 10) + { + ff = ff.substring(0, 8) + '...'; + } + + fontElt.innerHTML = ff; + sizeElt.innerHTML = fs; + } + }); + + graph.getSelectionModel().addListener(mxEvent.CHANGE, update); + graph.getModel().addListener(mxEvent.CHANGE, update); + + // Giuseppe Careri + // Updates button states + //this.addEdgeSelectionHandler([line, linestart, lineend]); + //this.addSelectionHandler([align]); +}; + +/** + * Hides the current menu. + */ +Toolbar.prototype.hideMenu = function() +{ + if (this.currentMenu != null) + { + this.currentMenu.hideMenu(); + this.currentMenu.destroy(); + this.currentMenu = null; + } +}; + +/** + * Adds a label to the toolbar. + */ +Toolbar.prototype.addMenu = function(label, tooltip, showLabels, name) +{ + var menu = this.editorUi.menus.get(name); + var elt = this.addMenuFunction(label, tooltip, showLabels, menu.funct); + + menu.addListener('stateChanged', function() + { + elt.setEnabled(menu.enabled); + }); + + return elt; +}; + +/** + * Adds a label to the toolbar. + */ +Toolbar.prototype.addMenuFunction = function(label, tooltip, showLabels, funct) +{ + var elt = (showLabels) ? this.createLabel(label) : this.createButton(label); + this.initElement(elt, tooltip); + this.addMenuHandler(elt, showLabels, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds a separator to the separator. + */ +Toolbar.prototype.addSeparator = function() +{ + var elt = document.createElement('div'); + elt.className = 'geSeparator'; + this.container.appendChild(elt); + + return elt; +}; + +/** + * Adds given action item + */ +Toolbar.prototype.addItems = function(keys) +{ + for (var i = 0; i < keys.length; i++) + { + var key = keys[i]; + + if (key == '-') + { + this.addSeparator(); + } + else + { + this.addItem('geSprite-' + key.toLowerCase(), key); + } + } +}; + +/** + * Adds given action item + */ +Toolbar.prototype.addItem = function(sprite, key) +{ + var action = this.editorUi.actions.get(key); + var elt = null; + + if (action != null) + { + elt = this.addButton(sprite, action.label, action.funct); + elt.setEnabled(action.enabled); + + action.addListener('stateChanged', function() + { + elt.setEnabled(action.enabled); + }); + } + + return elt; +}; + +/** + * Adds a button to the toolbar. + */ +Toolbar.prototype.addButton = function(classname, tooltip, funct) +{ + var elt = this.createButton(classname); + + this.initElement(elt, tooltip); + this.addClickHandler(elt, funct); + this.container.appendChild(elt); + + return elt; +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +Toolbar.prototype.addSelectionHandler = function(items) +{ + var graph = this.editorUi.editor.graph; + + var selectionListener = function() + { + var selected = !graph.isSelectionEmpty(); + + for (var i = 0; i < items.length; i++) + { + items[i].setEnabled(selected); + } + }; + + graph.getSelectionModel().addListener(mxEvent.CHANGE, selectionListener); + selectionListener(); +}; + +/** + * Updates the states of the given toolbar items based on the selection. + */ +Toolbar.prototype.addEdgeSelectionHandler = function(items) +{ + var graph = this.editorUi.editor.graph; + + var selectionListener = function() + { + var edgeSelected = false; + + if (!graph.isSelectionEmpty()) + { + var cells = graph.getSelectionCells(); + + for (var i = 0; i < cells.length; i++) + { + if (graph.getModel().isEdge(cells[i])) + { + edgeSelected = true; + break; + } + } + } + + for (var i = 0; i < items.length; i++) + { + items[i].setEnabled(edgeSelected); + } + }; + + graph.getSelectionModel().addListener(mxEvent.CHANGE, selectionListener); + selectionListener(); +}; + +/** + * Initializes the given toolbar element. + */ +Toolbar.prototype.initElement = function(elt, tooltip) +{ + elt.setAttribute('tabindex', '0'); + + // Adds tooltip + if (tooltip != null) + { + elt.setAttribute('title', tooltip); + } + + this.addEnabledState(elt); +}; + +/** + * Adds enabled state with setter to DOM node (avoids JS wrapper). + */ +Toolbar.prototype.addEnabledState = function(elt) +{ + var classname = elt.className; + + elt.setEnabled = function(value) + { + elt.enabled = value; + + if (value) + { + elt.className = classname; + } + else + { + elt.className = classname + ' geDisabled'; + } + }; + + elt.setEnabled(true); +}; + +/** + * Adds enabled state with setter to DOM node (avoids JS wrapper). + */ +Toolbar.prototype.addClickHandler = function(elt, funct) +{ + if (funct != null) + { + mxEvent.addListener(elt, 'click', function(evt) + { + if (elt.enabled) + { + funct(evt); + } + + mxEvent.consume(evt); + }); + } +}; + +/** + * Creates and returns a new button. + */ +Toolbar.prototype.createButton = function(classname) +{ + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geButton'; + + var inner = document.createElement('div'); + inner.className = 'geSprite ' + classname; + elt.appendChild(inner); + + return elt; +}; + +/** + * Creates and returns a new button. + */ +Toolbar.prototype.createLabel = function(label, tooltip) +{ + var elt = document.createElement('a'); + elt.setAttribute('href', 'javascript:void(0);'); + elt.className = 'geLabel'; + mxUtils.write(elt, label); + + return elt; +}; + +/** + * Adds a handler for showing a menu in the given element. + */ +Toolbar.prototype.addMenuHandler = function(elt, showLabels, funct, showAll) +{ + if (funct != null) + { + var graph = this.editorUi.editor.graph; + var menu = null; + + mxEvent.addListener(elt, 'click', mxUtils.bind(this, function(evt) + { + if (elt.enabled == null || elt.enabled) + { + graph.panningHandler.hideMenu(); + menu = new mxPopupMenu(funct); + menu.div.className += ' geToolbarMenu'; + menu.showDisabled = showAll; + menu.labels = showLabels; + menu.autoExpand = true; + + menu.popup(elt.offsetLeft, elt.offsetTop + elt.offsetHeight + 34, null, evt); + this.currentMenu = menu; + } + + mxEvent.consume(evt); + })); + } +}; diff --git a/public/assets/plugins/square/js/custom.js b/public/assets/plugins/square/js/custom.js index 51b02d8..39607c6 100644 --- a/public/assets/plugins/square/js/custom.js +++ b/public/assets/plugins/square/js/custom.js @@ -1 +1,283 @@ -var _0x20ac=["\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x3F","\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66","\x26","\x73\x70\x6C\x69\x74","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x6C\x65\x6E\x67\x74\x68","\x3D","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x74\x74\x70\x3A\x2F\x2F\x65\x78\x70\x2E\x64\x72\x61\x77\x2E\x69\x6F\x2F\x49\x6D\x61\x67\x65\x45\x78\x70\x6F\x72\x74\x32\x2F\x65\x78\x70\x6F\x72\x74","\x68\x74\x74\x70\x3A\x2F\x2F\x6C\x6F\x63\x61\x6C\x68\x6F\x73\x74\x3A\x33\x30\x30\x30","\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F","\x2F\x61\x70\x69\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x73\x71\x75\x61\x72\x65\x2F\x73\x74\x65\x6E\x63\x69\x6C\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x73\x71\x75\x61\x72\x65\x2F\x73\x68\x61\x70\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x69\x6D\x61\x67\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x73\x74\x79\x6C\x65\x73","\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x6F\x70\x65\x6E","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x73\x71\x75\x61\x72\x65\x2F\x74\x65\x6D\x70\x6C\x61\x74\x65\x73","\x2F\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x73\x71\x75\x61\x72\x65\x2F\x72\x65\x73\x6F\x75\x72\x63\x65\x73","\x2F\x64\x69\x61","\x63\x75\x73\x74\x6F\x6D","\x4E\x47\x5F\x54\x52\x41\x4E\x53\x4C\x41\x54\x45\x5F\x4C\x41\x4E\x47\x5F\x4B\x45\x59","\x67\x65\x74\x49\x74\x65\x6D","\x6C\x6F\x67","\x65\x6E","\x65\x6E\x5F\x45\x4E","\x69\x74","\x6D\x78\x4C\x61\x6E\x67\x75\x61\x67\x65","\x61\x72","\x62\x73","\x63\x73","\x64\x61","\x64\x65","\x65\x6C","\x65\x73","\x65\x73\x2D\x61\x72","\x66\x72","\x68\x75","\x69\x64","\x6A\x61","\x6B\x6F","\x6E\x6C","\x6E\x6F","\x70\x6C","\x70\x74\x2D\x62\x72","\x70\x74","\x72\x6F","\x72\x75","\x73\x72","\x73\x76","\x74\x68","\x74\x72","\x75\x6B","\x7A\x68","\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68","\x61\x73\x73\x65\x74\x73\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x6D\x78\x67\x72\x61\x70\x68\x2F\x6A\x73","\x55\x53\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x53\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x4D\x61\x6C\x65","\x55\x4B\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x4B\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x4D\x61\x6C\x65","\x41\x75\x73\x74\x72\x61\x6C\x69\x61\x6E\x20\x45\x6E\x67\x6C\x69\x73\x68","\x55\x53\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x55\x53\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x4D\x61\x6C\x65","\x43\x68\x69\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x43\x68\x69\x6E\x65\x73\x65\x20\x4D\x61\x6C\x65","\x48\x6F\x6E\x67\x20\x4B\x6F\x6E\x67\x20\x43\x61\x6E\x74\x6F\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x54\x61\x69\x77\x61\x6E\x20\x43\x68\x69\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x4D\x61\x6C\x65","\x4B\x6F\x72\x65\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x4B\x6F\x72\x65\x61\x6E\x20\x4D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x45\x6E\x67\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x48\x75\x6E\x67\x61\x72\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x42\x72\x61\x7A\x69\x6C\x69\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x53\x70\x61\x6E\x69\x73\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x43\x61\x74\x61\x6C\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x43\x7A\x65\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x44\x61\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x69\x6E\x6E\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x44\x75\x74\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x50\x6F\x6C\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x49\x74\x61\x6C\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x54\x75\x72\x6B\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65\x09","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x54\x75\x72\x6B\x69\x73\x68\x20\x4D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x47\x65\x72\x6D\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x45\x75\x72\x6F\x70\x65\x61\x6E\x20\x47\x65\x72\x6D\x61\x6E\x20\x4D\x61\x6C\x65","\x52\x75\x73\x73\x69\x61\x6E\x20\x46\x65\x6D\x61\x6C\x65","\x52\x75\x73\x73\x69\x61\x6E\x20\x4D\x61\x6C\x65","\x53\x77\x65\x64\x69\x73\x68\x20\x46\x65\x6D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x46\x65\x6D\x61\x6C\x65","\x43\x61\x6E\x61\x64\x69\x61\x6E\x20\x46\x72\x65\x6E\x63\x68\x20\x4D\x61\x6C\x65","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x55\x53\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x43\x61\x6E\x61\x64\x61\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x55\x4B\x29","\x45\x6E\x67\x6C\x69\x73\x68\x20\x28\x41\x75\x73\x74\x72\x61\x6C\x69\x61\x29","\x53\x70\x61\x6E\x69\x73\x68\x20\x28\x53\x70\x61\x69\x6E\x29","\x53\x70\x61\x6E\x69\x73\x68\x20\x28\x4D\x65\x78\x69\x63\x6F\x29","\x49\x74\x61\x6C\x69\x61\x6E\x20\x28\x49\x74\x61\x6C\x79\x29\x20\x2F\x20\x46\x69\x6E\x6E\x69\x73\x68\x20\x28\x46\x69\x6E\x6C\x61\x6E\x64\x29","\x46\x72\x65\x6E\x63\x68\x20\x28\x46\x72\x61\x6E\x63\x65\x29","\x46\x72\x65\x6E\x63\x68\x20\x28\x43\x61\x6E\x61\x64\x61\x29","\x50\x6F\x6C\x69\x73\x68\x20\x28\x50\x6F\x6C\x61\x6E\x64\x29","\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x28\x50\x6F\x72\x74\x75\x67\x61\x6C\x29","\x43\x61\x74\x61\x6C\x61\x6E\x20\x28\x43\x61\x74\x61\x6C\x61\x6E\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x54\x61\x69\x77\x61\x6E\x29","\x44\x61\x6E\x69\x73\x68\x20\x28\x44\x65\x6E\x6D\x61\x72\x6B\x29","\x47\x65\x72\x6D\x61\x6E\x20\x28\x47\x65\x72\x6D\x61\x6E\x79\x29","\x4A\x61\x70\x61\x6E\x65\x73\x65\x20\x28\x4A\x61\x70\x61\x6E\x29","\x4B\x6F\x72\x65\x61\x6E\x20\x28\x4B\x6F\x72\x65\x61\x29","\x44\x75\x74\x63\x68\x20\x28\x4E\x65\x74\x68\x65\x72\x6C\x61\x6E\x64\x73\x29","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x28\x4E\x6F\x72\x77\x61\x79\x29","\x50\x6F\x72\x74\x75\x67\x75\x65\x73\x65\x20\x28\x42\x72\x61\x7A\x69\x6C\x29","\x52\x75\x73\x73\x69\x61\x6E\x20\x28\x52\x75\x73\x73\x69\x61\x29","\x53\x77\x65\x64\x69\x73\x68\x20\x28\x53\x77\x65\x64\x65\x6E\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x43\x68\x69\x6E\x61\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x48\x6F\x6E\x67\x20\x4B\x6F\x6E\x67\x29","\x44\x65\x66\x61\x75\x6C\x74","\x44\x61\x74\x65","\x55\x53\x20\x4D\x6F\x6E\x65\x79","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39\x39","\x4E\x75\x6D\x62\x65\x72\x73\x20\x74\x6F\x20\x39\x39\x39","\x54\x69\x6D\x65","\x50\x68\x6F\x6E\x65\x20\x6E\x75\x6D\x62\x65\x72","\x53\x74\x72\x65\x65\x74\x73","\x55\x53\x20\x43\x69\x74\x79\x2F\x53\x74\x61\x74\x65\x73","\x41\x66\x72\x69\x6B\x61\x61\x6E\x73","\x41\x6C\x62\x61\x6E\x69\x61\x6E","\x41\x6D\x68\x61\x72\x69\x63","\x41\x72\x61\x62\x69\x63","\x41\x72\x6D\x65\x6E\x69\x61\x6E","\x41\x7A\x65\x72\x62\x61\x69\x6A\x61\x6E\x69","\x42\x61\x73\x71\x75\x65","\x42\x65\x6C\x61\x72\x75\x73\x69\x61\x6E","\x42\x65\x6E\x67\x61\x6C\x69","\x42\x69\x68\x61\x72\x69","\x42\x6F\x73\x6E\x69\x61\x6E","\x42\x72\x65\x74\x6F\x6E","\x42\x75\x6C\x67\x61\x72\x69\x61\x6E","\x43\x61\x6D\x62\x6F\x64\x69\x61\x6E","\x43\x61\x74\x61\x6C\x61\x6E","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x53\x69\x6D\x70\x6C\x69\x66\x69\x65\x64\x29","\x43\x68\x69\x6E\x65\x73\x65\x20\x28\x54\x72\x61\x64\x69\x74\x69\x6F\x6E\x61\x6C\x29","\x43\x6F\x72\x73\x69\x63\x61\x6E","\x43\x72\x6F\x61\x74\x69\x61\x6E","\x43\x7A\x65\x63\x68","\x44\x61\x6E\x69\x73\x68","\x44\x75\x74\x63\x68","\x45\x6E\x67\x6C\x69\x73\x68","\x45\x73\x70\x65\x72\x61\x6E\x74\x6F","\x45\x73\x74\x6F\x6E\x69\x61\x6E","\x46\x61\x72\x6F\x65\x73\x65","\x46\x69\x6C\x69\x70\x69\x6E\x6F","\x46\x69\x6E\x6E\x69\x73\x68","\x46\x72\x65\x6E\x63\x68","\x46\x72\x69\x73\x69\x61\x6E","\x47\x61\x6C\x69\x63\x69\x61\x6E","\x47\x65\x6F\x72\x67\x69\x61\x6E","\x47\x65\x72\x6D\x61\x6E","\x47\x72\x65\x65\x6B","\x47\x75\x61\x72\x61\x6E\x69","\x47\x75\x6A\x61\x72\x61\x74\x69","\x48\x61\x63\x6B\x65\x72","\x48\x61\x75\x73\x61","\x48\x65\x62\x72\x65\x77","\x48\x69\x6E\x64\x69","\x48\x75\x6E\x67\x61\x72\x69\x61\x6E","\x49\x63\x65\x6C\x61\x6E\x64\x69\x63","\x49\x6E\x64\x6F\x6E\x65\x73\x69\x61\x6E","\x49\x6E\x74\x65\x72\x6C\x69\x6E\x67\x75\x61","\x49\x72\x69\x73\x68","\x49\x74\x61\x6C\x69\x61\x6E","\x4A\x61\x76\x61\x6E\x65\x73\x65","\x4A\x61\x70\x61\x6E\x65\x73\x65","\x4B\x61\x6E\x6E\x61\x64\x61","\x4B\x61\x7A\x61\x6B\x68","\x4B\x69\x6E\x79\x61\x72\x77\x61\x6E\x64\x61","\x4B\x69\x72\x75\x6E\x64\x69","\x4B\x6C\x69\x6E\x67\x6F\x6E","\x4B\x75\x72\x64\x69\x73\x68","\x4B\x6F\x72\x65\x61\x6E","\x4B\x79\x72\x67\x79\x7A","\x4C\x61\x6F\x74\x68\x69\x61\x6E","\x4C\x61\x74\x69\x6E","\x4C\x61\x74\x76\x69\x61\x6E","\x4C\x69\x6E\x67\x61\x6C\x61","\x4C\x69\x74\x68\x75\x61\x6E\x69\x61\x6E","\x4D\x61\x63\x65\x64\x6F\x6E\x69\x61\x6E","\x4D\x61\x6C\x61\x67\x61\x73\x79","\x4D\x61\x6C\x61\x79","\x4D\x61\x6C\x61\x79\x61\x6C\x61\x6D","\x4D\x61\x6C\x74\x65\x73\x65","\x4D\x61\x6F\x72\x69","\x4D\x61\x72\x61\x74\x68\x69","\x4D\x6F\x6C\x64\x61\x76\x69\x61\x6E","\x4D\x6F\x6E\x67\x6F\x6C\x69\x61\x6E","\x4D\x6F\x6E\x74\x65\x6E\x65\x67\x72\x69\x6E","\x4E\x65\x70\x61\x6C\x69","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E","\x4E\x6F\x72\x77\x65\x67\x69\x61\x6E\x20\x28\x4E\x79\x6E\x6F\x72\x73\x6B\x29","\x4F\x63\x63\x69\x74\x61\x6E","\x4F\x72\x69\x79\x61","\x4F\x72\x6F\x6D\x6F","\x50\x61\x73\x68\x74\x6F","\x50\x65\x72\x73\x69\x61\x6E","\x50\x69\x72\x61\x74\x65","\x50\x6F\x6C\x69\x73\x68","\x50\x75\x6E\x6A\x61\x62\x69","\x51\x75\x65\x63\x68\x75\x61","\x52\x6F\x6D\x61\x6E\x69\x61\x6E","\x52\x6F\x6D\x61\x6E\x73\x68","\x52\x75\x73\x73\x69\x61\x6E","\x53\x63\x6F\x74\x73\x20\x47\x61\x65\x6C\x69\x63","\x53\x65\x72\x62\x69\x61\x6E","\x53\x65\x72\x62\x6F\x2D\x43\x72\x6F\x61\x74\x69\x61\x6E","\x53\x65\x73\x6F\x74\x68\x6F","\x53\x68\x6F\x6E\x61","\x53\x69\x6E\x64\x68\x69","\x53\x69\x6E\x68\x61\x6C\x65\x73\x65","\x53\x6C\x6F\x76\x61\x6B","\x53\x6C\x6F\x76\x65\x6E\x69\x61\x6E","\x53\x6F\x6D\x61\x6C\x69","\x53\x70\x61\x6E\x69\x73\x68","\x53\x75\x6E\x64\x61\x6E\x65\x73\x65","\x53\x77\x61\x68\x69\x6C\x69","\x53\x77\x65\x64\x69\x73\x68","\x54\x61\x6A\x69\x6B","\x54\x61\x6D\x69\x6C","\x54\x61\x74\x61\x72","\x54\x65\x6C\x75\x67\x75","\x54\x68\x61\x69","\x54\x69\x67\x72\x69\x6E\x79\x61","\x54\x6F\x6E\x67\x61","\x54\x75\x72\x6B\x69\x73\x68","\x54\x75\x72\x6B\x6D\x65\x6E","\x54\x77\x69","\x55\x69\x67\x68\x75\x72","\x55\x6B\x72\x61\x69\x6E\x69\x61\x6E","\x55\x72\x64\x75","\x55\x7A\x62\x65\x6B","\x56\x69\x65\x74\x6E\x61\x6D\x65\x73\x65","\x57\x65\x6C\x73\x68","\x58\x68\x6F\x73\x61","\x59\x69\x64\x64\x69\x73\x68","\x59\x6F\x72\x75\x62\x61","\x5A\x75\x6C\x75"];var urlParams=(function(_0xd08bx2){var _0xd08bx3= new Object();var _0xd08bx4=_0xd08bx2[_0x20ac[3]](_0x20ac[2]);if(_0xd08bx4>0){var _0xd08bx5=_0xd08bx2[_0x20ac[6]](_0xd08bx4+1)[_0x20ac[5]](_0x20ac[4]);for(var _0xd08bx6=0;_0xd08bx6<_0xd08bx5[_0x20ac[7]];_0xd08bx6++){_0xd08bx4=_0xd08bx5[_0xd08bx6][_0x20ac[9]](_0x20ac[8]);if(_0xd08bx4>0){_0xd08bx3[_0xd08bx5[_0xd08bx6][_0x20ac[6]](0,_0xd08bx4)]=_0xd08bx5[_0xd08bx6][_0x20ac[6]](_0xd08bx4+1)}}};return _0xd08bx3})(window[_0x20ac[1]][_0x20ac[0]]);var t0= new Date();var MAX_REQUEST_SIZE=10485760;var MAX_WIDTH=12000;var MAX_HEIGHT=12000;var EXPORT_URL=_0x20ac[10];var SHARE_HOST=_0x20ac[11];var SAVE_URL=_0x20ac[12];var VARIABLE_URL=_0x20ac[13];var STENCIL_PATH=_0x20ac[14];var SHAPES_PATH=_0x20ac[15];var IMAGE_PATH=_0x20ac[16];var STYLE_PATH=_0x20ac[17];var CSS_PATH=_0x20ac[17];var OPEN_FORM=_0x20ac[18];var TEMPLATE_PATH=_0x20ac[19];var RESOURCES_PATH=_0x20ac[20];var RESOURCE_BASE=RESOURCES_PATH+_0x20ac[21];var tapAndHoldStartsConnection=true;var showConnectorImg=true;var mxLoadResources=false;console[_0x20ac[25]](_0x20ac[22],localStorage[_0x20ac[24]](_0x20ac[23]));switch(localStorage[_0x20ac[24]](_0x20ac[23])){case _0x20ac[27]:mxLanguage=_0x20ac[26];break;case _0x20ac[28]:mxLanguage=_0x20ac[28];break;default:mxLanguage=_0x20ac[26]};console[_0x20ac[25]](_0x20ac[29],mxLanguage);var mxLanguages=[_0x20ac[30],_0x20ac[31],_0x20ac[32],_0x20ac[33],_0x20ac[34],_0x20ac[35],_0x20ac[36],_0x20ac[37],_0x20ac[38],_0x20ac[39],_0x20ac[40],_0x20ac[28],_0x20ac[41],_0x20ac[42],_0x20ac[43],_0x20ac[44],_0x20ac[45],_0x20ac[46],_0x20ac[47],_0x20ac[48],_0x20ac[49],_0x20ac[50],_0x20ac[51],_0x20ac[52],_0x20ac[53],_0x20ac[54],_0x20ac[55]];var mxBasePath=_0x20ac[56];var geBasePath=_0x20ac[57];var ISPEECHLANG={usenglishfemale:_0x20ac[58],usenglishmale:_0x20ac[59],ukenglishfemale:_0x20ac[60],ukenglishmale:_0x20ac[61],auenglishfemale:_0x20ac[62],usspanishfemale:_0x20ac[63],usspanishmale:_0x20ac[64],chchinesefemale:_0x20ac[65],chchinesemale:_0x20ac[66],hkchinesefemale:_0x20ac[67],twchinesefemale:_0x20ac[68],jpjapanesefemale:_0x20ac[69],jpjapanesemale:_0x20ac[70],krkoreanfemale:_0x20ac[71],krkoreanmale:_0x20ac[72],caenglishfemale:_0x20ac[73],huhungarianfemale:_0x20ac[74],brportuguesefemale:_0x20ac[75],eurportuguesefemale:_0x20ac[76],eurportuguesemale:_0x20ac[77],eurspanishfemale:_0x20ac[78],eurspanishmale:_0x20ac[79],eurcatalanfemale:_0x20ac[80],eurczechfemale:_0x20ac[81],eurdanishfemale:_0x20ac[82],eurfinnishfemale:_0x20ac[83],eurfrenchfemale:_0x20ac[84],eurfrenchmale:_0x20ac[85],eurnorwegianfemale:_0x20ac[86],eurdutchfemale:_0x20ac[87],eurpolishfemale:_0x20ac[88],euritalianfemale:_0x20ac[89],eurturkishfemale:_0x20ac[90],eurturkishmale:_0x20ac[91],eurgermanfemale:_0x20ac[92],eurgermanmale:_0x20ac[93],rurussianfemale:_0x20ac[94],rurussianmale:_0x20ac[95],swswedishfemale:_0x20ac[96],cafrenchfemale:_0x20ac[97],cafrenchmale:_0x20ac[98]};var ISPEECHASRLANG={"\x65\x6E\x2D\x55\x53":_0x20ac[99],"\x65\x6E\x2D\x43\x41":_0x20ac[100],"\x65\x6E\x2D\x47\x42":_0x20ac[101],"\x65\x6E\x2D\x41\x55":_0x20ac[102],"\x65\x73\x2D\x45\x53":_0x20ac[103],"\x65\x73\x2D\x4D\x58":_0x20ac[104],"\x69\x74\x2D\x49\x54":_0x20ac[105],"\x66\x72\x2D\x46\x52":_0x20ac[106],"\x66\x72\x2D\x43\x41":_0x20ac[107],"\x70\x6C\x2D\x50\x4C":_0x20ac[108],"\x70\x74\x2D\x50\x54":_0x20ac[109],"\x63\x61\x2D\x45\x53":_0x20ac[110],"\x7A\x68\x2D\x54\x57":_0x20ac[111],"\x64\x61\x2D\x44\x4B":_0x20ac[112],"\x66\x72\x2D\x46\x52":_0x20ac[113],"\x6A\x61\x2D\x4A\x50":_0x20ac[114],"\x6B\x6F\x2D\x4B\x52":_0x20ac[115],"\x6E\x6C\x2D\x4E\x4C":_0x20ac[116],"\x6E\x62\x2D\x4E\x4F":_0x20ac[117],"\x70\x74\x2D\x42\x52":_0x20ac[118],"\x72\x75\x2D\x52\x55":_0x20ac[119],"\x73\x76\x2D\x53\x45":_0x20ac[120],"\x7A\x68\x2D\x43\x4E":_0x20ac[121],"\x7A\x68\x2D\x48\x4B":_0x20ac[122]};var ISPEECHASRMODEL={0:_0x20ac[123],date:_0x20ac[124],usmoney:_0x20ac[125],numbersto9:_0x20ac[126],numbersto99:_0x20ac[127],numbersto999:_0x20ac[128],time:_0x20ac[129],phonenumber:_0x20ac[130],streets:_0x20ac[131],citystate:_0x20ac[132]};var GOOGLETTSLANG={"\x61\x66":_0x20ac[133],"\x73\x71":_0x20ac[134],"\x61\x6D":_0x20ac[135],"\x61\x72":_0x20ac[136],"\x68\x79":_0x20ac[137],"\x61\x7A":_0x20ac[138],"\x65\x75":_0x20ac[139],"\x62\x65":_0x20ac[140],"\x62\x6E":_0x20ac[141],"\x62\x68":_0x20ac[142],"\x62\x73":_0x20ac[143],"\x62\x72":_0x20ac[144],"\x62\x67":_0x20ac[145],"\x6B\x6D":_0x20ac[146],"\x63\x61":_0x20ac[147],"\x7A\x68\x2D\x43\x4E":_0x20ac[148],"\x7A\x68\x2D\x54\x57":_0x20ac[149],"\x63\x6F":_0x20ac[150],"\x68\x72":_0x20ac[151],"\x63\x73":_0x20ac[152],"\x64\x61":_0x20ac[153],"\x6E\x6C":_0x20ac[154],"\x65\x6E":_0x20ac[155],"\x65\x6F":_0x20ac[156],"\x65\x74":_0x20ac[157],"\x66\x6F":_0x20ac[158],"\x74\x6C":_0x20ac[159],"\x66\x69":_0x20ac[160],"\x66\x72":_0x20ac[161],"\x66\x79":_0x20ac[162],"\x67\x6C":_0x20ac[163],"\x6B\x61":_0x20ac[164],"\x64\x65":_0x20ac[165],"\x65\x6C":_0x20ac[166],"\x67\x6E":_0x20ac[167],"\x67\x75":_0x20ac[168],"\x78\x78\x2D\x68\x61\x63\x6B\x65\x72":_0x20ac[169],"\x68\x61":_0x20ac[170],"\x69\x77":_0x20ac[171],"\x68\x69":_0x20ac[172],"\x68\x75":_0x20ac[173],"\x69\x73":_0x20ac[174],"\x69\x64":_0x20ac[175],"\x69\x61":_0x20ac[176],"\x67\x61":_0x20ac[177],"\x69\x74":_0x20ac[178],"\x6A\x77":_0x20ac[179],"\x6A\x61":_0x20ac[180],"\x6B\x6E":_0x20ac[181],"\x6B\x6B":_0x20ac[182],"\x72\x77":_0x20ac[183],"\x72\x6E":_0x20ac[184],"\x78\x78\x2D\x6B\x6C\x69\x6E\x67\x6F\x6E":_0x20ac[185],"\x6B\x75":_0x20ac[186],"\x6B\x6F":_0x20ac[187],"\x6B\x79":_0x20ac[188],"\x6C\x6F":_0x20ac[189],"\x6C\x61":_0x20ac[190],"\x6C\x76":_0x20ac[191],"\x6C\x6E":_0x20ac[192],"\x6C\x74":_0x20ac[193],"\x6D\x6B":_0x20ac[194],"\x6D\x67":_0x20ac[195],"\x6D\x73":_0x20ac[196],"\x6D\x6C":_0x20ac[197],"\x6D\x74":_0x20ac[198],"\x6D\x69":_0x20ac[199],"\x6D\x72":_0x20ac[200],"\x6D\x6F":_0x20ac[201],"\x6D\x6E":_0x20ac[202],"\x73\x72\x2D\x4D\x45":_0x20ac[203],"\x6E\x65":_0x20ac[204],"\x6E\x6F":_0x20ac[205],"\x6E\x6E":_0x20ac[206],"\x6F\x63":_0x20ac[207],"\x6F\x72":_0x20ac[208],"\x6F\x6D":_0x20ac[209],"\x70\x73":_0x20ac[210],"\x66\x61":_0x20ac[211],"\x78\x78\x2D\x70\x69\x72\x61\x74\x65":_0x20ac[212],"\x70\x6C":_0x20ac[213],"\x70\x74\x2D\x42\x52":_0x20ac[118],"\x70\x74\x2D\x50\x54":_0x20ac[109],"\x70\x61":_0x20ac[214],"\x71\x75":_0x20ac[215],"\x72\x6F":_0x20ac[216],"\x72\x6D":_0x20ac[217],"\x72\x75":_0x20ac[218],"\x67\x64":_0x20ac[219],"\x73\x72":_0x20ac[220],"\x73\x68":_0x20ac[221],"\x73\x74":_0x20ac[222],"\x73\x6E":_0x20ac[223],"\x73\x64":_0x20ac[224],"\x73\x69":_0x20ac[225],"\x73\x6B":_0x20ac[226],"\x73\x6C":_0x20ac[227],"\x73\x6F":_0x20ac[228],"\x65\x73":_0x20ac[229],"\x73\x75":_0x20ac[230],"\x73\x77":_0x20ac[231],"\x73\x76":_0x20ac[232],"\x74\x67":_0x20ac[233],"\x74\x61":_0x20ac[234],"\x74\x74":_0x20ac[235],"\x74\x65":_0x20ac[236],"\x74\x68":_0x20ac[237],"\x74\x69":_0x20ac[238],"\x74\x6F":_0x20ac[239],"\x74\x72":_0x20ac[240],"\x74\x6B":_0x20ac[241],"\x74\x77":_0x20ac[242],"\x75\x67":_0x20ac[243],"\x75\x6B":_0x20ac[244],"\x75\x72":_0x20ac[245],"\x75\x7A":_0x20ac[246],"\x76\x69":_0x20ac[247],"\x63\x79":_0x20ac[248],"\x78\x68":_0x20ac[249],"\x79\x69":_0x20ac[250],"\x79\x6F":_0x20ac[251],"\x7A\x75":_0x20ac[252]} \ No newline at end of file +var urlParams = (function(url) { + var result = new Object(); + var idx = url.lastIndexOf('?'); + + if (idx > 0) { + var params = url.substring(idx + 1).split('&'); + + for (var i = 0; i < params.length; i++) { + idx = params[i].indexOf('='); + + if (idx > 0) { + result[params[i].substring(0, idx)] = params[i].substring(idx + 1); + } + } + } + + return result; +})(window.location.href); + +var t0 = new Date(); + +// Public global variables +var MAX_REQUEST_SIZE = 10485760; +var MAX_WIDTH = 12000; +var MAX_HEIGHT = 12000; + +// CUSTOM_PARAMETERS - URLs for save and export +var EXPORT_URL = 'http://exp.draw.io/ImageExport2/export'; +var SHARE_HOST = 'http://localhost:3000'; + +var SAVE_URL = 'api/square/projects/'; +var VARIABLE_URL = '/api/variables'; + +// Paths and files +var STENCIL_PATH = '/assets/plugins/square/stencils'; +var SHAPES_PATH = '/assets/plugins/square/shapes'; +var IMAGE_PATH = '/assets/plugins/mxgraph/images'; +// Path for images inside the diagram +//var GRAPH_IMAGE_PATH = 'assets/plugins/mxgraph/img'; +//var ICONFINDER_PATH = 'iconfinder'; +var STYLE_PATH = '/assets/plugins/mxgraph/styles'; +var CSS_PATH = '/assets/plugins/mxgraph/styles'; +var OPEN_FORM = 'api/square/projects/open'; +var TEMPLATE_PATH = '/assets/plugins/square/templates'; + +// Directory for i18 files and basename for main i18n file +var RESOURCES_PATH = '/assets/plugins/square/resources'; +var RESOURCE_BASE = RESOURCES_PATH + '/dia'; + +// Specifies connection mode for touch devices (at least one should be true) +var tapAndHoldStartsConnection = true; +var showConnectorImg = true; + +var mxLoadResources = false; +// var mxLanguage = 'it'; +console.log('custom', localStorage.getItem("NG_TRANSLATE_LANG_KEY")); +switch (localStorage.getItem("NG_TRANSLATE_LANG_KEY")) { + case 'en_EN': + mxLanguage = 'en'; + break; + case 'it': + mxLanguage = 'it'; + break; + default: + mxLanguage = 'en'; +} +console.log('mxLanguage', mxLanguage); + +var mxLanguages = ['ar', 'bs', 'cs', 'da', 'de', 'el', 'es', 'es-ar', 'fr', + 'hu', 'id', 'it', 'ja', 'ko', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', + 'sr', 'sv', 'th', 'tr', 'uk', 'zh' +]; +var mxBasePath = 'assets/plugins/mxgraph'; +var geBasePath = 'assets/plugins/mxgraph/js'; + +var ISPEECHLANG = { + usenglishfemale: "US English Female", + usenglishmale: "US English Male", + ukenglishfemale: "UK English Female", + ukenglishmale: "UK English Male", + auenglishfemale: "Australian English", + usspanishfemale: "US Spanish Female", + usspanishmale: "US Spanish Male", + chchinesefemale: "Chinese Female", + chchinesemale: "Chinese Male", + hkchinesefemale: "Hong Kong Cantonese Female", + twchinesefemale: "Taiwan Chinese Female", + jpjapanesefemale: "Japanese Female", + jpjapanesemale: "Japanese Male", + krkoreanfemale: "Korean Female", + krkoreanmale: "Korean Male", + caenglishfemale: "Canadian English Female", + huhungarianfemale: "Hungarian Female", + brportuguesefemale: "Brazilian Portuguese Female", + eurportuguesefemale: "European Portuguese Female", + eurportuguesemale: "European Portuguese Male", + eurspanishfemale: "European Spanish Female", + eurspanishmale: "European Spanish Male", + eurcatalanfemale: "European Catalan Female", + eurczechfemale: "European Czech Female", + eurdanishfemale: "European Danish Female", + eurfinnishfemale: "European Finnish Female", + eurfrenchfemale: "European French Female", + eurfrenchmale: "European French Male", + eurnorwegianfemale: "European Norwegian Female", + eurdutchfemale: "European Dutch Female", + eurpolishfemale: "European Polish Female", + euritalianfemale: "European Italian Female", + eurturkishfemale: "European Turkish Female ", + eurturkishmale: "European Turkish Male", + eurgermanfemale: "European German Female", + eurgermanmale: "European German Male", + rurussianfemale: "Russian Female", + rurussianmale: "Russian Male", + swswedishfemale: "Swedish Female", + cafrenchfemale: "Canadian French Female", + cafrenchmale: "Canadian French Male" +}; + +var ISPEECHASRLANG = { + "en-US": "English (US)", + "en-CA": "English (Canada)", + "en-GB": "English (UK)", + "en-AU": "English (Australia)", + "es-ES": "Spanish (Spain)", + "es-MX": "Spanish (Mexico)", + "it-IT": "Italian (Italy) / Finnish (Finland)", + "fr-FR": "French (France)", + "fr-CA": "French (Canada)", + "pl-PL": "Polish (Poland)", + "pt-PT": "Portuguese (Portugal)", + "ca-ES": "Catalan (Catalan)", + "zh-TW": "Chinese (Taiwan)", + "da-DK": "Danish (Denmark)", + "fr-FR": "German (Germany)", + "ja-JP": "Japanese (Japan)", + "ko-KR": "Korean (Korea)", + "nl-NL": "Dutch (Netherlands)", + "nb-NO": "Norwegian (Norway)", + "pt-BR": "Portuguese (Brazil)", + "ru-RU": "Russian (Russia)", + "sv-SE": "Swedish (Sweden)", + "zh-CN": "Chinese (China)", + "zh-HK": "Chinese (Hong Kong)" +}; + +var ISPEECHASRMODEL = { + 0: "Default", + date: "Date", + usmoney: "US Money", + numbersto9: "Numbers to 9", + numbersto99: "Numbers to 99", + numbersto999: "Numbers to 999", + time: "Time", + phonenumber: "Phone number", + streets: "Streets", + citystate: "US City/States" +}; + +var GOOGLETTSLANG = { + "af": "Afrikaans", + "sq": "Albanian", + "am": "Amharic", + "ar": "Arabic", + "hy": "Armenian", + "az": "Azerbaijani", + "eu": "Basque", + "be": "Belarusian", + "bn": "Bengali", + "bh": "Bihari", + "bs": "Bosnian", + "br": "Breton", + "bg": "Bulgarian", + "km": "Cambodian", + "ca": "Catalan", + "zh-CN": "Chinese (Simplified)", + "zh-TW": "Chinese (Traditional)", + "co": "Corsican", + "hr": "Croatian", + "cs": "Czech", + "da": "Danish", + "nl": "Dutch", + "en": "English", + "eo": "Esperanto", + "et": "Estonian", + "fo": "Faroese", + "tl": "Filipino", + "fi": "Finnish", + "fr": "French", + "fy": "Frisian", + "gl": "Galician", + "ka": "Georgian", + "de": "German", + "el": "Greek", + "gn": "Guarani", + "gu": "Gujarati", + "xx-hacker": "Hacker", + "ha": "Hausa", + "iw": "Hebrew", + "hi": "Hindi", + "hu": "Hungarian", + "is": "Icelandic", + "id": "Indonesian", + "ia": "Interlingua", + "ga": "Irish", + "it": "Italian", + "jw": "Javanese", + "ja": "Japanese", + "kn": "Kannada", + "kk": "Kazakh", + "rw": "Kinyarwanda", + "rn": "Kirundi", + "xx-klingon": "Klingon", + "ku": "Kurdish", + "ko": "Korean", + "ky": "Kyrgyz", + "lo": "Laothian", + "la": "Latin", + "lv": "Latvian", + "ln": "Lingala", + "lt": "Lithuanian", + "mk": "Macedonian", + "mg": "Malagasy", + "ms": "Malay", + "ml": "Malayalam", + "mt": "Maltese", + "mi": "Maori", + "mr": "Marathi", + "mo": "Moldavian", + "mn": "Mongolian", + "sr-ME": "Montenegrin", + "ne": "Nepali", + "no": "Norwegian", + "nn": "Norwegian (Nynorsk)", + "oc": "Occitan", + "or": "Oriya", + "om": "Oromo", + "ps": "Pashto", + "fa": "Persian", + "xx-pirate": "Pirate", + "pl": "Polish", + "pt-BR": "Portuguese (Brazil)", + "pt-PT": "Portuguese (Portugal)", + "pa": "Punjabi", + "qu": "Quechua", + "ro": "Romanian", + "rm": "Romansh", + "ru": "Russian", + "gd": "Scots Gaelic", + "sr": "Serbian", + "sh": "Serbo-Croatian", + "st": "Sesotho", + "sn": "Shona", + "sd": "Sindhi", + "si": "Sinhalese", + "sk": "Slovak", + "sl": "Slovenian", + "so": "Somali", + "es": "Spanish", + "su": "Sundanese", + "sw": "Swahili", + "sv": "Swedish", + "tg": "Tajik", + "ta": "Tamil", + "tt": "Tatar", + "te": "Telugu", + "th": "Thai", + "ti": "Tigrinya", + "to": "Tonga", + "tr": "Turkish", + "tk": "Turkmen", + "tw": "Twi", + "ug": "Uighur", + "uk": "Ukrainian", + "ur": "Urdu", + "uz": "Uzbek", + "vi": "Vietnamese", + "cy": "Welsh", + "xh": "Xhosa", + "yi": "Yiddish", + "yo": "Yoruba", + "zu": "Zulu" +}; diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 172b49f..1090bff 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -1 +1,113 @@ -var _0xe333=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x41\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x69\x64","\x75\x73\x65\x72","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x6C\x6F\x67","\x63\x6F\x6D\x6D\x69\x74","\x70\x61\x72\x61\x6D\x73","\x6D\x65\x72\x67\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65"];_0xe333[0];var _=require(_0xe333[1]);var Action=require(_0xe333[3])[_0xe333[2]];var sequelize=require(_0xe333[3])[_0xe333[4]];function handleError(_0x7f39x5,_0x7f39x6){return _0x7f39x5[_0xe333[6]](500)[_0xe333[5]](_0x7f39x6)}function responseWithResult(_0x7f39x5,_0x7f39x8){_0x7f39x8=_0x7f39x8||200;return function(_0x7f39x9){if(_0x7f39x9){_0x7f39x5[_0xe333[6]](_0x7f39x8)[_0xe333[7]](_0x7f39x9)}}}function handleEntityNotFound(_0x7f39x5){return function(_0x7f39x9){if(!_0x7f39x9){_0x7f39x5[_0xe333[6]](404)[_0xe333[8]]();return null};return _0x7f39x9}}function saveUpdates(_0x7f39xc){return function(_0x7f39x9){return _0x7f39x9[_0xe333[10]](_0x7f39xc)[_0xe333[9]](function(_0x7f39xd){return _0x7f39xd})}}function removeEntity(_0x7f39x5){return function(_0x7f39x9){if(_0x7f39x9){return _0x7f39x9[_0xe333[11]]()[_0xe333[9]](function(){_0x7f39x5[_0xe333[6]](204)[_0xe333[8]]()})}}}exports[_0xe333[12]]=function(_0x7f39xf,_0x7f39x5){Action[_0xe333[14]]()[_0xe333[9]](responseWithResult(_0x7f39x5))[_0xe333[13]](handleError(_0x7f39x5))};exports[_0xe333[15]]=function(_0x7f39xf,_0x7f39x5){};exports[_0xe333[16]]=function(_0x7f39xf,_0x7f39x5,_0x7f39x10){_0x7f39xf[_0xe333[18]][_0xe333[17]]=_0x7f39xf[_0xe333[20]][_0xe333[19]];return sequelize[_0xe333[26]]()[_0xe333[9]](function(_0x7f39x11){return Action[_0xe333[16]](_[_0xe333[25]](_0x7f39xf[_0xe333[18]],_0x7f39xf[_0xe333[24]]),{transaction:_0x7f39x11,body:_0x7f39xf[_0xe333[18]]})[_0xe333[9]](function(_0x7f39x12){_0x7f39x11[_0xe333[23]]();return _0x7f39x5[_0xe333[6]](201)[_0xe333[5]](_0x7f39x12)})[_0xe333[13]](function(_0x7f39x6){_0x7f39x11[_0xe333[21]]();console[_0xe333[22]](_0x7f39x6);return handleError(_0x7f39x5,_0x7f39x6)})})};exports[_0xe333[27]]=function(_0x7f39xf,_0x7f39x5){};exports[_0xe333[11]]=function(_0x7f39xf,_0x7f39x5){} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/actions -> index + * POST /api/actions -> create + * GET /api/actions/:id -> show + * PUT /api/actions/:id -> update + * DELETE /api/actions/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var Action = require('../../models').Action; +var sequelize = require('../../models').sequelize; + +function handleError(res, err) { + return res.status(500).send(err); +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of Actions +exports.index = function(req, res) { + Action.findAll() + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single Action from the DB +exports.show = function(req, res) { + // Action.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(responseWithResult(res)) + // .catch(handleError(res)); +} + +// Creates a new Action in the DB +exports.create = function(req, res, next) { + req.body.UserId = req.user.id; + return sequelize.transaction().then(function(t) { + return Action + .create(_.merge(req.body, req.params), { + transaction: t, + body: req.body + }).then(function(action) { + t.commit(); + return res.status(201).send(action); + }).catch(function(err) { + t.rollback(); + console.log(err); + return handleError(res, err); + }); + }); +} + +// Updates an existing Action in the DB +exports.update = function(req, res) { + // if (req.body.id) { + // delete req.body.id; + // } + // Action.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(saveUpdates(req.body)) + // .then(responseWithResult(res)) + // .catch(handleError(res)); +} + +// Deletes a Action from the DB +exports.destroy = function(req, res) { + // Action.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(removeEntity(res)) + // .catch(handleError(res)); +} diff --git a/server/api/action/action.socket.js b/server/api/action/action.socket.js index 738937e..36c2faa 100644 --- a/server/api/action/action.socket.js +++ b/server/api/action/action.socket.js @@ -1 +1,24 @@ -var _0x911b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x41\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x41\x63\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x41\x63\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x911b[0];var Action=require(_0x911b[2])[_0x911b[1]];exports[_0x911b[3]]=function(_0x8b62x2){Action[_0x911b[4]](function(_0x8b62x3){onSave(_0x8b62x2,_0x8b62x3)});Action[_0x911b[5]](function(_0x8b62x3){onSave(_0x8b62x2,_0x8b62x3)})};function onSave(_0x8b62x2,_0x8b62x3,_0x8b62x5){_0x8b62x2[_0x911b[7]](_0x911b[6],_0x8b62x3)}function onRemove(_0x8b62x2,_0x8b62x3,_0x8b62x5){_0x8b62x2[_0x911b[7]](_0x911b[8],_0x8b62x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Action = require('../../models').Action; + +exports.register = function (socket) { + Action.afterCreate(function (doc) { + onSave(socket, doc); + }); + Action.afterUpdate(function (doc) { + onSave(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('Action:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('Action:remove', doc); +} diff --git a/server/api/action/index.js b/server/api/action/index.js index 8c29829..8a3909e 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -1 +1,19 @@ -var _0xbcc9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x61\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0xbcc9[0];var express=require(_0xbcc9[1]);var auth=require(_0xbcc9[2]);var controller=require(_0xbcc9[3]);var router=express.Router();router[_0xbcc9[7]](_0xbcc9[4],auth[_0xbcc9[5]](),controller[_0xbcc9[6]]);router[_0xbcc9[10]](_0xbcc9[8],auth[_0xbcc9[5]](),controller[_0xbcc9[9]]);module[_0xbcc9[11]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); + +var auth = require('../../auth/auth.service'); +var controller = require('./action.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +// router.get('/:id', auth.isAuthenticated(), controller.show); +// router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:name', auth.isAuthenticated(), controller.create); +// router.put('/:id', auth.isAuthenticated(), controller.update); +// router.patch('/:id', auth.isAuthenticated(), controller.update); +// router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/agent/agent.controller.js b/server/api/agent/agent.controller.js index ae71220..e5aa7d5 100644 --- a/server/api/agent/agent.controller.js +++ b/server/api/agent/agent.controller.js @@ -1 +1,152 @@ -var _0xae80=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x55\x73\x65\x72","\x54\x65\x61\x6D","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x63\x68\x65\x63\x6B\x50\x61\x75\x73\x65\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x4F\x6E\x6C\x69\x6E\x65\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x53\x69\x70\x53\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x4F\x6E\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x68\x61\x6E\x64\x6C\x65\x46\x6F\x72\x65\x69\x67\x6E\x4B\x65\x79\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xae80[0];var _=require(_0xae80[1]);var sequelize=require(_0xae80[3])[_0xae80[2]];var Util=require(_0xae80[4]);var Agent=require(_0xae80[3])[_0xae80[5]];var Team=require(_0xae80[3])[_0xae80[6]];var MailRoom=require(_0xae80[3])[_0xae80[7]];exports[_0xae80[8]]=function(_0xfda7x7,_0xfda7x8,_0xfda7x9){return Agent[_0xae80[22]](_0xae80[17],{method:[_0xae80[18],_0xfda7x7[_0xae80[14]]]},{method:[_0xae80[19],_0xfda7x7[_0xae80[14]]]},{method:[_0xae80[20],_0xfda7x7[_0xae80[14]]]},_0xae80[21])[_0xae80[16]](Util[_0xae80[15]](_0xfda7x7[_0xae80[14]]))[_0xae80[13]](function(_0xfda7xb){return _0xfda7x8[_0xae80[12]](200)[_0xae80[11]](_0xfda7xb)})[_0xae80[10]](function(_0xfda7xa){console[_0xae80[9]](_0xfda7xa);return handleError(_0xfda7x8,_0xfda7xa)})};exports[_0xae80[23]]=function(_0xfda7x7,_0xfda7x8){return Agent[_0xae80[22]](_0xae80[17])[_0xae80[27]](_0xfda7x7[_0xae80[26]][_0xae80[25]])[_0xae80[13]](function(_0xfda7xc){if(!_0xfda7xc){return _0xfda7x8[_0xae80[24]](404)};return _0xfda7x8[_0xae80[11]](_0xfda7xc)})[_0xae80[10]](function(_0xfda7xa){return handleError(_0xfda7x8,_0xfda7xa)})};exports[_0xae80[28]]=function(_0xfda7x7,_0xfda7x8){var _0xfda7xd;return Agent[_0xae80[22]](_0xae80[17])[_0xae80[28]](_0xfda7x7[_0xae80[33]])[_0xae80[13]](function(_0xfda7xc){_0xfda7xd=_0xfda7xc;return Team[_0xae80[32]]({where:{defaultEntry:true}})})[_0xae80[13]](function(_0xfda7xe){return _0xfda7xe[_0xae80[31]](_0xfda7xd[_0xae80[25]])})[_0xae80[13]](function(){return _0xfda7x8[_0xae80[12]](201)[_0xae80[11]](_0xfda7xd)})[_0xae80[10]](sequelize.UniqueConstraintError,function(_0xfda7xa){return Util[_0xae80[30]][_0xae80[29]](_0xfda7x8,_0xfda7xa)})[_0xae80[10]](function(_0xfda7xa){return handleError(_0xfda7x8,_0xfda7xa)})};exports[_0xae80[34]]=function(_0xfda7x7,_0xfda7x8){if(_0xfda7x7[_0xae80[33]][_0xae80[25]]){delete _0xfda7x7[_0xae80[33]][_0xae80[25]]};return Agent[_0xae80[27]](_0xfda7x7[_0xae80[26]][_0xae80[25]])[_0xae80[13]](function(_0xfda7xc){if(!_0xfda7xc){return _0xfda7x8[_0xae80[24]](404)};var _0xfda7xf=_[_0xae80[35]](_0xfda7xc,_0xfda7x7[_0xae80[33]]);return _0xfda7xf[_0xae80[36]]()})[_0xae80[13]](function(_0xfda7xc){return _0xfda7x8[_0xae80[12]](200)[_0xae80[11]](_0xfda7xc)})[_0xae80[10]](sequelize.UniqueConstraintError,function(_0xfda7xa){return Util[_0xae80[30]][_0xae80[29]](_0xfda7x8,_0xfda7xa)})[_0xae80[10]](function(_0xfda7xa){return handleError(_0xfda7x8,_0xfda7xa)})};exports[_0xae80[37]]=function(_0xfda7x7,_0xfda7x8){var _0xfda7xd;return Agent[_0xae80[27]](_0xfda7x7[_0xae80[26]][_0xae80[25]])[_0xae80[13]](function(_0xfda7xc){_0xfda7xd=_0xfda7xc;if(!_0xfda7xc){return _0xfda7x8[_0xae80[24]](404)};return _0xfda7xc[_0xae80[37]]()})[_0xae80[13]](function(){return _0xfda7x8[_0xae80[24]](204)})[_0xae80[10]](sequelize.ForeignKeyConstraintError,function(_0xfda7xa){return Util[_0xae80[30]][_0xae80[39]](_0xfda7x8,_0xae80[17],_0xfda7xd[_0xae80[38]],_0xfda7xa)})[_0xae80[10]](function(_0xfda7xa){return handleError(_0xfda7x8,_0xfda7xa)})};exports[_0xae80[40]]=function(_0xfda7x7,_0xfda7x8){return Agent[_0xae80[37]]({where:{id:_0xfda7x7[_0xae80[14]][_0xae80[41]]},individualHooks:true})[_0xae80[13]](function(){return _0xfda7x8[_0xae80[24]](204)})[_0xae80[10]](function(_0xfda7xa){return handleError(_0xfda7x8,_0xfda7xa)})};function handleError(_0xfda7x8,_0xfda7xa){return _0xfda7x8[_0xae80[12]](500)[_0xae80[11]](_0xfda7xa)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var sequelize = require('../../models').sequelize; + +var Util = require('../../config/util'); + +var Agent = require('../../models').User; +var Team = require('../../models').Team; +var MailRoom = require('../../models').MailRoom; + +// Get list of agents +exports.index = function(req, res, next) { + return Agent + .scope('agent', { + method: ['checkPauseStatus', req.query] + }, { + method: ['checkOnlineStatus', req.query] + }, { + method: ['checkSipStatus', req.query] + }, + 'queues') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + return res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get a single agent +exports.show = function(req, res) { + return Agent + .scope('agent') + .findById(req.params.id) + .then(function(agent) { + if (!agent) { + return res.sendStatus(404); + } + return res.send(agent); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new agent in the DB. +exports.create = function(req, res) { + var _agent; + + return Agent + .scope('agent') + .create(req.body) + .then(function(agent) { + _agent = agent; + + return Team + .findOne({ + where: { + defaultEntry: true + } + }); + }) + .then(function(team) { + return team + .addUser(_agent.id); + }) + .then(function() { + return res.status(201).send(_agent); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing agent in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return Agent + .findById(req.params.id) + .then(function(agent) { + if (!agent) { + return res.sendStatus(404); + } + var updated = _.merge(agent, req.body); + return updated + .save(); + }) + .then(function(agent) { + return res.status(200).send(agent); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.destroy = function(req, res) { + var _agent; + + return Agent + .findById(req.params.id) + .then(function(agent) { + _agent = agent; + if (!agent) { + return res.sendStatus(404); + } + return agent + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(sequelize.ForeignKeyConstraintError, function(err) { + return Util.errorManager.handleForeignKeyConstraintError(res, 'agent', _agent.name, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return Agent + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/agent/agent.socket.js b/server/api/agent/agent.socket.js index 223f027..5535cb7 100644 --- a/server/api/agent/agent.socket.js +++ b/server/api/agent/agent.socket.js @@ -1 +1,33 @@ -var _0x9901=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x67\x65\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x61\x67\x65\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x9901[0];var agent=require(_0x9901[2])[_0x9901[1]];exports[_0x9901[3]]=function(_0x5b3fx2){agent[_0x9901[6]](function(_0x5b3fx3){if(_0x5b3fx3[_0x9901[4]]===_0x9901[5]){onSave(_0x5b3fx2,_0x5b3fx3)}});agent[_0x9901[7]](function(_0x5b3fx3){if(_0x5b3fx3[_0x9901[4]]===_0x9901[5]){onSave(_0x5b3fx2,_0x5b3fx3)}});agent[_0x9901[8]](function(_0x5b3fx3){if(_0x5b3fx3[_0x9901[4]]===_0x9901[5]){onRemove(_0x5b3fx2,_0x5b3fx3)}})};function onSave(_0x5b3fx2,_0x5b3fx3,_0x5b3fx5){_0x5b3fx2[_0x9901[10]](_0x9901[9],_0x5b3fx3)}function onRemove(_0x5b3fx2,_0x5b3fx3,_0x5b3fx5){_0x5b3fx2[_0x9901[10]](_0x9901[11],_0x5b3fx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var agent = require('../../models').User; + +exports.register = function(socket) { + agent.afterCreate(function(doc) { + if (doc.role === 'agent') { + onSave(socket, doc); + } + }); + agent.afterUpdate(function(doc) { + if (doc.role === 'agent') { + onSave(socket, doc); + } + }); + agent.afterDestroy(function(doc) { + if (doc.role === 'agent') { + onRemove(socket, doc); + } + }); +} + +function onSave(socket, doc, cb) { + socket.emit('agent:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('agent:remove', doc); +} diff --git a/server/api/agent/index.js b/server/api/agent/index.js index a3e6327..ebfd805 100644 --- a/server/api/agent/index.js +++ b/server/api/agent/index.js @@ -1 +1,17 @@ -var _0x5553=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x61\x67\x65\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x5553[0];var express=require(_0x5553[1]);var controller=require(_0x5553[2]);var auth=require(_0x5553[3]);var router=express.Router();router[_0x5553[7]](_0x5553[4],auth[_0x5553[5]](),controller[_0x5553[6]]);router[_0x5553[7]](_0x5553[8],auth[_0x5553[5]](),controller[_0x5553[9]]);router[_0x5553[11]](_0x5553[4],auth[_0x5553[5]](),controller[_0x5553[10]]);router[_0x5553[13]](_0x5553[8],auth[_0x5553[5]](),controller[_0x5553[12]]);router[_0x5553[14]](_0x5553[8],auth[_0x5553[5]](),controller[_0x5553[12]]);router[_0x5553[16]](_0x5553[4],auth[_0x5553[5]](),controller[_0x5553[15]]);router[_0x5553[16]](_0x5553[8],auth[_0x5553[5]](),controller[_0x5553[17]]);module[_0x5553[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./agent.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/ami/ami.ami.js b/server/api/ami/ami.ami.js index 39048f1..2684197 100644 --- a/server/api/ami/ami.ami.js +++ b/server/api/ami/ami.ami.js @@ -1 +1,37 @@ -var _0x3747=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x41\x6D\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x61\x73\x79\x6E\x63","\x6C\x6F\x64\x61\x73\x68","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x6D\x69","\x61\x63\x74\x69\x6F\x6E","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x6D\x65\x72\x67\x65","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65","\x41\x73\x74\x65\x72\x69\x73\x6B\x20\x4D\x61\x6E\x61\x67\x65\x72\x20\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x2E\x2E"];_0x3747[0];var Ami=require(_0x3747[2])[_0x3747[1]];var async=require(_0x3747[3]);var _=require(_0x3747[4]);var ami=null;exports[_0x3747[5]]=function(ami){this[_0x3747[6]]=ami};exports[_0x3747[7]]=function(_0x9aefx5,_0x9aefx6){if(this[_0x3747[6]]&&this[_0x3747[6]][_0x3747[8]]()){this[_0x3747[6]][_0x3747[7]](_0x9aefx5,function(_0x9aefx7,_0x9aefx8){if(_0x9aefx7){_0x9aefx6(_0x9aefx7)};var _0x9aefx9=_[_0x3747[9]](_0x9aefx8,_0x9aefx5);Ami[_0x3747[12]](_0x9aefx9)[_0x3747[11]](function(ami){_0x9aefx6(null,ami)})[_0x3747[10]](function(_0x9aefx7){return _0x9aefx6(_0x9aefx7)})})}else {_0x9aefx6( new Error(_0x3747[13]))}} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Ami = require('../../models').Ami; +var async = require('async'); +var _ = require('lodash'); + +var ami = null; + +exports.register = function(ami) { + this.ami = ami; +} + +exports.action = function(action, cb) { + if (this.ami && this.ami.isConnected()) { + this.ami.action(action, function(err, res) { + if (err) { + cb(err); + } + var data = _.merge(res, action); + Ami + .create(data) + .then(function(ami) { + cb(null, ami) + }) + .catch(function(err) { + return cb(err); + }); + + }); + } else { + cb(new Error('Asterisk Manager disconnected..')); + } +} diff --git a/server/api/ami/ami.controller.js b/server/api/ami/ami.controller.js index dbb160a..dc409ab 100644 --- a/server/api/ami/ami.controller.js +++ b/server/api/ami/ami.controller.js @@ -1 +1,101 @@ -var _0x93ed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x41\x6D\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x64\x61\x74\x61","\x62\x6F\x64\x79","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x55\x73\x65\x72\x49\x64","\x75\x73\x65\x72","\x61\x63\x74\x69\x6F\x6E","\x2E\x2F\x61\x6D\x69\x2E\x61\x6D\x69","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64"];_0x93ed[0];var _=require(_0x93ed[1]);var Ami=require(_0x93ed[3])[_0x93ed[2]];exports[_0x93ed[4]]=function(_0xa01ax3,_0xa01ax4){Ami[_0x93ed[9]]()[_0x93ed[8]](function(_0xa01ax6){return _0xa01ax4[_0x93ed[7]](200)[_0x93ed[6]](_0xa01ax6)})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})};exports[_0x93ed[10]]=function(_0xa01ax3,_0xa01ax4){Ami[_0x93ed[14]](_0xa01ax3[_0x93ed[13]][_0x93ed[12]])[_0x93ed[8]](function(_0xa01ax7){if(!_0xa01ax7){return _0xa01ax4[_0x93ed[11]](404)};return _0xa01ax4[_0x93ed[6]](_0xa01ax7)})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})};exports[_0x93ed[15]]=function(_0xa01ax3,_0xa01ax4){_0xa01ax3[_0x93ed[17]][_0x93ed[16]]=JSON[_0x93ed[18]](_0xa01ax3[_0x93ed[17]]);_0xa01ax3[_0x93ed[17]][_0x93ed[19]]=_0xa01ax3[_0x93ed[20]][_0x93ed[12]];require(_0x93ed[22])[_0x93ed[21]](_0xa01ax3[_0x93ed[17]],function(_0xa01ax5,_0xa01ax8){if(_0xa01ax5){handleError(_0xa01ax4,_0xa01ax5)}else {return _0xa01ax4[_0x93ed[7]](201)[_0x93ed[6]](_0xa01ax8)}})};exports[_0x93ed[23]]=function(_0xa01ax3,_0xa01ax4){if(_0xa01ax3[_0x93ed[17]][_0x93ed[12]]){delete _0xa01ax3[_0x93ed[17]][_0x93ed[12]]};Ami[_0x93ed[14]](_0xa01ax3[_0x93ed[13]][_0x93ed[12]])[_0x93ed[8]](function(_0xa01ax7){if(!_0xa01ax7){return _0xa01ax4[_0x93ed[11]](404)};var _0xa01ax9=_[_0x93ed[24]](_0xa01ax7,_0xa01ax3[_0x93ed[17]]);_0xa01ax9[_0x93ed[25]]()[_0x93ed[8]](function(){return _0xa01ax4[_0x93ed[7]](200)[_0x93ed[6]](_0xa01ax7)})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})};exports[_0x93ed[26]]=function(_0xa01ax3,_0xa01ax4){Ami[_0x93ed[27]]({where:{id:_0xa01ax3[_0x93ed[13]][_0x93ed[12]]}})[_0x93ed[8]](function(_0xa01ax7){if(!_0xa01ax7){return _0xa01ax4[_0x93ed[11]](404)};_0xa01ax7[_0x93ed[26]]()[_0x93ed[8]](function(){return _0xa01ax4[_0x93ed[11]](204)})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})})[_0x93ed[5]](function(_0xa01ax5){return handleError(_0xa01ax4,_0xa01ax5)})};function handleError(_0xa01ax4,_0xa01ax5){return _0xa01ax4[_0x93ed[7]](500)[_0x93ed[6]](_0xa01ax5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Ami = require('../../models').Ami; + +// Get list of amis +exports.index = function(req, res) { + Ami + .findAll() + .then(function(amis) { + return res.status(200).send(amis); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single ami +exports.show = function(req, res) { + Ami + .findById(req.params.id) + .then(function(ami) { + if (!ami) { + return res.sendStatus(404); + } + return res.send(ami); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new ami in the DB. +exports.create = function(req, res) { + + req.body.data = JSON.stringify(req.body); + req.body.UserId = req.user.id; + + require('./ami.ami').action(req.body, function(err, result) { + if (err) { + handleError(res, err); + } else { + return res.status(201).send(result); + } + }); + +}; + +// Updates an existing ami in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Ami + .findById(req.params.id) + .then(function(ami) { + if (!ami) { + return res.sendStatus(404); + } + var updated = _.merge(ami, req.body); + updated.save() + .then(function() { + return res.status(200).send(ami); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a ami from the DB. +exports.destroy = function(req, res) { + Ami + .find({ + where: { + id: req.params.id + } + }) + .then(function(ami) { + if (!ami) { + return res.sendStatus(404); + } + ami.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/ami/ami.socket.js b/server/api/ami/ami.socket.js index 89060f8..6047274 100644 --- a/server/api/ami/ami.socket.js +++ b/server/api/ami/ami.socket.js @@ -1 +1,24 @@ -var _0xd59d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x41\x6D\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x6D\x69\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x61\x6D\x69\x3A\x72\x65\x6D\x6F\x76\x65"];_0xd59d[0];var Ami=require(_0xd59d[2])[_0xd59d[1]];exports[_0xd59d[3]]=function(_0xa30fx2){Ami[_0xd59d[4]](function(_0xa30fx3){onSave(_0xa30fx2,_0xa30fx3)});Ami[_0xd59d[5]](function(_0xa30fx3){onRemove(_0xa30fx2,_0xa30fx3)})};function onSave(_0xa30fx2,_0xa30fx3,_0xa30fx5){_0xa30fx2[_0xd59d[7]](_0xd59d[6],_0xa30fx3)}function onRemove(_0xa30fx2,_0xa30fx3,_0xa30fx5){_0xa30fx2[_0xd59d[7]](_0xd59d[8],_0xa30fx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Ami = require('../../models').Ami; + +exports.register = function(socket) { + Ami.afterCreate(function (doc) { + onSave(socket, doc); + }); + Ami.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('ami:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('ami:remove', doc); +} diff --git a/server/api/ami/ami.spec.js b/server/api/ami/ami.spec.js index 69a54d3..a7502d7 100644 --- a/server/api/ami/ami.spec.js +++ b/server/api/ami/ami.spec.js @@ -1 +1,20 @@ -var _0x3eca=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6D\x69","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6D\x69","\x67\x65\x74"];_0x3eca[0];var should=require(_0x3eca[1]);var app=require(_0x3eca[2]);var request=require(_0x3eca[3]);describe(_0x3eca[4],function(){it(_0x3eca[5],function(_0xf175x4){request(app)[_0x3eca[13]](_0x3eca[12])[_0x3eca[11]](200)[_0x3eca[11]](_0x3eca[10],/json/)[_0x3eca[9]](function(_0xf175x5,_0xf175x6){if(_0xf175x5){return _0xf175x4(_0xf175x5)};_0xf175x6[_0x3eca[8]][_0x3eca[1]][_0x3eca[7]][_0x3eca[6]](Array);_0xf175x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/ami', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/ami') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/ami/index.js b/server/api/ami/index.js index a02fd0b..b926b75 100644 --- a/server/api/ami/index.js +++ b/server/api/ami/index.js @@ -1 +1,16 @@ -var _0x2727=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x61\x6D\x69\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x2727[0];var express=require(_0x2727[1]);var controller=require(_0x2727[2]);var auth=require(_0x2727[3]);var router=express.Router();router[_0x2727[7]](_0x2727[4],auth[_0x2727[5]](),controller[_0x2727[6]]);router[_0x2727[9]](_0x2727[4],auth[_0x2727[5]](),controller[_0x2727[8]]);module[_0x2727[10]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./ami.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +// router.get('/:id', controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +// router.put('/:id', controller.update); +// router.patch('/:id', controller.update); +// router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 77fdce9..762c4c9 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -1 +1,200 @@ -var _0xc39d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x54\x6F\x6F\x6C\x73\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x54\x6F\x6F\x6C\x73\x41\x63\x74\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x41\x6C\x6C","\x41\x6E\x79","\x41\x63\x74\x69\x6F\x6E\x73","\x75\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x49\x64","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x41\x6C\x6C\x49\x64","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x41\x6E\x79\x49\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0xc39d[0];var _=require(_0xc39d[1]);var util=require(_0xc39d[2]);var Util=require(_0xc39d[3]);var sequelize=require(_0xc39d[5])[_0xc39d[4]];var Automation=require(_0xc39d[5])[_0xc39d[6]];var ToolsCondition=require(_0xc39d[5])[_0xc39d[7]];var ToolsAction=require(_0xc39d[5])[_0xc39d[8]];exports[_0xc39d[9]]=function(_0x7036x8,_0x7036x9,_0x7036xa){return Automation[_0xc39d[18]](_0xc39d[17])[_0xc39d[16]](Util[_0xc39d[15]](_0x7036x8[_0xc39d[14]]))[_0xc39d[13]](function(_0x7036xc){_0x7036x9[_0xc39d[12]](200)[_0xc39d[11]](_0x7036xc)})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})};exports[_0xc39d[19]]=function(_0x7036x8,_0x7036x9){Automation[_0xc39d[18]](_0xc39d[17])[_0xc39d[23]](_0x7036x8[_0xc39d[22]][_0xc39d[21]])[_0xc39d[13]](function(Automation){if(!Automation){return _0x7036x9[_0xc39d[20]](404)};return _0x7036x9[_0xc39d[11]](Automation)})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})};exports[_0xc39d[24]]=function(_0x7036x8,_0x7036x9,_0x7036xa){Automation[_0xc39d[24]](_0x7036x8[_0xc39d[25]],{include:[{model:ToolsCondition,as:_0xc39d[26]},{model:ToolsCondition,as:_0xc39d[27]},{model:ToolsAction,as:_0xc39d[28]}]})[_0xc39d[13]](function(){return _0x7036x9[_0xc39d[20]](201)})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})};exports[_0xc39d[29]]=function(_0x7036x8,_0x7036x9,_0x7036xa){var _0x7036xd;if(_0x7036x8[_0xc39d[25]][_0xc39d[21]]){delete _0x7036x8[_0xc39d[25]][_0xc39d[21]]};return sequelize[_0xc39d[41]](function(_0x7036xe){return Automation[_0xc39d[23]](_0x7036x8[_0xc39d[22]][_0xc39d[21]])[_0xc39d[13]](function(_0x7036x10){if(!_0x7036x10){return _0x7036x9[_0xc39d[20]](404)};var _0x7036x11=_[_0xc39d[39]](_0x7036x10,_0x7036x8[_0xc39d[25]]);return _0x7036x11[_0xc39d[40]]({transaction:_0x7036xe})})[_0xc39d[13]](function(_0x7036x10){_0x7036xd=_0x7036x10;if(_0x7036x8[_0xc39d[25]][_0xc39d[27]]){return ToolsCondition[_0xc39d[36]]({where:{AutomationAnyId:_0x7036x8[_0xc39d[22]][_0xc39d[21]]},transaction:_0x7036xe})}})[_0xc39d[13]](function(){if(_0x7036x8[_0xc39d[25]][_0xc39d[27]]&&Array[_0xc39d[31]](_0x7036x8[_0xc39d[25]].Any)&&_0x7036x8[_0xc39d[25]][_0xc39d[27]][_0xc39d[32]]){_[_0xc39d[34]](_0x7036x8[_0xc39d[25]].Any,function(_0x7036xf){_0x7036xf[_0xc39d[38]]=_0x7036x8[_0xc39d[22]][_0xc39d[21]]});return ToolsCondition[_0xc39d[35]](_0x7036x8[_0xc39d[25]].Any,{transaction:_0x7036xe})}})[_0xc39d[13]](function(){if(_0x7036x8[_0xc39d[25]][_0xc39d[26]]){return ToolsCondition[_0xc39d[36]]({where:{AutomationAllId:_0x7036x8[_0xc39d[22]][_0xc39d[21]]},transaction:_0x7036xe})}})[_0xc39d[13]](function(){if(_0x7036x8[_0xc39d[25]][_0xc39d[26]]&&Array[_0xc39d[31]](_0x7036x8[_0xc39d[25]].All)&&_0x7036x8[_0xc39d[25]][_0xc39d[26]][_0xc39d[32]]){_[_0xc39d[34]](_0x7036x8[_0xc39d[25]].All,function(_0x7036xf){_0x7036xf[_0xc39d[37]]=_0x7036x8[_0xc39d[22]][_0xc39d[21]]});return ToolsCondition[_0xc39d[35]](_0x7036x8[_0xc39d[25]].All,{transaction:_0x7036xe})}})[_0xc39d[13]](function(){if(_0x7036x8[_0xc39d[25]][_0xc39d[28]]){return ToolsAction[_0xc39d[36]]({where:{AutomationId:_0x7036x8[_0xc39d[22]][_0xc39d[21]]},transaction:_0x7036xe})}})[_0xc39d[13]](function(){if(_0x7036x8[_0xc39d[25]][_0xc39d[28]]&&Array[_0xc39d[31]](_0x7036x8[_0xc39d[25]].Actions)&&_0x7036x8[_0xc39d[25]][_0xc39d[28]][_0xc39d[32]]){_[_0xc39d[34]](_0x7036x8[_0xc39d[25]].Actions,function(_0x7036xf){_0x7036xf[_0xc39d[33]]=_0x7036x8[_0xc39d[22]][_0xc39d[21]]});return ToolsAction[_0xc39d[35]](_0x7036x8[_0xc39d[25]].Actions,{transaction:_0x7036xe})}})})[_0xc39d[13]](function(){return _0x7036x9[_0xc39d[20]](200)})[_0xc39d[10]](function(_0x7036xb){console[_0xc39d[30]](_0x7036xb);return handleError(_0x7036x9,_0x7036xb)})};exports[_0xc39d[36]]=function(_0x7036x8,_0x7036x9){Automation[_0xc39d[23]](_0x7036x8[_0xc39d[22]][_0xc39d[21]])[_0xc39d[13]](function(Automation){if(!Automation){return _0x7036x9[_0xc39d[20]](404)};Automation[_0xc39d[36]]()[_0xc39d[13]](function(){return _0x7036x9[_0xc39d[20]](204)})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})};exports[_0xc39d[42]]=function(_0x7036x8,_0x7036x9){Automation[_0xc39d[36]]({where:{id:_0x7036x8[_0xc39d[14]][_0xc39d[21]]},individualHooks:true})[_0xc39d[13]](function(){return _0x7036x9[_0xc39d[20]](204)})[_0xc39d[10]](function(_0x7036xb){return handleError(_0x7036x9,_0x7036xb)})};function handleError(_0x7036x9,_0x7036xb){return _0x7036x9[_0xc39d[12]](500)[_0xc39d[11]](_0x7036xb)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Util = require('../../config/util'); +var sequelize = require('../../models').sequelize; + +var Automation = require('../../models').Automation; +var ToolsCondition = require('../../models').ToolsCondition; +var ToolsAction = require('../../models').ToolsAction; + +// Get list of agents +exports.index = function(req, res, next) { + return Automation + .scope('all') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single Automation +exports.show = function(req, res) { + Automation + .scope('all') + .findById(req.params.id) + .then(function(Automation) { + if (!Automation) { + return res.sendStatus(404); + } + return res.send(Automation); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new Automation in the DB. +exports.create = function(req, res, next) { + Automation + .create(req.body, { + include: [{ + model: ToolsCondition, + as: 'All' + }, { + model: ToolsCondition, + as: 'Any' + }, { + model: ToolsAction, + as: 'Actions' + }] + }) + .then(function() { + return res.sendStatus(201); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing Automation in the DB. +exports.update = function(req, res, next) { + var _automation; + if (req.body.id) { + delete req.body.id; + } + return sequelize.transaction(function(t) { + return Automation + .findById(req.params.id) + .then(function(automation) { + if (!automation) { + return res.sendStatus(404); + } + var updated = _.merge(automation, req.body); + return updated + .save({ + transaction: t + }); + }) + .then(function(automation) { + _automation = automation; + if (req.body.Any) { + return ToolsCondition + .destroy({ + where: { + AutomationAnyId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.Any && Array.isArray(req.body.Any) && req.body.Any.length) { + _.forEach(req.body.Any, function(elem) { + elem.AutomationAnyId = req.params.id; + }); + return ToolsCondition + .bulkCreate(req.body.Any, { + transaction: t + }); + } + }) + .then(function() { + if (req.body.All) { + return ToolsCondition + .destroy({ + where: { + AutomationAllId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.All && Array.isArray(req.body.All) && req.body.All.length) { + _.forEach(req.body.All, function(elem) { + elem.AutomationAllId = req.params.id; + }); + return ToolsCondition + .bulkCreate(req.body.All, { + transaction: t + }); + } + }) + .then(function() { + if (req.body.Actions) { + return ToolsAction + .destroy({ + where: { + AutomationId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.Actions && Array.isArray(req.body.Actions) && req.body.Actions.length) { + _.forEach(req.body.Actions, function(elem) { + elem.AutomationId = req.params.id; + }); + return ToolsAction + .bulkCreate(req.body.Actions, { + transaction: t + }); + } + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + + +// Deletes a Automation from the DB. +exports.destroy = function(req, res) { + Automation + .findById(req.params.id) + .then(function(Automation) { + if (!Automation) { + return res.sendStatus(404); + } + Automation.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +exports.bulkDestroy = function(req, res) { + Automation + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/automation/automation.socket.js b/server/api/automation/automation.socket.js index e3bb830..2c55b60 100644 --- a/server/api/automation/automation.socket.js +++ b/server/api/automation/automation.socket.js @@ -1 +1,24 @@ -var _0xd4f5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xd4f5[0];var Automation=require(_0xd4f5[2])[_0xd4f5[1]];exports[_0xd4f5[3]]=function(_0x86aax2){Automation[_0xd4f5[4]](function(_0x86aax3){onSave(_0x86aax2,_0x86aax3)});Automation[_0xd4f5[5]](function(_0x86aax3){onRemove(_0x86aax2,_0x86aax3)})};function onSave(_0x86aax2,_0x86aax3,_0x86aax5){_0x86aax2[_0xd4f5[7]](_0xd4f5[6],_0x86aax3)}function onRemove(_0x86aax2,_0x86aax3,_0x86aax5){_0x86aax2[_0xd4f5[7]](_0xd4f5[8],_0x86aax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Automation = require('../../models').Automation; + +exports.register = function(socket) { + Automation.afterCreate(function(doc) { + onSave(socket, doc); + }); + Automation.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('automation:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('automation:remove', doc); +} diff --git a/server/api/automation/automation.spec.js b/server/api/automation/automation.spec.js index 30c39d6..ab8c5b4 100644 --- a/server/api/automation/automation.spec.js +++ b/server/api/automation/automation.spec.js @@ -1 +1,20 @@ -var _0xb565=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0xb565[0];var should=require(_0xb565[1]);var app=require(_0xb565[2]);var request=require(_0xb565[3]);describe(_0xb565[4],function(){it(_0xb565[5],function(_0x2e3fx4){request(app)[_0xb565[13]](_0xb565[12])[_0xb565[11]](200)[_0xb565[11]](_0xb565[10],/json/)[_0xb565[9]](function(_0x2e3fx5,_0x2e3fx6){if(_0x2e3fx5){return _0x2e3fx4(_0x2e3fx5)};_0x2e3fx6[_0xb565[8]][_0xb565[1]][_0xb565[7]][_0xb565[6]](Array);_0x2e3fx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/automations', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/automations') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c0fe121..98acf5a 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -1 +1,17 @@ -var _0xf273=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xf273[0];var express=require(_0xf273[1]);var controller=require(_0xf273[2]);var auth=require(_0xf273[3]);var router=express.Router();router[_0xf273[7]](_0xf273[4],auth[_0xf273[5]](),controller[_0xf273[6]]);router[_0xf273[7]](_0xf273[8],auth[_0xf273[5]](),controller[_0xf273[9]]);router[_0xf273[11]](_0xf273[4],auth[_0xf273[5]](),controller[_0xf273[10]]);router[_0xf273[13]](_0xf273[8],auth[_0xf273[5]](),controller[_0xf273[12]]);router[_0xf273[14]](_0xf273[8],auth[_0xf273[5]](),controller[_0xf273[12]]);router[_0xf273[16]](_0xf273[8],auth[_0xf273[5]](),controller[_0xf273[15]]);router[_0xf273[16]](_0xf273[4],auth[_0xf273[5]](),controller[_0xf273[17]]);module[_0xf273[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./automation.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); + +module.exports = router; diff --git a/server/api/canned_answer/canned_answer.controller.js b/server/api/canned_answer/canned_answer.controller.js index 01f0dc6..2078d7a 100644 --- a/server/api/canned_answer/canned_answer.controller.js +++ b/server/api/canned_answer/canned_answer.controller.js @@ -1 +1,128 @@ -var _0x107c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x61\x6E\x6E\x65\x64\x41\x6E\x73\x77\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64\x73"];_0x107c[0];var _=require(_0x107c[1]);var Util=require(_0x107c[2]);var CannedAnswer=require(_0x107c[4])[_0x107c[3]];function handleError(_0x5057x5,_0x5057x6){_0x5057x6=_0x5057x6||500;return function(_0x5057x7){_0x5057x5[_0x107c[6]](_0x5057x6)[_0x107c[5]](_0x5057x7)}}function responseWithResult(_0x5057x5,_0x5057x6){_0x5057x6=_0x5057x6||200;return function(_0x5057x9){if(_0x5057x9){_0x5057x5[_0x107c[6]](_0x5057x6)[_0x107c[7]](_0x5057x9)}}}function handleEntityNotFound(_0x5057x5){return function(_0x5057x9){if(!_0x5057x9){_0x5057x5[_0x107c[6]](404)[_0x107c[8]]();return null};return _0x5057x9}}function saveUpdates(_0x5057xc){return function(_0x5057x9){return _0x5057x9[_0x107c[10]](_0x5057xc)[_0x107c[9]](function(_0x5057xd){return _0x5057xd})}}function removeEntity(_0x5057x5){return function(_0x5057x9){if(_0x5057x9){return _0x5057x9[_0x107c[11]]()[_0x107c[9]](function(){_0x5057x5[_0x107c[6]](204)[_0x107c[8]]()})}}}exports[_0x107c[12]]=function(_0x5057xf,_0x5057x5,_0x5057x10){return CannedAnswer[_0x107c[17]](Util[_0x107c[16]](_0x5057xf[_0x107c[15]]))[_0x107c[9]](function(_0x5057x11){_0x5057x5[_0x107c[6]](200)[_0x107c[5]](_0x5057x11)})[_0x107c[14]](function(_0x5057x7){console[_0x107c[13]](_0x5057x7);return handleError(_0x5057x5,_0x5057x7)})};exports[_0x107c[18]]=function(_0x5057xf,_0x5057x5){CannedAnswer[_0x107c[21]](_0x5057xf[_0x107c[20]][_0x107c[19]])[_0x107c[9]](handleEntityNotFound(_0x5057x5))[_0x107c[9]](responseWithResult(_0x5057x5))[_0x107c[14]](handleError(_0x5057x5))};exports[_0x107c[22]]=function(_0x5057xf,_0x5057x5){CannedAnswer[_0x107c[22]](_0x5057xf[_0x107c[23]])[_0x107c[9]](responseWithResult(_0x5057x5,201))[_0x107c[14]](handleError(_0x5057x5))};exports[_0x107c[24]]=function(_0x5057xf,_0x5057x5){if(_0x5057xf[_0x107c[23]][_0x107c[19]]){delete _0x5057xf[_0x107c[23]][_0x107c[19]]};CannedAnswer[_0x107c[21]](_0x5057xf[_0x107c[20]][_0x107c[19]])[_0x107c[9]](handleEntityNotFound(_0x5057x5))[_0x107c[9]](saveUpdates(_0x5057xf[_0x107c[23]]))[_0x107c[9]](responseWithResult(_0x5057x5))[_0x107c[14]](handleError(_0x5057x5))};exports[_0x107c[11]]=function(_0x5057xf,_0x5057x5){CannedAnswer[_0x107c[21]](_0x5057xf[_0x107c[20]][_0x107c[19]])[_0x107c[9]](handleEntityNotFound(_0x5057x5))[_0x107c[9]](removeEntity(_0x5057x5))[_0x107c[14]](handleError(_0x5057x5))};exports[_0x107c[25]]=function(_0x5057xf,_0x5057x5){return CannedAnswer[_0x107c[11]]({where:{id:_0x5057xf[_0x107c[15]][_0x107c[27]]},individualHooks:true})[_0x107c[9]](function(){return _0x5057x5[_0x107c[26]](204)})[_0x107c[14]](function(_0x5057x7){return handleError(_0x5057x5,_0x5057x7)})} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/answers -> index + * POST /api/answers -> create + * GET /api/answers/:id -> show + * PUT /api/answers/:id -> update + * DELETE /api/answers/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var CannedAnswer = require('../../models').CannedAnswer; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Get list of agents +exports.index = function(req, res, next) { + return CannedAnswer + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Gets a single CannedAnswer from the DB +exports.show = function(req, res) { + CannedAnswer.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new CannedAnswer in the DB +exports.create = function(req, res) { + CannedAnswer.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing CannedAnswer in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + CannedAnswer.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a CannedAnswer from the DB +exports.destroy = function(req, res) { + CannedAnswer.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return CannedAnswer + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; diff --git a/server/api/canned_answer/canned_answer.socket.js b/server/api/canned_answer/canned_answer.socket.js index c172bfb..1998ba4 100644 --- a/server/api/canned_answer/canned_answer.socket.js +++ b/server/api/canned_answer/canned_answer.socket.js @@ -1 +1,24 @@ -var _0x136c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x61\x6E\x6E\x65\x64\x41\x6E\x73\x77\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0x136c[0];var CannedAnswer=require(_0x136c[2])[_0x136c[1]];exports[_0x136c[3]]=function(_0x340ex2){CannedAnswer[_0x136c[4]](function(_0x340ex3){onSave(_0x340ex2,_0x340ex3)});CannedAnswer[_0x136c[5]](function(_0x340ex3){onRemove(_0x340ex2,_0x340ex3)})};function onSave(_0x340ex2,_0x340ex3,_0x340ex5){_0x340ex2[_0x136c[7]](_0x136c[6],_0x340ex3)}function onRemove(_0x340ex2,_0x340ex3,_0x340ex5){_0x340ex2[_0x136c[7]](_0x136c[8],_0x340ex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var CannedAnswer = require('../../models').CannedAnswer; + +exports.register = function(socket) { + CannedAnswer.afterCreate(function(doc) { + onSave(socket, doc); + }); + CannedAnswer.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('canned_answer:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('canned_answer:remove', doc); +} diff --git a/server/api/canned_answer/index.js b/server/api/canned_answer/index.js index c4e2ebc..b9d0dcd 100644 --- a/server/api/canned_answer/index.js +++ b/server/api/canned_answer/index.js @@ -1 +1,18 @@ -var _0x29ef=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x29ef[0];var express=require(_0x29ef[1]);var auth=require(_0x29ef[2]);var controller=require(_0x29ef[3]);var router=express.Router();router[_0x29ef[7]](_0x29ef[4],auth[_0x29ef[5]](),controller[_0x29ef[6]]);router[_0x29ef[7]](_0x29ef[8],auth[_0x29ef[5]](),controller[_0x29ef[9]]);router[_0x29ef[11]](_0x29ef[4],auth[_0x29ef[5]](),controller[_0x29ef[10]]);router[_0x29ef[13]](_0x29ef[8],auth[_0x29ef[5]](),controller[_0x29ef[12]]);router[_0x29ef[14]](_0x29ef[8],auth[_0x29ef[5]](),controller[_0x29ef[12]]);router[_0x29ef[16]](_0x29ef[4],auth[_0x29ef[5]](),controller[_0x29ef[15]]);router[_0x29ef[16]](_0x29ef[8],auth[_0x29ef[5]](),controller[_0x29ef[17]]);module[_0x29ef[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./canned_answer.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/chanspy/chanspy.controller.js b/server/api/chanspy/chanspy.controller.js index ac84376..e3dafb3 100644 --- a/server/api/chanspy/chanspy.controller.js +++ b/server/api/chanspy/chanspy.controller.js @@ -1 +1,107 @@ -var _0x16da=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x68\x61\x6E\x53\x70\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x16da[0];var _=require(_0x16da[1]);var ChanSpy=require(_0x16da[3])[_0x16da[2]];var Util=require(_0x16da[4]);exports[_0x16da[5]]=function(_0x3cb4x4,_0x3cb4x5,_0x3cb4x6){return ChanSpy[_0x16da[13]](Util[_0x16da[12]](_0x3cb4x4[_0x16da[11]]))[_0x16da[10]](function(_0x3cb4x8){_0x3cb4x5[_0x16da[9]](200)[_0x16da[8]](_0x3cb4x8)})[_0x16da[7]](function(_0x3cb4x7){console[_0x16da[6]](_0x3cb4x7);return handleError(_0x3cb4x5,_0x3cb4x7)})};exports[_0x16da[14]]=function(_0x3cb4x4,_0x3cb4x5){return ChanSpy[_0x16da[18]](_0x3cb4x4[_0x16da[17]][_0x16da[16]])[_0x16da[10]](function(_0x3cb4x9){if(!_0x3cb4x9){return _0x3cb4x5[_0x16da[15]](404)};return _0x3cb4x5[_0x16da[8]](_0x3cb4x9)})[_0x16da[7]](function(_0x3cb4x7){return handleError(_0x3cb4x5,_0x3cb4x7)})};exports[_0x16da[19]]=function(_0x3cb4x4,_0x3cb4x5){return ChanSpy[_0x16da[19]](_0x3cb4x4[_0x16da[20]])[_0x16da[10]](function(_0x3cb4x9){return _0x3cb4x5[_0x16da[9]](201)[_0x16da[8]](_0x3cb4x9)})[_0x16da[7]](function(_0x3cb4x7){return handleError(_0x3cb4x5,_0x3cb4x7)})};exports[_0x16da[21]]=function(_0x3cb4x4,_0x3cb4x5){if(_0x3cb4x4[_0x16da[20]][_0x16da[16]]){delete _0x3cb4x4[_0x16da[20]][_0x16da[16]]};return ChanSpy[_0x16da[18]](_0x3cb4x4[_0x16da[17]][_0x16da[16]])[_0x16da[10]](function(_0x3cb4x9){if(!_0x3cb4x9){return _0x3cb4x5[_0x16da[15]](404)};var _0x3cb4xa=_[_0x16da[22]](_0x3cb4x9,_0x3cb4x4[_0x16da[20]]);return _0x3cb4xa[_0x16da[23]]()})[_0x16da[10]](function(_0x3cb4x9){return _0x3cb4x5[_0x16da[9]](200)[_0x16da[8]](_0x3cb4x9)})[_0x16da[7]](function(_0x3cb4x7){return handleError(_0x3cb4x5,_0x3cb4x7)})};exports[_0x16da[24]]=function(_0x3cb4x4,_0x3cb4x5){return ChanSpy[_0x16da[18]](_0x3cb4x4[_0x16da[17]][_0x16da[16]])[_0x16da[10]](function(_0x3cb4x9){if(!_0x3cb4x9){return _0x3cb4x5[_0x16da[15]](404)};return _0x3cb4x9[_0x16da[24]]()})[_0x16da[10]](function(){return _0x3cb4x5[_0x16da[15]](204)})[_0x16da[7]](function(_0x3cb4x7){return handleError(_0x3cb4x5,_0x3cb4x7)})};exports[_0x16da[25]]=function(_0x3cb4x4,_0x3cb4x5){return ChanSpy[_0x16da[24]]({where:{id:_0x3cb4x4[_0x16da[11]][_0x16da[26]]},individualHooks:true})[_0x16da[10]](function(){return _0x3cb4x5[_0x16da[15]](204)})[_0x16da[7]](function(_0x3cb4x7){return handleError(_0x3cb4x5,_0x3cb4x7)})};function handleError(_0x3cb4x5,_0x3cb4x7){return _0x3cb4x5[_0x16da[9]](500)[_0x16da[8]](_0x3cb4x7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ChanSpy = require('../../models').ChanSpy; +var Util = require('../../config/util'); + +// Get list of chanspy +exports.index = function(req, res, next) { + return ChanSpy + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get a single chanspy +exports.show = function(req, res) { + return ChanSpy + .findById(req.params.id) + .then(function(chanspy) { + if (!chanspy) { + return res.sendStatus(404); + } + return res.send(chanspy); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new chanspy in the DB. +exports.create = function(req, res) { + return ChanSpy + .create(req.body) + .then(function(chanspy) { + return res.status(201).send(chanspy); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing chanspy in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return ChanSpy + .findById(req.params.id) + .then(function(chanspy) { + if (!chanspy) { + return res.sendStatus(404); + } + var updated = _.merge(chanspy, req.body); + return updated + .save(); + }) + .then(function(chanspy) { + return res.status(200).send(chanspy); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a chanspy from the DB. +exports.destroy = function(req, res) { + return ChanSpy + .findById(req.params.id) + .then(function(chanspy) { + if (!chanspy) { + return res.sendStatus(404); + } + return chanspy.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + return ChanSpy + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chanspy/chanspy.socket.js b/server/api/chanspy/chanspy.socket.js index 5c58e38..9fb1324 100644 --- a/server/api/chanspy/chanspy.socket.js +++ b/server/api/chanspy/chanspy.socket.js @@ -1 +1,24 @@ -var _0x9786=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x6E\x53\x70\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x6E\x73\x70\x79\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x6E\x73\x70\x79\x3A\x72\x65\x6D\x6F\x76\x65"];_0x9786[0];var ChanSpy=require(_0x9786[2])[_0x9786[1]];exports[_0x9786[3]]=function(_0x87b7x2){ChanSpy[_0x9786[4]](function(_0x87b7x3){onSave(_0x87b7x2,_0x87b7x3)});ChanSpy[_0x9786[5]](function(_0x87b7x3){onRemove(_0x87b7x2,_0x87b7x3)})};function onSave(_0x87b7x2,_0x87b7x3,_0x87b7x5){_0x87b7x2[_0x9786[7]](_0x9786[6],_0x87b7x3)}function onRemove(_0x87b7x2,_0x87b7x3,_0x87b7x5){_0x87b7x2[_0x9786[7]](_0x9786[8],_0x87b7x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ChanSpy = require('../../models').ChanSpy; + +exports.register = function(socket) { + ChanSpy.afterCreate(function(doc) { + onSave(socket, doc); + }); + ChanSpy.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chanspy:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chanspy:remove', doc); +} diff --git a/server/api/chanspy/index.js b/server/api/chanspy/index.js index cad059c..97d091d 100644 --- a/server/api/chanspy/index.js +++ b/server/api/chanspy/index.js @@ -1 +1,17 @@ -var _0x3e71=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x6E\x73\x70\x79\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x61\x64\x6D\x69\x6E","\x68\x61\x73\x52\x6F\x6C\x65","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x3e71[0];var express=require(_0x3e71[1]);var controller=require(_0x3e71[2]);var auth=require(_0x3e71[3]);var router=express.Router();router[_0x3e71[9]](_0x3e71[4],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[8]]);router[_0x3e71[9]](_0x3e71[10],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[11]]);router[_0x3e71[13]](_0x3e71[4],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[12]]);router[_0x3e71[15]](_0x3e71[10],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[14]]);router[_0x3e71[16]](_0x3e71[10],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[14]]);router[_0x3e71[18]](_0x3e71[4],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[17]]);router[_0x3e71[18]](_0x3e71[10],auth[_0x3e71[5]](),auth[_0x3e71[7]](_0x3e71[6]),controller[_0x3e71[19]]);module[_0x3e71[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chanspy.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), auth.hasRole('admin'), controller.index); +router.get('/:id', auth.isAuthenticated(), auth.hasRole('admin'), controller.show); +router.post('/', auth.isAuthenticated(), auth.hasRole('admin'), controller.create); +router.put('/:id', auth.isAuthenticated(), auth.hasRole('admin'), controller.update); +router.patch('/:id', auth.isAuthenticated(), auth.hasRole('admin'), controller.update); +router.delete('/', auth.isAuthenticated(), auth.hasRole('admin'), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), auth.hasRole('admin'), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_application/chat_application.controller.js b/server/api/chat_application/chat_application.controller.js index d5f832f..9c2085d 100644 --- a/server/api/chat_application/chat_application.controller.js +++ b/server/api/chat_application/chat_application.controller.js @@ -1 +1,105 @@ -var _0x5235=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x6D\x61\x78","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x5235[0];var _=require(_0x5235[1]);var ChatApplication=require(_0x5235[3])[_0x5235[2]];exports[_0x5235[4]]=function(_0xb445x3,_0xb445x4){ChatApplication[_0x5235[11]]({where:_0xb445x3[_0x5235[9]],order:_0x5235[10],include:[{all:true}]})[_0x5235[8]](function(_0xb445x6){return _0xb445x4[_0x5235[7]](200)[_0x5235[6]](_0xb445x6)})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})};exports[_0x5235[12]]=function(_0xb445x3,_0xb445x4){ChatApplication[_0x5235[16]](_0xb445x3[_0x5235[15]][_0x5235[14]])[_0x5235[8]](function(_0xb445x7){if(!_0xb445x7){return _0xb445x4[_0x5235[13]](404)};return _0xb445x4[_0x5235[6]](_0xb445x7)})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})};exports[_0x5235[17]]=function(_0xb445x3,_0xb445x4,_0xb445x8){ChatApplication[_0x5235[20]](_0x5235[10],{where:{ChatWebsiteId:_0xb445x3[_0x5235[18]][_0x5235[19]]}})[_0x5235[8]](function(_0xb445x9){_0xb445x3[_0x5235[18]][_0x5235[10]]=_0xb445x9?++_0xb445x9:1;ChatApplication[_0x5235[17]](_0xb445x3[_0x5235[18]])[_0x5235[8]](function(_0xb445xa){return _0xb445x4[_0x5235[7]](201)[_0x5235[6]](_0xb445xa)})[_0x5235[5]](function(_0xb445x5){return _0xb445x8(_0xb445x5)})})[_0x5235[5]](function(_0xb445x5){_0xb445x8(_0xb445x5)})};exports[_0x5235[21]]=function(_0xb445x3,_0xb445x4){if(_0xb445x3[_0x5235[18]][_0x5235[14]]){delete _0xb445x3[_0x5235[18]][_0x5235[14]]};ChatApplication[_0x5235[16]](_0xb445x3[_0x5235[15]][_0x5235[14]])[_0x5235[8]](function(_0xb445x7){if(!_0xb445x7){return _0xb445x4[_0x5235[13]](404)};var _0xb445xb=_[_0x5235[22]](_0xb445x7,_0xb445x3[_0x5235[18]]);_0xb445xb[_0x5235[23]]()[_0x5235[8]](function(){return _0xb445x4[_0x5235[7]](200)[_0x5235[6]](_0xb445x7)})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})};exports[_0x5235[24]]=function(_0xb445x3,_0xb445x4){ChatApplication[_0x5235[16]](_0xb445x3[_0x5235[15]][_0x5235[14]])[_0x5235[8]](function(_0xb445x7){if(!_0xb445x7){return _0xb445x4[_0x5235[13]](404)};_0xb445x7[_0x5235[24]]()[_0x5235[8]](function(){return _0xb445x4[_0x5235[13]](204)})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})})[_0x5235[5]](function(_0xb445x5){return handleError(_0xb445x4,_0xb445x5)})};function handleError(_0xb445x4,_0xb445x5){return _0xb445x4[_0x5235[7]](500)[_0x5235[6]](_0xb445x5)} \ No newline at end of file +'use strict'; +var _ = require('lodash'); +var ChatApplication = require('../../models').ChatApplication; +// Get list of chat_applications +exports.index = function(req, res) { + ChatApplication + .findAll({ + where: req.query, + order: 'priority', + include: [{ + all: true + }] + }) + .then(function(chat_applications) { + return res.status(200).send(chat_applications); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Get a single chat_application +exports.show = function(req, res) { + ChatApplication + .findById(req.params.id) + .then(function(chat_application) { + if (!chat_application) { + return res.sendStatus(404); + } + return res.send(chat_application); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Creates a new chat_application in the DB. +exports.create = function(req, res, next) { + ChatApplication.max('priority', { + where: { + ChatWebsiteId: req.body.ChatWebsiteId + } + }).then(function(max) { + // SET PRIORITY + req.body.priority = max ? ++max : 1; + ChatApplication + .create(req.body) + .then(function(mailApplication) { + return res.status(201).send(mailApplication); + }) + .catch(function(err) { + return next(err); + }); + }).catch(function(err) { + next(err); + }); +}; +// Updates an existing chat_application in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + ChatApplication + .findById(req.params.id) + .then(function(chat_application) { + if (!chat_application) { + return res.sendStatus(404); + } + var updated = _.merge(chat_application, req.body); + updated + .save() + .then(function() { + return res.status(200).send(chat_application); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Deletes a chat_application from the DB. +exports.destroy = function(req, res) { + ChatApplication + .findById(req.params.id) + .then(function(chat_application) { + if (!chat_application) { + return res.sendStatus(404); + } + chat_application + .destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_application/chat_application.socket.js b/server/api/chat_application/chat_application.socket.js index 12e8ace..8776f3a 100644 --- a/server/api/chat_application/chat_application.socket.js +++ b/server/api/chat_application/chat_application.socket.js @@ -1 +1,24 @@ -var _0x7472=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7472[0];var ChatApplication=require(_0x7472[2])[_0x7472[1]];exports[_0x7472[3]]=function(_0x46b3x2){ChatApplication[_0x7472[4]](function(_0x46b3x3){onSave(_0x46b3x2,_0x46b3x3)});ChatApplication[_0x7472[5]](function(_0x46b3x3){onRemove(_0x46b3x2,_0x46b3x3)})};function onSave(_0x46b3x2,_0x46b3x3,_0x46b3x5){_0x46b3x2[_0x7472[7]](_0x7472[6],_0x46b3x3)}function onRemove(_0x46b3x2,_0x46b3x3,_0x46b3x5){_0x46b3x2[_0x7472[7]](_0x7472[8],_0x46b3x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ChatApplication = require('../../models').ChatApplication; + +exports.register = function(socket) { + ChatApplication.afterCreate(function (doc) { + onSave(socket, doc); + }); + ChatApplication.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chat_application:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_application:remove', doc); +} diff --git a/server/api/chat_application/chat_application.spec.js b/server/api/chat_application/chat_application.spec.js index b8faed0..215f533 100644 --- a/server/api/chat_application/chat_application.spec.js +++ b/server/api/chat_application/chat_application.spec.js @@ -1 +1,20 @@ -var _0xb3f3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0xb3f3[0];var should=require(_0xb3f3[1]);var app=require(_0xb3f3[2]);var request=require(_0xb3f3[3]);describe(_0xb3f3[4],function(){it(_0xb3f3[5],function(_0xa5cdx4){request(app)[_0xb3f3[13]](_0xb3f3[12])[_0xb3f3[11]](200)[_0xb3f3[11]](_0xb3f3[10],/json/)[_0xb3f3[9]](function(_0xa5cdx5,_0xa5cdx6){if(_0xa5cdx5){return _0xa5cdx4(_0xa5cdx5)};_0xa5cdx6[_0xb3f3[8]][_0xb3f3[1]][_0xb3f3[7]][_0xb3f3[6]](Array);_0xa5cdx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/chat/applications', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/chat/applications') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/chat_application/index.js b/server/api/chat_application/index.js index 377975f..d85a510 100644 --- a/server/api/chat_application/index.js +++ b/server/api/chat_application/index.js @@ -1 +1,15 @@ -var _0x4f04=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x4f04[0];var express=require(_0x4f04[1]);var controller=require(_0x4f04[2]);var router=express.Router();router[_0x4f04[5]](_0x4f04[3],controller[_0x4f04[4]]);router[_0x4f04[5]](_0x4f04[6],controller[_0x4f04[7]]);router[_0x4f04[9]](_0x4f04[3],controller[_0x4f04[8]]);router[_0x4f04[11]](_0x4f04[6],controller[_0x4f04[10]]);router[_0x4f04[12]](_0x4f04[6],controller[_0x4f04[10]]);router[_0x4f04[14]](_0x4f04[6],controller[_0x4f04[13]]);module[_0x4f04[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_application.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/chat_enquiry/enquiry.controller.js b/server/api/chat_enquiry/enquiry.controller.js index f707fe5..d72924b 100644 --- a/server/api/chat_enquiry/enquiry.controller.js +++ b/server/api/chat_enquiry/enquiry.controller.js @@ -1 +1,106 @@ -var _0xde26=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x69\x64","\x6E\x61\x6D\x65","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xde26[0];var _=require(_0xde26[1]);var Util=require(_0xde26[2]);var ChatEnquiry=require(_0xde26[4])[_0xde26[3]];var ChatVisitor=require(_0xde26[4])[_0xde26[5]];var ChatWebsite=require(_0xde26[4])[_0xde26[6]];exports[_0xde26[7]]=function(_0xa9fdx6,_0xa9fdx7,_0xa9fdx8){return ChatEnquiry[_0xde26[17]](_[_0xde26[16]](Util[_0xde26[13]](_0xa9fdx6[_0xde26[12]]),{include:[{model:ChatWebsite,attributes:[_0xde26[14],_0xde26[15]]}]}))[_0xde26[11]](function(_0xa9fdxa){return _0xa9fdx7[_0xde26[10]](200)[_0xde26[9]](_0xa9fdxa)})[_0xde26[8]](function(_0xa9fdx9){return handleError(_0xa9fdx7,_0xa9fdx9)})};exports[_0xde26[18]]=function(_0xa9fdx6,_0xa9fdx7){return ChatEnquiry[_0xde26[22]](_0xa9fdx6[_0xde26[21]][_0xde26[14]],{include:[{model:ChatWebsite,attributes:[_0xde26[14],_0xde26[15]]},{model:ChatVisitor}]})[_0xde26[11]](function(_0xa9fdxb){if(!_0xa9fdxb){return _0xa9fdx7[_0xde26[20]](404)};return _0xa9fdx7[_0xde26[9]](_0xa9fdxb)})[_0xde26[8]](function(_0xa9fdx9){console[_0xde26[19]](_0xa9fdx9);return handleError(_0xa9fdx7,_0xa9fdx9)})};exports[_0xde26[23]]=function(_0xa9fdx6,_0xa9fdx7){return ChatEnquiry[_0xde26[23]](_0xa9fdx6[_0xde26[24]])[_0xde26[11]](function(_0xa9fdxb){return _0xa9fdx7[_0xde26[10]](201)[_0xde26[9]](_0xa9fdxb)})[_0xde26[8]](function(_0xa9fdx9){return handleError(_0xa9fdx7,_0xa9fdx9)})};exports[_0xde26[25]]=function(_0xa9fdx6,_0xa9fdx7){if(_0xa9fdx6[_0xde26[24]][_0xde26[14]]){delete _0xa9fdx6[_0xde26[24]][_0xde26[14]]};return ChatEnquiry[_0xde26[22]](_0xa9fdx6[_0xde26[21]][_0xde26[14]])[_0xde26[11]](function(_0xa9fdxb){if(!_0xa9fdxb){return _0xa9fdx7[_0xde26[20]](404)};var _0xa9fdxc=_[_0xde26[16]](_0xa9fdxb,_0xa9fdx6[_0xde26[24]]);return _0xa9fdxc[_0xde26[26]]()})[_0xde26[11]](function(_0xa9fdxb){return _0xa9fdx7[_0xde26[10]](200)[_0xde26[9]](_0xa9fdxb)})[_0xde26[8]](function(_0xa9fdx9){return handleError(_0xa9fdx7,_0xa9fdx9)})};exports[_0xde26[27]]=function(_0xa9fdx6,_0xa9fdx7){return ChatEnquiry[_0xde26[22]](_0xa9fdx6[_0xde26[21]][_0xde26[14]])[_0xde26[11]](function(_0xa9fdxb){if(!_0xa9fdxb){return _0xa9fdx7[_0xde26[20]](404)};return _0xa9fdxb[_0xde26[27]]()})[_0xde26[11]](function(){return _0xa9fdx7[_0xde26[20]](204)})[_0xde26[8]](function(_0xa9fdx9){return handleError(_0xa9fdx7,_0xa9fdx9)})};function handleError(_0xa9fdx7,_0xa9fdx9){return _0xa9fdx7[_0xde26[10]](500)[_0xde26[9]](_0xa9fdx9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var ChatEnquiry = require('../../models').ChatEnquiry; +var ChatVisitor = require('../../models').ChatVisitor; +var ChatWebsite = require('../../models').ChatWebsite; + +// Get list of agents +exports.index = function(req, res, next) { + return ChatEnquiry + .findAndCountAll(_.merge(Util.getQuery(req.query), { + include: [{ + model: ChatWebsite, + attributes: ['id', 'name'] + }] + })) + .then(function(result) { + return res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single enquiry +exports.show = function(req, res) { + return ChatEnquiry + .findById(req.params.id, { + include: [{ + model: ChatWebsite, + attributes: ['id', 'name'] + }, { + model: ChatVisitor + }] + }) + .then(function(enquiry) { + if (!enquiry) { + return res.sendStatus(404); + } + return res.send(enquiry); + }) + .catch(function(err) { + console.error(err); + return handleError(res, err); + }); +}; + +// Creates a new enquiry in the DB. +exports.create = function(req, res) { + return ChatEnquiry + .create(req.body) + .then(function(enquiry) { + return res.status(201).send(enquiry); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing enquiry in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ChatEnquiry + .findById(req.params.id) + .then(function(enquiry) { + if (!enquiry) { + return res.sendStatus(404); + } + var updated = _.merge(enquiry, req.body); + return updated + .save(); + }) + .then(function(enquiry) { + return res.status(200).send(enquiry); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a enquiry from the DB. +exports.destroy = function(req, res) { + return ChatEnquiry + .findById(req.params.id) + .then(function(enquiry) { + if (!enquiry) { + return res.sendStatus(404); + } + return enquiry + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_enquiry/enquiry.socket.js b/server/api/chat_enquiry/enquiry.socket.js index da618f0..b7b69e1 100644 --- a/server/api/chat_enquiry/enquiry.socket.js +++ b/server/api/chat_enquiry/enquiry.socket.js @@ -1 +1,24 @@ -var _0x406c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x6E\x71\x75\x69\x72\x79\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x65\x6E\x71\x75\x69\x72\x79\x3A\x72\x65\x6D\x6F\x76\x65"];_0x406c[0];var enquiry=require(_0x406c[2])[_0x406c[1]];exports[_0x406c[3]]=function(_0xd427x2){enquiry[_0x406c[4]](function(_0xd427x3){onSave(_0xd427x2,_0xd427x3)});enquiry[_0x406c[5]](function(_0xd427x3){onRemove(_0xd427x2,_0xd427x3)})};function onSave(_0xd427x2,_0xd427x3,_0xd427x5){_0xd427x2[_0x406c[7]](_0x406c[6],_0xd427x3)}function onRemove(_0xd427x2,_0xd427x3,_0xd427x5){_0xd427x2[_0x406c[7]](_0x406c[8],_0xd427x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var enquiry = require('../../models').ChatEnquiry; + +exports.register = function(socket) { + enquiry.afterCreate(function (doc) { + onSave(socket, doc); + }); + enquiry.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('enquiry:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('enquiry:remove', doc); +} diff --git a/server/api/chat_enquiry/index.js b/server/api/chat_enquiry/index.js index 6912a2a..84a2544 100644 --- a/server/api/chat_enquiry/index.js +++ b/server/api/chat_enquiry/index.js @@ -1 +1,15 @@ -var _0x2e82=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x65\x6E\x71\x75\x69\x72\x79\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x43\x68\x61\x74","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x2e82[0];var express=require(_0x2e82[1]);var controller=require(_0x2e82[2]);var license=require(_0x2e82[3]);var router=express.Router();router[_0x2e82[8]](_0x2e82[4],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[7]]);router[_0x2e82[8]](_0x2e82[9],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[10]]);router[_0x2e82[12]](_0x2e82[4],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[11]]);router[_0x2e82[14]](_0x2e82[9],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[13]]);router[_0x2e82[15]](_0x2e82[9],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[13]]);router[_0x2e82[17]](_0x2e82[9],license[_0x2e82[5]](),license[_0x2e82[6]](),controller[_0x2e82[16]]);module[_0x2e82[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./enquiry.controller'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasChat(), controller.index); +router.get('/:id', license.isValidDate(), license.hasChat(), controller.show); +router.post('/', license.isValidDate(), license.hasChat(), controller.create); +router.put('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.patch('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/:id', license.isValidDate(), license.hasChat(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_message/chat_message.controller.js b/server/api/chat_message/chat_message.controller.js index 18c7966..958ca19 100644 --- a/server/api/chat_message/chat_message.controller.js +++ b/server/api/chat_message/chat_message.controller.js @@ -1 +1,267 @@ -var _0xc10a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x64\x35","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x73\x65\x72","\x6D\x65\x72\x67\x65","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xc10a[0];var _=require(_0xc10a[1]);var md5=require(_0xc10a[2]);var User=require(_0xc10a[4])[_0xc10a[3]];var ChatRoom=require(_0xc10a[4])[_0xc10a[5]];var ChatMessage=require(_0xc10a[4])[_0xc10a[6]];var ChatVisitor=require(_0xc10a[4])[_0xc10a[7]];exports[_0xc10a[8]]=function(_0xcfbax7,_0xcfbax8){ChatMessage[_0xc10a[13]]()[_0xc10a[12]](function(_0xcfbaxa){return _0xcfbax8[_0xc10a[11]](200)[_0xc10a[10]](_0xcfbaxa)})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})};exports[_0xc10a[14]]=function(_0xcfbax7,_0xcfbax8){ChatMessage[_0xc10a[18]](_0xcfbax7[_0xc10a[17]][_0xc10a[16]])[_0xc10a[12]](function(_0xcfbaxb){if(!_0xcfbaxb){return _0xcfbax8[_0xc10a[15]](404)};return _0xcfbax8[_0xc10a[10]](_0xcfbaxb)})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})};exports[_0xc10a[19]]=function(_0xcfbax7,_0xcfbax8,_0xcfbaxc){ChatMessage[_0xc10a[19]](_[_0xc10a[22]](_0xcfbax7[_0xc10a[20]],{UserId:_0xcfbax7[_0xc10a[21]][_0xc10a[16]]}))[_0xc10a[12]](function(_0xcfbaxb){return _0xcfbax8[_0xc10a[11]](201)[_0xc10a[10]](_0xcfbaxb)})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})};exports[_0xc10a[23]]=function(_0xcfbax7,_0xcfbax8){if(_0xcfbax7[_0xc10a[20]][_0xc10a[16]]){delete _0xcfbax7[_0xc10a[20]][_0xc10a[16]]};return ChatMessage[_0xc10a[18]](_0xcfbax7[_0xc10a[17]][_0xc10a[16]])[_0xc10a[12]](function(_0xcfbaxb){if(!_0xcfbaxb){return _0xcfbax8[_0xc10a[15]](404)};var _0xcfbaxd=_[_0xc10a[22]](_0xcfbaxb,_0xcfbax7[_0xc10a[20]]);return _0xcfbaxd[_0xc10a[24]]()})[_0xc10a[12]](function(_0xcfbaxb){return _0xcfbax8[_0xc10a[11]](200)[_0xc10a[10]](_0xcfbaxb)})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})};exports[_0xc10a[25]]=function(_0xcfbax7,_0xcfbax8){ChatMessage[_0xc10a[18]](_0xcfbax7[_0xc10a[17]][_0xc10a[16]])[_0xc10a[12]](function(_0xcfbaxb){if(!_0xcfbaxb){return _0xcfbax8[_0xc10a[15]](404)};_0xcfbaxb[_0xc10a[25]]()[_0xc10a[12]](function(){return _0xcfbax8[_0xc10a[15]](204)})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})})[_0xc10a[9]](function(_0xcfbax9){return handleError(_0xcfbax8,_0xcfbax9)})};function handleError(_0xcfbax8,_0xcfbax9){return _0xcfbax8[_0xc10a[11]](500)[_0xc10a[10]](_0xcfbax9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var md5 = require('md5'); + +var User = require('../../models').User; +var ChatRoom = require('../../models').ChatRoom; +var ChatMessage = require('../../models').ChatMessage; +var ChatVisitor = require('../../models').ChatVisitor; + +// Get list of chat_messages +exports.index = function (req, res) { + ChatMessage + .findAll() + .then(function (chat_messages) { + return res.status(200).send(chat_messages); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +// Get a single chatMessage +exports.show = function (req, res) { + ChatMessage + .findById(req.params.id) + .then(function (chatMessage) { + if (!chatMessage) { + return res.sendStatus(404); + } + return res.send(chatMessage); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +// Creates a new chatMessage in the DB. +exports.create = function (req, res, next) { + // if (req.body.ChatRoomId && req.body.to) { + // return handleError(res, new Error('Select ChatRoomId or to')); + // } else if (req.body.to) { + // + // switch (req.body.type) { + // case 'internal': + // User + // .findOne({ + // where: { + // $or: [{ + // id: { + // $like: req.body.to + // } + // }, { + // name: req.body.to + // }] + // } + // }) + // .then(function(user) { + // if (user) { + // + // var users = _.sortBy([user, req.user], 'id'); + // var participants = { + // users: { + // ids: [users[0].id, users[1].id] + // }, + // visitors: { + // ids: [] + // } + // }; + // + // var token = md5(JSON.stringify(participants)).toString( + // 'base64'); + // + // participants.users.fullnames = [users[0].fullname, users[1].fullname]; + // participants.visitors.fullnames = []; + // + // ChatRoom + // .findOrCreate({ + // where: { + // token: token + // }, + // defaults: { + // type: req.body.type, + // token: token, + // participants: JSON.stringify(participants) + // } + // }) + // .spread(function(chatRoom, created) { + // + // chatRoom + // .updateAttributes({ + // participants: JSON.stringify(participants) + // }); + // + // ChatMessage + // .create({ + // body: req.body.body, + // fullname: req.user.fullname, + // email: req.user.email, + // ChatRoomId: chatRoom.id, + // userId: req.user.id + // }) + // .then(function(chatMessage) { + // return res.status(201).send(chatMessage); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // }); + // + // } else { + // return handleError(res, new Error('User not found')); + // } + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // + // break; + // case 'external': + // ChatVisitor + // .findOne({ + // where: { + // $or: [{ + // id: { + // $like: req.body.to + // } + // }, { + // fullname: req.body.to + // }] + // } + // }) + // .then(function(chatVisitor) { + // if (chatVisitor) { + // + // var participants = { + // users: { + // ids: [req.user.id] + // }, + // visitors: { + // ids: [chatVisitor.id] + // } + // }; + // + // var token = md5(JSON.stringify(participants)).toString( + // 'base64'); + // + // participants.users.fullnames = [req.user.fullname]; + // participants.visitors.fullnames = [chatVisitor.fullname]; + // + // ChatRoom + // .findOrCreate({ + // where: { + // token: token + // }, + // defaults: { + // type: req.body.type, + // token: token, + // participants: JSON.stringify(participants) + // } + // }) + // .spread(function(chatRoom, created) { + // + // chatRoom + // .updateAttributes({ + // participants: JSON.stringify(participants) + // }); + // + // ChatMessage + // .create({ + // body: req.body.body, + // fullname: req.user.fullname, + // email: req.user.email, + // ChatRoomId: chatRoom.id, + // userId: req.user.id + // }) + // .then(function(chatMessage) { + // return res.status(201).send(chatMessage); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // }); + // } + // }); + // break; + // default: + // return handleError(res, new Error('Room type unsupported')); + // } + // + // + // } else if (req.body.ChatRoomId) { + // + // ChatMessage + // .create(_.merge({ + // userId: req.user.id, + // email: req.user.email, + // fullname: req.user.fullname + // }, req.body)) + // .then(function(chatMessage) { + // return res.status(201).send(chatMessage); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // } else { + // return handleError(res, new Error('Select ChatRoomId or to')); + // } + ChatMessage + .create(_.merge(req.body, { + UserId: req.user.id + })) + .then(function (chatMessage) { + return res.status(201).send(chatMessage); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +// Updates an existing chatMessage in the DB. +exports.update = function (req, res) { + if (req.body.id) { + delete req.body.id; + } + + return ChatMessage + .findById(req.params.id) + .then(function (chatMessage) { + if (!chatMessage) { + return res.sendStatus(404); + } + var updated = _.merge(chatMessage, req.body); + return updated.save(); + }) + .then(function (chatMessage) { + return res.status(200).send(chatMessage); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +// Deletes a chatMessage from the DB. +exports.destroy = function (req, res) { + ChatMessage + .findById(req.params.id) + .then(function (chatMessage) { + if (!chatMessage) { + return res.sendStatus(404); + } + chatMessage.destroy() + .then(function () { + return res.sendStatus(204); + }) + .catch(function (err) { + return handleError(res, err); + }); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_message/chat_message.socket.js b/server/api/chat_message/chat_message.socket.js index a60816e..dccab23 100644 --- a/server/api/chat_message/chat_message.socket.js +++ b/server/api/chat_message/chat_message.socket.js @@ -1 +1,59 @@ -var _0xacc9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x6C\x6F\x64\x61\x73\x68","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x55\x73\x65\x72\x49\x64","\x66\x69\x6E\x64","\x75\x73\x65\x72\x49\x64","\x69\x64","\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x73\x61\x76\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x65\x72\x67\x65","\x65\x6D\x69\x74","\x66\x6F\x72\x45\x61\x63\x68","\x73\x70\x72\x65\x61\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x72\x6F\x6C\x65","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x67\x65\x74\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x74\x68\x65\x6E","\x67\x65\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xacc9[0];var chat_message=require(_0xacc9[2])[_0xacc9[1]];var _=require(_0xacc9[3]);exports[_0xacc9[4]]=function(_0x3ea7x3){chat_message[_0xacc9[5]](function(_0x3ea7x4){onSave(_0x3ea7x3,_0x3ea7x4)});chat_message[_0xacc9[6]](function(_0x3ea7x4){onSave(_0x3ea7x3,_0x3ea7x4)});chat_message[_0xacc9[7]](function(_0x3ea7x4){onRemove(_0x3ea7x3,_0x3ea7x4)})};function onSave(_0x3ea7x3,_0x3ea7x4,_0x3ea7x6){return _0x3ea7x4[_0xacc9[28]]()[_0xacc9[27]](function(_0x3ea7xc){return [_0x3ea7xc[_0xacc9[25]]({attributes:[_0xacc9[13],_0xacc9[20],_0xacc9[21],_0xacc9[22],_0xacc9[23],_0xacc9[24]],raw:true}),_0x3ea7xc[_0xacc9[26]]({attributes:[_0xacc9[13],_0xacc9[21],_0xacc9[22]],raw:true})]})[_0xacc9[19]](function(_0x3ea7x8,_0x3ea7x9){var _0x3ea7xa=_[_0xacc9[11]](_0x3ea7x8,{id:_0x3ea7x4[_0xacc9[10]]});_0x3ea7x8[_0xacc9[18]](function(_0x3ea7xb){if(_0x3ea7x3[_0xacc9[12]]==_0x3ea7xb[_0xacc9[13]]&&(_0x3ea7xa||_0x3ea7x9)){_0x3ea7x3[_0xacc9[17]](_0xacc9[14],_[_0xacc9[16]](_0x3ea7x4[_0xacc9[15]],{User:_0x3ea7xa,ChatVisitor:_0x3ea7x9}))}})})[_0xacc9[9]](function(_0x3ea7x7){console[_0xacc9[8]](_0x3ea7x7)})}function onRemove(_0x3ea7x3,_0x3ea7x4,_0x3ea7x6){_0x3ea7x3[_0xacc9[17]](_0xacc9[29],_0x3ea7x4)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var chat_message = require('../../models').ChatMessage; +var _ = require('lodash'); + +exports.register = function (socket) { + chat_message.afterCreate(function (doc) { + onSave(socket, doc); + }); + chat_message.afterUpdate(function (doc) { + onSave(socket, doc); + }); + chat_message.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + return doc + .getChatRoom() + .then(function (chatRoom) { + return [chatRoom + .getUsers({ + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'], + raw: true + }), chatRoom + .getChatVisitor({ + attributes: ['id', 'fullname', 'email'], + raw: true + }) + ]; + }) + .spread(function (users, visitor) { + var sender = _.find(users, { + id: doc.UserId + }); + + users.forEach(function (user) { + // SOCKET FILTER + if (socket.userId == user.id && (sender || visitor)) { + socket.emit('chat_message:save', _.merge(doc.dataValues, { + User: sender, // TODO modify to sender + ChatVisitor: visitor // TODO modify to visitor + })); + } + }); + }) + .catch(function (err) { + console.error(err); + }); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_message:remove', doc); +} diff --git a/server/api/chat_message/chat_message.spec.js b/server/api/chat_message/chat_message.spec.js index 91f30f1..f646838 100644 --- a/server/api/chat_message/chat_message.spec.js +++ b/server/api/chat_message/chat_message.spec.js @@ -1 +1,20 @@ -var _0xaf5c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x67\x65\x74"];_0xaf5c[0];var should=require(_0xaf5c[1]);var app=require(_0xaf5c[2]);var request=require(_0xaf5c[3]);describe(_0xaf5c[4],function(){it(_0xaf5c[5],function(_0xccfex4){request(app)[_0xaf5c[13]](_0xaf5c[12])[_0xaf5c[11]](200)[_0xaf5c[11]](_0xaf5c[10],/json/)[_0xaf5c[9]](function(_0xccfex5,_0xccfex6){if(_0xccfex5){return _0xccfex4(_0xccfex5)};_0xccfex6[_0xaf5c[8]][_0xaf5c[1]][_0xaf5c[7]][_0xaf5c[6]](Array);_0xccfex4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/chat/messages', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/chat/messages') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/chat_message/index.js b/server/api/chat_message/index.js index 57067a8..efcb4e1 100644 --- a/server/api/chat_message/index.js +++ b/server/api/chat_message/index.js @@ -1 +1,15 @@ -var _0x42ed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x43\x68\x61\x74","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x42ed[0];var express=require(_0x42ed[1]);var controller=require(_0x42ed[2]);var auth=require(_0x42ed[3]);var license=require(_0x42ed[4]);var router=express.Router();router[_0x42ed[9]](_0x42ed[5],license[_0x42ed[6]](),license[_0x42ed[7]](),controller[_0x42ed[8]]);router[_0x42ed[9]](_0x42ed[10],license[_0x42ed[6]](),license[_0x42ed[7]](),controller[_0x42ed[11]]);router[_0x42ed[14]](_0x42ed[5],license[_0x42ed[6]](),license[_0x42ed[7]](),auth[_0x42ed[12]](),controller[_0x42ed[13]]);router[_0x42ed[16]](_0x42ed[10],license[_0x42ed[6]](),license[_0x42ed[7]](),controller[_0x42ed[15]]);router[_0x42ed[18]](_0x42ed[10],license[_0x42ed[6]](),license[_0x42ed[7]](),controller[_0x42ed[17]]);module[_0x42ed[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_message.controller'); +var auth = require('../../auth/auth.service'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasChat(), controller.index); +router.get('/:id', license.isValidDate(), license.hasChat(), controller.show); +router.post('/', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.create); +router.put('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/:id', license.isValidDate(), license.hasChat(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_proactive_action/chat_proactive_action.controller.js b/server/api/chat_proactive_action/chat_proactive_action.controller.js index e8c33e0..8e3b8ba 100644 --- a/server/api/chat_proactive_action/chat_proactive_action.controller.js +++ b/server/api/chat_proactive_action/chat_proactive_action.controller.js @@ -1 +1,112 @@ -var _0xa6e6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0xa6e6[0];var _=require(_0xa6e6[1]);var Util=require(_0xa6e6[2]);var ChatProactiveAction=require(_0xa6e6[4])[_0xa6e6[3]];function handleError(_0x397cx5,_0x397cx6){_0x397cx6=_0x397cx6||500;return function(_0x397cx7){_0x397cx5[_0xa6e6[6]](_0x397cx6)[_0xa6e6[5]](_0x397cx7)}}function responseWithResult(_0x397cx5,_0x397cx6){_0x397cx6=_0x397cx6||200;return function(_0x397cx9){if(_0x397cx9){_0x397cx5[_0xa6e6[6]](_0x397cx6)[_0xa6e6[7]](_0x397cx9)}}}function responseWithoutResult(_0x397cx5,_0x397cx6){_0x397cx6=_0x397cx6||204;return function(){_0x397cx5[_0xa6e6[8]](_0x397cx6)}}function handleEntityNotFound(_0x397cx5){return function(_0x397cx9){if(!_0x397cx9){_0x397cx5[_0xa6e6[6]](404)[_0xa6e6[9]]();return null};return _0x397cx9}}function saveUpdates(_0x397cxd){return function(_0x397cx9){return _0x397cx9[_0xa6e6[11]](_0x397cxd)[_0xa6e6[10]](function(_0x397cxe){return _0x397cxe})}}function removeEntity(_0x397cx5){return function(_0x397cx9){if(_0x397cx9){return _0x397cx9[_0xa6e6[12]]()[_0xa6e6[10]](function(){_0x397cx5[_0xa6e6[6]](204)[_0xa6e6[9]]()})}}}exports[_0xa6e6[13]]=function(_0x397cx10,_0x397cx5){return ChatProactiveAction[_0xa6e6[17]](Util[_0xa6e6[16]](_0x397cx10[_0xa6e6[15]]))[_0xa6e6[10]](responseWithResult(_0x397cx5))[_0xa6e6[14]](handleError(_0x397cx5))};exports[_0xa6e6[18]]=function(_0x397cx10,_0x397cx5){return ChatProactiveAction[_0xa6e6[21]](_0x397cx10[_0xa6e6[20]][_0xa6e6[19]])[_0xa6e6[10]](handleEntityNotFound(_0x397cx5))[_0xa6e6[10]](responseWithResult(_0x397cx5))[_0xa6e6[14]](handleError(_0x397cx5))};exports[_0xa6e6[22]]=function(_0x397cx10,_0x397cx5){return ChatProactiveAction[_0xa6e6[22]](_0x397cx10[_0xa6e6[23]])[_0xa6e6[10]](responseWithResult(_0x397cx5,201))[_0xa6e6[14]](handleError(_0x397cx5))};exports[_0xa6e6[24]]=function(_0x397cx10,_0x397cx5){if(_0x397cx10[_0xa6e6[23]][_0xa6e6[19]]){delete _0x397cx10[_0xa6e6[23]][_0xa6e6[19]]};return ChatProactiveAction[_0xa6e6[21]](_0x397cx10[_0xa6e6[20]][_0xa6e6[19]])[_0xa6e6[10]](handleEntityNotFound(_0x397cx5))[_0xa6e6[10]](saveUpdates(_0x397cx10[_0xa6e6[23]]))[_0xa6e6[10]](responseWithResult(_0x397cx5))[_0xa6e6[14]](handleError(_0x397cx5))};exports[_0xa6e6[12]]=function(_0x397cx10,_0x397cx5){return ChatProactiveAction[_0xa6e6[21]](_0x397cx10[_0xa6e6[20]][_0xa6e6[19]])[_0xa6e6[10]](handleEntityNotFound(_0x397cx5))[_0xa6e6[10]](removeEntity(_0x397cx5))[_0xa6e6[14]](handleError(_0x397cx5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/chat/proactives -> index + * POST /api/chat/proactives -> create + * GET /api/chat/proactives/:id -> show + * PUT /api/chat/proactives/:id -> update + * DELETE /api/chat/proactives/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var ChatProactiveAction = require('../../models').ChatProactiveAction; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function responseWithoutResult(res, statusCode) { + statusCode = statusCode || 204; + return function() { + res.sendStatus(statusCode); + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of ChatProactiveActions +exports.index = function(req, res) { + return ChatProactiveAction.findAll(Util.getQuery(req.query)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single ChatProactiveAction from the DB +exports.show = function(req, res) { + return ChatProactiveAction.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new ChatProactiveAction in the DB +exports.create = function(req, res) { + return ChatProactiveAction.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing ChatProactiveAction in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ChatProactiveAction.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a ChatProactiveAction from the DB +exports.destroy = function(req, res) { + return ChatProactiveAction.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/chat_proactive_action/chat_proactive_action.socket.js b/server/api/chat_proactive_action/chat_proactive_action.socket.js index 2224c38..ca71aaf 100644 --- a/server/api/chat_proactive_action/chat_proactive_action.socket.js +++ b/server/api/chat_proactive_action/chat_proactive_action.socket.js @@ -1 +1,24 @@ -var _0xccbb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xccbb[0];var ChatProactiveAction=require(_0xccbb[2])[_0xccbb[1]];exports[_0xccbb[3]]=function(_0x6bd2x2){ChatProactiveAction[_0xccbb[4]](function(_0x6bd2x3){onSave(_0x6bd2x2,_0x6bd2x3)});ChatProactiveAction[_0xccbb[5]](function(_0x6bd2x3){onRemove(_0x6bd2x2,_0x6bd2x3)})};function onSave(_0x6bd2x2,_0x6bd2x3,_0x6bd2x5){_0x6bd2x2[_0xccbb[7]](_0xccbb[6],_0x6bd2x3)}function onRemove(_0x6bd2x2,_0x6bd2x3,_0x6bd2x5){_0x6bd2x2[_0xccbb[7]](_0xccbb[8],_0x6bd2x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ChatProactiveAction = require('../../models').ChatProactiveAction; + +exports.register = function(socket) { + ChatProactiveAction.afterCreate(function(doc) { + onSave(socket, doc); + }); + ChatProactiveAction.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('chat_proactive_action:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_proactive_action:remove', doc); +} diff --git a/server/api/chat_proactive_action/index.js b/server/api/chat_proactive_action/index.js index 610ffd7..f38d95e 100644 --- a/server/api/chat_proactive_action/index.js +++ b/server/api/chat_proactive_action/index.js @@ -1 +1,16 @@ -var _0x9e52=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x9e52[0];var express=require(_0x9e52[1]);var auth=require(_0x9e52[2]);var controller=require(_0x9e52[3]);var router=express.Router();router[_0x9e52[7]](_0x9e52[4],auth[_0x9e52[5]](),controller[_0x9e52[6]]);router[_0x9e52[7]](_0x9e52[8],auth[_0x9e52[5]](),controller[_0x9e52[9]]);router[_0x9e52[11]](_0x9e52[4],auth[_0x9e52[5]](),controller[_0x9e52[10]]);router[_0x9e52[13]](_0x9e52[8],auth[_0x9e52[5]](),controller[_0x9e52[12]]);router[_0x9e52[14]](_0x9e52[8],auth[_0x9e52[5]](),controller[_0x9e52[12]]);router[_0x9e52[16]](_0x9e52[8],auth[_0x9e52[5]](),controller[_0x9e52[15]]);module[_0x9e52[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./chat_proactive_action.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_proactive_action/index.spec.js b/server/api/chat_proactive_action/index.spec.js index 379c2aa..2b9c66a 100644 --- a/server/api/chat_proactive_action/index.spec.js +++ b/server/api/chat_proactive_action/index.spec.js @@ -1 +1,97 @@ -var _0x1891=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x1891[0];var proxyquire=require(_0x1891[2])[_0x1891[1]]();var chatProactiveActionCtrlStub={index:_0x1891[3],show:_0x1891[4],create:_0x1891[5],update:_0x1891[6],destroy:_0x1891[7]};var routerStub={get:sinon[_0x1891[8]](),put:sinon[_0x1891[8]](),patch:sinon[_0x1891[8]](),post:sinon[_0x1891[8]](),delete:sinon[_0x1891[8]]()};var chatProactiveActionIndex=proxyquire(_0x1891[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":chatProactiveActionCtrlStub});describe(_0x1891[10],function(){it(_0x1891[11],function(){expect(chatProactiveActionIndex)[_0x1891[13]][_0x1891[12]](routerStub)});describe(_0x1891[14],function(){it(_0x1891[15],function(){expect(routerStub[_0x1891[21]][_0x1891[20]](_0x1891[19],_0x1891[3]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})});describe(_0x1891[22],function(){it(_0x1891[23],function(){expect(routerStub[_0x1891[21]][_0x1891[20]](_0x1891[24],_0x1891[4]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})});describe(_0x1891[25],function(){it(_0x1891[26],function(){expect(routerStub[_0x1891[27]][_0x1891[20]](_0x1891[19],_0x1891[5]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})});describe(_0x1891[28],function(){it(_0x1891[29],function(){expect(routerStub[_0x1891[30]][_0x1891[20]](_0x1891[24],_0x1891[6]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})});describe(_0x1891[31],function(){it(_0x1891[29],function(){expect(routerStub[_0x1891[32]][_0x1891[20]](_0x1891[24],_0x1891[6]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})});describe(_0x1891[33],function(){it(_0x1891[34],function(){expect(routerStub[_0x1891[35]][_0x1891[20]](_0x1891[24],_0x1891[7]))[_0x1891[13]][_0x1891[18]][_0x1891[17]][_0x1891[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var chatProactiveActionCtrlStub = { + index: 'chatProactiveActionCtrl.index', + show: 'chatProactiveActionCtrl.show', + create: 'chatProactiveActionCtrl.create', + update: 'chatProactiveActionCtrl.update', + destroy: 'chatProactiveActionCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var chatProactiveActionIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './chat_proactive_action.controller': chatProactiveActionCtrlStub +}); + +describe('ChatProactiveAction API Router:', function() { + + it('should return an express router instance', function() { + expect(chatProactiveActionIndex).to.equal(routerStub); + }); + + describe('GET /api/chat/proactives', function() { + + it('should route to chatProactiveAction.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'chatProactiveActionCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/chat/proactives/:id', function() { + + it('should route to chatProactiveAction.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'chatProactiveActionCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/chat/proactives', function() { + + it('should route to chatProactiveAction.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'chatProactiveActionCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/chat/proactives/:id', function() { + + it('should route to chatProactiveAction.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'chatProactiveActionCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/chat/proactives/:id', function() { + + it('should route to chatProactiveAction.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'chatProactiveActionCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/chat/proactives/:id', function() { + + it('should route to chatProactiveAction.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'chatProactiveActionCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/chat_queue/chat_queue.controller.js b/server/api/chat_queue/chat_queue.controller.js index 80d0bfb..e7c8ffd 100644 --- a/server/api/chat_queue/chat_queue.controller.js +++ b/server/api/chat_queue/chat_queue.controller.js @@ -1 +1,200 @@ -var _0x3f9a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x6D\x65","\x69\x64","\x75\x73\x65\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x61\x64\x64\x55\x73\x65\x72\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x3f9a[0];var _=require(_0x3f9a[1]);var Util=require(_0x3f9a[2]);var ChatQueue=require(_0x3f9a[4])[_0x3f9a[3]];var User=require(_0x3f9a[4])[_0x3f9a[5]];var UserHasChatQueue=require(_0x3f9a[4])[_0x3f9a[6]];exports[_0x3f9a[7]]=function(_0x4402x6,_0x4402x7){return ChatQueue[_0x3f9a[16]](_0x3f9a[15])[_0x3f9a[14]](Util[_0x3f9a[13]](_0x4402x6[_0x3f9a[12]]))[_0x3f9a[11]](function(_0x4402x9){_0x4402x7[_0x3f9a[10]](200)[_0x3f9a[9]](_0x4402x9)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[17]]=function(_0x4402x6,_0x4402x7,_0x4402xa){UserHasChatQueue[_0x3f9a[20]]({where:{UserId:_0x4402x6[_0x3f9a[19]][_0x3f9a[18]]}})[_0x3f9a[11]](function(_0x4402xb){return _0x4402x7[_0x3f9a[10]](200)[_0x3f9a[9]](_0x4402xb)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[21]]=function(_0x4402x6,_0x4402x7){ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402xc){if(!_0x4402xc){return _0x4402x7[_0x3f9a[22]](404)};return _0x4402x7[_0x3f9a[9]](_0x4402xc)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[25]]=function(_0x4402x6,_0x4402x7){return ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402xe){if(!_0x4402xe){return _0x4402x7[_0x3f9a[22]](404)};return _0x4402xe[_0x3f9a[30]]({where:{role:_0x3f9a[26]},attributes:[_0x3f9a[18],_0x3f9a[27],_0x3f9a[28],_0x3f9a[29]]})})[_0x3f9a[11]](function(_0x4402xd){return _0x4402x7[_0x3f9a[10]](200)[_0x3f9a[9]](_0x4402xd)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[31]]=function(_0x4402x6,_0x4402x7){return ChatQueue[_0x3f9a[31]](_0x4402x6[_0x3f9a[32]])[_0x3f9a[11]](function(_0x4402xc){return _0x4402x7[_0x3f9a[10]](201)[_0x3f9a[9]](_0x4402xc)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[33]]=function(_0x4402x6,_0x4402x7){if(_0x4402x6[_0x3f9a[32]][_0x3f9a[18]]){delete _0x4402x6[_0x3f9a[32]][_0x3f9a[18]]};return ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402xc){if(!_0x4402xc){return _0x4402x7[_0x3f9a[22]](404)};var _0x4402xf=_[_0x3f9a[34]](_0x4402xc,_0x4402x6[_0x3f9a[32]]);_0x4402xf[_0x3f9a[35]]()[_0x3f9a[11]](function(){return _0x4402x7[_0x3f9a[10]](200)[_0x3f9a[9]](_0x4402xc)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[36]]=function(_0x4402x6,_0x4402x7,_0x4402xa){return ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402x10){if(!_0x4402x10){return _0x4402x7[_0x3f9a[22]](404)};return _0x4402x10[_0x3f9a[39]](_0x4402x6[_0x3f9a[32]][_0x3f9a[37]],{penalty:_0x4402x6[_0x3f9a[32]][_0x3f9a[38]],queue:_0x4402x10[_0x3f9a[27]]},{individualHooks:true})})[_0x3f9a[11]](function(){return _0x4402x7[_0x3f9a[22]](200)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[40]]=function(_0x4402x6,_0x4402x7,_0x4402xa){return ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402x10){if(!_0x4402x10){return _0x4402x7[_0x3f9a[22]](404)};return _0x4402x10[_0x3f9a[41]](_0x4402x6[_0x3f9a[12]][_0x3f9a[37]],{individualHooks:true})})[_0x3f9a[11]](function(){return _0x4402x7[_0x3f9a[22]](200)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[42]]=function(_0x4402x6,_0x4402x7){ChatQueue[_0x3f9a[24]](_0x4402x6[_0x3f9a[23]][_0x3f9a[18]])[_0x3f9a[11]](function(_0x4402xc){if(!_0x4402xc){return _0x4402x7[_0x3f9a[22]](404)};_0x4402xc[_0x3f9a[42]]()[_0x3f9a[11]](function(){return _0x4402x7[_0x3f9a[22]](204)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};exports[_0x3f9a[43]]=function(_0x4402x6,_0x4402x7){return ChatQueue[_0x3f9a[42]]({where:{id:_0x4402x6[_0x3f9a[12]][_0x3f9a[44]]},individualHooks:true})[_0x3f9a[11]](function(){return _0x4402x7[_0x3f9a[22]](204)})[_0x3f9a[8]](function(_0x4402x8){return handleError(_0x4402x7,_0x4402x8)})};function handleError(_0x4402x7,_0x4402x8){return _0x4402x7[_0x3f9a[10]](500)[_0x3f9a[9]](_0x4402x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var ChatQueue = require('../../models').ChatQueue; +var User = require('../../models').User; +var UserHasChatQueue = require('../../models').UserHasChatQueue; + +// Get list of mailQueues +exports.index = function(req, res) { + return ChatQueue + .scope('default') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of my chat_rooms +exports.me = function(req, res, next) { + UserHasChatQueue + .findAll({ + where: { + UserId: req.user.id + } + }) + .then(function(userHasChatQueues) { + return res.status(200).send(userHasChatQueues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single chat_queue +exports.show = function(req, res) { + ChatQueue + .findById(req.params.id) + .then(function(chat_queue) { + if (!chat_queue) { + return res.sendStatus(404); + } + return res.send(chat_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single queue +exports.showAgents = function(req, res) { + return ChatQueue + .findById(req.params.id) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .getUsers({ + where: { + role: 'agent' + }, + attributes: ['id', 'name', 'fullname', 'email'] + }); + }) + .then(function(agents) { + return res.status(200).send(agents); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new chat_queue in the DB. +exports.create = function(req, res) { + return ChatQueue + .create(req.body) + .then(function(chat_queue) { + return res.status(201).send(chat_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing chat_queue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ChatQueue + .findById(req.params.id) + .then(function(chat_queue) { + if (!chat_queue) { + return res.sendStatus(404); + } + var updated = _.merge(chat_queue, req.body); + updated.save() + .then(function() { + return res.status(200).send(chat_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Add agents to chat queues +exports.addAgents = function(req, res, next) { + + return ChatQueue + .findById(req.params.id) + .then(function(chatQueue) { + if (!chatQueue) { + return res.sendStatus(404); + } + return chatQueue + .addUsers(req.body.agents, { + penalty: req.body.penalty, + queue: chatQueue.name + }, { + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.removeAgents = function(req, res, next) { + return ChatQueue + .findById(req.params.id) + .then(function(chatQueue) { + if (!chatQueue) { + return res.sendStatus(404); + } + return chatQueue + .removeUsers(req.query.agents, { + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a chat_queue from the DB. +exports.destroy = function(req, res) { + ChatQueue + .findById(req.params.id) + .then(function(chat_queue) { + if (!chat_queue) { + return res.sendStatus(404); + } + chat_queue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return ChatQueue + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_queue/chat_queue.socket.js b/server/api/chat_queue/chat_queue.socket.js index 46d19b2..2e7f5d4 100644 --- a/server/api/chat_queue/chat_queue.socket.js +++ b/server/api/chat_queue/chat_queue.socket.js @@ -1 +1,24 @@ -var _0xe5c3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xe5c3[0];var chatQueue=require(_0xe5c3[2])[_0xe5c3[1]];exports[_0xe5c3[3]]=function(_0x6f1ax2){chatQueue[_0xe5c3[4]](function(_0x6f1ax3){onSave(_0x6f1ax2,_0x6f1ax3)});chatQueue[_0xe5c3[5]](function(_0x6f1ax3){onRemove(_0x6f1ax2,_0x6f1ax3)})};function onSave(_0x6f1ax2,_0x6f1ax3,_0x6f1ax5){_0x6f1ax2[_0xe5c3[7]](_0xe5c3[6],_0x6f1ax3)}function onRemove(_0x6f1ax2,_0x6f1ax3,_0x6f1ax5){_0x6f1ax2[_0xe5c3[7]](_0xe5c3[8],_0x6f1ax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var chatQueue = require('../../models').ChatQueue; + +exports.register = function (socket) { + chatQueue.afterCreate(function (doc) { + onSave(socket, doc); + }); + chatQueue.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chat_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_queue:remove', doc); +} diff --git a/server/api/chat_queue/index.js b/server/api/chat_queue/index.js index 6c91e2b..d4cc855 100644 --- a/server/api/chat_queue/index.js +++ b/server/api/chat_queue/index.js @@ -1 +1,21 @@ -var _0x53c6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x43\x68\x61\x74","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x6D\x65","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x6D\x65","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x64\x65\x6C\x65\x74\x65","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x53c6[0];var express=require(_0x53c6[1]);var controller=require(_0x53c6[2]);var auth=require(_0x53c6[3]);var license=require(_0x53c6[4]);var router=express.Router();router[_0x53c6[9]](_0x53c6[5],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[8]]);router[_0x53c6[9]](_0x53c6[10],license[_0x53c6[6]](),license[_0x53c6[7]](),auth[_0x53c6[11]](),controller[_0x53c6[12]]);router[_0x53c6[9]](_0x53c6[13],auth[_0x53c6[11]](),license[_0x53c6[7]](),controller[_0x53c6[14]]);router[_0x53c6[9]](_0x53c6[15],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[16]]);router[_0x53c6[18]](_0x53c6[5],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[17]]);router[_0x53c6[18]](_0x53c6[13],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[19]]);router[_0x53c6[21]](_0x53c6[15],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[20]]);router[_0x53c6[23]](_0x53c6[13],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[22]]);router[_0x53c6[24]](_0x53c6[15],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[20]]);router[_0x53c6[23]](_0x53c6[5],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[25]]);router[_0x53c6[23]](_0x53c6[15],license[_0x53c6[6]](),license[_0x53c6[7]](),controller[_0x53c6[26]]);module[_0x53c6[27]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_queue.controller'); +var auth = require('../../auth/auth.service'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasChat(), controller.index); +router.get('/me', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.me); +router.get('/:id/agents', auth.isAuthenticated(), license.hasChat(), controller.showAgents); +router.get('/:id', license.isValidDate(), license.hasChat(), controller.show); +router.post('/', license.isValidDate(), license.hasChat(), controller.create); +router.post('/:id/agents', license.isValidDate(), license.hasChat(), controller.addAgents); +router.put('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/:id/agents', license.isValidDate(), license.hasChat(), controller.removeAgents); +router.patch('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/', license.isValidDate(), license.hasChat(), controller.bulkDestroy); +router.delete('/:id', license.isValidDate(), license.hasChat(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_room/chat_room.controller.js b/server/api/chat_room/chat_room.controller.js index 470d72b..efdde6b 100644 --- a/server/api/chat_room/chat_room.controller.js +++ b/server/api/chat_room/chat_room.controller.js @@ -1 +1,499 @@ -var _0x5bd6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x64\x35","\x6D\x6F\x6D\x65\x6E\x74","\x74\x6F\x2D\x63\x73\x76","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x72\x6F\x6C\x65","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6D\x65","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x67\x65\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77","\x70\x61\x72\x61\x6D\x73","\x75\x73\x65\x72\x70\x69\x63","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x55\x73\x65\x72\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x67\x65\x74\x55\x73\x65\x72\x73","\x75\x73\x65\x72\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x73\x70\x72\x65\x61\x64","\x62\x61\x73\x65\x36\x34","\x73\x6F\x72\x74","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x4F\x50\x45\x4E","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74","\x20","\x72\x65\x70\x6C\x61\x63\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65\x73","\x74\x65\x78\x74\x2F\x63\x73\x76","\x74\x79\x70\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x54\x79\x70\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x47\x72\x6F\x75\x70\x73","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79"];_0x5bd6[0];var _=require(_0x5bd6[1]);var md5=require(_0x5bd6[2]);var moment=require(_0x5bd6[3]);var csv=require(_0x5bd6[4]);var Util=require(_0x5bd6[5]);var User=require(_0x5bd6[7])[_0x5bd6[6]];var ChatRoom=require(_0x5bd6[7])[_0x5bd6[8]];var ChatMessage=require(_0x5bd6[7])[_0x5bd6[9]];var ChatVisitor=require(_0x5bd6[7])[_0x5bd6[10]];var UserHasChatRoom=require(_0x5bd6[7])[_0x5bd6[11]];exports[_0x5bd6[12]]=function(_0x1c24xb,_0x1c24xc,_0x1c24xd){return ChatRoom[_0x5bd6[27]](_[_0x5bd6[26]](Util[_0x5bd6[19]](_0x1c24xb[_0x5bd6[18]]),{include:[{model:User,attributes:[_0x5bd6[20],_0x5bd6[21],_0x5bd6[22],_0x5bd6[23],_0x5bd6[24],_0x5bd6[25]]},{model:ChatMessage},{model:ChatVisitor}]}))[_0x5bd6[17]](function(_0x1c24xf){_0x1c24xc[_0x5bd6[16]](200)[_0x5bd6[15]](_0x1c24xf)})[_0x5bd6[14]](function(_0x1c24xe){console[_0x5bd6[13]](_0x1c24xe);return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[28]]=function(_0x1c24xb,_0x1c24xc){return User[_0x5bd6[32]](_0x1c24xb[_0x5bd6[31]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x11){return _0x1c24x11[_0x5bd6[30]]({include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[22],_0x5bd6[23]]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[21],_0x5bd6[22],_0x5bd6[23],_0x5bd6[24],_0x5bd6[25]]}]})})[_0x5bd6[17]](function(_0x1c24x10){if(!_0x1c24x10){return _0x1c24xc[_0x5bd6[29]](404)};return _0x1c24xc[_0x5bd6[15]](_0x1c24x10)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[33]]=function(_0x1c24xb,_0x1c24xc){return ChatRoom[_0x5bd6[32]](_0x1c24xb[_0x5bd6[34]][_0x5bd6[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[23],_0x5bd6[22]]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[23],_0x5bd6[21],_0x5bd6[22],_0x5bd6[35]]}]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[23],_0x5bd6[21],_0x5bd6[22]]},{model:ChatVisitor}]})[_0x5bd6[17]](function(_0x1c24x12){if(!_0x1c24x12){return _0x1c24xc[_0x5bd6[29]](404)};return _0x1c24xc[_0x5bd6[15]](_0x1c24x12)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[36]]=function(_0x1c24xb,_0x1c24xc,_0x1c24xd){var _0x1c24x13;return ChatRoom[_0x5bd6[46]]({where:{token:md5(JSON[_0x5bd6[44]](_0x1c24xb[_0x5bd6[18]][_0x5bd6[39]][_0x5bd6[43]]())).toString(_0x5bd6[42])},defaults:{type:_0x5bd6[25],token:md5(JSON[_0x5bd6[44]](_0x1c24xb[_0x5bd6[18]][_0x5bd6[39]][_0x5bd6[43]]())).toString(_0x5bd6[42]),status:_0x5bd6[45]},include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[23],_0x5bd6[22]]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[21],_0x5bd6[22],_0x5bd6[23],_0x5bd6[24],_0x5bd6[25]]}]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[21],_0x5bd6[22],_0x5bd6[23],_0x5bd6[24],_0x5bd6[25]]}]})[_0x5bd6[41]](function(_0x1c24x12,_0x1c24x15){_0x1c24x13=_0x1c24x12;if(_0x1c24x15){return _0x1c24x13[_0x5bd6[40]](_0x1c24xb[_0x5bd6[18]][_0x5bd6[39]])}else {return}})[_0x5bd6[17]](function(){return _0x1c24x13[_0x5bd6[38]]()})[_0x5bd6[17]](function(_0x1c24x14){return _0x1c24xc[_0x5bd6[16]](200)[_0x5bd6[15]](_[_0x5bd6[26]](_0x1c24x13[_0x5bd6[37]],{Users:_0x1c24x14}))})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[47]]=function(_0x1c24xb,_0x1c24xc,_0x1c24xd){console[_0x5bd6[13]](_0x5bd6[47]);return ChatRoom[_0x5bd6[32]](_0x1c24xb[_0x5bd6[34]][_0x5bd6[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[22]]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[22]]}]}]})[_0x5bd6[17]](function(_0x1c24x12){var _0x1c24x16=[];_0x1c24x12[_0x5bd6[54]][_0x5bd6[53]](function(_0x1c24x17){_0x1c24x16[_0x5bd6[52]]({name:_0x1c24x17[_0x5bd6[6]]?_0x1c24x17[_0x5bd6[6]][_0x5bd6[22]]:_0x1c24x17[_0x5bd6[10]][_0x5bd6[22]],text:_0x1c24x17[_0x5bd6[50]][_0x5bd6[49]](/(\r\n|\n|\r)/gm,_0x5bd6[48]),date:_0x1c24x17[_0x5bd6[51]]})});return _0x1c24xc[_0x5bd6[56]](_0x5bd6[55])[_0x5bd6[16]](200)[_0x5bd6[15]](csv(_0x1c24x16))})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[57]]=function(_0x1c24xb,_0x1c24xc){User[_0x5bd6[32]](_0x1c24xb[_0x5bd6[31]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x11){_0x1c24x11[_0x5bd6[30]]({where:{type:_0x1c24xb[_0x5bd6[34]][_0x5bd6[56]]},include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[22],_0x5bd6[23]]}]})[_0x5bd6[17]](function(_0x1c24x10){if(!_0x1c24x10){return _0x1c24xc[_0x5bd6[29]](404)};return _0x1c24xc[_0x5bd6[15]](_0x1c24x10)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[58]]=function(_0x1c24xb,_0x1c24xc){User[_0x5bd6[32]](_0x1c24xb[_0x5bd6[31]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x11){_0x1c24x11[_0x5bd6[30]]({include:[{model:ChatVisitor,attributes:[_0x5bd6[20],_0x5bd6[22],_0x5bd6[23]]},{model:User,attributes:[_0x5bd6[20],_0x5bd6[21],_0x5bd6[22],_0x5bd6[23],_0x5bd6[24],_0x5bd6[25]]}]})[_0x5bd6[17]](function(_0x1c24x10){if(!_0x1c24x10){return _0x1c24xc[_0x5bd6[29]](404)};return _0x1c24xc[_0x5bd6[15]](_0x1c24x10)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[59]]=function(_0x1c24xb,_0x1c24xc){};exports[_0x5bd6[60]]=function(_0x1c24xb,_0x1c24xc){if(_0x1c24xb[_0x5bd6[50]][_0x5bd6[20]]){delete _0x1c24xb[_0x5bd6[50]][_0x5bd6[20]]};ChatRoom[_0x5bd6[32]](_0x1c24xb[_0x5bd6[34]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x12){if(!_0x1c24x12){return _0x1c24xc[_0x5bd6[29]](404)};var _0x1c24x18=_[_0x5bd6[26]](_0x1c24x12,_0x1c24xb[_0x5bd6[50]]);_0x1c24x18[_0x5bd6[61]]()[_0x5bd6[17]](function(){return _0x1c24xc[_0x5bd6[16]](200)[_0x5bd6[15]](_0x1c24x12)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[62]]=function(_0x1c24xb,_0x1c24xc){var _0x1c24x13;if(_0x1c24xb[_0x5bd6[50]][_0x5bd6[20]]){delete _0x1c24xb[_0x5bd6[50]][_0x5bd6[20]]};return ChatRoom[_0x5bd6[32]](_0x1c24xb[_0x5bd6[34]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x12){if(!_0x1c24x12||!_0x1c24xb[_0x5bd6[50]][_0x5bd6[39]]){return _0x1c24xc[_0x5bd6[29]](404)};return _0x1c24x12})[_0x5bd6[17]](function(_0x1c24x12){return _0x1c24x12[_0x5bd6[60]]({token:md5(JSON[_0x5bd6[44]](_0x1c24xb[_0x5bd6[50]][_0x5bd6[39]][_0x5bd6[43]]())).toString(_0x5bd6[42])})})[_0x5bd6[17]](function(_0x1c24x12){_0x1c24x13=_0x1c24x12;return _0x1c24x12[_0x5bd6[40]](_0x1c24xb[_0x5bd6[50]][_0x5bd6[39]][_0x5bd6[43]](),{individualHooks:true})})[_0x5bd6[17]](function(){return _0x1c24x13[_0x5bd6[38]]()})[_0x5bd6[17]](function(_0x1c24x14){return _0x1c24xc[_0x5bd6[16]](200)[_0x5bd6[15]](_[_0x5bd6[26]](_0x1c24x13[_0x5bd6[37]],{Users:_0x1c24x14,ChatMessages:[]}))})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};exports[_0x5bd6[63]]=function(_0x1c24xb,_0x1c24xc){ChatRoom[_0x5bd6[32]](_0x1c24xb[_0x5bd6[34]][_0x5bd6[20]])[_0x5bd6[17]](function(_0x1c24x12){if(!_0x1c24x12){return _0x1c24xc[_0x5bd6[29]](404)};_0x1c24x12[_0x5bd6[63]]()[_0x5bd6[17]](function(){return _0x1c24xc[_0x5bd6[29]](204)})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})})[_0x5bd6[14]](function(_0x1c24xe){return handleError(_0x1c24xc,_0x1c24xe)})};function handleError(_0x1c24xc,_0x1c24xe){return _0x1c24xc[_0x5bd6[16]](500)[_0x5bd6[15]](_0x1c24xe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var md5 = require('md5'); +var moment = require('moment'); +var csv = require('to-csv'); + +var Util = require('../../config/util'); + +var User = require('../../models').User; +var ChatRoom = require('../../models').ChatRoom; +var ChatMessage = require('../../models').ChatMessage; +var ChatVisitor = require('../../models').ChatVisitor; +var UserHasChatRoom = require('../../models').UserHasChatRoom; + + +// Get list of chat_rooms +exports.index = function(req, res, next) { + return ChatRoom + .findAndCountAll(_.merge(Util.getQuery(req.query), { + include: [{ + model: User, + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }, { + model: ChatMessage + }, { + model: ChatVisitor + }] + })) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get list of my chat_rooms +exports.me = function(req, res) { + return User + .findById(req.user.id) + .then(function(user) { + return user + .getChatRooms({ + include: [{ + model: ChatVisitor, + attributes: ['id', 'fullname', 'email'] + }, { + model: User, + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }] + }); + }) + .then(function(chatRooms) { + if (!chatRooms) { + return res.sendStatus(404); + } + return res.send(chatRooms); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single chatRoom +exports.show = function(req, res) { + return ChatRoom + .findById(req.params.id, { + include: [{ + model: ChatMessage, + include: [{ + model: ChatVisitor, + attributes: ['id', 'email', 'fullname'] + }, { + model: User, + attributes: ['id', 'email', 'name', 'fullname', 'userpic'] + }] + }, { + model: User, + attributes: ['id', 'email', 'name', 'fullname'] + }, { + model: ChatVisitor + }] + }) + .then(function(chatRoom) { + if (!chatRoom) { + return res.sendStatus(404); + } + return res.send(chatRoom); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single chatRoom by users +exports.getRoomByUsers = function(req, res, next) { + + var _chatRoom; + + return ChatRoom + .findOrCreate({ + where: { + token: md5(JSON.stringify(req.query.users.sort())).toString('base64') + }, + defaults: { + type: 'internal', + token: md5(JSON.stringify(req.query.users.sort())).toString('base64'), + status: 'OPEN' + }, + include: [{ + model: ChatMessage, + include: [{ + model: ChatVisitor, + attributes: ['id', 'email', 'fullname'] + }, { + model: User, + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }] + }, { + model: User, + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }] + }) + .spread(function(chatRoom, created) { + _chatRoom = chatRoom; + // _chatRoom.dataValues.ChatMessages = []; + if (created) { + return _chatRoom + .setUsers(req.query.users); + } else { + return; + } + }) + .then(function() { + return _chatRoom + .getUsers(); + }) + .then(function(users) { + return res.status(200).send(_.merge(_chatRoom.dataValues, { + Users: users + })); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.export = function(req, res, next) { + console.log('export'); + return ChatRoom + .findById(req.params.id, { + include: [{ + model: ChatMessage, + include: [{ + model: ChatVisitor, + attributes: ['id', 'fullname'] + }, { + model: User, + attributes: ['id', 'fullname'] + }] + }] + }) + .then(function(chatRoom) { + var chatMessageForCSV = []; + chatRoom.ChatMessages.forEach(function(chatMessage) { + chatMessageForCSV.push({ + name: chatMessage.User ? chatMessage.User.fullname : chatMessage.ChatVisitor.fullname, + text: chatMessage.body.replace(/(\r\n|\n|\r)/gm, " "), + date: chatMessage.createdAt + }); + }); + return res.type('text/csv').status(200).send(csv(chatMessageForCSV)); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single chatRoom +exports.getRoomByType = function(req, res) { + User + .findById(req.user.id) + .then(function(user) { + user + .getChatRooms({ + where: { + type: req.params.type + }, + include: [{ + model: ChatVisitor, + attributes: ['id', 'fullname', 'email'] + }] + }) + .then(function(chatRooms) { + if (!chatRooms) { + return res.sendStatus(404); + } + return res.send(chatRooms); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single chatRoom +exports.getRoomGroups = function(req, res) { + User + .findById(req.user.id) + .then(function(user) { + user + .getChatRooms({ + include: [{ + model: ChatVisitor, + attributes: ['id', 'fullname', 'email'] + }, { + model: User, + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }] + }) + .then(function(chatRooms) { + if (!chatRooms) { + return res.sendStatus(404); + } + return res.send(chatRooms); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new chatRoom in the DB. +exports.create = function(req, res) { + // if (req.body.to) { + // + // var token; + // var participants = { + // users: { + // ids: [] + // }, + // visitor: {} + // }; + // + // switch (req.body.type) { + // case 'internal': + // + // if (!req.body.to.isArray) { + // req.body.to = [parseInt(req.body.to, 10)]; + // } + // + // participants.users.ids = req.body.to; + // + // if (!_.contains(req.body.to, req.user.id)) { + // participants.users.ids.push(req.user.id); + // } + // + // participants.users.ids.sort(); + // + // token = md5(JSON.stringify(participants)).toString( + // 'base64'); + // + // participants.users.fullnames = []; + // + // User + // .findAll({ + // where: { + // id: { + // $in: req.body.to + // } + // }, + // attributes: ['id', 'fullname'] + // }) + // .then(function(users) { + // + // _.sortBy(users, 'id').forEach(function(item, index) { + // participants.users.fullnames.push(item.fullname); + // }); + // + // ChatRoom + // .findOrCreate({ + // where: { + // token: token + // }, + // defaults: _.merge({ + // token: token, + // participants: JSON.stringify(participants) + // }, req.body), + // include: [{ + // model: ChatMessage + // }] + // }) + // .spread(function(chatRoom, created) { + // + // if (created) { + // chatRoom + // .setUsers(participants.users.ids) + // .then(function() { + // return res.status(201).send(chatRoom); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // } else { + // return res.status(201).send(chatRoom); + // } + // + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // + // break; + // case 'external': + // + // participants.visitor.id = req.body.to; + // participants.users.ids.push(req.user.id); + // participants.users.ids.sort(); + // + // token = md5(JSON.stringify(participants)).toString('base64'); + // + // participants.users.fullnames = [req.user.fullname]; + // + // ChatVisitor + // .findById(req.body.to, { + // attributes: ['id', 'fullname', 'email', 'referer'] + // }) + // .then(function(chatVisitor) { + // participants.visitor.fullname = chatVisitor.fullname; + // participants.visitor.referer = chatVisitor.referer; + // participants.visitor.email = chatVisitor.email; + // + // ChatRoom + // .findOrCreate({ + // where: { + // token: token + // }, + // defaults: _.merge({ + // token: token, + // participants: JSON.stringify(participants) + // }, req.body), + // include: [{ + // model: ChatMessage + // }, { + // model: ChatVisitor + // }, { + // model: User, + // }] + // }) + // .spread(function(chatRoom, created) { + // if (created) { + // + // chatRoom + // .setUsers(participants.users.ids, { + // individualHooks: true + // }) + // .then(function() { + // chatRoom + // .setChatVisitor(participants.visitor.id) + // .then(function() { + // return res.status(201).send(chatRoom); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // } else { + // return res.status(201).send(chatRoom); + // } + // + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + // + // break; + // default: + // } + // } else { + // return handleError(res, new Error('field "to" omitted')); + // } +}; + +// Updates an existing chatRoom in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + ChatRoom + .findById(req.params.id) + .then(function(chatRoom) { + if (!chatRoom) { + return res.sendStatus(404); + } + var updated = _.merge(chatRoom, req.body); + updated + .save() + .then(function() { + return res.status(200).send(chatRoom); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing chatRoom in the DB. +exports.updateUsers = function(req, res) { + var _chatRoom; + + if (req.body.id) { + delete req.body.id; + } + + return ChatRoom + .findById(req.params.id) + .then(function(chatRoom) { + if (!chatRoom || !req.body.users) { + return res.sendStatus(404); + } + return chatRoom; + }) + .then(function(chatRoom) { + return chatRoom + .update({ + token: md5(JSON.stringify(req.body.users.sort())).toString('base64') + }); + }) + .then(function(chatRoom) { + _chatRoom = chatRoom; + return chatRoom + .setUsers(req.body.users.sort(), { + individualHooks: true + }); + }) + .then(function() { + return _chatRoom + .getUsers(); + }) + .then(function(users) { + return res.status(200).send(_.merge(_chatRoom.dataValues, { + Users: users, + ChatMessages: [] + })); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a chatRoom from the DB. +exports.destroy = function(req, res) { + ChatRoom + .findById(req.params.id) + .then(function(chatRoom) { + if (!chatRoom) { + return res.sendStatus(404); + } + + chatRoom + .destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_room/chat_room.socket.js b/server/api/chat_room/chat_room.socket.js index 9bb273f..2f75a98 100644 --- a/server/api/chat_room/chat_room.socket.js +++ b/server/api/chat_room/chat_room.socket.js @@ -1 +1,30 @@ -var _0xa72e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0xa72e[0];var User=require(_0xa72e[2])[_0xa72e[1]];var ChatRoom=require(_0xa72e[2])[_0xa72e[3]];var ChatMessage=require(_0xa72e[2])[_0xa72e[4]];var ChatVisitor=require(_0xa72e[2])[_0xa72e[5]];exports[_0xa72e[6]]=function(_0xad40x5){ChatRoom[_0xa72e[7]](function(_0xad40x6){onSave(_0xad40x5,_0xad40x6)});ChatRoom[_0xa72e[8]](function(_0xad40x6){onSave(_0xad40x5,_0xad40x6)});ChatRoom[_0xa72e[9]](function(_0xad40x6){onRemove(_0xad40x5,_0xad40x6)})};function onSave(_0xad40x5,_0xad40x6,_0xad40x8){_0xad40x5[_0xa72e[11]](_0xa72e[10],_0xad40x6)}function onRemove(_0xad40x5,_0xad40x6,_0xad40x8){_0xad40x5[_0xa72e[11]](_0xa72e[12],_0xad40x6)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var User = require('../../models').User; +var ChatRoom = require('../../models').ChatRoom; +var ChatMessage = require('../../models').ChatMessage; +var ChatVisitor = require('../../models').ChatVisitor; + +exports.register = function (socket) { + ChatRoom.afterCreate(function (doc) { + onSave(socket, doc); + }); + ChatRoom.afterUpdate(function (doc) { + onSave(socket, doc); + }); + ChatRoom.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chat_room:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_room:remove', doc); +} diff --git a/server/api/chat_room/index.js b/server/api/chat_room/index.js index 4bc6405..731381f 100644 --- a/server/api/chat_room/index.js +++ b/server/api/chat_room/index.js @@ -1 +1,22 @@ -var _0x9f87=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x43\x68\x61\x74","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x6D\x65","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x6D\x65","\x2F\x75\x73\x65\x72\x73","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x55\x73\x65\x72\x73","\x2F\x67\x72\x6F\x75\x70\x73","\x67\x65\x74\x52\x6F\x6F\x6D\x47\x72\x6F\x75\x70\x73","\x2F\x74\x79\x70\x65\x2F\x3A\x74\x79\x70\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x54\x79\x70\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x65\x78\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x75\x73\x65\x72\x73","\x75\x70\x64\x61\x74\x65\x55\x73\x65\x72\x73","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x9f87[0];var express=require(_0x9f87[1]);var controller=require(_0x9f87[2]);var auth=require(_0x9f87[3]);var license=require(_0x9f87[4]);var router=express.Router();router[_0x9f87[9]](_0x9f87[5],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[8]]);router[_0x9f87[9]](_0x9f87[10],license[_0x9f87[6]](),license[_0x9f87[7]](),auth[_0x9f87[11]](),controller[_0x9f87[12]]);router[_0x9f87[9]](_0x9f87[13],license[_0x9f87[6]](),license[_0x9f87[7]](),auth[_0x9f87[11]](),controller[_0x9f87[14]]);router[_0x9f87[9]](_0x9f87[15],license[_0x9f87[6]](),license[_0x9f87[7]](),auth[_0x9f87[11]](),controller[_0x9f87[16]]);router[_0x9f87[9]](_0x9f87[17],license[_0x9f87[6]](),license[_0x9f87[7]](),auth[_0x9f87[11]](),controller[_0x9f87[18]]);router[_0x9f87[9]](_0x9f87[19],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[20]]);router[_0x9f87[9]](_0x9f87[21],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[22]]);router[_0x9f87[24]](_0x9f87[5],license[_0x9f87[6]](),license[_0x9f87[7]](),auth[_0x9f87[11]](),controller[_0x9f87[23]]);router[_0x9f87[26]](_0x9f87[19],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[25]]);router[_0x9f87[26]](_0x9f87[27],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[28]]);router[_0x9f87[29]](_0x9f87[19],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[25]]);router[_0x9f87[31]](_0x9f87[19],license[_0x9f87[6]](),license[_0x9f87[7]](),controller[_0x9f87[30]]);module[_0x9f87[32]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_room.controller'); +var auth = require('../../auth/auth.service'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasChat(), controller.index); +router.get('/me', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.me); +router.get('/users', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.getRoomByUsers); +router.get('/groups', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.getRoomGroups); +router.get('/type/:type', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.getRoomByType); +router.get('/:id', license.isValidDate(), license.hasChat(), controller.show); +router.get('/:id/export', license.isValidDate(), license.hasChat(), controller.export); +router.post('/', license.isValidDate(), license.hasChat(), auth.isAuthenticated(), controller.create); +router.put('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.put('/:id/users', license.isValidDate(), license.hasChat(), controller.updateUsers); +router.patch('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/:id', license.isValidDate(), license.hasChat(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_visitor/chat_visitor.controller.js b/server/api/chat_visitor/chat_visitor.controller.js index 2cb2ecd..38e5d14 100644 --- a/server/api/chat_visitor/chat_visitor.controller.js +++ b/server/api/chat_visitor/chat_visitor.controller.js @@ -1 +1,104 @@ -var _0x875c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x69\x6E\x64\x65\x78","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x875c[0];var _=require(_0x875c[1]);var Util=require(_0x875c[2]);var ChatVisitor=require(_0x875c[4])[_0x875c[3]];var ChatEnquiry=require(_0x875c[4])[_0x875c[5]];var ChatWebsite=require(_0x875c[4])[_0x875c[6]];exports[_0x875c[7]]=function(_0xb658x6,_0xb658x7,_0xb658x8){return ChatVisitor[_0x875c[16]](_[_0x875c[15]](Util[_0x875c[14]](_0xb658x6[_0x875c[13]]),{include:[{model:ChatWebsite}]}))[_0x875c[12]](function(_0xb658xa){_0xb658x7[_0x875c[11]](200)[_0x875c[10]](_0xb658xa)})[_0x875c[9]](function(_0xb658x9){console[_0x875c[8]](_0xb658x9);return handleError(_0xb658x7,_0xb658x9)})};exports[_0x875c[17]]=function(_0xb658x6,_0xb658x7){return ChatVisitor[_0x875c[21]](_0xb658x6[_0x875c[20]][_0x875c[19]],{include:[{model:ChatEnquiry},{model:ChatWebsite}]})[_0x875c[12]](function(_0xb658xb){if(!_0xb658xb){return _0xb658x7[_0x875c[18]](404)};return _0xb658x7[_0x875c[10]](_0xb658xb)})[_0x875c[9]](function(_0xb658x9){return handleError(_0xb658x7,_0xb658x9)})};exports[_0x875c[22]]=function(_0xb658x6,_0xb658x7){return ChatVisitor[_0x875c[22]](_0xb658x6[_0x875c[23]])[_0x875c[12]](function(_0xb658xb){return _0xb658x7[_0x875c[11]](201)[_0x875c[10]](_0xb658xb)})[_0x875c[9]](function(_0xb658x9){return handleError(_0xb658x7,_0xb658x9)})};exports[_0x875c[24]]=function(_0xb658x6,_0xb658x7){if(_0xb658x6[_0x875c[23]][_0x875c[19]]){delete _0xb658x6[_0x875c[23]][_0x875c[19]]};return ChatVisitor[_0x875c[21]](_0xb658x6[_0x875c[20]][_0x875c[19]])[_0x875c[12]](function(_0xb658xb){if(!_0xb658xb){return _0xb658x7[_0x875c[18]](404)};var _0xb658xc=_[_0x875c[15]](_0xb658xb,_0xb658x6[_0x875c[23]]);return _0xb658xc[_0x875c[25]]()})[_0x875c[12]](function(_0xb658xb){return _0xb658x7[_0x875c[11]](200)[_0x875c[10]](_0xb658xb)})[_0x875c[9]](function(_0xb658x9){return handleError(_0xb658x7,_0xb658x9)})};exports[_0x875c[26]]=function(_0xb658x6,_0xb658x7){return ChatVisitor[_0x875c[21]](_0xb658x6[_0x875c[20]][_0x875c[19]])[_0x875c[12]](function(_0xb658xb){if(!_0xb658xb){return _0xb658x7[_0x875c[18]](404)};return _0xb658xb[_0x875c[26]]()})[_0x875c[12]](function(){return _0xb658x7[_0x875c[18]](204)})[_0x875c[9]](function(_0xb658x9){return handleError(_0xb658x7,_0xb658x9)})};function handleError(_0xb658x7,_0xb658x9){return _0xb658x7[_0x875c[11]](500)[_0x875c[10]](_0xb658x9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var ChatVisitor = require('../../models').ChatVisitor; +var ChatEnquiry = require('../../models').ChatEnquiry; +var ChatWebsite = require('../../models').ChatWebsite; + +// Get list of agents +exports.index = function(req, res, next) { + return ChatVisitor + .findAndCountAll(_.merge(Util.getQuery(req.query), { + include: [{ + model: ChatWebsite + }] + })) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.error(err); + return handleError(res, err); + }); +}; + +// Get a single chatVisitor +exports.show = function(req, res) { + return ChatVisitor + .findById(req.params.id, { + include: [{ + model: ChatEnquiry + }, { + model: ChatWebsite + }] + }) + .then(function(chatVisitor) { + if (!chatVisitor) { + return res.sendStatus(404); + } + return res.send(chatVisitor); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new chatVisitor in the DB. +exports.create = function(req, res) { + return ChatVisitor + .create(req.body) + .then(function(chatVisitor) { + return res.status(201).send(chatVisitor); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing chatVisitor in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ChatVisitor + .findById(req.params.id) + .then(function(chatVisitor) { + if (!chatVisitor) { + return res.sendStatus(404); + } + var updated = _.merge(chatVisitor, req.body); + return updated + .save(); + }) + .then(function(chatVisitor) { + return res.status(200).send(chatVisitor); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a chatVisitor from the DB. +exports.destroy = function(req, res) { + return ChatVisitor + .findById(req.params.id) + .then(function(chatVisitor) { + if (!chatVisitor) { + return res.sendStatus(404); + } + return chatVisitor + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_visitor/chat_visitor.socket.js b/server/api/chat_visitor/chat_visitor.socket.js index 7efe761..a283bfc 100644 --- a/server/api/chat_visitor/chat_visitor.socket.js +++ b/server/api/chat_visitor/chat_visitor.socket.js @@ -1 +1,27 @@ -var _0x7927=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7927[0];var chat_visitor=require(_0x7927[2])[_0x7927[1]];exports[_0x7927[3]]=function(_0xdfa4x2){chat_visitor[_0x7927[4]](function(_0xdfa4x3){onSave(_0xdfa4x2,_0xdfa4x3)});chat_visitor[_0x7927[5]](function(_0xdfa4x3){onSave(_0xdfa4x2,_0xdfa4x3)});chat_visitor[_0x7927[6]](function(_0xdfa4x3){onRemove(_0xdfa4x2,_0xdfa4x3)})};function onSave(_0xdfa4x2,_0xdfa4x3,_0xdfa4x5){_0xdfa4x2[_0x7927[8]](_0x7927[7],_0xdfa4x3)}function onRemove(_0xdfa4x2,_0xdfa4x3,_0xdfa4x5){_0xdfa4x2[_0x7927[8]](_0x7927[9],_0xdfa4x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var chat_visitor = require('../../models').ChatVisitor; + +exports.register = function(socket) { + chat_visitor.afterCreate(function(doc) { + onSave(socket, doc); + }); + chat_visitor.afterUpdate(function(doc) { + onSave(socket, doc); + }); + chat_visitor.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chat_visitor:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_visitor:remove', doc); +} diff --git a/server/api/chat_visitor/index.js b/server/api/chat_visitor/index.js index 1723ead..c58a917 100644 --- a/server/api/chat_visitor/index.js +++ b/server/api/chat_visitor/index.js @@ -1 +1,15 @@ -var _0xc43f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x43\x68\x61\x74","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xc43f[0];var express=require(_0xc43f[1]);var controller=require(_0xc43f[2]);var license=require(_0xc43f[3]);var router=express.Router();router[_0xc43f[8]](_0xc43f[4],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[7]]);router[_0xc43f[8]](_0xc43f[9],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[10]]);router[_0xc43f[12]](_0xc43f[4],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[11]]);router[_0xc43f[14]](_0xc43f[9],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[13]]);router[_0xc43f[15]](_0xc43f[9],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[13]]);router[_0xc43f[17]](_0xc43f[9],license[_0xc43f[5]](),license[_0xc43f[6]](),controller[_0xc43f[16]]);module[_0xc43f[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_visitor.controller'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasChat(), controller.index); +router.get('/:id', license.isValidDate(), license.hasChat(), controller.show); +router.post('/', license.isValidDate(), license.hasChat(), controller.create); +router.put('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.patch('/:id', license.isValidDate(), license.hasChat(), controller.update); +router.delete('/:id', license.isValidDate(), license.hasChat(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_website/chat_website.controller.js b/server/api/chat_website/chat_website.controller.js index 4222f6b..084d688 100644 --- a/server/api/chat_website/chat_website.controller.js +++ b/server/api/chat_website/chat_website.controller.js @@ -1 +1,383 @@ -var _0x2a6a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x6D\x75\x73\x74\x61\x63\x68\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x55\x73\x65\x72","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x73\x6E\x69\x70\x70\x65\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x78\x63\x68\x61\x74\x74\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6C\x6F\x67","\x6C\x65\x6E\x67\x74\x68","\x6E\x61\x6D\x65","\x6D\x65\x72\x67\x65","\x67\x65\x74\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x67\x65\x74\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x67\x65\x74\x53\x6E\x69\x70\x70\x65\x74\x43\x6F\x64\x65","\x72\x65\x6D\x6F\x74\x65","\x72\x65\x6E\x64\x65\x72","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x77\x65\x62\x73\x69\x74\x65\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x64\x73","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x67\x65\x74\x46\x6F\x72\x6D\x73","\x6A\x73\x6F\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x74\x79\x70\x65","\x73\x63\x6F\x70\x65","\x75\x70\x64\x61\x74\x65\x46\x6F\x72\x6D\x73","\x6F\x6E\x6C\x69\x6E\x65","\x4F\x6E\x6C\x69\x6E\x65\x49\x64","\x6F\x66\x66\x6C\x69\x6E\x65","\x4F\x66\x66\x6C\x69\x6E\x65\x49\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x64\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x70\x61\x63\x74\x69\x6F\x6E\x49\x64","\x63\x72\x65\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x75\x70\x64\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E"];_0x2a6a[0];var _=require(_0x2a6a[1]);var util=require(_0x2a6a[2]);var async=require(_0x2a6a[3]);var Mustache=require(_0x2a6a[4]);var Util=require(_0x2a6a[5]);var sequelize=require(_0x2a6a[7])[_0x2a6a[6]];var ChatWebsite=require(_0x2a6a[7])[_0x2a6a[8]];var ChatQueue=require(_0x2a6a[7])[_0x2a6a[9]];var User=require(_0x2a6a[7])[_0x2a6a[10]];var ChatApplication=require(_0x2a6a[7])[_0x2a6a[11]];var ChatWebsitesField=require(_0x2a6a[7])[_0x2a6a[12]];var ChatProactiveAction=require(_0x2a6a[7])[_0x2a6a[13]];var snippet=require(_0x2a6a[15])[_0x2a6a[14]];exports[_0x2a6a[16]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatWebsite[_0x2a6a[23]](Util[_0x2a6a[22]](_0xeddaxe[_0x2a6a[21]]))[_0x2a6a[20]](function(_0xeddax12){_0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[18]](_0xeddax12)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[24]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax13){if(!_0xeddax13){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddaxf[_0x2a6a[18]](_0xeddax13)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[29]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax15){if(!_0xeddax15){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax15[_0x2a6a[34]](_[_0x2a6a[33]](Util[_0x2a6a[22]](_0xeddaxe[_0x2a6a[21]]),{include:[{model:ChatQueue,attributes:[_0x2a6a[26],_0x2a6a[32]]},{model:User,attributes:[_0x2a6a[26],_0x2a6a[32]]}]}))})[_0x2a6a[20]](function(_0xeddax14){return _0xeddaxf[_0x2a6a[18]]({count:_0xeddax14[_0x2a6a[31]],rows:_0xeddax14})})[_0x2a6a[17]](function(_0xeddax11){console[_0x2a6a[30]](_0xeddax11);return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[35]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax15){if(!_0xeddax15){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax15[_0x2a6a[36]](Util[_0x2a6a[22]](_0xeddaxe[_0x2a6a[21]]))})[_0x2a6a[20]](function(_0xeddax16){return _0xeddaxf[_0x2a6a[18]]({count:_0xeddax16[_0x2a6a[31]],rows:_0xeddax16})})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[37]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax13){var _0xeddax17={remote:_0xeddax13[_0x2a6a[38]],websiteId:_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]};var _0xeddax18=Mustache[_0x2a6a[39]](snippet,_0xeddax17);return _0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[18]]({html:_0xeddax18})})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[40]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsite[_0x2a6a[40]](_0xeddaxe[_0x2a6a[41]])[_0x2a6a[20]](function(_0xeddax13){return _0xeddaxf[_0x2a6a[19]](201)[_0x2a6a[18]](_0xeddax13)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[42]]=function(_0xeddaxe,_0xeddaxf){if(_0xeddaxe[_0x2a6a[41]][_0x2a6a[26]]){delete _0xeddaxe[_0x2a6a[41]][_0x2a6a[26]]};return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax13){if(!_0xeddax13){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax13[_0x2a6a[42]](_0xeddaxe[_0x2a6a[41]])[_0x2a6a[20]](function(_0xeddax13){return _0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[18]](_0xeddax13)})})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[43]]=function(_0xeddaxe,_0xeddaxf){var _0xeddax19=0;var _0xeddax1a=_0xeddaxe[_0x2a6a[41]];_0xeddax1a[_0x2a6a[47]](function(_0xeddax1b){delete _0xeddax1b[_0x2a6a[26]];delete _0xeddax1b[_0x2a6a[44]];delete _0xeddax1b[_0x2a6a[45]];_0xeddax1b[_0x2a6a[46]]= ++_0xeddax19});return sequelize[_0x2a6a[50]](function(_0xeddax1c){return ChatApplication[_0x2a6a[49]]({where:{ChatWebsiteId:_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]},individualHooks:true,transaction:_0xeddax1c})[_0x2a6a[20]](function(){return ChatApplication[_0x2a6a[48]](_0xeddax1a,{individualHooks:true,transaction:_0xeddax1c})})})[_0x2a6a[20]](function(_0xeddax14){return _0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[18]]({count:_0xeddax14[_0x2a6a[31]],rows:_0xeddax14})})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[49]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax13){if(!_0xeddax13){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax13[_0x2a6a[49]]()})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[51]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsite[_0x2a6a[49]]({where:{id:_0xeddaxe[_0x2a6a[21]][_0x2a6a[52]]},individualHooks:true})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[53]]=function(_0xeddaxe,_0xeddaxf){return ChatApplication[_0x2a6a[49]]({where:{id:_0xeddaxe[_0x2a6a[21]][_0x2a6a[54]]},individualHooks:true})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[55]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatApplication[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[56]])[_0x2a6a[20]](function(_0xeddax1d){if(!_0xeddax1d){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax1d[_0x2a6a[49]]()})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[57]]=function(_0xeddaxe,_0xeddaxf){return ChatWebsitesField[_0x2a6a[61]]({method:[_0xeddaxe[_0x2a6a[27]][_0x2a6a[60]],_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]]})[_0x2a6a[59]]()[_0x2a6a[20]](function(_0xeddax1e){return _0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[58]](_0xeddax1e)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[62]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatWebsitesField[_0x2a6a[49]]({where:_0xeddaxe[_0x2a6a[27]][_0x2a6a[60]]===_0x2a6a[63]?{OnlineId:_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]}:{OfflineId:_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]}})[_0x2a6a[20]](function(){_[_0x2a6a[47]](_0xeddaxe[_0x2a6a[41]],function(_0xeddax20){if(_0xeddaxe[_0x2a6a[27]][_0x2a6a[60]]===_0x2a6a[63]){_0xeddax20[_0x2a6a[64]]=_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]}else {if(_0xeddaxe[_0x2a6a[27]][_0x2a6a[60]]===_0x2a6a[65]){_0xeddax20[_0x2a6a[66]]=_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]]}}});return ChatWebsitesField[_0x2a6a[48]](_0xeddaxe[_0x2a6a[41]])})[_0x2a6a[20]](function(_0xeddax1f){_0xeddaxf[_0x2a6a[19]](201)[_0x2a6a[58]](_0xeddax1f)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[67]]=function(_0xeddaxe,_0xeddaxf){return ChatProactiveAction[_0x2a6a[49]]({where:{id:_0xeddaxe[_0x2a6a[21]][_0x2a6a[54]]},individualHooks:true})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[68]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatProactiveAction[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[69]])[_0x2a6a[20]](function(_0xeddax21){if(!_0xeddax21){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax21[_0x2a6a[49]]()})[_0x2a6a[20]](function(){return _0xeddaxf[_0x2a6a[25]](204)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[70]]=function(_0xeddaxe,_0xeddaxf,_0xeddax10){return ChatWebsite[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[26]])[_0x2a6a[20]](function(_0xeddax15){if(!_0xeddax15){return _0xeddaxf[_0x2a6a[25]](404)};_0xeddaxe[_0x2a6a[41]][_0x2a6a[71]]=_0xeddax15[_0x2a6a[26]];return ChatProactiveAction[_0x2a6a[40]](_0xeddaxe[_0x2a6a[41]])})[_0x2a6a[20]](function(_0xeddax21){return _0xeddaxf[_0x2a6a[19]](201)[_0x2a6a[18]](_0xeddax21)})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};exports[_0x2a6a[72]]=function(_0xeddaxe,_0xeddaxf){if(_0xeddaxe[_0x2a6a[41]][_0x2a6a[26]]){delete _0xeddaxe[_0x2a6a[41]][_0x2a6a[26]]};return ChatProactiveAction[_0x2a6a[28]](_0xeddaxe[_0x2a6a[27]][_0x2a6a[69]])[_0x2a6a[20]](function(_0xeddax21){if(!_0xeddax21){return _0xeddaxf[_0x2a6a[25]](404)};return _0xeddax21[_0x2a6a[42]](_0xeddaxe[_0x2a6a[41]])[_0x2a6a[20]](function(_0xeddax21){console[_0x2a6a[30]](_0xeddax21);return _0xeddaxf[_0x2a6a[19]](200)[_0x2a6a[18]](_0xeddax21)})})[_0x2a6a[17]](function(_0xeddax11){return handleError(_0xeddaxf,_0xeddax11)})};function handleError(_0xeddaxf,_0xeddax11){return _0xeddaxf[_0x2a6a[19]](500)[_0x2a6a[18]](_0xeddax11)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var async = require('async'); +var Mustache = require('mustache'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var ChatWebsite = require('../../models').ChatWebsite; +var ChatQueue = require('../../models').ChatQueue; +var User = require('../../models').User; +var ChatApplication = require('../../models').ChatApplication; +var ChatWebsitesField = require('../../models').ChatWebsitesField; +var ChatProactiveAction = require('../../models').ChatProactiveAction; +var snippet = require('../../components/xchatty').snippet; + +// Get list of agents +exports.index = function(req, res, next) { + return ChatWebsite + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Get a single chat_website +exports.show = function(req, res) { + return ChatWebsite + .findById(req.params.id) + .then(function(chat_website) { + if (!chat_website) { + return res.sendStatus(404); + } + return res.send(chat_website); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailAccount +exports.showApplications = function(req, res, next) { + return ChatWebsite + // .scope('default') + .findById(req.params.id) + .then(function(chatWebsite) { + if (!chatWebsite) { + return res.sendStatus(404); + } + return chatWebsite + .getChatApplications(_.merge(Util.getQuery(req.query), { + include: [{ + model: ChatQueue, + attributes: ['id', 'name'] + }, { + model: User, + attributes: ['id', 'name'] + }] + })); + }) + .then(function(chatApplications) { + return res.send({ + count: chatApplications.length, + rows: chatApplications + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.showProactiveActions = function(req, res, next) { + return ChatWebsite + .findById(req.params.id) + .then(function(chatWebsite) { + if (!chatWebsite) { + return res.sendStatus(404); + } + return chatWebsite + .getChatProactiveActions(Util.getQuery(req.query)); + }) + .then(function(chatProactiveActions) { + return res.send({ + count: chatProactiveActions.length, + rows: chatProactiveActions + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a snippet for chat_website +exports.getSnippetCode = function(req, res) { + return ChatWebsite + .findById(req.params.id) + .then(function(chat_website) { + var configSnippet = { + remote: chat_website.remote, + websiteId: req.params.id + }; + var html = Mustache.render(snippet, configSnippet); + return res.status(200).send({ + html: html + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new chat_website in the DB. +exports.create = function(req, res) { + return ChatWebsite + .create(req.body) + .then(function(chat_website) { + return res.status(201).send(chat_website); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing chat_website in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return ChatWebsite + .findById(req.params.id) + .then(function(chat_website) { + if (!chat_website) { + return res.sendStatus(404); + } + + return chat_website + .update(req.body) + .then(function(chat_website) { + return res.status(200).send(chat_website); + }) + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailAccount in the DB. +exports.updateApplications = function(req, res) { + + var priority = 0; + var apps = req.body; + + apps.forEach(function(app) { + delete app.id; + delete app.createdAt; + delete app.updatedAt; + + app.priority = ++priority; + }); + + return sequelize.transaction(function(t) { + return ChatApplication + .destroy({ + where: { + ChatWebsiteId: req.params.id + }, + individualHooks: true, + transaction: t + }).then(function() { + return ChatApplication + .bulkCreate(apps, { + individualHooks: true, + transaction: t + }); + }); + }).then(function(chatApplications) { + return res.status(200).send({ + count: chatApplications.length, + rows: chatApplications + }); + }).catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a chat_website from the DB. +exports.destroy = function(req, res) { + return ChatWebsite + .findById(req.params.id) + .then(function(chat_website) { + if (!chat_website) { + return res.sendStatus(404); + } + return chat_website + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return ChatWebsite + .destroy({ + where: { + id: req.query.websites + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroyApplications = function(req, res) { + return ChatApplication + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailAccount from the DB. +exports.destroyApplication = function(req, res, next) { + return ChatApplication + .findById(req.params.appId) + .then(function(mailApplication) { + if (!mailApplication) { + return res.sendStatus(404); + } + + return mailApplication + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getForms = function(req, res) { + return ChatWebsitesField + .scope({ + method: [req.params.type, req.params.id] + }) + .findAll() + .then(function(data) { + return res.status(200).json(data); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +exports.updateForms = function(req, res, next) { + return ChatWebsitesField + .destroy({ + where: req.params.type === 'online' ? { + OnlineId: req.params.id + } : { + OfflineId: req.params.id + } + }) + .then(function() { + _.forEach(req.body, function(value) { + if (req.params.type === 'online') { + value.OnlineId = req.params.id; + } else if (req.params.type === 'offline') { + value.OfflineId = req.params.id; + } + }); + return ChatWebsitesField.bulkCreate(req.body); + }) + .then(function(fields) { + res.status(201).json(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +exports.bulkDestroyProactiveActions = function(req, res) { + return ChatProactiveAction + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailAccount from the DB. +exports.destroyProactiveAction = function(req, res, next) { + return ChatProactiveAction + .findById(req.params.pactionId) + .then(function(chatProactiveAction) { + if (!chatProactiveAction) { + return res.sendStatus(404); + } + return chatProactiveAction.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.createProactiveAction = function(req, res, next) { + return ChatWebsite + .findById(req.params.id) + .then(function(chatWebsite) { + if (!chatWebsite) { + return res.sendStatus(404); + } + req.body.ChatWebsiteId = chatWebsite.id; + return ChatProactiveAction.create(req.body); + }) + .then(function(chatProactiveAction) { + return res.status(201).send(chatProactiveAction); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.updateProactiveAction = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return ChatProactiveAction + .findById(req.params.pactionId) + .then(function(chatProactiveAction) { + if (!chatProactiveAction) { + return res.sendStatus(404); + } + + return chatProactiveAction + .update(req.body) + .then(function(chatProactiveAction) { + console.log(chatProactiveAction); + return res.status(200).send(chatProactiveAction); + }) + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/chat_website/chat_website.socket.js b/server/api/chat_website/chat_website.socket.js index 124f733..49f62d6 100644 --- a/server/api/chat_website/chat_website.socket.js +++ b/server/api/chat_website/chat_website.socket.js @@ -1 +1,24 @@ -var _0xe136=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xe136[0];var chat_website=require(_0xe136[2])[_0xe136[1]];exports[_0xe136[3]]=function(_0x6033x2){chat_website[_0xe136[4]](function(_0x6033x3){onSave(_0x6033x2,_0x6033x3)});chat_website[_0xe136[5]](function(_0x6033x3){onRemove(_0x6033x2,_0x6033x3)})};function onSave(_0x6033x2,_0x6033x3,_0x6033x5){_0x6033x2[_0xe136[7]](_0xe136[6],_0x6033x3)}function onRemove(_0x6033x2,_0x6033x3,_0x6033x5){_0x6033x2[_0xe136[7]](_0xe136[8],_0x6033x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var chat_website = require('../../models').ChatWebsite; + +exports.register = function(socket) { + chat_website.afterCreate(function (doc) { + onSave(socket, doc); + }); + chat_website.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('chat_website:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_website:remove', doc); +} diff --git a/server/api/chat_website/index.js b/server/api/chat_website/index.js index ae5afe6..b7d89c0 100644 --- a/server/api/chat_website/index.js +++ b/server/api/chat_website/index.js @@ -1 +1,29 @@ -var _0xf0ed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65","\x73\x68\x6F\x77\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x74\x79\x70\x65","\x67\x65\x74\x46\x6F\x72\x6D\x73","\x2F\x3A\x69\x64\x2F\x73\x6E\x69\x70\x70\x65\x74","\x67\x65\x74\x53\x6E\x69\x70\x70\x65\x74\x43\x6F\x64\x65","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x2F\x3A\x70\x61\x63\x74\x69\x6F\x6E\x49\x64","\x75\x70\x64\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65\x46\x6F\x72\x6D\x73","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x61\x70\x70\x49\x64","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];_0xf0ed[0];var express=require(_0xf0ed[1]);var controller=require(_0xf0ed[2]);var auth=require(_0xf0ed[3]);var license=require(_0xf0ed[4]);var router=express.Router();router[_0xf0ed[8]](_0xf0ed[5],auth[_0xf0ed[6]](),controller[_0xf0ed[7]]);router[_0xf0ed[8]](_0xf0ed[9],auth[_0xf0ed[6]](),controller[_0xf0ed[10]]);router[_0xf0ed[8]](_0xf0ed[11],auth[_0xf0ed[6]](),controller[_0xf0ed[12]]);router[_0xf0ed[8]](_0xf0ed[13],auth[_0xf0ed[6]](),controller[_0xf0ed[14]]);router[_0xf0ed[8]](_0xf0ed[15],auth[_0xf0ed[6]](),controller[_0xf0ed[16]]);router[_0xf0ed[8]](_0xf0ed[17],auth[_0xf0ed[6]](),controller[_0xf0ed[18]]);router[_0xf0ed[20]](_0xf0ed[5],auth[_0xf0ed[6]](),controller[_0xf0ed[19]]);router[_0xf0ed[20]](_0xf0ed[13],auth[_0xf0ed[6]](),controller[_0xf0ed[21]]);router[_0xf0ed[23]](_0xf0ed[9],auth[_0xf0ed[6]](),controller[_0xf0ed[22]]);router[_0xf0ed[23]](_0xf0ed[11],auth[_0xf0ed[6]](),controller[_0xf0ed[24]]);router[_0xf0ed[23]](_0xf0ed[25],auth[_0xf0ed[6]](),controller[_0xf0ed[26]]);router[_0xf0ed[23]](_0xf0ed[15],auth[_0xf0ed[6]](),controller[_0xf0ed[27]]);router[_0xf0ed[28]](_0xf0ed[9],auth[_0xf0ed[6]](),controller[_0xf0ed[22]]);router[_0xf0ed[30]](_0xf0ed[5],auth[_0xf0ed[6]](),controller[_0xf0ed[29]]);router[_0xf0ed[30]](_0xf0ed[9],auth[_0xf0ed[6]](),controller[_0xf0ed[31]]);router[_0xf0ed[30]](_0xf0ed[11],auth[_0xf0ed[6]](),controller[_0xf0ed[32]]);router[_0xf0ed[30]](_0xf0ed[13],auth[_0xf0ed[6]](),controller[_0xf0ed[33]]);router[_0xf0ed[30]](_0xf0ed[34],auth[_0xf0ed[6]](),controller[_0xf0ed[35]]);router[_0xf0ed[30]](_0xf0ed[25],auth[_0xf0ed[6]](),controller[_0xf0ed[36]]);module[_0xf0ed[37]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./chat_website.controller'); +var auth = require('../../auth/auth.service'); +var license = require('../../config/license/license.service'); +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/applications', auth.isAuthenticated(), controller.showApplications); +router.get('/:id/proactive', auth.isAuthenticated(), controller.showProactiveActions); +router.get('/:id/fields/:type', auth.isAuthenticated(), controller.getForms); +router.get('/:id/snippet', auth.isAuthenticated(), controller.getSnippetCode); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/proactive', auth.isAuthenticated(), controller.createProactiveAction); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.put('/:id/applications', auth.isAuthenticated(), controller.updateApplications); +router.put('/:id/proactive/:pactionId', auth.isAuthenticated(), controller.updateProactiveAction); +router.put('/:id/fields/:type', auth.isAuthenticated(), controller.updateForms); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/applications', auth.isAuthenticated(), controller.bulkDestroyApplications); +router.delete('/:id/proactive', auth.isAuthenticated(), controller.bulkDestroyProactiveActions); +router.delete('/:id/applications/:appId', auth.isAuthenticated(), controller.destroyApplication); +router.delete('/:id/proactive/:pactionId', auth.isAuthenticated(), controller.destroyProactiveAction); + +module.exports = router; diff --git a/server/api/chat_websites_field/chat_websites_field.controller.js b/server/api/chat_websites_field/chat_websites_field.controller.js index 81205c2..78c9c47 100644 --- a/server/api/chat_websites_field/chat_websites_field.controller.js +++ b/server/api/chat_websites_field/chat_websites_field.controller.js @@ -1 +1,112 @@ -var _0x64b5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x64b5[0];var _=require(_0x64b5[1]);var Util=require(_0x64b5[2]);var ChatWebsitesField=require(_0x64b5[4])[_0x64b5[3]];function handleError(_0xdc09x5,_0xdc09x6){_0xdc09x6=_0xdc09x6||500;return function(_0xdc09x7){_0xdc09x5[_0x64b5[6]](_0xdc09x6)[_0x64b5[5]](_0xdc09x7)}}function responseWithResult(_0xdc09x5,_0xdc09x6){_0xdc09x6=_0xdc09x6||200;return function(_0xdc09x9){if(_0xdc09x9){_0xdc09x5[_0x64b5[6]](_0xdc09x6)[_0x64b5[7]](_0xdc09x9)}}}function responseWithoutResult(_0xdc09x5,_0xdc09x6){_0xdc09x6=_0xdc09x6||204;return function(){_0xdc09x5[_0x64b5[8]](_0xdc09x6)}}function handleEntityNotFound(_0xdc09x5){return function(_0xdc09x9){if(!_0xdc09x9){_0xdc09x5[_0x64b5[6]](404)[_0x64b5[9]]();return null};return _0xdc09x9}}function saveUpdates(_0xdc09xd){return function(_0xdc09x9){return _0xdc09x9[_0x64b5[11]](_0xdc09xd)[_0x64b5[10]](function(_0xdc09xe){return _0xdc09xe})}}function removeEntity(_0xdc09x5){return function(_0xdc09x9){if(_0xdc09x9){return _0xdc09x9[_0x64b5[12]]()[_0x64b5[10]](function(){_0xdc09x5[_0x64b5[6]](204)[_0x64b5[9]]()})}}}exports[_0x64b5[13]]=function(_0xdc09x10,_0xdc09x5){return ChatWebsitesField[_0x64b5[17]](Util[_0x64b5[16]](_0xdc09x10[_0x64b5[15]]))[_0x64b5[10]](responseWithResult(_0xdc09x5))[_0x64b5[14]](handleError(_0xdc09x5))};exports[_0x64b5[18]]=function(_0xdc09x10,_0xdc09x5){return ChatWebsitesField[_0x64b5[21]](_0xdc09x10[_0x64b5[20]][_0x64b5[19]])[_0x64b5[10]](handleEntityNotFound(_0xdc09x5))[_0x64b5[10]](responseWithResult(_0xdc09x5))[_0x64b5[14]](handleError(_0xdc09x5))};exports[_0x64b5[22]]=function(_0xdc09x10,_0xdc09x5){return ChatWebsitesField[_0x64b5[22]](_0xdc09x10[_0x64b5[23]])[_0x64b5[10]](responseWithResult(_0xdc09x5,201))[_0x64b5[14]](handleError(_0xdc09x5))};exports[_0x64b5[24]]=function(_0xdc09x10,_0xdc09x5){if(_0xdc09x10[_0x64b5[23]][_0x64b5[19]]){delete _0xdc09x10[_0x64b5[23]][_0x64b5[19]]};return ChatWebsitesField[_0x64b5[21]](_0xdc09x10[_0x64b5[20]][_0x64b5[19]])[_0x64b5[10]](handleEntityNotFound(_0xdc09x5))[_0x64b5[10]](saveUpdates(_0xdc09x10[_0x64b5[23]]))[_0x64b5[10]](responseWithResult(_0xdc09x5))[_0x64b5[14]](handleError(_0xdc09x5))};exports[_0x64b5[12]]=function(_0xdc09x10,_0xdc09x5){return ChatWebsitesField[_0x64b5[21]](_0xdc09x10[_0x64b5[20]][_0x64b5[19]])[_0x64b5[10]](handleEntityNotFound(_0xdc09x5))[_0x64b5[10]](removeEntity(_0xdc09x5))[_0x64b5[14]](handleError(_0xdc09x5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/chat/websites/fields -> index + * POST /api/chat/websites/fields -> create + * GET /api/chat/websites/fields/:id -> show + * PUT /api/chat/websites/fields/:id -> update + * DELETE /api/chat/websites/fields/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var ChatWebsitesField = require('../../models').ChatWebsitesField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function responseWithoutResult(res, statusCode) { + statusCode = statusCode || 204; + return function() { + res.sendStatus(statusCode); + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of ChatWebsitesFields +exports.index = function(req, res) { + return ChatWebsitesField.findAll(Util.getQuery(req.query)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single ChatWebsitesField from the DB +exports.show = function(req, res) { + return ChatWebsitesField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new ChatWebsitesField in the DB +exports.create = function(req, res) { + return ChatWebsitesField.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing ChatWebsitesField in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ChatWebsitesField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a ChatWebsitesField from the DB +exports.destroy = function(req, res) { + return ChatWebsitesField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/chat_websites_field/chat_websites_field.socket.js b/server/api/chat_websites_field/chat_websites_field.socket.js index 0d3df74..e6f0f21 100644 --- a/server/api/chat_websites_field/chat_websites_field.socket.js +++ b/server/api/chat_websites_field/chat_websites_field.socket.js @@ -1 +1,24 @@ -var _0x8cd0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8cd0[0];var ChatWebsitesField=require(_0x8cd0[2])[_0x8cd0[1]];exports[_0x8cd0[3]]=function(_0xf222x2){ChatWebsitesField[_0x8cd0[4]](function(_0xf222x3){onSave(_0xf222x2,_0xf222x3)});ChatWebsitesField[_0x8cd0[5]](function(_0xf222x3){onRemove(_0xf222x2,_0xf222x3)})};function onSave(_0xf222x2,_0xf222x3,_0xf222x5){_0xf222x2[_0x8cd0[7]](_0x8cd0[6],_0xf222x3)}function onRemove(_0xf222x2,_0xf222x3,_0xf222x5){_0xf222x2[_0x8cd0[7]](_0x8cd0[8],_0xf222x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ChatWebsitesField = require('../../models').ChatWebsitesField; + +exports.register = function(socket) { + ChatWebsitesField.afterCreate(function(doc) { + onSave(socket, doc); + }); + ChatWebsitesField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('chat_websites_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('chat_websites_field:remove', doc); +} diff --git a/server/api/chat_websites_field/index.js b/server/api/chat_websites_field/index.js index 82b24e4..dccf6d7 100644 --- a/server/api/chat_websites_field/index.js +++ b/server/api/chat_websites_field/index.js @@ -1 +1,16 @@ -var _0x15d3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x15d3[0];var express=require(_0x15d3[1]);var auth=require(_0x15d3[2]);var controller=require(_0x15d3[3]);var router=express.Router();router[_0x15d3[7]](_0x15d3[4],auth[_0x15d3[5]](),controller[_0x15d3[6]]);router[_0x15d3[7]](_0x15d3[8],auth[_0x15d3[5]](),controller[_0x15d3[9]]);router[_0x15d3[11]](_0x15d3[4],auth[_0x15d3[5]](),controller[_0x15d3[10]]);router[_0x15d3[13]](_0x15d3[8],auth[_0x15d3[5]](),controller[_0x15d3[12]]);router[_0x15d3[14]](_0x15d3[8],auth[_0x15d3[5]](),controller[_0x15d3[12]]);router[_0x15d3[16]](_0x15d3[8],auth[_0x15d3[5]](),controller[_0x15d3[15]]);module[_0x15d3[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./chat_websites_field.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/chat_websites_field/index.spec.js b/server/api/chat_websites_field/index.spec.js index 46819ae..c50e6e0 100644 --- a/server/api/chat_websites_field/index.spec.js +++ b/server/api/chat_websites_field/index.spec.js @@ -1 +1,97 @@ -var _0x38b6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x38b6[0];var proxyquire=require(_0x38b6[2])[_0x38b6[1]]();var chatWebsitesFieldCtrlStub={index:_0x38b6[3],show:_0x38b6[4],create:_0x38b6[5],update:_0x38b6[6],destroy:_0x38b6[7]};var routerStub={get:sinon[_0x38b6[8]](),put:sinon[_0x38b6[8]](),patch:sinon[_0x38b6[8]](),post:sinon[_0x38b6[8]](),delete:sinon[_0x38b6[8]]()};var chatWebsitesFieldIndex=proxyquire(_0x38b6[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":chatWebsitesFieldCtrlStub});describe(_0x38b6[10],function(){it(_0x38b6[11],function(){expect(chatWebsitesFieldIndex)[_0x38b6[13]][_0x38b6[12]](routerStub)});describe(_0x38b6[14],function(){it(_0x38b6[15],function(){expect(routerStub[_0x38b6[21]][_0x38b6[20]](_0x38b6[19],_0x38b6[3]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})});describe(_0x38b6[22],function(){it(_0x38b6[23],function(){expect(routerStub[_0x38b6[21]][_0x38b6[20]](_0x38b6[24],_0x38b6[4]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})});describe(_0x38b6[25],function(){it(_0x38b6[26],function(){expect(routerStub[_0x38b6[27]][_0x38b6[20]](_0x38b6[19],_0x38b6[5]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})});describe(_0x38b6[28],function(){it(_0x38b6[29],function(){expect(routerStub[_0x38b6[30]][_0x38b6[20]](_0x38b6[24],_0x38b6[6]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})});describe(_0x38b6[31],function(){it(_0x38b6[29],function(){expect(routerStub[_0x38b6[32]][_0x38b6[20]](_0x38b6[24],_0x38b6[6]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})});describe(_0x38b6[33],function(){it(_0x38b6[34],function(){expect(routerStub[_0x38b6[35]][_0x38b6[20]](_0x38b6[24],_0x38b6[7]))[_0x38b6[13]][_0x38b6[18]][_0x38b6[17]][_0x38b6[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var chatWebsitesFieldCtrlStub = { + index: 'chatWebsitesFieldCtrl.index', + show: 'chatWebsitesFieldCtrl.show', + create: 'chatWebsitesFieldCtrl.create', + update: 'chatWebsitesFieldCtrl.update', + destroy: 'chatWebsitesFieldCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var chatWebsitesFieldIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './chat_websites_field.controller': chatWebsitesFieldCtrlStub +}); + +describe('ChatWebsitesField API Router:', function() { + + it('should return an express router instance', function() { + expect(chatWebsitesFieldIndex).to.equal(routerStub); + }); + + describe('GET /api/chat/websites/fields', function() { + + it('should route to chatWebsitesField.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'chatWebsitesFieldCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/chat/websites/fields/:id', function() { + + it('should route to chatWebsitesField.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'chatWebsitesFieldCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/chat/websites/fields', function() { + + it('should route to chatWebsitesField.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'chatWebsitesFieldCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/chat/websites/fields/:id', function() { + + it('should route to chatWebsitesField.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'chatWebsitesFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/chat/websites/fields/:id', function() { + + it('should route to chatWebsitesField.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'chatWebsitesFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/chat/websites/fields/:id', function() { + + it('should route to chatWebsitesField.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'chatWebsitesFieldCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/company/company.controller.js b/server/api/company/company.controller.js index 44c0164..3229f81 100644 --- a/server/api/company/company.controller.js +++ b/server/api/company/company.controller.js @@ -1 +1,156 @@ -var _0x6733=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x6F\x6D\x70\x61\x6E\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x63\x6F\x6D\x70\x61\x6E\x79\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x6C\x6F\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x43\x4F\x4D\x50\x41\x4E\x59","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x6733[0];var _=require(_0x6733[1]);var Company=require(_0x6733[3])[_0x6733[2]];var util=require(_0x6733[4]);var Util=require(_0x6733[5]);exports[_0x6733[6]]=function(_0x3485x5,_0x3485x6,_0x3485x7){return Company[_0x6733[13]](Util[_0x6733[12]](_0x3485x5[_0x6733[11]]))[_0x6733[10]](function(_0x3485x9){_0x3485x6[_0x6733[9]](200)[_0x6733[8]](_0x3485x9)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[14]]=function(_0x3485x5,_0x3485x6){console[_0x6733[16]](_0x3485x5[_0x6733[15]]);Company[_0x6733[19]]({where:{name:_0x3485x5[_0x6733[15]][_0x6733[18]]}})[_0x6733[10]](function(_0x3485xa){if(!_0x3485xa){return _0x3485x6[_0x6733[17]](404)};return _0x3485x6[_0x6733[8]](_0x3485xa)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[20]]=function(_0x3485x5,_0x3485x6){Company[_0x6733[23]](_0x3485x5[_0x6733[22]][_0x6733[21]])[_0x6733[10]](function(_0x3485xb){if(!_0x3485xb){return _0x3485x6[_0x6733[17]](404)};return _0x3485x6[_0x6733[8]](_0x3485xb)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[24]]=function(_0x3485x5,_0x3485x6){Company[_0x6733[24]](_0x3485x5[_0x6733[15]])[_0x6733[10]](function(_0x3485xb){return _0x3485x6[_0x6733[9]](201)[_0x6733[8]](_0x3485xb)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[25]]=function(_0x3485x5,_0x3485x6){Company[_0x6733[19]]({where:{name:_0x3485x5[_0x6733[15]][_0x6733[18]],id:{$ne:_0x3485x5[_0x6733[15]][_0x6733[21]]}}})[_0x6733[10]](function(_0x3485xa){if(!_0x3485xa){return _0x3485x6[_0x6733[17]](404)};if(_0x3485xa[_0x6733[26]]>0){return _0x3485x6[_0x6733[9]](500)[_0x6733[8]]({message:_0x6733[27]})};if(_0x3485x5[_0x6733[15]][_0x6733[21]]){delete _0x3485x5[_0x6733[15]][_0x6733[21]]};Company[_0x6733[30]]({where:{id:_0x3485x5[_0x6733[22]][_0x6733[21]]}})[_0x6733[10]](function(_0x3485xb){if(!_0x3485xb){return _0x3485x6[_0x6733[17]](404)};var _0x3485xc=_[_0x6733[28]](_0x3485xb,_0x3485x5[_0x6733[15]]);_0x3485xc[_0x6733[29]]()[_0x6733[10]](function(){return _0x3485x6[_0x6733[9]](200)[_0x6733[8]](_0x3485xb)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[31]]=function(_0x3485x5,_0x3485x6){Company[_0x6733[23]](_0x3485x5[_0x6733[22]][_0x6733[21]])[_0x6733[10]](function(_0x3485xb){if(!_0x3485xb){return _0x3485x6[_0x6733[17]](404)};_0x3485xb[_0x6733[31]]()[_0x6733[10]](function(){return _0x3485x6[_0x6733[17]](204)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};exports[_0x6733[32]]=function(_0x3485x5,_0x3485x6){Company[_0x6733[31]]({where:{id:_0x3485x5[_0x6733[11]][_0x6733[21]]},individualHooks:true})[_0x6733[10]](function(){return _0x3485x6[_0x6733[17]](204)})[_0x6733[7]](function(_0x3485x8){return handleError(_0x3485x6,_0x3485x8)})};function handleError(_0x3485x6,_0x3485x8){return _0x3485x6[_0x6733[9]](500)[_0x6733[8]](_0x3485x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Company = require('../../models').Company; +var util = require('util'); +var Util = require('../../config/util'); + +// Get list of companies +exports.index = function(req, res, next) { + return Company + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.companyValidation = function(req, res) { + console.log(req.body); + Company + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(companies) { + if (!companies) { + return res.sendStatus(404); + } + return res.send(companies); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single company +exports.show = function(req, res) { + Company + .findById(req.params.id) + .then(function(company) { + if (!company) { + return res.sendStatus(404); + } + return res.send(company); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new company in the DB. +exports.create = function(req, res) { + Company + .create(req.body) + .then(function(company) { + return res.status(201).send(company); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing company in the DB. +exports.update = function(req, res) { + Company + .findAll({ + where: { + name: req.body.name, + id: { + $ne: req.body.id + } + } + }) + .then(function(companies) { + if (!companies) { + return res.sendStatus(404); + } + if (companies.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_COMPANY' + }) + } + if (req.body.id) { + delete req.body.id; + } + Company + .find({ + where: { + id: req.params.id + } + }) + .then(function(company) { + if (!company) { + return res.sendStatus(404); + } + var updated = _.merge(company, req.body); + updated.save() + .then(function() { + return res.status(200).send(company); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a company from the DB. +exports.destroy = function(req, res) { + Company + .findById(req.params.id) + .then(function(company) { + if (!company) { + return res.sendStatus(404); + } + company.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + Company + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/company/company.socket.js b/server/api/company/company.socket.js index 7c85792..850be4a 100644 --- a/server/api/company/company.socket.js +++ b/server/api/company/company.socket.js @@ -1 +1,24 @@ -var _0x965d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x6F\x6D\x70\x61\x6E\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x6F\x6D\x70\x61\x6E\x79\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x6F\x6D\x70\x61\x6E\x79\x3A\x72\x65\x6D\x6F\x76\x65"];_0x965d[0];var Company=require(_0x965d[2])[_0x965d[1]];exports[_0x965d[3]]=function(_0x3b1cx2){Company[_0x965d[4]](function(_0x3b1cx3){onSave(_0x3b1cx2,_0x3b1cx3)});Company[_0x965d[5]](function(_0x3b1cx3){onRemove(_0x3b1cx2,_0x3b1cx3)})};function onSave(_0x3b1cx2,_0x3b1cx3,_0x3b1cx5){_0x3b1cx2[_0x965d[7]](_0x965d[6],_0x3b1cx3)}function onRemove(_0x3b1cx2,_0x3b1cx3,_0x3b1cx5){_0x3b1cx2[_0x965d[7]](_0x965d[8],_0x3b1cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Company = require('../../models').Company; + +exports.register = function(socket) { + Company.afterCreate(function(doc) { + onSave(socket, doc); + }); + Company.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('company:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('company:remove', doc); +} diff --git a/server/api/company/company.spec.js b/server/api/company/company.spec.js index a5f77cc..37c8889 100644 --- a/server/api/company/company.spec.js +++ b/server/api/company/company.spec.js @@ -1 +1,20 @@ -var _0x6901=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6D\x70\x61\x6E\x69\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6D\x70\x61\x6E\x69\x65\x73","\x67\x65\x74"];_0x6901[0];var should=require(_0x6901[1]);var app=require(_0x6901[2]);var request=require(_0x6901[3]);describe(_0x6901[4],function(){it(_0x6901[5],function(_0x2ef7x4){request(app)[_0x6901[13]](_0x6901[12])[_0x6901[11]](200)[_0x6901[11]](_0x6901[10],/json/)[_0x6901[9]](function(_0x2ef7x5,_0x2ef7x6){if(_0x2ef7x5){return _0x2ef7x4(_0x2ef7x5)};_0x2ef7x6[_0x6901[8]][_0x6901[1]][_0x6901[7]][_0x6901[6]](Array);_0x2ef7x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/contactmanager/companies', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/contactmanager/companies') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/company/index.js b/server/api/company/index.js index 80f79a5..734f562 100644 --- a/server/api/company/index.js +++ b/server/api/company/index.js @@ -1 +1,18 @@ -var _0x22d4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x6F\x6D\x70\x61\x6E\x79\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x63\x6F\x6D\x70\x61\x6E\x79\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x22d4[0];var express=require(_0x22d4[1]);var controller=require(_0x22d4[2]);var auth=require(_0x22d4[3]);var router=express.Router();router[_0x22d4[7]](_0x22d4[4],auth[_0x22d4[5]](),controller[_0x22d4[6]]);router[_0x22d4[7]](_0x22d4[8],auth[_0x22d4[5]](),controller[_0x22d4[9]]);router[_0x22d4[11]](_0x22d4[4],auth[_0x22d4[5]](),controller[_0x22d4[10]]);router[_0x22d4[11]](_0x22d4[12],auth[_0x22d4[5]](),controller[_0x22d4[13]]);router[_0x22d4[15]](_0x22d4[8],auth[_0x22d4[5]](),controller[_0x22d4[14]]);router[_0x22d4[16]](_0x22d4[8],auth[_0x22d4[5]](),controller[_0x22d4[14]]);router[_0x22d4[18]](_0x22d4[4],auth[_0x22d4[5]](),controller[_0x22d4[17]]);router[_0x22d4[18]](_0x22d4[8],auth[_0x22d4[5]](),controller[_0x22d4[19]]);module[_0x22d4[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./company.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.companyValidation); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/contact_manager/contact_manager.controller.js b/server/api/contact_manager/contact_manager.controller.js index e0fc3c3..9457eb1 100644 --- a/server/api/contact_manager/contact_manager.controller.js +++ b/server/api/contact_manager/contact_manager.controller.js @@ -1 +1,429 @@ -var _0x585f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x53\x65\x72\x76\x69\x63\x65","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x54\x61\x67","\x73\x74\x72\x65\x61\x6D","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x65\x72\x76\x69\x63\x65","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x6C\x6F\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x50\x68\x6F\x6E\x65\x73","\x49\x6E\x62\x6F\x75\x6E\x64\x73","\x4F\x75\x74\x62\x6F\x75\x6E\x64\x73","\x48\x69\x73\x74\x6F\x72\x79\x49\x6E\x62\x6F\x75\x6E\x64\x73","\x48\x69\x73\x74\x6F\x72\x79\x4F\x75\x74\x62\x6F\x75\x6E\x64\x73","\x45\x6D\x61\x69\x6C\x73","\x49\x6E\x62\x6F\x75\x6E\x64\x4D\x65\x73\x73\x61\x67\x65\x73","\x4F\x75\x74\x62\x6F\x75\x6E\x64\x4D\x65\x73\x73\x61\x67\x65\x73","\x48\x69\x73\x74\x6F\x72\x79\x49\x6E\x62\x6F\x75\x6E\x64\x4D\x65\x73\x73\x61\x67\x65\x73","\x48\x69\x73\x74\x6F\x72\x79\x4F\x75\x74\x62\x6F\x75\x6E\x64\x4D\x65\x73\x73\x61\x67\x65\x73","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x45\x76\x65\x6E\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x76\x6F\x69\x63\x65","\x66\x72\x6F\x6D","\x6D\x61\x69\x6C","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x75\x73\x65\x72","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x61\x70","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x6F\x6E\x74\x61\x63\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x68\x6F\x6E\x65\x73","\x62\x6F\x64\x79","\x65\x6D\x61\x69\x6C\x73","\x63\x72\x65\x61\x74\x65","\x73\x70\x72\x65\x61\x64","\x43\x6F\x6E\x74\x61\x63\x74\x48\x61\x73\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x66\x6F\x72\x45\x61\x63\x68","\x73\x65\x74\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x6B\x65\x79\x73","\x73\x65\x74\x45\x6D\x61\x69\x6C\x73","\x73\x65\x74\x50\x68\x6F\x6E\x65\x73","\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x63\x6C\x6F\x6E\x65","\x61\x6C\x6C","\x65\x6D\x61\x69\x6C","\x75\x6E\x69\x71","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x70\x75\x73\x68","\x6E\x61\x6D\x65","\x74\x61\x67\x73","\x2C","\x73\x70\x6C\x69\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x6C\x65\x6E\x67\x74\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x70\x68\x6F\x6E\x65","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x585f[0];var _=require(_0x585f[1]);var Contact=require(_0x585f[3])[_0x585f[2]];var ContactPhone=require(_0x585f[3])[_0x585f[4]];var ContactEmail=require(_0x585f[3])[_0x585f[5]];var CustomField=require(_0x585f[3])[_0x585f[6]];var ReportCall=require(_0x585f[3])[_0x585f[7]];var ReportIntegration=require(_0x585f[3])[_0x585f[8]];var Service=require(_0x585f[3])[_0x585f[9]];var ReportCallHistory=require(_0x585f[3])[_0x585f[11]][_0x585f[10]];var ReportMailSession=require(_0x585f[3])[_0x585f[12]];var ReportMailSessionHistory=require(_0x585f[3])[_0x585f[11]][_0x585f[13]];var Tag=require(_0x585f[3])[_0x585f[14]];var stream=require(_0x585f[15]);var sequelize=require(_0x585f[3])[_0x585f[16]];var util=require(_0x585f[17]);var Util=require(_0x585f[18]);exports[_0x585f[19]]=function(_0x7186x11,_0x7186x12,_0x7186x13){return Contact[_0x585f[28]](_0x585f[27])[_0x585f[26]](Util[_0x585f[25]](_0x7186x11[_0x585f[24]]))[_0x585f[23]](function(_0x7186x15){_0x7186x12[_0x585f[22]](200)[_0x585f[21]](_0x7186x15)})[_0x585f[20]](function(_0x7186x14){return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[29]]=function(_0x7186x11,_0x7186x12){Contact[_0x585f[45]](_0x7186x11[_0x585f[33]][_0x585f[32]],{include:[{model:ContactPhone,as:_0x585f[34],include:[{model:ReportCall,as:_0x585f[35],include:[{all:true}]},{model:ReportCall,as:_0x585f[36],include:[{all:true}]},{model:ReportCallHistory,as:_0x585f[37],include:[{all:true}]},{model:ReportCallHistory,as:_0x585f[38],include:[{all:true}]}]},{model:ContactEmail,as:_0x585f[39],include:[{model:ReportMailSession,as:_0x585f[40],include:[{all:true}]},{model:ReportMailSession,as:_0x585f[41],include:[{all:true}]},{model:ReportMailSessionHistory,as:_0x585f[42],include:[{all:true}]},{model:ReportMailSessionHistory,as:_0x585f[43],include:[{all:true}]}]},{model:CustomField,as:_0x585f[44]},{model:Service}]})[_0x585f[23]](function(_0x7186x16){if(!_0x7186x16){return _0x7186x12[_0x585f[31]](404)};return _0x7186x12[_0x585f[22]](200)[_0x585f[21]](_0x7186x16)})[_0x585f[20]](function(_0x7186x14){console[_0x585f[30]](_0x7186x14);return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[46]]=function(_0x7186x11,_0x7186x12){ReportIntegration[_0x585f[45]](_0x7186x11[_0x585f[33]][_0x585f[32]])[_0x585f[23]](function(_0x7186x18){var _0x7186x19={};switch(_0x7186x18[_0x585f[51]]){case _0x585f[48]:_0x7186x19={model:ContactPhone,as:_0x585f[34],where:{phone:_0x7186x18[_0x585f[47]]}};break;case _0x585f[50]:_0x7186x19={model:ContactEmail,as:_0x585f[39],where:{email:_0x7186x18[_0x585f[49]]}};break;default:};return Contact[_0x585f[55]]({include:[_0x7186x19,{model:Service,where:{id:_[_0x585f[54]](_[_0x585f[54]](_0x7186x11[_0x585f[52]].Services,_0x585f[53]),_0x585f[32])}}]})})[_0x585f[23]](function(_0x7186x17){return _0x7186x12[_0x585f[22]](200)[_0x585f[21]](_0x7186x17)})[_0x585f[20]](function(_0x7186x14){console[_0x585f[30]](_0x7186x14);return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[56]]=function(_0x7186x11,_0x7186x12){Contact[_0x585f[55]]({where:{$or:{"\x24\x50\x68\x6F\x6E\x65\x73\x2E\x70\x68\x6F\x6E\x65\x24":_0x7186x11[_0x585f[58]][_0x585f[57]],"\x24\x45\x6D\x61\x69\x6C\x73\x2E\x65\x6D\x61\x69\x6C\x24":_0x7186x11[_0x585f[58]][_0x585f[59]]}},include:[{all:true}]})[_0x585f[23]](function(_0x7186x17){console[_0x585f[30]](_0x7186x17);return _0x7186x12[_0x585f[22]](200)[_0x585f[21]](_0x7186x17)})[_0x585f[20]](function(_0x7186x14){console[_0x585f[30]](_0x7186x14);return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[60]]=function(_0x7186x11,_0x7186x12,_0x7186x13){var _0x7186x1a=[],_0x7186x1b=[],_0x7186x1c={};Tag[_0x585f[55]]()[_0x585f[23]](function(_0x7186x23){var _0x7186x24=[];var _0x7186x25=_[_0x585f[54]](_[_0x585f[54]](_0x7186x23,_0x585f[53]),_0x585f[75]);if(_0x7186x11[_0x585f[58]][_0x585f[76]]){var _0x7186x26=_0x7186x11[_0x585f[58]][_0x585f[76]][_0x585f[78]](_0x585f[77]);_0x7186x26[_0x585f[63]](function(_0x7186x1f){if(!_[_0x585f[79]](_0x7186x23,_0x7186x1f)){_0x7186x24[_0x585f[74]]({name:_0x7186x1f})}});if(_0x7186x24[_0x585f[80]]){Tag[_0x585f[81]](_0x7186x24,{individualHooks:true})}};_0x7186x11[_0x585f[58]][_0x585f[82]]=_0x7186x11[_0x585f[52]][_0x585f[32]];var _0x7186x27=_[_0x585f[72]](_[_0x585f[54]](_0x7186x11[_0x585f[58]].Phones,_0x585f[83]));var _0x7186x28=[];_0x7186x27[_0x585f[63]](function(_0x7186x1f){_0x7186x28[_0x585f[74]](ContactPhone[_0x585f[73]]({where:{phone:_0x7186x1f},defaults:{phone:_0x7186x1f}}))});return _0x7186x28})[_0x585f[70]]()[_0x585f[23]](function(_0x7186x12){_0x7186x1a=_[_0x585f[54]](_0x7186x12,function(_0x7186x1f){return _0x7186x1f[0]});var _0x7186x21=[];var _0x7186x22=_[_0x585f[72]](_[_0x585f[54]](_0x7186x11[_0x585f[58]].Emails,_0x585f[71]));_0x7186x22[_0x585f[63]](function(_0x7186x1f){_0x7186x21[_0x585f[74]](ContactEmail[_0x585f[73]]({where:{email:_0x7186x1f},defaults:{email:_0x7186x1f}}))});return _0x7186x21})[_0x585f[70]]()[_0x585f[23]](function(_0x7186x12){_0x7186x1b=_[_0x585f[54]](_0x7186x12,function(_0x7186x1f){return _0x7186x1f[0]});delete _0x7186x11[_0x585f[58]][_0x585f[34]];delete _0x7186x11[_0x585f[58]][_0x585f[39]];_0x7186x1c=_[_0x585f[69]](_0x7186x11[_0x585f[58]][_0x585f[68]]);delete _0x7186x11[_0x585f[58]][_0x585f[68]];return Contact[_0x585f[60]](_0x7186x11[_0x585f[58]])})[_0x585f[23]](function(_0x7186x1d){return [_0x7186x1d,_0x7186x1d[_0x585f[67]](_0x7186x1a)]})[_0x585f[61]](function(_0x7186x1d){return [_0x7186x1d,_0x7186x1d[_0x585f[66]](_0x7186x1b)]})[_0x585f[61]](function(_0x7186x1d){var _0x7186x20=_[_0x585f[65]](_0x7186x1c);return [_0x7186x1d,CustomField[_0x585f[55]]({where:{id:_0x7186x20}})]})[_0x585f[61]](function(_0x7186x1d,_0x7186x1e){_0x7186x1e[_0x585f[63]](function(_0x7186x1f){_0x7186x1f[_0x585f[62]]={value:_0x7186x1c[String(_0x7186x1f[_0x585f[32]])]}});return [_0x7186x1d,_0x7186x1d[_0x585f[64]](_0x7186x1e)]})[_0x585f[61]](function(_0x7186x1d){return _0x7186x12[_0x585f[22]](201)[_0x585f[21]](_0x7186x1d)})[_0x585f[20]](function(_0x7186x14){console[_0x585f[30]](_0x7186x14);return _0x7186x13(_0x7186x14)})};exports[_0x585f[84]]=function(_0x7186x11,_0x7186x12,_0x7186x13){var _0x7186x1a=[],_0x7186x1b=[],_0x7186x1c={};Tag[_0x585f[55]]()[_0x585f[23]](function(_0x7186x23){var _0x7186x24=[];var _0x7186x25=_[_0x585f[54]](_[_0x585f[54]](_0x7186x23,_0x585f[53]),_0x585f[75]);if(_0x7186x11[_0x585f[58]][_0x585f[76]]){var _0x7186x26=_0x7186x11[_0x585f[58]][_0x585f[76]][_0x585f[78]](_0x585f[77]);_0x7186x26[_0x585f[63]](function(_0x7186x1f){if(!_[_0x585f[79]](_0x7186x23,_0x7186x1f)){_0x7186x24[_0x585f[74]]({name:_0x7186x1f})}});if(_0x7186x24[_0x585f[80]]){Tag[_0x585f[81]](_0x7186x24,{individualHooks:true})}};var _0x7186x28=[];var _0x7186x27=_[_0x585f[72]](_[_0x585f[54]](_0x7186x11[_0x585f[58]].Phones,_0x585f[83]));_0x7186x27[_0x585f[63]](function(_0x7186x1f){_0x7186x28[_0x585f[74]](ContactPhone[_0x585f[73]]({where:{phone:_0x7186x1f},defaults:{phone:_0x7186x1f}}))});return _0x7186x28})[_0x585f[70]]()[_0x585f[23]](function(_0x7186x12){_0x7186x1a=_[_0x585f[54]](_0x7186x12,function(_0x7186x1f){return _0x7186x1f[0]});var _0x7186x21=[];var _0x7186x22=_[_0x585f[72]](_[_0x585f[54]](_0x7186x11[_0x585f[58]].Emails,_0x585f[71]));_0x7186x22[_0x585f[63]](function(_0x7186x1f){_0x7186x21[_0x585f[74]](ContactEmail[_0x585f[73]]({where:{email:_0x7186x1f},defaults:{email:_0x7186x1f}}))});return _0x7186x21})[_0x585f[70]]()[_0x585f[23]](function(_0x7186x12){_0x7186x1b=_[_0x585f[54]](_0x7186x12,function(_0x7186x1f){return _0x7186x1f[0]});delete _0x7186x11[_0x585f[58]][_0x585f[34]];delete _0x7186x11[_0x585f[58]][_0x585f[39]];_0x7186x1c=_[_0x585f[69]](_0x7186x11[_0x585f[58]][_0x585f[68]]);delete _0x7186x11[_0x585f[58]][_0x585f[68]];delete _0x7186x11[_0x585f[58]][_0x585f[44]];var _0x7186x29=_0x7186x11[_0x585f[58]][_0x585f[32]];delete _0x7186x11[_0x585f[58]][_0x585f[32]];return Contact[_0x585f[45]](_0x7186x29)})[_0x585f[23]](function(_0x7186x1d){return [_0x7186x1d,_0x7186x1d[_0x585f[67]](_0x7186x1a)]})[_0x585f[61]](function(_0x7186x1d){return [_0x7186x1d,_0x7186x1d[_0x585f[66]](_0x7186x1b)]})[_0x585f[61]](function(_0x7186x1d){var _0x7186x20=_[_0x585f[65]](_0x7186x1c);return [_0x7186x1d,CustomField[_0x585f[55]]({where:{id:_0x7186x20}})]})[_0x585f[61]](function(_0x7186x1d,_0x7186x1e){_0x7186x1e[_0x585f[63]](function(_0x7186x1f){_0x7186x1f[_0x585f[62]]={value:_0x7186x1c[String(_0x7186x1f[_0x585f[32]])]}});return [_0x7186x1d,_0x7186x1d[_0x585f[64]](_0x7186x1e)]})[_0x585f[61]](function(_0x7186x1d){return _0x7186x1d[_0x585f[85]](_0x7186x11[_0x585f[58]])})[_0x585f[23]](function(_0x7186x1d){return _0x7186x12[_0x585f[22]](200)[_0x585f[21]](_0x7186x1d)})[_0x585f[20]](function(_0x7186x14){console[_0x585f[30]](_0x7186x14);return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[86]]=function(_0x7186x11,_0x7186x12){Contact[_0x585f[45]](_0x7186x11[_0x585f[33]][_0x585f[32]])[_0x585f[23]](function(_0x7186x16){if(!_0x7186x16){return _0x7186x12[_0x585f[31]](404)};_0x7186x16[_0x585f[86]]()[_0x585f[23]](function(){return _0x7186x12[_0x585f[31]](204)})[_0x585f[20]](function(_0x7186x14){return handleError(_0x7186x12,_0x7186x14)})})[_0x585f[20]](function(_0x7186x14){return handleError(_0x7186x12,_0x7186x14)})};exports[_0x585f[87]]=function(_0x7186x11,_0x7186x12){Contact[_0x585f[86]]({where:{id:_0x7186x11[_0x585f[24]][_0x585f[32]]},individualHooks:true})[_0x585f[23]](function(){return _0x7186x12[_0x585f[31]](204)})[_0x585f[20]](function(_0x7186x14){return handleError(_0x7186x12,_0x7186x14)})};function handleError(_0x7186x12,_0x7186x14){return _0x7186x12[_0x585f[22]](500)[_0x585f[21]](_0x7186x14)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Contact = require('../../models').Contact; +var ContactPhone = require('../../models').ContactPhone; +var ContactEmail = require('../../models').ContactEmail; +var CustomField = require('../../models').CustomField; +var ReportCall = require('../../models').ReportCall; +var ReportIntegration = require('../../models').ReportIntegration; +var Service = require('../../models').Service; +var ReportCallHistory = require('../../models').history.ReportCallHistory; +var ReportMailSession = require('../../models').ReportMailSession; +var ReportMailSessionHistory = require('../../models').history.ReportMailSessionHistory; +var Tag = require('../../models').Tag; +var stream = require('stream'); +var sequelize = require('../../models').sequelize; +var util = require('util'); +var Util = require('../../config/util'); + +// Get list of contacts +exports.index = function(req, res, next) { + return Contact + .scope('service') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single managed_contact +exports.show = function(req, res) { + Contact + .findById(req.params.id, { + include: [{ + model: ContactPhone, + as: 'Phones', + include: [{ + model: ReportCall, + as: 'Inbounds', + include: [{ + all: true + }] + }, { + model: ReportCall, + as: 'Outbounds', + include: [{ + all: true + }] + }, { + model: ReportCallHistory, + as: 'HistoryInbounds', + include: [{ + all: true + }] + }, { + model: ReportCallHistory, + as: 'HistoryOutbounds', + include: [{ + all: true + }] + }] + }, { + model: ContactEmail, + as: 'Emails', + include: [{ + model: ReportMailSession, + as: 'InboundMessages', + include: [{ + all: true + }] + }, { + model: ReportMailSession, + as: 'OutboundMessages', + include: [{ + all: true + }] + }, { + model: ReportMailSessionHistory, + as: 'HistoryInboundMessages', + include: [{ + all: true + }] + }, { + model: ReportMailSessionHistory, + as: 'HistoryOutboundMessages', + include: [{ + all: true + }] + }] + }, { + model: CustomField, + as: 'CustomFields' + }, { + model: Service + }] + }) + .then(function(managed_contact) { + if (!managed_contact) { + return res.sendStatus(404); + } + return res.status(200).send(managed_contact); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.getEventContacts = function(req, res) { + ReportIntegration + .findById(req.params.id) + .then(function(event) { + var modelInclude = {}; + switch (event.eventChannel) { + case 'voice': + modelInclude = { + model: ContactPhone, + as: 'Phones', + where: { + phone: event.calleridnum + } + }; + break; + case 'mail': + modelInclude = { + model: ContactEmail, + as: 'Emails', + where: { + email: event.from + } + }; + break; + default: + } + return Contact.findAll({ + include: [modelInclude, { + model: Service, + where: { + id: _.map(_.map(req.user.Services, 'dataValues'), 'id') + } + }] + }); + }) + .then(function(contacts) { + return res.status(200).send(contacts); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + +}; + +// validate contact uniqueness +exports.contactValidation = function(req, res) { + Contact.findAll({ + where: { + $or: { + '$Phones.phone$': req.body.phones, + '$Emails.email$': req.body.emails + } + }, + include: [{ + all: true + }] + }) + .then(function(contacts) { + console.log(contacts); + return res.status(200).send(contacts); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Creates a new managed_contact in the DB. +exports.create = function(req, res, next) { + var newPhones = [], + newEmails = [], + newCustomFields = {}; + Tag.findAll() + .then(function(tags) { + var newTags = []; + var tagList = _.map(_.map(tags, 'dataValues'), 'name'); + if (req.body.tags) { + var contactTags = req.body.tags.split(','); + contactTags.forEach(function(elem) { + if (!_.includes(tags, elem)) { + newTags.push({ + name: elem + }); + } + }); + if (newTags.length) { + Tag.bulkCreate(newTags, { + individualHooks: true + }); + } + } + req.body.UserId = req.user.id; + var phones = _.uniq(_.map(req.body.Phones, 'phone')); + var contactPhones = []; + phones.forEach(function(elem) { + contactPhones.push(ContactPhone.findOrCreate({ + where: { + phone: elem + }, + defaults: { + phone: elem + } + })); + }); + return contactPhones; + }) + .all() + .then(function(res) { + newPhones = _.map(res, function(elem) { + return elem[0]; + }); + + var contactEmails = []; + var emails = _.uniq(_.map(req.body.Emails, 'email')); + emails.forEach(function(elem) { + contactEmails.push(ContactEmail.findOrCreate({ + where: { + email: elem + }, + defaults: { + email: elem + } + })); + }); + return contactEmails; + }) + .all() + .then(function(res) { + newEmails = _.map(res, function(elem) { + return elem[0]; + }); + delete req.body.Phones; + delete req.body.Emails; + newCustomFields = _.clone(req.body.customFields); + delete req.body.customFields; + + return Contact.create(req.body); + }) + .then(function(contact) { + return [contact, contact.setPhones(newPhones)]; + }) + .spread(function(contact) { + return [contact, contact.setEmails(newEmails)]; + }) + .spread(function(contact) { + var customFieldsIds = _.keys(newCustomFields); + return [contact, CustomField.findAll({ + where: { + id: customFieldsIds + } + })]; + }) + .spread(function(contact, customFields) { + customFields.forEach(function(elem) { + elem.ContactHasCustomField = { + value: newCustomFields[String(elem.id)] + } + }); + return [contact, contact.setCustomFields(customFields)]; + }) + .spread(function(contact) { + return res.status(201).send(contact); + }) + .catch(function(err) { + console.log(err); + return next(err); + }); +}; + +// Updates an existing managed_contact in the DB. +exports.update = function(req, res, next) { + var newPhones = [], + newEmails = [], + newCustomFields = {}; + Tag.findAll() + .then(function(tags) { + var newTags = []; + var tagList = _.map(_.map(tags, 'dataValues'), 'name'); + if (req.body.tags) { + var contactTags = req.body.tags.split(','); + contactTags.forEach(function(elem) { + if (!_.includes(tags, elem)) { + newTags.push({ + name: elem + }); + } + }); + if (newTags.length) { + Tag.bulkCreate(newTags, { + individualHooks: true + }); + } + } + var contactPhones = []; + var phones = _.uniq(_.map(req.body.Phones, 'phone')); + phones.forEach(function(elem) { + contactPhones.push(ContactPhone.findOrCreate({ + where: { + phone: elem + }, + defaults: { + phone: elem + } + })); + }); + return contactPhones; + }) + .all() + .then(function(res) { + newPhones = _.map(res, function(elem) { + return elem[0]; + }); + + var contactEmails = []; + var emails = _.uniq(_.map(req.body.Emails, 'email')); + emails.forEach(function(elem) { + contactEmails.push(ContactEmail.findOrCreate({ + where: { + email: elem + }, + defaults: { + email: elem + } + })); + }); + return contactEmails; + }) + .all() + .then(function(res) { + newEmails = _.map(res, function(elem) { + return elem[0]; + }); + delete req.body.Phones; + delete req.body.Emails; + newCustomFields = _.clone(req.body.customFields); + delete req.body.customFields; + delete req.body.CustomFields; + var updateId = req.body.id; + delete req.body.id; + + return Contact.findById(updateId); + }) + .then(function(contact) { + return [contact, contact.setPhones(newPhones)]; + }) + .spread(function(contact) { + return [contact, contact.setEmails(newEmails)]; + }) + .spread(function(contact) { + var customFieldsIds = _.keys(newCustomFields); + return [contact, CustomField.findAll({ + where: { + id: customFieldsIds + } + })]; + }) + .spread(function(contact, customFields) { + customFields.forEach(function(elem) { + elem.ContactHasCustomField = { + value: newCustomFields[String(elem.id)] + } + }); + return [contact, contact.setCustomFields(customFields)]; + }) + .spread(function(contact) { + return contact.updateAttributes(req.body) + }) + .then(function(contact) { + return res.status(200).send(contact); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Deletes a managed_contact from the DB. +exports.destroy = function(req, res) { + Contact + .findById(req.params.id) + .then(function(managed_contact) { + if (!managed_contact) { + return res.sendStatus(404); + } + managed_contact.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a managed_contact from the DB. +exports.bulkDestroy = function(req, res) { + Contact + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/contact_manager/contact_manager.socket.js b/server/api/contact_manager/contact_manager.socket.js index 65fc24d..addfca0 100644 --- a/server/api/contact_manager/contact_manager.socket.js +++ b/server/api/contact_manager/contact_manager.socket.js @@ -1 +1,24 @@ -var _0xbe68=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0xbe68[0];var Contact=require(_0xbe68[2])[_0xbe68[1]];exports[_0xbe68[3]]=function(_0x6134x2){Contact[_0xbe68[4]](function(_0x6134x3){onSave(_0x6134x2,_0x6134x3)});Contact[_0xbe68[5]](function(_0x6134x3){onRemove(_0x6134x2,_0x6134x3)})};function onSave(_0x6134x2,_0x6134x3,_0x6134x5){_0x6134x2[_0xbe68[7]](_0xbe68[6],_0x6134x3)}function onRemove(_0x6134x2,_0x6134x3,_0x6134x5){_0x6134x2[_0xbe68[7]](_0xbe68[8],_0x6134x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Contact = require('../../models').Contact; + +exports.register = function(socket) { + Contact.afterCreate(function(doc) { + onSave(socket, doc); + }); + Contact.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('contact_manager:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('contact_manager:remove', doc); +} diff --git a/server/api/contact_manager/contact_manager.spec.js b/server/api/contact_manager/contact_manager.spec.js index 0fa46e5..f212dfb 100644 --- a/server/api/contact_manager/contact_manager.spec.js +++ b/server/api/contact_manager/contact_manager.spec.js @@ -1 +1,20 @@ -var _0xf917=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6E\x74\x61\x63\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72","\x67\x65\x74"];_0xf917[0];var should=require(_0xf917[1]);var app=require(_0xf917[2]);var request=require(_0xf917[3]);describe(_0xf917[4],function(){it(_0xf917[5],function(_0x1386x4){request(app)[_0xf917[13]](_0xf917[12])[_0xf917[11]](200)[_0xf917[11]](_0xf917[10],/json/)[_0xf917[9]](function(_0x1386x5,_0x1386x6){if(_0x1386x5){return _0x1386x4(_0x1386x5)};_0x1386x6[_0xf917[8]][_0xf917[1]][_0xf917[7]][_0xf917[6]](Array);_0x1386x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/contactmanager/contacts', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/contactmanager') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/contact_manager/index.js b/server/api/contact_manager/index.js index 3e0bb55..18623b0 100644 --- a/server/api/contact_manager/index.js +++ b/server/api/contact_manager/index.js @@ -1 +1,19 @@ -var _0x9528=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B\x65\x76\x65\x6E\x74","\x67\x65\x74\x45\x76\x65\x6E\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x63\x6F\x6E\x74\x61\x63\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x9528[0];var express=require(_0x9528[1]);var controller=require(_0x9528[2]);var auth=require(_0x9528[3]);var router=express.Router();router[_0x9528[7]](_0x9528[4],auth[_0x9528[5]](),controller[_0x9528[6]]);router[_0x9528[7]](_0x9528[8],auth[_0x9528[5]](),controller[_0x9528[9]]);router[_0x9528[7]](_0x9528[10],auth[_0x9528[5]](),controller[_0x9528[11]]);router[_0x9528[13]](_0x9528[4],auth[_0x9528[5]](),controller[_0x9528[12]]);router[_0x9528[13]](_0x9528[14],auth[_0x9528[5]](),controller[_0x9528[15]]);router[_0x9528[17]](_0x9528[10],auth[_0x9528[5]](),controller[_0x9528[16]]);router[_0x9528[18]](_0x9528[10],auth[_0x9528[5]](),controller[_0x9528[16]]);router[_0x9528[20]](_0x9528[4],auth[_0x9528[5]](),controller[_0x9528[19]]);router[_0x9528[20]](_0x9528[10],auth[_0x9528[5]](),controller[_0x9528[21]]);module[_0x9528[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./contact_manager.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id/checkevent', auth.isAuthenticated(), controller.getEventContacts); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.contactValidation); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/custom_report/custom_report.controller.js b/server/api/custom_report/custom_report.controller.js index 64b9643..12e3404 100644 --- a/server/api/custom_report/custom_report.controller.js +++ b/server/api/custom_report/custom_report.controller.js @@ -1 +1,326 @@ -var _0x8c97=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x4D\x65\x74\x72\x69\x63","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x70\x61\x72\x61\x6D\x73","\x6D\x65\x72\x67\x65","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x70\x72\x65\x76\x69\x65\x77","\x6C\x6F\x67","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6D\x69\x74","\x76\x61\x6C\x75\x65","\x74\x61\x6B\x65","\x6F\x66\x66\x73\x65\x74","\x73\x6C\x69\x63\x65","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x62\x75\x69\x6C\x64\x52\x65\x70\x6F\x72\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\x65\x78\x74\x72\x61\x63\x74","\x73\x70\x72\x65\x61\x64","\x6E\x61\x6D\x65","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x65\x6E\x64\x44\x61\x74\x65","\x63\x72\x65\x61\x74\x65","\x73\x68\x6F\x77","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x61\x72\x65\x6E\x74","\x62\x6F\x64\x79","\x6D\x61\x70","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x73","\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x73\x61\x76\x65","\x69\x73\x41\x72\x72\x61\x79","\x74\x61\x62\x6C\x65","\x61\x6C\x6C","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x4D\x65\x74\x72\x69\x63\x49\x64","\x66\x69\x6E\x64","\x66\x69\x65\x6C\x64","\x6D\x65\x74\x72\x69\x63","\x70\x75\x73\x68","\x54\x68\x65\x20\x6D\x65\x74\x72\x69\x63\x20\x77\x69\x74\x68\x20\x69\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x54\x68\x65\x20\x66\x69\x65\x6C\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65","\x66\x6F\x72\x45\x61\x63\x68","\x6B\x65\x79\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x59\x6F\x75\x20\x68\x61\x76\x65\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x6F\x72\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x8c97[0];var _=require(_0x8c97[1]);var util=require(_0x8c97[2]);var sequelize=require(_0x8c97[4])[_0x8c97[3]];var CustomReport=require(_0x8c97[4])[_0x8c97[5]];var ReportField=require(_0x8c97[4])[_0x8c97[6]];var Metric=require(_0x8c97[4])[_0x8c97[7]];var ExtractedReport=require(_0x8c97[4])[_0x8c97[8]];var extractUtils=require(_0x8c97[9]);var reportBuildUtils=require(_0x8c97[10]);var Util=require(_0x8c97[11]);exports[_0x8c97[12]]=function(_0x2ef5xb,_0x2ef5xc,_0x2ef5xd){return CustomReport[_0x8c97[21]](Util[_0x8c97[20]](_[_0x8c97[19]](_0x2ef5xb[_0x8c97[17]],_0x2ef5xb[_0x8c97[18]])))[_0x8c97[16]](function(_0x2ef5xf){_0x2ef5xc[_0x8c97[15]](200)[_0x8c97[14]](_0x2ef5xf)})[_0x8c97[13]](function(_0x2ef5xe){return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[22]]=function(_0x2ef5xb,_0x2ef5xc){var _0x2ef5x10;return CustomReport[_0x8c97[39]](_0x8c97[38])[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){console[_0x8c97[23]](_0x8c97[30]);if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};var _0x2ef5x13=reportBuildUtils[_0x8c97[33]](_0x2ef5x12[_0x8c97[32]],_0x2ef5xb[_0x8c97[17]]);return sequelize[_0x8c97[17]](_0x2ef5x13,{type:sequelize[_0x8c97[35]][_0x8c97[34]]})})[_0x8c97[16]](function(_0x2ef5x11){_0x2ef5x10=_0x2ef5x11[_0x8c97[24]];if(_0x2ef5xb[_0x8c97[17]][_0x8c97[25]]){_0x2ef5x11=_(_0x2ef5x11)[_0x8c97[29]](_0x2ef5xb[_0x8c97[17]][_0x8c97[28]]||0)[_0x8c97[27]](_0x2ef5xb[_0x8c97[17]][_0x8c97[25]])[_0x8c97[26]]()};_0x2ef5xc[_0x8c97[15]](200)[_0x8c97[14]]({rows:_0x2ef5x11,count:_0x2ef5x10})})[_0x8c97[13]](function(_0x2ef5xe){console[_0x8c97[23]](_0x2ef5xe);return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[40]]=function(_0x2ef5xb,_0x2ef5xc){docExtract(_0x2ef5xb,_0x2ef5xc,_0x8c97[41])};exports[_0x8c97[42]]=function(_0x2ef5xb,_0x2ef5xc){docExtract(_0x2ef5xb,_0x2ef5xc,_0x8c97[43])};function docExtract(_0x2ef5xb,_0x2ef5xc,_0x2ef5x15){CustomReport[_0x8c97[39]](_0x8c97[38])[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};return [_0x2ef5x12,ExtractedReport[_0x8c97[49]]({name:_0x2ef5x12[_0x8c97[46]],startDate:_0x2ef5xb[_0x8c97[17]][_0x8c97[47]]||null,endDate:_0x2ef5xb[_0x8c97[17]][_0x8c97[48]]||null,output:_0x2ef5x15})]})[_0x8c97[45]](function(_0x2ef5x12,_0x2ef5x16){extractUtils[_0x8c97[44]+_0x2ef5x15](_0x2ef5x12,_0x2ef5xb[_0x8c97[17]],_0x2ef5x16[_0x8c97[36]])})[_0x8c97[13]](function(_0x2ef5xe){console[_0x8c97[23]](_0x2ef5xe);return handleError(_0x2ef5xc,_0x2ef5xe)});return _0x2ef5xc[_0x8c97[31]](200)}exports[_0x8c97[50]]=function(_0x2ef5xb,_0x2ef5xc){return CustomReport[_0x8c97[39]](_0x8c97[38])[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};return _0x2ef5xc[_0x8c97[14]](_0x2ef5x12)})[_0x8c97[13]](function(_0x2ef5xe){return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[51]]=function(_0x2ef5xb,_0x2ef5xc){var _0x2ef5x17;return sequelize[_0x8c97[57]](function(_0x2ef5x18){return CustomReport[_0x8c97[39]](_0x8c97[38])[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};var _0x2ef5x19=_0x2ef5x12[_0x8c97[32]];delete _0x2ef5x19[_0x8c97[36]];delete _0x2ef5x19[_0x8c97[52]];delete _0x2ef5x19[_0x8c97[53]];_0x2ef5x19[_0x8c97[54]]=_0x2ef5xb[_0x8c97[55]][_0x8c97[54]];_0x2ef5x17=_[_0x8c97[56]](_0x2ef5x19.Fields,_0x8c97[32]);return CustomReport[_0x8c97[49]](_0x2ef5x19,{transaction:_0x2ef5x18})})[_0x8c97[16]](function(_0x2ef5x12){return [_0x2ef5x12,_0x2ef5x17]})[_0x8c97[45]](createFields(_0x2ef5x18))})[_0x8c97[16]](function(){return _0x2ef5xc[_0x8c97[31]](201)})[_0x8c97[13]](function(_0x2ef5xe){console[_0x8c97[23]](_0x2ef5xe);return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[49]]=function(_0x2ef5xb,_0x2ef5xc){var _0x2ef5x1a;return sequelize[_0x8c97[57]](function(_0x2ef5x18){return CustomReport[_0x8c97[49]](_0x2ef5xb[_0x8c97[55]],{transaction:_0x2ef5x18})[_0x8c97[16]](function(_0x2ef5x12){_0x2ef5x1a=_0x2ef5x12;return [_0x2ef5x1a,_0x2ef5xb[_0x8c97[55]][_0x8c97[58]]]})[_0x8c97[45]](createFields(_0x2ef5x18))})[_0x8c97[16]](function(){return _0x2ef5xc[_0x8c97[15]](201)[_0x8c97[14]](_0x2ef5x1a)})[_0x8c97[13]](function(_0x2ef5xe){console[_0x8c97[23]](_0x2ef5xe);return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[59]]=function(_0x2ef5xb,_0x2ef5xc){if(_0x2ef5xb[_0x8c97[55]][_0x8c97[36]]){delete _0x2ef5xb[_0x8c97[55]][_0x8c97[36]]};var _0x2ef5x1a;return sequelize[_0x8c97[57]](function(_0x2ef5x18){return CustomReport[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};var _0x2ef5x1b=_[_0x8c97[19]](_0x2ef5x12,_0x2ef5xb[_0x8c97[55]]);return _0x2ef5x12[_0x8c97[61]]({transaction:_0x2ef5x18})})[_0x8c97[16]](function(_0x2ef5x12){_0x2ef5x1a=_0x2ef5x12;if(_0x2ef5xb[_0x8c97[55]][_0x8c97[58]]){return ReportField[_0x8c97[60]]({where:{CustomReportId:_0x2ef5xb[_0x8c97[18]][_0x8c97[36]]},transaction:_0x2ef5x18})}})[_0x8c97[16]](function(){return [_0x2ef5x1a,_0x2ef5xb[_0x8c97[55]][_0x8c97[58]]]})[_0x8c97[45]](createFields(_0x2ef5x18))})[_0x8c97[16]](function(){return _0x2ef5xc[_0x8c97[31]](200)})[_0x8c97[13]](function(_0x2ef5xe){console[_0x8c97[23]](_0x2ef5xe);return handleError(_0x2ef5xc,_0x2ef5xe)})};function createFields(_0x2ef5x18){return function(_0x2ef5x12,_0x2ef5x1d){if(_0x2ef5x1d&&Array[_0x8c97[62]](_0x2ef5x1d)&&_0x2ef5x1d[_0x8c97[24]]){var _0x2ef5x1e=getTable(_0x2ef5x12[_0x8c97[63]]);if(_0x2ef5x1e){var _0x2ef5x1f;return _0x2ef5x1e[_0x8c97[79]]()[_0x8c97[16]](function(_0x2ef5x24){_0x2ef5x1f=_[_0x8c97[77]](_0x2ef5x24);return Metric[_0x8c97[78]]()})[_0x8c97[16]](function(_0x2ef5x20){var _0x2ef5x21=[];_0x2ef5x20=_[_0x8c97[56]](_0x2ef5x20,_0x8c97[32]);_0x2ef5x1d[_0x8c97[76]](function(_0x2ef5x22){_0x2ef5x22[_0x8c97[65]]=_0x2ef5x12[_0x8c97[36]];if(_0x2ef5x22[_0x8c97[66]]){var _0x2ef5x23=_[_0x8c97[67]](_0x2ef5x20,{id:_0x2ef5x22[_0x8c97[66]]});if(_0x2ef5x23){_0x2ef5x22[_0x8c97[68]]=_0x2ef5x23[_0x8c97[69]];_0x2ef5x21[_0x8c97[70]](ReportField[_0x8c97[49]](_0x2ef5x22,{transaction:_0x2ef5x18}))}else {throw new Error(_0x8c97[71]+_0x2ef5x22[_0x8c97[66]]+_0x8c97[72])}}else {if(_[_0x8c97[73]](_0x2ef5x1f,_0x2ef5x22[_0x8c97[68]])){_0x2ef5x21[_0x8c97[70]](ReportField[_0x8c97[49]](_0x2ef5x22,{transaction:_0x2ef5x18}))}else {throw new Error(_0x8c97[74]+_0x2ef5x22[_0x8c97[68]]+_0x8c97[75])}}});return _0x2ef5x21})[_0x8c97[64]]()}else {throw new Error(_0x8c97[80])}}}}function getTable(_0x2ef5x26){var _0x2ef5x1e;switch(_0x2ef5x26){case _0x8c97[83]:_0x2ef5x1e=require(_0x8c97[4])[_0x8c97[82]][_0x8c97[81]];break;case _0x8c97[85]:_0x2ef5x1e=require(_0x8c97[4])[_0x8c97[82]][_0x8c97[84]];break;case _0x8c97[87]:_0x2ef5x1e=require(_0x8c97[4])[_0x8c97[82]][_0x8c97[86]];break;case _0x8c97[89]:_0x2ef5x1e=require(_0x8c97[4])[_0x8c97[82]][_0x8c97[88]];break;default:};return _0x2ef5x1e}exports[_0x8c97[60]]=function(_0x2ef5xb,_0x2ef5xc){CustomReport[_0x8c97[37]](_0x2ef5xb[_0x8c97[18]][_0x8c97[36]])[_0x8c97[16]](function(_0x2ef5x12){if(!_0x2ef5x12){return _0x2ef5xc[_0x8c97[31]](404)};_0x2ef5x12[_0x8c97[60]]()[_0x8c97[16]](function(){return _0x2ef5xc[_0x8c97[31]](204)})[_0x8c97[13]](function(_0x2ef5xe){return handleError(_0x2ef5xc,_0x2ef5xe)})})[_0x8c97[13]](function(_0x2ef5xe){return handleError(_0x2ef5xc,_0x2ef5xe)})};exports[_0x8c97[90]]=function(_0x2ef5xb,_0x2ef5xc){CustomReport[_0x8c97[60]]({where:{id:_0x2ef5xb[_0x8c97[17]][_0x8c97[91]]},individualHooks:true})[_0x8c97[16]](function(){return _0x2ef5xc[_0x8c97[31]](204)})[_0x8c97[13]](function(_0x2ef5xe){return handleError(_0x2ef5xc,_0x2ef5xe)})};function handleError(_0x2ef5xc,_0x2ef5xe){return _0x2ef5xc[_0x8c97[15]](500)[_0x8c97[14]](_0x2ef5xe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var sequelize = require('../../models').sequelize; +var CustomReport = require('../../models').CustomReport; +var ReportField = require('../../models').ReportField; +var Metric = require('../../models').Metric; +var ExtractedReport = require('../../models').ExtractedReport; +var extractUtils = require('../../utils/report_extraction'); +var reportBuildUtils = require('../../utils/report_build'); +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return CustomReport + .findAndCountAll(Util.getQuery(_.merge(req.query, req.params))) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.preview = function(req, res) { + var _countAll; + return CustomReport + .scope('fields') + .findById(req.params.id) + .then(function(report) { + console.log('found report'); + if (!report) { + return res.sendStatus(404); + } + var query = reportBuildUtils.buildReport(report.dataValues, req.query); + // console.log(query); + return sequelize.query(query, { + type: sequelize.QueryTypes.SELECT + }); + }) + .then(function(results) { + _countAll = results.length; + if (req.query.limit) { + results = _(results).slice(req.query.offset || 0).take(req.query.limit).value(); + } + res.status(200).send({ + rows: results, + count: _countAll + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.extractPdf = function(req, res) { + // console.log('extractPdf api function'); + docExtract(req, res, 'PDF') +}; + +exports.extractCsv = function(req, res) { + // console.log('extractCsv api function'); + docExtract(req, res, 'CSV'); +}; + +function docExtract(req, res, typeFunction) { + // console.log('common docExtract api function'); + CustomReport + .scope('fields') + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + // console.log('found the report, creating the new DB row for extracted reports..'); + //CREATE A DB ROW IN A TABLE WITH THE REPORT INFO, QUERY DATES, AND THE STATUS 'ELABORATING' + return [report, ExtractedReport.create({ + name: report.name, + startDate: req.query.startDate || null, + endDate: req.query.endDate || null, + output: typeFunction + })] + }) + .spread(function(report, extractedReport) { + // console.log('created new extracted reports db entry, calling external extraction function: ' + typeFunction); + extractUtils['extract' + typeFunction](report, req.query, extractedReport.id); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + return res.sendStatus(200); +} + +// Get a single report +exports.show = function(req, res) { + return CustomReport + .scope('fields') + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + return res.send(report); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Copy a custom report +exports.copy = function(req, res) { + var _fields; + return sequelize.transaction(function(t) { + return CustomReport + .scope('fields') + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + var newReport = report.dataValues; + delete newReport.id; + delete newReport.createdAt; + delete newReport.updatedAt; + newReport.parent = req.body.parent; + _fields = _.map(newReport.Fields, 'dataValues'); + return CustomReport + .create(newReport, { + transaction: t + }); + }) + .then(function(report) { + return [report, _fields]; + }) + .spread(createFields(t)); + }) + .then(function() { + return res.sendStatus(201); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Creates a new report in the DB. +exports.create = function(req, res) { + var _report; + return sequelize.transaction(function(t) { + return CustomReport + .create(req.body, { + transaction: t + }) + .then(function(report) { + _report = report; + return [_report, req.body.Fields]; + }) + .spread(createFields(t)); + }) + .then(function() { + return res.status(201).send(_report); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + var _report; + return sequelize.transaction(function(t) { + return CustomReport + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + var updated = _.merge(report, req.body); + return report + .save({ + transaction: t + }); + }) + .then(function(report) { + _report = report; + if (req.body.Fields) { + return ReportField.destroy({ + where: { + CustomReportId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + return [_report, req.body.Fields]; + }) + .spread(createFields(t)); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + +function createFields(t) { + return function(report, fields) { + if (fields && Array.isArray(fields) && fields.length) { + var tableModel = getTable(report.table); + if (tableModel) { + var _tableFields; + return tableModel + .describe() + .then(function(tableFields) { + _tableFields = _.keys(tableFields); + return Metric + .findAll(); + }) + .then(function(metrics) { + var bulkFields = []; + metrics = _.map(metrics, 'dataValues'); + fields.forEach(function(elem) { + elem.CustomReportId = report.id; + if (elem.MetricId) { + var metric = _.find(metrics, { + id: elem.MetricId + }); + if (metric) { + elem.field = metric.metric; + bulkFields.push(ReportField + .create(elem, { + transaction: t + })); + } else { + throw new Error("The metric with id " + elem.MetricId + " you specified does not exist"); + } + } else { + if (_.includes(_tableFields, elem.field)) { + bulkFields.push(ReportField + .create(elem, { + transaction: t + })); + } else { + throw new Error("The field " + elem.field + " you specified does not exist in the table"); + } + } + }); + return bulkFields; + }) + .all(); + } else { + throw new Error("You have not specified the table or the table does not exist"); + } + } + } +} + +function getTable(table) { + var tableModel; + switch (table) { + case 'report_agent_history': + tableModel = require('../../models').history.ReportAgentHistory; + break; + case 'report_mail_session_history': + tableModel = require('../../models').history.ReportMailSessionHistory; + break; + case 'report_queue_history': + tableModel = require('../../models').history.ReportQueueHistory; + break; + case 'report_chat_session_history': + tableModel = require('../../models').history.ReportChatSessionHistory; + break; + default: + } + return tableModel; +} + +// Deletes a report from the DB. +exports.destroy = function(req, res) { + CustomReport + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + report.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + CustomReport + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/custom_report/custom_report.socket.js b/server/api/custom_report/custom_report.socket.js index 6f92b11..07bf827 100644 --- a/server/api/custom_report/custom_report.socket.js +++ b/server/api/custom_report/custom_report.socket.js @@ -1 +1,24 @@ -var _0xbb70=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xbb70[0];var CustomReport=require(_0xbb70[2])[_0xbb70[1]];exports[_0xbb70[3]]=function(_0x8c38x2){CustomReport[_0xbb70[4]](function(_0x8c38x3){onSave(_0x8c38x2,_0x8c38x3)});CustomReport[_0xbb70[5]](function(_0x8c38x3){onRemove(_0x8c38x2,_0x8c38x3)})};function onSave(_0x8c38x2,_0x8c38x3,_0x8c38x5){_0x8c38x2[_0xbb70[7]](_0xbb70[6],_0x8c38x3)}function onRemove(_0x8c38x2,_0x8c38x3,_0x8c38x5){_0x8c38x2[_0xbb70[7]](_0xbb70[8],_0x8c38x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var CustomReport = require('../../models').CustomReport; + +exports.register = function(socket) { + CustomReport.afterCreate(function(doc) { + onSave(socket, doc); + }); + CustomReport.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('custom_report:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('custom_report:remove', doc); +} diff --git a/server/api/custom_report/custom_report.spec.js b/server/api/custom_report/custom_report.spec.js index 6ff1c15..905f802 100644 --- a/server/api/custom_report/custom_report.spec.js +++ b/server/api/custom_report/custom_report.spec.js @@ -1 +1,20 @@ -var _0x3033=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x63\x75\x73\x74\x6F\x6D","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x63\x75\x73\x74\x6F\x6D","\x67\x65\x74"];_0x3033[0];var should=require(_0x3033[1]);var app=require(_0x3033[2]);var request=require(_0x3033[3]);describe(_0x3033[4],function(){it(_0x3033[5],function(_0xbd7cx4){request(app)[_0x3033[13]](_0x3033[12])[_0x3033[11]](200)[_0x3033[11]](_0x3033[10],/json/)[_0x3033[9]](function(_0xbd7cx5,_0xbd7cx6){if(_0xbd7cx5){return _0xbd7cx4(_0xbd7cx5)};_0xbd7cx6[_0x3033[8]][_0x3033[1]][_0x3033[7]][_0x3033[6]](Array);_0xbd7cx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/analytics/reports/custom', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/analytic/reports/custom') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/custom_report/index.js b/server/api/custom_report/index.js index 9fd6f1e..132d3cc 100644 --- a/server/api/custom_report/index.js +++ b/server/api/custom_report/index.js @@ -1 +1,21 @@ -var _0x906f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x70\x72\x65\x76\x69\x65\x77","\x70\x72\x65\x76\x69\x65\x77","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x3A\x69\x64\x2F\x65\x78\x74\x72\x61\x63\x74\x2F\x70\x64\x66","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x2F\x3A\x69\x64\x2F\x65\x78\x74\x72\x61\x63\x74\x2F\x63\x73\x76","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x2F\x69\x6D\x70\x6F\x72\x74","\x2F\x3A\x69\x64\x2F\x63\x6F\x70\x79","\x63\x6F\x70\x79","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x906f[0];var express=require(_0x906f[1]);var controller=require(_0x906f[2]);var router=express.Router();router[_0x906f[5]](_0x906f[3],controller[_0x906f[4]]);router[_0x906f[5]](_0x906f[6],controller[_0x906f[7]]);router[_0x906f[5]](_0x906f[8],controller[_0x906f[9]]);router[_0x906f[11]](_0x906f[3],controller[_0x906f[10]]);router[_0x906f[5]](_0x906f[12],controller[_0x906f[13]]);router[_0x906f[5]](_0x906f[14],controller[_0x906f[15]]);router[_0x906f[11]](_0x906f[16],controller[_0x906f[10]]);router[_0x906f[11]](_0x906f[17],controller[_0x906f[18]]);router[_0x906f[20]](_0x906f[8],controller[_0x906f[19]]);router[_0x906f[21]](_0x906f[8],controller[_0x906f[19]]);router[_0x906f[23]](_0x906f[3],controller[_0x906f[22]]);router[_0x906f[23]](_0x906f[8],controller[_0x906f[24]]);module[_0x906f[25]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./custom_report.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id/preview', controller.preview); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.get('/:id/extract/pdf', controller.extractPdf); +router.get('/:id/extract/csv', controller.extractCsv); +router.post('/import', controller.create); +router.post('/:id/copy', controller.copy); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/', controller.bulkDestroy); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 84cc0b7..4eb8756 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -1 +1,147 @@ -var _0xb93d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x61\x6C\x6C","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x6C\x6F\x6E\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x65\x64\x69\x74\x61\x62\x6C\x65","\x64\x65\x66\x61\x75\x6C\x74\x45\x6E\x74\x72\x79","\x6E\x61\x6D\x65","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xb93d[0];var _=require(_0xb93d[1]);var util=require(_0xb93d[2]);var Dashboard=require(_0xb93d[4])[_0xb93d[3]];var Util=require(_0xb93d[5]);exports[_0xb93d[6]]=function(_0xeefdx5,_0xeefdx6,_0xeefdx7){return Dashboard[_0xb93d[13]](Util[_0xb93d[12]](_0xeefdx5[_0xb93d[11]]))[_0xb93d[10]](function(_0xeefdx9){_0xeefdx6[_0xb93d[9]](200)[_0xb93d[8]](_0xeefdx9)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[14]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[16]]()[_0xb93d[10]](function(_0xeefdxa){if(!_0xeefdxa){return _0xeefdx6[_0xb93d[15]](404)};return _0xeefdx6[_0xb93d[9]](200)[_0xb93d[8]](_0xeefdxa)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[17]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[20]](_0xeefdx5[_0xb93d[19]][_0xb93d[18]])[_0xb93d[10]](function(_0xeefdxb){if(!_0xeefdxb){return _0xeefdx6[_0xb93d[15]](404)};return _0xeefdx6[_0xb93d[8]](_0xeefdxb)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[21]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[21]](_0xeefdx5[_0xb93d[22]])[_0xb93d[10]](function(_0xeefdxb){return _0xeefdx6[_0xb93d[9]](201)[_0xb93d[8]](_0xeefdxb)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[23]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[20]](_0xeefdx5[_0xb93d[19]][_0xb93d[18]])[_0xb93d[10]](function(_0xeefdxb){var _0xeefdxc=_0xeefdxb[_0xb93d[24]];delete _0xeefdxc[_0xb93d[18]];_0xeefdxc[_0xb93d[25]]=true;_0xeefdxc[_0xb93d[26]]=false;_0xeefdxc[_0xb93d[27]]=_0xeefdx5[_0xb93d[22]][_0xb93d[27]]||_0xeefdxc[_0xb93d[27]];return Dashboard[_0xb93d[21]](_0xeefdxc)})[_0xb93d[10]](function(_0xeefdxb){return _0xeefdx6[_0xb93d[9]](201)[_0xb93d[8]](_0xeefdxb)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[28]]=function(_0xeefdx5,_0xeefdx6){if(_0xeefdx5[_0xb93d[22]][_0xb93d[18]]){delete _0xeefdx5[_0xb93d[22]][_0xb93d[18]]};Dashboard[_0xb93d[20]](_0xeefdx5[_0xb93d[19]][_0xb93d[18]])[_0xb93d[10]](function(_0xeefdxb){if(!_0xeefdxb){return _0xeefdx6[_0xb93d[15]](404)};var _0xeefdxd=_[_0xb93d[29]](_0xeefdxb,_0xeefdx5[_0xb93d[22]]);_0xeefdxd[_0xb93d[30]]()[_0xb93d[10]](function(){return _0xeefdx6[_0xb93d[9]](200)[_0xb93d[8]](_0xeefdxb)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[31]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[20]](_0xeefdx5[_0xb93d[19]][_0xb93d[18]])[_0xb93d[10]](function(_0xeefdxb){if(!_0xeefdxb){return _0xeefdx6[_0xb93d[15]](404)};_0xeefdxb[_0xb93d[31]]()[_0xb93d[10]](function(){return _0xeefdx6[_0xb93d[15]](204)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};exports[_0xb93d[32]]=function(_0xeefdx5,_0xeefdx6){Dashboard[_0xb93d[31]]({where:{id:_0xeefdx5[_0xb93d[11]][_0xb93d[33]]},individualHooks:true})[_0xb93d[10]](function(){return _0xeefdx6[_0xb93d[15]](204)})[_0xb93d[7]](function(_0xeefdx8){return handleError(_0xeefdx6,_0xeefdx8)})};function handleError(_0xeefdx6,_0xeefdx8){return _0xeefdx6[_0xb93d[9]](500)[_0xb93d[8]](_0xeefdx8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Dashboard = require('../../models').Dashboard; +var Util = require('../../config/util'); + +// Get list of dashboards +exports.index = function(req, res, next) { + return Dashboard + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single dashboard +exports.all = function(req, res) { + Dashboard + .findAll() + .then(function(dashboards) { + if (!dashboards) { + return res.sendStatus(404); + } + return res.status(200).send(dashboards); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single dashboard +exports.show = function(req, res) { + Dashboard + .findById(req.params.id) + .then(function(dashboard) { + if (!dashboard) { + return res.sendStatus(404); + } + return res.send(dashboard); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new dashboard in the DB. +exports.create = function(req, res) { + Dashboard + .create(req.body) + .then(function(dashboard) { + return res.status(201).send(dashboard); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Clone a dashboard in the DB. +exports.clone = function(req, res) { + Dashboard + .findById(req.params.id) + .then(function(dashboard) { + var newDashboard = dashboard.dataValues; + delete newDashboard.id; + newDashboard.editable = true; + newDashboard.defaultEntry = false; + newDashboard.name = req.body.name || newDashboard.name; + return Dashboard + .create(newDashboard); + }) + .then(function(dashboard) { + return res.status(201).send(dashboard); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing dashboard in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Dashboard + .findById(req.params.id) + .then(function(dashboard) { + if (!dashboard) { + return res.sendStatus(404); + } + var updated = _.merge(dashboard, req.body); + updated.save() + .then(function() { + return res.status(200).send(dashboard); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a dashboard from the DB. +exports.destroy = function(req, res) { + Dashboard + .findById(req.params.id) + .then(function(dashboard) { + if (!dashboard) { + return res.sendStatus(404); + } + dashboard.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + Dashboard + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fe1a684..9bf2215 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -1 +1,27 @@ -var _0xcf2f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0xcf2f[0];var Dashboard=require(_0xcf2f[2])[_0xcf2f[1]];exports[_0xcf2f[3]]=function(_0xe2eex2){Dashboard[_0xcf2f[4]](function(_0xe2eex3){onSave(_0xe2eex2,_0xe2eex3)});Dashboard[_0xcf2f[5]](function(_0xe2eex3){onSave(_0xe2eex2,_0xe2eex3)});Dashboard[_0xcf2f[6]](function(_0xe2eex3){onRemove(_0xe2eex2,_0xe2eex3)})};function onSave(_0xe2eex2,_0xe2eex3,_0xe2eex5){_0xe2eex2[_0xcf2f[8]](_0xcf2f[7],_0xe2eex3)}function onRemove(_0xe2eex2,_0xe2eex3,_0xe2eex5){_0xe2eex2[_0xcf2f[8]](_0xcf2f[9],_0xe2eex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Dashboard = require('../../models').Dashboard; + +exports.register = function(socket) { + Dashboard.afterCreate(function(doc) { + onSave(socket, doc); + }); + Dashboard.afterUpdate(function(doc) { + onSave(socket, doc); + }); + Dashboard.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('dashboard:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('dashboard:remove', doc); +} diff --git a/server/api/dashboard/dashboard.spec.js b/server/api/dashboard/dashboard.spec.js index c1aea37..4784e74 100644 --- a/server/api/dashboard/dashboard.spec.js +++ b/server/api/dashboard/dashboard.spec.js @@ -1 +1,20 @@ -var _0x88f1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x73","\x67\x65\x74"];_0x88f1[0];var should=require(_0x88f1[1]);var app=require(_0x88f1[2]);var request=require(_0x88f1[3]);describe(_0x88f1[4],function(){it(_0x88f1[5],function(_0x3ca4x4){request(app)[_0x88f1[13]](_0x88f1[12])[_0x88f1[11]](200)[_0x88f1[11]](_0x88f1[10],/json/)[_0x88f1[9]](function(_0x3ca4x5,_0x3ca4x6){if(_0x3ca4x5){return _0x3ca4x4(_0x3ca4x5)};_0x3ca4x6[_0x88f1[8]][_0x88f1[1]][_0x88f1[7]][_0x88f1[6]](Array);_0x3ca4x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/dashboards', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/dashboards') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 67c11af..393fb11 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -1 +1,19 @@ -var _0xb132=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x61\x6C\x6C","\x61\x6C\x6C","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x3A\x69\x64\x2F\x63\x6C\x6F\x6E\x65","\x63\x6C\x6F\x6E\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xb132[0];var express=require(_0xb132[1]);var controller=require(_0xb132[2]);var auth=require(_0xb132[3]);var router=express.Router();router[_0xb132[7]](_0xb132[4],auth[_0xb132[5]](),controller[_0xb132[6]]);router[_0xb132[7]](_0xb132[8],auth[_0xb132[5]](),controller[_0xb132[9]]);router[_0xb132[7]](_0xb132[10],auth[_0xb132[5]](),controller[_0xb132[11]]);router[_0xb132[13]](_0xb132[4],auth[_0xb132[5]](),controller[_0xb132[12]]);router[_0xb132[13]](_0xb132[14],auth[_0xb132[5]](),controller[_0xb132[15]]);router[_0xb132[17]](_0xb132[10],auth[_0xb132[5]](),controller[_0xb132[16]]);router[_0xb132[18]](_0xb132[10],auth[_0xb132[5]](),controller[_0xb132[16]]);router[_0xb132[20]](_0xb132[4],auth[_0xb132[5]](),controller[_0xb132[19]]);router[_0xb132[20]](_0xb132[10],auth[_0xb132[5]](),controller[_0xb132[21]]);module[_0xb132[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./dashboard.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/all', auth.isAuthenticated(), controller.all); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/clone', auth.isAuthenticated(), controller.clone); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/default_report/default_report.controller.js b/server/api/default_report/default_report.controller.js index d09915d..4fc95af 100644 --- a/server/api/default_report/default_report.controller.js +++ b/server/api/default_report/default_report.controller.js @@ -1 +1,234 @@ -var _0xa024=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x70\x61\x72\x61\x6D\x73","\x6D\x65\x72\x67\x65","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x70\x72\x65\x76\x69\x65\x77","\x6C\x6F\x67","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6D\x69\x74","\x76\x61\x6C\x75\x65","\x74\x61\x6B\x65","\x6F\x66\x66\x73\x65\x74","\x73\x6C\x69\x63\x65","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x62\x75\x69\x6C\x64\x52\x65\x70\x6F\x72\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\x65\x78\x74\x72\x61\x63\x74","\x73\x70\x72\x65\x61\x64","\x6E\x61\x6D\x65","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x65\x6E\x64\x44\x61\x74\x65","\x63\x72\x65\x61\x74\x65","","\x28","\x72\x75\x6C\x65\x73","\x20","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x67\x72\x6F\x75\x70","\x66\x69\x65\x6C\x64","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x20\x27","\x4C\x49\x4B\x45","\x25","\x27","\x29","\x73\x68\x6F\x77","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x61\x72\x65\x6E\x74","\x62\x6F\x64\x79","\x46\x69\x65\x6C\x64\x73","\x6D\x61\x70","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74\x49\x64","\x66\x6F\x72\x45\x61\x63\x68","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xa024[0];var _=require(_0xa024[1]);var util=require(_0xa024[2]);var DefaultReport=require(_0xa024[4])[_0xa024[3]];var sequelize=require(_0xa024[4])[_0xa024[5]];var CustomReport=require(_0xa024[4])[_0xa024[6]];var ExtractedReport=require(_0xa024[4])[_0xa024[7]];var extractUtils=require(_0xa024[8]);var reportBuildUtils=require(_0xa024[9]);var Util=require(_0xa024[10]);exports[_0xa024[11]]=function(_0x966fxa,_0x966fxb,_0x966fxc){return DefaultReport[_0xa024[20]](Util[_0xa024[19]](_[_0xa024[18]](_0x966fxa[_0xa024[16]],_0x966fxa[_0xa024[17]])))[_0xa024[15]](function(_0x966fxe){_0x966fxb[_0xa024[14]](200)[_0xa024[13]](_0x966fxe)})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[21]]=function(_0x966fxa,_0x966fxb){var _0x966fxf;DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]],{include:[{all:true}]})[_0xa024[15]](function(_0x966fx11){console[_0xa024[22]](_0xa024[29]);if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};var _0x966fx12=reportBuildUtils[_0xa024[32]](_0x966fx11[_0xa024[31]],_0x966fxa[_0xa024[16]]);return sequelize[_0xa024[16]](_0x966fx12,{type:sequelize[_0xa024[34]][_0xa024[33]]})})[_0xa024[15]](function(_0x966fx10){_0x966fxf=_0x966fx10[_0xa024[23]];if(_0x966fxa[_0xa024[16]][_0xa024[24]]){var _0x966fx10=_(_0x966fx10)[_0xa024[28]](_0x966fxa[_0xa024[16]][_0xa024[27]]||0)[_0xa024[26]](_0x966fxa[_0xa024[16]][_0xa024[24]])[_0xa024[25]]()};_0x966fxb[_0xa024[14]](200)[_0xa024[13]]({rows:_0x966fx10,count:_0x966fxf})})[_0xa024[12]](function(_0x966fxd){console[_0xa024[22]](_0x966fxd);return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[37]]=function(_0x966fxa,_0x966fxb){docExtract(_0x966fxa,_0x966fxb,_0xa024[38])};exports[_0xa024[39]]=function(_0x966fxa,_0x966fxb){docExtract(_0x966fxa,_0x966fxb,_0xa024[40])};function docExtract(_0x966fxa,_0x966fxb,_0x966fx14){DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]],{include:[{all:true}]})[_0xa024[15]](function(_0x966fx11){if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};return [_0x966fx11,ExtractedReport[_0xa024[46]]({name:_0x966fx11[_0xa024[43]],startDate:_0x966fxa[_0xa024[16]][_0xa024[44]]||null,endDate:_0x966fxa[_0xa024[16]][_0xa024[45]]||null,output:_0x966fx14})]})[_0xa024[42]](function(_0x966fx11,_0x966fx15){extractUtils[_0xa024[41]+_0x966fx14](_0x966fx11,_0x966fxa[_0xa024[16]],_0x966fx15[_0xa024[35]])})[_0xa024[12]](function(_0x966fxd){console[_0xa024[22]](_0x966fxd);return handleError(_0x966fxb,_0x966fxd)});return _0x966fxb[_0xa024[30]](200)}function getConditions(_0x966fx17){if(!_0x966fx17){return _0xa024[47]};for(var _0x966fx18=_0xa024[48],_0x966fx19=0;_0x966fx19<_0x966fx17[_0xa024[49]][_0xa024[23]];_0x966fx19++){_0x966fx19>0&&(_0x966fx18+=_0xa024[50]+_0x966fx17[_0xa024[51]]+_0xa024[50]);_0x966fx18+=_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[52]]?getConditions(_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[52]]):_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[53]]+_0xa024[50]+_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[54]]+_0xa024[55]+(_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[54]]===_0xa024[56]?_0xa024[57]+_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[25]]+_0xa024[57]:_0x966fx17[_0xa024[49]][_0x966fx19][_0xa024[25]])+_0xa024[58]};return _0x966fx18+_0xa024[59]}exports[_0xa024[60]]=function(_0x966fxa,_0x966fxb){DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]],{include:[{all:true}]})[_0xa024[15]](function(_0x966fx11){if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};return _0x966fxb[_0xa024[13]](_0x966fx11)})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[61]]=function(_0x966fxa,_0x966fxb){DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]],{include:[{all:true}]})[_0xa024[15]](function(_0x966fx11){if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};var _0x966fx1a=_0x966fx11[_0xa024[31]];delete _0x966fx1a[_0xa024[35]];delete _0x966fx1a[_0xa024[62]];delete _0x966fx1a[_0xa024[63]];_0x966fx1a[_0xa024[64]]=_0x966fxa[_0xa024[65]][_0xa024[64]];_0x966fx1a[_0xa024[66]]=_[_0xa024[67]](_0x966fx1a.Fields,_0xa024[31]);_[_0xa024[69]](_0x966fx1a.Fields,function(_0x966fx1b){delete _0x966fx1b[_0xa024[35]];delete _0x966fx1b[_0xa024[68]];delete _0x966fx1b[_0xa024[62]];delete _0x966fx1b[_0xa024[63]]});return CustomReport[_0xa024[46]](_0x966fx1a,{include:[{all:true}]})})[_0xa024[15]](function(){return _0x966fxb[_0xa024[30]](201)})[_0xa024[12]](function(_0x966fxd){console[_0xa024[22]](_0x966fxd);return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[46]]=function(_0x966fxa,_0x966fxb){DefaultReport[_0xa024[46]](_0x966fxa[_0xa024[65]])[_0xa024[15]](function(_0x966fx11){return _0x966fxb[_0xa024[14]](201)[_0xa024[13]](_0x966fx11)})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[70]]=function(_0x966fxa,_0x966fxb){if(_0x966fxa[_0xa024[65]][_0xa024[35]]){delete _0x966fxa[_0xa024[65]][_0xa024[35]]};DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]])[_0xa024[15]](function(_0x966fx11){if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};var _0x966fx1c=_[_0xa024[18]](_0x966fx11,_0x966fxa[_0xa024[65]]);_0x966fx1c[_0xa024[71]]()[_0xa024[15]](function(){return _0x966fxb[_0xa024[14]](200)[_0xa024[13]](_0x966fx11)})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})};exports[_0xa024[72]]=function(_0x966fxa,_0x966fxb){DefaultReport[_0xa024[36]](_0x966fxa[_0xa024[17]][_0xa024[35]])[_0xa024[15]](function(_0x966fx11){if(!_0x966fx11){return _0x966fxb[_0xa024[30]](404)};_0x966fx11[_0xa024[72]]()[_0xa024[15]](function(){return _0x966fxb[_0xa024[30]](204)})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})})[_0xa024[12]](function(_0x966fxd){return handleError(_0x966fxb,_0x966fxd)})};function handleError(_0x966fxb,_0x966fxd){return _0x966fxb[_0xa024[14]](500)[_0xa024[13]](_0x966fxd)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var DefaultReport = require('../../models').DefaultReport; +var sequelize = require('../../models').sequelize; +var CustomReport = require('../../models').CustomReport; +var ExtractedReport = require('../../models').ExtractedReport; +var extractUtils = require('../../utils/report_extraction'); +var reportBuildUtils = require('../../utils/report_build'); +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return DefaultReport + .findAndCountAll(Util.getQuery(_.merge(req.query, req.params))) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + + +exports.preview = function(req, res) { + var _countAll; + DefaultReport + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(report) { + console.log('found report'); + if (!report) { + return res.sendStatus(404); + } + var query = reportBuildUtils.buildReport(report.dataValues, req.query); + // console.log(query); + return sequelize.query(query, { + type: sequelize.QueryTypes.SELECT + }); + }) + .then(function(results) { + _countAll = results.length; + if (req.query.limit) { + var results = _(results).slice(req.query.offset || 0).take(req.query.limit).value(); + } + res.status(200).send({ + rows: results, + count: _countAll + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.extractPdf = function(req, res) { + // console.log('extractPdf api function'); + docExtract(req, res, 'PDF') +}; + +exports.extractCsv = function(req, res) { + // console.log('extractCsv api function'); + docExtract(req, res, 'CSV'); +}; + +function docExtract(req, res, typeFunction) { + // console.log('common docExtract api function'); + DefaultReport + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + // console.log('found the report, creating the new DB row for extracted reports..'); + //CREATE A DB ROW IN A TABLE WITH THE REPORT INFO, QUERY DATES, AND THE STATUS 'ELABORATING' + return [report, ExtractedReport.create({ + name: report.name, + startDate: req.query.startDate || null, + endDate: req.query.endDate || null, + output: typeFunction + })] + }) + .spread(function(report, extractedReport) { + // console.log('created new extracted reports db entry, calling external extraction function: ' + typeFunction); + extractUtils['extract' + typeFunction](report, req.query, extractedReport.id); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + return res.sendStatus(200); +} + +function getConditions(group) { + if (!group) return ""; + for (var str = "(", i = 0; i < group.rules.length; i++) { + i > 0 && (str += " " + group.operator + " "); + str += group.rules[i].group ? + getConditions(group.rules[i].group) : + group.rules[i].field + " " + group.rules[i].condition + " '" + (group.rules[i].condition === 'LIKE' ? "%" + group.rules[i].value + "%" : group.rules[i].value) + "'"; + } + + return str + ')'; +} + +// Get a single report +exports.show = function(req, res) { + DefaultReport + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + return res.send(report); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Copy a default report +exports.copy = function(req, res) { + DefaultReport + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + var newReport = report.dataValues; + delete newReport.id; + delete newReport.createdAt; + delete newReport.updatedAt; + newReport.parent = req.body.parent; + newReport.Fields = _.map(newReport.Fields, 'dataValues'); + _.forEach(newReport.Fields, function(elem) { + delete elem.id; + delete elem.DefaultReportId; + delete elem.createdAt; + delete elem.updatedAt; + }); + + return CustomReport.create(newReport, { + include: [{ + all: true + }] + }) + }) + .then(function() { + return res.sendStatus(201); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Creates a new report in the DB. +exports.create = function(req, res) { + DefaultReport + .create(req.body) + .then(function(report) { + return res.status(201).send(report); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing report in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + DefaultReport + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + var updated = _.merge(report, req.body); + updated.save() + .then(function() { + return res.status(200).send(report); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a report from the DB. +exports.destroy = function(req, res) { + DefaultReport + .findById(req.params.id) + .then(function(report) { + if (!report) { + return res.sendStatus(404); + } + report.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/default_report/default_report.socket.js b/server/api/default_report/default_report.socket.js index aba6d5e..2acd563 100644 --- a/server/api/default_report/default_report.socket.js +++ b/server/api/default_report/default_report.socket.js @@ -1 +1,24 @@ -var _0x48cf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x48cf[0];var DefaultReport=require(_0x48cf[2])[_0x48cf[1]];exports[_0x48cf[3]]=function(_0x716dx2){DefaultReport[_0x48cf[4]](function(_0x716dx3){onSave(_0x716dx2,_0x716dx3)});DefaultReport[_0x48cf[5]](function(_0x716dx3){onRemove(_0x716dx2,_0x716dx3)})};function onSave(_0x716dx2,_0x716dx3,_0x716dx5){_0x716dx2[_0x48cf[7]](_0x48cf[6],_0x716dx3)}function onRemove(_0x716dx2,_0x716dx3,_0x716dx5){_0x716dx2[_0x48cf[7]](_0x48cf[8],_0x716dx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var DefaultReport = require('../../models').DefaultReport; + +exports.register = function(socket) { + DefaultReport.afterCreate(function(doc) { + onSave(socket, doc); + }); + DefaultReport.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('default_report:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('default_report:remove', doc); +} diff --git a/server/api/default_report/default_report.spec.js b/server/api/default_report/default_report.spec.js index be499e8..2a6c81d 100644 --- a/server/api/default_report/default_report.spec.js +++ b/server/api/default_report/default_report.spec.js @@ -1 +1,20 @@ -var _0x5396=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x64\x65\x66\x61\x75\x6C\x74","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x64\x65\x66\x61\x75\x6C\x74","\x67\x65\x74"];_0x5396[0];var should=require(_0x5396[1]);var app=require(_0x5396[2]);var request=require(_0x5396[3]);describe(_0x5396[4],function(){it(_0x5396[5],function(_0x77e0x4){request(app)[_0x5396[13]](_0x5396[12])[_0x5396[11]](200)[_0x5396[11]](_0x5396[10],/json/)[_0x5396[9]](function(_0x77e0x5,_0x77e0x6){if(_0x77e0x5){return _0x77e0x4(_0x77e0x5)};_0x77e0x6[_0x5396[8]][_0x5396[1]][_0x5396[7]][_0x5396[6]](Array);_0x77e0x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/analytics/reports/default', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/analytic/reports/default') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/default_report/index.js b/server/api/default_report/index.js index 633728a..550ecd6 100644 --- a/server/api/default_report/index.js +++ b/server/api/default_report/index.js @@ -1 +1,19 @@ -var _0x1611=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x70\x72\x65\x76\x69\x65\x77","\x70\x72\x65\x76\x69\x65\x77","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x3A\x69\x64\x2F\x65\x78\x74\x72\x61\x63\x74\x2F\x70\x64\x66","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x2F\x3A\x69\x64\x2F\x65\x78\x74\x72\x61\x63\x74\x2F\x63\x73\x76","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x2F\x3A\x69\x64\x2F\x63\x6F\x70\x79","\x63\x6F\x70\x79","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x1611[0];var express=require(_0x1611[1]);var controller=require(_0x1611[2]);var router=express.Router();router[_0x1611[5]](_0x1611[3],controller[_0x1611[4]]);router[_0x1611[5]](_0x1611[6],controller[_0x1611[7]]);router[_0x1611[5]](_0x1611[8],controller[_0x1611[9]]);router[_0x1611[11]](_0x1611[3],controller[_0x1611[10]]);router[_0x1611[5]](_0x1611[12],controller[_0x1611[13]]);router[_0x1611[5]](_0x1611[14],controller[_0x1611[15]]);router[_0x1611[11]](_0x1611[16],controller[_0x1611[17]]);router[_0x1611[19]](_0x1611[8],controller[_0x1611[18]]);router[_0x1611[20]](_0x1611[8],controller[_0x1611[18]]);router[_0x1611[22]](_0x1611[8],controller[_0x1611[21]]);module[_0x1611[23]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./default_report.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id/preview', controller.preview); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.get('/:id/extract/pdf', controller.extractPdf); +router.get('/:id/extract/csv', controller.extractCsv); +router.post('/:id/copy', controller.copy); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/desk_account/desk_account.controller.js b/server/api/desk_account/desk_account.controller.js index 680efa0..78e1902 100644 --- a/server/api/desk_account/desk_account.controller.js +++ b/server/api/desk_account/desk_account.controller.js @@ -1 +1,256 @@ -var _0x35a6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x64\x65\x73\x6B\x2E\x6A\x73","\x44\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x61\x75\x74\x68\x54\x79\x70\x65","\x62\x61\x73\x69\x63","\x70\x61\x73\x73\x77\x6F\x72\x64","\x6F\x61\x75\x74\x68","\x63\x6F\x6E\x73\x75\x6D\x65\x72\x4B\x65\x79","\x63\x6F\x6E\x73\x75\x6D\x65\x72\x53\x65\x63\x72\x65\x74","\x74\x6F\x6B\x65\x6E","\x74\x6F\x6B\x65\x6E\x53\x65\x63\x72\x65\x74","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x65\x6E\x74","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x75\x73\x65\x72\x73\x2F\x6D\x65","\x67\x65\x74","\x64\x65\x73\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x63\x75\x73\x74\x6F\x6D\x5F\x66\x69\x65\x6C\x64\x73","\x65\x6E\x74\x72\x69\x65\x73","\x5F\x65\x6D\x62\x65\x64\x64\x65\x64","\x6A\x73\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x75\x62\x73\x74\x72","\x2F","\x6C\x65\x6E\x67\x74\x68"];_0x35a6[0];var _=require(_0x35a6[1]);var util=require(_0x35a6[2]);var desk=require(_0x35a6[3]);var DeskAccount=require(_0x35a6[5])[_0x35a6[4]];exports[_0x35a6[6]]=function(_0x7438x5,_0x7438x6){var _0x7438x7=[_0x35a6[7],_0x35a6[8],_0x35a6[9],_0x35a6[10]];var _0x7438x8=_0x7438x5[_0x35a6[12]][_0x35a6[11]]?parseInt(_0x7438x5[_0x35a6[12]][_0x35a6[11]],10):100;var _0x7438x9=_0x7438x5[_0x35a6[12]][_0x35a6[13]]?parseInt(_0x7438x5[_0x35a6[12]][_0x35a6[13]],10):0;var _0x7438xa={where:{},limit:_0x7438x8,offset:_0x7438x9*_0x7438x8};_[_0x35a6[27]](_0x7438x5[_0x35a6[12]],function(_0x7438xb,_0x7438xc){switch(_0x7438xc){case _0x35a6[11]:;case _0x35a6[13]:break;case _0x35a6[16]:_0x7438xa[_0x35a6[14]]=util[_0x35a6[19]](_0x35a6[15],_0x7438x5[_0x35a6[12]][_0x35a6[16]],_0x7438x5[_0x35a6[12]][_0x35a6[17]]||_0x35a6[18])||null;break;case _0x35a6[17]:break;case _0x35a6[25]:_0x7438xa[_0x35a6[21]][_0x35a6[20]]=[];_0x7438x7[_0x35a6[24]](function(_0x7438xd){var _0x7438xe={};_0x7438xe[_0x7438xd]={$like:_0x35a6[22]+_0x7438xb+_0x35a6[22]};_0x7438xa[_0x35a6[21]][_0x35a6[20]][_0x35a6[23]](_0x7438xe)});break;default:_0x7438xa[_0x35a6[21]][_0x7438xc]={$like:{}};_0x7438xa[_0x35a6[21]][_0x7438xc][_0x35a6[26]]=_0x35a6[22]+_0x7438xb+_0x35a6[22]}});DeskAccount[_0x35a6[42]](_0x7438xa)[_0x35a6[41]](function(_0x7438x10){var _0x7438x11=Math[_0x35a6[33]](_0x7438x10[_0x35a6[32]]/_0x7438x8);var _0x7438x12=_0x7438x11>(_0x7438xa[_0x35a6[34]]+1)?util[_0x35a6[19]](_0x35a6[35],_0x7438x5[_0x35a6[36]],_0x7438x5[_0x35a6[38]][_0x35a6[37]],_0x7438x5[_0x35a6[39]],_0x7438x9+1):null;var _0x7438x13=_0x7438x9>0?util[_0x35a6[19]](_0x35a6[35],_0x7438x5[_0x35a6[36]],_0x7438x5[_0x35a6[38]][_0x35a6[37]],_0x7438x5[_0x35a6[39]],_0x7438x9-1):null;return _0x7438x6[_0x35a6[30]](200)[_0x35a6[29]]({count:_0x7438x10[_0x35a6[32]],rows:_0x7438x10[_0x35a6[40]],next_page:_0x7438x12,previous_page:_0x7438x13,total_pages:_0x7438x11})})[_0x35a6[31]](function(_0x7438xf){return _0x7438x6[_0x35a6[30]](500)[_0x35a6[29]]({error:_0x35a6[28]})})};exports[_0x35a6[43]]=function(_0x7438x5,_0x7438x6){DeskAccount[_0x35a6[47]](_0x7438x5[_0x35a6[46]][_0x35a6[45]])[_0x35a6[41]](function(_0x7438x14){if(!_0x7438x14){return _0x7438x6[_0x35a6[44]](404)};return _0x7438x6[_0x35a6[29]](_0x7438x14)})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[48]]=function(_0x7438x5,_0x7438x6,_0x7438x15){DeskAccount[_0x35a6[48]](_0x7438x5[_0x35a6[49]])[_0x35a6[41]](function(_0x7438x14){return _0x7438x6[_0x35a6[30]](201)[_0x35a6[29]](_0x7438x14)})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[50]]=function(_0x7438x5,_0x7438x6){if(_0x7438x5[_0x35a6[49]][_0x35a6[45]]){delete _0x7438x5[_0x35a6[49]][_0x35a6[45]]};DeskAccount[_0x35a6[47]](_0x7438x5[_0x35a6[46]][_0x35a6[45]])[_0x35a6[41]](function(_0x7438x14){if(!_0x7438x14){return _0x7438x6[_0x35a6[44]](404)};var _0x7438x16=_[_0x35a6[51]](_0x7438x14,_0x7438x5[_0x35a6[49]]);_0x7438x16[_0x35a6[52]]()[_0x35a6[41]](function(){return _0x7438x6[_0x35a6[30]](200)[_0x35a6[29]](_0x7438x14)})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[53]]=function(_0x7438x5,_0x7438x6){DeskAccount[_0x35a6[47]](_0x7438x5[_0x35a6[46]][_0x35a6[45]])[_0x35a6[41]](function(_0x7438x14){if(!_0x7438x14){return _0x7438x6[_0x35a6[44]](404)};_0x7438x14[_0x35a6[53]]()[_0x35a6[41]](function(){return _0x7438x6[_0x35a6[44]](204)})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[54]]=function(_0x7438x5,_0x7438x6){DeskAccount[_0x35a6[47]](_0x7438x5[_0x35a6[46]][_0x35a6[45]])[_0x35a6[41]](function(_0x7438x17){var _0x7438x14={endpoint:stripTrailingSlash(_0x7438x17[_0x35a6[10]]),retry:false};if(_0x7438x17[_0x35a6[55]]===_0x35a6[56]){_0x7438x14[_0x35a6[9]]=_0x7438x17[_0x35a6[9]];_0x7438x14[_0x35a6[57]]=_0x7438x17[_0x35a6[57]]}else {if(_0x7438x17[_0x35a6[55]]===_0x35a6[58]){_0x7438x14[_0x35a6[59]]=_0x7438x17[_0x35a6[59]];_0x7438x14[_0x35a6[60]]=_0x7438x17[_0x35a6[60]];_0x7438x14[_0x35a6[61]]=_0x7438x17[_0x35a6[61]];_0x7438x14[_0x35a6[62]]=_0x7438x17[_0x35a6[62]]}};var _0x7438x18=desk[_0x35a6[63]](_0x7438x14);_0x7438x18[_0x35a6[65]](_0x35a6[64],function(_0x7438xf,_0x7438x19,_0x7438x1a){if(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)};return _0x7438x6[_0x35a6[44]](200)})})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[66]]=function(_0x7438x5,_0x7438x6){var _0x7438x1b={};_0x7438x1b[_0x7438x5[_0x35a6[46]][_0x35a6[67]]]=_0x7438x5[_0x35a6[49]][_0x35a6[68]];DeskAccount[_0x35a6[42]]({where:_0x7438x1b})[_0x35a6[41]](function(_0x7438x10){if(_0x7438x10[_0x35a6[32]]){return _0x7438x6[_0x35a6[30]](200)[_0x35a6[29]]({isValid:false,value:_0x7438x5[_0x35a6[49]][_0x35a6[68]]})};return _0x7438x6[_0x35a6[30]](200)[_0x35a6[29]]({isValid:true,value:_0x7438x5[_0x35a6[49]][_0x35a6[68]]})})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[69]]=function(_0x7438x5,_0x7438x6){DeskAccount[_0x35a6[47]](_0x7438x5[_0x35a6[46]][_0x35a6[45]])[_0x35a6[41]](function(_0x7438x17){var _0x7438x14={endpoint:stripTrailingSlash(_0x7438x17[_0x35a6[10]]),retry:false};if(_0x7438x17[_0x35a6[55]]===_0x35a6[56]){_0x7438x14[_0x35a6[9]]=_0x7438x17[_0x35a6[9]];_0x7438x14[_0x35a6[57]]=_0x7438x17[_0x35a6[57]]}else {if(_0x7438x17[_0x35a6[55]]===_0x35a6[58]){_0x7438x14[_0x35a6[59]]=_0x7438x17[_0x35a6[59]];_0x7438x14[_0x35a6[60]]=_0x7438x17[_0x35a6[60]];_0x7438x14[_0x35a6[61]]=_0x7438x17[_0x35a6[61]];_0x7438x14[_0x35a6[62]]=_0x7438x17[_0x35a6[62]]}};var _0x7438x18=desk[_0x35a6[63]](_0x7438x14);_0x7438x18[_0x35a6[65]](_0x35a6[70],function(_0x7438xf,_0x7438x19,_0x7438x1a){if(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)};return _0x7438x6[_0x35a6[30]](200)[_0x35a6[73]](_0x7438x19[_0x35a6[72]][_0x35a6[71]])})})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};exports[_0x35a6[74]]=function(_0x7438x5,_0x7438x6){DeskAccount[_0x35a6[53]]({where:{id:_0x7438x5[_0x35a6[12]][_0x35a6[45]]},individualHooks:true})[_0x35a6[41]](function(){return _0x7438x6[_0x35a6[44]](204)})[_0x35a6[31]](function(_0x7438xf){return handleError(_0x7438x6,_0x7438xf)})};function stripTrailingSlash(_0x7438x1d){if(_0x7438x1d[_0x35a6[75]](-1)===_0x35a6[76]){return _0x7438x1d[_0x35a6[75]](0,_0x7438x1d[_0x35a6[77]]-1)};return _0x7438x1d}function handleError(_0x7438x6,_0x7438xf){return _0x7438x6[_0x35a6[30]](500)[_0x35a6[29]](_0x7438xf)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var desk = require('desk.js'); + +var DeskAccount = require('../../models').DeskAccount; + +// Get list of desk_accounts +exports.index = function(req, res) { + var attributes = ['description', 'name', 'username', 'remoteUri']; + var per_page = req.query.per_page ? parseInt(req.query.per_page, 10) : 100; + var page = req.query.page ? parseInt(req.query.page, 10) : 0; + + var query = { + where: {}, + limit: per_page, + offset: page * per_page + }; + + _.forIn(req.query, function(value, key) { + switch (key) { + case 'per_page': + case 'page': + break; + case 'sort_by': + query.order = util.format('%s %s', req.query.sort_by, req.query.sort_order || 'ASC') || null; + break; + case 'sort_order': + break; + case '$': + query.where.$or = []; + attributes.forEach(function(attribute) { + var tmp = {}; + tmp[attribute] = { + $like: '%' + value + '%' + }; + + query.where.$or.push(tmp); + }); + break; + default: + query.where[key] = { + $like: {} + }; + query.where[key].$like = '%' + value + '%'; + } + }); + + DeskAccount + .findAndCountAll(query) + .then(function(result) { + + var total_pages = Math.ceil(result.count / per_page); + var next_page = total_pages > (query.offset + 1) ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page + 1) : null; + var previous_page = page > 0 ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page - 1) : null; + + return res.status(200).send({ + count: result.count, + rows: result.rows, + next_page: next_page, + previous_page: previous_page, + total_pages: total_pages + }); + + }) + .catch(function(err) { + return res.status(500).send({ + error: 'Something blew up!' + }); + }); +}; + +// Get a single desk_account +exports.show = function(req, res) { + DeskAccount + .findById(req.params.id) + .then(function(desk_account) { + if (!desk_account) { + return res.sendStatus(404); + } + return res.send(desk_account); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new desk_account in the DB. +exports.create = function(req, res, next) { + DeskAccount + .create(req.body) + .then(function(desk_account) { + return res.status(201).send(desk_account); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing desk_account in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + DeskAccount + .findById(req.params.id) + .then(function(desk_account) { + if (!desk_account) { + return res.sendStatus(404); + } + var updated = _.merge(desk_account, req.body); + updated.save() + .then(function() { + return res.status(200).send(desk_account); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a desk_account from the DB. +exports.destroy = function(req, res) { + DeskAccount + .findById(req.params.id) + .then(function(desk_account) { + if (!desk_account) { + return res.sendStatus(404); + } + desk_account.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.checkAccount = function(req, res) { + DeskAccount + .findById(req.params.id) + .then(function(account) { + var desk_account = { + endpoint: stripTrailingSlash(account.remoteUri), + retry: false + }; + if (account.authType === 'basic') { + desk_account.username = account.username; + desk_account.password = account.password; + } else if (account.authType === 'oauth') { + desk_account.consumerKey = account.consumerKey; + desk_account.consumerSecret = account.consumerSecret; + desk_account.token = account.token; + desk_account.tokenSecret = account.tokenSecret; + } + var client = desk.createClient(desk_account); + client.get('/api/v2/users/me', function(err, body, response) { + if (err) { + return handleError(res, err); + } + return res.sendStatus(200); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.deskValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + DeskAccount + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getFields = function(req, res) { + DeskAccount + .findById(req.params.id) + .then(function(account) { + var desk_account = { + endpoint: stripTrailingSlash(account.remoteUri), + retry: false + }; + if (account.authType === 'basic') { + desk_account.username = account.username; + desk_account.password = account.password; + } else if (account.authType === 'oauth') { + desk_account.consumerKey = account.consumerKey; + desk_account.consumerSecret = account.consumerSecret; + desk_account.token = account.token; + desk_account.tokenSecret = account.tokenSecret; + } + var client = desk.createClient(desk_account); + client.get('/api/v2/custom_fields', function(err, body, response) { + if (err) { + return handleError(res, err); + } + return res.status(200).json(body._embedded.entries); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +exports.bulkDestroy = function(req, res) { + DeskAccount + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function stripTrailingSlash(str) { + if (str.substr(-1) === '/') { + return str.substr(0, str.length - 1); + } + return str; +} + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/desk_account/desk_account.socket.js b/server/api/desk_account/desk_account.socket.js index c723273..3f7badd 100644 --- a/server/api/desk_account/desk_account.socket.js +++ b/server/api/desk_account/desk_account.socket.js @@ -1 +1,24 @@ -var _0xfb40=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x44\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xfb40[0];var DeskAccount=require(_0xfb40[2])[_0xfb40[1]];exports[_0xfb40[3]]=function(_0x9075x2){DeskAccount[_0xfb40[4]](function(_0x9075x3){onSave(_0x9075x2,_0x9075x3)});DeskAccount[_0xfb40[5]](function(_0x9075x3){onRemove(_0x9075x2,_0x9075x3)})};function onSave(_0x9075x2,_0x9075x3,_0x9075x5){_0x9075x2[_0xfb40[7]](_0xfb40[6],_0x9075x3)}function onRemove(_0x9075x2,_0x9075x3,_0x9075x5){_0x9075x2[_0xfb40[7]](_0xfb40[8],_0x9075x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var DeskAccount = require('../../models').DeskAccount; + +exports.register = function(socket) { + DeskAccount.afterCreate(function (doc) { + onSave(socket, doc); + }); + DeskAccount.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('desk_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('desk_account:remove', doc); +} diff --git a/server/api/desk_account/desk_account.spec.js b/server/api/desk_account/desk_account.spec.js index acba779..a56fc11 100644 --- a/server/api/desk_account/desk_account.spec.js +++ b/server/api/desk_account/desk_account.spec.js @@ -1 +1,20 @@ -var _0x45fc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x67\x65\x74"];_0x45fc[0];var should=require(_0x45fc[1]);var app=require(_0x45fc[2]);var request=require(_0x45fc[3]);describe(_0x45fc[4],function(){it(_0x45fc[5],function(_0xd201x4){request(app)[_0x45fc[13]](_0x45fc[12])[_0x45fc[11]](200)[_0x45fc[11]](_0x45fc[10],/json/)[_0x45fc[9]](function(_0xd201x5,_0xd201x6){if(_0xd201x5){return _0xd201x4(_0xd201x5)};_0xd201x6[_0x45fc[8]][_0x45fc[1]][_0x45fc[7]][_0x45fc[6]](Array);_0xd201x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/desk/accounts', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/desk/accounts') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/desk_account/index.js b/server/api/desk_account/index.js index 0a93455..4a593d0 100644 --- a/server/api/desk_account/index.js +++ b/server/api/desk_account/index.js @@ -1 +1,19 @@ -var _0x22bd=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x64\x65\x73\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x22bd[0];var express=require(_0x22bd[1]);var controller=require(_0x22bd[2]);var auth=require(_0x22bd[3]);var router=express.Router();router[_0x22bd[7]](_0x22bd[4],auth[_0x22bd[5]](),controller[_0x22bd[6]]);router[_0x22bd[7]](_0x22bd[8],auth[_0x22bd[5]](),controller[_0x22bd[9]]);router[_0x22bd[7]](_0x22bd[10],auth[_0x22bd[5]](),controller[_0x22bd[11]]);router[_0x22bd[7]](_0x22bd[12],auth[_0x22bd[5]](),controller[_0x22bd[13]]);router[_0x22bd[16]](_0x22bd[14],auth[_0x22bd[5]](),controller[_0x22bd[15]]);router[_0x22bd[16]](_0x22bd[4],auth[_0x22bd[5]](),controller[_0x22bd[17]]);router[_0x22bd[19]](_0x22bd[8],auth[_0x22bd[5]](),controller[_0x22bd[18]]);router[_0x22bd[20]](_0x22bd[8],auth[_0x22bd[5]](),controller[_0x22bd[18]]);router[_0x22bd[22]](_0x22bd[4],auth[_0x22bd[5]](),controller[_0x22bd[21]]);router[_0x22bd[22]](_0x22bd[8],auth[_0x22bd[5]](),controller[_0x22bd[23]]);module[_0x22bd[24]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./desk_account.controller'); +var auth = require('../../auth/auth.service'); +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/check', auth.isAuthenticated(), controller.checkAccount); +router.get('/:id/fields', auth.isAuthenticated(), controller.getFields); +router.post('/validate/:field', auth.isAuthenticated(), controller.deskValidation); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/desk_configuration/desk_configuration.controller.js b/server/api/desk_configuration/desk_configuration.controller.js index 5367d3d..3824ca1 100644 --- a/server/api/desk_configuration/desk_configuration.controller.js +++ b/server/api/desk_configuration/desk_configuration.controller.js @@ -1 +1,145 @@ -var _0xc4d5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x44\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x53\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x73\x70\x72\x65\x61\x64","\x61\x64\x64\x53\x75\x62\x6A\x65\x63\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x64\x64\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x74\x79\x70\x65"];_0xc4d5[0];var _=require(_0xc4d5[1]);var DeskConfiguration=require(_0xc4d5[3])[_0xc4d5[2]];var DeskField=require(_0xc4d5[3])[_0xc4d5[4]];function handleError(_0x85f4x5,_0x85f4x6){_0x85f4x6=_0x85f4x6||500;return function(_0x85f4x7){_0x85f4x5[_0xc4d5[6]](_0x85f4x6)[_0xc4d5[5]](_0x85f4x7)}}function responseWithResult(_0x85f4x5,_0x85f4x6){_0x85f4x6=_0x85f4x6||200;return function(_0x85f4x9){if(_0x85f4x9){_0x85f4x5[_0xc4d5[6]](_0x85f4x6)[_0xc4d5[7]](_0x85f4x9)}}}function handleEntityNotFound(_0x85f4x5){return function(_0x85f4x9){if(!_0x85f4x9){_0x85f4x5[_0xc4d5[6]](404)[_0xc4d5[8]]();return null};return _0x85f4x9}}function saveUpdates(_0x85f4xc){return function(_0x85f4x9){return _0x85f4x9[_0xc4d5[10]](_0x85f4xc)[_0xc4d5[9]](function(_0x85f4xd){return _0x85f4xd})}}function removeEntity(_0x85f4x5){return function(_0x85f4x9){if(_0x85f4x9){return _0x85f4x9[_0xc4d5[11]]()[_0xc4d5[9]](function(){_0x85f4x5[_0xc4d5[6]](204)[_0xc4d5[8]]()})}}}exports[_0xc4d5[12]]=function(_0x85f4xf,_0x85f4x5){DeskConfiguration[_0xc4d5[15]]({where:_0x85f4xf[_0xc4d5[14]]})[_0xc4d5[9]](responseWithResult(_0x85f4x5))[_0xc4d5[13]](handleError(_0x85f4x5))};exports[_0xc4d5[16]]=function(_0x85f4xf,_0x85f4x5){DeskConfiguration[_0xc4d5[22]]({where:{id:_0x85f4xf[_0xc4d5[18]][_0xc4d5[17]]},include:[{model:DeskField,as:_0xc4d5[19]},{model:DeskField,as:_0xc4d5[20]},{model:DeskField,as:_0xc4d5[21]}]})[_0xc4d5[9]](handleEntityNotFound(_0x85f4x5))[_0xc4d5[9]](responseWithResult(_0x85f4x5))[_0xc4d5[13]](handleError(_0x85f4x5))};exports[_0xc4d5[23]]=function(_0x85f4xf,_0x85f4x5){DeskConfiguration[_0xc4d5[23]](_0x85f4xf[_0xc4d5[24]])[_0xc4d5[9]](responseWithResult(_0x85f4x5,201))[_0xc4d5[13]](handleError(_0x85f4x5))};exports[_0xc4d5[25]]=function(_0x85f4xf,_0x85f4x5){if(_0x85f4xf[_0xc4d5[24]][_0xc4d5[17]]){delete _0x85f4xf[_0xc4d5[24]][_0xc4d5[17]]};DeskConfiguration[_0xc4d5[26]](_0x85f4xf[_0xc4d5[18]][_0xc4d5[17]])[_0xc4d5[9]](handleEntityNotFound(_0x85f4x5))[_0xc4d5[9]](saveUpdates(_0x85f4xf[_0xc4d5[24]]))[_0xc4d5[9]](responseWithResult(_0x85f4x5))[_0xc4d5[13]](handleError(_0x85f4x5))};exports[_0xc4d5[11]]=function(_0x85f4xf,_0x85f4x5){DeskConfiguration[_0xc4d5[26]](_0x85f4xf[_0xc4d5[18]][_0xc4d5[17]])[_0xc4d5[9]](handleEntityNotFound(_0x85f4x5))[_0xc4d5[9]](removeEntity(_0x85f4x5))[_0xc4d5[13]](handleError(_0x85f4x5))};exports[_0xc4d5[27]]=function(_0x85f4xf,_0x85f4x5,_0x85f4x10){var _0x85f4x11;DeskConfiguration[_0xc4d5[26]](_0x85f4xf[_0xc4d5[18]][_0xc4d5[17]])[_0xc4d5[9]](handleEntityNotFound(_0x85f4x5))[_0xc4d5[9]](function(_0x85f4x14){_0x85f4x11=_0x85f4x14;return DeskField[_0xc4d5[23]](_0x85f4xf[_0xc4d5[24]])})[_0xc4d5[9]](function(_0x85f4x13){switch(_0x85f4xf[_0xc4d5[18]][_0xc4d5[35]]){case _0xc4d5[30]:return [_0x85f4x11[_0xc4d5[29]](_0x85f4x13),_0x85f4x13];case _0xc4d5[32]:return [_0x85f4x11[_0xc4d5[31]](_0x85f4x13),_0x85f4x13];case _0xc4d5[34]:return [_0x85f4x11[_0xc4d5[33]](_0x85f4x13),_0x85f4x13]}})[_0xc4d5[28]](function(_0x85f4x12,_0x85f4x13){return _0x85f4x5[_0xc4d5[6]](201)[_0xc4d5[7]](_0x85f4x13)})[_0xc4d5[13]](handleError(_0x85f4x5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/desk/configurations -> index + * POST /api/desk/configurations -> create + * GET /api/desk/configurations/:id -> show + * PUT /api/desk/configurations/:id -> update + * DELETE /api/desk/configurations/:id -> destroy + */ + +'use strict'; + +var _ = require('lodash'); + +var DeskConfiguration = require('../../models').DeskConfiguration; +var DeskField = require('../../models').DeskField; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of DeskConfigurations +exports.index = function(req, res) { + DeskConfiguration.findAll({ + where: req.query + }) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single DeskConfiguration from the DB +exports.show = function(req, res) { + DeskConfiguration.find({ + where: { + id: req.params.id + }, + include: [{ + model: DeskField, + as: 'Subject' + }, { + model: DeskField, + as: 'Description' + }, { + model: DeskField, + as: 'Field' + }] + }) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new DeskConfiguration in the DB +exports.create = function(req, res) { + DeskConfiguration.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing DeskConfiguration in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + DeskConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a DeskConfiguration from the DB +exports.destroy = function(req, res) { + DeskConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.addConfigurationField = function(req, res, next) { + // console.log(req.params); + var deskConfiguration; + DeskConfiguration + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(desk_configuration) { + deskConfiguration = desk_configuration; + return DeskField.create(req.body) + }) + .then(function(deskField) { + switch (req.params.type) { + case 'subject': + return [deskConfiguration.addSubject(deskField), deskField]; + case 'description': + return [deskConfiguration.addDescription(deskField), deskField]; + case 'field': + return [deskConfiguration.addField(deskField), deskField]; + } + }) + .spread(function(data, deskField) { + return res.status(201).json(deskField); + }) + .catch(handleError(res)); +}; diff --git a/server/api/desk_configuration/desk_configuration.socket.js b/server/api/desk_configuration/desk_configuration.socket.js index 3a34d03..d26e4f6 100644 --- a/server/api/desk_configuration/desk_configuration.socket.js +++ b/server/api/desk_configuration/desk_configuration.socket.js @@ -1 +1,24 @@ -var _0x3ac8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x44\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x3ac8[0];var DeskConfiguration=require(_0x3ac8[2])[_0x3ac8[1]];exports[_0x3ac8[3]]=function(_0xcb1fx2){DeskConfiguration[_0x3ac8[4]](function(_0xcb1fx3){onSave(_0xcb1fx2,_0xcb1fx3)});DeskConfiguration[_0x3ac8[5]](function(_0xcb1fx3){onRemove(_0xcb1fx2,_0xcb1fx3)})};function onSave(_0xcb1fx2,_0xcb1fx3,_0xcb1fx5){_0xcb1fx2[_0x3ac8[7]](_0x3ac8[6],_0xcb1fx3)}function onRemove(_0xcb1fx2,_0xcb1fx3,_0xcb1fx5){_0xcb1fx2[_0x3ac8[7]](_0x3ac8[8],_0xcb1fx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var DeskConfiguration = require('../../models').DeskConfiguration; + +exports.register = function(socket) { + DeskConfiguration.afterCreate(function(doc) { + onSave(socket, doc); + }); + DeskConfiguration.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('desk_configuration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('desk_configuration:remove', doc); +} diff --git a/server/api/desk_configuration/index.js b/server/api/desk_configuration/index.js index 719acd1..91adaf0 100644 --- a/server/api/desk_configuration/index.js +++ b/server/api/desk_configuration/index.js @@ -1 +1,19 @@ -var _0xb7db=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x3A\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xb7db[0];var express=require(_0xb7db[1]);var auth=require(_0xb7db[2]);var controller=require(_0xb7db[3]);var router=express.Router();router[_0xb7db[7]](_0xb7db[4],auth[_0xb7db[5]](),controller[_0xb7db[6]]);router[_0xb7db[7]](_0xb7db[8],auth[_0xb7db[5]](),controller[_0xb7db[9]]);router[_0xb7db[11]](_0xb7db[4],auth[_0xb7db[5]](),controller[_0xb7db[10]]);router[_0xb7db[13]](_0xb7db[8],auth[_0xb7db[5]](),controller[_0xb7db[12]]);router[_0xb7db[11]](_0xb7db[14],auth[_0xb7db[5]](),controller[_0xb7db[15]]);router[_0xb7db[16]](_0xb7db[8],auth[_0xb7db[5]](),controller[_0xb7db[12]]);router[_0xb7db[18]](_0xb7db[8],auth[_0xb7db[5]](),controller[_0xb7db[17]]);module[_0xb7db[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./desk_configuration.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/:id/:type', auth.isAuthenticated(), controller.addConfigurationField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/desk_configuration/index.spec.js b/server/api/desk_configuration/index.spec.js index a99767d..fd6b650 100644 --- a/server/api/desk_configuration/index.spec.js +++ b/server/api/desk_configuration/index.spec.js @@ -1 +1,97 @@ -var _0xd309=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x44\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0xd309[0];var proxyquire=require(_0xd309[2])[_0xd309[1]]();var deskConfigurationCtrlStub={index:_0xd309[3],show:_0xd309[4],create:_0xd309[5],update:_0xd309[6],destroy:_0xd309[7]};var routerStub={get:sinon[_0xd309[8]](),put:sinon[_0xd309[8]](),patch:sinon[_0xd309[8]](),post:sinon[_0xd309[8]](),delete:sinon[_0xd309[8]]()};var deskConfigurationIndex=proxyquire(_0xd309[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":deskConfigurationCtrlStub});describe(_0xd309[10],function(){it(_0xd309[11],function(){expect(deskConfigurationIndex)[_0xd309[13]][_0xd309[12]](routerStub)});describe(_0xd309[14],function(){it(_0xd309[15],function(){expect(routerStub[_0xd309[21]][_0xd309[20]](_0xd309[19],_0xd309[3]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})});describe(_0xd309[22],function(){it(_0xd309[23],function(){expect(routerStub[_0xd309[21]][_0xd309[20]](_0xd309[24],_0xd309[4]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})});describe(_0xd309[25],function(){it(_0xd309[26],function(){expect(routerStub[_0xd309[27]][_0xd309[20]](_0xd309[19],_0xd309[5]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})});describe(_0xd309[28],function(){it(_0xd309[29],function(){expect(routerStub[_0xd309[30]][_0xd309[20]](_0xd309[24],_0xd309[6]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})});describe(_0xd309[31],function(){it(_0xd309[29],function(){expect(routerStub[_0xd309[32]][_0xd309[20]](_0xd309[24],_0xd309[6]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})});describe(_0xd309[33],function(){it(_0xd309[34],function(){expect(routerStub[_0xd309[35]][_0xd309[20]](_0xd309[24],_0xd309[7]))[_0xd309[13]][_0xd309[18]][_0xd309[17]][_0xd309[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var deskConfigurationCtrlStub = { + index: 'deskConfigurationCtrl.index', + show: 'deskConfigurationCtrl.show', + create: 'deskConfigurationCtrl.create', + update: 'deskConfigurationCtrl.update', + destroy: 'deskConfigurationCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var deskConfigurationIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './desk_configuration.controller': deskConfigurationCtrlStub +}); + +describe('DeskConfiguration API Router:', function() { + + it('should return an express router instance', function() { + expect(deskConfigurationIndex).to.equal(routerStub); + }); + + describe('GET /api/desk/configurations', function() { + + it('should route to deskConfiguration.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'deskConfigurationCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/desk/configurations/:id', function() { + + it('should route to deskConfiguration.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'deskConfigurationCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/desk/configurations', function() { + + it('should route to deskConfiguration.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'deskConfigurationCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/desk/configurations/:id', function() { + + it('should route to deskConfiguration.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'deskConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/desk/configurations/:id', function() { + + it('should route to deskConfiguration.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'deskConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/desk/configurations/:id', function() { + + it('should route to deskConfiguration.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'deskConfigurationCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/desk_field/desk_field.controller.js b/server/api/desk_field/desk_field.controller.js index 57808e7..6b39f83 100644 --- a/server/api/desk_field/desk_field.controller.js +++ b/server/api/desk_field/desk_field.controller.js @@ -1 +1,104 @@ -var _0x2ad0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x2ad0[0];var _=require(_0x2ad0[1]);var DeskField=require(_0x2ad0[3])[_0x2ad0[2]];function handleError(_0x7280x4,_0x7280x5){_0x7280x5=_0x7280x5||500;return function(_0x7280x6){_0x7280x4[_0x2ad0[5]](_0x7280x5)[_0x2ad0[4]](_0x7280x6)}}function responseWithResult(_0x7280x4,_0x7280x5){_0x7280x5=_0x7280x5||200;return function(_0x7280x8){if(_0x7280x8){_0x7280x4[_0x2ad0[5]](_0x7280x5)[_0x2ad0[6]](_0x7280x8)}}}function handleEntityNotFound(_0x7280x4){return function(_0x7280x8){if(!_0x7280x8){_0x7280x4[_0x2ad0[5]](404)[_0x2ad0[7]]();return null};return _0x7280x8}}function saveUpdates(_0x7280xb){return function(_0x7280x8){return _0x7280x8[_0x2ad0[9]](_0x7280xb)[_0x2ad0[8]](function(_0x7280xc){return _0x7280xc})}}function removeEntity(_0x7280x4){return function(_0x7280x8){if(_0x7280x8){return _0x7280x8[_0x2ad0[10]]()[_0x2ad0[8]](function(){_0x7280x4[_0x2ad0[5]](204)[_0x2ad0[7]]()})}}}exports[_0x2ad0[11]]=function(_0x7280xe,_0x7280x4){DeskField[_0x2ad0[13]]()[_0x2ad0[8]](responseWithResult(_0x7280x4))[_0x2ad0[12]](handleError(_0x7280x4))};exports[_0x2ad0[14]]=function(_0x7280xe,_0x7280x4){DeskField[_0x2ad0[17]](_0x7280xe[_0x2ad0[16]][_0x2ad0[15]])[_0x2ad0[8]](handleEntityNotFound(_0x7280x4))[_0x2ad0[8]](responseWithResult(_0x7280x4))[_0x2ad0[12]](handleError(_0x7280x4))};exports[_0x2ad0[18]]=function(_0x7280xe,_0x7280x4){DeskField[_0x2ad0[18]](_0x7280xe[_0x2ad0[19]])[_0x2ad0[8]](responseWithResult(_0x7280x4,201))[_0x2ad0[12]](handleError(_0x7280x4))};exports[_0x2ad0[20]]=function(_0x7280xe,_0x7280x4){if(_0x7280xe[_0x2ad0[19]][_0x2ad0[15]]){delete _0x7280xe[_0x2ad0[19]][_0x2ad0[15]]};DeskField[_0x2ad0[17]](_0x7280xe[_0x2ad0[16]][_0x2ad0[15]])[_0x2ad0[8]](handleEntityNotFound(_0x7280x4))[_0x2ad0[8]](saveUpdates(_0x7280xe[_0x2ad0[19]]))[_0x2ad0[8]](responseWithResult(_0x7280x4))[_0x2ad0[12]](handleError(_0x7280x4))};exports[_0x2ad0[10]]=function(_0x7280xe,_0x7280x4){DeskField[_0x2ad0[17]](_0x7280xe[_0x2ad0[16]][_0x2ad0[15]])[_0x2ad0[8]](handleEntityNotFound(_0x7280x4))[_0x2ad0[8]](removeEntity(_0x7280x4))[_0x2ad0[12]](handleError(_0x7280x4))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/desk/fields -> index + * POST /api/desk/fields -> create + * GET /api/desk/fields/:id -> show + * PUT /api/desk/fields/:id -> update + * DELETE /api/desk/fields/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var DeskField = require('../../models').DeskField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of DeskFields +exports.index = function(req, res) { + DeskField.findAll() + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single DeskField from the DB +exports.show = function(req, res) { + DeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new DeskField in the DB +exports.create = function(req, res) { + DeskField.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing DeskField in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + DeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a DeskField from the DB +exports.destroy = function(req, res) { + DeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/desk_field/desk_field.socket.js b/server/api/desk_field/desk_field.socket.js index bd62d16..b01d8f1 100644 --- a/server/api/desk_field/desk_field.socket.js +++ b/server/api/desk_field/desk_field.socket.js @@ -1 +1,24 @@ -var _0x37fe=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0x37fe[0];var DeskField=require(_0x37fe[2])[_0x37fe[1]];exports[_0x37fe[3]]=function(_0x4c2ex2){DeskField[_0x37fe[4]](function(_0x4c2ex3){onSave(_0x4c2ex2,_0x4c2ex3)});DeskField[_0x37fe[5]](function(_0x4c2ex3){onRemove(_0x4c2ex2,_0x4c2ex3)})};function onSave(_0x4c2ex2,_0x4c2ex3,_0x4c2ex5){_0x4c2ex2[_0x37fe[7]](_0x37fe[6],_0x4c2ex3)}function onRemove(_0x4c2ex2,_0x4c2ex3,_0x4c2ex5){_0x4c2ex2[_0x37fe[7]](_0x37fe[8],_0x4c2ex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var DeskField = require('../../models').DeskField; + +exports.register = function(socket) { + DeskField.afterCreate(function(doc) { + onSave(socket, doc); + }); + DeskField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('desk_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('desk_field:remove', doc); +} diff --git a/server/api/desk_field/index.js b/server/api/desk_field/index.js index fe6988e..266676c 100644 --- a/server/api/desk_field/index.js +++ b/server/api/desk_field/index.js @@ -1 +1,18 @@ -var _0xb2fb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xb2fb[0];var express=require(_0xb2fb[1]);var auth=require(_0xb2fb[2]);var controller=require(_0xb2fb[3]);var router=express.Router();router[_0xb2fb[7]](_0xb2fb[4],auth[_0xb2fb[5]](),controller[_0xb2fb[6]]);router[_0xb2fb[7]](_0xb2fb[8],auth[_0xb2fb[5]](),controller[_0xb2fb[9]]);router[_0xb2fb[11]](_0xb2fb[4],auth[_0xb2fb[5]](),controller[_0xb2fb[10]]);router[_0xb2fb[13]](_0xb2fb[8],auth[_0xb2fb[5]](),controller[_0xb2fb[12]]);router[_0xb2fb[14]](_0xb2fb[8],auth[_0xb2fb[5]](),controller[_0xb2fb[12]]);router[_0xb2fb[16]](_0xb2fb[8],auth[_0xb2fb[5]](),controller[_0xb2fb[15]]);module[_0xb2fb[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./desk_field.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/desk_field/index.spec.js b/server/api/desk_field/index.spec.js index c6c5c44..fef888c 100644 --- a/server/api/desk_field/index.spec.js +++ b/server/api/desk_field/index.spec.js @@ -1 +1,97 @@ -var _0x985e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x985e[0];var proxyquire=require(_0x985e[2])[_0x985e[1]]();var deskFieldCtrlStub={index:_0x985e[3],show:_0x985e[4],create:_0x985e[5],update:_0x985e[6],destroy:_0x985e[7]};var routerStub={get:sinon[_0x985e[8]](),put:sinon[_0x985e[8]](),patch:sinon[_0x985e[8]](),post:sinon[_0x985e[8]](),delete:sinon[_0x985e[8]]()};var deskFieldIndex=proxyquire(_0x985e[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":deskFieldCtrlStub});describe(_0x985e[10],function(){it(_0x985e[11],function(){expect(deskFieldIndex)[_0x985e[13]][_0x985e[12]](routerStub)});describe(_0x985e[14],function(){it(_0x985e[15],function(){expect(routerStub[_0x985e[21]][_0x985e[20]](_0x985e[19],_0x985e[3]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})});describe(_0x985e[22],function(){it(_0x985e[23],function(){expect(routerStub[_0x985e[21]][_0x985e[20]](_0x985e[24],_0x985e[4]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})});describe(_0x985e[25],function(){it(_0x985e[26],function(){expect(routerStub[_0x985e[27]][_0x985e[20]](_0x985e[19],_0x985e[5]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})});describe(_0x985e[28],function(){it(_0x985e[29],function(){expect(routerStub[_0x985e[30]][_0x985e[20]](_0x985e[24],_0x985e[6]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})});describe(_0x985e[31],function(){it(_0x985e[29],function(){expect(routerStub[_0x985e[32]][_0x985e[20]](_0x985e[24],_0x985e[6]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})});describe(_0x985e[33],function(){it(_0x985e[34],function(){expect(routerStub[_0x985e[35]][_0x985e[20]](_0x985e[24],_0x985e[7]))[_0x985e[13]][_0x985e[18]][_0x985e[17]][_0x985e[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var deskFieldCtrlStub = { + index: 'deskFieldCtrl.index', + show: 'deskFieldCtrl.show', + create: 'deskFieldCtrl.create', + update: 'deskFieldCtrl.update', + destroy: 'deskFieldCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var deskFieldIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './desk_field.controller': deskFieldCtrlStub +}); + +describe('DeskField API Router:', function() { + + it('should return an express router instance', function() { + expect(deskFieldIndex).to.equal(routerStub); + }); + + describe('GET /api/desk/fields', function() { + + it('should route to deskField.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'deskFieldCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/desk/fields/:id', function() { + + it('should route to deskField.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'deskFieldCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/desk/fields', function() { + + it('should route to deskField.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'deskFieldCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/desk/fields/:id', function() { + + it('should route to deskField.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'deskFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/desk/fields/:id', function() { + + it('should route to deskField.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'deskFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/desk/fields/:id', function() { + + it('should route to deskField.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'deskFieldCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/extracted_report/extracted_report.controller.js b/server/api/extracted_report/extracted_report.controller.js index 165a970..3d57d37 100644 --- a/server/api/extracted_report/extracted_report.controller.js +++ b/server/api/extracted_report/extracted_report.controller.js @@ -1 +1,197 @@ -var _0x155e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x6D\x6F\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x66\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x6C\x6F\x67","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x72\x65\x70\x6F\x72\x74\x73","\x73\x61\x76\x65\x6E\x61\x6D\x65","\x6A\x6F\x69\x6E","\x65\x6E\x63\x6F\x64\x65","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x74\x72\x6F\x79","\x52\x5F\x4F\x4B","\x57\x5F\x4F\x4B","\x46\x69\x6C\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x20\x6F\x72\x20\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E\x20\x6E\x6F\x74\x20\x70\x65\x72\x6D\x69\x74\x74\x65\x64","\x65\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x20\x64\x65\x6C\x65\x74\x69\x6E\x67\x20\x66\x69\x6C\x65\x20\x3A","\x66\x69\x6C\x65\x20\x64\x65\x6C\x65\x74\x65\x64","\x75\x6E\x6C\x69\x6E\x6B","\x61\x63\x63\x65\x73\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x66\x6F\x72\x45\x61\x63\x68","\x69\x64\x73"];_0x155e[0];var _=require(_0x155e[1]);var ExtractedReport=require(_0x155e[3])[_0x155e[2]];var util=require(_0x155e[4]);var path=require(_0x155e[5]);var moment=require(_0x155e[6]);var config=require(_0x155e[7]);var base64=require(_0x155e[8]);var fs=require(_0x155e[9]);var Util=require(_0x155e[10]);exports[_0x155e[11]]=function(_0x9292xa,_0x9292xb,_0x9292xc){return ExtractedReport[_0x155e[18]](Util[_0x155e[17]](_0x9292xa[_0x155e[16]]))[_0x155e[15]](function(_0x9292xe){_0x9292xb[_0x155e[14]](200)[_0x155e[13]](_0x9292xe)})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[19]]=function(_0x9292xa,_0x9292xb){ExtractedReport[_0x155e[23]](_0x9292xa[_0x155e[22]][_0x155e[21]])[_0x155e[15]](function(_0x9292xf){if(!_0x9292xf){return _0x9292xb[_0x155e[20]](404)};return _0x9292xb[_0x155e[13]](_0x9292xf)})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[24]]=function(_0x9292xa,_0x9292xb){ExtractedReport[_0x155e[23]](_0x9292xa[_0x155e[22]][_0x155e[21]])[_0x155e[15]](function(_0x9292x10){if(!_0x9292x10){return _0x9292xb[_0x155e[14]](404)[_0x155e[13]](_0x9292x10)};var _0x9292x11=path[_0x155e[31]](config[_0x155e[26]],_0x155e[27],_0x155e[28],_0x155e[29],_0x9292x10[_0x155e[30]]);base64[_0x155e[32]](_0x9292x11,function(_0x9292xd,_0x9292x12){if(_0x9292xd){console[_0x155e[25]](_0x9292xd);return handleError(_0x9292xb,_0x9292xd)}else {return _0x9292xb[_0x155e[14]](200)[_0x155e[13]]({downloadString:_0x9292x12})}})})[_0x155e[12]](function(_0x9292xd){console[_0x155e[25]](_0x9292xd);return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[33]]=function(_0x9292xa,_0x9292xb){ExtractedReport[_0x155e[33]](_0x9292xa[_0x155e[34]])[_0x155e[15]](function(_0x9292xf){return _0x9292xb[_0x155e[14]](201)[_0x155e[13]](_0x9292xf)})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[35]]=function(_0x9292xa,_0x9292xb){ExtractedReport[_0x155e[39]]({where:{name:_0x9292xa[_0x155e[34]][_0x155e[38]],id:{$ne:_0x9292xa[_0x155e[34]][_0x155e[21]]}}})[_0x155e[15]](function(_0x9292x13){if(!_0x9292x13){return _0x9292xb[_0x155e[20]](404)};if(_0x9292xa[_0x155e[34]][_0x155e[21]]){delete _0x9292xa[_0x155e[34]][_0x155e[21]]};ExtractedReport[_0x155e[23]](_0x9292xa[_0x155e[22]][_0x155e[21]])[_0x155e[15]](function(_0x9292xf){if(!_0x9292xf){return _0x9292xb[_0x155e[20]](404)};var _0x9292x14=_[_0x155e[36]](_0x9292xf,_0x9292xa[_0x155e[34]]);_0x9292x14[_0x155e[37]]()[_0x155e[15]](function(){return _0x9292xb[_0x155e[14]](200)[_0x155e[13]](_0x9292xf)})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[40]]=function(_0x9292xa,_0x9292xb){var _0x9292x15;ExtractedReport[_0x155e[23]](_0x9292xa[_0x155e[22]][_0x155e[21]])[_0x155e[15]](function(_0x9292xf){_0x9292x15=_0x9292xf;if(!_0x9292xf){return _0x9292xb[_0x155e[20]](404)};return _0x9292xf[_0x155e[40]]()})[_0x155e[15]](function(){if(_0x9292x15[_0x155e[30]]){var _0x9292x11=path[_0x155e[31]](config[_0x155e[26]],_0x155e[27],_0x155e[28],_0x155e[29],_0x9292x15[_0x155e[30]]);fs[_0x155e[48]](_0x9292x11,fs[_0x155e[41]]|fs[_0x155e[42]],function(_0x9292xd){if(_0x9292xd){console[_0x155e[44]](_0x155e[43])}else {fs[_0x155e[47]](_0x9292x11,function(_0x9292xd){if(_0x9292xd){console[_0x155e[44]](_0x155e[45],_0x9292xd)}else {console[_0x155e[25]](_0x155e[46])}})}})};return _0x9292xb[_0x155e[20]](204)})[_0x155e[12]](function(_0x9292xd){console[_0x155e[25]](_0x9292xd);return handleError(_0x9292xb,_0x9292xd)})};exports[_0x155e[49]]=function(_0x9292xa,_0x9292xb){ExtractedReport[_0x155e[39]]({where:{id:_0x9292xa[_0x155e[16]][_0x155e[51]]}})[_0x155e[15]](function(_0x9292x16){_0x9292x16[_0x155e[50]](function(_0x9292xf){_0x9292xf[_0x155e[40]]()[_0x155e[15]](function(){if(_0x9292xf[_0x155e[30]]){var _0x9292x11=path[_0x155e[31]](config[_0x155e[26]],_0x155e[27],_0x155e[28],_0x155e[29],_0x9292xf[_0x155e[30]]);fs[_0x155e[48]](_0x9292x11,fs[_0x155e[41]]|fs[_0x155e[42]],function(_0x9292xd){if(_0x9292xd){console[_0x155e[44]](_0x155e[43])}else {fs[_0x155e[47]](_0x9292x11,function(_0x9292xd){if(_0x9292xd){console[_0x155e[44]](_0x155e[45],_0x9292xd)}else {console[_0x155e[25]](_0x155e[46])}})}})}})[_0x155e[12]](function(_0x9292xd){console[_0x155e[25]](_0x9292xd)})});return _0x9292xb[_0x155e[20]](204)})[_0x155e[12]](function(_0x9292xd){return handleError(_0x9292xb,_0x9292xd)})};function handleError(_0x9292xb,_0x9292xd){return _0x9292xb[_0x155e[14]](500)[_0x155e[13]](_0x9292xd)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ExtractedReport = require('../../models').ExtractedReport; +var util = require('util'); +var path = require('path'); +var moment = require('moment'); +var config = require('../../config/environment'); +var base64 = require('file-base64'); +var fs = require('fs'); +var Util = require('../../config/util'); + +// Get list of extracted_reports +exports.index = function(req, res, next) { + return ExtractedReport + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single extracted_reports +exports.show = function(req, res) { + ExtractedReport + .findById(req.params.id) + .then(function(extracted) { + if (!extracted) { + return res.sendStatus(404); + } + return res.send(extracted); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.download = function(req, res) { + ExtractedReport + .findById(req.params.id) + .then(function(extract) { + if (!extract) { + return res.status(404).send(extract); + } + var filepath = path.join(config.root, 'server', 'files', 'reports', extract.savename); + base64.encode(filepath, function(err, base64String) { + if (err) { + console.log(err); + return handleError(res, err); + } else { + return res.status(200).send({ + downloadString: base64String + }); + } + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Creates a new extracted_report in the DB. +exports.create = function(req, res) { + ExtractedReport + .create(req.body) + .then(function(extracted) { + return res.status(201).send(extracted); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing extracted_report in the DB. +exports.update = function(req, res) { + ExtractedReport + .findAll({ + where: { + name: req.body.name, + id: { + $ne: req.body.id + } + } + }) + .then(function(extracted_reports) { + if (!extracted_reports) { + return res.sendStatus(404); + } + if (req.body.id) { + delete req.body.id; + } + ExtractedReport + .findById(req.params.id) + .then(function(extracted) { + if (!extracted) { + return res.sendStatus(404); + } + var updated = _.merge(extracted, req.body); + updated.save() + .then(function() { + return res.status(200).send(extracted); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes an extracted_report from the DB. +exports.destroy = function(req, res) { + var _extracted; + ExtractedReport + .findById(req.params.id) + .then(function(extracted) { + _extracted = extracted; + if (!extracted) { + return res.sendStatus(404); + } + return extracted.destroy(); + }) + .then(function() { + if (_extracted.savename) { + var filepath = path.join(config.root, 'server', 'files', 'reports', _extracted.savename); + fs.access(filepath, fs.R_OK | fs.W_OK, function(err) { + if (err) { + console.error('File does not exist or operation not permitted'); + } else { + fs.unlink(filepath, function(err) { + if (err) { + console.error('error deleting file :', err); + } else { + console.log('file deleted'); + } + }) + } + }); + } + return res.sendStatus(204); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + ExtractedReport + .findAll({ + where: { + id: req.query.ids + } + }) + .then(function(extracts) { + extracts.forEach(function(extracted) { + extracted.destroy() + .then(function() { + if (extracted.savename) { + var filepath = path.join(config.root, 'server', 'files', 'reports', extracted.savename); + fs.access(filepath, fs.R_OK | fs.W_OK, function(err) { + if (err) { + console.error('File does not exist or operation not permitted'); + } else { + fs.unlink(filepath, function(err) { + if (err) { + console.error('error deleting file :', err); + } else { + console.log('file deleted'); + } + }) + } + }); + } + }) + .catch(function(err) { + console.log(err); + }); + }); + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/extracted_report/extracted_report.socket.js b/server/api/extracted_report/extracted_report.socket.js index 36143b3..faf3482 100644 --- a/server/api/extracted_report/extracted_report.socket.js +++ b/server/api/extracted_report/extracted_report.socket.js @@ -1 +1,24 @@ -var _0x7760=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7760[0];var ExtractedReport=require(_0x7760[2])[_0x7760[1]];exports[_0x7760[3]]=function(_0x7d9ex2){ExtractedReport[_0x7760[4]](function(_0x7d9ex3){onSave(_0x7d9ex2,_0x7d9ex3)});ExtractedReport[_0x7760[5]](function(_0x7d9ex3){onRemove(_0x7d9ex2,_0x7d9ex3)})};function onSave(_0x7d9ex2,_0x7d9ex3,_0x7d9ex5){_0x7d9ex2[_0x7760[7]](_0x7760[6],_0x7d9ex3)}function onRemove(_0x7d9ex2,_0x7d9ex3,_0x7d9ex5){_0x7d9ex2[_0x7760[7]](_0x7760[8],_0x7d9ex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ExtractedReport = require('../../models').ExtractedReport; + +exports.register = function(socket) { + ExtractedReport.afterCreate(function(doc) { + onSave(socket, doc); + }); + ExtractedReport.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('extracted_report:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('extracted_report:remove', doc); +} diff --git a/server/api/extracted_report/extracted_report.spec.js b/server/api/extracted_report/extracted_report.spec.js index d82b009..0830865 100644 --- a/server/api/extracted_report/extracted_report.spec.js +++ b/server/api/extracted_report/extracted_report.spec.js @@ -1 +1,20 @@ -var _0x6df1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64","\x67\x65\x74"];_0x6df1[0];var should=require(_0x6df1[1]);var app=require(_0x6df1[2]);var request=require(_0x6df1[3]);describe(_0x6df1[4],function(){it(_0x6df1[5],function(_0x2c69x4){request(app)[_0x6df1[13]](_0x6df1[12])[_0x6df1[11]](200)[_0x6df1[11]](_0x6df1[10],/json/)[_0x6df1[9]](function(_0x2c69x5,_0x2c69x6){if(_0x2c69x5){return _0x2c69x4(_0x2c69x5)};_0x2c69x6[_0x6df1[8]][_0x6df1[1]][_0x6df1[7]][_0x6df1[6]](Array);_0x2c69x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/analytics/extracted', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/analytics/extracted') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/extracted_report/index.js b/server/api/extracted_report/index.js index 2418f60..21b8e1c 100644 --- a/server/api/extracted_report/index.js +++ b/server/api/extracted_report/index.js @@ -1 +1,18 @@ -var _0x53c7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x53c7[0];var express=require(_0x53c7[1]);var controller=require(_0x53c7[2]);var auth=require(_0x53c7[3]);var router=express.Router();router[_0x53c7[7]](_0x53c7[4],auth[_0x53c7[5]](),controller[_0x53c7[6]]);router[_0x53c7[7]](_0x53c7[8],auth[_0x53c7[5]](),controller[_0x53c7[9]]);router[_0x53c7[7]](_0x53c7[10],auth[_0x53c7[5]](),controller[_0x53c7[11]]);router[_0x53c7[13]](_0x53c7[4],auth[_0x53c7[5]](),controller[_0x53c7[12]]);router[_0x53c7[15]](_0x53c7[10],auth[_0x53c7[5]](),controller[_0x53c7[14]]);router[_0x53c7[16]](_0x53c7[10],auth[_0x53c7[5]](),controller[_0x53c7[14]]);router[_0x53c7[18]](_0x53c7[4],auth[_0x53c7[5]](),controller[_0x53c7[17]]);router[_0x53c7[18]](_0x53c7[10],auth[_0x53c7[5]](),controller[_0x53c7[19]]);module[_0x53c7[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./extracted_report.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id/download', auth.isAuthenticated(), controller.download); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/fax_account/fax_account.controller.js b/server/api/fax_account/fax_account.controller.js index 7b00e78..d550303 100644 --- a/server/api/fax_account/fax_account.controller.js +++ b/server/api/fax_account/fax_account.controller.js @@ -1 +1,374 @@ -var _0x7a69=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x54\x72\x75\x6E\x6B","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x69\x6E\x64\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x70\x68\x6F\x6E\x65","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x6F\x6E\x74\x65\x78\x74","\x47\x6F\x74\x6F","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78\x2C\x73\x2C\x31","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x6C\x6F\x67","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x6F\x6B","\x63\x6F\x6D\x6D\x69\x74","\x77\x61\x74\x65\x72\x66\x61\x6C\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x76\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20\x65\x64\x69\x74\x65\x64","\x55\x73\x65\x72\x49\x64","\x6D\x65\x72\x67\x65","\x66\x61\x78\x41\x63\x63\x6F\x75\x6E\x74\x20\x73\x61\x76\x65\x64","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x61\x64\x64\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6C\x65\x6E\x67\x74\x68","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x70\x72\x69\x6F\x72\x69\x74\x79","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x7a69[0];var _=require(_0x7a69[1]);var util=require(_0x7a69[2]);var async=require(_0x7a69[3]);var Trunk=require(_0x7a69[5])[_0x7a69[4]];var FaxAccount=require(_0x7a69[5])[_0x7a69[6]];var FaxApplication=require(_0x7a69[5])[_0x7a69[7]];var VoiceExtension=require(_0x7a69[5])[_0x7a69[8]];var sequelize=require(_0x7a69[5])[_0x7a69[9]];exports[_0x7a69[10]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){var _0xef6exc=[_0x7a69[11],_0x7a69[12],_0x7a69[13]];var _0xef6exd=_0xef6ex9[_0x7a69[15]][_0x7a69[14]]?parseInt(_0xef6ex9[_0x7a69[15]][_0x7a69[14]],10):100;var _0xef6exe=_0xef6ex9[_0x7a69[15]][_0x7a69[16]]?parseInt(_0xef6ex9[_0x7a69[15]][_0x7a69[16]],10):0;var _0xef6exf={where:{},limit:_0xef6exd,offset:_0xef6exe*_0xef6exd};_[_0x7a69[30]](_0xef6ex9[_0x7a69[15]],function(_0xef6ex10,_0xef6ex11){switch(_0xef6ex11){case _0x7a69[14]:;case _0x7a69[16]:break;case _0x7a69[19]:_0xef6exf[_0x7a69[17]]=util[_0x7a69[22]](_0x7a69[18],_0xef6ex9[_0x7a69[15]][_0x7a69[19]],_0xef6ex9[_0x7a69[15]][_0x7a69[20]]||_0x7a69[21])||null;break;case _0x7a69[20]:break;case _0x7a69[28]:_0xef6exf[_0x7a69[24]][_0x7a69[23]]=[];_0xef6exc[_0x7a69[27]](function(_0xef6ex12){var _0xef6ex13={};_0xef6ex13[_0xef6ex12]={$like:_0x7a69[25]+_0xef6ex10+_0x7a69[25]};_0xef6exf[_0x7a69[24]][_0x7a69[23]][_0x7a69[26]](_0xef6ex13)});break;default:_0xef6exf[_0x7a69[24]][_0xef6ex11]={$like:{}};_0xef6exf[_0x7a69[24]][_0xef6ex11][_0x7a69[29]]=_0x7a69[25]+_0xef6ex10+_0x7a69[25]}});FaxAccount[_0x7a69[45]](_0xef6exf)[_0x7a69[44]](function(_0xef6ex15){var _0xef6ex16=Math[_0x7a69[36]](_0xef6ex15[_0x7a69[35]]/_0xef6exd);var _0xef6ex17=_0xef6ex16>(_0xef6exf[_0x7a69[37]]+1)?util[_0x7a69[22]](_0x7a69[38],_0xef6ex9[_0x7a69[39]],_0xef6ex9[_0x7a69[41]][_0x7a69[40]],_0xef6ex9[_0x7a69[42]],_0xef6exe+1):null;var _0xef6ex18=_0xef6exe>0?util[_0x7a69[22]](_0x7a69[38],_0xef6ex9[_0x7a69[39]],_0xef6ex9[_0x7a69[41]][_0x7a69[40]],_0xef6ex9[_0x7a69[42]],_0xef6exe-1):null;_0xef6exa[_0x7a69[33]](200)[_0x7a69[32]]({count:_0xef6ex15[_0x7a69[35]],rows:_0xef6ex15[_0x7a69[43]],next_page:_0xef6ex17,previous_page:_0xef6ex18,total_pages:_0xef6ex16})})[_0x7a69[34]](function(_0xef6ex14){_0xef6exa[_0x7a69[33]](500)[_0x7a69[32]]({error:_0x7a69[31]})})};exports[_0x7a69[46]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){FaxAccount[_0x7a69[50]](_0xef6ex9[_0x7a69[49]][_0x7a69[48]])[_0x7a69[44]](function(_0xef6ex19){if(!_0xef6ex19){return _0xef6exa[_0x7a69[47]](404)};return _0xef6exa[_0x7a69[32]](_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){return _0xef6exb(_0xef6ex14)})};exports[_0x7a69[51]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){return sequelize[_0x7a69[62]]()[_0x7a69[44]](function(_0xef6ex1a){async[_0x7a69[61]]([function(_0xef6ex1b){return FaxAccount[_0x7a69[51]](_0xef6ex9[_0x7a69[52]],{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex19){_0xef6ex1b(null,_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})},function(_0xef6ex19,_0xef6ex1b){return Trunk[_0x7a69[50]](_0xef6ex9[_0x7a69[52]].TrunkId,{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1c){_0xef6ex1b(null,_0xef6ex19,_0xef6ex1c)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})},function(_0xef6ex19,_0xef6ex1c,_0xef6ex1b){return VoiceExtension[_0x7a69[51]]({context:_0xef6ex1c[_0x7a69[53]],exten:_0xef6ex9[_0x7a69[52]][_0x7a69[13]],priority:1,app:_0x7a69[54],appdata:_0x7a69[55],type:_0x7a69[56],TrunkId:_0xef6ex1c[_0x7a69[48]]},{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1d){_0xef6ex1b(null,_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})}],function(_0xef6ex14,_0xef6ex19){if(_0xef6ex14){console[_0x7a69[57]](_0xef6ex14);_0xef6ex1a[_0x7a69[58]]();return _0xef6exa[_0x7a69[33]](404)[_0x7a69[32]](_0xef6ex14)}else {console[_0x7a69[57]](_0x7a69[59]);_0xef6ex1a[_0x7a69[60]]();return _0xef6exa[_0x7a69[33]](201)[_0x7a69[32]](_0xef6ex19)}})})};exports[_0x7a69[63]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){if(_0xef6ex9[_0x7a69[52]][_0x7a69[48]]){delete _0xef6ex9[_0x7a69[52]][_0x7a69[48]]};return sequelize[_0x7a69[62]]()[_0x7a69[44]](function(_0xef6ex1a){async[_0x7a69[61]]([function(_0xef6ex1b){return FaxAccount[_0x7a69[64]]({where:{id:_0xef6ex9[_0x7a69[49]][_0x7a69[48]]},include:[{model:Trunk}]},{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex19){_0xef6ex1b(null,_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})},function(_0xef6ex19,_0xef6ex1b){return Trunk[_0x7a69[50]](_0xef6ex9[_0x7a69[52]].TrunkId,{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1e){return _0xef6ex19[_0x7a69[65]]({TrunkId:_0xef6ex1e[_0x7a69[48]]},{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1f){_0xef6ex1b(null,_0xef6ex19,_0xef6ex1e)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})},function(_0xef6ex19,_0xef6ex1e,_0xef6ex1b){return VoiceExtension[_0x7a69[64]]({where:{priority:1,exten:_0xef6ex19[_0x7a69[13]],context:_0xef6ex19[_0x7a69[4]][_0x7a69[53]]}},{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1d){if(!_0xef6ex1d){_0xef6ex1b(null,_0xef6ex19)};return _0xef6ex1d[_0x7a69[65]]({exten:_0xef6ex9[_0x7a69[52]][_0x7a69[13]],context:_0xef6ex1e[_0x7a69[53]],TrunkId:_0xef6ex9[_0x7a69[52]][_0x7a69[67]]},{transaction:_0xef6ex1a})[_0x7a69[44]](function(){console[_0x7a69[57]](_0x7a69[66]);_0xef6ex1b(null,_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})},function(_0xef6ex19,_0xef6ex1b){var _0xef6ex20=_[_0x7a69[68]](_0xef6ex19,_0xef6ex9[_0x7a69[52]]);return _0xef6ex20[_0x7a69[70]]({transaction:_0xef6ex1a})[_0x7a69[44]](function(){console[_0x7a69[57]](_0x7a69[69]);_0xef6ex1b(null,_0xef6ex19)})[_0x7a69[34]](function(_0xef6ex14){_0xef6ex1b(_0xef6ex14)})}],function(_0xef6ex14,_0xef6ex19){if(_0xef6ex14){console[_0x7a69[57]](_0xef6ex14);_0xef6ex1a[_0x7a69[58]]();return _0xef6exa[_0x7a69[33]](404)[_0x7a69[32]](_0xef6ex14)}else {console[_0x7a69[57]](_0x7a69[59]);_0xef6ex1a[_0x7a69[60]]();return _0xef6exa[_0x7a69[33]](201)[_0x7a69[32]](_0xef6ex19)}})})};exports[_0x7a69[71]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){FaxAccount[_0x7a69[72]]({where:{id:_0xef6ex9[_0x7a69[49]][_0x7a69[48]]}})[_0x7a69[44]](function(_0xef6ex19){if(!_0xef6ex19){return _0xef6exa[_0x7a69[47]](404)};_0xef6ex19[_0x7a69[71]]()[_0x7a69[44]](function(){return _0xef6exa[_0x7a69[47]](204)})[_0x7a69[34]](function(_0xef6ex14){_0xef6exb(_0xef6ex14)})})[_0x7a69[34]](function(_0xef6ex14){_0xef6exb(_0xef6ex14)})};exports[_0x7a69[73]]=function(_0xef6ex9,_0xef6exa,_0xef6exb){FaxApplication[_0x7a69[79]]({where:{id:_0xef6ex9[_0x7a69[52]][_0x7a69[75]]}})[_0x7a69[44]](function(_0xef6ex21){var _0xef6ex22=_0xef6ex21;return sequelize[_0x7a69[62]](function(_0xef6ex1a){return FaxApplication[_0x7a69[71]]({where:{id:_0xef6ex9[_0x7a69[52]][_0x7a69[75]]}},{transaction:_0xef6ex1a})[_0x7a69[44]](function(){var _0xef6ex23=[];for(var _0xef6ex24=0;_0xef6ex24<_0xef6ex9[_0x7a69[52]][_0x7a69[75]][_0x7a69[74]];_0xef6ex24++){var _0xef6ex25=_[_0x7a69[72]](_0xef6ex22,{"\x69\x64":_0xef6ex9[_0x7a69[52]][_0x7a69[75]][_0xef6ex24]});if(_0xef6ex25){_0xef6ex25[_0x7a69[76]]=_0xef6ex24+1;_0xef6ex23[_0x7a69[26]](_0xef6ex25[_0x7a69[77]])}};return FaxApplication[_0x7a69[78]](_0xef6ex23,{transaction:_0xef6ex1a})[_0x7a69[44]](function(_0xef6ex1f){return _0xef6ex1f})})})[_0x7a69[44]](function(_0xef6ex15){return _0xef6exa[_0x7a69[33]](200)[_0x7a69[32]](_0xef6ex15)})[_0x7a69[34]](function(_0xef6ex14){return handleError(_0xef6exa,_0xef6ex14)})})[_0x7a69[34]](function(_0xef6ex14){return _0xef6exb(_0xef6ex14)})};exports[_0x7a69[80]]=function(_0xef6ex9,_0xef6exa){FaxAccount[_0x7a69[71]]({where:{id:_0xef6ex9[_0x7a69[15]][_0x7a69[48]]},individualHooks:true})[_0x7a69[44]](function(){return _0xef6exa[_0x7a69[47]](204)})[_0x7a69[34]](function(_0xef6ex14){return handleError(_0xef6exa,_0xef6ex14)})};function handleError(_0xef6exa,_0xef6ex14){return _0xef6exa[_0x7a69[33]](500)[_0x7a69[32]](_0xef6ex14)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var async = require('async'); + +var Trunk = require('../../models').Trunk; +var FaxAccount = require('../../models').FaxAccount; +var FaxApplication = require('../../models').FaxApplication; +var VoiceExtension = require('../../models').VoiceExtension; +var sequelize = require('../../models').sequelize; + +// Get list of agents +exports.index = function(req, res, next) { + + var attributes = ['description', 'name', 'phone']; + var per_page = req.query.per_page ? parseInt(req.query.per_page, 10) : 100; + var page = req.query.page ? parseInt(req.query.page, 10) : 0; + + var query = { + where: {}, + limit: per_page, + offset: page * per_page + }; + + _.forIn(req.query, function(value, key) { + switch (key) { + case 'per_page': + case 'page': + break; + case 'sort_by': + query.order = util.format('%s %s', req.query.sort_by, req.query.sort_order || 'ASC') || null; + break; + case 'sort_order': + break; + case '$': + query.where.$or = []; + attributes.forEach(function(attribute) { + var tmp = {}; + tmp[attribute] = { + $like: '%' + value + '%' + }; + + query.where.$or.push(tmp); + }); + break; + default: + query.where[key] = { + $like: {} + }; + query.where[key].$like = '%' + value + '%'; + } + }); + + FaxAccount + .findAndCountAll(query) + .then(function(result) { + + var total_pages = Math.ceil(result.count / per_page); + var next_page = total_pages > (query.offset + 1) ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page + 1) : null; + var previous_page = page > 0 ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page - 1) : null; + + res.status(200).send({ + count: result.count, + rows: result.rows, + next_page: next_page, + previous_page: previous_page, + total_pages: total_pages + }); + + }) + .catch(function(err) { + res.status(500).send({ + error: 'Something blew up!' + }); + }); +}; + +// Get a single faxAccount +exports.show = function(req, res, next) { + FaxAccount + .findById(req.params.id) + .then(function(faxAccount) { + if (!faxAccount) { + return res.sendStatus(404); + } + return res.send(faxAccount); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Creates a new faxAccount in the DB. +exports.create = function(req, res, next) { + // console.log(req.body); + return sequelize + .transaction() + .then(function(t) { + async.waterfall([ + function(callback) { + return FaxAccount + .create(req.body, { + transaction: t + }) + .then(function(faxAccount) { + callback(null, faxAccount); + }) + .catch(function(err) { + callback(err); + }); + }, + function(faxAccount, callback) { + return Trunk + .findById(req.body.TrunkId, { + transaction: t + }) + .then(function(faxTrunk) { + callback(null, faxAccount, faxTrunk); + }) + .catch(function(err) { + callback(err); + }); + }, + function(faxAccount, faxTrunk, callback) { + return VoiceExtension + .create({ + context: faxTrunk.context, + exten: req.body.phone, + priority: 1, + app: 'Goto', + appdata: 'inbound-fax,s,1', + type: 'inbound-fax', + TrunkId: faxTrunk.id + }, { + transaction: t + }) + .then(function(voiceExtension) { + callback(null, faxAccount); + }) + .catch(function(err) { + callback(err); + }); + } + ], function(err, faxAccount) { + if (err) { + console.log(err); + t.rollback(); + return res.status(404).send(err); + } else { + console.log('ok'); + t.commit(); + return res.status(201).send(faxAccount); + } + }) + }); +}; + +// Updates an existing faxAccount in the DB. +exports.update = function(req, res, next) { + // console.log(req.body); + // console.log(req.params); + + if (req.body.id) { + delete req.body.id; + } + + return sequelize + .transaction() + .then(function(t) { + async.waterfall([ + function(callback) { + return FaxAccount + .findOne({ + where: { + id: req.params.id + }, + include: [{ + model: Trunk + }] + }, { + transaction: t + }) + .then(function(faxAccount) { + callback(null, faxAccount); + }) + .catch(function(err) { + callback(err); + }); + }, + function(faxAccount, callback) { + return Trunk + .findById(req.body.TrunkId, { + transaction: t + }) + .then(function(trunk) { + return faxAccount + .updateAttributes({ + TrunkId: trunk.id + }, { + transaction: t + }) + .then(function(data) { + callback(null, faxAccount, trunk); + }) + .catch(function(err) { + callback(err); + }); + }) + .catch(function(err) { + callback(err); + }); + }, + function(faxAccount, trunk, callback) { + return VoiceExtension + .findOne({ + where: { + priority: 1, + exten: faxAccount.phone, + context: faxAccount.Trunk.context + } + }, { + transaction: t + }) + .then(function(voiceExtension) { + if (!voiceExtension) { + callback(null, faxAccount); + } + return voiceExtension + .updateAttributes({ + exten: req.body.phone, + context: trunk.context, + TrunkId: req.body.UserId + }, { + transaction: t + }) + .then(function() { + console.log('voiceExtension edited'); + callback(null, faxAccount); + }) + .catch(function(err) { + callback(err); + }); + }) + .catch(function(err) { + callback(err); + }); + }, + function(faxAccount, callback) { + var updated = _.merge(faxAccount, req.body); + return updated.save({ + transaction: t + }) + .then(function() { + console.log('faxAccount saved'); + callback(null, faxAccount); + }) + .catch(function(err) { + callback(err); + }); + } + ], function(err, faxAccount) { + if (err) { + console.log(err); + t.rollback(); + return res.status(404).send(err); + } else { + console.log('ok'); + t.commit(); + return res.status(201).send(faxAccount); + } + }) + }); +}; + +// Deletes a faxAccount from the DB. +exports.destroy = function(req, res, next) { + FaxAccount + .find({ + where: { + id: req.params.id + } + }) + .then(function(faxAccount) { + if (!faxAccount) { + return res.sendStatus(404); + } + faxAccount.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + next(err); + }); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.addApplications = function(req, res, next) { + + FaxApplication + .findAll({ + where: { + id: req.body.applications + } + }) + .then(function(faxApplications) { + var tmpFaxApplications = faxApplications; + + return sequelize.transaction(function(t) { + return FaxApplication.destroy({ + where: { + id: req.body.applications + } + }, { + transaction: t + }).then(function() { + + var sortedApplications = []; + + for (var i = 0; i < req.body.applications.length; i++) { + + var tmpFaxApplication = _.find(tmpFaxApplications, { + 'id': req.body.applications[i] + }); + + if (tmpFaxApplication) { + tmpFaxApplication.priority = i + 1; + sortedApplications.push(tmpFaxApplication.dataValues); + } + } + + return FaxApplication.bulkCreate(sortedApplications, { + transaction: t + }).then(function(data) { + return data; + }); + }); + }).then(function(result) { + return res.status(200).send(result); + // Transaction has been committed + // result is whatever the result of the promise chain returned to the transaction callback + }).catch(function(err) { + return handleError(res, err); + // Transaction has been rolled back + // err is whatever rejected the promise chain returned to the transaction callback + }); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.bulkDestroy = function(req, res) { + FaxAccount + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/fax_account/fax_account.socket.js b/server/api/fax_account/fax_account.socket.js index 335899e..e28dde9 100644 --- a/server/api/fax_account/fax_account.socket.js +++ b/server/api/fax_account/fax_account.socket.js @@ -1 +1,24 @@ -var _0x8b68=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8b68[0];var fax_account=require(_0x8b68[2])[_0x8b68[1]];exports[_0x8b68[3]]=function(_0x67c9x2){fax_account[_0x8b68[4]](function(_0x67c9x3){onSave(_0x67c9x2,_0x67c9x3)});fax_account[_0x8b68[5]](function(_0x67c9x3){onRemove(_0x67c9x2,_0x67c9x3)})};function onSave(_0x67c9x2,_0x67c9x3,_0x67c9x5){_0x67c9x2[_0x8b68[7]](_0x8b68[6],_0x67c9x3)}function onRemove(_0x67c9x2,_0x67c9x3,_0x67c9x5){_0x67c9x2[_0x8b68[7]](_0x8b68[8],_0x67c9x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var fax_account = require('../../models').FaxAccount; + +exports.register = function(socket) { + fax_account.afterCreate(function (doc) { + onSave(socket, doc); + }); + fax_account.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('fax_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('fax_account:remove', doc); +} diff --git a/server/api/fax_account/fax_account.spec.js b/server/api/fax_account/fax_account.spec.js index 0acef82..0399e33 100644 --- a/server/api/fax_account/fax_account.spec.js +++ b/server/api/fax_account/fax_account.spec.js @@ -1 +1,20 @@ -var _0xc67c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x67\x65\x74"];_0xc67c[0];var should=require(_0xc67c[1]);var app=require(_0xc67c[2]);var request=require(_0xc67c[3]);describe(_0xc67c[4],function(){it(_0xc67c[5],function(_0x4404x4){request(app)[_0xc67c[13]](_0xc67c[12])[_0xc67c[11]](200)[_0xc67c[11]](_0xc67c[10],/json/)[_0xc67c[9]](function(_0x4404x5,_0x4404x6){if(_0x4404x5){return _0x4404x4(_0x4404x5)};_0x4404x6[_0xc67c[8]][_0xc67c[1]][_0xc67c[7]][_0xc67c[6]](Array);_0x4404x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/accounts', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/accounts') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/fax_account/index.js b/server/api/fax_account/index.js index c85a803..15886c9 100644 --- a/server/api/fax_account/index.js +++ b/server/api/fax_account/index.js @@ -1 +1,17 @@ -var _0x590e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x3A\x69\x64\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x61\x64\x64\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x590e[0];var express=require(_0x590e[1]);var controller=require(_0x590e[2]);var auth=require(_0x590e[3]);var router=express.Router();router[_0x590e[7]](_0x590e[4],auth[_0x590e[5]](),controller[_0x590e[6]]);router[_0x590e[7]](_0x590e[8],controller[_0x590e[9]]);router[_0x590e[11]](_0x590e[4],controller[_0x590e[10]]);router[_0x590e[11]](_0x590e[12],controller[_0x590e[13]]);router[_0x590e[15]](_0x590e[8],controller[_0x590e[14]]);router[_0x590e[16]](_0x590e[8],controller[_0x590e[14]]);router[_0x590e[18]](_0x590e[4],controller[_0x590e[17]]);router[_0x590e[18]](_0x590e[8],controller[_0x590e[19]]);module[_0x590e[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./fax_account.controller'); +var auth = require('../../auth/auth.service'); +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.post('/:id/applications', controller.addApplications); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/', controller.bulkDestroy); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/fax_application/fax_application.controller.js b/server/api/fax_application/fax_application.controller.js index 53c814f..59b09cb 100644 --- a/server/api/fax_application/fax_application.controller.js +++ b/server/api/fax_application/fax_application.controller.js @@ -1 +1,94 @@ -var _0x1c8f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x6C\x6F\x67","\x70\x72\x69\x6F\x72\x69\x74\x79","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x6D\x61\x78","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64"];_0x1c8f[0];var _=require(_0x1c8f[1]);var FaxApplication=require(_0x1c8f[3])[_0x1c8f[2]];exports[_0x1c8f[4]]=function(_0x5fa0x3,_0x5fa0x4){FaxApplication[_0x1c8f[10]]({where:_0x5fa0x3[_0x1c8f[9]]})[_0x1c8f[8]](function(_0x5fa0x6){return _0x5fa0x4[_0x1c8f[7]](200)[_0x1c8f[6]](_0x5fa0x6)})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})};exports[_0x1c8f[11]]=function(_0x5fa0x3,_0x5fa0x4){FaxApplication[_0x1c8f[15]](_0x5fa0x3[_0x1c8f[14]][_0x1c8f[13]])[_0x1c8f[8]](function(_0x5fa0x7){if(!_0x5fa0x7){return _0x5fa0x4[_0x1c8f[12]](404)};return _0x5fa0x4[_0x1c8f[6]](_0x5fa0x7)})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})};exports[_0x1c8f[16]]=function(_0x5fa0x3,_0x5fa0x4,_0x5fa0x8){console[_0x1c8f[18]](_0x5fa0x3[_0x1c8f[17]]);FaxApplication[_0x1c8f[21]](_0x1c8f[19],{where:{FaxAccountId:_0x5fa0x3[_0x1c8f[17]][_0x1c8f[20]]}})[_0x1c8f[8]](function(_0x5fa0x9){_0x5fa0x3[_0x1c8f[17]][_0x1c8f[19]]=_0x5fa0x9?++_0x5fa0x9:1;FaxApplication[_0x1c8f[16]](_0x5fa0x3[_0x1c8f[17]])[_0x1c8f[8]](function(_0x5fa0xa){return _0x5fa0x4[_0x1c8f[7]](201)[_0x1c8f[6]](_0x5fa0xa)})[_0x1c8f[5]](function(_0x5fa0x5){return _0x5fa0x8(_0x5fa0x5)});console[_0x1c8f[18]](_0x5fa0x9)})[_0x1c8f[5]](function(_0x5fa0x5){_0x5fa0x8(_0x5fa0x5)})};exports[_0x1c8f[22]]=function(_0x5fa0x3,_0x5fa0x4){if(_0x5fa0x3[_0x1c8f[17]][_0x1c8f[13]]){delete _0x5fa0x3[_0x1c8f[17]][_0x1c8f[13]]};FaxApplication[_0x1c8f[15]](_0x5fa0x3[_0x1c8f[14]][_0x1c8f[13]])[_0x1c8f[8]](function(_0x5fa0x7){if(!_0x5fa0x7){return _0x5fa0x4[_0x1c8f[12]](404)};var _0x5fa0xb=_[_0x1c8f[23]](_0x5fa0x7,_0x5fa0x3[_0x1c8f[17]]);_0x5fa0xb[_0x1c8f[24]]()[_0x1c8f[8]](function(){return _0x5fa0x4[_0x1c8f[7]](200)[_0x1c8f[6]](_0x5fa0x7)})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})};exports[_0x1c8f[25]]=function(_0x5fa0x3,_0x5fa0x4){FaxApplication[_0x1c8f[26]]({where:{id:_0x5fa0x3[_0x1c8f[14]][_0x1c8f[13]]}})[_0x1c8f[8]](function(_0x5fa0x7){if(!_0x5fa0x7){return _0x5fa0x4[_0x1c8f[12]](404)};_0x5fa0x7[_0x1c8f[25]]()[_0x1c8f[8]](function(){return _0x5fa0x4[_0x1c8f[12]](204)})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})})[_0x1c8f[5]](function(_0x5fa0x5){return handleError(_0x5fa0x4,_0x5fa0x5)})};function handleError(_0x5fa0x4,_0x5fa0x5){return _0x5fa0x4[_0x1c8f[7]](500)[_0x1c8f[6]](_0x5fa0x5)} \ No newline at end of file +'use strict'; +var _ = require('lodash'); +var FaxApplication = require('../../models').FaxApplication; +// Get list of fax_applications +exports.index = function(req, res) { + FaxApplication.findAll({ + where: req.query + }).then(function(fax_applications) { + return res.status(200).send(fax_applications); + }).catch(function(err) { + return handleError(res, err); + }); +}; +// Get a single fax_application +exports.show = function(req, res) { + FaxApplication.findById(req.params.id).then(function(fax_application) { + if (!fax_application) { + return res.sendStatus(404); + } + return res.send(fax_application); + }).catch(function(err) { + return handleError(res, err); + }); +}; +// Creates a new fax_application in the DB. +exports.create = function(req, res, next) { + console.log(req.body); + FaxApplication.max('priority', { + where: { + FaxAccountId: req.body.FaxAccountId + } + }).then(function(max) { + // SET PRIORITY + req.body.priority = max ? ++max : 1; + FaxApplication.create(req.body).then(function(faxApplication) { + return res.status(201).send(faxApplication); + }).catch(function(err) { + return next(err); + }); + console.log(max); + }).catch(function(err) { + next(err); + }); + // FaxApplication + // .create(req.body) + // .then(function(fax_application) { + // return res.status(201).send(fax_application); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); +}; +// Updates an existing fax_application in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FaxApplication.findById(req.params.id).then(function(fax_application) { + if (!fax_application) { + return res.sendStatus(404); + } + var updated = _.merge(fax_application, req.body); + updated.save().then(function() { + return res.status(200).send(fax_application); + }).catch(function(err) { + return handleError(res, err); + }); + }).catch(function(err) { + return handleError(res, err); + }); +}; +// Deletes a fax_application from the DB. +exports.destroy = function(req, res) { + FaxApplication.find({ + where: { + id: req.params.id + } + }).then(function(fax_application) { + if (!fax_application) { + return res.sendStatus(404); + } + fax_application.destroy().then(function() { + return res.sendStatus(204); + }).catch(function(err) { + return handleError(res, err); + }); + }).catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/fax_application/fax_application.socket.js b/server/api/fax_application/fax_application.socket.js index 09d3c45..2a677d7 100644 --- a/server/api/fax_application/fax_application.socket.js +++ b/server/api/fax_application/fax_application.socket.js @@ -1 +1,24 @@ -var _0xcfcd=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xcfcd[0];var fax_application=require(_0xcfcd[2])[_0xcfcd[1]];exports[_0xcfcd[3]]=function(_0x10e5x2){fax_application[_0xcfcd[4]](function(_0x10e5x3){onSave(_0x10e5x2,_0x10e5x3)});fax_application[_0xcfcd[5]](function(_0x10e5x3){onRemove(_0x10e5x2,_0x10e5x3)})};function onSave(_0x10e5x2,_0x10e5x3,_0x10e5x5){_0x10e5x2[_0xcfcd[7]](_0xcfcd[6],_0x10e5x3)}function onRemove(_0x10e5x2,_0x10e5x3,_0x10e5x5){_0x10e5x2[_0xcfcd[7]](_0xcfcd[8],_0x10e5x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var fax_application = require('../../models').FaxApplication; + +exports.register = function(socket) { + fax_application.afterCreate(function (doc) { + onSave(socket, doc); + }); + fax_application.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('fax_application:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('fax_application:remove', doc); +} diff --git a/server/api/fax_application/fax_application.spec.js b/server/api/fax_application/fax_application.spec.js index c8c5e62..9eeaee8 100644 --- a/server/api/fax_application/fax_application.spec.js +++ b/server/api/fax_application/fax_application.spec.js @@ -1 +1,20 @@ -var _0xfc26=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0xfc26[0];var should=require(_0xfc26[1]);var app=require(_0xfc26[2]);var request=require(_0xfc26[3]);describe(_0xfc26[4],function(){it(_0xfc26[5],function(_0xf61bx4){request(app)[_0xfc26[13]](_0xfc26[12])[_0xfc26[11]](200)[_0xfc26[11]](_0xfc26[10],/json/)[_0xfc26[9]](function(_0xf61bx5,_0xf61bx6){if(_0xf61bx5){return _0xf61bx4(_0xf61bx5)};_0xf61bx6[_0xfc26[8]][_0xfc26[1]][_0xfc26[7]][_0xfc26[6]](Array);_0xf61bx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/applications', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/applications') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/fax_application/index.js b/server/api/fax_application/index.js index acc2519..b27e419 100644 --- a/server/api/fax_application/index.js +++ b/server/api/fax_application/index.js @@ -1 +1,15 @@ -var _0xd976=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd976[0];var express=require(_0xd976[1]);var controller=require(_0xd976[2]);var router=express.Router();router[_0xd976[5]](_0xd976[3],controller[_0xd976[4]]);router[_0xd976[5]](_0xd976[6],controller[_0xd976[7]]);router[_0xd976[9]](_0xd976[3],controller[_0xd976[8]]);router[_0xd976[11]](_0xd976[6],controller[_0xd976[10]]);router[_0xd976[12]](_0xd976[6],controller[_0xd976[10]]);router[_0xd976[14]](_0xd976[6],controller[_0xd976[13]]);module[_0xd976[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./fax_application.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/fax_message/fax_message.ami.js b/server/api/fax_message/fax_message.ami.js index ff5ff99..2d69e42 100644 --- a/server/api/fax_message/fax_message.ami.js +++ b/server/api/fax_message/fax_message.ami.js @@ -1 +1,64 @@ -var _0xd561=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x72\x65\x67\x69\x73\x74\x65\x72","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65\x20\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x4E\x4F\x54\x20\x53\x45\x4E\x54","\x61\x63\x74\x69\x6F\x6E\x69\x64","\x62\x6F\x64\x79","\x70\x61\x72\x73\x65","\x66\x61\x78\x42\x6F\x64\x79","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x66\x72\x6F\x6D","\x25\x73\x2F\x25\x73\x40\x25\x73","\x74\x65\x63\x68\x6E\x6F\x6C\x6F\x67\x79","\x74\x6F","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x73","\x74\x72\x75\x65","\x6D\x61\x78\x72\x61\x74\x65","\x6D\x69\x6E\x72\x61\x74\x65","\x65\x63\x6D","\x79\x65\x73","\x6E\x6F","\x66\x61\x78\x5F\x6C\x6F\x63\x61\x6C\x69\x64","\x66\x61\x78\x5F\x66\x69\x6C\x65","\x66\x61\x78\x5F\x68\x65\x61\x64\x65\x72","\x75\x75\x69\x64","\x46\x41\x49\x4C\x45\x44","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x61\x63\x74\x69\x6F\x6E","\x74\x68\x65\x6E","\x69\x64","\x74\x72\x75\x6E\x6B","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0xd561[0];var _=require(_0xd561[1]);var util=require(_0xd561[2]);var FaxMessage=require(_0xd561[4])[_0xd561[3]];var Trunk=require(_0xd561[4])[_0xd561[5]];exports[_0xd561[6]]=function(_0x4dfdx5){FaxMessage[_0xd561[9]](function(_0x4dfdx6){console[_0xd561[8]](_0xd561[7]);onSave(_0x4dfdx5,_0x4dfdx6)})};function onSave(_0x4dfdx5,_0x4dfdx6,_0x4dfdx8){if(_0x4dfdx6[_0xd561[10]]===_0xd561[11]&&!_0x4dfdx6[_0xd561[12]]){var _0x4dfdx9=JSON[_0xd561[14]](_0x4dfdx6[_0xd561[13]]);console[_0xd561[8]](_0xd561[15],_0x4dfdx9);Trunk[_0xd561[44]](_0x4dfdx9[_0xd561[43]][_0xd561[42]])[_0xd561[41]](function(_0x4dfdxb){var _0x4dfdxc={Action:_0xd561[18],CallerID:_0x4dfdx9[_0xd561[19]],Channel:util[_0xd561[24]](_0xd561[20],_0x4dfdx9[_0xd561[21]],_0x4dfdx9[_0xd561[22]],_0x4dfdxb[_0xd561[23]]),Context:_0xd561[25],Exten:_0xd561[26],Priority:1,Async:_0xd561[27],Variable:{MAXRATE:_0x4dfdx9[_0xd561[28]],MINRATE:_0x4dfdx9[_0xd561[29]],ECM:_0x4dfdx9[_0xd561[30]]?_0xd561[31]:_0xd561[32],LOCALID:_0x4dfdx9[_0xd561[33]],FAXFILE:_0x4dfdx9[_0xd561[34]],FAXHEADER:_0x4dfdx9[_0xd561[35]],FAXUUID:_0x4dfdx9[_0xd561[36]]}};_0x4dfdx5[_0xd561[40]](_0x4dfdxc,function(_0x4dfdxa,_0x4dfdxd){if(_0x4dfdxa){_0x4dfdx6[_0xd561[38]]({status:_0xd561[37]})}else {if(_0x4dfdxd[_0xd561[39]]&&_0x4dfdxd[_0xd561[12]]){_0x4dfdx6[_0xd561[38]]({actionid:_0x4dfdxd[_0xd561[12]]})}}})})[_0xd561[17]](function(_0x4dfdxa){console[_0xd561[16]](_0x4dfdxa)})}} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); + +var FaxMessage = require('../../models').FaxMessage; +var Trunk = require('../../models').User; + +exports.register = function(ami) { + + FaxMessage.afterCreate(function(doc) { + console.log('FaxMessage afterCreate'); + onSave(ami, doc); + }); +}; + +function onSave(ami, doc, cb) { + if (doc.status === 'NOT SENT' && !doc.actionid) { + // I have to send the fax with the Originate + var faxBody = JSON.parse(doc.body); + console.log('faxBody', faxBody); + + Trunk + .findById(faxBody.trunk.id) + .then(function(trunk) { + var action = { + Action: 'originate', + CallerID: faxBody.from, + Channel: util.format('%s/%s@%s', faxBody.technology, faxBody.to, trunk.name), + Context: 'outbound-fax', + Exten: 's', + Priority: 1, + Async: 'true', + Variable: { + MAXRATE: faxBody.maxrate, + MINRATE: faxBody.minrate, + ECM: faxBody.ecm ? 'yes' : 'no', + LOCALID: faxBody.fax_localid, + FAXFILE: faxBody.fax_file, + // 'FAXFILE': 'test.tiff', // Scommentare se si fanno prove in locale! + FAXHEADER: faxBody.fax_header, + FAXUUID: faxBody.uuid + } + }; + + ami.action(action, function(err, res) { + if (err) { + doc.updateAttributes({ + status: 'FAILED' + }); + } else { + if (res.response && res.actionid) { + doc.updateAttributes({ + actionid: res.actionid + }); + } + } + }); + }) + .catch(function(err) { + console.error(err); + }); + } +} diff --git a/server/api/fax_message/fax_message.controller.js b/server/api/fax_message/fax_message.controller.js index a45dd86..e354d5f 100644 --- a/server/api/fax_message/fax_message.controller.js +++ b/server/api/fax_message/fax_message.controller.js @@ -1 +1,422 @@ -var _0x68e3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x66\x73","\x70\x61\x74\x68","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x6E\x6F\x64\x65\x2D\x75\x75\x69\x64","\x68\x74\x6D\x6C\x2D\x70\x64\x66","\x73\x70\x69\x6E\x64\x72\x69\x66\x74","\x66\x6F\x72\x6D\x69\x64\x61\x62\x6C\x65","\x65\x78\x65\x63","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x44\x45\x53\x43","\x46\x72\x6F\x6D","\x54\x6F","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x72\x65\x61\x74\x65","\x75\x70\x6C\x6F\x61\x64\x44\x69\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x66\x61\x78\x2F\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2F\x6F\x72\x69\x67\x69\x6E\x61\x6C","\x6A\x6F\x69\x6E","\x6B\x65\x65\x70\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x6D\x75\x6C\x74\x69\x70\x6C\x65\x73","\x6F\x6E\x6C\x79\x54\x65\x78\x74","\x62\x6F\x64\x79","\x68\x74\x6D\x6C","\x76\x34","\x2E\x70\x64\x66","\x46\x61\x78\x3A\x20\x48\x54\x4D\x4C\x20\x43\x6F\x6E\x76\x65\x72\x74\x65\x64","\x6C\x6F\x67","\x74\x6F\x46\x69\x6C\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x66\x69\x6C\x65","\x63\x72\x65\x61\x74\x65\x57\x72\x69\x74\x65\x53\x74\x72\x65\x61\x6D","\x70\x69\x70\x65","\x70\x64\x66\x53\x74\x72\x65\x61\x6D","\x46\x61\x78\x3A\x20\x48\x54\x4D\x4C\x20\x6A\x6F\x69\x6E\x65\x64\x20\x77\x69\x74\x68\x20\x50\x44\x46\x20\x75\x70\x6C\x6F\x61\x64\x65\x64","\x65\x72\x72\x6F\x72","\x46\x61\x78\x3A\x20\x50\x44\x46\x20\x52\x65\x6E\x61\x6D\x65","\x72\x65\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x66\x61\x78","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x6F\x72\x69\x67\x69\x6E\x61\x6C","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x2E\x74\x69\x66","\x67\x73","\x20\x2D\x71\x20\x2D\x64\x4E\x4F\x50\x41\x55\x53\x45\x20\x2D\x64\x42\x41\x54\x43\x48\x20\x2D\x73\x44\x45\x56\x49\x43\x45\x3D\x74\x69\x66\x66\x67\x34\x20","\x2D\x73\x50\x41\x50\x45\x52\x53\x49\x5A\x45\x3D\x6C\x65\x74\x74\x65\x72\x20\x2D\x73\x4F\x75\x74\x70\x75\x74\x46\x69\x6C\x65\x3D","\x20","\x53\x49\x50","\x74\x6F\x4E\x75\x6D","\x70\x68\x6F\x6E\x65","\x66\x61\x78\x68\x65\x61\x64\x65\x72","\x6C\x6F\x63\x61\x6C\x69\x64","\x6D\x61\x78\x72\x61\x74\x65","\x6D\x69\x6E\x72\x61\x74\x65","\x65\x63\x6D","\x54\x72\x75\x6E\x6B\x49\x64","\x46\x69\x6C\x65\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x73","\x46\x61\x78\x3A\x20\x50\x44\x46\x20\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x20\x74\x6F\x20\x54\x49\x46\x46","\x72\x6F\x6F\x6D\x49\x64","\x73\x65\x74\x46\x72\x6F\x6D","\x73\x70\x72\x65\x61\x64","\x66\x72\x6F\x6D","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x73\x65\x74\x54\x6F","\x74\x6F","\x4E\x4F\x54\x20\x53\x45\x4E\x54","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x4F\x50\x45\x4E","\x61\x63\x63\x6F\x75\x6E\x74\x49\x64","\x75\x73\x65\x72\x49\x64","\x63\x68\x6D\x6F\x64","\x65\x78\x69\x73\x74\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x67\x65\x74\x43\x6F\x6E\x74\x65\x6E\x74\x46\x72\x6F\x6D\x4D\x65\x73\x73\x61\x67\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65\x50\x44\x46","\x52\x45\x43\x45\x49\x56\x45\x44","\x69\x6E\x62\x6F\x75\x6E\x64","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x53\x45\x4E\x54","\x46\x41\x49\x4C\x45\x44"];_0x68e3[0];var _=require(_0x68e3[1]);var fs=require(_0x68e3[2]);var path=require(_0x68e3[3]);var uploadFile=require(_0x68e3[4]);var uuidLib=require(_0x68e3[5]);var pdf=require(_0x68e3[6]);var spindrift=require(_0x68e3[7]);var formidable=require(_0x68e3[8]);var exec=require(_0x68e3[10])[_0x68e3[9]];var config=require(_0x68e3[11]);var FaxMessage=require(_0x68e3[13])[_0x68e3[12]];var FaxRoom=require(_0x68e3[13])[_0x68e3[14]];var FaxAccount=require(_0x68e3[13])[_0x68e3[15]];var Contact=require(_0x68e3[13])[_0x68e3[16]];exports[_0x68e3[17]]=function(_0x1e2exf,_0x1e2ex10){FaxMessage[_0x68e3[26]]({where:_0x1e2exf[_0x68e3[22]],order:_0x68e3[23],include:[{model:Contact,as:_0x68e3[24]},{model:Contact,as:_0x68e3[25]},{model:FaxRoom,include:[{model:FaxAccount}]}]})[_0x68e3[21]](function(_0x1e2ex12){return _0x1e2ex10[_0x68e3[20]](200)[_0x68e3[19]](_0x1e2ex12)})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})};exports[_0x68e3[27]]=function(_0x1e2exf,_0x1e2ex10){FaxMessage[_0x68e3[31]]({where:{id:_0x1e2exf[_0x68e3[30]][_0x68e3[29]]},include:[{model:Contact,as:_0x68e3[24]},{model:Contact,as:_0x68e3[25]}]})[_0x68e3[21]](function(_0x1e2ex13){if(!_0x1e2ex13){return _0x1e2ex10[_0x68e3[28]](404)};return _0x1e2ex10[_0x68e3[19]](_0x1e2ex13)})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})};exports[_0x68e3[32]]=function(_0x1e2exf,_0x1e2ex10,_0x1e2ex14){var _0x1e2ex15= new formidable.IncomingForm();_0x1e2ex15[_0x68e3[33]]=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[35]);_0x1e2ex15[_0x68e3[37]]=true;_0x1e2ex15[_0x68e3[38]]=false;if(_0x1e2exf[_0x68e3[40]][_0x68e3[39]]){if(_0x1e2exf[_0x68e3[40]][_0x68e3[41]]){var _0x1e2ex16=uuidLib[_0x68e3[42]]();var _0x1e2ex17=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[35],_0x1e2ex16+_0x68e3[43]);pdf[_0x68e3[32]](_0x1e2exf[_0x68e3[40]][_0x68e3[41]],{"\x74\x69\x6D\x65\x6F\x75\x74":30000})[_0x68e3[46]](_0x1e2ex17,function(_0x1e2ex11,_0x1e2ex18){console[_0x68e3[45]](_0x68e3[44]);convertPdfAndSendFax(_0x1e2exf,_0x1e2ex10,_0x1e2ex16,_0x1e2exf[_0x68e3[40]])})}}else {_0x1e2ex15[_0x68e3[56]](_0x1e2exf,function(_0x1e2ex11,_0x1e2ex19,_0x1e2ex1a){if(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)};if(_0x1e2ex19[_0x68e3[41]]){var _0x1e2ex16=uuidLib[_0x68e3[42]]();var _0x1e2ex17=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[35],_0x1e2ex16+_0x68e3[43]);pdf[_0x68e3[32]](_0x1e2ex19[_0x68e3[41]],{"\x74\x69\x6D\x65\x6F\x75\x74":30000})[_0x68e3[46]](_0x1e2ex17,function(_0x1e2ex11,_0x1e2ex18){console[_0x68e3[45]](_0x68e3[44]);var _0x1e2ex1b=spindrift(_0x1e2ex18[_0x68e3[47]]);var _0x1e2ex1c=spindrift(_0x1e2ex1a[_0x68e3[48]][_0x68e3[3]]);var _0x1e2ex16=uuidLib[_0x68e3[42]]();spindrift[_0x68e3[36]](_0x1e2ex1b,_0x1e2ex1c)[_0x68e3[51]]()[_0x68e3[50]](fs[_0x68e3[49]](path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[35],_0x1e2ex16+_0x68e3[43])));console[_0x68e3[45]](_0x68e3[52]);convertPdfAndSendFax(_0x1e2exf,_0x1e2ex10,_0x1e2ex16,_0x1e2ex19)})}else {var _0x1e2ex16=uuidLib[_0x68e3[42]]();var _0x1e2ex17=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[35],_0x1e2ex16+_0x68e3[43]);fs[_0x68e3[55]](_0x1e2ex1a[_0x68e3[48]][_0x68e3[3]],_0x1e2ex17,function(_0x1e2ex11){if(_0x1e2ex11){console[_0x68e3[53]](_0x1e2ex11);return handleError(_0x1e2ex10,_0x1e2exf)};console[_0x68e3[45]](_0x68e3[54]);convertPdfAndSendFax(_0x1e2exf,_0x1e2ex10,_0x1e2ex16,_0x1e2ex19)})}})}};function convertPdfAndSendFax(_0x1e2exf,_0x1e2ex10,_0x1e2ex1e,_0x1e2ex19){var _0x1e2ex1f=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[57],_0x68e3[58],_0x68e3[59],_0x68e3[60],_0x68e3[61],_0x1e2ex1e+_0x68e3[43]);var _0x1e2ex20=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[57],_0x68e3[58],_0x68e3[59],_0x68e3[60],_0x68e3[62],_0x1e2ex1e+_0x68e3[63]);var _0x1e2ex21=_0x68e3[64]+_0x68e3[65]+_0x68e3[66]+_0x1e2ex20+_0x68e3[67]+_0x1e2ex1f;var _0x1e2ex22=uuidLib[_0x68e3[42]]();FaxAccount[_0x68e3[93]](_0x1e2ex19[_0x68e3[89]])[_0x68e3[21]](function(_0x1e2ex23){if(_0x1e2ex23){var _0x1e2ex24={technology:_0x68e3[68],to:_0x1e2ex19[_0x68e3[69]],from:_0x1e2ex23[_0x68e3[70]],fax_file:_0x1e2ex20,fax_header:_0x1e2ex23[_0x68e3[71]],fax_localid:_0x1e2ex23[_0x68e3[72]],maxrate:_0x1e2ex23[_0x68e3[73]],minrate:_0x1e2ex23[_0x68e3[74]],ecm:_0x1e2ex23[_0x68e3[75]],uuid:_0x1e2ex22,trunk:{id:_0x1e2ex23[_0x68e3[76]]}};fs[_0x68e3[92]](_0x1e2ex1f,function(_0x1e2ex25){if(!_0x1e2ex25){handleError(_0x1e2ex10, new Error(_0x68e3[77]))}else {exec(_0x1e2ex21,function(_0x1e2ex11){if(_0x1e2ex11){console[_0x68e3[53]](_0x1e2ex11);handleError(_0x1e2ex10,_0x1e2ex11)}else {console[_0x68e3[45]](_0x68e3[78]);fs[_0x68e3[91]](_0x1e2ex20,511,function(_0x1e2ex11){if(_0x1e2ex19[_0x68e3[79]]){FaxRoom[_0x68e3[83]]({where:{id:_0x1e2ex19[_0x68e3[79]]},defaults:{}})[_0x68e3[81]](function(_0x1e2ex26,_0x1e2ex27){FaxMessage[_0x68e3[32]]({status:_0x68e3[86],read:true,filenamePDF:_0x1e2ex1e+_0x68e3[43],filename:_0x1e2ex1e+_0x68e3[63],body:JSON[_0x68e3[87]](_0x1e2ex24),uuid:_0x1e2ex22,FaxRoomId:_0x1e2ex26[_0x68e3[29]]})[_0x68e3[21]](function(_0x1e2ex28){Contact[_0x68e3[83]]({where:{phone:_0x1e2ex24[_0x68e3[82]]},defaults:{phone:_0x1e2ex24[_0x68e3[82]],fullname:_0x1e2ex24[_0x68e3[82]]}})[_0x68e3[81]](function(_0x1e2ex29,_0x1e2ex27){_0x1e2ex28[_0x68e3[80]](_0x1e2ex29)});Contact[_0x68e3[83]]({where:{phone:_0x1e2ex24[_0x68e3[85]]},defaults:{phone:_0x1e2ex24[_0x68e3[85]],fullname:_0x1e2ex24[_0x68e3[85]]}})[_0x68e3[81]](function(_0x1e2ex29,_0x1e2ex27){_0x1e2ex28[_0x68e3[84]](_0x1e2ex29)});return _0x1e2ex10[_0x68e3[20]](200)[_0x68e3[19]](_0x1e2ex28)})[_0x68e3[18]](function(_0x1e2ex11){handleError(_0x1e2ex10,_0x1e2ex11)})})}else {FaxRoom[_0x68e3[32]]({status:_0x68e3[88],from:_0x1e2ex19[_0x68e3[69]],FaxAccountId:_0x1e2ex19[_0x68e3[89]],UserId:_0x1e2ex19[_0x68e3[90]]})[_0x68e3[21]](function(_0x1e2ex26){FaxMessage[_0x68e3[32]]({status:_0x68e3[86],read:true,filenamePDF:_0x1e2ex1e+_0x68e3[43],filename:_0x1e2ex1e+_0x68e3[63],body:JSON[_0x68e3[87]](_0x1e2ex24),uuid:_0x1e2ex22,FaxRoomId:_0x1e2ex26[_0x68e3[29]]})[_0x68e3[21]](function(_0x1e2ex28){Contact[_0x68e3[83]]({where:{phone:_0x1e2ex24[_0x68e3[82]]},defaults:{phone:_0x1e2ex24[_0x68e3[82]],fullname:_0x1e2ex24[_0x68e3[82]]}})[_0x68e3[81]](function(_0x1e2ex29,_0x1e2ex27){_0x1e2ex28[_0x68e3[80]](_0x1e2ex29)});Contact[_0x68e3[83]]({where:{phone:_0x1e2ex24[_0x68e3[85]]},defaults:{phone:_0x1e2ex24[_0x68e3[85]],fullname:_0x1e2ex24[_0x68e3[85]]}})[_0x68e3[81]](function(_0x1e2ex29,_0x1e2ex27){_0x1e2ex28[_0x68e3[84]](_0x1e2ex29)});return _0x1e2ex10[_0x68e3[20]](200)[_0x68e3[19]](_0x1e2ex28)})[_0x68e3[18]](function(_0x1e2ex11){handleError(_0x1e2ex10,_0x1e2ex11)})})[_0x68e3[18]](function(_0x1e2ex11){handleError(_0x1e2ex10,_0x1e2ex11)})}})}})}})}})}exports[_0x68e3[94]]=function(_0x1e2exf,_0x1e2ex10){if(_0x1e2exf[_0x68e3[40]][_0x68e3[29]]){delete _0x1e2exf[_0x68e3[40]][_0x68e3[29]]};FaxMessage[_0x68e3[31]]({where:{id:_0x1e2exf[_0x68e3[30]][_0x68e3[29]]},include:[{model:Contact,as:_0x68e3[24]},{model:Contact,as:_0x68e3[25]}]})[_0x68e3[21]](function(_0x1e2ex13){if(!_0x1e2ex13){return _0x1e2ex10[_0x68e3[28]](404)};var _0x1e2ex2a=_[_0x68e3[95]](_0x1e2ex13,_0x1e2exf[_0x68e3[40]]);_0x1e2ex2a[_0x68e3[96]]()[_0x68e3[21]](function(){return _0x1e2ex10[_0x68e3[20]](200)[_0x68e3[19]](_0x1e2ex13)})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})};exports[_0x68e3[97]]=function(_0x1e2exf,_0x1e2ex10){FaxMessage[_0x68e3[98]]({where:{id:_0x1e2exf[_0x68e3[30]][_0x68e3[29]]}})[_0x68e3[21]](function(_0x1e2ex13){if(!_0x1e2ex13){return _0x1e2ex10[_0x68e3[28]](404)};_0x1e2ex13[_0x68e3[97]]()[_0x68e3[21]](function(){return _0x1e2ex10[_0x68e3[28]](204)})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})};exports[_0x68e3[99]]=function(_0x1e2exf,_0x1e2ex10){FaxMessage[_0x68e3[93]](_0x1e2exf[_0x68e3[30]][_0x68e3[29]])[_0x68e3[21]](function(_0x1e2ex13){if(!_0x1e2ex13){return _0x1e2ex10[_0x68e3[28]](404)};if(_0x1e2ex13[_0x68e3[100]]){if(_0x1e2ex13[_0x68e3[20]]===_0x68e3[101]){var _0x1e2ex2b=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[57],_0x68e3[58],_0x68e3[59],_0x68e3[102],_0x1e2ex13[_0x68e3[100]]);fs[_0x68e3[92]](_0x1e2ex2b,function(_0x1e2ex25){if(_0x1e2ex25){return _0x1e2ex10[_0x68e3[103]](_0x1e2ex2b)}else {return _0x1e2ex10[_0x68e3[28]](404)}})}else {if(_0x1e2ex13[_0x68e3[20]]===_0x68e3[86]||_0x1e2ex13[_0x68e3[104]]===_0x68e3[105]||_0x1e2ex13[_0x68e3[20]]===_0x68e3[106]){var _0x1e2ex2b=path[_0x68e3[36]](config[_0x68e3[34]],_0x68e3[57],_0x68e3[58],_0x68e3[59],_0x68e3[60],_0x68e3[61],_0x1e2ex13[_0x68e3[100]]);fs[_0x68e3[92]](_0x1e2ex2b,function(_0x1e2ex25){if(_0x1e2ex25){return _0x1e2ex10[_0x68e3[103]](_0x1e2ex2b)}else {return _0x1e2ex10[_0x68e3[28]](404)}})}}}else {_0x1e2ex10[_0x68e3[28]](404)}})[_0x68e3[18]](function(_0x1e2ex11){return handleError(_0x1e2ex10,_0x1e2ex11)})};function handleError(_0x1e2ex10,_0x1e2ex11){return _0x1e2ex10[_0x68e3[20]](500)[_0x68e3[19]](_0x1e2ex11)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var fs = require('fs'); +var path = require('path'); +var uploadFile = require('upload-file'); +var uuidLib = require('node-uuid'); +var pdf = require('html-pdf'); +var spindrift = require('spindrift'); +var formidable = require('formidable'); +var exec = require('child_process').exec; +var config = require('../../config/environment'); + +var FaxMessage = require('../../models').FaxMessage; +var FaxRoom = require('../../models').FaxRoom; +var FaxAccount = require('../../models').FaxAccount; +var Contact = require('../../models').Contact; + +// Get list of fax_messages +exports.index = function(req, res) { + FaxMessage + .findAll({ + where: req.query, + order: 'createdAt DESC', + include: [{ + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }, { + model: FaxRoom, + include: [{ + model: FaxAccount + }] + }] + }) + .then(function(fax_messages) { + return res.status(200).send(fax_messages); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single fax_message +exports.show = function(req, res) { + FaxMessage + .findOne({ + where: { + id: req.params.id + }, + include: [{ + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }] + }) + .then(function(fax_message) { + if (!fax_message) { + return res.sendStatus(404); + } + return res.send(fax_message); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new fax_message in the DB. +exports.create = function(req, res, next) { + // FaxMessage + // .create(req.body) + // .then(function(fax_message) { + // return res.status(201).send(fax_message); + // }) + // .catch(function(err) { + // return handleError(res, err); + // }); + + var form = new formidable.IncomingForm(); + // form.encoding = 'utf-8'; + form.uploadDir = path.join(config.root, 'server/files/fax/outbound/original'); + form.keepExtensions = true; + form.multiples = false; + + if (req.body.onlyText) { + //There is not file, only text + // console.log(req.body); + if (req.body.html) { + //There is the html message -> convert + var uuid = uuidLib.v4() + var dest = path.join(config.root, 'server/files/fax/outbound/original', uuid + '.pdf'); + pdf.create(req.body.html, { + "timeout": 30000 + }).toFile(dest, function(err, result) { + console.log('Fax: HTML Converted'); + convertPdfAndSendFax(req, res, uuid, req.body); + }); + } + } else { + form.parse(req, function(err, fields, files) { + if (err) { + return handleError(res, err); + } + + if (fields.html) { + //There is HTML with PDF + var uuid = uuidLib.v4(); + var dest = path.join(config.root, 'server/files/fax/outbound/original', uuid + '.pdf'); + pdf.create(fields.html, { + "timeout": 30000 + }).toFile(dest, function(err, result) { + console.log('Fax: HTML Converted'); + var pdfHTML = spindrift(result.filename); + var pdfUploaded = spindrift(files.file.path); + var uuid = uuidLib.v4(); + spindrift.join(pdfHTML, pdfUploaded).pdfStream().pipe(fs.createWriteStream(path.join(config.root, 'server/files/fax/outbound/original', uuid + '.pdf'))); + console.log('Fax: HTML joined with PDF uploaded'); + convertPdfAndSendFax(req, res, uuid, fields); + }); + } else { + //There is only PDF + var uuid = uuidLib.v4(); + var dest = path.join(config.root, 'server/files/fax/outbound/original', uuid + '.pdf'); + fs.rename(files.file.path, dest, function(err) { + if (err) { + console.error(err); + return handleError(res, req); + // return next(err); + } + console.log('Fax: PDF Rename'); + convertPdfAndSendFax(req, res, uuid, fields); + }); + } + + }); + } +}; + +function convertPdfAndSendFax(req, res, filenameInput, fields) { + var inputPath = path.join(config.root, 'server', 'files', 'fax', 'outbound', 'original', filenameInput + '.pdf'); + var resultPath = path.join(config.root, 'server', 'files', 'fax', 'outbound', 'converted', filenameInput + '.tif'); + var command = 'gs' + ' -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 ' + '-sPAPERSIZE=letter -sOutputFile=' + resultPath + ' ' + inputPath; + // console.log(inputPath, resultPath, command); + + var uuidFax = uuidLib.v4(); + FaxAccount + .findById(fields.accountId) + .then(function(faxAccount) { + // console.log('FaxAccount', faxAccount); + + if (faxAccount) { + var faxBody = { + technology: 'SIP', + to: fields.toNum, + from: faxAccount.phone, + fax_file: resultPath, + fax_header: faxAccount.faxheader, + fax_localid: faxAccount.localid, + maxrate: faxAccount.maxrate, + minrate: faxAccount.minrate, + ecm: faxAccount.ecm, + uuid: uuidFax, + trunk: { + id: faxAccount.TrunkId + } + }; + + fs.exists(inputPath, function(exists) { + if (!exists) { + // console.log('File not exist'); + handleError(res, new Error('File not exists')); + } else { + exec(command, function(err) { + if (err) { + console.error(err); + handleError(res, err); + } else { + console.log('Fax: PDF converted to TIFF'); + fs.chmod(resultPath, 511, function(err) { + if (fields.roomId) { + // Room already exists -> create new message and associate + FaxRoom + .findOrCreate({ + where: { + id: fields.roomId + }, + defaults: {} + }) + .spread(function(faxRoom, created) { + // TODO Verify if we have to manage also the created + FaxMessage + .create({ + status: 'NOT SENT', + read: true, + filenamePDF: filenameInput + '.pdf', + filename: filenameInput + '.tif', + body: JSON.stringify(faxBody), + uuid: uuidFax, + FaxRoomId: faxRoom.id + }) + .then(function(faxMessage) { + // Fax message created, now association + Contact + .findOrCreate({ + where: { + phone: faxBody.from + }, + defaults: { + phone: faxBody.from, + fullname: faxBody.from + } + }) + .spread(function(contact, created) { + // console.log('Set relationship with from', created); + faxMessage.setFrom(contact); + }); + + Contact + .findOrCreate({ + where: { + phone: faxBody.to + }, + defaults: { + phone: faxBody.to, + fullname: faxBody.to + } + }) + .spread(function(contact, created) { + // console.log('Set relationship with to', created); + faxMessage.setTo(contact); + }); + + return res.status(200).send(faxMessage); + }) + .catch(function(err) { + handleError(res, err); + // console.error(err); + // next(err); + }); + }); + } else { + // Room not exists -> create room, message and associate + FaxRoom + .create({ + status: 'OPEN', + from: fields.toNum, + FaxAccountId: fields.accountId, + UserId: fields.userId + }) + .then(function(faxRoom) { + // Room created, now message + FaxMessage + .create({ + status: 'NOT SENT', + read: true, + filenamePDF: filenameInput + '.pdf', + filename: filenameInput + '.tif', + body: JSON.stringify(faxBody), + uuid: uuidFax, + FaxRoomId: faxRoom.id + }) + .then(function(faxMessage) { + // Fax message created, now association + + Contact + .findOrCreate({ + where: { + phone: faxBody.from + }, + defaults: { + phone: faxBody.from, + fullname: faxBody.from + } + }) + .spread(function(contact, created) { + faxMessage.setFrom(contact); + }); + + Contact + .findOrCreate({ + where: { + phone: faxBody.to + }, + defaults: { + phone: faxBody.to, + fullname: faxBody.to + } + }) + .spread(function(contact, created) { + faxMessage.setTo(contact); + }); + + return res.status(200).send( + faxMessage); + }) + .catch(function(err) { + handleError(res, err); + }); + }) + .catch(function(err) { + handleError(res, err); + }); + } + }); + } + }); + } + }); + } + }); +} + +// Updates an existing fax_message in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FaxMessage + .findOne({ + where: { + id: req.params.id + }, + include: [{ + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }] + }) + .then(function(fax_message) { + if (!fax_message) { + return res.sendStatus(404); + } + var updated = _.merge(fax_message, req.body); + updated.save() + .then(function() { + return res.status(200).send(fax_message); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a fax_message from the DB. +exports.destroy = function(req, res) { + FaxMessage + .find({ + where: { + id: req.params.id + } + }) + .then(function(fax_message) { + if (!fax_message) { + return res.sendStatus(404); + } + fax_message.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getContentFromMessage = function(req, res) { + + FaxMessage + .findById(req.params.id) + .then(function(fax_message) { + + // console.log(fax_message); + + if (!fax_message) { + return res.sendStatus(404); + } + + if (fax_message.filenamePDF) { + + if (fax_message.status === 'RECEIVED') { + var pdfPath = path.join(config.root, 'server', 'files', 'fax', 'inbound', fax_message.filenamePDF); + fs.exists(pdfPath, function(exists) { + if (exists) + return res.sendFile(pdfPath); + else + return res.sendStatus(404); + }); + } else if (fax_message.status === 'NOT SENT' || fax_message.directory === + 'SENT' || fax_message.status === 'FAILED') { + var pdfPath = path.join(config.root, 'server', 'files', 'fax', 'outbound', 'original', fax_message.filenamePDF); + fs.exists(pdfPath, function(exists) { + if (exists) + return res.sendFile(pdfPath); + else + return res.sendStatus(404); + }); + } + } else { + res.sendStatus(404); + } + + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/fax_message/fax_message.socket.js b/server/api/fax_message/fax_message.socket.js index 50a41de..79a31ad 100644 --- a/server/api/fax_message/fax_message.socket.js +++ b/server/api/fax_message/fax_message.socket.js @@ -1 +1,85 @@ -var _0x1d6e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x72\x65\x67\x69\x73\x74\x65\x72","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x69\x64","\x46\x72\x6F\x6D","\x54\x6F","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x75\x70\x64\x61\x74\x65","\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x1d6e[0];var FaxMessage=require(_0x1d6e[2])[_0x1d6e[1]];var Contact=require(_0x1d6e[2])[_0x1d6e[3]];var FaxRoom=require(_0x1d6e[2])[_0x1d6e[4]];var FaxAccount=require(_0x1d6e[2])[_0x1d6e[5]];exports[_0x1d6e[6]]=function(_0x325bx5){FaxMessage[_0x1d6e[14]](function(_0x325bx6){FaxMessage[_0x1d6e[13]]({where:{id:_0x325bx6[_0x1d6e[10]]},include:[{model:Contact,as:_0x1d6e[11]},{model:Contact,as:_0x1d6e[12]},{model:FaxRoom,include:[{model:FaxAccount}]}]})[_0x1d6e[9]](function(_0x325bx8){onSave(_0x325bx5,_0x325bx8)})[_0x1d6e[8]](function(_0x325bx7){console[_0x1d6e[7]](_0x325bx7)})});FaxMessage[_0x1d6e[15]](function(_0x325bx6){FaxMessage[_0x1d6e[13]]({where:{id:_0x325bx6[_0x1d6e[10]]},include:[{model:Contact,as:_0x1d6e[11]},{model:Contact,as:_0x1d6e[12]},{model:FaxRoom,include:[{model:FaxAccount}]}]})[_0x1d6e[9]](function(_0x325bx8){onSave(_0x325bx5,_0x325bx8);onUpdate(_0x325bx5,_0x325bx8)})[_0x1d6e[8]](function(_0x325bx7){console[_0x1d6e[7]](_0x325bx7)})});FaxMessage[_0x1d6e[16]](function(_0x325bx6){onRemove(_0x325bx5,_0x325bx6)})};function onSave(_0x325bx5,_0x325bx6,_0x325bxa){_0x325bx5[_0x1d6e[18]](_0x1d6e[17],_0x325bx6)}function onUpdate(_0x325bx5,_0x325bx6,_0x325bxa){_0x325bx5[_0x1d6e[18]](_0x1d6e[19],_0x325bx6)}function onRemove(_0x325bx5,_0x325bx6,_0x325bxa){_0x325bx5[_0x1d6e[18]](_0x1d6e[20],_0x325bx6)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var FaxMessage = require('../../models').FaxMessage; +var Contact = require('../../models').Contact; +var FaxRoom = require('../../models').FaxRoom; +var FaxAccount = require('../../models').FaxAccount; + +exports.register = function(socket) { + FaxMessage.afterCreate(function(doc) { + FaxMessage + .findOne({ + where: { + id: doc.id + }, + include: [{ + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }, { + model: FaxRoom, + include: [{ + model: FaxAccount + }] + }] + }) + .then(function(faxMessage) { + onSave(socket, faxMessage); + }) + .catch(function(err) { + console.error(err); + }); + }); + + FaxMessage.afterUpdate(function(doc) { + FaxMessage + .findOne({ + where: { + id: doc.id + }, + include: [{ + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }, { + model: FaxRoom, + include: [{ + model: FaxAccount + }] + }] + }) + .then(function(faxMessage) { + onSave(socket, faxMessage); + onUpdate(socket, faxMessage); + }) + .catch(function(err) { + console.error(err); + }); + }); + + FaxMessage.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('fax_message:save', doc); + // socket.emit('fax_message:' + doc.directory + ':save', doc); +} + +function onUpdate(socket, doc, cb) { + socket.emit('fax_message:update', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('fax_message:remove', doc); + // socket.emit('fax_message:' + doc.directory + ':remove', doc); +} diff --git a/server/api/fax_message/fax_message.spec.js b/server/api/fax_message/fax_message.spec.js index ceae706..d61f66e 100644 --- a/server/api/fax_message/fax_message.spec.js +++ b/server/api/fax_message/fax_message.spec.js @@ -1 +1,20 @@ -var _0x6888=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x67\x65\x74"];_0x6888[0];var should=require(_0x6888[1]);var app=require(_0x6888[2]);var request=require(_0x6888[3]);describe(_0x6888[4],function(){it(_0x6888[5],function(_0x2780x4){request(app)[_0x6888[13]](_0x6888[12])[_0x6888[11]](200)[_0x6888[11]](_0x6888[10],/json/)[_0x6888[9]](function(_0x2780x5,_0x2780x6){if(_0x2780x5){return _0x2780x4(_0x2780x5)};_0x2780x6[_0x6888[8]][_0x6888[1]][_0x6888[7]][_0x6888[6]](Array);_0x2780x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/messages', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/messages') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/fax_message/index.js b/server/api/fax_message/index.js index 802fd3e..b237a79 100644 --- a/server/api/fax_message/index.js +++ b/server/api/fax_message/index.js @@ -1 +1,16 @@ -var _0xd909=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x74\x65\x6E\x74","\x67\x65\x74\x43\x6F\x6E\x74\x65\x6E\x74\x46\x72\x6F\x6D\x4D\x65\x73\x73\x61\x67\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd909[0];var express=require(_0xd909[1]);var controller=require(_0xd909[2]);var router=express.Router();router[_0xd909[5]](_0xd909[3],controller[_0xd909[4]]);router[_0xd909[5]](_0xd909[6],controller[_0xd909[7]]);router[_0xd909[5]](_0xd909[8],controller[_0xd909[9]]);router[_0xd909[11]](_0xd909[3],controller[_0xd909[10]]);router[_0xd909[13]](_0xd909[8],controller[_0xd909[12]]);router[_0xd909[14]](_0xd909[8],controller[_0xd909[12]]);router[_0xd909[16]](_0xd909[8],controller[_0xd909[15]]);module[_0xd909[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./fax_message.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id/content', controller.getContentFromMessage); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/fax_queue/fax_queue.controller.js b/server/api/fax_queue/fax_queue.controller.js index 01fa25b..65cffaf 100644 --- a/server/api/fax_queue/fax_queue.controller.js +++ b/server/api/fax_queue/fax_queue.controller.js @@ -1 +1,185 @@ -var _0xa5d6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x46\x61\x78\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x6E\x61\x6D\x65","\x61\x64\x64\x55\x73\x65\x72\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xa5d6[0];var _=require(_0xa5d6[1]);var Util=require(_0xa5d6[2]);var FaxQueue=require(_0xa5d6[4])[_0xa5d6[3]];exports[_0xa5d6[5]]=function(_0x2e0ax4,_0x2e0ax5){return FaxQueue[_0xa5d6[12]](Util[_0xa5d6[11]](_0x2e0ax4[_0xa5d6[10]]))[_0xa5d6[9]](function(_0x2e0ax7){_0x2e0ax5[_0xa5d6[8]](200)[_0xa5d6[7]](_0x2e0ax7)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[13]]=function(_0x2e0ax4,_0x2e0ax5){FaxQueue[_0xa5d6[17]](_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]])[_0xa5d6[9]](function(_0x2e0ax8){if(!_0x2e0ax8){return _0x2e0ax5[_0xa5d6[14]](404)};return _0x2e0ax5[_0xa5d6[7]](_0x2e0ax8)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[18]]=function(_0x2e0ax4,_0x2e0ax5){FaxQueue[_0xa5d6[18]](_0x2e0ax4[_0xa5d6[19]])[_0xa5d6[9]](function(_0x2e0ax8){return _0x2e0ax5[_0xa5d6[8]](201)[_0xa5d6[7]](_0x2e0ax8)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[20]]=function(_0x2e0ax4,_0x2e0ax5){if(_0x2e0ax4[_0xa5d6[19]][_0xa5d6[15]]){delete _0x2e0ax4[_0xa5d6[19]][_0xa5d6[15]]};FaxQueue[_0xa5d6[23]]({where:{id:_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]]}})[_0xa5d6[9]](function(_0x2e0ax8){if(!_0x2e0ax8){return _0x2e0ax5[_0xa5d6[14]](404)};var _0x2e0ax9=_[_0xa5d6[21]](_0x2e0ax8,_0x2e0ax4[_0xa5d6[19]]);_0x2e0ax9[_0xa5d6[22]]()[_0xa5d6[9]](function(){return _0x2e0ax5[_0xa5d6[8]](200)[_0xa5d6[7]](_0x2e0ax8)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[24]]=function(_0x2e0ax4,_0x2e0ax5){FaxQueue[_0xa5d6[23]]({where:{id:_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]]}})[_0xa5d6[9]](function(_0x2e0ax8){if(!_0x2e0ax8){return _0x2e0ax5[_0xa5d6[14]](404)};_0x2e0ax8[_0xa5d6[24]]()[_0xa5d6[9]](function(){return _0x2e0ax5[_0xa5d6[14]](204)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[25]]=function(_0x2e0ax4,_0x2e0ax5,_0x2e0axa){return FaxQueue[_0xa5d6[17]](_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]])[_0xa5d6[9]](function(_0x2e0axb){if(!_0x2e0axb){return _0x2e0ax5[_0xa5d6[14]](404)};return _0x2e0axb[_0xa5d6[29]](_0x2e0ax4[_0xa5d6[19]][_0xa5d6[26]],{penalty:_0x2e0ax4[_0xa5d6[19]][_0xa5d6[27]],queue:_0x2e0axb[_0xa5d6[28]]},{individualHooks:true})})[_0xa5d6[9]](function(){return _0x2e0ax5[_0xa5d6[14]](200)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[30]]=function(_0x2e0ax4,_0x2e0ax5){return FaxQueue[_0xa5d6[17]](_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]])[_0xa5d6[9]](function(_0x2e0axd){if(!_0x2e0axd){return _0x2e0ax5[_0xa5d6[14]](404)};return _0x2e0axd[_0xa5d6[34]]({where:{role:_0xa5d6[31]},attributes:[_0xa5d6[15],_0xa5d6[28],_0xa5d6[32],_0xa5d6[33]]})})[_0xa5d6[9]](function(_0x2e0axc){return _0x2e0ax5[_0xa5d6[8]](200)[_0xa5d6[7]](_0x2e0axc)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};exports[_0xa5d6[35]]=function(_0x2e0ax4,_0x2e0ax5,_0x2e0axa){return FaxQueue[_0xa5d6[17]](_0x2e0ax4[_0xa5d6[16]][_0xa5d6[15]])[_0xa5d6[9]](function(_0x2e0axd){if(!_0x2e0axd){return _0x2e0ax5[_0xa5d6[14]](404)};return _0x2e0axd[_0xa5d6[36]](_0x2e0ax4[_0xa5d6[10]][_0xa5d6[26]])})[_0xa5d6[9]](function(){return _0x2e0ax5[_0xa5d6[14]](202)})[_0xa5d6[6]](function(_0x2e0ax6){return _0x2e0axa(_0x2e0ax6)})};exports[_0xa5d6[37]]=function(_0x2e0ax4,_0x2e0ax5){FaxQueue[_0xa5d6[24]]({where:{id:_0x2e0ax4[_0xa5d6[10]][_0xa5d6[38]]},individualHooks:true})[_0xa5d6[9]](function(){return _0x2e0ax5[_0xa5d6[14]](204)})[_0xa5d6[6]](function(_0x2e0ax6){return handleError(_0x2e0ax5,_0x2e0ax6)})};function handleError(_0x2e0ax5,_0x2e0ax6){return _0x2e0ax5[_0xa5d6[8]](500)[_0xa5d6[7]](_0x2e0ax6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var FaxQueue = require('../../models').FaxQueue; + +// Get list of fax_queues +exports.index = function(req, res) { + return FaxQueue + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single fax_queue +exports.show = function(req, res) { + FaxQueue + .findById(req.params.id) + .then(function(fax_queue) { + if (!fax_queue) { + return res.sendStatus(404); + } + return res.send(fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new fax_queue in the DB. +exports.create = function(req, res) { + FaxQueue + .create(req.body) + .then(function(fax_queue) { + return res.status(201).send(fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing fax_queue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FaxQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(fax_queue) { + if (!fax_queue) { + return res.sendStatus(404); + } + var updated = _.merge(fax_queue, req.body); + updated.save() + .then(function() { + return res.status(200).send(fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a fax_queue from the DB. +exports.destroy = function(req, res) { + FaxQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(fax_queue) { + if (!fax_queue) { + return res.sendStatus(404); + } + fax_queue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.addAgents = function(req, res, next) { + + return FaxQueue + .findById(req.params.id) + .then(function(faxQueue) { + if (!faxQueue) { + return res.sendStatus(404); + } + return faxQueue + .addUsers(req.body.agents, { + penalty: req.body.penalty, + queue: faxQueue.name + }, { + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.showAgents = function(req, res) { + return FaxQueue + .findById(req.params.id) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .getUsers({ + where: { + role: 'agent' + }, + attributes: ['id', 'name', 'fullname', 'email'] + }); + }) + .then(function(agents) { + return res.status(200).send(agents); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.removeAgents = function(req, res, next) { + return FaxQueue + .findById(req.params.id) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .removeUser(req.query.agents); + }) + .then(function() { + return res.sendStatus(202); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + FaxQueue + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/fax_queue/fax_queue.socket.js b/server/api/fax_queue/fax_queue.socket.js index fac783d..243ed07 100644 --- a/server/api/fax_queue/fax_queue.socket.js +++ b/server/api/fax_queue/fax_queue.socket.js @@ -1 +1,24 @@ -var _0x8dc9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x61\x78\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8dc9[0];var fax_queue=require(_0x8dc9[2])[_0x8dc9[1]];exports[_0x8dc9[3]]=function(_0x9f37x2){fax_queue[_0x8dc9[4]](function(_0x9f37x3){onSave(_0x9f37x2,_0x9f37x3)});fax_queue[_0x8dc9[5]](function(_0x9f37x3){onRemove(_0x9f37x2,_0x9f37x3)})};function onSave(_0x9f37x2,_0x9f37x3,_0x9f37x5){_0x9f37x2[_0x8dc9[7]](_0x8dc9[6],_0x9f37x3)}function onRemove(_0x9f37x2,_0x9f37x3,_0x9f37x5){_0x9f37x2[_0x8dc9[7]](_0x8dc9[8],_0x9f37x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var fax_queue = require('../../models').FaxQueue; + +exports.register = function(socket) { + fax_queue.afterCreate(function (doc) { + onSave(socket, doc); + }); + fax_queue.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('fax_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('fax_queue:remove', doc); +} diff --git a/server/api/fax_queue/fax_queue.spec.js b/server/api/fax_queue/fax_queue.spec.js index 971d412..9148967 100644 --- a/server/api/fax_queue/fax_queue.spec.js +++ b/server/api/fax_queue/fax_queue.spec.js @@ -1 +1,20 @@ -var _0x52e0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x71\x75\x65\x75\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x71\x75\x65\x75\x65\x73","\x67\x65\x74"];_0x52e0[0];var should=require(_0x52e0[1]);var app=require(_0x52e0[2]);var request=require(_0x52e0[3]);describe(_0x52e0[4],function(){it(_0x52e0[5],function(_0xdcccx4){request(app)[_0x52e0[13]](_0x52e0[12])[_0x52e0[11]](200)[_0x52e0[11]](_0x52e0[10],/json/)[_0x52e0[9]](function(_0xdcccx5,_0xdcccx6){if(_0xdcccx5){return _0xdcccx4(_0xdcccx5)};_0xdcccx6[_0x52e0[8]][_0x52e0[1]][_0x52e0[7]][_0x52e0[6]](Array);_0xdcccx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/queues', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/queues') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/fax_queue/index.js b/server/api/fax_queue/index.js index 2e2bc22..9f1fac3 100644 --- a/server/api/fax_queue/index.js +++ b/server/api/fax_queue/index.js @@ -1 +1,20 @@ -var _0x724a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x65\x78\x70\x6F\x72\x74\x73"];_0x724a[0];var express=require(_0x724a[1]);var controller=require(_0x724a[2]);var auth=require(_0x724a[3]);var router=express.Router();router[_0x724a[7]](_0x724a[4],auth[_0x724a[5]](),controller[_0x724a[6]]);router[_0x724a[7]](_0x724a[8],auth[_0x724a[5]](),controller[_0x724a[9]]);router[_0x724a[7]](_0x724a[10],auth[_0x724a[5]](),controller[_0x724a[11]]);router[_0x724a[13]](_0x724a[4],auth[_0x724a[5]](),controller[_0x724a[12]]);router[_0x724a[13]](_0x724a[10],auth[_0x724a[5]](),controller[_0x724a[14]]);router[_0x724a[16]](_0x724a[8],auth[_0x724a[5]](),controller[_0x724a[15]]);router[_0x724a[17]](_0x724a[8],auth[_0x724a[5]](),controller[_0x724a[15]]);router[_0x724a[19]](_0x724a[4],auth[_0x724a[5]](),controller[_0x724a[18]]);router[_0x724a[19]](_0x724a[8],auth[_0x724a[5]](),controller[_0x724a[20]]);router[_0x724a[19]](_0x724a[10],auth[_0x724a[5]](),controller[_0x724a[21]]);module[_0x724a[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./fax_queue.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/agents', auth.isAuthenticated(), controller.showAgents); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/agents', auth.isAuthenticated(), controller.addAgents); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/agents', auth.isAuthenticated(), controller.removeAgents); + +module.exports = router; diff --git a/server/api/fax_room/fax_room.controller.js b/server/api/fax_room/fax_room.controller.js index 325a9de..a139fd5 100644 --- a/server/api/fax_room/fax_room.controller.js +++ b/server/api/fax_room/fax_room.controller.js @@ -1 +1,151 @@ -var _0xb557=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x46\x61\x78\x52\x6F\x6F\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x43\x6F\x6E\x74\x61\x63\x74","\x55\x73\x65\x72","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x70\x61\x72\x61\x6D\x73","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x46\x72\x6F\x6D","\x54\x6F","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0xb557[0];var _=require(_0xb557[1]);var FaxRoom=require(_0xb557[3])[_0xb557[2]];var FaxAccount=require(_0xb557[3])[_0xb557[4]];var FaxMessage=require(_0xb557[3])[_0xb557[5]];var Contact=require(_0xb557[3])[_0xb557[6]];var User=require(_0xb557[3])[_0xb557[7]];exports[_0xb557[8]]=function(_0x57f7x7,_0x57f7x8){FaxRoom[_0xb557[14]]({include:[{model:FaxMessage,attributes:[_0xb557[13]]},{model:FaxAccount},{model:User}]})[_0xb557[12]](function(_0x57f7xa){return _0x57f7x8[_0xb557[11]](200)[_0xb557[10]](_0x57f7xa)})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})};exports[_0xb557[15]]=function(_0x57f7x7,_0x57f7x8,_0x57f7xb){FaxRoom[_0xb557[14]]({where:{UserId:_0x57f7x7[_0xb557[16]][_0xb557[13]]},include:[{model:FaxAccount},{model:User}]})[_0xb557[12]](function(_0x57f7xc){return _0x57f7x8[_0xb557[11]](200)[_0xb557[10]](_0x57f7xc)})[_0xb557[9]](function(_0x57f7x9){return _0x57f7xb(_0x57f7x9)})};exports[_0xb557[17]]=function(_0x57f7x7,_0x57f7x8){FaxRoom[_0xb557[23]]({where:{id:_0x57f7x7[_0xb557[16]][_0xb557[13]]},include:[{model:FaxMessage,include:[{model:FaxRoom,include:[{model:FaxAccount}]},{model:Contact,as:_0xb557[19]},{model:Contact,as:_0xb557[20]}]},{model:FaxAccount}],order:[[FaxMessage,_0xb557[21],_0xb557[22]]]})[_0xb557[12]](function(_0x57f7xd){if(!_0x57f7xd){return _0x57f7x8[_0xb557[18]](404)};return _0x57f7x8[_0xb557[10]](_0x57f7xd)})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})};exports[_0xb557[24]]=function(_0x57f7x7,_0x57f7x8){FaxRoom[_0xb557[24]](_0x57f7x7[_0xb557[25]])[_0xb557[12]](function(_0x57f7xd){return _0x57f7x8[_0xb557[11]](201)[_0xb557[10]](_0x57f7xd)})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})};exports[_0xb557[26]]=function(_0x57f7x7,_0x57f7x8){FaxRoom[_0xb557[29]](_0x57f7x7[_0xb557[16]][_0xb557[13]])[_0xb557[12]](function(_0x57f7xd){if(!_0x57f7xd){return _0x57f7x8[_0xb557[18]](404)};var _0x57f7xe=_[_0xb557[27]](_0x57f7xd,_0x57f7x7[_0xb557[25]]);_0x57f7xe[_0xb557[28]]()[_0xb557[12]](function(){return _0x57f7x8[_0xb557[11]](200)[_0xb557[10]](_0x57f7xd)})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})};exports[_0xb557[30]]=function(_0x57f7x7,_0x57f7x8){FaxRoom[_0xb557[29]](_0x57f7x7[_0xb557[16]][_0xb557[13]])[_0xb557[12]](function(_0x57f7xd){if(!_0x57f7xd){return _0x57f7x8[_0xb557[18]](404)};_0x57f7xd[_0xb557[30]]()[_0xb557[12]](function(){return _0x57f7x8[_0xb557[18]](204)})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})})[_0xb557[9]](function(_0x57f7x9){return handleError(_0x57f7x8,_0x57f7x9)})};function handleError(_0x57f7x8,_0x57f7x9){return _0x57f7x8[_0xb557[11]](500)[_0xb557[10]](_0x57f7x9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var FaxRoom = require('../../models').FaxRoom; +var FaxAccount = require('../../models').FaxAccount; +var FaxMessage = require('../../models').FaxMessage; +var Contact = require('../../models').Contact; +var User = require('../../models').User; + +// Get list of fax_rooms +exports.index = function(req, res) { + FaxRoom + .findAll({ + include: [{ + model: FaxMessage, + attributes: ['id'] + }, { + model: FaxAccount + }, { + model: User + }] + }) + .then(function(fax_rooms) { + return res.status(200).send(fax_rooms); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of agent mailRooms +exports.agentIndex = function(req, res, next) { + FaxRoom + .findAll({ + where: { + UserId: req.params.id + }, + include: [{ + model: FaxAccount + }, { + model: User + }] + }) + .then(function(faxRooms) { + return res.status(200).send(faxRooms); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Get a single fax_room +exports.show = function(req, res) { + FaxRoom + .findOne({ + where: { + id: req.params.id + }, + include: [{ + model: FaxMessage, + include: [{ + model: FaxRoom, + include: [{ + model: FaxAccount + }] + }, { + model: Contact, + as: 'From' + }, { + model: Contact, + as: 'To' + }] + }, { + model: FaxAccount + }], + order: [ + [FaxMessage, 'createdAt', 'DESC'] + ] + }) + .then(function(fax_room) { + if (!fax_room) { + return res.sendStatus(404); + } + return res.send(fax_room); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new fax_room in the DB. +exports.create = function(req, res) { + FaxRoom + .create(req.body) + .then(function(fax_room) { + return res.status(201).send(fax_room); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing fax_room in the DB. +exports.update = function(req, res) { + // if (req.body.id) { + // delete req.body.id; + // } + FaxRoom + .findById(req.params.id) + .then(function(fax_room) { + if (!fax_room) { + return res.sendStatus(404); + } + var updated = _.merge(fax_room, req.body); + updated.save() + .then(function() { + return res.status(200).send(fax_room); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a fax_room from the DB. +exports.destroy = function(req, res) { + FaxRoom + .findById(req.params.id) + .then(function(fax_room) { + if (!fax_room) { + return res.sendStatus(404); + } + fax_room.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/fax_room/fax_room.kue.js b/server/api/fax_room/fax_room.kue.js index 28a931a..ba9c227 100644 --- a/server/api/fax_room/fax_room.kue.js +++ b/server/api/fax_room/fax_room.kue.js @@ -1 +1,64 @@ -var _0xe219=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x51\x75\x65\x75\x65","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x4E\x45\x57","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x46\x41\x58","\x66\x72\x6F\x6D","\x73\x61\x76\x65","\x66\x61\x78","\x63\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x73\x74\x72\x61\x74\x65\x67\x79","\x74\x69\x6D\x65\x6F\x75\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x67\x65\x74\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0xe219[0];var User=require(_0xe219[2])[_0xe219[1]];var FaxRoom=require(_0xe219[2])[_0xe219[3]];var FaxQueue=require(_0xe219[2])[_0xe219[4]];var FaxAccount=require(_0xe219[2])[_0xe219[5]];var FaxApplication=require(_0xe219[2])[_0xe219[6]];exports[_0xe219[7]]=function(_0x314cx6){FaxRoom[_0xe219[8]](function(_0x314cx7){onSave(_0x314cx6,_0x314cx7)})};function onSave(_0x314cx6,_0x314cx7,_0x314cx9){if(_0x314cx7[_0xe219[9]]===_0xe219[10]){FaxAccount[_0xe219[25]](_0x314cx7.FaxAccountId)[_0xe219[20]](function(_0x314cxb){_0x314cxb[_0xe219[24]]({include:[{model:User,attributes:[_0xe219[13]]},{model:FaxQueue,attributes:[_0xe219[13],_0xe219[21],_0xe219[22]],include:{model:User,attributes:[_0xe219[13]]}}],order:[[_0xe219[23]]]})[_0xe219[20]](function(_0x314cxc){var _0x314cxd={roomId:_0x314cx7[_0xe219[13]],accountId:_0x314cx7[_0xe219[14]],channel:_0xe219[15],msg:{from:_0x314cx7[_0xe219[16]]},applications:_0x314cxc};_0x314cx6[_0xe219[19]](_0xe219[18],_0x314cxd)[_0xe219[17]]()})[_0xe219[12]](function(_0x314cxa){console[_0xe219[11]](_0x314cxa)})})[_0xe219[12]](function(_0x314cxa){console[_0xe219[11]](_0x314cxa)})}} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var User = require('../../models').User; +var FaxRoom = require('../../models').FaxRoom; +var FaxQueue = require('../../models').FaxQueue; +var FaxAccount = require('../../models').FaxAccount; +var FaxApplication = require('../../models').FaxApplication; + +exports.register = function(queue) { + FaxRoom.afterCreate(function(doc) { + onSave(queue, doc); + }); +} + +function onSave(queue, doc, cb) { + if (doc.status === 'NEW') { + FaxAccount + .findById(doc.FaxAccountId) + .then(function(faxAccount) { + faxAccount + .getFaxApplications({ + include: [{ + model: User, + attributes: ['id'] + }, { + model: FaxQueue, + attributes: ['id', 'strategy', 'timeout'], + include: { + model: User, + attributes: ['id'] + } + }], + order: [ + ['priority'] + ] + }) + .then(function(faxApplications) { + + var data = { + roomId: doc.id, + accountId: doc.FaxAccountId, + channel: 'FAX', + msg: { + from: doc.from + }, + applications: faxApplications + }; + + // Create queue process + queue.create('fax', data).save(); + }) + .catch(function(err) { + console.error(err); + }); + }) + .catch(function(err) { + console.error(err); + }); + } +} diff --git a/server/api/fax_room/fax_room.socket.js b/server/api/fax_room/fax_room.socket.js index 36f650a..92f71b0 100644 --- a/server/api/fax_room/fax_room.socket.js +++ b/server/api/fax_room/fax_room.socket.js @@ -1 +1,24 @@ -var _0x4223=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x61\x78\x52\x6F\x6F\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0x4223[0];var fax_room=require(_0x4223[2])[_0x4223[1]];exports[_0x4223[3]]=function(_0xe419x2){fax_room[_0x4223[4]](function(_0xe419x3){onSave(_0xe419x2,_0xe419x3)});fax_room[_0x4223[5]](function(_0xe419x3){onRemove(_0xe419x2,_0xe419x3)})};function onSave(_0xe419x2,_0xe419x3,_0xe419x5){_0xe419x2[_0x4223[7]](_0x4223[6],_0xe419x3)}function onRemove(_0xe419x2,_0xe419x3,_0xe419x5){_0xe419x2[_0x4223[7]](_0x4223[8],_0xe419x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var fax_room = require('../../models').FaxRoom; + +exports.register = function(socket) { + fax_room.afterCreate(function (doc) { + onSave(socket, doc); + }); + fax_room.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('fax_room:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('fax_room:remove', doc); +} diff --git a/server/api/fax_room/fax_room.spec.js b/server/api/fax_room/fax_room.spec.js index 2315f6e..1a5ae47 100644 --- a/server/api/fax_room/fax_room.spec.js +++ b/server/api/fax_room/fax_room.spec.js @@ -1 +1,20 @@ -var _0xe605=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x72\x6F\x6F\x6D\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x72\x6F\x6F\x6D\x73","\x67\x65\x74"];_0xe605[0];var should=require(_0xe605[1]);var app=require(_0xe605[2]);var request=require(_0xe605[3]);describe(_0xe605[4],function(){it(_0xe605[5],function(_0xde6fx4){request(app)[_0xe605[13]](_0xe605[12])[_0xe605[11]](200)[_0xe605[11]](_0xe605[10],/json/)[_0xe605[9]](function(_0xde6fx5,_0xde6fx6){if(_0xde6fx5){return _0xde6fx4(_0xde6fx5)};_0xde6fx6[_0xe605[8]][_0xe605[1]][_0xe605[7]][_0xe605[6]](Array);_0xde6fx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/rooms', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/rooms') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/fax_room/index.js b/server/api/fax_room/index.js index 0cfaec0..73e938a 100644 --- a/server/api/fax_room/index.js +++ b/server/api/fax_room/index.js @@ -1 +1,17 @@ -var _0xf29a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x68\x61\x73\x46\x61\x78","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x61\x67\x65\x6E\x74\x2F\x3A\x69\x64","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xf29a[0];var express=require(_0xf29a[1]);var controller=require(_0xf29a[2]);var license=require(_0xf29a[3]);var router=express.Router();router[_0xf29a[8]](_0xf29a[4],license[_0xf29a[5]](),license[_0xf29a[6]](),controller[_0xf29a[7]]);router[_0xf29a[8]](_0xf29a[9],controller[_0xf29a[10]]);router[_0xf29a[8]](_0xf29a[11],controller[_0xf29a[12]]);router[_0xf29a[14]](_0xf29a[4],controller[_0xf29a[13]]);router[_0xf29a[16]](_0xf29a[11],controller[_0xf29a[15]]);router[_0xf29a[17]](_0xf29a[11],controller[_0xf29a[15]]);router[_0xf29a[19]](_0xf29a[11],controller[_0xf29a[18]]);module[_0xf29a[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./fax_room.controller'); +var license = require('../../config/license/license.service'); + +var router = express.Router(); + +router.get('/', license.isValidDate(), license.hasFax(), controller.index); +router.get('/agent/:id', controller.agentIndex); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/freshdesk_account/freshdesk_account.controller.js b/server/api/freshdesk_account/freshdesk_account.controller.js index ddfe36a..ae9ab8a 100644 --- a/server/api/freshdesk_account/freshdesk_account.controller.js +++ b/server/api/freshdesk_account/freshdesk_account.controller.js @@ -1 +1,239 @@ -var _0x95bf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x66\x72\x65\x73\x68\x64\x65\x73\x6B","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x61\x70\x69\x4B\x65\x79","\x70\x61\x72\x73\x65","\x72\x65\x71\x75\x69\x72\x65\x5F\x6C\x6F\x67\x69\x6E","\x6C\x69\x73\x74\x54\x69\x63\x6B\x65\x74\x73","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x74\x69\x63\x6B\x65\x74\x5F\x66\x69\x65\x6C\x64\x73\x2E\x6A\x73\x6F\x6E","\x67\x65\x74"];_0x95bf[0];var _=require(_0x95bf[1]);var util=require(_0x95bf[2]);var _fd=require(_0x95bf[3]);var FreshdeskAccount=require(_0x95bf[5])[_0x95bf[4]];function handleError(_0xb672x6,_0xb672x7){_0xb672x7=_0xb672x7||500;return function(_0xb672x8){_0xb672x6[_0x95bf[7]](_0xb672x7)[_0x95bf[6]](_0xb672x8)}}function responseWithResult(_0xb672x6,_0xb672x7){_0xb672x7=_0xb672x7||200;return function(_0xb672xa){if(_0xb672xa){_0xb672x6[_0x95bf[7]](_0xb672x7)[_0x95bf[8]](_0xb672xa)}}}function handleEntityNotFound(_0xb672x6){return function(_0xb672xa){if(!_0xb672xa){_0xb672x6[_0x95bf[7]](404)[_0x95bf[9]]();return null};return _0xb672xa}}function saveUpdates(_0xb672xd){return function(_0xb672xa){return _0xb672xa[_0x95bf[11]](_0xb672xd)[_0x95bf[10]](function(_0xb672xe){return _0xb672xe})}}function removeEntity(_0xb672x6){return function(_0xb672xa){if(_0xb672xa){return _0xb672xa[_0x95bf[12]]()[_0x95bf[10]](function(){_0xb672x6[_0x95bf[7]](204)[_0x95bf[9]]()})}}}exports[_0x95bf[13]]=function(_0xb672x10,_0xb672x6){var _0xb672x11=[_0x95bf[14],_0x95bf[15],_0x95bf[16],_0x95bf[17]];var _0xb672x12=_0xb672x10[_0x95bf[19]][_0x95bf[18]]?parseInt(_0xb672x10[_0x95bf[19]][_0x95bf[18]],10):100;var _0xb672x13=_0xb672x10[_0x95bf[19]][_0x95bf[20]]?parseInt(_0xb672x10[_0x95bf[19]][_0x95bf[20]],10):0;var _0xb672x14={where:{},limit:_0xb672x12,offset:_0xb672x13*_0xb672x12};_[_0x95bf[34]](_0xb672x10[_0x95bf[19]],function(_0xb672x15,_0xb672x16){switch(_0xb672x16){case _0x95bf[18]:;case _0x95bf[20]:break;case _0x95bf[23]:_0xb672x14[_0x95bf[21]]=util[_0x95bf[26]](_0x95bf[22],_0xb672x10[_0x95bf[19]][_0x95bf[23]],_0xb672x10[_0x95bf[19]][_0x95bf[24]]||_0x95bf[25])||null;break;case _0x95bf[24]:break;case _0x95bf[32]:_0xb672x14[_0x95bf[28]][_0x95bf[27]]=[];_0xb672x11[_0x95bf[31]](function(_0xb672x17){var _0xb672x18={};_0xb672x18[_0xb672x17]={$like:_0x95bf[29]+_0xb672x15+_0x95bf[29]};_0xb672x14[_0x95bf[28]][_0x95bf[27]][_0x95bf[30]](_0xb672x18)});break;default:_0xb672x14[_0x95bf[28]][_0xb672x16]={$like:{}};_0xb672x14[_0x95bf[28]][_0xb672x16][_0x95bf[33]]=_0x95bf[29]+_0xb672x15+_0x95bf[29]}});FreshdeskAccount[_0x95bf[46]](_0xb672x14)[_0x95bf[10]](function(_0xb672x19){var _0xb672x1a=Math[_0x95bf[38]](_0xb672x19[_0x95bf[37]]/_0xb672x12);var _0xb672x1b=_0xb672x1a>(_0xb672x14[_0x95bf[39]]+1)?util[_0x95bf[26]](_0x95bf[40],_0xb672x10[_0x95bf[41]],_0xb672x10[_0x95bf[43]][_0x95bf[42]],_0xb672x10[_0x95bf[44]],_0xb672x13+1):null;var _0xb672x1c=_0xb672x13>0?util[_0x95bf[26]](_0x95bf[40],_0xb672x10[_0x95bf[41]],_0xb672x10[_0x95bf[43]][_0x95bf[42]],_0xb672x10[_0x95bf[44]],_0xb672x13-1):null;return _0xb672x6[_0x95bf[7]](200)[_0x95bf[6]]({count:_0xb672x19[_0x95bf[37]],rows:_0xb672x19[_0x95bf[45]],next_page:_0xb672x1b,previous_page:_0xb672x1c,total_pages:_0xb672x1a})})[_0x95bf[36]](function(_0xb672x8){return _0xb672x6[_0x95bf[7]](500)[_0x95bf[6]]({error:_0x95bf[35]})})};exports[_0x95bf[47]]=function(_0xb672x10,_0xb672x6){FreshdeskAccount[_0x95bf[50]](_0xb672x10[_0x95bf[49]][_0x95bf[48]])[_0x95bf[10]](handleEntityNotFound(_0xb672x6))[_0x95bf[10]](responseWithResult(_0xb672x6))[_0x95bf[36]](handleError(_0xb672x6))};exports[_0x95bf[51]]=function(_0xb672x10,_0xb672x6){FreshdeskAccount[_0x95bf[51]](_0xb672x10[_0x95bf[52]])[_0x95bf[10]](responseWithResult(_0xb672x6,201))[_0x95bf[36]](handleError(_0xb672x6))};exports[_0x95bf[53]]=function(_0xb672x10,_0xb672x6){if(_0xb672x10[_0x95bf[52]][_0x95bf[48]]){delete _0xb672x10[_0x95bf[52]][_0x95bf[48]]};FreshdeskAccount[_0x95bf[50]](_0xb672x10[_0x95bf[49]][_0x95bf[48]])[_0x95bf[10]](handleEntityNotFound(_0xb672x6))[_0x95bf[10]](saveUpdates(_0xb672x10[_0x95bf[52]]))[_0x95bf[10]](responseWithResult(_0xb672x6))[_0x95bf[36]](handleError(_0xb672x6))};exports[_0x95bf[12]]=function(_0xb672x10,_0xb672x6){FreshdeskAccount[_0x95bf[50]](_0xb672x10[_0x95bf[49]][_0x95bf[48]])[_0x95bf[10]](handleEntityNotFound(_0xb672x6))[_0x95bf[10]](removeEntity(_0xb672x6))[_0x95bf[36]](handleError(_0xb672x6))};exports[_0x95bf[54]]=function(_0xb672x10,_0xb672x6){FreshdeskAccount[_0x95bf[12]]({where:{id:_0xb672x10[_0x95bf[19]][_0x95bf[48]]},individualHooks:true})[_0x95bf[10]](function(){return _0xb672x6[_0x95bf[55]](204)})[_0x95bf[36]](function(_0xb672x8){return handleError(_0xb672x6,_0xb672x8)})};exports[_0x95bf[56]]=function(_0xb672x10,_0xb672x6){FreshdeskAccount[_0x95bf[50]](_0xb672x10[_0x95bf[49]][_0x95bf[48]])[_0x95bf[10]](handleEntityNotFound(_0xb672x6))[_0x95bf[10]](function(_0xb672x1d){var _0xb672x1e= new _fd(_0xb672x1d[_0x95bf[17]],_0xb672x1d[_0x95bf[57]]);_0xb672x1e[_0x95bf[60]](function(_0xb672x8,_0xb672x1f,_0xb672x20){if(_0xb672x8){return _0xb672x6[_0x95bf[55]](400)};_0xb672x20=JSON[_0x95bf[58]](_0xb672x20);if(_0xb672x20[_0x95bf[59]]){return _0xb672x6[_0x95bf[55]](400)};return _0xb672x6[_0x95bf[55]](200)})})[_0x95bf[36]](handleError(_0xb672x6))};exports[_0x95bf[61]]=function(_0xb672x10,_0xb672x6){var _0xb672x21={};_0xb672x21[_0xb672x10[_0x95bf[49]][_0x95bf[62]]]=_0xb672x10[_0x95bf[52]][_0x95bf[63]];FreshdeskAccount[_0x95bf[46]]({where:_0xb672x21})[_0x95bf[10]](function(_0xb672x19){if(_0xb672x19[_0x95bf[37]]){return _0xb672x6[_0x95bf[7]](200)[_0x95bf[6]]({isValid:false,value:_0xb672x10[_0x95bf[52]][_0x95bf[63]]})};return _0xb672x6[_0x95bf[7]](200)[_0x95bf[6]]({isValid:true,value:_0xb672x10[_0x95bf[52]][_0x95bf[63]]})})[_0x95bf[36]](function(_0xb672x8){return handleError(_0xb672x6,_0xb672x8)})};exports[_0x95bf[64]]=function(_0xb672x10,_0xb672x6,_0xb672x22){FreshdeskAccount[_0x95bf[50]](_0xb672x10[_0x95bf[49]][_0x95bf[48]])[_0x95bf[10]](handleEntityNotFound(_0xb672x6))[_0x95bf[10]](function(_0xb672x1d){var _0xb672x23= new _fd(_0xb672x1d[_0x95bf[17]],_0xb672x1d[_0x95bf[57]]);_0xb672x23[_0x95bf[66]](_0x95bf[65],function(_0xb672x8,_0xb672x1f,_0xb672x20){if(_0xb672x8){return _0xb672x22(_0xb672x8)};_0xb672x20=JSON[_0x95bf[58]](_0xb672x20);return _0xb672x6[_0x95bf[7]](200)[_0x95bf[6]](_0xb672x20)})})[_0x95bf[36]](handleError(_0xb672x6))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/freshdesk/accounts -> index + * POST /api/freshdesk/accounts -> create + * GET /api/freshdesk/accounts/:id -> show + * PUT /api/freshdesk/accounts/:id -> update + * DELETE /api/freshdesk/accounts/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var util = require('util'); +var _fd = require('freshdesk'); + +var FreshdeskAccount = require('../../models').FreshdeskAccount; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of FreshdeskAccounts +exports.index = function(req, res) { + var attributes = ['description', 'name', 'username', 'remoteUri']; + var per_page = req.query.per_page ? parseInt(req.query.per_page, 10) : 100; + var page = req.query.page ? parseInt(req.query.page, 10) : 0; + + var query = { + where: {}, + limit: per_page, + offset: page * per_page + }; + + _.forIn(req.query, function(value, key) { + switch (key) { + case 'per_page': + case 'page': + break; + case 'sort_by': + query.order = util.format('%s %s', req.query.sort_by, req.query.sort_order || 'ASC') || null; + break; + case 'sort_order': + break; + case '$': + query.where.$or = []; + attributes.forEach(function(attribute) { + var tmp = {}; + tmp[attribute] = { + $like: '%' + value + '%' + }; + + query.where.$or.push(tmp); + }); + break; + default: + query.where[key] = { + $like: {} + }; + query.where[key].$like = '%' + value + '%'; + } + }); + + FreshdeskAccount + .findAndCountAll(query) + .then(function(result) { + + var total_pages = Math.ceil(result.count / per_page); + var next_page = total_pages > (query.offset + 1) ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page + 1) : null; + var previous_page = page > 0 ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page - 1) : null; + + return res.status(200).send({ + count: result.count, + rows: result.rows, + next_page: next_page, + previous_page: previous_page, + total_pages: total_pages + }); + + }) + .catch(function(err) { + return res.status(500).send({ + error: 'Something blew up!' + }); + }); +} + +// Gets a single FreshdeskAccount from the DB +exports.show = function(req, res) { + FreshdeskAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new FreshdeskAccount in the DB +exports.create = function(req, res) { + FreshdeskAccount.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing FreshdeskAccount in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FreshdeskAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a FreshdeskAccount from the DB +exports.destroy = function(req, res) { + FreshdeskAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.bulkDestroy = function(req, res) { + FreshdeskAccount + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.checkAccount = function(req, res) { + FreshdeskAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + var freshdesk = new _fd(account.remoteUri, account.apiKey); + freshdesk.listTickets(function(err, response, body) { + if (err) { + return res.sendStatus(400); + } + body = JSON.parse(body); + if (body.require_login) { + return res.sendStatus(400); + } + return res.sendStatus(200); + }) + }) + .catch(handleError(res)); +} + +exports.accountValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + FreshdeskAccount + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getFields = function(req, res, next) { + FreshdeskAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + var Freshdesk = new _fd(account.remoteUri, account.apiKey); + Freshdesk.get('/ticket_fields.json', function(err, response, body) { + if (err) { + return next(err); + } + body = JSON.parse(body); + return res.status(200).send(body); + }); + }) + .catch(handleError(res)); +}; diff --git a/server/api/freshdesk_account/freshdesk_account.socket.js b/server/api/freshdesk_account/freshdesk_account.socket.js index ba48045..2aabaae 100644 --- a/server/api/freshdesk_account/freshdesk_account.socket.js +++ b/server/api/freshdesk_account/freshdesk_account.socket.js @@ -1 +1,24 @@ -var _0xbd3b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xbd3b[0];var FreshdeskAccount=require(_0xbd3b[2])[_0xbd3b[1]];exports[_0xbd3b[3]]=function(_0x4c0cx2){FreshdeskAccount[_0xbd3b[4]](function(_0x4c0cx3){onSave(_0x4c0cx2,_0x4c0cx3)});FreshdeskAccount[_0xbd3b[5]](function(_0x4c0cx3){onRemove(_0x4c0cx2,_0x4c0cx3)})};function onSave(_0x4c0cx2,_0x4c0cx3,_0x4c0cx5){_0x4c0cx2[_0xbd3b[7]](_0xbd3b[6],_0x4c0cx3)}function onRemove(_0x4c0cx2,_0x4c0cx3,_0x4c0cx5){_0x4c0cx2[_0xbd3b[7]](_0xbd3b[8],_0x4c0cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var FreshdeskAccount = require('../../models').FreshdeskAccount; + +exports.register = function(socket) { + FreshdeskAccount.afterCreate(function(doc) { + onSave(socket, doc); + }); + FreshdeskAccount.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('freshdesk_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('freshdesk_account:remove', doc); +} diff --git a/server/api/freshdesk_account/index.js b/server/api/freshdesk_account/index.js index eed04fd..a7385b7 100644 --- a/server/api/freshdesk_account/index.js +++ b/server/api/freshdesk_account/index.js @@ -1 +1,21 @@ -var _0x2c68=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x2c68[0];var express=require(_0x2c68[1]);var auth=require(_0x2c68[2]);var controller=require(_0x2c68[3]);var router=express.Router();router[_0x2c68[7]](_0x2c68[4],auth[_0x2c68[5]](),controller[_0x2c68[6]]);router[_0x2c68[7]](_0x2c68[8],auth[_0x2c68[5]](),controller[_0x2c68[9]]);router[_0x2c68[7]](_0x2c68[10],auth[_0x2c68[5]](),controller[_0x2c68[11]]);router[_0x2c68[7]](_0x2c68[12],auth[_0x2c68[5]](),controller[_0x2c68[13]]);router[_0x2c68[16]](_0x2c68[14],auth[_0x2c68[5]](),controller[_0x2c68[15]]);router[_0x2c68[16]](_0x2c68[4],auth[_0x2c68[5]](),controller[_0x2c68[17]]);router[_0x2c68[19]](_0x2c68[8],auth[_0x2c68[5]](),controller[_0x2c68[18]]);router[_0x2c68[20]](_0x2c68[8],auth[_0x2c68[5]](),controller[_0x2c68[18]]);router[_0x2c68[22]](_0x2c68[4],auth[_0x2c68[5]](),controller[_0x2c68[21]]);router[_0x2c68[22]](_0x2c68[8],auth[_0x2c68[5]](),controller[_0x2c68[23]]);module[_0x2c68[24]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./freshdesk_account.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/fields', auth.isAuthenticated(), controller.getFields); +router.get('/:id/check', auth.isAuthenticated(), controller.checkAccount); +router.post('/validate/:field', auth.isAuthenticated(), controller.accountValidation); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/freshdesk_account/index.spec.js b/server/api/freshdesk_account/index.spec.js index 4a3c10e..6d7fc75 100644 --- a/server/api/freshdesk_account/index.spec.js +++ b/server/api/freshdesk_account/index.spec.js @@ -1 +1,97 @@ -var _0x6add=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x6add[0];var proxyquire=require(_0x6add[2])[_0x6add[1]]();var freshdeskAccountCtrlStub={index:_0x6add[3],show:_0x6add[4],create:_0x6add[5],update:_0x6add[6],destroy:_0x6add[7]};var routerStub={get:sinon[_0x6add[8]](),put:sinon[_0x6add[8]](),patch:sinon[_0x6add[8]](),post:sinon[_0x6add[8]](),delete:sinon[_0x6add[8]]()};var freshdeskAccountIndex=proxyquire(_0x6add[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":freshdeskAccountCtrlStub});describe(_0x6add[10],function(){it(_0x6add[11],function(){expect(freshdeskAccountIndex)[_0x6add[13]][_0x6add[12]](routerStub)});describe(_0x6add[14],function(){it(_0x6add[15],function(){expect(routerStub[_0x6add[21]][_0x6add[20]](_0x6add[19],_0x6add[3]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})});describe(_0x6add[22],function(){it(_0x6add[23],function(){expect(routerStub[_0x6add[21]][_0x6add[20]](_0x6add[24],_0x6add[4]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})});describe(_0x6add[25],function(){it(_0x6add[26],function(){expect(routerStub[_0x6add[27]][_0x6add[20]](_0x6add[19],_0x6add[5]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})});describe(_0x6add[28],function(){it(_0x6add[29],function(){expect(routerStub[_0x6add[30]][_0x6add[20]](_0x6add[24],_0x6add[6]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})});describe(_0x6add[31],function(){it(_0x6add[29],function(){expect(routerStub[_0x6add[32]][_0x6add[20]](_0x6add[24],_0x6add[6]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})});describe(_0x6add[33],function(){it(_0x6add[34],function(){expect(routerStub[_0x6add[35]][_0x6add[20]](_0x6add[24],_0x6add[7]))[_0x6add[13]][_0x6add[18]][_0x6add[17]][_0x6add[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var freshdeskAccountCtrlStub = { + index: 'freshdeskAccountCtrl.index', + show: 'freshdeskAccountCtrl.show', + create: 'freshdeskAccountCtrl.create', + update: 'freshdeskAccountCtrl.update', + destroy: 'freshdeskAccountCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var freshdeskAccountIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './freshdesk_account.controller': freshdeskAccountCtrlStub +}); + +describe('FreshdeskAccount API Router:', function() { + + it('should return an express router instance', function() { + expect(freshdeskAccountIndex).to.equal(routerStub); + }); + + describe('GET /api/freshdesk/accounts', function() { + + it('should route to freshdeskAccount.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'freshdeskAccountCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/freshdesk/accounts/:id', function() { + + it('should route to freshdeskAccount.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'freshdeskAccountCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/freshdesk/accounts', function() { + + it('should route to freshdeskAccount.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'freshdeskAccountCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/freshdesk/accounts/:id', function() { + + it('should route to freshdeskAccount.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'freshdeskAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/freshdesk/accounts/:id', function() { + + it('should route to freshdeskAccount.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'freshdeskAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/freshdesk/accounts/:id', function() { + + it('should route to freshdeskAccount.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'freshdeskAccountCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/freshdesk_configuration/freshdesk_configuration.controller.js b/server/api/freshdesk_configuration/freshdesk_configuration.controller.js index 6d4aa96..4c3d44d 100644 --- a/server/api/freshdesk_configuration/freshdesk_configuration.controller.js +++ b/server/api/freshdesk_configuration/freshdesk_configuration.controller.js @@ -1 +1,146 @@ -var _0x20a4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x53\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x73\x70\x72\x65\x61\x64","\x61\x64\x64\x53\x75\x62\x6A\x65\x63\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x64\x64\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x74\x79\x70\x65"];_0x20a4[0];var _=require(_0x20a4[1]);var FreshdeskConfiguration=require(_0x20a4[3])[_0x20a4[2]];var FreshdeskField=require(_0x20a4[3])[_0x20a4[4]];function handleError(_0xa33dx5,_0xa33dx6){_0xa33dx6=_0xa33dx6||500;return function(_0xa33dx7){_0xa33dx5[_0x20a4[6]](_0xa33dx6)[_0x20a4[5]](_0xa33dx7)}}function responseWithResult(_0xa33dx5,_0xa33dx6){_0xa33dx6=_0xa33dx6||200;return function(_0xa33dx9){if(_0xa33dx9){_0xa33dx5[_0x20a4[6]](_0xa33dx6)[_0x20a4[7]](_0xa33dx9)}}}function handleEntityNotFound(_0xa33dx5){return function(_0xa33dx9){if(!_0xa33dx9){_0xa33dx5[_0x20a4[6]](404)[_0x20a4[8]]();return null};return _0xa33dx9}}function saveUpdates(_0xa33dxc){return function(_0xa33dx9){return _0xa33dx9[_0x20a4[10]](_0xa33dxc)[_0x20a4[9]](function(_0xa33dxd){return _0xa33dxd})}}function removeEntity(_0xa33dx5){return function(_0xa33dx9){if(_0xa33dx9){return _0xa33dx9[_0x20a4[11]]()[_0x20a4[9]](function(){_0xa33dx5[_0x20a4[6]](204)[_0x20a4[8]]()})}}}exports[_0x20a4[12]]=function(_0xa33dxf,_0xa33dx5){FreshdeskConfiguration[_0x20a4[15]]({where:_0xa33dxf[_0x20a4[14]]})[_0x20a4[9]](responseWithResult(_0xa33dx5))[_0x20a4[13]](handleError(_0xa33dx5))};exports[_0x20a4[16]]=function(_0xa33dxf,_0xa33dx5){FreshdeskConfiguration[_0x20a4[22]]({where:{id:_0xa33dxf[_0x20a4[18]][_0x20a4[17]]},include:[{model:FreshdeskField,as:_0x20a4[19]},{model:FreshdeskField,as:_0x20a4[20]},{model:FreshdeskField,as:_0x20a4[21]}]})[_0x20a4[9]](handleEntityNotFound(_0xa33dx5))[_0x20a4[9]](responseWithResult(_0xa33dx5))[_0x20a4[13]](handleError(_0xa33dx5))};exports[_0x20a4[23]]=function(_0xa33dxf,_0xa33dx5){FreshdeskConfiguration[_0x20a4[23]](_0xa33dxf[_0x20a4[24]])[_0x20a4[9]](responseWithResult(_0xa33dx5,201))[_0x20a4[13]](handleError(_0xa33dx5))};exports[_0x20a4[25]]=function(_0xa33dxf,_0xa33dx5){if(_0xa33dxf[_0x20a4[24]][_0x20a4[17]]){delete _0xa33dxf[_0x20a4[24]][_0x20a4[17]]};FreshdeskConfiguration[_0x20a4[26]](_0xa33dxf[_0x20a4[18]][_0x20a4[17]])[_0x20a4[9]](handleEntityNotFound(_0xa33dx5))[_0x20a4[9]](saveUpdates(_0xa33dxf[_0x20a4[24]]))[_0x20a4[9]](responseWithResult(_0xa33dx5))[_0x20a4[13]](handleError(_0xa33dx5))};exports[_0x20a4[11]]=function(_0xa33dxf,_0xa33dx5){FreshdeskConfiguration[_0x20a4[26]](_0xa33dxf[_0x20a4[18]][_0x20a4[17]])[_0x20a4[9]](handleEntityNotFound(_0xa33dx5))[_0x20a4[9]](removeEntity(_0xa33dx5))[_0x20a4[13]](handleError(_0xa33dx5))};exports[_0x20a4[27]]=function(_0xa33dxf,_0xa33dx5,_0xa33dx10){var _0xa33dx11;FreshdeskConfiguration[_0x20a4[26]](_0xa33dxf[_0x20a4[18]][_0x20a4[17]])[_0x20a4[9]](handleEntityNotFound(_0xa33dx5))[_0x20a4[9]](function(_0xa33dx14){_0xa33dx11=_0xa33dx14;return FreshdeskField[_0x20a4[23]](_0xa33dxf[_0x20a4[24]])})[_0x20a4[9]](function(_0xa33dx13){switch(_0xa33dxf[_0x20a4[18]][_0x20a4[35]]){case _0x20a4[30]:return [_0xa33dx11[_0x20a4[29]](_0xa33dx13),_0xa33dx13];case _0x20a4[32]:return [_0xa33dx11[_0x20a4[31]](_0xa33dx13),_0xa33dx13];case _0x20a4[34]:return [_0xa33dx11[_0x20a4[33]](_0xa33dx13),_0xa33dx13]}})[_0x20a4[28]](function(_0xa33dx12,_0xa33dx13){return _0xa33dx5[_0x20a4[6]](201)[_0x20a4[7]](_0xa33dx13)})[_0x20a4[13]](handleError(_0xa33dx5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/freshdesk/configurations -> index + * POST /api/freshdesk/configurations -> create + * GET /api/freshdesk/configurations/:id -> show + * PUT /api/freshdesk/configurations/:id -> update + * DELETE /api/freshdesk/configurations/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var FreshdeskConfiguration = require('../../models').FreshdeskConfiguration; +var FreshdeskField = require('../../models').FreshdeskField; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of FreshdeskConfigurations +exports.index = function(req, res) { + FreshdeskConfiguration.findAll({ + where: req.query + }) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single FreshdeskConfiguration from the DB +exports.show = function(req, res) { + FreshdeskConfiguration.find({ + where: { + id: req.params.id + }, + include: [{ + model: FreshdeskField, + as: 'Subject' + }, { + model: FreshdeskField, + as: 'Description' + }, { + model: FreshdeskField, + as: 'Field' + }] + }) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new FreshdeskConfiguration in the DB +exports.create = function(req, res) { + FreshdeskConfiguration.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing FreshdeskConfiguration in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FreshdeskConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a FreshdeskConfiguration from the DB +exports.destroy = function(req, res) { + FreshdeskConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.addConfigurationField = function(req, res, next) { + // console.log(req.params); + var freshdeskConfiguration; + FreshdeskConfiguration + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(salesforce_configuration) { + freshdeskConfiguration = salesforce_configuration; + return FreshdeskField.create(req.body) + }) + .then(function(freshdeskField) { + switch (req.params.type) { + case 'subject': + return [freshdeskConfiguration.addSubject(freshdeskField), freshdeskField]; + case 'description': + return [freshdeskConfiguration.addDescription(freshdeskField), freshdeskField]; + case 'field': + return [freshdeskConfiguration.addField(freshdeskField), freshdeskField]; + } + }) + .spread(function(data, freshdeskField) { + return res.status(201).json(freshdeskField); + }) + .catch(handleError(res)); +}; diff --git a/server/api/freshdesk_configuration/freshdesk_configuration.socket.js b/server/api/freshdesk_configuration/freshdesk_configuration.socket.js index cabe8c1..4ce7f30 100644 --- a/server/api/freshdesk_configuration/freshdesk_configuration.socket.js +++ b/server/api/freshdesk_configuration/freshdesk_configuration.socket.js @@ -1 +1,24 @@ -var _0x14b4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x14b4[0];var FreshdeskConfiguration=require(_0x14b4[2])[_0x14b4[1]];exports[_0x14b4[3]]=function(_0x313cx2){FreshdeskConfiguration[_0x14b4[4]](function(_0x313cx3){onSave(_0x313cx2,_0x313cx3)});FreshdeskConfiguration[_0x14b4[5]](function(_0x313cx3){onRemove(_0x313cx2,_0x313cx3)})};function onSave(_0x313cx2,_0x313cx3,_0x313cx5){_0x313cx2[_0x14b4[7]](_0x14b4[6],_0x313cx3)}function onRemove(_0x313cx2,_0x313cx3,_0x313cx5){_0x313cx2[_0x14b4[7]](_0x14b4[8],_0x313cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var FreshdeskConfiguration = require('../../models').FreshdeskConfiguration; + +exports.register = function(socket) { + FreshdeskConfiguration.afterCreate(function(doc) { + onSave(socket, doc); + }); + FreshdeskConfiguration.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('freshdesk_configuration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('freshdesk_configuration:remove', doc); +} diff --git a/server/api/freshdesk_configuration/index.js b/server/api/freshdesk_configuration/index.js index ecd1fdc..e08945f 100644 --- a/server/api/freshdesk_configuration/index.js +++ b/server/api/freshdesk_configuration/index.js @@ -1 +1,19 @@ -var _0xc4c4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x3A\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xc4c4[0];var express=require(_0xc4c4[1]);var auth=require(_0xc4c4[2]);var controller=require(_0xc4c4[3]);var router=express.Router();router[_0xc4c4[7]](_0xc4c4[4],auth[_0xc4c4[5]](),controller[_0xc4c4[6]]);router[_0xc4c4[7]](_0xc4c4[8],auth[_0xc4c4[5]](),controller[_0xc4c4[9]]);router[_0xc4c4[11]](_0xc4c4[4],auth[_0xc4c4[5]](),controller[_0xc4c4[10]]);router[_0xc4c4[13]](_0xc4c4[8],auth[_0xc4c4[5]](),controller[_0xc4c4[12]]);router[_0xc4c4[11]](_0xc4c4[14],auth[_0xc4c4[5]](),controller[_0xc4c4[15]]);router[_0xc4c4[16]](_0xc4c4[8],auth[_0xc4c4[5]](),controller[_0xc4c4[12]]);router[_0xc4c4[18]](_0xc4c4[8],auth[_0xc4c4[5]](),controller[_0xc4c4[17]]);module[_0xc4c4[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./freshdesk_configuration.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/:id/:type', auth.isAuthenticated(), controller.addConfigurationField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/freshdesk_configuration/index.spec.js b/server/api/freshdesk_configuration/index.spec.js index ebf6801..b297c23 100644 --- a/server/api/freshdesk_configuration/index.spec.js +++ b/server/api/freshdesk_configuration/index.spec.js @@ -1 +1,97 @@ -var _0x6fde=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x6fde[0];var proxyquire=require(_0x6fde[2])[_0x6fde[1]]();var freshdeskConfigurationCtrlStub={index:_0x6fde[3],show:_0x6fde[4],create:_0x6fde[5],update:_0x6fde[6],destroy:_0x6fde[7]};var routerStub={get:sinon[_0x6fde[8]](),put:sinon[_0x6fde[8]](),patch:sinon[_0x6fde[8]](),post:sinon[_0x6fde[8]](),delete:sinon[_0x6fde[8]]()};var freshdeskConfigurationIndex=proxyquire(_0x6fde[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":freshdeskConfigurationCtrlStub});describe(_0x6fde[10],function(){it(_0x6fde[11],function(){expect(freshdeskConfigurationIndex)[_0x6fde[13]][_0x6fde[12]](routerStub)});describe(_0x6fde[14],function(){it(_0x6fde[15],function(){expect(routerStub[_0x6fde[21]][_0x6fde[20]](_0x6fde[19],_0x6fde[3]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})});describe(_0x6fde[22],function(){it(_0x6fde[23],function(){expect(routerStub[_0x6fde[21]][_0x6fde[20]](_0x6fde[24],_0x6fde[4]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})});describe(_0x6fde[25],function(){it(_0x6fde[26],function(){expect(routerStub[_0x6fde[27]][_0x6fde[20]](_0x6fde[19],_0x6fde[5]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})});describe(_0x6fde[28],function(){it(_0x6fde[29],function(){expect(routerStub[_0x6fde[30]][_0x6fde[20]](_0x6fde[24],_0x6fde[6]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})});describe(_0x6fde[31],function(){it(_0x6fde[29],function(){expect(routerStub[_0x6fde[32]][_0x6fde[20]](_0x6fde[24],_0x6fde[6]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})});describe(_0x6fde[33],function(){it(_0x6fde[34],function(){expect(routerStub[_0x6fde[35]][_0x6fde[20]](_0x6fde[24],_0x6fde[7]))[_0x6fde[13]][_0x6fde[18]][_0x6fde[17]][_0x6fde[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var freshdeskConfigurationCtrlStub = { + index: 'freshdeskConfigurationCtrl.index', + show: 'freshdeskConfigurationCtrl.show', + create: 'freshdeskConfigurationCtrl.create', + update: 'freshdeskConfigurationCtrl.update', + destroy: 'freshdeskConfigurationCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var freshdeskConfigurationIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './freshdesk_configuration.controller': freshdeskConfigurationCtrlStub +}); + +describe('FreshdeskConfiguration API Router:', function() { + + it('should return an express router instance', function() { + expect(freshdeskConfigurationIndex).to.equal(routerStub); + }); + + describe('GET /api/freshdesk/configurations', function() { + + it('should route to freshdeskConfiguration.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'freshdeskConfigurationCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/freshdesk/configurations/:id', function() { + + it('should route to freshdeskConfiguration.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'freshdeskConfigurationCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/freshdesk/configurations', function() { + + it('should route to freshdeskConfiguration.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'freshdeskConfigurationCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/freshdesk/configurations/:id', function() { + + it('should route to freshdeskConfiguration.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'freshdeskConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/freshdesk/configurations/:id', function() { + + it('should route to freshdeskConfiguration.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'freshdeskConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/freshdesk/configurations/:id', function() { + + it('should route to freshdeskConfiguration.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'freshdeskConfigurationCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/freshdesk_field/freshdesk_field.controller.js b/server/api/freshdesk_field/freshdesk_field.controller.js index f44e166..4a35db8 100644 --- a/server/api/freshdesk_field/freshdesk_field.controller.js +++ b/server/api/freshdesk_field/freshdesk_field.controller.js @@ -1 +1,104 @@ -var _0x4a0a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x4a0a[0];var _=require(_0x4a0a[1]);var FreshdeskField=require(_0x4a0a[3])[_0x4a0a[2]];function handleError(_0x5b67x4,_0x5b67x5){_0x5b67x5=_0x5b67x5||500;return function(_0x5b67x6){_0x5b67x4[_0x4a0a[5]](_0x5b67x5)[_0x4a0a[4]](_0x5b67x6)}}function responseWithResult(_0x5b67x4,_0x5b67x5){_0x5b67x5=_0x5b67x5||200;return function(_0x5b67x8){if(_0x5b67x8){_0x5b67x4[_0x4a0a[5]](_0x5b67x5)[_0x4a0a[6]](_0x5b67x8)}}}function handleEntityNotFound(_0x5b67x4){return function(_0x5b67x8){if(!_0x5b67x8){_0x5b67x4[_0x4a0a[5]](404)[_0x4a0a[7]]();return null};return _0x5b67x8}}function saveUpdates(_0x5b67xb){return function(_0x5b67x8){return _0x5b67x8[_0x4a0a[9]](_0x5b67xb)[_0x4a0a[8]](function(_0x5b67xc){return _0x5b67xc})}}function removeEntity(_0x5b67x4){return function(_0x5b67x8){if(_0x5b67x8){return _0x5b67x8[_0x4a0a[10]]()[_0x4a0a[8]](function(){_0x5b67x4[_0x4a0a[5]](204)[_0x4a0a[7]]()})}}}exports[_0x4a0a[11]]=function(_0x5b67xe,_0x5b67x4){FreshdeskField[_0x4a0a[13]]()[_0x4a0a[8]](responseWithResult(_0x5b67x4))[_0x4a0a[12]](handleError(_0x5b67x4))};exports[_0x4a0a[14]]=function(_0x5b67xe,_0x5b67x4){FreshdeskField[_0x4a0a[17]](_0x5b67xe[_0x4a0a[16]][_0x4a0a[15]])[_0x4a0a[8]](handleEntityNotFound(_0x5b67x4))[_0x4a0a[8]](responseWithResult(_0x5b67x4))[_0x4a0a[12]](handleError(_0x5b67x4))};exports[_0x4a0a[18]]=function(_0x5b67xe,_0x5b67x4){FreshdeskField[_0x4a0a[18]](_0x5b67xe[_0x4a0a[19]])[_0x4a0a[8]](responseWithResult(_0x5b67x4,201))[_0x4a0a[12]](handleError(_0x5b67x4))};exports[_0x4a0a[20]]=function(_0x5b67xe,_0x5b67x4){if(_0x5b67xe[_0x4a0a[19]][_0x4a0a[15]]){delete _0x5b67xe[_0x4a0a[19]][_0x4a0a[15]]};FreshdeskField[_0x4a0a[17]](_0x5b67xe[_0x4a0a[16]][_0x4a0a[15]])[_0x4a0a[8]](handleEntityNotFound(_0x5b67x4))[_0x4a0a[8]](saveUpdates(_0x5b67xe[_0x4a0a[19]]))[_0x4a0a[8]](responseWithResult(_0x5b67x4))[_0x4a0a[12]](handleError(_0x5b67x4))};exports[_0x4a0a[10]]=function(_0x5b67xe,_0x5b67x4){FreshdeskField[_0x4a0a[17]](_0x5b67xe[_0x4a0a[16]][_0x4a0a[15]])[_0x4a0a[8]](handleEntityNotFound(_0x5b67x4))[_0x4a0a[8]](removeEntity(_0x5b67x4))[_0x4a0a[12]](handleError(_0x5b67x4))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/freshdesk/fields -> index + * POST /api/freshdesk/fields -> create + * GET /api/freshdesk/fields/:id -> show + * PUT /api/freshdesk/fields/:id -> update + * DELETE /api/freshdesk/fields/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var FreshdeskField = require('../../models').FreshdeskField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of FreshdeskFields +exports.index = function(req, res) { + FreshdeskField.findAll() + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single FreshdeskField from the DB +exports.show = function(req, res) { + FreshdeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new FreshdeskField in the DB +exports.create = function(req, res) { + FreshdeskField.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing FreshdeskField in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + FreshdeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a FreshdeskField from the DB +exports.destroy = function(req, res) { + FreshdeskField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/freshdesk_field/freshdesk_field.socket.js b/server/api/freshdesk_field/freshdesk_field.socket.js index 2ae970b..b351442 100644 --- a/server/api/freshdesk_field/freshdesk_field.socket.js +++ b/server/api/freshdesk_field/freshdesk_field.socket.js @@ -1 +1,24 @@ -var _0xed3d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0xed3d[0];var FreshdeskField=require(_0xed3d[2])[_0xed3d[1]];exports[_0xed3d[3]]=function(_0xdf6ex2){FreshdeskField[_0xed3d[4]](function(_0xdf6ex3){onSave(_0xdf6ex2,_0xdf6ex3)});FreshdeskField[_0xed3d[5]](function(_0xdf6ex3){onRemove(_0xdf6ex2,_0xdf6ex3)})};function onSave(_0xdf6ex2,_0xdf6ex3,_0xdf6ex5){_0xdf6ex2[_0xed3d[7]](_0xed3d[6],_0xdf6ex3)}function onRemove(_0xdf6ex2,_0xdf6ex3,_0xdf6ex5){_0xdf6ex2[_0xed3d[7]](_0xed3d[8],_0xdf6ex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var FreshdeskField = require('../../models').FreshdeskField; + +exports.register = function(socket) { + FreshdeskField.afterCreate(function(doc) { + onSave(socket, doc); + }); + FreshdeskField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('freshdesk_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('freshdesk_field:remove', doc); +} diff --git a/server/api/freshdesk_field/index.js b/server/api/freshdesk_field/index.js index 0e063ce..d17268f 100644 --- a/server/api/freshdesk_field/index.js +++ b/server/api/freshdesk_field/index.js @@ -1 +1,18 @@ -var _0xd4f8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd4f8[0];var express=require(_0xd4f8[1]);var auth=require(_0xd4f8[2]);var controller=require(_0xd4f8[3]);var router=express.Router();router[_0xd4f8[7]](_0xd4f8[4],auth[_0xd4f8[5]](),controller[_0xd4f8[6]]);router[_0xd4f8[7]](_0xd4f8[8],auth[_0xd4f8[5]](),controller[_0xd4f8[9]]);router[_0xd4f8[11]](_0xd4f8[4],auth[_0xd4f8[5]](),controller[_0xd4f8[10]]);router[_0xd4f8[13]](_0xd4f8[8],auth[_0xd4f8[5]](),controller[_0xd4f8[12]]);router[_0xd4f8[14]](_0xd4f8[8],auth[_0xd4f8[5]](),controller[_0xd4f8[12]]);router[_0xd4f8[16]](_0xd4f8[8],auth[_0xd4f8[5]](),controller[_0xd4f8[15]]);module[_0xd4f8[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./freshdesk_field.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/freshdesk_field/index.spec.js b/server/api/freshdesk_field/index.spec.js index c6eaf2b..b5c0fb8 100644 --- a/server/api/freshdesk_field/index.spec.js +++ b/server/api/freshdesk_field/index.spec.js @@ -1 +1,97 @@ -var _0xf317=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0xf317[0];var proxyquire=require(_0xf317[2])[_0xf317[1]]();var freshdeskFieldCtrlStub={index:_0xf317[3],show:_0xf317[4],create:_0xf317[5],update:_0xf317[6],destroy:_0xf317[7]};var routerStub={get:sinon[_0xf317[8]](),put:sinon[_0xf317[8]](),patch:sinon[_0xf317[8]](),post:sinon[_0xf317[8]](),delete:sinon[_0xf317[8]]()};var freshdeskFieldIndex=proxyquire(_0xf317[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":freshdeskFieldCtrlStub});describe(_0xf317[10],function(){it(_0xf317[11],function(){expect(freshdeskFieldIndex)[_0xf317[13]][_0xf317[12]](routerStub)});describe(_0xf317[14],function(){it(_0xf317[15],function(){expect(routerStub[_0xf317[21]][_0xf317[20]](_0xf317[19],_0xf317[3]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})});describe(_0xf317[22],function(){it(_0xf317[23],function(){expect(routerStub[_0xf317[21]][_0xf317[20]](_0xf317[24],_0xf317[4]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})});describe(_0xf317[25],function(){it(_0xf317[26],function(){expect(routerStub[_0xf317[27]][_0xf317[20]](_0xf317[19],_0xf317[5]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})});describe(_0xf317[28],function(){it(_0xf317[29],function(){expect(routerStub[_0xf317[30]][_0xf317[20]](_0xf317[24],_0xf317[6]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})});describe(_0xf317[31],function(){it(_0xf317[29],function(){expect(routerStub[_0xf317[32]][_0xf317[20]](_0xf317[24],_0xf317[6]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})});describe(_0xf317[33],function(){it(_0xf317[34],function(){expect(routerStub[_0xf317[35]][_0xf317[20]](_0xf317[24],_0xf317[7]))[_0xf317[13]][_0xf317[18]][_0xf317[17]][_0xf317[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var freshdeskFieldCtrlStub = { + index: 'freshdeskFieldCtrl.index', + show: 'freshdeskFieldCtrl.show', + create: 'freshdeskFieldCtrl.create', + update: 'freshdeskFieldCtrl.update', + destroy: 'freshdeskFieldCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var freshdeskFieldIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './freshdesk_field.controller': freshdeskFieldCtrlStub +}); + +describe('FreshdeskField API Router:', function() { + + it('should return an express router instance', function() { + expect(freshdeskFieldIndex).to.equal(routerStub); + }); + + describe('GET /api/freshdesk/fields', function() { + + it('should route to freshdeskField.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'freshdeskFieldCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/freshdesk/fields/:id', function() { + + it('should route to freshdeskField.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'freshdeskFieldCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/freshdesk/fields', function() { + + it('should route to freshdeskField.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'freshdeskFieldCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/freshdesk/fields/:id', function() { + + it('should route to freshdeskField.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'freshdeskFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/freshdesk/fields/:id', function() { + + it('should route to freshdeskField.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'freshdeskFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/freshdesk/fields/:id', function() { + + it('should route to freshdeskField.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'freshdeskFieldCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 11500f3..5789126 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -1 +1,15 @@ -var _0x7e6b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x7e6b[0];var express=require(_0x7e6b[1]);var controller=require(_0x7e6b[2]);var router=express.Router();router[_0x7e6b[5]](_0x7e6b[3],controller[_0x7e6b[4]]);router[_0x7e6b[5]](_0x7e6b[6],controller[_0x7e6b[7]]);router[_0x7e6b[9]](_0x7e6b[3],controller[_0x7e6b[8]]);router[_0x7e6b[11]](_0x7e6b[6],controller[_0x7e6b[10]]);router[_0x7e6b[12]](_0x7e6b[6],controller[_0x7e6b[10]]);router[_0x7e6b[14]](_0x7e6b[6],controller[_0x7e6b[13]]);module[_0x7e6b[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./integration.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 708aef6..cc5e706 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -1 +1,178 @@ -var _0xea94=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x70\x61\x74\x68","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x61\x64\x6D\x2D\x7A\x69\x70","\x73\x74\x72\x69\x6E\x67\x2D\x74\x6F\x2D\x6A\x73\x6F\x6E","\x66\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x6A\x6F\x69\x6E","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x7A\x69\x70\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x54\x68\x65\x20\x6D\x61\x78\x69\x6D\x75\x6D\x20\x66\x69\x6C\x65\x20\x73\x69\x7A\x65\x20\x69\x73\x20\x35\x20\x4D\x62","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x67\x65\x74\x45\x6E\x74\x72\x69\x65\x73","\x6E\x61\x6D\x65","\x6D\x61\x6E\x69\x66\x65\x73\x74\x2E\x6A\x73\x6F\x6E","\x75\x74\x66\x38","\x67\x65\x74\x44\x61\x74\x61","\x75\x70\x6C\x6F\x61\x64\x5A\x69\x70","\x6C\x6F\x67","\x70\x61\x72\x73\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C\x54\x6F","\x6D\x65\x72\x67\x65","\x6A\x73\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x75\x6E\x6C\x69\x6E\x6B\x53\x79\x6E\x63","\x6D\x61\x6E\x69\x66\x65\x73\x74","\x6D\x61\x6E\x69\x66\x65\x73\x74\x2E\x6A\x73\x6F\x6E\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x6F\x6E","\x65\x72\x72\x6F\x72","\x75\x70\x6C\x6F\x61\x64","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0xea94[0];var _=require(_0xea94[1]);var uploadFile=require(_0xea94[2]);var config=require(_0xea94[3]);var path=require(_0xea94[4]);var sr=require(_0xea94[5]);var admZip=require(_0xea94[6]);var str2json=require(_0xea94[7]);var fs=require(_0xea94[8]);var Util=require(_0xea94[9]);var Integration=require(_0xea94[11])[_0xea94[10]];exports[_0xea94[12]]=function(_0x9cbexb,_0x9cbexc,_0x9cbexd){return Integration[_0xea94[19]](Util[_0xea94[18]](_0x9cbexb[_0xea94[17]]))[_0xea94[16]](function(_0x9cbexf){_0x9cbexc[_0xea94[15]](200)[_0xea94[14]](_0x9cbexf)})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})};exports[_0xea94[20]]=function(_0x9cbexb,_0x9cbexc){Integration[_0xea94[24]](_0x9cbexb[_0xea94[23]][_0xea94[22]])[_0xea94[16]](function(_0x9cbex10){if(!_0x9cbex10){return _0x9cbexc[_0xea94[21]](404)};return _0x9cbexc[_0xea94[14]](_0x9cbex10)})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})};exports[_0xea94[25]]=function(_0x9cbexb,_0x9cbexc){var _0x9cbex11= new uploadFile({dest:path[_0xea94[28]](config[_0xea94[26]],_0xea94[27]),maxFileSize:5*1000000,maxNumberOfFiles:1,minNumberOfFiles:1,acceptFileTypes:/(\.|\/)(zip)$/i,messages:{maxNumberOfFiles:_0xea94[29],acceptFileTypes:_0xea94[30],maxFileSize:_0xea94[31],invalidRequest:_0xea94[32]}});_0x9cbex11[_0xea94[50]](_0xea94[33],function(_0x9cbex12,_0x9cbex13){var _0x9cbex14= new admZip(_0x9cbex13[_0xea94[34]][_0xea94[4]]);var _0x9cbex15=false;var _0x9cbex16=_0x9cbex14[_0xea94[35]]();_0x9cbex16[_0xea94[46]](function(_0x9cbex17){if(_0x9cbex17[_0xea94[36]]===_0xea94[37]){var _0x9cbex18=_0x9cbex17[_0xea94[39]]().toString(_0xea94[38]);console[_0xea94[41]](_0xea94[40],_0x9cbex18);try{_0x9cbex15=JSON[_0xea94[42]](_0x9cbex18);console[_0xea94[41]](_0xea94[40],_0x9cbex15);Integration[_0xea94[25]](_[_0xea94[44]](_0x9cbex13[_0xea94[34]],_0x9cbex15))[_0xea94[16]](function(_0x9cbex10){_0x9cbex14[_0xea94[43]](path[_0xea94[28]](config[_0xea94[26]],_0xea94[27]),true);return _0x9cbexc[_0xea94[15]](201)[_0xea94[14]](_0x9cbex10)})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})}catch(e){console[_0xea94[41]](e);var _0x9cbexe={errors:[{type:_0xea94[45],message:e}]};return handleError(_0x9cbexc,_0x9cbexe)}}});fs[_0xea94[47]](_0x9cbex13[_0xea94[34]][_0xea94[4]]);if(!_0x9cbex15){var _0x9cbexe={errors:[{type:_0xea94[48],message:_0xea94[49]}]};return handleError(_0x9cbexc,_0x9cbexe)}});_0x9cbex11[_0xea94[50]](_0xea94[51],function(_0x9cbex19){var _0x9cbexe={errors:[{type:_0xea94[52],message:_0x9cbex19}]};return handleError(_0x9cbexc,_0x9cbexe)});_0x9cbex11[_0xea94[42]](_0x9cbexb)};exports[_0xea94[53]]=function(_0x9cbexb,_0x9cbexc){if(_0x9cbexb[_0xea94[54]][_0xea94[22]]){delete _0x9cbexb[_0xea94[54]][_0xea94[22]]};Integration[_0xea94[56]]({where:{id:_0x9cbexb[_0xea94[23]][_0xea94[22]]}})[_0xea94[16]](function(_0x9cbex10){if(!_0x9cbex10){return _0x9cbexc[_0xea94[21]](404)};var _0x9cbex1a=_[_0xea94[44]](_0x9cbex10,_0x9cbexb[_0xea94[54]]);_0x9cbex1a[_0xea94[55]]()[_0xea94[16]](function(){return _0x9cbexc[_0xea94[15]](200)[_0xea94[14]](_0x9cbex10)})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})};exports[_0xea94[57]]=function(_0x9cbexb,_0x9cbexc){Integration[_0xea94[56]]({where:{id:_0x9cbexb[_0xea94[23]][_0xea94[22]]}})[_0xea94[16]](function(_0x9cbex10){if(!_0x9cbex10){return _0x9cbexc[_0xea94[21]](404)};_0x9cbex10[_0xea94[57]]()[_0xea94[16]](function(){return _0x9cbexc[_0xea94[21]](204)})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})})[_0xea94[13]](function(_0x9cbexe){return handleError(_0x9cbexc,_0x9cbexe)})};function handleError(_0x9cbexc,_0x9cbexe){return _0x9cbexc[_0xea94[15]](500)[_0xea94[14]](_0x9cbexe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var uploadFile = require('upload-file'); +var config = require('../../config/environment'); +var path = require('path'); +var sr = require('simple-random'); +var admZip = require('adm-zip'); +var str2json = require('string-to-json'); +var fs = require('fs'); +var Util = require('../../config/util'); + +var Integration = require('../../models').Integration; + +// Get list of Integration +exports.index = function(req, res, next) { + return Integration + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single integration +exports.show = function(req, res) { + Integration + .findById(req.params.id) + .then(function(integration) { + if (!integration) { + return res.sendStatus(404); + } + return res.send(integration); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new integration in the DB. +exports.create = function(req, res) { + var upload = new uploadFile({ + dest: path.join(config.root, 'server/files/integrations'), + maxFileSize: 5 * 1000000, + maxNumberOfFiles: 1, + minNumberOfFiles: 1, + acceptFileTypes: /(\.|\/)(zip)$/i, + messages: { + maxNumberOfFiles: "Max number of files upload exceeded", + acceptFileTypes: "Only zip format accepted", + maxFileSize: "The maximum file size is 5 Mb", + invalidRequest: "Invalid request" + } + }); + + upload.on('end', function(fields, files) { + var zip = new admZip(files.file.path); + + var manifest = false; + var zipEntries = zip.getEntries(); + zipEntries.forEach(function(zipEntry) { + if (zipEntry.name === 'manifest.json') { + var str = zipEntry.getData().toString('utf8'); + console.log('uploadZip', str); + try { + manifest = JSON.parse(str); + console.log('uploadZip', manifest); + Integration + .create(_.merge(files.file, manifest)) + .then(function(integration) { + + // Extract All Zip and overwrite old directory + zip.extractAllTo(path.join(config.root, + 'server/files/integrations'), true); + + return res.status(201).send(integration); + }) + .catch(function(err) { + return handleError(res, err); + }); + } catch (e) { + console.log(e); + var err = { + errors: [{ + type: 'json', + message: e + }] + }; + return handleError(res, err); + } + } + }); + + fs.unlinkSync(files.file.path); + + if (!manifest) { + var err = { + errors: [{ + type: 'manifest', + message: 'manifest.json not found' + }] + }; + return handleError(res, err); + } + }); + + upload.on('error', function(e) { + var err = { + errors: [{ + type: 'upload', + message: e + }] + }; + return handleError(res, err); + }); + + upload.parse(req); +}; + +// Updates an existing integration in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Integration + .find({ + where: { + id: req.params.id + } + }) + .then(function(integration) { + if (!integration) { + return res.sendStatus(404); + } + var updated = _.merge(integration, req.body); + updated.save() + .then(function() { + return res.status(200).send(integration); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a integration from the DB. +exports.destroy = function(req, res) { + Integration + .find({ + where: { + id: req.params.id + } + }) + .then(function(integration) { + if (!integration) { + return res.sendStatus(404); + } + integration.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/integration/integration.socket.js b/server/api/integration/integration.socket.js index f0945f2..a79af43 100644 --- a/server/api/integration/integration.socket.js +++ b/server/api/integration/integration.socket.js @@ -1 +1,27 @@ -var _0xfdd6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xfdd6[0];var Integration=require(_0xfdd6[2])[_0xfdd6[1]];exports[_0xfdd6[3]]=function(_0x25f9x2){Integration[_0xfdd6[4]](function(_0x25f9x3){onSave(_0x25f9x2,_0x25f9x3)});Integration[_0xfdd6[5]](function(_0x25f9x3){onSave(_0x25f9x2,_0x25f9x3)});Integration[_0xfdd6[6]](function(_0x25f9x3){onRemove(_0x25f9x2,_0x25f9x3)})};function onSave(_0x25f9x2,_0x25f9x3,_0x25f9x5){_0x25f9x2[_0xfdd6[8]](_0xfdd6[7],_0x25f9x3)}function onRemove(_0x25f9x2,_0x25f9x3,_0x25f9x5){_0x25f9x2[_0xfdd6[8]](_0xfdd6[9],_0x25f9x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Integration = require('../../models').Integration; + +exports.register = function(socket) { + Integration.afterCreate(function(doc) { + onSave(socket, doc); + }); + Integration.afterUpdate(function(doc) { + onSave(socket, doc); + }); + Integration.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('integration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('integration:remove', doc); +} diff --git a/server/api/integration/integration.spec.js b/server/api/integration/integration.spec.js index 9fca24c..0d4146d 100644 --- a/server/api/integration/integration.spec.js +++ b/server/api/integration/integration.spec.js @@ -1 +1,20 @@ -var _0xdb31=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0xdb31[0];var should=require(_0xdb31[1]);var app=require(_0xdb31[2]);var request=require(_0xdb31[3]);describe(_0xdb31[4],function(){it(_0xdb31[5],function(_0x9047x4){request(app)[_0xdb31[13]](_0xdb31[12])[_0xdb31[11]](200)[_0xdb31[11]](_0xdb31[10],/json/)[_0xdb31[9]](function(_0x9047x5,_0x9047x6){if(_0x9047x5){return _0x9047x4(_0x9047x5)};_0x9047x6[_0xdb31[8]][_0xdb31[1]][_0xdb31[7]][_0xdb31[6]](Array);_0x9047x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/integrations', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/integrations') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f72b376..b9f5ab2 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -1 +1,16 @@ -var _0xae0f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xae0f[0];var express=require(_0xae0f[1]);var controller=require(_0xae0f[2]);var auth=require(_0xae0f[3]);var router=express.Router();router[_0xae0f[7]](_0xae0f[4],auth[_0xae0f[5]](),controller[_0xae0f[6]]);router[_0xae0f[7]](_0xae0f[8],auth[_0xae0f[5]](),controller[_0xae0f[9]]);router[_0xae0f[11]](_0xae0f[4],auth[_0xae0f[5]](),controller[_0xae0f[10]]);router[_0xae0f[13]](_0xae0f[8],auth[_0xae0f[5]](),controller[_0xae0f[12]]);router[_0xae0f[15]](_0xae0f[4],auth[_0xae0f[5]](),controller[_0xae0f[14]]);router[_0xae0f[15]](_0xae0f[8],auth[_0xae0f[5]](),controller[_0xae0f[16]]);module[_0xae0f[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./interval.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 3d9c837..584391e 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -1 +1,167 @@ -var _0x30a7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x73\x75\x62\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x6C\x6F\x67","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x61\x6C\x6C","\x61\x72\x65\x20\x74\x68\x65\x72\x65\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x53\x75\x62\x49\x6E\x74\x65\x72\x76\x61\x6C\x73","\x6C\x65\x6E\x67\x74\x68","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x79\x65\x73\x20\x74\x68\x65\x72\x65\x20\x61\x72\x65","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x6D\x65\x73\x73\x61\x67\x65","\x54\x68\x65\x20\x49\x6E\x74\x65\x72\x76\x61\x6C\x20\x69\x73\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x65\x64\x20\x77\x69\x74\x68\x20\x6F\x6E\x65\x20\x6F\x72\x20\x6D\x6F\x72\x65\x20\x72\x6F\x75\x74\x65\x73\x2C\x20\x64\x65\x6C\x65\x74\x65\x20\x74\x68\x65\x6D\x20\x66\x69\x72\x73\x74","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x49\x4E\x54\x45\x52\x56\x41\x4C\x5F\x52\x4F\x55\x54\x45\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x30a7[0];var _=require(_0x30a7[1]);var Interval=require(_0x30a7[3])[_0x30a7[2]];var VoiceExtension=require(_0x30a7[3])[_0x30a7[4]];var sequelize=require(_0x30a7[3])[_0x30a7[5]];var Util=require(_0x30a7[6]);exports[_0x30a7[7]]=function(_0xd5b7x6,_0xd5b7x7,_0xd5b7x8){return Interval[_0x30a7[17]](_0x30a7[15],_0x30a7[16])[_0x30a7[14]](Util[_0x30a7[13]](_0xd5b7x6[_0x30a7[12]]))[_0x30a7[11]](function(_0xd5b7xa){_0xd5b7x7[_0x30a7[10]](200)[_0x30a7[9]](_0xd5b7xa)})[_0x30a7[8]](function(_0xd5b7x9){return handleError(_0xd5b7x7,_0xd5b7x9)})};exports[_0x30a7[18]]=function(_0xd5b7x6,_0xd5b7x7){return Interval[_0x30a7[17]](_0x30a7[16])[_0x30a7[22]](_0xd5b7x6[_0x30a7[21]][_0x30a7[20]])[_0x30a7[11]](function(_0xd5b7xb){if(!_0xd5b7xb){return _0xd5b7x7[_0x30a7[19]](404)};return _0xd5b7x7[_0x30a7[9]](_0xd5b7xb)})[_0x30a7[8]](function(_0xd5b7x9){return handleError(_0xd5b7x7,_0xd5b7x9)})};exports[_0x30a7[23]]=function(_0xd5b7x6,_0xd5b7x7){return Interval[_0x30a7[17]](_0x30a7[16])[_0x30a7[23]](_0xd5b7x6[_0x30a7[25]])[_0x30a7[11]](function(_0xd5b7xb){return _0xd5b7x7[_0x30a7[10]](201)[_0x30a7[9]](_0xd5b7xb)})[_0x30a7[8]](function(_0xd5b7x9){console[_0x30a7[24]](_0xd5b7x9);return handleError(_0xd5b7x7,_0xd5b7x9)})};exports[_0x30a7[26]]=function(_0xd5b7x6,_0xd5b7x7){console[_0x30a7[24]](_0xd5b7x6[_0x30a7[25]]);return sequelize[_0x30a7[32]](function(_0xd5b7xc){if(_0xd5b7x6[_0x30a7[25]][_0x30a7[20]]){delete _0xd5b7x6[_0x30a7[25]][_0x30a7[20]]};return Interval[_0x30a7[26]](_0xd5b7x6[_0x30a7[25]],{where:{id:_0xd5b7x6[_0x30a7[21]][_0x30a7[20]]},individualHooks:true,transaction:_0xd5b7xc})[_0x30a7[11]](function(){if(_0xd5b7x6[_0x30a7[25]][_0x30a7[29]]){return Interval[_0x30a7[31]]({where:{IntervalId:_0xd5b7x6[_0x30a7[21]][_0x30a7[20]]},transaction:_0xd5b7xc})}})[_0x30a7[11]](function(){console[_0x30a7[24]](_0x30a7[28]);if(_0xd5b7x6[_0x30a7[25]][_0x30a7[29]]&&_0xd5b7x6[_0x30a7[25]][_0x30a7[29]][_0x30a7[30]]){return _0xd5b7x6[_0x30a7[21]][_0x30a7[20]]}})[_0x30a7[11]](bulkCreateSubIntervals(_0xd5b7x6[_0x30a7[25]].SubIntervals,_0xd5b7xc))[_0x30a7[27]]()})[_0x30a7[11]](function(){return _0xd5b7x7[_0x30a7[19]](200)})[_0x30a7[8]](function(_0xd5b7x9){console[_0x30a7[24]](_0xd5b7x9);return handleError(_0xd5b7x7,_0xd5b7x9)})};function bulkCreateSubIntervals(_0xd5b7xe,_0xd5b7xc){return function(_0xd5b7xf){if(_0xd5b7xf){console[_0x30a7[24]](_0x30a7[33]);var _0xd5b7x10=[];_0xd5b7xe[_0x30a7[36]](function(_0xd5b7x11){_0xd5b7x11[_0x30a7[34]]=_0xd5b7xf;_0xd5b7x10[_0x30a7[35]](Interval[_0x30a7[23]](_0xd5b7x11,{transaction:_0xd5b7xc}))});return _0xd5b7x10}else {return []}}}exports[_0x30a7[31]]=function(_0xd5b7x6,_0xd5b7x7){return sequelize[_0x30a7[32]](function(_0xd5b7xc){return Interval[_0x30a7[31]]({where:{id:_0xd5b7x6[_0x30a7[21]][_0x30a7[20]]},individualHooks:true,transaction:_0xd5b7xc})})[_0x30a7[11]](function(){return _0xd5b7x7[_0x30a7[19]](204)})[_0x30a7[8]](sequelize.ForeignKeyConstraintError,function(_0xd5b7x9){_0xd5b7x9[_0x30a7[37]]=_0x30a7[38];_0xd5b7x9[_0x30a7[39]]=_0x30a7[40];return handleError(_0xd5b7x7,_0xd5b7x9)})[_0x30a7[8]](function(_0xd5b7x9){return handleError(_0xd5b7x7,_0xd5b7x9)})};exports[_0x30a7[41]]=function(_0xd5b7x6,_0xd5b7x7){return sequelize[_0x30a7[32]](function(_0xd5b7xc){return Interval[_0x30a7[31]]({where:{id:_0xd5b7x6[_0x30a7[12]][_0x30a7[42]]},individualHooks:true,transaction:_0xd5b7xc})})[_0x30a7[11]](function(){return _0xd5b7x7[_0x30a7[19]](204)})[_0x30a7[8]](sequelize.ForeignKeyConstraintError,function(_0xd5b7x9){_0xd5b7x9[_0x30a7[37]]=_0x30a7[38];_0xd5b7x9[_0x30a7[39]]=_0x30a7[40];return handleError(_0xd5b7x7,_0xd5b7x9)})[_0x30a7[8]](function(_0xd5b7x9){return handleError(_0xd5b7x7,_0xd5b7x9)})};function handleError(_0xd5b7x7,_0xd5b7x9){return _0xd5b7x7[_0x30a7[10]](500)[_0x30a7[9]](_0xd5b7x9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Interval = require('../../models').Interval; +var VoiceExtension = require('../../models').VoiceExtension; +var sequelize = require('../../models').sequelize; + +var Util = require('../../config/util'); + +// Get list of interval +exports.index = function(req, res, next) { + return Interval + .scope('intervals', 'subintervals') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single interval +exports.show = function(req, res) { + return Interval + .scope('subintervals') + .findById(req.params.id) + .then(function(interval) { + if (!interval) { + return res.sendStatus(404); + } + return res.send(interval); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new interval in the DB. +exports.create = function(req, res) { + return Interval + .scope('subintervals') + .create(req.body) + .then(function(interval) { + return res.status(201).send(interval); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Updates an existing interval in the DB. +exports.update = function(req, res) { + console.log(req.body); + return sequelize.transaction(function(t) { + if (req.body.id) { + delete req.body.id; + } + return Interval + .update(req.body, { + where: { + id: req.params.id + }, + individualHooks: true, + transaction: t + }) + .then(function() { + if (req.body.SubIntervals) { + return Interval + .destroy({ + where: { + IntervalId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + console.log('are there intervals'); + if (req.body.SubIntervals && req.body.SubIntervals.length) { + return req.params.id; + } + }) + .then(bulkCreateSubIntervals(req.body.SubIntervals, t)) + .all(); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +function bulkCreateSubIntervals(subIntervals, t) { + return function(mainInterval) { + if (mainInterval) { + console.log('yes there are'); + var bulkSubInts = []; + subIntervals.forEach(function(elem) { + elem.IntervalId = mainInterval; + bulkSubInts.push(Interval.create(elem, { + transaction: t + })); + }); + return bulkSubInts; + } else { + return []; + } + } +} + +// Deletes a interval from the DB. +exports.destroy = function(req, res) { + return sequelize.transaction(function(t) { + return Interval + .destroy({ + where: { + id: req.params.id + }, + individualHooks: true, + transaction: t + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(sequelize.ForeignKeyConstraintError, function(err) { + err.message = 'The Interval is associated with one or more routes, delete them first'; + err.translatedMessage = 'MESSAGE_INTERVAL_ROUTE_ASSOCIATED' + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes multiple intervals from the DB. +exports.bulkDestroy = function(req, res) { + return sequelize.transaction(function(t) { + return Interval + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true, + transaction: t + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(sequelize.ForeignKeyConstraintError, function(err) { + err.message = 'The Interval is associated with one or more routes, delete them first'; + err.translatedMessage = 'MESSAGE_INTERVAL_ROUTE_ASSOCIATED' + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/interval/interval.socket.js b/server/api/interval/interval.socket.js index 0967e4e..d8aee27 100644 --- a/server/api/interval/interval.socket.js +++ b/server/api/interval/interval.socket.js @@ -1 +1,31 @@ -var _0xe00a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x69\x6E\x74\x65\x72\x76\x61\x6C\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C\x3A\x72\x65\x6D\x6F\x76\x65","\x69\x6E\x74\x65\x72\x76\x61\x6C\x3A\x75\x70\x64\x61\x74\x65"];_0xe00a[0];var Interval=require(_0xe00a[2])[_0xe00a[1]];exports[_0xe00a[3]]=function(_0xe522x2){Interval[_0xe00a[4]](function(_0xe522x3){onSave(_0xe522x2,_0xe522x3)});Interval[_0xe00a[5]](function(_0xe522x3){onRemove(_0xe522x2,_0xe522x3)});Interval[_0xe00a[6]](function(_0xe522x3){onUpdate(_0xe522x2,_0xe522x3)})};function onSave(_0xe522x2,_0xe522x3,_0xe522x5){_0xe522x2[_0xe00a[8]](_0xe00a[7],_0xe522x3)}function onRemove(_0xe522x2,_0xe522x3,_0xe522x5){_0xe522x2[_0xe00a[8]](_0xe00a[9],_0xe522x3)}function onUpdate(_0xe522x2,_0xe522x3,_0xe522x5){_0xe522x2[_0xe00a[8]](_0xe00a[10],_0xe522x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Interval = require('../../models').Interval; + +exports.register = function(socket) { + Interval.afterCreate(function(doc) { + onSave(socket, doc); + }); + Interval.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + Interval.afterUpdate(function(doc) { + onUpdate(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('interval:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('interval:remove', doc); +} + +function onUpdate(socket, doc, cb) { + socket.emit('interval:update', doc); +} diff --git a/server/api/interval/interval.spec.js b/server/api/interval/interval.spec.js index 6b69557..280cb64 100644 --- a/server/api/interval/interval.spec.js +++ b/server/api/interval/interval.spec.js @@ -1 +1,20 @@ -var _0xd2f5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x67\x65\x74"];_0xd2f5[0];var should=require(_0xd2f5[1]);var app=require(_0xd2f5[2]);var request=require(_0xd2f5[3]);describe(_0xd2f5[4],function(){it(_0xd2f5[5],function(_0x7eb2x4){request(app)[_0xd2f5[13]](_0xd2f5[12])[_0xd2f5[11]](200)[_0xd2f5[11]](_0xd2f5[10],/json/)[_0xd2f5[9]](function(_0x7eb2x5,_0x7eb2x6){if(_0x7eb2x5){return _0x7eb2x4(_0x7eb2x5)};_0x7eb2x6[_0xd2f5[8]][_0xd2f5[1]][_0xd2f5[7]][_0xd2f5[6]](Array);_0x7eb2x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/intervals', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/intervals') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/jscripty_project/index.js b/server/api/jscripty_project/index.js index e16d9ab..1ecf642 100644 --- a/server/api/jscripty_project/index.js +++ b/server/api/jscripty_project/index.js @@ -1 +1,33 @@ -var _0xec3a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x2F\x3A\x69\x64\x2F\x73\x65\x73\x73\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x73\x65\x73\x73\x69\x6F\x6E\x73\x2F\x3A\x73\x65\x73\x73\x69\x6F\x6E\x49\x64","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E","\x2F\x3A\x69\x64\x2F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x2F\x73\x75\x6D\x6D\x61\x72\x79","\x73\x68\x6F\x77\x53\x75\x6D\x6D\x61\x72\x79","\x2F\x3A\x69\x64\x2F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x2F\x64\x65\x74\x61\x69\x6C","\x73\x68\x6F\x77\x44\x65\x74\x61\x69\x6C","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x2F\x3A\x69\x64\x2F\x73\x65\x73\x73\x69\x6F\x6E\x73\x2F\x3A\x73\x65\x73\x73\x69\x6F\x6E\x49\x64\x2F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x75\x70\x64\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xec3a[0];var express=require(_0xec3a[1]);var auth=require(_0xec3a[2]);var controller=require(_0xec3a[3]);var router=express.Router();router[_0xec3a[7]](_0xec3a[4],auth[_0xec3a[5]](),controller[_0xec3a[6]]);router[_0xec3a[7]](_0xec3a[8],auth[_0xec3a[5]](),controller[_0xec3a[9]]);router[_0xec3a[7]](_0xec3a[10],controller[_0xec3a[11]]);router[_0xec3a[7]](_0xec3a[12],controller[_0xec3a[13]]);router[_0xec3a[7]](_0xec3a[14],controller[_0xec3a[15]]);router[_0xec3a[7]](_0xec3a[16],controller[_0xec3a[17]]);router[_0xec3a[7]](_0xec3a[18],controller[_0xec3a[19]]);router[_0xec3a[7]](_0xec3a[20],controller[_0xec3a[21]]);router[_0xec3a[23]](_0xec3a[4],auth[_0xec3a[5]](),controller[_0xec3a[22]]);router[_0xec3a[23]](_0xec3a[12],auth[_0xec3a[5]](),controller[_0xec3a[24]]);router[_0xec3a[23]](_0xec3a[25],auth[_0xec3a[5]](),controller[_0xec3a[26]]);router[_0xec3a[28]](_0xec3a[8],auth[_0xec3a[5]](),controller[_0xec3a[27]]);router[_0xec3a[28]](_0xec3a[14],auth[_0xec3a[5]](),controller[_0xec3a[29]]);router[_0xec3a[30]](_0xec3a[8],auth[_0xec3a[5]](),controller[_0xec3a[27]]);router[_0xec3a[32]](_0xec3a[4],auth[_0xec3a[5]](),controller[_0xec3a[31]]);router[_0xec3a[32]](_0xec3a[8],auth[_0xec3a[5]](),controller[_0xec3a[33]]);module[_0xec3a[34]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./jscripty_project.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/download', controller.download); +router.get('/:id/sessions', controller.showSessions); +router.get('/:id/sessions/:sessionId', controller.showSession); + +router.get('/:id/questions', controller.showQuestions); + +router.get('/:id/questions/summary', controller.showSummary); +router.get('/:id/questions/detail', controller.showDetail); + +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/sessions', auth.isAuthenticated(), controller.createSession); +router.post('/:id/sessions/:sessionId/questions', auth.isAuthenticated(), controller.createQuestions); + +router.put('/:id', auth.isAuthenticated(), controller.update); +router.put('/:id/sessions/:sessionId', auth.isAuthenticated(), controller.updateSession); + +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + + +module.exports = router; diff --git a/server/api/jscripty_project/index.spec.js b/server/api/jscripty_project/index.spec.js index 12dd761..3860e91 100644 --- a/server/api/jscripty_project/index.spec.js +++ b/server/api/jscripty_project/index.spec.js @@ -1 +1,97 @@ -var _0x9eda=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x6A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x9eda[0];var proxyquire=require(_0x9eda[2])[_0x9eda[1]]();var jscriptyProjectCtrlStub={index:_0x9eda[3],show:_0x9eda[4],create:_0x9eda[5],update:_0x9eda[6],destroy:_0x9eda[7]};var routerStub={get:sinon[_0x9eda[8]](),put:sinon[_0x9eda[8]](),patch:sinon[_0x9eda[8]](),post:sinon[_0x9eda[8]](),delete:sinon[_0x9eda[8]]()};var jscriptyProjectIndex=proxyquire(_0x9eda[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":jscriptyProjectCtrlStub});describe(_0x9eda[10],function(){it(_0x9eda[11],function(){expect(jscriptyProjectIndex)[_0x9eda[13]][_0x9eda[12]](routerStub)});describe(_0x9eda[14],function(){it(_0x9eda[15],function(){expect(routerStub[_0x9eda[21]][_0x9eda[20]](_0x9eda[19],_0x9eda[3]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})});describe(_0x9eda[22],function(){it(_0x9eda[23],function(){expect(routerStub[_0x9eda[21]][_0x9eda[20]](_0x9eda[24],_0x9eda[4]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})});describe(_0x9eda[25],function(){it(_0x9eda[26],function(){expect(routerStub[_0x9eda[27]][_0x9eda[20]](_0x9eda[19],_0x9eda[5]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})});describe(_0x9eda[28],function(){it(_0x9eda[29],function(){expect(routerStub[_0x9eda[30]][_0x9eda[20]](_0x9eda[24],_0x9eda[6]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})});describe(_0x9eda[31],function(){it(_0x9eda[29],function(){expect(routerStub[_0x9eda[32]][_0x9eda[20]](_0x9eda[24],_0x9eda[6]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})});describe(_0x9eda[33],function(){it(_0x9eda[34],function(){expect(routerStub[_0x9eda[35]][_0x9eda[20]](_0x9eda[24],_0x9eda[7]))[_0x9eda[13]][_0x9eda[18]][_0x9eda[17]][_0x9eda[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var jscriptyProjectCtrlStub = { + index: 'jscriptyProjectCtrl.index', + show: 'jscriptyProjectCtrl.show', + create: 'jscriptyProjectCtrl.create', + update: 'jscriptyProjectCtrl.update', + destroy: 'jscriptyProjectCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var jscriptyProjectIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './jscripty_project.controller': jscriptyProjectCtrlStub +}); + +describe('JscriptyProject API Router:', function() { + + it('should return an express router instance', function() { + expect(jscriptyProjectIndex).to.equal(routerStub); + }); + + describe('GET /api/jscripty/projects', function() { + + it('should route to jscriptyProject.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'jscriptyProjectCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/jscripty/projects/:id', function() { + + it('should route to jscriptyProject.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'jscriptyProjectCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/jscripty/projects', function() { + + it('should route to jscriptyProject.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'jscriptyProjectCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/jscripty/projects/:id', function() { + + it('should route to jscriptyProject.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'jscriptyProjectCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/jscripty/projects/:id', function() { + + it('should route to jscriptyProject.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'jscriptyProjectCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/jscripty/projects/:id', function() { + + it('should route to jscriptyProject.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'jscriptyProjectCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/jscripty_project/jscripty_project.controller.js b/server/api/jscripty_project/jscripty_project.controller.js index d501ee1..7550756 100644 --- a/server/api/jscripty_project/jscripty_project.controller.js +++ b/server/api/jscripty_project/jscripty_project.controller.js @@ -1 +1,389 @@ -var _0x6c41=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x78\x6D\x6C\x32\x6A\x73","\x6C\x6F\x64\x61\x73\x68","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x51\x75\x65\x73\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E\x73","\x6C\x6F\x67","\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x41\x6E\x64\x49\x6E\x70\x75\x74","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E","\x73\x65\x73\x73\x69\x6F\x6E\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x53\x75\x6D\x6D\x61\x72\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x53\x75\x6D\x6D\x61\x72\x79","\x73\x68\x6F\x77\x44\x65\x74\x61\x69\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6C\x61\x62\x65\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x65\x78\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x61\x6E\x73\x77\x65\x72","\x63\x6F\x75\x6E\x74","\x63\x6F\x6C","\x66\x6E","\x63\x72\x65\x61\x74\x65","\x6E\x61\x6D\x65","\x66\x69\x65\x6C\x64\x73","\x6D\x65\x73\x73\x61\x67\x65","\x50\x72\x6F\x6A\x65\x63\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x50\x52\x4F\x4A\x45\x43\x54","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x72\x65\x71\x2E\x62\x6F\x64\x79","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x66\x69\x6E\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3B\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D\x22","\x2E\x78\x6D\x6C\x22","\x74\x78\x74\x2F\x78\x6D\x6C","\x73\x65\x74","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E"];_0x6c41[0];var xml=require(_0x6c41[1]);var _=require(_0x6c41[2]);var JscriptyProject=require(_0x6c41[4])[_0x6c41[3]];var Util=require(_0x6c41[5]);var sequelize=require(_0x6c41[4])[_0x6c41[6]];var ReportJscriptySession=require(_0x6c41[4])[_0x6c41[7]];var ReportJscriptyQuestion=require(_0x6c41[4])[_0x6c41[8]];var ReportJscriptyInput=require(_0x6c41[4])[_0x6c41[9]];var Promise=require(_0x6c41[10]);function handleError(_0x5e57xb,_0x5e57xc){return _0x5e57xb[_0x6c41[12]](500)[_0x6c41[11]](_0x5e57xc)}function responseWithResult(_0x5e57xb,_0x5e57xe){_0x5e57xe=_0x5e57xe||200;return function(_0x5e57xf){if(_0x5e57xf){_0x5e57xb[_0x6c41[12]](_0x5e57xe)[_0x6c41[13]](_0x5e57xf)}}}function handleEntityNotFound(_0x5e57xb){return function(_0x5e57xf){if(!_0x5e57xf){_0x5e57xb[_0x6c41[12]](404)[_0x6c41[14]]();return null};return _0x5e57xf}}function saveUpdates(_0x5e57x12){return function(_0x5e57xf){return _0x5e57xf[_0x6c41[16]](_0x5e57x12)[_0x6c41[15]](function(_0x5e57x13){return _0x5e57x13})}}function removeEntity(_0x5e57xb){return function(_0x5e57xf){if(_0x5e57xf){return _0x5e57xf[_0x6c41[17]]()[_0x6c41[15]](function(){_0x5e57xb[_0x6c41[12]](204)[_0x6c41[14]]()})}}}exports[_0x6c41[18]]=function(_0x5e57x15,_0x5e57xb,_0x5e57x16){return JscriptyProject[_0x6c41[22]](Util[_0x6c41[21]](_0x5e57x15[_0x6c41[20]]))[_0x6c41[15]](function(_0x5e57x17){_0x5e57xb[_0x6c41[12]](200)[_0x6c41[11]](_0x5e57x17)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[23]]=function(_0x5e57x15,_0x5e57xb){return JscriptyProject[_0x6c41[27]](_0x5e57x15[_0x6c41[26]][_0x6c41[25]])[_0x6c41[15]](function(_0x5e57x18){if(!_0x5e57x18){return _0x5e57xb[_0x6c41[24]](404)};return _0x5e57xb[_0x6c41[11]](_0x5e57x18)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[28]]=function(_0x5e57x15,_0x5e57xb){return ReportJscriptySession[_0x6c41[31]]({method:[_0x6c41[30],_0x5e57x15[_0x6c41[26]][_0x6c41[25]]]})[_0x6c41[22]](Util[_0x6c41[21]](_0x5e57x15[_0x6c41[20]]))[_0x6c41[15]](handleEntityNotFound(_0x5e57xb))[_0x6c41[15]](responseWithResult(_0x5e57xb))[_0x6c41[19]](function(_0x5e57xc){console[_0x6c41[29]](_0x5e57xc);return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[32]]=function(_0x5e57x15,_0x5e57xb){return ReportJscriptySession[_0x6c41[34]]({where:{projectId:_0x5e57x15[_0x6c41[26]][_0x6c41[25]],session_id:_0x5e57x15[_0x6c41[26]][_0x6c41[33]]},include:[{model:ReportJscriptyQuestion,include:[{model:ReportJscriptyInput}]}]})[_0x6c41[15]](handleEntityNotFound(_0x5e57xb))[_0x6c41[15]](responseWithResult(_0x5e57xb))[_0x6c41[19]](function(_0x5e57xc){console[_0x6c41[29]](_0x5e57xc);return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[35]]=function(_0x5e57x15,_0x5e57xb){return ReportJscriptyQuestion[_0x6c41[34]]({where:{projectId:_0x5e57x15[_0x6c41[26]][_0x6c41[25]]},include:[{model:ReportJscriptyInput}]})[_0x6c41[15]](function(_0x5e57x19){if(!_0x5e57x19){return _0x5e57xb[_0x6c41[24]](404)};return _0x5e57xb[_0x6c41[12]](200)[_0x6c41[11]](_0x5e57x19)})[_0x6c41[15]](handleEntityNotFound(_0x5e57xb))[_0x6c41[19]](function(_0x5e57xc){console[_0x6c41[29]](_0x5e57xc);return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[36]]=function(_0x5e57x15,_0x5e57xb){return ReportJscriptyQuestion[_0x6c41[31]]({method:[_0x6c41[37],_0x5e57x15[_0x6c41[26]][_0x6c41[25]]]})[_0x6c41[22]](Util[_0x6c41[21]](_0x5e57x15[_0x6c41[20]]))[_0x6c41[15]](handleEntityNotFound(_0x5e57xb))[_0x6c41[15]](function(_0x5e57x1a){return _0x5e57xb[_0x6c41[12]](200)[_0x6c41[11]](_0x5e57x1a)})[_0x6c41[19]](function(_0x5e57xc){console[_0x6c41[29]](_0x5e57xc);return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[38]]=function(_0x5e57x15,_0x5e57xb){return ReportJscriptyQuestion[_0x6c41[34]]({where:{projectId:_0x5e57x15[_0x6c41[26]][_0x6c41[25]],question_type:_0x6c41[39]},attributes:[_0x6c41[40],_0x6c41[41],_0x6c41[42],_0x6c41[43],[sequelize[_0x6c41[46]](_0x6c41[44],sequelize[_0x6c41[45]](_0x6c41[43])),_0x6c41[44]]],group:[_0x6c41[40],_0x6c41[41],_0x6c41[42],_0x6c41[43]]})[_0x6c41[15]](function(_0x5e57x19){return _0x5e57xb[_0x6c41[12]](201)[_0x6c41[11]](_0x5e57x19)})[_0x6c41[19]](function(_0x5e57xc){console[_0x6c41[29]](_0x5e57xc);return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[47]]=function(_0x5e57x15,_0x5e57xb){return JscriptyProject[_0x6c41[47]](_0x5e57x15[_0x6c41[54]])[_0x6c41[15]](function(_0x5e57x18){return _0x5e57xb[_0x6c41[12]](201)[_0x6c41[11]](_0x5e57x18)})[_0x6c41[19]](sequelize.UniqueConstraintError,function(_0x5e57xc){if(_0x5e57xc[_0x6c41[49]][_0x6c41[48]]){_0x5e57xc[_0x6c41[50]]=_0x6c41[51];_0x5e57xc[_0x6c41[52]]=_0x6c41[53]};return handleError(_0x5e57xb,_0x5e57xc)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[55]]=function(_0x5e57x15,_0x5e57xb){ReportJscriptySession[_0x6c41[47]](_0x5e57x15[_0x6c41[54]])[_0x6c41[15]](function(_0x5e57x1b){return _0x5e57xb[_0x6c41[12]](201)[_0x6c41[11]](_0x5e57x1b)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[56]]=function(_0x5e57x15,_0x5e57xb){ReportJscriptyQuestion[_0x6c41[17]]({where:{sessionId:_0x5e57x15[_0x6c41[26]][_0x6c41[33]]}})[_0x6c41[15]](function(){console[_0x6c41[29]](_0x6c41[57],_0x5e57x15[_0x6c41[54]]);var _0x5e57x1d=[];_0x5e57x15[_0x6c41[54]][_0x6c41[59]](function(_0x5e57x1e){_0x5e57x1d[_0x6c41[58]](ReportJscriptyQuestion[_0x6c41[47]](_0x5e57x1e,{include:[{model:ReportJscriptyInput}]}))});return Promise[_0x6c41[60]](_0x5e57x1d)})[_0x6c41[15]](function(_0x5e57x1c){return _0x5e57xb[_0x6c41[12]](201)[_0x6c41[11]](_0x5e57x1c)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[61]]=function(_0x5e57x15,_0x5e57xb){if(_0x5e57x15[_0x6c41[54]][_0x6c41[25]]){delete _0x5e57x15[_0x6c41[54]][_0x6c41[25]]};JscriptyProject[_0x6c41[27]](_0x5e57x15[_0x6c41[26]][_0x6c41[25]])[_0x6c41[15]](function(_0x5e57x18){if(!_0x5e57x18){return _0x5e57xb[_0x6c41[24]](404)};var _0x5e57x13=_[_0x6c41[62]](_0x5e57x18,_0x5e57x15[_0x6c41[54]]);_0x5e57x13[_0x6c41[63]]()[_0x6c41[15]](function(){return _0x5e57xb[_0x6c41[12]](200)[_0x6c41[11]](_0x5e57x18)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[64]]=function(_0x5e57x15,_0x5e57xb){ReportJscriptySession[_0x6c41[61]](_0x5e57x15[_0x6c41[54]],{where:{session_id:_0x5e57x15[_0x6c41[26]][_0x6c41[33]]}})[_0x6c41[15]](function(_0x5e57x1b){return _0x5e57xb[_0x6c41[12]](200)[_0x6c41[11]](_0x5e57x1b)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[17]]=function(_0x5e57x15,_0x5e57xb){JscriptyProject[_0x6c41[65]]({where:{id:_0x5e57x15[_0x6c41[26]][_0x6c41[25]]}})[_0x6c41[15]](function(_0x5e57x18){if(!_0x5e57x18){return _0x5e57xb[_0x6c41[24]](404)};_0x5e57x18[_0x6c41[17]]()[_0x6c41[15]](function(){return _0x5e57xb[_0x6c41[24]](204)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[66]]=function(_0x5e57x15,_0x5e57xb){JscriptyProject[_0x6c41[17]]({where:{id:_0x5e57x15[_0x6c41[20]][_0x6c41[67]]},individualHooks:true})[_0x6c41[15]](function(){return _0x5e57xb[_0x6c41[24]](204)})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})};exports[_0x6c41[68]]=function(_0x5e57x15,_0x5e57xb,_0x5e57x16){JscriptyProject[_0x6c41[27]](_0x5e57x15[_0x6c41[26]][_0x6c41[25]])[_0x6c41[15]](function(_0x5e57x18){if(!_0x5e57x18){return _0x5e57xb[_0x6c41[24]](404)};console[_0x6c41[29]](_0x5e57x15[_0x6c41[20]][_0x6c41[69]]);_0x5e57xb[_0x6c41[73]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E":_0x6c41[70]+_0x5e57x15[_0x6c41[20]][_0x6c41[69]]+_0x6c41[71],"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x6c41[72]});return _0x5e57xb[_0x6c41[11]](_0x5e57x18[_0x6c41[74]])})[_0x6c41[19]](function(_0x5e57xc){return handleError(_0x5e57xb,_0x5e57xc)})} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/jscripty/projects -> index + * POST /api/jscripty/projects -> create + * GET /api/jscripty/projects/:id -> show + * PUT /api/jscripty/projects/:id -> update + * DELETE /api/jscripty/projects/:id -> destroy + */ + +'use strict'; +var xml = require('xml2js'); + +var _ = require('lodash'); + +var JscriptyProject = require('../../models').JscriptyProject; +var Util = require('../../config/util'); +var sequelize = require('../../models').sequelize; +var ReportJscriptySession = require('../../models').ReportJscriptySession; +var ReportJscriptyQuestion = require('../../models').ReportJscriptyQuestion; +var ReportJscriptyInput = require('../../models').ReportJscriptyInput; +var Promise = require('bluebird'); + +function handleError(res, err) { + return res.status(500).send(err); +} + + + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of JscriptyProjects + +exports.index = function(req, res, next) { + return JscriptyProject + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.show = function(req, res) { + return JscriptyProject + .findById(req.params.id) + .then(function(jscripty_project) { + if (!jscripty_project) { + return res.sendStatus(404); + } + return res.send(jscripty_project); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Gets a all ReportJscriptySession from the DB +exports.showSessions = function(req, res) { + return ReportJscriptySession + .scope({ + method: ['questionsAndInput', req.params.id] + }) + .findAndCountAll(Util.getQuery(req.query)) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + } + // Gets a one ReportJscriptySession from the DB +exports.showSession = function(req, res) { + return ReportJscriptySession + .findAll({ + where: { + projectId: req.params.id, + session_id: req.params.sessionId + }, + include: [{ + model: ReportJscriptyQuestion, + include: [{ + model: ReportJscriptyInput + }] + }] + + }) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + +// Gets a all ReportJscriptyQuestion from the DB +exports.showQuestions = function(req, res) { + return ReportJscriptyQuestion + .findAll({ + where: { + projectId: req.params.id + }, + include: [{ + model: ReportJscriptyInput + }], + + }) + .then(function(jscripty_questions) { + if (!jscripty_questions) { + return res.sendStatus(404); + } + return res.status(200).send(jscripty_questions); + }) + .then(handleEntityNotFound(res)) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + + +// Gets summary of ReportJscriptyQuestion from the DB + +exports.showSummary = function(req, res) { + return ReportJscriptyQuestion + .scope({ + method: ['questionSummary', req.params.id] + }) + .findAndCountAll(Util.getQuery(req.query)) + .then(handleEntityNotFound(res)) + .then(function(jscripty_summary) { + return res.status(200).send(jscripty_summary); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + + } + // Gets detail of ReportJscriptyQuestion from the DB +exports.showDetail = function(req, res) { + + return ReportJscriptyQuestion + .findAll({ + + where: { + projectId: req.params.id, + question_type: 'question' + }, + attributes: ['question_id', 'question_label', 'question_text', 'question_answer', [sequelize.fn('count', sequelize.col('question_answer')), + 'count' + ]], + + group: ['question_id', 'question_label', 'question_text', 'question_answer'] + + + }) + .then(function(jscripty_questions) { + + return res.status(201).send(jscripty_questions); + + }) + + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + } + // Creates a new JscriptyProject in the DB +exports.create = function(req, res) { + return JscriptyProject + .create(req.body) + .then(function(jscripty_project) { + return res.status(201).send(jscripty_project); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + if (err.fields.name) { + err.message = 'Project name already exists'; + err.translatedMessage = 'MESSAGE_EXIST_PROJECT' + } + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new ReportJscriptySession in the DB +exports.createSession = function(req, res) { + ReportJscriptySession + .create(req.body) + .then(function(jscripty_session) { + return res.status(201).send(jscripty_session); + }) + .catch(function(err) { + return handleError(res, err); + }); + + } + // Creates a new ReportJscriptyQuestions in the DB +exports.createQuestions = function(req, res) { + ReportJscriptyQuestion + .destroy({ + where: { + sessionId: req.params.sessionId + } + }) + .then(function() { + console.log('req.body', req.body); + var _promises = []; + + req.body.forEach(function(question) { + _promises.push(ReportJscriptyQuestion.create(question, { + include: [{ + model: ReportJscriptyInput + }] + })); + }); + + return Promise + .all(_promises); + }) + .then(function(jscripty_question) { + return res.status(201).send(jscripty_question); + }) + .catch(function(err) { + return handleError(res, err); + }); + } + // Updates an existing JscriptyProject in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + JscriptyProject + .findById(req.params.id) + .then(function(jscripty_project) { + if (!jscripty_project) { + return res.sendStatus(404); + } + var updated = _.merge(jscripty_project, req.body); + updated.save() + .then(function() { + return res.status(200).send(jscripty_project); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Updates an existing ReportJscriptySession in the DB +exports.updateSession = function(req, res) { + + ReportJscriptySession + .update(req.body, { + where: { + session_id: req.params.sessionId + } + + }) + .then(function(jscripty_session) { + return res.status(200).send(jscripty_session); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +// Deletes a JscriptyProject from the DB +exports.destroy = function(req, res) { + JscriptyProject + .find({ + where: { + id: req.params.id + } + }) + .then(function(jscripty_project) { + if (!jscripty_project) { + return res.sendStatus(404); + } + jscripty_project.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a jscripty_project from the DB. +exports.bulkDestroy = function(req, res) { + JscriptyProject + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +exports.download = function(req, res, next) { + JscriptyProject + .findById(req.params.id) + .then(function(jscripty_project) { + if (!jscripty_project) { + return res.sendStatus(404); + } + console.log(req.query.filename); + res.set({ + "Content-Disposition": "attachment; filename=\"" + req.query.filename + + ".xml\"", + "Content-Type": "txt/xml" + }); + return res.send(jscripty_project.production); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// exports.projectJson = function(req, res, next) { +// JscriptyProject +// .findById(req.params.id) +// .then(function(jscripty_project) { +// if (!jscripty_project) { +// return res.sendStatus(404); +// } +// +// xml.parseString(jscripty_project.production, { +// normalizeTags: true, +// explicitArray: false +// }, function(err, result) { +// console.log(result); +// return res.status(200).send(result); +// +// }); +// }) +// .catch(function(err) { +// return handleError(res, err); +// }); +// }; diff --git a/server/api/jscripty_project/jscripty_project.socket.js b/server/api/jscripty_project/jscripty_project.socket.js index 6217c86..4f5b49e 100644 --- a/server/api/jscripty_project/jscripty_project.socket.js +++ b/server/api/jscripty_project/jscripty_project.socket.js @@ -1 +1,24 @@ -var _0x8fc1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8fc1[0];var JscriptyProject=require(_0x8fc1[2])[_0x8fc1[1]];exports[_0x8fc1[3]]=function(_0x78b5x2){JscriptyProject[_0x8fc1[4]](function(_0x78b5x3){onSave(_0x78b5x2,_0x78b5x3)});JscriptyProject[_0x8fc1[5]](function(_0x78b5x3){onRemove(_0x78b5x2,_0x78b5x3)})};function onSave(_0x78b5x2,_0x78b5x3,_0x78b5x5){_0x78b5x2[_0x8fc1[7]](_0x8fc1[6],_0x78b5x3)}function onRemove(_0x78b5x2,_0x78b5x3,_0x78b5x5){_0x78b5x2[_0x8fc1[7]](_0x8fc1[8],_0x78b5x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var JscriptyProject = require('../../models').JscriptyProject; + +exports.register = function(socket) { + JscriptyProject.afterCreate(function(doc) { + onSave(socket, doc); + }); + JscriptyProject.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('jscripty_project:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('jscripty_project:remove', doc); +} diff --git a/server/api/license/index.js b/server/api/license/index.js index 04e25d2..3eb5928 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -1 +1,19 @@ -var _0x958e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x72\x65\x71\x75\x65\x73\x74","\x72\x65\x71\x75\x65\x73\x74","\x70\x6F\x73\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x958e[0];var express=require(_0x958e[1]);var auth=require(_0x958e[2]);var controller=require(_0x958e[3]);var router=express.Router();router[_0x958e[7]](_0x958e[4],auth[_0x958e[5]](),controller[_0x958e[6]]);router[_0x958e[10]](_0x958e[8],auth[_0x958e[5]](),controller[_0x958e[9]]);module[_0x958e[11]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./license.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +// router.get('/:id', auth.isAuthenticated(), controller.show); +// router.post('/', auth.isAuthenticated(), controller.create); +router.post('/request', auth.isAuthenticated(), controller.request); +// router.put('/:id', auth.isAuthenticated(), controller.update); +// router.patch('/:id', auth.isAuthenticated(), controller.update); +// router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 323cc9b..3d38afa 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -1 +1,161 @@ -var _0x167f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x44\x45\x4D\x4F\x20\x4C\x49\x43\x45\x4E\x53\x45","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6C\x69\x63\x65\x6E\x73\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x64\x65\x63\x72\x79\x70\x74","\x70\x61\x72\x73\x65","\x74\x6F\x6B\x65\x6E","\x67\x65\x74\x55\x75\x69\x64","\x6A\x73\x6F\x6E","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x65\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x72\x65\x71\x75\x65\x73\x74","\x6C\x6F\x67","\x73\x74\x61\x74\x75\x73\x43\x6F\x64\x65","\x50\x4F\x53\x54","\x70\x72\x6F\x76\x69\x73\x69\x6F\x6E\x69\x6E\x67","\x2F\x73\x65\x72\x76\x65\x72\x73\x2F","\x2F\x72\x65\x71\x75\x65\x73\x74","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x167f[0];var _=require(_0x167f[1]);var rp=require(_0x167f[2]);var config=require(_0x167f[3]);var license=require(_0x167f[4]);var Settings=require(_0x167f[6])[_0x167f[5]];var demoLicense={users:1,agents:1,telephones:0,chat:false,mail:false,fax:false,description:_0x167f[7]};function handleError(_0x2412x8,_0x2412x9){_0x2412x9=_0x2412x9||500;return function(_0x2412xa){_0x2412x8[_0x167f[9]](_0x2412x9)[_0x167f[8]](_0x2412xa)}}function responseWithResult(_0x2412x8,_0x2412x9){_0x2412x9=_0x2412x9||200;return function(_0x2412xc){if(_0x2412xc){if(_0x2412xc[_0x167f[10]]){_0x2412xc[_0x167f[11]][_0x167f[10]]=license[_0x167f[12]](_0x2412xc[_0x167f[11]][_0x167f[10]]);_0x2412xc[_0x167f[11]][_0x167f[10]]=JSON[_0x167f[13]](_0x2412xc[_0x167f[11]][_0x167f[10]])}else {_0x2412xc[_0x167f[11]][_0x167f[10]]=demoLicense};_0x2412xc[_0x167f[11]][_0x167f[10]][_0x167f[14]]=license[_0x167f[15]]();_0x2412x8[_0x167f[9]](_0x2412x9)[_0x167f[16]](_0x2412xc)}}}function handleEntityNotFound(_0x2412x8){return function(_0x2412xc){if(!_0x2412xc){_0x2412xc={dataValues:{license:demoLicense}};_0x2412xc[_0x167f[11]][_0x167f[10]][_0x167f[14]]=license[_0x167f[15]]();_0x2412x8[_0x167f[9]](201)[_0x167f[16]](_0x2412xc);return null};return _0x2412xc}}function saveUpdates(_0x2412xf){return function(_0x2412xc){return _0x2412xc[_0x167f[18]](_0x2412xf)[_0x167f[17]](function(_0x2412x10){return _0x2412x10})}}function removeEntity(_0x2412x8){return function(_0x2412xc){if(_0x2412xc){return _0x2412xc[_0x167f[20]]()[_0x167f[17]](function(){_0x2412x8[_0x167f[9]](204)[_0x167f[19]]()})}}}exports[_0x167f[21]]=function(_0x2412x12,_0x2412x8){Settings[_0x167f[23]](1)[_0x167f[17]](handleEntityNotFound(_0x2412x8))[_0x167f[17]](responseWithResult(_0x2412x8))[_0x167f[22]](handleError(_0x2412x8))};exports[_0x167f[24]]=function(_0x2412x12,_0x2412x8){};exports[_0x167f[25]]=function(_0x2412x12,_0x2412x8){};exports[_0x167f[26]]=function(_0x2412x12,_0x2412x8){return rp({method:_0x167f[29],uri:config[_0x167f[30]]+_0x167f[31]+license[_0x167f[15]]()+_0x167f[32],body:_0x2412x12[_0x167f[33]],json:true})[_0x167f[17]](function(_0x2412x13){console[_0x167f[27]](_0x2412x13);_0x2412x8[_0x167f[9]](201)[_0x167f[8]](_0x2412x13)})[_0x167f[22]](function(_0x2412xa){console[_0x167f[27]](_0x2412xa);return _0x2412x8[_0x167f[9]](_0x2412xa[_0x167f[28]]||500)[_0x167f[8]](_0x2412xa)})};exports[_0x167f[34]]=function(_0x2412x12,_0x2412x8){};exports[_0x167f[20]]=function(_0x2412x12,_0x2412x8){} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/licenses -> index + * POST /api/licenses -> create + * GET /api/licenses/:id -> show + * PUT /api/licenses/:id -> update + * DELETE /api/licenses/:id -> destroy + */ + +'use strict'; + +var _ = require('lodash'); +var rp = require('request-promise'); + +var config = require('../../config/environment'); +var license = require('../../config/license/license.service'); +var Settings = require('../../models').Settings; + +var demoLicense = { + users: 1, + agents: 1, + telephones: 0, + chat: false, + mail: false, + fax: false, + description: 'DEMO LICENSE' +}; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + if (entity.license) { + entity.dataValues.license = license.decrypt(entity.dataValues.license); + entity.dataValues.license = JSON.parse(entity.dataValues.license); + } else { + entity.dataValues.license = demoLicense; + } + + entity.dataValues.license.token = license.getUuid(); + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + entity = { + dataValues: { + license: demoLicense + } + }; + + entity.dataValues.license.token = license.getUuid(); + res.status(201).json(entity); + return null; + } + + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity + .updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity + .destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of Licenses +exports.index = function(req, res) { + // License.findAll() + // .then(responseWithResult(res)) + // .catch(handleError(res)); + + Settings + .findById(1) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single License from the DB +exports.show = function(req, res) { + // License.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(responseWithResult(res)) + // .catch(handleError(res)); +} + +// Creates a new License in the DB +exports.create = function(req, res) { + // License.create(req.body) + // .then(responseWithResult(res, 201)) + // .catch(handleError(res)); +} + +// Creates a new License in the DB +exports.request = function(req, res) { + // License.create(req.body) + // .then(responseWithResult(res, 201)) + // .catch(handleError(res)); + return rp({ + method: 'POST', + uri: config.provisioning + '/servers/' + license.getUuid() + '/request', + body: req.body, + json: true // Automatically stringifies the body to JSON + }) + .then(function(data) { + console.log(data); + res.status(201).send(data); + }) + .catch(function(err) { + console.log(err); + return res.status(err.statusCode || 500).send(err); + }); + // .catch(handleError(res)); +} + +// Updates an existing License in the DB +exports.update = function(req, res) { + // if (req.body.id) { + // delete req.body.id; + // } + // License.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(saveUpdates(req.body)) + // .then(responseWithResult(res)) + // .catch(handleError(res)); +} + +// Deletes a License from the DB +exports.destroy = function(req, res) { + // License.findById(req.params.id) + // .then(handleEntityNotFound(res)) + // .then(removeEntity(res)) + // .catch(handleError(res)); +} diff --git a/server/api/license/license.socket.js b/server/api/license/license.socket.js index 9d46a54..fb7f746 100644 --- a/server/api/license/license.socket.js +++ b/server/api/license/license.socket.js @@ -1 +1,24 @@ -var _0xdf26=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x72\x65\x67\x69\x73\x74\x65\x72","\x6C\x69\x63\x65\x6E\x73\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6C\x69\x63\x65\x6E\x73\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xdf26[0];exports[_0xdf26[1]]=function(_0x89fex1){};function onSave(_0x89fex1,_0x89fex3,_0x89fex4){_0x89fex1[_0xdf26[3]](_0xdf26[2],_0x89fex3)}function onRemove(_0x89fex1,_0x89fex3,_0x89fex4){_0x89fex1[_0xdf26[3]](_0xdf26[4],_0x89fex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +// var License = require('../../models').License; + +exports.register = function (socket) { + // License.afterCreate(function(doc) { + // onSave(socket, doc); + // }); + // License.afterDestroy(function(doc) { + // onRemove(socket, doc); + // }); +}; + +function onSave(socket, doc, cb) { + socket.emit('license:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('license:remove', doc); +} diff --git a/server/api/mail_account/index.js b/server/api/mail_account/index.js index c9ab84b..92b8162 100644 --- a/server/api/mail_account/index.js +++ b/server/api/mail_account/index.js @@ -1 +1,23 @@ -var _0x20c1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x61\x70\x70\x49\x64","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];_0x20c1[0];var express=require(_0x20c1[1]);var controller=require(_0x20c1[2]);var auth=require(_0x20c1[3]);var router=express.Router();router[_0x20c1[7]](_0x20c1[4],auth[_0x20c1[5]](),controller[_0x20c1[6]]);router[_0x20c1[7]](_0x20c1[8],auth[_0x20c1[5]](),controller[_0x20c1[9]]);router[_0x20c1[7]](_0x20c1[10],auth[_0x20c1[5]](),controller[_0x20c1[11]]);router[_0x20c1[13]](_0x20c1[4],auth[_0x20c1[5]](),controller[_0x20c1[12]]);router[_0x20c1[15]](_0x20c1[8],auth[_0x20c1[5]](),controller[_0x20c1[14]]);router[_0x20c1[15]](_0x20c1[10],auth[_0x20c1[5]](),controller[_0x20c1[16]]);router[_0x20c1[17]](_0x20c1[8],auth[_0x20c1[5]](),controller[_0x20c1[14]]);router[_0x20c1[19]](_0x20c1[4],auth[_0x20c1[5]](),controller[_0x20c1[18]]);router[_0x20c1[19]](_0x20c1[8],auth[_0x20c1[5]](),controller[_0x20c1[20]]);router[_0x20c1[19]](_0x20c1[10],auth[_0x20c1[5]](),controller[_0x20c1[21]]);router[_0x20c1[19]](_0x20c1[22],auth[_0x20c1[5]](),controller[_0x20c1[23]]);module[_0x20c1[24]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_account.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/applications', auth.isAuthenticated(), controller.showApplications); +router.post('/', auth.isAuthenticated(), controller.create); +// router.post('/:id/applications', auth.isAuthenticated(), controller.createApplications); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.put('/:id/applications', auth.isAuthenticated(), controller.updateApplications); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/applications', auth.isAuthenticated(), controller.bulkDestroyApplications); +router.delete('/:id/applications/:appId', auth.isAuthenticated(), controller.destroyApplication); + + +module.exports = router; diff --git a/server/api/mail_account/mail_account.controller.js b/server/api/mail_account/mail_account.controller.js index b600b8d..87e8593 100644 --- a/server/api/mail_account/mail_account.controller.js +++ b/server/api/mail_account/mail_account.controller.js @@ -1 +1,242 @@ -var _0x13da=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x6D\x65\x72\x67\x65","\x67\x65\x74\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73"];_0x13da[0];var _=require(_0x13da[1]);var util=require(_0x13da[2]);var async=require(_0x13da[3]);var Util=require(_0x13da[4]);var sequelize=require(_0x13da[6])[_0x13da[5]];var User=require(_0x13da[6])[_0x13da[7]];var MailQueue=require(_0x13da[6])[_0x13da[8]];var MailAccount=require(_0x13da[6])[_0x13da[9]];var MailServerIn=require(_0x13da[6])[_0x13da[10]];var MailServerOut=require(_0x13da[6])[_0x13da[11]];var MailApplication=require(_0x13da[6])[_0x13da[12]];exports[_0x13da[13]]=function(_0x6190xc,_0x6190xd){return MailAccount[_0x13da[22]](_0x13da[21])[_0x13da[20]](Util[_0x13da[19]](_0x6190xc[_0x13da[18]]))[_0x13da[17]](function(_0x6190xf){_0x6190xd[_0x13da[16]](200)[_0x13da[15]](_0x6190xf)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[23]]=function(_0x6190xc,_0x6190xd,_0x6190x10){return MailAccount[_0x13da[22]](_0x13da[21])[_0x13da[27]](_0x6190xc[_0x13da[26]][_0x13da[25]])[_0x13da[17]](function(_0x6190x11){if(!_0x6190x11){return _0x6190xd[_0x13da[24]](404)};return _0x6190xd[_0x13da[15]](_0x6190x11)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[28]]=function(_0x6190xc,_0x6190xd,_0x6190x10){return MailAccount[_0x13da[22]](_0x13da[21])[_0x13da[27]](_0x6190xc[_0x13da[26]][_0x13da[25]])[_0x13da[17]](function(_0x6190x11){if(!_0x6190x11){return _0x6190xd[_0x13da[24]](404)};return _0x6190x11[_0x13da[33]](_[_0x13da[32]](Util[_0x13da[19]](_0x6190xc[_0x13da[18]]),{include:[{model:MailQueue,attributes:[_0x13da[25],_0x13da[30]]},{model:User,attributes:[_0x13da[25],_0x13da[30],_0x13da[31]]}]}))})[_0x13da[17]](function(_0x6190x12){return _0x6190xd[_0x13da[15]]({count:_0x6190x12[_0x13da[29]],rows:_0x6190x12})})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[34]]=function(_0x6190xc,_0x6190xd,_0x6190x10){return sequelize[_0x13da[38]](function(_0x6190x13){return MailAccount[_0x13da[34]](_0x6190xc[_0x13da[37]],{include:[{model:MailServerIn},{model:MailServerOut}],transaction:_0x6190x13})})[_0x13da[17]](function(_0x6190x11){return _0x6190xd[_0x13da[16]](201)[_0x13da[15]](_0x6190x11)})[_0x13da[14]](sequelize.UniqueConstraintError,function(_0x6190xe){return Util[_0x13da[36]][_0x13da[35]](_0x6190xd,_0x6190xe)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[39]]=function(_0x6190xc,_0x6190xd){if(_0x6190xc[_0x13da[37]][_0x13da[25]]){delete _0x6190xc[_0x13da[37]][_0x13da[25]]};return MailAccount[_0x13da[27]](_0x6190xc[_0x13da[26]][_0x13da[25]])[_0x13da[17]](function(_0x6190x11){if(!_0x6190x11){return _0x6190xd[_0x13da[24]](404)};var _0x6190x14=_[_0x13da[32]](_0x6190x11,_0x6190xc[_0x13da[37]]);return _0x6190x14[_0x13da[40]]()})[_0x13da[17]](function(_0x6190x11){return _0x6190xd[_0x13da[16]](200)[_0x13da[15]](_0x6190x11)})[_0x13da[14]](sequelize.UniqueConstraintError,function(_0x6190xe){return Util[_0x13da[36]][_0x13da[35]](_0x6190xd,_0x6190xe)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[41]]=function(_0x6190xc,_0x6190xd){var _0x6190x15=0;var _0x6190x16=_0x6190xc[_0x13da[37]];_0x6190x16[_0x13da[45]](function(_0x6190x17){delete _0x6190x17[_0x13da[25]];delete _0x6190x17[_0x13da[42]];delete _0x6190x17[_0x13da[43]];_0x6190x17[_0x13da[44]]= ++_0x6190x15});return sequelize[_0x13da[38]](function(_0x6190x13){return MailApplication[_0x13da[47]]({where:{MailAccountId:_0x6190xc[_0x13da[26]][_0x13da[25]]},individualHooks:true,transaction:_0x6190x13})[_0x13da[17]](function(_0x6190x19){return MailApplication[_0x13da[46]](_0x6190x16,{individualHooks:true,transaction:_0x6190x13})})})[_0x13da[17]](function(_0x6190x18){return _0x6190xd[_0x13da[16]](200)[_0x13da[15]]({count:_0x6190x18[_0x13da[29]],rows:_0x6190x18})})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[47]]=function(_0x6190xc,_0x6190xd,_0x6190x10){return MailAccount[_0x13da[27]](_0x6190xc[_0x13da[26]][_0x13da[25]])[_0x13da[17]](function(_0x6190x11){if(!_0x6190x11){return _0x6190xd[_0x13da[24]](404)};return _0x6190x11[_0x13da[47]]()})[_0x13da[17]](function(){return _0x6190xd[_0x13da[24]](204)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[48]]=function(_0x6190xc,_0x6190xd,_0x6190x10){return MailApplication[_0x13da[27]](_0x6190xc[_0x13da[26]][_0x13da[49]])[_0x13da[17]](function(_0x6190x19){if(!_0x6190x19){return _0x6190xd[_0x13da[24]](404)};return _0x6190x19[_0x13da[47]]()})[_0x13da[17]](function(){return _0x6190xd[_0x13da[24]](204)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[50]]=function(_0x6190xc,_0x6190xd){return MailAccount[_0x13da[47]]({where:{id:_0x6190xc[_0x13da[18]][_0x13da[51]]},individualHooks:true})[_0x13da[17]](function(){return _0x6190xd[_0x13da[24]](204)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};exports[_0x13da[52]]=function(_0x6190xc,_0x6190xd){return MailApplication[_0x13da[47]]({where:{id:_0x6190xc[_0x13da[18]][_0x13da[51]]},individualHooks:true})[_0x13da[17]](function(){return _0x6190xd[_0x13da[24]](204)})[_0x13da[14]](function(_0x6190xe){return handleError(_0x6190xd,_0x6190xe)})};function handleError(_0x6190xd,_0x6190xe){return _0x6190xd[_0x13da[16]](500)[_0x13da[15]](_0x6190xe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var async = require('async'); + +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var User = require('../../models').User; +var MailQueue = require('../../models').MailQueue; +var MailAccount = require('../../models').MailAccount; +var MailServerIn = require('../../models').MailServerIn; +var MailServerOut = require('../../models').MailServerOut; +var MailApplication = require('../../models').MailApplication; + +// Get list of mailAccounts +exports.index = function(req, res) { + return MailAccount + .scope('default') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailAccount +exports.show = function(req, res, next) { + return MailAccount + .scope('default') + .findById(req.params.id) + .then(function(mailAccount) { + if (!mailAccount) { + return res.sendStatus(404); + } + return res.send(mailAccount); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailAccount +exports.showApplications = function(req, res, next) { + return MailAccount + .scope('default') + .findById(req.params.id) + .then(function(mailAccount) { + if (!mailAccount) { + return res.sendStatus(404); + } + return mailAccount + .getMailApplications(_.merge(Util.getQuery(req.query), { + include: [{ + model: MailQueue, + attributes: ['id', 'name'] + }, { + model: User, + attributes: ['id', 'name', 'online'] + }] + })); + }) + .then(function(mailApplications) { + return res.send({ + count: mailApplications.length, + rows: mailApplications + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailAccount in the DB. +exports.create = function(req, res, next) { + return sequelize.transaction(function(t) { + return MailAccount + .create(req.body, { + include: [{ + model: MailServerIn + }, { + model: MailServerOut + }], + transaction: t + }); + }).then(function(mailAccount) { + return res.status(201).send(mailAccount); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailAccount in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return MailAccount + .findById(req.params.id) + .then(function(mailAccount) { + if (!mailAccount) { + return res.sendStatus(404); + } + var updated = _.merge(mailAccount, req.body); + return updated + .save(); + }) + .then(function(mailAccount) { + return res.status(200).send(mailAccount); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailAccount in the DB. +exports.updateApplications = function(req, res) { + + var priority = 0; + var apps = req.body; + + apps.forEach(function(app) { + delete app.id; + delete app.createdAt; + delete app.updatedAt; + + app.priority = ++priority; + }); + + return sequelize.transaction(function(t) { + return MailApplication + .destroy({ + where: { + MailAccountId: req.params.id + }, + individualHooks: true, + transaction: t + }).then(function(mailApplication) { + return MailApplication + .bulkCreate(apps, { + individualHooks: true, + transaction: t + }); + }); + }).then(function(mailAccounts) { + return res.status(200).send({ + count: mailAccounts.length, + rows: mailAccounts + }); + }).catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailAccount from the DB. +exports.destroy = function(req, res, next) { + return MailAccount + .findById(req.params.id) + .then(function(mailAccount) { + if (!mailAccount) { + return res.sendStatus(404); + } + + return mailAccount + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailAccount from the DB. +exports.destroyApplication = function(req, res, next) { + return MailApplication + .findById(req.params.appId) + .then(function(mailApplication) { + if (!mailApplication) { + return res.sendStatus(404); + } + + return mailApplication + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return MailAccount + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroyApplications = function(req, res) { + return MailApplication + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_account/mail_account.socket.js b/server/api/mail_account/mail_account.socket.js index dfe746f..5b51c79 100644 --- a/server/api/mail_account/mail_account.socket.js +++ b/server/api/mail_account/mail_account.socket.js @@ -1 +1,27 @@ -var _0xc891=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xc891[0];var MailAccount=require(_0xc891[2])[_0xc891[1]];exports[_0xc891[3]]=function(_0xeab8x2){MailAccount[_0xc891[4]](function(_0xeab8x3){onSave(_0xeab8x2,_0xeab8x3)});MailAccount[_0xc891[5]](function(_0xeab8x3){onSave(_0xeab8x2,_0xeab8x3)});MailAccount[_0xc891[6]](function(_0xeab8x3){onRemove(_0xeab8x2,_0xeab8x3)})};function onSave(_0xeab8x2,_0xeab8x3,_0xeab8x5){_0xeab8x2[_0xc891[8]](_0xc891[7],_0xeab8x3)}function onRemove(_0xeab8x2,_0xeab8x3,_0xeab8x5){_0xeab8x2[_0xc891[8]](_0xc891[9],_0xeab8x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailAccount = require('../../models').MailAccount; + +exports.register = function(socket) { + MailAccount.afterCreate(function(doc) { + onSave(socket, doc); + }); + MailAccount.afterUpdate(function(doc) { + onSave(socket, doc); + }); + MailAccount.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_account:remove', doc); +} diff --git a/server/api/mail_application/index.js b/server/api/mail_application/index.js index 32fed73..3c132bb 100644 --- a/server/api/mail_application/index.js +++ b/server/api/mail_application/index.js @@ -1 +1,15 @@ -var _0x63d6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x63d6[0];var express=require(_0x63d6[1]);var controller=require(_0x63d6[2]);var router=express.Router();router[_0x63d6[5]](_0x63d6[3],controller[_0x63d6[4]]);router[_0x63d6[5]](_0x63d6[6],controller[_0x63d6[7]]);router[_0x63d6[9]](_0x63d6[3],controller[_0x63d6[8]]);router[_0x63d6[11]](_0x63d6[6],controller[_0x63d6[10]]);router[_0x63d6[12]](_0x63d6[6],controller[_0x63d6[10]]);router[_0x63d6[14]](_0x63d6[6],controller[_0x63d6[13]]);module[_0x63d6[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_application.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/mail_application/mail_application.controller.js b/server/api/mail_application/mail_application.controller.js index a9a2255..260557e 100644 --- a/server/api/mail_application/mail_application.controller.js +++ b/server/api/mail_application/mail_application.controller.js @@ -1 +1,111 @@ -var _0xbb5a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x6D\x61\x78","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xbb5a[0];var _=require(_0xbb5a[1]);var MailApplication=require(_0xbb5a[3])[_0xbb5a[2]];exports[_0xbb5a[4]]=function(_0x8b00x3,_0x8b00x4,_0x8b00x5){MailApplication[_0xbb5a[11]]({where:_0x8b00x3[_0xbb5a[9]],order:_0xbb5a[10],include:[{all:true}]})[_0xbb5a[8]](function(_0x8b00x7){return _0x8b00x4[_0xbb5a[7]](200)[_0xbb5a[6]](_0x8b00x7)})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})};exports[_0xbb5a[12]]=function(_0x8b00x3,_0x8b00x4,_0x8b00x5){MailApplication[_0xbb5a[16]](_0x8b00x3[_0xbb5a[15]][_0xbb5a[14]],{include:[{all:true}]})[_0xbb5a[8]](function(_0x8b00x8){if(!_0x8b00x8){return _0x8b00x4[_0xbb5a[13]](404)};return _0x8b00x4[_0xbb5a[6]](_0x8b00x8)})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})};exports[_0xbb5a[17]]=function(_0x8b00x3,_0x8b00x4,_0x8b00x5){MailApplication[_0xbb5a[20]](_0xbb5a[10],{where:{MailAccountId:_0x8b00x3[_0xbb5a[18]][_0xbb5a[19]]}})[_0xbb5a[8]](function(_0x8b00x9){_0x8b00x3[_0xbb5a[18]][_0xbb5a[10]]=_0x8b00x9?++_0x8b00x9:1;MailApplication[_0xbb5a[17]](_0x8b00x3[_0xbb5a[18]])[_0xbb5a[8]](function(_0x8b00x8){return _0x8b00x4[_0xbb5a[7]](201)[_0xbb5a[6]](_0x8b00x8)})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})};exports[_0xbb5a[21]]=function(_0x8b00x3,_0x8b00x4,_0x8b00x5){if(_0x8b00x3[_0xbb5a[18]][_0xbb5a[14]]){delete _0x8b00x3[_0xbb5a[18]][_0xbb5a[14]]};MailApplication[_0xbb5a[16]](_0x8b00x3[_0xbb5a[15]][_0xbb5a[14]])[_0xbb5a[8]](function(_0x8b00x8){if(!_0x8b00x8){return _0x8b00x4[_0xbb5a[13]](404)};var _0x8b00xa=_[_0xbb5a[22]](_0x8b00x8,_0x8b00x3[_0xbb5a[18]]);_0x8b00xa[_0xbb5a[23]]()[_0xbb5a[8]](function(){return _0x8b00x4[_0xbb5a[7]](200)[_0xbb5a[6]](_0x8b00x8)})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})};exports[_0xbb5a[24]]=function(_0x8b00x3,_0x8b00x4,_0x8b00x5){MailApplication[_0xbb5a[16]](_0x8b00x3[_0xbb5a[15]][_0xbb5a[14]])[_0xbb5a[8]](function(_0x8b00x8){if(!_0x8b00x8){return _0x8b00x4[_0xbb5a[13]](404)};_0x8b00x8[_0xbb5a[24]]()[_0xbb5a[8]](function(){return _0x8b00x4[_0xbb5a[13]](204)})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})})[_0xbb5a[5]](function(_0x8b00x6){return handleError(_0x8b00x4,_0x8b00x6)})};function handleError(_0x8b00x4,_0x8b00x6){return _0x8b00x4[_0xbb5a[7]](500)[_0xbb5a[6]](_0x8b00x6)} \ No newline at end of file +'use strict'; +var _ = require('lodash'); +var MailApplication = require('../../models').MailApplication; +// Get list of mailApplications +exports.index = function(req, res, next) { + MailApplication + .findAll({ + where: req.query, + order: 'priority', + include: [{ + all: true + }] + }) + .then(function(mailApplications) { + return res.status(200).send(mailApplications); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Get a single mailApplication +exports.show = function(req, res, next) { + MailApplication + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(mailApplication) { + if (!mailApplication) { + return res.sendStatus(404); + } + return res.send(mailApplication); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Creates a new mailApplication in the DB. +exports.create = function(req, res, next) { + MailApplication + .max('priority', { + where: { + MailAccountId: req.body.MailAccountId + } + }).then(function(max) { + // SET PRIORITY + req.body.priority = max ? ++max : 1; + MailApplication + .create(req.body) + .then(function(mailApplication) { + return res.status(201).send(mailApplication); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Updates an existing mailApplication in the DB. +exports.update = function(req, res, next) { + if (req.body.id) { + delete req.body.id; + } + MailApplication + .findById(req.params.id) + .then(function(mailApplication) { + if (!mailApplication) { + return res.sendStatus(404); + } + var updated = _.merge(mailApplication, req.body); + updated + .save() + .then(function() { + return res.status(200).send(mailApplication); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Deletes a mailApplication from the DB. +exports.destroy = function(req, res, next) { + MailApplication + .findById(req.params.id) + .then(function(mailApplication) { + if (!mailApplication) { + return res.sendStatus(404); + } + mailApplication + .destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_application/mail_application.socket.js b/server/api/mail_application/mail_application.socket.js index c26bcdf..ead0c90 100644 --- a/server/api/mail_application/mail_application.socket.js +++ b/server/api/mail_application/mail_application.socket.js @@ -1 +1,24 @@ -var _0xe96e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xe96e[0];var mailApplication=require(_0xe96e[2])[_0xe96e[1]];exports[_0xe96e[3]]=function(_0x52b9x2){mailApplication[_0xe96e[4]](function(_0x52b9x3){onSave(_0x52b9x2,_0x52b9x3)});mailApplication[_0xe96e[5]](function(_0x52b9x3){onRemove(_0x52b9x2,_0x52b9x3)})};function onSave(_0x52b9x2,_0x52b9x3,_0x52b9x5){_0x52b9x2[_0xe96e[7]](_0xe96e[6],_0x52b9x3)}function onRemove(_0x52b9x2,_0x52b9x3,_0x52b9x5){_0x52b9x2[_0xe96e[7]](_0xe96e[8],_0x52b9x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var mailApplication = require('../../models').MailApplication; + +exports.register = function(socket) { + mailApplication.afterCreate(function(doc) { + onSave(socket, doc); + }); + mailApplication.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_application:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_application:remove', doc); +} diff --git a/server/api/mail_application/mail_application.spec.js b/server/api/mail_application/mail_application.spec.js index 364f9ff..023b99b 100644 --- a/server/api/mail_application/mail_application.spec.js +++ b/server/api/mail_application/mail_application.spec.js @@ -1 +1,20 @@ -var _0x3f18=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0x3f18[0];var should=require(_0x3f18[1]);var app=require(_0x3f18[2]);var request=require(_0x3f18[3]);describe(_0x3f18[4],function(){it(_0x3f18[5],function(_0xd6a3x4){request(app)[_0x3f18[13]](_0x3f18[12])[_0x3f18[11]](200)[_0x3f18[11]](_0x3f18[10],/json/)[_0x3f18[9]](function(_0xd6a3x5,_0xd6a3x6){if(_0xd6a3x5){return _0xd6a3x4(_0xd6a3x5)};_0xd6a3x6[_0x3f18[8]][_0x3f18[1]][_0x3f18[7]][_0x3f18[6]](Array);_0xd6a3x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/mail/applications', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/mail/applications') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/mail_attachment/index.js b/server/api/mail_attachment/index.js index d438b27..f154de4 100644 --- a/server/api/mail_attachment/index.js +++ b/server/api/mail_attachment/index.js @@ -1 +1,15 @@ -var _0xc726=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xc726[0];var express=require(_0xc726[1]);var controller=require(_0xc726[2]);var router=express.Router();router[_0xc726[5]](_0xc726[3],controller[_0xc726[4]]);router[_0xc726[5]](_0xc726[6],controller[_0xc726[7]]);router[_0xc726[9]](_0xc726[3],controller[_0xc726[8]]);router[_0xc726[11]](_0xc726[6],controller[_0xc726[10]]);router[_0xc726[12]](_0xc726[6],controller[_0xc726[10]]);router[_0xc726[14]](_0xc726[6],controller[_0xc726[13]]);module[_0xc726[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_attachment.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/mail_attachment/mail_attachment.controller.js b/server/api/mail_attachment/mail_attachment.controller.js index ff92eaf..72d2b7b 100644 --- a/server/api/mail_attachment/mail_attachment.controller.js +++ b/server/api/mail_attachment/mail_attachment.controller.js @@ -1 +1,100 @@ -var _0x696f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x66\x73","\x66\x6F\x72\x6D\x69\x64\x61\x62\x6C\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x6E\x61\x6D\x65","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x75\x70\x6C\x6F\x61\x64\x44\x69\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6A\x6F\x69\x6E","\x6B\x65\x65\x70\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x6D\x75\x6C\x74\x69\x70\x6C\x65\x73","\x68\x61\x73\x68","\x73\x69\x7A\x65","\x66\x69\x6C\x65","\x74\x79\x70\x65","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x75\x6E\x6C\x69\x6E\x6B","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79"];_0x696f[0];var _=require(_0x696f[1]);var path=require(_0x696f[2]);var fs=require(_0x696f[3]);var formidable=require(_0x696f[4]);var Promise=require(_0x696f[5]);var config=require(_0x696f[6]);var MailAttachment=require(_0x696f[8])[_0x696f[7]];exports[_0x696f[9]]=function(_0x75ddx8,_0x75ddx9,_0x75ddxa){return MailAttachment[_0x696f[14]]()[_0x696f[13]](function(_0x75ddxc){return _0x75ddx9[_0x696f[12]](200)[_0x696f[11]](_0x75ddxc)})[_0x696f[10]](function(_0x75ddxb){return _0x75ddxa(_0x75ddxb)})};exports[_0x696f[15]]=function(_0x75ddx8,_0x75ddx9,_0x75ddxa){return MailAttachment[_0x696f[20]](_0x75ddx8[_0x696f[19]][_0x696f[18]])[_0x696f[13]](function(_0x75ddxd){return _0x75ddx9[_0x696f[17]](_0x75ddxd[_0x696f[2]],_0x75ddxd[_0x696f[16]])})[_0x696f[10]](function(_0x75ddxb){return _0x75ddxa(_0x75ddxb)})};exports[_0x696f[21]]=function(_0x75ddx8,_0x75ddx9,_0x75ddxa){var _0x75ddxe= new formidable.IncomingForm();_0x75ddxe[_0x696f[22]]=path[_0x696f[27]](config[_0x696f[23]],_0x696f[24],_0x696f[25],_0x696f[26]);_0x75ddxe[_0x696f[28]]=true;_0x75ddxe[_0x696f[29]]=true;_0x75ddxe[_0x696f[30]]=true;_0x75ddxe[_0x696f[35]](_0x75ddx8,function(_0x75ddxb,_0x75ddxe,_0x75ddxf){if(_0x75ddxb){return _0x75ddx9[_0x696f[12]](500)[_0x696f[11]](_0x75ddxb)};return _0x75ddx9[_0x696f[12]](201)[_0x696f[11]]({size:_0x75ddxf[_0x696f[32]][_0x696f[31]],path:_0x75ddxf[_0x696f[32]][_0x696f[2]],name:_0x75ddxf[_0x696f[32]][_0x696f[16]],type:_0x75ddxf[_0x696f[32]][_0x696f[33]],basename:path[_0x696f[34]](_0x75ddxf[_0x696f[32]][_0x696f[2]])})})};exports[_0x696f[36]]=function(_0x75ddx8,_0x75ddx9,_0x75ddxa){if(_0x75ddx8[_0x696f[37]][_0x696f[18]]){delete _0x75ddx8[_0x696f[37]][_0x696f[18]]};MailAttachment[_0x696f[20]](_0x75ddx8[_0x696f[19]][_0x696f[18]])[_0x696f[13]](function(_0x75ddxd){if(!_0x75ddxd){return _0x75ddx9[_0x696f[38]](404)};var _0x75ddx10=_[_0x696f[39]](_0x75ddxd,_0x75ddx8[_0x696f[37]]);_0x75ddx10[_0x696f[40]]()[_0x696f[13]](function(){return _0x75ddx9[_0x696f[12]](200)[_0x696f[11]](_0x75ddxd)})[_0x696f[10]](function(_0x75ddxb){return _0x75ddxa(_0x75ddxb)})})[_0x696f[10]](function(_0x75ddxb){return _0x75ddxa(_0x75ddxb)})};exports[_0x696f[41]]=function(_0x75ddx8,_0x75ddx9,_0x75ddxa){var _0x75ddx11=Promise[_0x696f[43]](require(_0x696f[3])[_0x696f[42]]);var _0x75ddx12=path[_0x696f[27]](config[_0x696f[23]],_0x696f[24],_0x696f[25],_0x696f[26],_0x75ddx8[_0x696f[19]][_0x696f[18]]);return _0x75ddx11(_0x75ddx12)[_0x696f[13]](function(){return _0x75ddx9[_0x696f[38]](204)})[_0x696f[10]](function(_0x75ddxb){return handleError(_0x75ddx9,_0x75ddxb)})};function handleError(_0x75ddx9,_0x75ddxb){return _0x75ddx9[_0x696f[12]](500)[_0x696f[11]](_0x75ddxb)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var path = require('path'); +var fs = require('fs'); +var formidable = require('formidable'); +var Promise = require('bluebird'); + +var config = require('../../config/environment'); +var MailAttachment = require('../../models').MailAttachment; + +// Get list of mailAttachments +exports.index = function(req, res, next) { + return MailAttachment + .findAll() + .then(function(mailAttachments) { + return res.status(200).send(mailAttachments); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Get a single mailAttachment +exports.show = function(req, res, next) { + return MailAttachment + .findById(req.params.id) + .then(function(mailAttachment) { + return res.download(mailAttachment.path, mailAttachment.name); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Creates a new mailAttachment in the DB. +exports.create = function(req, res, next) { + + var form = new formidable.IncomingForm(); + form.uploadDir = path.join(config.root, 'server', 'files', 'attachments'); + form.keepExtensions = true; + form.multiples = true; + form.hash = true; + + form.parse(req, function(err, form, wrap) { + if (err) { + return res.status(500).send(err); + } + return res.status(201).send({ + size: wrap.file.size, + path: wrap.file.path, + name: wrap.file.name, + type: wrap.file.type, + basename: path.basename(wrap.file.path) + }); + }); +}; + +// Updates an existing mailAttachment in the DB. +exports.update = function(req, res, next) { + if (req.body.id) { + delete req.body.id; + } + MailAttachment + .findById(req.params.id) + .then(function(mailAttachment) { + if (!mailAttachment) { + return res.sendStatus(404); + } + var updated = _.merge(mailAttachment, req.body); + updated.save() + .then(function() { + return res.status(200).send(mailAttachment); + }) + .catch(function(err) { + return next(err); + }); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Deletes a mailAttachment from the DB. +exports.destroy = function(req, res, next) { + var unlink = Promise.promisify(require("fs").unlink); + var _path = path.join(config.root, 'server', 'files', 'attachments', req.params.id); + + return unlink(_path) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_attachment/mail_attachment.socket.js b/server/api/mail_attachment/mail_attachment.socket.js index a4f6e63..65c9085 100644 --- a/server/api/mail_attachment/mail_attachment.socket.js +++ b/server/api/mail_attachment/mail_attachment.socket.js @@ -1 +1,24 @@ -var _0xbe5f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xbe5f[0];var mail_attachment=require(_0xbe5f[2])[_0xbe5f[1]];exports[_0xbe5f[3]]=function(_0x9e89x2){mail_attachment[_0xbe5f[4]](function(_0x9e89x3){onSave(_0x9e89x2,_0x9e89x3)});mail_attachment[_0xbe5f[5]](function(_0x9e89x3){onRemove(_0x9e89x2,_0x9e89x3)})};function onSave(_0x9e89x2,_0x9e89x3,_0x9e89x5){_0x9e89x2[_0xbe5f[7]](_0xbe5f[6],_0x9e89x3)}function onRemove(_0x9e89x2,_0x9e89x3,_0x9e89x5){_0x9e89x2[_0xbe5f[7]](_0xbe5f[8],_0x9e89x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var mail_attachment = require('../../models').MailAttachment; + +exports.register = function(socket) { + mail_attachment.afterCreate(function (doc) { + onSave(socket, doc); + }); + mail_attachment.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_attachment:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_attachment:remove', doc); +} diff --git a/server/api/mail_message/index.js b/server/api/mail_message/index.js index 89bde1c..58b5988 100644 --- a/server/api/mail_message/index.js +++ b/server/api/mail_message/index.js @@ -1 +1,19 @@ -var _0xbe9d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x64\x65\x6C\x65\x74\x65\x2F\x62\x75\x6C\x6B","\x62\x75\x6C\x6B\x44\x65\x6C\x65\x74\x65","\x2F\x64\x65\x6C\x65\x74\x65\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xbe9d[0];var express=require(_0xbe9d[1]);var controller=require(_0xbe9d[2]);var auth=require(_0xbe9d[3]);var router=express.Router();router[_0xbe9d[7]](_0xbe9d[4],auth[_0xbe9d[5]](),controller[_0xbe9d[6]]);router[_0xbe9d[7]](_0xbe9d[8],auth[_0xbe9d[5]](),controller[_0xbe9d[9]]);router[_0xbe9d[11]](_0xbe9d[4],auth[_0xbe9d[5]](),controller[_0xbe9d[10]]);router[_0xbe9d[13]](_0xbe9d[4],auth[_0xbe9d[5]](),controller[_0xbe9d[12]]);router[_0xbe9d[13]](_0xbe9d[14],auth[_0xbe9d[5]](),controller[_0xbe9d[15]]);router[_0xbe9d[13]](_0xbe9d[16],auth[_0xbe9d[5]](),controller[_0xbe9d[12]]);router[_0xbe9d[13]](_0xbe9d[8],auth[_0xbe9d[5]](),controller[_0xbe9d[12]]);router[_0xbe9d[17]](_0xbe9d[8],auth[_0xbe9d[5]](),controller[_0xbe9d[12]]);router[_0xbe9d[19]](_0xbe9d[8],auth[_0xbe9d[5]](),controller[_0xbe9d[18]]);module[_0xbe9d[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_message.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/', auth.isAuthenticated(), controller.update); +router.put('/delete/bulk', auth.isAuthenticated(), controller.bulkDelete); +router.put('/delete/:id', auth.isAuthenticated(), controller.update); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/mail_message/mail_message.controller.js b/server/api/mail_message/mail_message.controller.js index 7f9205d..0105703 100644 --- a/server/api/mail_message/mail_message.controller.js +++ b/server/api/mail_message/mail_message.controller.js @@ -1 +1,179 @@ -var _0x1287=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x61\x73\x79\x6E\x63","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x66\x6F\x72\x6D\x69\x64\x61\x62\x6C\x65","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x6F\x6E\x74\x61\x63\x74","\x55\x73\x65\x72","\x69\x6E\x64\x65\x78","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x44\x45\x53\x43","\x77\x68\x65\x72\x65","\x71\x75\x65\x72\x79","\x61\x64\x6D\x69\x6E","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x75\x73\x65\x72","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x65\x72\x72\x6F\x72","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x6C\x65\x74\x65","\x54\x52\x41\x53\x48","\x62\x75\x6C\x6B\x55\x70\x64\x61\x74\x65"];_0x1287[0];var _=require(_0x1287[1]);var async=require(_0x1287[2]);var htmlToText=require(_0x1287[3]);var formidable=require(_0x1287[4]);var path=require(_0x1287[5]);var config=require(_0x1287[6]);var sequelize=require(_0x1287[8])[_0x1287[7]];var MailMessage=require(_0x1287[8])[_0x1287[9]];var MailAttachment=require(_0x1287[8])[_0x1287[10]];var MailRoom=require(_0x1287[8])[_0x1287[11]];var MailAccount=require(_0x1287[8])[_0x1287[12]];var ContactEmail=require(_0x1287[8])[_0x1287[13]];var Contact=require(_0x1287[8])[_0x1287[14]];var User=require(_0x1287[8])[_0x1287[15]];exports[_0x1287[16]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){var _0xa5f0x12={order:_0x1287[17],include:[{all:true,include:[{all:true}]}]};switch(_0xa5f0xf[_0x1287[23]][_0x1287[22]]){case _0x1287[20]:_0xa5f0x12[_0x1287[18]]=_0xa5f0xf[_0x1287[19]];break;case _0x1287[21]:break;default:};return MailMessage[_0x1287[28]](_0xa5f0x12)[_0x1287[27]](function(_0xa5f0x14){return _0xa5f0x10[_0x1287[26]](200)[_0x1287[25]](_0xa5f0x14)})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})};exports[_0x1287[29]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){return MailMessage[_0x1287[36]](_0xa5f0xf[_0x1287[32]][_0x1287[31]],{include:[{model:MailAttachment},{model:User,attributes:[_0x1287[31],_0x1287[33],_0x1287[34],_0x1287[35]]}]})[_0x1287[27]](function(_0xa5f0x15){if(!_0xa5f0x15){return _0xa5f0x10[_0x1287[30]](404)};return _0xa5f0x10[_0x1287[25]](_0xa5f0x15)})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})};exports[_0x1287[37]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){_0xa5f0xf[_0x1287[39]][_0x1287[38]]=_0xa5f0xf[_0x1287[23]][_0x1287[31]];_0xa5f0xf[_0x1287[39]][_0x1287[40]]=_0xa5f0xf[_0x1287[39]][_0x1287[40]]||htmlToText[_0x1287[42]](_0xa5f0xf[_0x1287[39]][_0x1287[41]],{wordwrap:false});return sequelize[_0x1287[46]]()[_0x1287[27]](function(_0xa5f0x16){return MailMessage[_0x1287[37]](_0xa5f0xf[_0x1287[39]],{include:[{model:MailAttachment}],transaction:_0xa5f0x16})[_0x1287[27]](function(_0xa5f0x15){_0xa5f0x16[_0x1287[45]]();return _0xa5f0x10[_0x1287[26]](201)[_0x1287[25]](_0xa5f0x15)})[_0x1287[24]](function(_0xa5f0x13){console[_0x1287[43]](_0xa5f0x13);_0xa5f0x16[_0x1287[44]]();return handleError(_0xa5f0x10,_0xa5f0x13)})})};exports[_0x1287[47]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){MailMessage[_0x1287[36]](_0xa5f0xf[_0x1287[32]][_0x1287[31]],{include:[{all:true}]})[_0x1287[27]](function(_0xa5f0x15){if(!_0xa5f0x15){return _0xa5f0x10[_0x1287[30]](404)};var _0xa5f0x17=_[_0x1287[48]](_0xa5f0x15,_0xa5f0xf[_0x1287[39]]);_0xa5f0x17[_0x1287[49]]()[_0x1287[27]](function(){return _0xa5f0x10[_0x1287[26]](200)[_0x1287[25]](_0xa5f0x17)})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})};exports[_0x1287[50]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){MailMessage[_0x1287[36]](_0xa5f0xf[_0x1287[32]][_0x1287[31]])[_0x1287[27]](function(_0xa5f0x15){if(!_0xa5f0x15){return _0xa5f0x10[_0x1287[30]](404)};_0xa5f0x15[_0x1287[50]]()[_0x1287[27]](function(){return _0xa5f0x10[_0x1287[30]](204)})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})};exports[_0x1287[51]]=function(_0xa5f0xf,_0xa5f0x10,_0xa5f0x11){MailMessage[_0x1287[53]]({where:{id:{$in:_0xa5f0xf[_0x1287[39]][_0x1287[31]]}},attributes:{directory:_0x1287[52]}})[_0x1287[27]](function(_0xa5f0x15){if(!_0xa5f0x15){return _0xa5f0x10[_0x1287[30]](404)};_0xa5f0x15[_0x1287[50]]()[_0x1287[27]](function(){return _0xa5f0x10[_0x1287[30]](204)})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})})[_0x1287[24]](function(_0xa5f0x13){return handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11)})};function handleError(_0xa5f0x10,_0xa5f0x13,_0xa5f0x11){return _0xa5f0x10[_0x1287[26]](500)[_0x1287[25]](_0xa5f0x13)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var async = require('async'); + +var htmlToText = require('html-to-text'); +var formidable = require('formidable'); +var path = require('path'); + +var config = require('../../config/environment'); +var sequelize = require('../../models').sequelize; +var MailMessage = require('../../models').MailMessage; +var MailAttachment = require('../../models').MailAttachment; +var MailRoom = require('../../models').MailRoom; +var MailAccount = require('../../models').MailAccount; +var ContactEmail = require('../../models').ContactEmail; +var Contact = require('../../models').Contact; +var User = require('../../models').User; + +// Get list of mail_messages +exports.index = function(req, res, next) { + var params = { + order: 'createdAt DESC', + include: [{ + all: true, + include: [{ + all: true + }] + }] + }; + + switch (req.user.role) { + case 'admin': + params.where = req.query; + break; + case 'agent': + break; + default: + } + + return MailMessage + .findAll(params) + .then(function(mail_messages) { + return res.status(200).send(mail_messages); + }) + .catch(function(err) { + return handleError(res, err, next); + }); +}; + +// Get a single mailMessage +exports.show = function(req, res, next) { + return MailMessage + .findById(req.params.id, { + include: [{ + model: MailAttachment + }, { + model: User, + attributes: ['id', 'name', 'fullname', 'email'] + }] + }) + .then(function(mailMessage) { + if (!mailMessage) { + return res.sendStatus(404); + } + return res.send(mailMessage); + }) + .catch(function(err) { + return handleError(res, err, next); + }); +}; + +// Creates a new mailMessage in the DB. +exports.create = function(req, res, next) { + req.body.UserId = req.user.id; + req.body.text = req.body.text || htmlToText.fromString(req.body.html, { + wordwrap: false + }); + + return sequelize.transaction().then(function(t) { + return MailMessage + .create(req.body, { + include: [{ + model: MailAttachment + }], + transaction: t, + // user: req.user + }).then(function(mailMessage) { + t.commit(); + return res.status(201).send(mailMessage); + }).catch(function(err) { + console.error(err); + t.rollback(); + return handleError(res, err); + }); + }); +}; + +// Updates an existing mailMessage in the DB. +exports.update = function(req, res, next) { + + MailMessage + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(mailMessage) { + if (!mailMessage) { + return res.sendStatus(404); + } + var updated = _.merge(mailMessage, req.body); + updated.save() + .then(function() { + return res.status(200).send(updated); + }) + .catch(function(err) { + return handleError(res, err, next); + }); + }) + .catch(function(err) { + return handleError(res, err, next); + }); +}; + +// Deletes a mailMessage from the DB. +exports.destroy = function(req, res, next) { + MailMessage + .findById(req.params.id) + .then(function(mailMessage) { + if (!mailMessage) { + return res.sendStatus(404); + } + mailMessage.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err, next); + }); + }) + .catch(function(err) { + return handleError(res, err, next); + }); +}; + +// Deletes a mailMessage from the DB. +exports.bulkDelete = function(req, res, next) { + MailMessage + .bulkUpdate({ + where: { + id: { + $in: req.body.id + } + }, + attributes: { + directory: 'TRASH' + } + }) + .then(function(mailMessage) { + if (!mailMessage) { + return res.sendStatus(404); + } + mailMessage.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err, next); + }); + }) + .catch(function(err) { + return handleError(res, err, next); + }); +}; + +function handleError(res, err, next) { + return res.status(500).send(err); +} diff --git a/server/api/mail_message/mail_message.socket.js b/server/api/mail_message/mail_message.socket.js index b068d73..64a5b96 100644 --- a/server/api/mail_message/mail_message.socket.js +++ b/server/api/mail_message/mail_message.socket.js @@ -1 +1,31 @@ -var _0x6ace=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x49\x64","\x55\x73\x65\x72\x49\x64","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x6ace[0];var MailMessage=require(_0x6ace[2])[_0x6ace[1]];exports[_0x6ace[3]]=function(_0x1c8cx2){MailMessage[_0x6ace[4]](function(_0x1c8cx3){onSave(_0x1c8cx2,_0x1c8cx3)});MailMessage[_0x6ace[5]](function(_0x1c8cx3){onSave(_0x1c8cx2,_0x1c8cx3)});MailMessage[_0x6ace[6]](function(_0x1c8cx3){onRemove(_0x1c8cx2,_0x1c8cx3)})};function onSave(_0x1c8cx2,_0x1c8cx3,_0x1c8cx5){if(_0x1c8cx2[_0x6ace[7]]===_0x1c8cx3[_0x6ace[8]]||_0x1c8cx2[_0x6ace[9]]===_0x6ace[10]){_0x1c8cx2[_0x6ace[12]](_0x6ace[11],_0x1c8cx3)}}function onRemove(_0x1c8cx2,_0x1c8cx3,_0x1c8cx5){_0x1c8cx2[_0x6ace[12]](_0x6ace[13],_0x1c8cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailMessage = require('../../models').MailMessage; + +exports.register = function(socket) { + MailMessage.afterCreate(function(doc) { + onSave(socket, doc); + }); + + MailMessage.afterUpdate(function(doc) { + onSave(socket, doc); + }); + + MailMessage.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (socket.userId === doc.UserId || socket.role === 'admin') { + socket.emit('mail_message:save', doc); + } +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_message:remove', doc); +} diff --git a/server/api/mail_queue/index.js b/server/api/mail_queue/index.js index 1cebf5a..1252097 100644 --- a/server/api/mail_queue/index.js +++ b/server/api/mail_queue/index.js @@ -1 +1,20 @@ -var _0xadeb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x65\x78\x70\x6F\x72\x74\x73"];_0xadeb[0];var express=require(_0xadeb[1]);var controller=require(_0xadeb[2]);var auth=require(_0xadeb[3]);var router=express.Router();router[_0xadeb[7]](_0xadeb[4],auth[_0xadeb[5]](),controller[_0xadeb[6]]);router[_0xadeb[7]](_0xadeb[8],auth[_0xadeb[5]](),controller[_0xadeb[9]]);router[_0xadeb[7]](_0xadeb[10],auth[_0xadeb[5]](),controller[_0xadeb[11]]);router[_0xadeb[13]](_0xadeb[4],auth[_0xadeb[5]](),controller[_0xadeb[12]]);router[_0xadeb[13]](_0xadeb[10],auth[_0xadeb[5]](),controller[_0xadeb[14]]);router[_0xadeb[16]](_0xadeb[8],auth[_0xadeb[5]](),controller[_0xadeb[15]]);router[_0xadeb[17]](_0xadeb[8],auth[_0xadeb[5]](),controller[_0xadeb[15]]);router[_0xadeb[19]](_0xadeb[4],auth[_0xadeb[5]](),controller[_0xadeb[18]]);router[_0xadeb[19]](_0xadeb[8],auth[_0xadeb[5]](),controller[_0xadeb[20]]);router[_0xadeb[19]](_0xadeb[10],auth[_0xadeb[5]](),controller[_0xadeb[21]]);module[_0xadeb[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_queue.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/agents', auth.isAuthenticated(), controller.showAgents); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/agents', auth.isAuthenticated(), controller.addAgents); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/agents', auth.isAuthenticated(), controller.removeAgents); + +module.exports = router; diff --git a/server/api/mail_queue/mail_queue.controller.js b/server/api/mail_queue/mail_queue.controller.js index caf0185..70cd358 100644 --- a/server/api/mail_queue/mail_queue.controller.js +++ b/server/api/mail_queue/mail_queue.controller.js @@ -1 +1,212 @@ -var _0x1846=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x6E\x61\x6D\x65","\x61\x64\x64\x55\x73\x65\x72\x73","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x65\x72\x72","\x65\x72\x72\x6F\x72","\x71\x75\x65\x75\x65","\x68\x61\x6E\x64\x6C\x65\x46\x6F\x72\x65\x69\x67\x6E\x4B\x65\x79\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72"];_0x1846[0];var _=require(_0x1846[1]);var util=require(_0x1846[2]);var Util=require(_0x1846[3]);var sequelize=require(_0x1846[5])[_0x1846[4]];var MailQueue=require(_0x1846[5])[_0x1846[6]];exports[_0x1846[7]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[16]](_0x1846[15])[_0x1846[14]](Util[_0x1846[13]](_0xb9f2x6[_0x1846[12]]))[_0x1846[11]](function(_0xb9f2x9){_0xb9f2x7[_0x1846[10]](200)[_0x1846[9]](_0xb9f2x9)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[17]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[16]](_0x1846[15])[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xa){if(!_0xb9f2xa){return _0xb9f2x7[_0x1846[18]](404)};return _0xb9f2x7[_0x1846[9]](_0xb9f2xa)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[22]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[22]](_0xb9f2x6[_0x1846[25]])[_0x1846[11]](function(_0xb9f2xa){return _0xb9f2x7[_0x1846[10]](201)[_0x1846[9]](_0xb9f2xa)})[_0x1846[8]](sequelize.UniqueConstraintError,function(_0xb9f2x8){return Util[_0x1846[24]][_0x1846[23]](_0xb9f2x7,_0xb9f2x8)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[26]]=function(_0xb9f2x6,_0xb9f2x7){if(_0xb9f2x6[_0x1846[25]][_0x1846[19]]){delete _0xb9f2x6[_0x1846[25]][_0x1846[19]]};return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xa){if(!_0xb9f2xa){return _0xb9f2x7[_0x1846[18]](404)};var _0xb9f2xb=_[_0x1846[27]](_0xb9f2xa,_0xb9f2x6[_0x1846[25]]);return _0xb9f2xb[_0x1846[28]]()})[_0x1846[11]](function(_0xb9f2xa){return _0xb9f2x7[_0x1846[10]](200)[_0x1846[9]](_0xb9f2xa)})[_0x1846[8]](sequelize.UniqueConstraintError,function(_0xb9f2x8){return Util[_0x1846[24]][_0x1846[23]](_0xb9f2x7,_0xb9f2x8)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[29]]=function(_0xb9f2x6,_0xb9f2x7,_0xb9f2xc){return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xa){if(_0xb9f2xa){return _0xb9f2xa[_0x1846[33]](_0xb9f2x6[_0x1846[25]][_0x1846[30]],{penalty:_0xb9f2x6[_0x1846[25]][_0x1846[31]],queue:_0xb9f2xa[_0x1846[32]]},{individualHooks:true})}else {throw new Error(_0x1846[34])}})[_0x1846[11]](function(){return _0xb9f2x7[_0x1846[18]](200)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[35]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xa){if(_0xb9f2xa){return _0xb9f2xa[_0x1846[36]](_0xb9f2x6[_0x1846[25]][_0x1846[30]],{individualHooks:true})}else {throw new Error(_0x1846[34])}})[_0x1846[11]](function(){return _0xb9f2x7[_0x1846[18]](200)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[37]]=function(_0xb9f2x6,_0xb9f2x7){var _0xb9f2xd;return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xa){_0xb9f2xd=_0xb9f2xa;if(!_0xb9f2xa){return _0xb9f2x7[_0x1846[18]](404)};return _0xb9f2xa[_0x1846[37]]()})[_0x1846[11]](function(){return _0xb9f2x7[_0x1846[18]](204)})[_0x1846[8]](sequelize.ForeignKeyConstraintError,function(_0xb9f2x8){return Util[_0x1846[24]][_0x1846[41]](_0xb9f2x7,_0x1846[40],_0xb9f2xd[_0x1846[32]],_0xb9f2x8)})[_0x1846[8]](function(_0xb9f2x8){console[_0x1846[39]](_0x1846[38],_0xb9f2x8);return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[42]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[37]]({where:{id:_0xb9f2x6[_0x1846[12]][_0x1846[43]]},individualHooks:true})[_0x1846[11]](function(){return _0xb9f2x7[_0x1846[18]](204)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[44]]=function(_0xb9f2x6,_0xb9f2x7){return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xf){if(!_0xb9f2xf){return _0xb9f2x7[_0x1846[18]](404)};return _0xb9f2xf[_0x1846[48]]({where:{role:_0x1846[45]},attributes:[_0x1846[19],_0x1846[32],_0x1846[46],_0x1846[47]]})})[_0x1846[11]](function(_0xb9f2xe){return _0xb9f2x7[_0x1846[10]](200)[_0x1846[9]](_0xb9f2xe)})[_0x1846[8]](function(_0xb9f2x8){return handleError(_0xb9f2x7,_0xb9f2x8)})};exports[_0x1846[35]]=function(_0xb9f2x6,_0xb9f2x7,_0xb9f2xc){return MailQueue[_0x1846[21]](_0xb9f2x6[_0x1846[20]][_0x1846[19]])[_0x1846[11]](function(_0xb9f2xf){if(!_0xb9f2xf){return _0xb9f2x7[_0x1846[18]](404)};return _0xb9f2xf[_0x1846[49]](_0xb9f2x6[_0x1846[12]][_0x1846[30]])})[_0x1846[11]](function(){return _0xb9f2x7[_0x1846[18]](202)})[_0x1846[8]](function(_0xb9f2x8){return _0xb9f2xc(_0xb9f2x8)})};function handleError(_0xb9f2x7,_0xb9f2x8){return _0xb9f2x7[_0x1846[10]](500)[_0x1846[9]](_0xb9f2x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var MailQueue = require('../../models').MailQueue; + +// Get list of mailQueues +exports.index = function(req, res) { + return MailQueue + .scope('default') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailQueue +exports.show = function(req, res) { + return MailQueue + .scope('default') + .findById(req.params.id) + .then(function(mailQueue) { + if (!mailQueue) { + return res.sendStatus(404); + } + return res.send(mailQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailQueue in the DB. +exports.create = function(req, res) { + return MailQueue + .create(req.body) + .then(function(mailQueue) { + return res.status(201).send(mailQueue); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailQueue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return MailQueue + .findById(req.params.id) + .then(function(mailQueue) { + if (!mailQueue) { + return res.sendStatus(404); + } + var updated = _.merge(mailQueue, req.body); + return updated + .save(); + }) + .then(function(mailQueue) { + return res.status(200).send(mailQueue); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_mailQueue in the DB. +exports.addAgents = function(req, res, next) { + return MailQueue + .findById(req.params.id) + .then(function(mailQueue) { + if (mailQueue) { + return mailQueue + .addUsers(req.body.agents, { + penalty: req.body.penalty, + queue: mailQueue.name + }, { + individualHooks: true + }); + } else { + throw new Error('MailQueue not found'); + } + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.removeAgents = function(req, res) { + return MailQueue + .findById(req.params.id) + .then(function(mailQueue) { + if (mailQueue) { + return mailQueue + .removeUsers(req.body.agents, { + individualHooks: true + }); + } else { + throw new Error('MailQueue not found'); + } + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailQueue from the DB. +exports.destroy = function(req, res) { + var _mailQueue; + + return MailQueue + .findById(req.params.id) + .then(function(mailQueue) { + _mailQueue = mailQueue; + if (!mailQueue) { + return res.sendStatus(404); + } + return mailQueue + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(sequelize.ForeignKeyConstraintError, function(err) { + return Util.errorManager.handleForeignKeyConstraintError(res, 'queue', _mailQueue.name, err); + }) + .catch(function(err) { + console.error('err', err); + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return MailQueue + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.showAgents = function(req, res) { + return MailQueue + .findById(req.params.id) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .getUsers({ + where: { + role: 'agent' + }, + attributes: ['id', 'name', 'fullname', 'email'] + }); + }) + .then(function(agents) { + return res.status(200).send(agents); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.removeAgents = function(req, res, next) { + return MailQueue + .findById(req.params.id) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .removeUser(req.query.agents); + }) + .then(function() { + return res.sendStatus(202); + }) + .catch(function(err) { + return next(err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_queue/mail_queue.socket.js b/server/api/mail_queue/mail_queue.socket.js index 1ea58ce..3518b62 100644 --- a/server/api/mail_queue/mail_queue.socket.js +++ b/server/api/mail_queue/mail_queue.socket.js @@ -1 +1,24 @@ -var _0x5c52=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x5c52[0];var MailQueue=require(_0x5c52[2])[_0x5c52[1]];exports[_0x5c52[3]]=function(_0x139cx2){MailQueue[_0x5c52[4]](function(_0x139cx3){onSave(_0x139cx2,_0x139cx3)});MailQueue[_0x5c52[5]](function(_0x139cx3){onRemove(_0x139cx2,_0x139cx3)})};function onSave(_0x139cx2,_0x139cx3,_0x139cx5){_0x139cx2[_0x5c52[7]](_0x5c52[6],_0x139cx3)}function onRemove(_0x139cx2,_0x139cx3,_0x139cx5){_0x139cx2[_0x5c52[7]](_0x5c52[8],_0x139cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailQueue = require('../../models').MailQueue; + +exports.register = function(socket) { + MailQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + MailQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_queue:remove', doc); +} diff --git a/server/api/mail_room/index.js b/server/api/mail_room/index.js index f458043..91ef299 100644 --- a/server/api/mail_room/index.js +++ b/server/api/mail_room/index.js @@ -1 +1,22 @@ -var _0xca05=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x61\x67\x65\x6E\x74\x2F\x3A\x69\x64","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x3A\x69\x64\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x63\x72\x65\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x75\x70\x64\x61\x74\x65\x41\x67\x65\x6E\x74\x73","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xca05[0];var express=require(_0xca05[1]);var controller=require(_0xca05[2]);var auth=require(_0xca05[3]);var router=express.Router();router[_0xca05[7]](_0xca05[4],auth[_0xca05[5]](),controller[_0xca05[6]]);router[_0xca05[7]](_0xca05[8],auth[_0xca05[5]](),controller[_0xca05[9]]);router[_0xca05[7]](_0xca05[10],auth[_0xca05[5]](),controller[_0xca05[11]]);router[_0xca05[7]](_0xca05[12],controller[_0xca05[13]]);router[_0xca05[15]](_0xca05[4],auth[_0xca05[5]](),controller[_0xca05[14]]);router[_0xca05[15]](_0xca05[16],auth[_0xca05[5]](),controller[_0xca05[17]]);router[_0xca05[19]](_0xca05[10],auth[_0xca05[5]](),controller[_0xca05[18]]);router[_0xca05[19]](_0xca05[12],auth[_0xca05[5]](),controller[_0xca05[20]]);router[_0xca05[21]](_0xca05[10],auth[_0xca05[5]](),controller[_0xca05[18]]);router[_0xca05[23]](_0xca05[4],auth[_0xca05[5]](),controller[_0xca05[22]]);router[_0xca05[23]](_0xca05[10],auth[_0xca05[5]](),controller[_0xca05[24]]);module[_0xca05[25]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_room.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +// TODO endpoint to filter just NEW/OPEN +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/agent/:id', auth.isAuthenticated(), controller.agentIndex); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/agents', controller.showAgents); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/messages', auth.isAuthenticated(), controller.createMessage); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.put('/:id/agents', auth.isAuthenticated(), controller.updateAgents); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/mail_room/mail_room.controller.js b/server/api/mail_room/mail_room.controller.js index f89d3b5..0d5f5bb 100644 --- a/server/api/mail_room/mail_room.controller.js +++ b/server/api/mail_room/mail_room.controller.js @@ -1 +1,231 @@ -var _0xe8e3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x61\x67\x65\x6E\x74","\x69\x64","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74\x49\x6E\x64\x65\x78","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x55\x73\x65\x72\x49\x64","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6A\x6F\x62\x49\x64","\x4D\x61\x69\x6C\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x61\x73\x73\x69\x67\x6E\x65\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xe8e3[0];var _=require(_0xe8e3[1]);var util=require(_0xe8e3[2]);var htmlToText=require(_0xe8e3[3]);var Util=require(_0xe8e3[4]);var sequelize=require(_0xe8e3[6])[_0xe8e3[5]];var User=require(_0xe8e3[6])[_0xe8e3[7]];var Agent=require(_0xe8e3[6])[_0xe8e3[7]];var Contact=require(_0xe8e3[6])[_0xe8e3[8]];var MailRoom=require(_0xe8e3[6])[_0xe8e3[9]];var MailMessage=require(_0xe8e3[6])[_0xe8e3[10]];var MailAccount=require(_0xe8e3[6])[_0xe8e3[11]];var MailAttachment=require(_0xe8e3[6])[_0xe8e3[12]];exports[_0xe8e3[13]]=function(_0xe767xd,_0xe767xe,_0xe767xf){switch(_0xe767xd[_0xe8e3[24]][_0xe8e3[26]]){case _0xe8e3[22]:return MailRoom[_0xe8e3[25]](_0xe8e3[21],{method:[_0xe8e3[22],_0xe767xd[_0xe8e3[24]][_0xe8e3[23]]]})[_0xe8e3[20]](Util[_0xe8e3[19]](_0xe767xd[_0xe8e3[18]]))[_0xe8e3[17]](function(_0xe767x11){return _0xe767xe[_0xe8e3[16]](200)[_0xe8e3[15]](_0xe767x11)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)});default:return MailRoom[_0xe8e3[25]](_0xe8e3[21])[_0xe8e3[20]](Util[_0xe8e3[19]](_0xe767xd[_0xe8e3[18]]))[_0xe8e3[17]](function(_0xe767x11){return _0xe767xe[_0xe8e3[16]](200)[_0xe8e3[15]](_0xe767x11)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})}};exports[_0xe8e3[27]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[29]]({where:{UserId:_0xe767xd[_0xe8e3[28]][_0xe8e3[23]]},include:[{all:true}]})[_0xe8e3[17]](function(_0xe767x12){return _0xe767xe[_0xe8e3[16]](200)[_0xe8e3[15]](_0xe767x12)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[30]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[25]](_0xe8e3[21])[_0xe8e3[33]](_0xe767xd[_0xe8e3[28]][_0xe8e3[23]])[_0xe8e3[17]](function(_0xe767x13){if(!_0xe767x13){return _0xe767xe[_0xe8e3[32]](404)};return _0xe767xe[_0xe8e3[15]](_0xe767x13)})[_0xe8e3[14]](function(_0xe767x10){console[_0xe8e3[31]](_0xe767x10);return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[34]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[33]](_0xe767xd[_0xe8e3[28]][_0xe8e3[23]])[_0xe8e3[17]](function(_0xe767x13){if(!_0xe767x13){return _0xe767xe[_0xe8e3[32]](404)};return _0xe767x13[_0xe8e3[39]]({attributes:[_0xe8e3[23],_0xe8e3[35],_0xe8e3[36],_0xe8e3[37],_0xe8e3[26],_0xe8e3[38]]})})[_0xe8e3[17]](function(_0xe767x14){return _0xe767xe[_0xe8e3[15]](_0xe767x14)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[40]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[40]](_0xe767xd[_0xe8e3[41]])[_0xe8e3[17]](function(_0xe767x13){return _0xe767xe[_0xe8e3[16]](201)[_0xe8e3[15]](_0xe767x13)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[42]]=function(_0xe767xd,_0xe767xe,_0xe767xf){_0xe767xd[_0xe8e3[41]][_0xe8e3[43]]=_0xe767xd[_0xe8e3[24]][_0xe8e3[23]];_0xe767xd[_0xe8e3[41]][_0xe8e3[44]]=_0xe767xd[_0xe8e3[28]][_0xe8e3[23]];_0xe767xd[_0xe8e3[41]][_0xe8e3[45]]=(_0xe767xd[_0xe8e3[41]][_0xe8e3[46]]&&_0xe767xd[_0xe8e3[41]][_0xe8e3[46]][_0xe8e3[47]])?true:false;_0xe767xd[_0xe8e3[41]][_0xe8e3[48]]=_0xe767xd[_0xe8e3[41]][_0xe8e3[48]]||htmlToText[_0xe8e3[50]](_0xe767xd[_0xe8e3[41]][_0xe8e3[49]],{wordwrap:false});return sequelize[_0xe8e3[53]]()[_0xe8e3[17]](function(_0xe767x15){return MailMessage[_0xe8e3[40]](_0xe767xd[_0xe8e3[41]],{include:[{model:MailAttachment}],transaction:_0xe767x15,user:_0xe767xd[_0xe8e3[24]]})[_0xe8e3[17]](function(_0xe767x16){_0xe767x15[_0xe8e3[52]]();return _0xe767xe[_0xe8e3[16]](201)[_0xe8e3[15]](_0xe767x16)})[_0xe8e3[14]](function(_0xe767x10){console[_0xe8e3[31]](_0xe767x10);_0xe767x15[_0xe8e3[51]]();return handleError(_0xe767xe,_0xe767x10)})})};exports[_0xe8e3[54]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[33]](_0xe767xd[_0xe8e3[28]][_0xe8e3[23]])[_0xe8e3[17]](function(_0xe767x13){if(!_0xe767x13){return _0xe767xe[_0xe8e3[32]](404)};if(_0xe767x13[_0xe8e3[55]]){throw new Error(_0xe8e3[56])};var _0xe767x17=_[_0xe8e3[57]](_0xe767x13,_0xe767xd[_0xe8e3[41]]);return _0xe767x17[_0xe8e3[58]]()})[_0xe8e3[17]](function(_0xe767x13){return _0xe767xe[_0xe8e3[16]](200)[_0xe8e3[15]](_0xe767x13)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[59]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[33]](_0xe767xd[_0xe8e3[28]][_0xe8e3[23]])[_0xe8e3[17]](function(_0xe767x13){if(!_0xe767x13){return _0xe767xe[_0xe8e3[32]](404)};return _0xe767x13[_0xe8e3[61]](_0xe767xd[_0xe8e3[41]][_0xe8e3[60]],{individualHooks:true})})[_0xe8e3[17]](function(){return _0xe767xe[_0xe8e3[32]](200)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[62]]=function(_0xe767xd,_0xe767xe,_0xe767xf){return MailRoom[_0xe8e3[33]](_0xe767xd[_0xe8e3[28]][_0xe8e3[23]])[_0xe8e3[17]](function(_0xe767x13){if(!_0xe767x13){return _0xe767xe[_0xe8e3[32]](404)};return _0xe767x13[_0xe8e3[62]]()})[_0xe8e3[17]](function(){return _0xe767xe[_0xe8e3[32]](204)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};exports[_0xe8e3[63]]=function(_0xe767xd,_0xe767xe){return MailRoom[_0xe8e3[62]]({where:{id:_0xe767xd[_0xe8e3[18]][_0xe8e3[64]]},individualHooks:true})[_0xe8e3[17]](function(){return _0xe767xe[_0xe8e3[32]](200)})[_0xe8e3[14]](function(_0xe767x10){return handleError(_0xe767xe,_0xe767x10)})};function handleError(_0xe767xe,_0xe767x10){return _0xe767xe[_0xe8e3[16]](500)[_0xe8e3[15]](_0xe767x10)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var htmlToText = require('html-to-text'); + +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var User = require('../../models').User; +var Agent = require('../../models').User; +var Contact = require('../../models').Contact; +var MailRoom = require('../../models').MailRoom; +var MailMessage = require('../../models').MailMessage; +var MailAccount = require('../../models').MailAccount; +var MailAttachment = require('../../models').MailAttachment; + +// Get list of mailRooms +exports.index = function(req, res, next) { + switch (req.user.role) { + case 'agent': + + return MailRoom + .scope('default', { + method: ['agent', req.user.id] + }) + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + return res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); + + default: + + return MailRoom + .scope('default') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + return res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); + } +}; + +// Get list of agent mailRooms +exports.agentIndex = function(req, res, next) { + return MailRoom + .findAll({ + where: { + UserId: req.params.id + }, + include: [{ + all: true + }] + }) + .then(function(mailRooms) { + return res.status(200).send(mailRooms); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailRoom +exports.show = function(req, res, next) { + return MailRoom + .scope('default') + .findById(req.params.id) + .then(function(mailRoom) { + if (!mailRoom) { + return res.sendStatus(404); + } + return res.send(mailRoom); + }) + .catch(function(err) { + console.error(err); + return handleError(res, err); + }); +}; + +// Get a single mailRoom +exports.showAgents = function(req, res, next) { + return MailRoom + .findById(req.params.id) + .then(function(mailRoom) { + if (!mailRoom) { + return res.sendStatus(404); + } + + return mailRoom + .getUsers({ + attributes: ['id', 'name', 'fullname', 'email', 'role', 'internal'] + }); + }) + .then(function(users) { + return res.send(users); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailRoom in the DB. +exports.create = function(req, res, next) { + return MailRoom + .create(req.body) + .then(function(mailRoom) { + return res.status(201).send(mailRoom); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailMessage in the DB. +exports.createMessage = function(req, res, next) { + req.body.UserId = req.user.id; + req.body.MailRoomId = req.params.id; + req.body.attachment = (req.body.MailAttachments && req.body.MailAttachments.length) ? true : false; + req.body.text = req.body.text || htmlToText.fromString(req.body.html, { + wordwrap: false + }); + + return sequelize.transaction().then(function(t) { + return MailMessage + .create(req.body, { + include: [{ + model: MailAttachment + }], + transaction: t, + user: req.user + }).then(function(mailMessage) { + t.commit(); + return res.status(201).send(mailMessage); + }).catch(function(err) { + console.error(err); + t.rollback(); + return handleError(res, err); + }); + }); +}; + +// Updates an existing mailRoom in the DB. +exports.update = function(req, res, next) { + return MailRoom + .findById(req.params.id) + .then(function(mailRoom) { + if (!mailRoom) { + return res.sendStatus(404); + } + // CHECK IF MAIL IS ALREADY ASSIGNED + if (mailRoom.jobId) { + throw new Error('Mail already assigned'); + } + var updated = _.merge(mailRoom, req.body); + + return updated + .save(); + }) + .then(function(mailRoom) { + return res.status(200).send(mailRoom); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailRoom +exports.updateAgents = function(req, res, next) { + return MailRoom + .findById(req.params.id) + .then(function(mailRoom) { + if (!mailRoom) { + return res.sendStatus(404); + } + + return mailRoom + .setUsers(req.body.agents, { + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailRoom from the DB. +exports.destroy = function(req, res, next) { + return MailRoom + .findById(req.params.id) + .then(function(mailRoom) { + if (!mailRoom) { + return res.sendStatus(404); + } + return mailRoom.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return MailRoom + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_room/mail_room.socket.js b/server/api/mail_room/mail_room.socket.js index 8f95a3b..3f12a1c 100644 --- a/server/api/mail_room/mail_room.socket.js +++ b/server/api/mail_room/mail_room.socket.js @@ -1 +1,43 @@ -var _0x247e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x55\x73\x65\x72","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0x247e[0];var MailMessage=require(_0x247e[2])[_0x247e[1]];var MailRoom=require(_0x247e[2])[_0x247e[3]];var User=require(_0x247e[2])[_0x247e[4]];exports[_0x247e[5]]=function(_0x18aax4){MailRoom[_0x247e[6]](function(_0x18aax5){onSave(_0x18aax4,_0x18aax5)});MailRoom[_0x247e[7]](function(_0x18aax5){onRemove(_0x18aax4,_0x18aax5)});MailRoom[_0x247e[13]](function(_0x18aax5){MailRoom[_0x247e[12]](_0x18aax5[_0x247e[11]],{include:[{all:true}]})[_0x247e[10]](function(_0x18aax7){onSave(_0x18aax4,_0x18aax7)})[_0x247e[9]](function(_0x18aax6){console[_0x247e[8]](_0x18aax6)})})};function onSave(_0x18aax4,_0x18aax5,_0x18aax9){_0x18aax4[_0x247e[15]](_0x247e[14],_0x18aax5)}function onRemove(_0x18aax4,_0x18aax5,_0x18aax9){_0x18aax4[_0x247e[15]](_0x247e[16],_0x18aax5)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + + +var MailMessage = require('../../models').MailMessage; +var MailRoom = require('../../models').MailRoom; +var User = require('../../models').User; + +exports.register = function(socket) { + MailRoom.afterCreate(function(doc) { + onSave(socket, doc); + }); + + MailRoom.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + + MailRoom.afterUpdate(function(doc) { + MailRoom + .findById(doc.id, { + include: [{ + all: true + }] + }) + .then(function(mailRoom) { + onSave(socket, mailRoom); + }) + .catch(function(err) { + console.error(err); + }); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_room:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_room:remove', doc); +} diff --git a/server/api/mail_server_in/index.js b/server/api/mail_server_in/index.js index fe3fc77..adb146b 100644 --- a/server/api/mail_server_in/index.js +++ b/server/api/mail_server_in/index.js @@ -1 +1,15 @@ -var _0x87b7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x87b7[0];var express=require(_0x87b7[1]);var controller=require(_0x87b7[2]);var router=express.Router();router[_0x87b7[5]](_0x87b7[3],controller[_0x87b7[4]]);router[_0x87b7[5]](_0x87b7[6],controller[_0x87b7[7]]);router[_0x87b7[9]](_0x87b7[3],controller[_0x87b7[8]]);router[_0x87b7[11]](_0x87b7[6],controller[_0x87b7[10]]);router[_0x87b7[12]](_0x87b7[6],controller[_0x87b7[10]]);router[_0x87b7[14]](_0x87b7[6],controller[_0x87b7[13]]);module[_0x87b7[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_server_in.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/mail_server_in/mail_server_in.controller.js b/server/api/mail_server_in/mail_server_in.controller.js index edac6cc..27fda21 100644 --- a/server/api/mail_server_in/mail_server_in.controller.js +++ b/server/api/mail_server_in/mail_server_in.controller.js @@ -1 +1,96 @@ -var _0x41d1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x41d1[0];var _=require(_0x41d1[1]);var Util=require(_0x41d1[2]);var sequelize=require(_0x41d1[4])[_0x41d1[3]];var MailServerIn=require(_0x41d1[4])[_0x41d1[5]];exports[_0x41d1[6]]=function(_0x871bx5,_0x871bx6){return MailServerIn[_0x41d1[11]]()[_0x41d1[10]](function(_0x871bx8){return _0x871bx6[_0x41d1[9]](200)[_0x41d1[8]](_0x871bx8)})[_0x41d1[7]](function(_0x871bx7){return handleError(_0x871bx6,_0x871bx7)})};exports[_0x41d1[12]]=function(_0x871bx5,_0x871bx6){return MailServerIn[_0x41d1[16]](_0x871bx5[_0x41d1[15]][_0x41d1[14]])[_0x41d1[10]](function(_0x871bx9){if(!_0x871bx9){return _0x871bx6[_0x41d1[13]](404)};return _0x871bx6[_0x41d1[8]](_0x871bx9)})[_0x41d1[7]](function(_0x871bx7){return handleError(_0x871bx6,_0x871bx7)})};exports[_0x41d1[17]]=function(_0x871bx5,_0x871bx6){return MailServerIn[_0x41d1[17]](_0x871bx5[_0x41d1[20]])[_0x41d1[10]](function(_0x871bx9){return _0x871bx6[_0x41d1[9]](201)[_0x41d1[8]](_0x871bx9)})[_0x41d1[7]](sequelize.UniqueConstraintError,function(_0x871bx7){return Util[_0x41d1[19]][_0x41d1[18]](_0x871bx6,_0x871bx7)})[_0x41d1[7]](function(_0x871bx7){return handleError(_0x871bx6,_0x871bx7)})};exports[_0x41d1[21]]=function(_0x871bx5,_0x871bx6){if(_0x871bx5[_0x41d1[20]][_0x41d1[14]]){delete _0x871bx5[_0x41d1[20]][_0x41d1[14]]};return MailServerIn[_0x41d1[16]](_0x871bx5[_0x41d1[15]][_0x41d1[14]])[_0x41d1[10]](function(_0x871bx9){if(!_0x871bx9){return _0x871bx6[_0x41d1[13]](404)};var _0x871bxa=_[_0x41d1[22]](_0x871bx9,_0x871bx5[_0x41d1[20]]);return _0x871bxa[_0x41d1[23]]()})[_0x41d1[10]](function(_0x871bx9){return _0x871bx6[_0x41d1[9]](200)[_0x41d1[8]](_0x871bx9)})[_0x41d1[7]](sequelize.UniqueConstraintError,function(_0x871bx7){return Util[_0x41d1[19]][_0x41d1[18]](_0x871bx6,_0x871bx7)})[_0x41d1[7]](function(_0x871bx7){return handleError(_0x871bx6,_0x871bx7)})};exports[_0x41d1[24]]=function(_0x871bx5,_0x871bx6){return MailServerIn[_0x41d1[16]](_0x871bx5[_0x41d1[15]][_0x41d1[14]])[_0x41d1[10]](function(_0x871bx9){if(!_0x871bx9){return _0x871bx6[_0x41d1[13]](404)};return _0x871bx9[_0x41d1[24]]()})[_0x41d1[7]](function(_0x871bx7){return handleError(_0x871bx6,_0x871bx7)})};function handleError(_0x871bx6,_0x871bx7){return _0x871bx6[_0x41d1[9]](500)[_0x41d1[8]](_0x871bx7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var MailServerIn = require('../../models').MailServerIn; + +// Get list of mail_server_ins +exports.index = function(req, res) { + return MailServerIn + .findAll() + .then(function(mail_server_ins) { + return res.status(200).send(mail_server_ins); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailServerIn +exports.show = function(req, res) { + return MailServerIn + .findById(req.params.id) + .then(function(mailServerIn) { + if (!mailServerIn) { + return res.sendStatus(404); + } + return res.send(mailServerIn); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailServerIn in the DB. +exports.create = function(req, res) { + return MailServerIn + .create(req.body) + .then(function(mailServerIn) { + return res.status(201).send(mailServerIn); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailServerIn in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return MailServerIn + .findById(req.params.id) + .then(function(mailServerIn) { + if (!mailServerIn) { + return res.sendStatus(404); + } + var updated = _.merge(mailServerIn, req.body); + return updated + .save(); + }) + .then(function(mailServerIn) { + return res.status(200).send(mailServerIn); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailServerIn from the DB. +exports.destroy = function(req, res) { + return MailServerIn + .findById(req.params.id) + .then(function(mailServerIn) { + if (!mailServerIn) { + return res.sendStatus(404); + } + return mailServerIn + .destroy(); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_server_in/mail_server_in.socket.js b/server/api/mail_server_in/mail_server_in.socket.js index e934afd..811977e 100644 --- a/server/api/mail_server_in/mail_server_in.socket.js +++ b/server/api/mail_server_in/mail_server_in.socket.js @@ -1 +1,27 @@ -var _0x414b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x414b[0];var MailServerIn=require(_0x414b[2])[_0x414b[1]];exports[_0x414b[3]]=function(_0xd3dax2){MailServerIn[_0x414b[4]](function(_0xd3dax3){onSave(_0xd3dax2,_0xd3dax3)});MailServerIn[_0x414b[5]](function(_0xd3dax3){onSave(_0xd3dax2,_0xd3dax3)});MailServerIn[_0x414b[6]](function(_0xd3dax3){onRemove(_0xd3dax2,_0xd3dax3)})};function onSave(_0xd3dax2,_0xd3dax3,_0xd3dax5){_0xd3dax2[_0x414b[8]](_0x414b[7],_0xd3dax3)}function onRemove(_0xd3dax2,_0xd3dax3,_0xd3dax5){_0xd3dax2[_0x414b[8]](_0x414b[9],_0xd3dax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailServerIn = require('../../models').MailServerIn; + +exports.register = function(socket) { + MailServerIn.afterCreate(function(doc) { + onSave(socket, doc); + }); + MailServerIn.afterUpdate(function(doc) { + onSave(socket, doc); + }); + MailServerIn.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_server_in:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_server_in:remove', doc); +} diff --git a/server/api/mail_server_out/index.js b/server/api/mail_server_out/index.js index 718bccf..526e713 100644 --- a/server/api/mail_server_out/index.js +++ b/server/api/mail_server_out/index.js @@ -1 +1,19 @@ -var _0xf9db=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x6F\x75\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x73\x65\x72\x76\x69\x63\x65","\x69\x6E\x64\x65\x78\x53\x65\x72\x76\x69\x63\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x74\x65\x73\x74","\x74\x65\x73\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x74\x65\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xf9db[0];var express=require(_0xf9db[1]);var controller=require(_0xf9db[2]);var auth=require(_0xf9db[3]);var router=express.Router();router[_0xf9db[7]](_0xf9db[4],auth[_0xf9db[5]](),controller[_0xf9db[6]]);router[_0xf9db[7]](_0xf9db[8],auth[_0xf9db[5]](),controller[_0xf9db[9]]);router[_0xf9db[7]](_0xf9db[10],auth[_0xf9db[5]](),controller[_0xf9db[11]]);router[_0xf9db[7]](_0xf9db[12],auth[_0xf9db[5]](),controller[_0xf9db[13]]);router[_0xf9db[15]](_0xf9db[4],auth[_0xf9db[5]](),controller[_0xf9db[14]]);router[_0xf9db[15]](_0xf9db[16],auth[_0xf9db[5]](),controller[_0xf9db[13]]);router[_0xf9db[18]](_0xf9db[10],auth[_0xf9db[5]](),controller[_0xf9db[17]]);router[_0xf9db[19]](_0xf9db[10],auth[_0xf9db[5]](),controller[_0xf9db[17]]);router[_0xf9db[21]](_0xf9db[10],auth[_0xf9db[5]](),controller[_0xf9db[20]]);module[_0xf9db[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_server_out.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/service', auth.isAuthenticated(), controller.indexService); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/test', auth.isAuthenticated(), controller.test); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/test', auth.isAuthenticated(), controller.test); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/mail_server_out/mail_server_out.controller.js b/server/api/mail_server_out/mail_server_out.controller.js index f8a8eec..f2c852d 100644 --- a/server/api/mail_server_out/mail_server_out.controller.js +++ b/server/api/mail_server_out/mail_server_out.controller.js @@ -1 +1,162 @@ -var _0x677a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x69\x6E\x64\x65\x78\x53\x65\x72\x76\x69\x63\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x74\x65\x73\x74","\x65\x72\x72\x6F\x72","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x45\x52\x52\x4F\x52","\x63\x6F\x6D\x6D\x69\x74","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x20","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x20\x74\x65\x73\x74\x2E\x2E","\x75\x73\x65\x72","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E"];_0x677a[0];var _=require(_0x677a[1]);var MailServerOut=require(_0x677a[3])[_0x677a[2]];var MailMessage=require(_0x677a[3])[_0x677a[4]];var sequelize=require(_0x677a[3])[_0x677a[5]];exports[_0x677a[6]]=function(_0xc60ax5,_0xc60ax6){return MailServerOut[_0x677a[11]]()[_0x677a[10]](function(_0xc60ax8){return _0xc60ax6[_0x677a[9]](200)[_0x677a[8]](_0xc60ax8)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[12]]=function(_0xc60ax5,_0xc60ax6){return MailServerOut[_0x677a[13]]({where:{service:true}})[_0x677a[10]](function(_0xc60ax9){return _0xc60ax6[_0x677a[9]](200)[_0x677a[8]](_0xc60ax9)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[14]]=function(_0xc60ax5,_0xc60ax6){return MailServerOut[_0x677a[18]](_0xc60ax5[_0x677a[17]][_0x677a[16]])[_0x677a[10]](function(_0xc60ax9){if(!_0xc60ax9){return _0xc60ax6[_0x677a[15]](404)};return _0xc60ax6[_0x677a[8]](_0xc60ax9)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[19]]=function(_0xc60ax5,_0xc60ax6){return MailServerOut[_0x677a[19]](_0xc60ax5[_0x677a[20]])[_0x677a[10]](function(_0xc60ax9){return _0xc60ax6[_0x677a[9]](201)[_0x677a[8]](_0xc60ax9)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[21]]=function(_0xc60ax5,_0xc60ax6){if(_0xc60ax5[_0x677a[20]][_0x677a[16]]){delete _0xc60ax5[_0x677a[20]][_0x677a[16]]};return MailServerOut[_0x677a[18]](_0xc60ax5[_0x677a[17]][_0x677a[16]])[_0x677a[10]](function(_0xc60ax9){if(!_0xc60ax9){return _0xc60ax6[_0x677a[15]](404)};var _0xc60axa=_[_0x677a[22]](_0xc60ax9,_0xc60ax5[_0x677a[20]]);return _0xc60axa[_0x677a[23]]()})[_0x677a[10]](function(_0xc60ax9){return _0xc60ax6[_0x677a[9]](200)[_0x677a[8]](_0xc60ax9)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[24]]=function(_0xc60ax5,_0xc60ax6){return MailServerOut[_0x677a[18]](_0xc60ax5[_0x677a[17]][_0x677a[16]])[_0x677a[10]](function(_0xc60ax9){if(!_0xc60ax9){return _0xc60ax6[_0x677a[15]](404)};return _0xc60ax9[_0x677a[24]]()})[_0x677a[10]](function(){return _0xc60ax6[_0x677a[15]](204)})[_0x677a[7]](function(_0xc60ax7){return handleError(_0xc60ax6,_0xc60ax7)})};exports[_0x677a[25]]=function(_0xc60ax5,_0xc60ax6){return sequelize[_0x677a[35]]()[_0x677a[10]](function(_0xc60axb){var _0xc60axc;var _0xc60axd;return MailServerOut[_0x677a[18]](_0xc60ax5[_0x677a[17]][_0x677a[16]])[_0x677a[10]](function(_0xc60ax9){if(!_0xc60ax9){_0xc60axb[_0x677a[27]]();return _0xc60ax6[_0x677a[15]](404)}else {return _0xc60ax9}})[_0x677a[10]](function(_0xc60ax9){_0xc60axc=_0xc60ax9;return MailMessage[_0x677a[19]]({subject:_0x677a[31]+_0xc60ax9[_0x677a[32]]+_0x677a[33],text:_0x677a[31]+_0xc60ax9[_0x677a[32]]+_0x677a[33],from:[_0xc60ax9[_0x677a[32]]],to:[_0xc60ax9[_0x677a[32]]]},{transaction:_0xc60axb,user:_0xc60ax5[_0x677a[34]]})})[_0x677a[10]](function(_0xc60axe){_0xc60axd=_0xc60axe;return _0xc60axc[_0x677a[21]]({state:_0x677a[30]})})[_0x677a[10]](function(){_0xc60axb[_0x677a[29]]();return _0xc60ax6[_0x677a[9]](201)[_0x677a[8]](_0xc60axd)})[_0x677a[7]](function(_0xc60ax7){console[_0x677a[26]](_0xc60ax7);_0xc60axb[_0x677a[27]]();return _0xc60axc[_0x677a[21]]({state:_0x677a[28]})[_0x677a[10]](function(){return handleError(_0xc60ax6,_0xc60ax7)})})})};function handleError(_0xc60ax6,_0xc60ax7){return _0xc60ax6[_0x677a[9]](500)[_0x677a[8]](_0xc60ax7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var MailServerOut = require('../../models').MailServerOut; +var MailMessage = require('../../models').MailMessage; +var sequelize = require('../../models').sequelize; + +// Get list of mailServerOuts +exports.index = function(req, res) { + return MailServerOut + .findAll() + .then(function(mailServerOuts) { + return res.status(200).send(mailServerOuts); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.indexService = function(req, res) { + return MailServerOut + .findOne({ + where: { + service: true + } + }) + .then(function(mailServerOut) { + return res.status(200).send(mailServerOut); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailServerOut +exports.show = function(req, res) { + return MailServerOut + .findById(req.params.id) + .then(function(mailServerOut) { + if (!mailServerOut) { + return res.sendStatus(404); + } + return res.send(mailServerOut); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailServerOut in the DB. +exports.create = function(req, res) { + return MailServerOut + .create(req.body) + .then(function(mailServerOut) { + return res.status(201).send(mailServerOut); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailServerOut in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return MailServerOut + .findById(req.params.id) + .then(function(mailServerOut) { + if (!mailServerOut) { + return res.sendStatus(404); + } + var updated = _.merge(mailServerOut, req.body); + return updated + .save(); + }) + .then(function(mailServerOut) { + return res.status(200).send(mailServerOut); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailServerOut from the DB. +exports.destroy = function(req, res) { + return MailServerOut + .findById(req.params.id) + .then(function(mailServerOut) { + if (!mailServerOut) { + return res.sendStatus(404); + } + + return mailServerOut + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.test = function(req, res) { + return sequelize + .transaction() + .then(function(t) { + var _mailServerOut; + var _mailMessage; + + return MailServerOut + .findById(req.params.id) + .then(function(mailServerOut) { + if (!mailServerOut) { + t.rollback(); + return res.sendStatus(404); + } else { + return mailServerOut; + } + }) + .then(function(mailServerOut) { + _mailServerOut = mailServerOut; + return MailMessage + .create({ + subject: 'MailAccount ' + mailServerOut.username + ' test..', + text: 'MailAccount ' + mailServerOut.username + ' test..', + from: [mailServerOut.username], + to: [mailServerOut.username] + }, { + transaction: t, + user: req.user + }); + }) + .then(function(mailMessage) { + _mailMessage = mailMessage; + return _mailServerOut + .update({ + state: 'CONNECTED', + }); + }) + .then(function() { + t.commit(); + return res.status(201).send(_mailMessage); + }) + .catch(function(err) { + console.error(err); + t.rollback(); + return _mailServerOut + .update({ + state: 'ERROR', + }) + .then(function() { + return handleError(res, err); + }) + }); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_server_out/mail_server_out.socket.js b/server/api/mail_server_out/mail_server_out.socket.js index 05d35e1..d9e6e91 100644 --- a/server/api/mail_server_out/mail_server_out.socket.js +++ b/server/api/mail_server_out/mail_server_out.socket.js @@ -1 +1,26 @@ -var _0x4f0e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74\x20\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74\x20\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x6F\x75\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x6F\x75\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x4f0e[0];var MailServerOut=require(_0x4f0e[2])[_0x4f0e[1]];exports[_0x4f0e[3]]=function(_0x99c3x2){MailServerOut[_0x4f0e[6]](function(_0x99c3x3){console[_0x4f0e[5]](_0x4f0e[4]);onSave(_0x99c3x2,_0x99c3x3)});MailServerOut[_0x4f0e[8]](function(_0x99c3x3){console[_0x4f0e[5]](_0x4f0e[7]);onRemove(_0x99c3x2,_0x99c3x3)})};function onSave(_0x99c3x2,_0x99c3x3,_0x99c3x5){_0x99c3x2[_0x4f0e[10]](_0x4f0e[9],_0x99c3x3)}function onRemove(_0x99c3x2,_0x99c3x3,_0x99c3x5){_0x99c3x2[_0x4f0e[10]](_0x4f0e[11],_0x99c3x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailServerOut = require('../../models').MailServerOut; + +exports.register = function(socket) { + MailServerOut.afterCreate(function(doc) { + console.log('MailServerOut afterCreate'); + onSave(socket, doc); + }); + MailServerOut.afterDestroy(function(doc) { + console.log('MailServerOut afterDestroy'); + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_server_out:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_server_out:remove', doc); +} diff --git a/server/api/mail_template/index.js b/server/api/mail_template/index.js index 4692b26..cb8e0b2 100644 --- a/server/api/mail_template/index.js +++ b/server/api/mail_template/index.js @@ -1 +1,15 @@ -var _0xcca9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xcca9[0];var express=require(_0xcca9[1]);var controller=require(_0xcca9[2]);var router=express.Router();router[_0xcca9[5]](_0xcca9[3],controller[_0xcca9[4]]);router[_0xcca9[5]](_0xcca9[6],controller[_0xcca9[7]]);router[_0xcca9[9]](_0xcca9[3],controller[_0xcca9[8]]);router[_0xcca9[11]](_0xcca9[6],controller[_0xcca9[10]]);router[_0xcca9[12]](_0xcca9[6],controller[_0xcca9[10]]);router[_0xcca9[14]](_0xcca9[6],controller[_0xcca9[13]]);module[_0xcca9[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./mail_template.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/mail_template/mail_template.controller.js b/server/api/mail_template/mail_template.controller.js index 2130cbf..8853adc 100644 --- a/server/api/mail_template/mail_template.controller.js +++ b/server/api/mail_template/mail_template.controller.js @@ -1 +1,92 @@ -var _0xd454=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x4D\x61\x69\x6C\x54\x65\x6D\x70\x6C\x61\x74\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xd454[0];var _=require(_0xd454[1]);var util=require(_0xd454[2]);var Util=require(_0xd454[3]);var MailTemplate=require(_0xd454[5])[_0xd454[4]];exports[_0xd454[6]]=function(_0xb844x5,_0xb844x6,_0xb844x7){return MailTemplate[_0xd454[13]](Util[_0xd454[12]](_0xb844x5[_0xd454[11]]))[_0xd454[10]](function(_0xb844x9){_0xb844x6[_0xd454[9]](200)[_0xd454[8]](_0xb844x9)})[_0xd454[7]](function(_0xb844x8){return handleError(_0xb844x6,_0xb844x8)})};exports[_0xd454[14]]=function(_0xb844x5,_0xb844x6){return MailTemplate[_0xd454[18]](_0xb844x5[_0xd454[17]][_0xd454[16]])[_0xd454[10]](function(_0xb844xa){if(!_0xb844xa){return _0xb844x6[_0xd454[15]](404)};return _0xb844x6[_0xd454[8]](_0xb844xa)})[_0xd454[7]](function(_0xb844x8){return handleError(_0xb844x6,_0xb844x8)})};exports[_0xd454[19]]=function(_0xb844x5,_0xb844x6){return MailTemplate[_0xd454[19]](_0xb844x5[_0xd454[20]])[_0xd454[10]](function(_0xb844xa){return _0xb844x6[_0xd454[9]](201)[_0xd454[8]](_0xb844xa)})[_0xd454[7]](function(_0xb844x8){return handleError(_0xb844x6,_0xb844x8)})};exports[_0xd454[21]]=function(_0xb844x5,_0xb844x6){if(_0xb844x5[_0xd454[20]][_0xd454[16]]){delete _0xb844x5[_0xd454[20]][_0xd454[16]]};return MailTemplate[_0xd454[18]](_0xb844x5[_0xd454[17]][_0xd454[16]])[_0xd454[10]](function(_0xb844xa){if(!_0xb844xa){return _0xb844x6[_0xd454[15]](404)};var _0xb844xb=_[_0xd454[22]](_0xb844xa,_0xb844x5[_0xd454[20]]);return _0xb844xb[_0xd454[23]]()})[_0xd454[10]](function(_0xb844xa){return _0xb844x6[_0xd454[9]](200)[_0xd454[8]](_0xb844xa)})[_0xd454[7]](function(_0xb844x8){return handleError(_0xb844x6,_0xb844x8)})};exports[_0xd454[24]]=function(_0xb844x5,_0xb844x6){return MailTemplate[_0xd454[18]](_0xb844x5[_0xd454[17]][_0xd454[16]])[_0xd454[10]](function(_0xb844xa){if(!_0xb844xa){return _0xb844x6[_0xd454[15]](404)};_0xb844xa[_0xd454[24]]()})[_0xd454[10]](function(){return _0xb844x6[_0xd454[15]](204)})[_0xd454[7]](function(_0xb844x8){return handleError(_0xb844x6,_0xb844x8)})};function handleError(_0xb844x6,_0xb844x8){return _0xb844x6[_0xd454[9]](500)[_0xd454[8]](_0xb844x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Util = require('../../config/util'); + +var MailTemplate = require('../../models').MailTemplate; + +// Get list of agents +exports.index = function(req, res, next) { + return MailTemplate + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single mailTemplate +exports.show = function(req, res) { + return MailTemplate + .findById(req.params.id) + .then(function(mailTemplate) { + if (!mailTemplate) { + return res.sendStatus(404); + } + return res.send(mailTemplate); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new mailTemplate in the DB. +exports.create = function(req, res) { + return MailTemplate + .create(req.body) + .then(function(mailTemplate) { + return res.status(201).send(mailTemplate); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing mailTemplate in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return MailTemplate + .findById(req.params.id) + .then(function(mailTemplate) { + if (!mailTemplate) { + return res.sendStatus(404); + } + var updated = _.merge(mailTemplate, req.body); + return updated + .save(); + }) + .then(function(mailTemplate) { + return res.status(200).send(mailTemplate); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a mailTemplate from the DB. +exports.destroy = function(req, res) { + return MailTemplate + .findById(req.params.id) + .then(function(mailTemplate) { + if (!mailTemplate) { + return res.sendStatus(404); + } + mailTemplate + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/mail_template/mail_template.socket.js b/server/api/mail_template/mail_template.socket.js index b97c57f..a01fb2e 100644 --- a/server/api/mail_template/mail_template.socket.js +++ b/server/api/mail_template/mail_template.socket.js @@ -1 +1,24 @@ -var _0xcf7d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x54\x65\x6D\x70\x6C\x61\x74\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xcf7d[0];var MailTemplate=require(_0xcf7d[2])[_0xcf7d[1]];exports[_0xcf7d[3]]=function(_0x3420x2){MailTemplate[_0xcf7d[4]](function(_0x3420x3){onSave(_0x3420x2,_0x3420x3)});MailTemplate[_0xcf7d[5]](function(_0x3420x3){onRemove(_0x3420x2,_0x3420x3)})};function onSave(_0x3420x2,_0x3420x3,_0x3420x5){_0x3420x2[_0xcf7d[7]](_0xcf7d[6],_0x3420x3)}function onRemove(_0x3420x2,_0x3420x3,_0x3420x5){_0x3420x2[_0xcf7d[7]](_0xcf7d[8],_0x3420x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var MailTemplate = require('../../models').MailTemplate; + +exports.register = function(socket) { + MailTemplate.afterCreate(function (doc) { + onSave(socket, doc); + }); + MailTemplate.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('mail_template:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('mail_template:remove', doc); +} diff --git a/server/api/metric/index.js b/server/api/metric/index.js index 917fd55..d565c16 100644 --- a/server/api/metric/index.js +++ b/server/api/metric/index.js @@ -1 +1,19 @@ -var _0x6343=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x65\x74\x72\x69\x63\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x74\x61\x62\x6C\x65","\x67\x65\x74\x4D\x65\x74\x72\x69\x63\x73\x42\x79\x54\x61\x62\x6C\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x6D\x65\x74\x72\x69\x63\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x6343[0];var express=require(_0x6343[1]);var controller=require(_0x6343[2]);var auth=require(_0x6343[3]);var router=express.Router();router[_0x6343[7]](_0x6343[4],auth[_0x6343[5]](),controller[_0x6343[6]]);router[_0x6343[7]](_0x6343[8],auth[_0x6343[5]](),controller[_0x6343[9]]);router[_0x6343[7]](_0x6343[10],auth[_0x6343[5]](),controller[_0x6343[11]]);router[_0x6343[13]](_0x6343[4],auth[_0x6343[5]](),controller[_0x6343[12]]);router[_0x6343[13]](_0x6343[14],auth[_0x6343[5]](),controller[_0x6343[15]]);router[_0x6343[17]](_0x6343[10],auth[_0x6343[5]](),controller[_0x6343[16]]);router[_0x6343[18]](_0x6343[10],auth[_0x6343[5]](),controller[_0x6343[16]]);router[_0x6343[20]](_0x6343[4],auth[_0x6343[5]](),controller[_0x6343[19]]);router[_0x6343[20]](_0x6343[10],auth[_0x6343[5]](),controller[_0x6343[21]]);module[_0x6343[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./metric.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/table', auth.isAuthenticated(), controller.getMetricsByTable); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.metricValidation); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/metric/metric.controller.js b/server/api/metric/metric.controller.js index 4ef4590..ce77ec6 100644 --- a/server/api/metric/metric.controller.js +++ b/server/api/metric/metric.controller.js @@ -1 +1,180 @@ -var _0x672e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x65\x74\x72\x69\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6D\x65\x74\x72\x69\x63\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6E\x61\x6D\x65","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x4D\x65\x74\x72\x69\x63\x73\x42\x79\x54\x61\x62\x6C\x65","\x6C\x6F\x67","\x74\x61\x62\x6C\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x4D\x45\x54\x52\x49\x43","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x4D\x45\x54\x52\x49\x43\x5F\x43\x4F\x4E\x46\x49\x47\x55\x52\x41\x54\x49\x4F\x4E\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x67\x65\x74\x5A\x65\x6E\x64\x65\x73\x6B\x54\x65\x78\x74\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x672e[0];var _=require(_0x672e[1]);var Metric=require(_0x672e[3])[_0x672e[2]];var util=require(_0x672e[4]);var Util=require(_0x672e[5]);exports[_0x672e[6]]=function(_0xfbe4x5,_0xfbe4x6,_0xfbe4x7){return Metric[_0x672e[13]](Util[_0x672e[12]](_0xfbe4x5[_0x672e[11]]))[_0x672e[10]](function(_0xfbe4x9){_0xfbe4x6[_0x672e[9]](200)[_0x672e[8]](_0xfbe4x9)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[14]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[18]]({where:{name:_0xfbe4x5[_0x672e[17]][_0x672e[16]]}})[_0x672e[10]](function(_0xfbe4xa){if(!_0xfbe4xa){return _0xfbe4x6[_0x672e[15]](404)};return _0xfbe4x6[_0x672e[8]](_0xfbe4xa)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[19]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[18]]({where:{table:_0xfbe4x5[_0x672e[11]][_0x672e[21]]}})[_0x672e[10]](function(_0xfbe4xa){console[_0x672e[20]](_0xfbe4xa);if(!_0xfbe4xa){return _0xfbe4x6[_0x672e[15]](404)};return _0xfbe4x6[_0x672e[9]](200)[_0x672e[8]](_0xfbe4xa)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[22]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[25]](_0xfbe4x5[_0x672e[24]][_0x672e[23]])[_0x672e[10]](function(_0xfbe4xb){if(!_0xfbe4xb){return _0xfbe4x6[_0x672e[15]](404)};return _0xfbe4x6[_0x672e[8]](_0xfbe4xb)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[26]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[26]](_0xfbe4x5[_0x672e[17]])[_0x672e[10]](function(_0xfbe4xb){return _0xfbe4x6[_0x672e[9]](201)[_0x672e[8]](_0xfbe4xb)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[27]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[18]]({where:{name:_0xfbe4x5[_0x672e[17]][_0x672e[16]],id:{$ne:_0xfbe4x5[_0x672e[17]][_0x672e[23]]}}})[_0x672e[10]](function(_0xfbe4xa){if(!_0xfbe4xa){return _0xfbe4x6[_0x672e[15]](404)};if(_0xfbe4xa[_0x672e[30]]>0){return _0xfbe4x6[_0x672e[9]](500)[_0x672e[8]]({message:_0x672e[31]})};if(_0xfbe4x5[_0x672e[17]][_0x672e[23]]){delete _0xfbe4x5[_0x672e[17]][_0x672e[23]]};return Metric[_0x672e[32]]({where:{id:_0xfbe4x5[_0x672e[24]][_0x672e[23]]}})})[_0x672e[10]](function(_0xfbe4xb){if(!_0xfbe4xb){return _0xfbe4x6[_0x672e[15]](404)};var _0xfbe4xc=_[_0x672e[28]](_0xfbe4xb,_0xfbe4x5[_0x672e[17]]);return _0xfbe4xc[_0x672e[29]]()})[_0x672e[10]](function(){return _0xfbe4x6[_0x672e[15]](200)})[_0x672e[7]](function(_0xfbe4x8){console[_0x672e[20]](_0xfbe4x8);return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[33]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[25]](_0xfbe4x5[_0x672e[24]][_0x672e[23]])[_0x672e[10]](function(_0xfbe4xb){if(!_0xfbe4xb){return _0xfbe4x6[_0x672e[15]](404)};_0xfbe4xb[_0x672e[35]]()[_0x672e[10]](function(_0xfbe4xd){if(_0xfbe4xd[_0x672e[30]]>0){return _0xfbe4x6[_0x672e[9]](500)[_0x672e[8]]({message:_0x672e[34]})};_0xfbe4xb[_0x672e[33]]()[_0x672e[10]](function(){return _0xfbe4x6[_0x672e[15]](204)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};exports[_0x672e[36]]=function(_0xfbe4x5,_0xfbe4x6){Metric[_0x672e[33]]({where:{id:_0xfbe4x5[_0x672e[11]][_0x672e[23]]},individualHooks:true})[_0x672e[10]](function(){return _0xfbe4x6[_0x672e[15]](204)})[_0x672e[7]](function(_0xfbe4x8){return handleError(_0xfbe4x6,_0xfbe4x8)})};function handleError(_0xfbe4x6,_0xfbe4x8){return _0xfbe4x6[_0x672e[9]](500)[_0x672e[8]](_0xfbe4x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Metric = require('../../models').Metric; +var util = require('util'); +var Util = require('../../config/util'); + +// Get list of metrics +exports.index = function(req, res, next) { + return Metric + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.metricValidation = function(req, res) { + Metric + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(metrics) { + if (!metrics) { + return res.sendStatus(404); + } + return res.send(metrics); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getMetricsByTable = function(req, res) { + Metric + .findAll({ + where: { + table: req.query.table + } + }) + .then(function(metrics) { + console.log(metrics); + if (!metrics) { + return res.sendStatus(404); + } + return res.status(200).send(metrics); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single metric +exports.show = function(req, res) { + Metric + .findById(req.params.id) + .then(function(metric) { + if (!metric) { + return res.sendStatus(404); + } + return res.send(metric); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new metric in the DB. +exports.create = function(req, res) { + Metric + .create(req.body) + .then(function(metric) { + return res.status(201).send(metric); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing metric in the DB. +exports.update = function(req, res) { + Metric + .findAll({ + where: { + name: req.body.name, + id: { + $ne: req.body.id + } + } + }) + .then(function(metrics) { + if (!metrics) { + return res.sendStatus(404); + } + if (metrics.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_METRIC' + }) + } + if (req.body.id) { + delete req.body.id; + } + return Metric + .find({ + where: { + id: req.params.id + } + }); + }) + .then(function(metric) { + if (!metric) { + return res.sendStatus(404); + } + var updated = _.merge(metric, req.body); + return updated.save(); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Deletes a metric from the DB. +exports.destroy = function(req, res) { + Metric + .findById(req.params.id) + .then(function(metric) { + if (!metric) { + return res.sendStatus(404); + } + metric.getZendeskTexts() + .then(function(texts) { + if (texts.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_METRIC_CONFIGURATION_ASSOCIATED' + }); + } + metric.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + Metric + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/metric/metric.socket.js b/server/api/metric/metric.socket.js index f72203f..e604bc9 100644 --- a/server/api/metric/metric.socket.js +++ b/server/api/metric/metric.socket.js @@ -1 +1,41 @@ -var _0x5d53=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x65\x74\x72\x69\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x65\x74\x72\x69\x63\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x65\x74\x72\x69\x63\x3A\x72\x65\x6D\x6F\x76\x65","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x6D\x65\x74\x72\x69\x63","\x69\x64","\x75\x70\x64\x61\x74\x65"];_0x5d53[0];var Metric=require(_0x5d53[2])[_0x5d53[1]];var ReportField=require(_0x5d53[2])[_0x5d53[3]];exports[_0x5d53[4]]=function(_0xdfccx3){Metric[_0x5d53[5]](function(_0xdfccx4){onSave(_0xdfccx3,_0xdfccx4)});Metric[_0x5d53[6]](function(_0xdfccx4){updateFields(_0xdfccx4)});Metric[_0x5d53[7]](function(_0xdfccx4){onRemove(_0xdfccx3,_0xdfccx4)})};function onSave(_0xdfccx3,_0xdfccx4,_0xdfccx6){_0xdfccx3[_0x5d53[9]](_0x5d53[8],_0xdfccx4)}function onRemove(_0xdfccx3,_0xdfccx4,_0xdfccx6){_0xdfccx3[_0x5d53[9]](_0x5d53[10],_0xdfccx4)}function updateFields(_0xdfccx4){return ReportField[_0x5d53[15]]({field:_0xdfccx4[_0x5d53[13]]},{where:{MetricId:_0xdfccx4[_0x5d53[14]]}})[_0x5d53[12]](function(_0xdfccx9){console[_0x5d53[11]](_0xdfccx9)})} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Metric = require('../../models').Metric; +var ReportField = require('../../models').ReportField; + +exports.register = function(socket) { + Metric.afterCreate(function(doc) { + onSave(socket, doc); + }); + Metric.afterUpdate(function(doc) { + updateFields(doc); + }); + Metric.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('metric:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('metric:remove', doc); +} + +function updateFields(doc) { + return ReportField.update({ + field: doc.metric + }, { + where: { + MetricId: doc.id + } + }) + .catch(function(err) { + console.log(err); + }); +} diff --git a/server/api/metric/metric.spec.js b/server/api/metric/metric.spec.js index 3020939..076cab1 100644 --- a/server/api/metric/metric.spec.js +++ b/server/api/metric/metric.spec.js @@ -1 +1,20 @@ -var _0xafa9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x6D\x65\x74\x72\x69\x63\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x6D\x65\x74\x72\x69\x63\x73","\x67\x65\x74"];_0xafa9[0];var should=require(_0xafa9[1]);var app=require(_0xafa9[2]);var request=require(_0xafa9[3]);describe(_0xafa9[4],function(){it(_0xafa9[5],function(_0xd7bcx4){request(app)[_0xafa9[13]](_0xafa9[12])[_0xafa9[11]](200)[_0xafa9[11]](_0xafa9[10],/json/)[_0xafa9[9]](function(_0xd7bcx5,_0xd7bcx6){if(_0xd7bcx5){return _0xd7bcx4(_0xd7bcx5)};_0xd7bcx6[_0xafa9[8]][_0xafa9[1]][_0xafa9[7]][_0xafa9[6]](Array);_0xd7bcx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/analytics/metrics', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/analytics/metrics') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/module/index.js b/server/api/module/index.js index 617eb51..8204682 100644 --- a/server/api/module/index.js +++ b/server/api/module/index.js @@ -1 +1,15 @@ -var _0x1416=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x6F\x64\x75\x6C\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x1416[0];var express=require(_0x1416[1]);var controller=require(_0x1416[2]);var router=express.Router();router[_0x1416[5]](_0x1416[3],controller[_0x1416[4]]);router[_0x1416[5]](_0x1416[6],controller[_0x1416[7]]);router[_0x1416[9]](_0x1416[3],controller[_0x1416[8]]);router[_0x1416[11]](_0x1416[6],controller[_0x1416[10]]);router[_0x1416[12]](_0x1416[6],controller[_0x1416[10]]);router[_0x1416[14]](_0x1416[6],controller[_0x1416[13]]);module[_0x1416[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./module.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/module/module.controller.js b/server/api/module/module.controller.js index 433c64e..9d6517c 100644 --- a/server/api/module/module.controller.js +++ b/server/api/module/module.controller.js @@ -1 +1,92 @@ -var _0x9118=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x6F\x64\x75\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x9118[0];var _=require(_0x9118[1]);var Module=require(_0x9118[3])[_0x9118[2]];exports[_0x9118[4]]=function(_0xb6f5x3,_0xb6f5x4){Module[_0x9118[9]]()[_0x9118[8]](function(_0xb6f5x6){return _0xb6f5x4[_0x9118[7]](200)[_0x9118[6]](_0xb6f5x6)})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})};exports[_0x9118[10]]=function(_0xb6f5x3,_0xb6f5x4){var _0xb6f5x7=_0xb6f5x3[_0x9118[12]][_0x9118[11]];Module[_0x9118[14]](_0xb6f5x7)[_0x9118[8]](function(_0xb6f5x8){if(!_0xb6f5x8){return _0xb6f5x4[_0x9118[13]](404)};return _0xb6f5x4[_0x9118[6]](_0xb6f5x8)})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})};exports[_0x9118[15]]=function(_0xb6f5x3,_0xb6f5x4){Module[_0x9118[15]](_0xb6f5x3[_0x9118[16]])[_0x9118[8]](function(_0xb6f5x8){return _0xb6f5x4[_0x9118[7]](201)[_0x9118[6]](_0xb6f5x8)})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})};exports[_0x9118[17]]=function(_0xb6f5x3,_0xb6f5x4){var _0xb6f5x7=_0xb6f5x3[_0x9118[16]][_0x9118[11]];if(_0xb6f5x3[_0x9118[16]][_0x9118[11]]){delete _0xb6f5x3[_0x9118[16]][_0x9118[11]]};Module[_0x9118[14]](_0xb6f5x7)[_0x9118[8]](function(_0xb6f5x8){if(!_0xb6f5x8){return _0xb6f5x4[_0x9118[13]](404)};var _0xb6f5x9=_[_0x9118[18]](_0xb6f5x8,_0xb6f5x3[_0x9118[16]]);_0xb6f5x9[_0x9118[19]]()[_0x9118[8]](function(){return _0xb6f5x4[_0x9118[7]](200)[_0x9118[6]](_0xb6f5x8)})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})};exports[_0x9118[20]]=function(_0xb6f5x3,_0xb6f5x4){var _0xb6f5x7=_0xb6f5x3[_0x9118[12]][_0x9118[11]];Module[_0x9118[14]](_0xb6f5x7)[_0x9118[8]](function(_0xb6f5x8){if(!_0xb6f5x8){return _0xb6f5x4[_0x9118[13]](404)};_0xb6f5x8[_0x9118[20]]()[_0x9118[8]](function(){return _0xb6f5x4[_0x9118[13]](204)})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})})[_0x9118[5]](function(_0xb6f5x5){return handleError(_0xb6f5x4,_0xb6f5x5)})};function handleError(_0xb6f5x4,_0xb6f5x5){return _0xb6f5x4[_0x9118[7]](500)[_0x9118[6]](_0xb6f5x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Module = require('../../models').Module; + +// Get list of modules +exports.index = function(req, res) { + Module + .findAll() + .then(function (modules) { + return res.status(200).send(modules); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single module +exports.show = function(req, res) { + var moduleId = req.params.id; + + Module + .findById(moduleId) + .then(function (module) { + if(!module) { return res.sendStatus(404); } + return res.send(module); + }) + .catch(function(err){ + return handleError(res, err); + }); +}; + +// Creates a new module in the DB. +exports.create = function(req, res) { + Module + .create(req.body) + .then(function(module) { + return res.status(201).send(module); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing module in the DB. +exports.update = function(req, res) { + var moduleId = req.body.id; + + if(req.body.id) { delete req.body.id; } + + Module + .findById(moduleId) + .then(function (module) { + if(!module) { return res.sendStatus(404); } + var updated = _.merge(module, req.body); + updated.save() + .then(function () { + return res.status(200).send(module); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a module from the DB. +exports.destroy = function(req, res) { + var moduleId = req.params.id; + + Module + .findById(moduleId) + .then(function (module) { + if(!module) { return res.sendStatus(404); } + module.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/module/module.socket.js b/server/api/module/module.socket.js index d23fa47..0eade3b 100644 --- a/server/api/module/module.socket.js +++ b/server/api/module/module.socket.js @@ -1 +1,24 @@ -var _0xfc50=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x6F\x64\x75\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x6F\x64\x75\x6C\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x6F\x64\x75\x6C\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xfc50[0];var module=require(_0xfc50[2])[_0xfc50[1]];exports[_0xfc50[3]]=function(_0x9b20x2){module[_0xfc50[4]](function(_0x9b20x3){onSave(_0x9b20x2,_0x9b20x3)});module[_0xfc50[5]](function(_0x9b20x3){onRemove(_0x9b20x2,_0x9b20x3)})};function onSave(_0x9b20x2,_0x9b20x3,_0x9b20x5){_0x9b20x2[_0xfc50[7]](_0xfc50[6],_0x9b20x3)}function onRemove(_0x9b20x2,_0x9b20x3,_0x9b20x5){_0x9b20x2[_0xfc50[7]](_0xfc50[8],_0x9b20x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var module = require('../../models').Module; + +exports.register = function(socket) { + module.afterCreate(function (doc) { + onSave(socket, doc); + }); + module.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('module:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('module:remove', doc); +} diff --git a/server/api/module/module.spec.js b/server/api/module/module.spec.js index 46c329d..45aa629 100644 --- a/server/api/module/module.spec.js +++ b/server/api/module/module.spec.js @@ -1 +1,20 @@ -var _0xf994=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x6D\x6F\x64\x75\x6C\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x6D\x6F\x64\x75\x6C\x65\x73","\x67\x65\x74"];_0xf994[0];var should=require(_0xf994[1]);var app=require(_0xf994[2]);var request=require(_0xf994[3]);describe(_0xf994[4],function(){it(_0xf994[5],function(_0xe187x4){request(app)[_0xf994[13]](_0xf994[12])[_0xf994[11]](200)[_0xf994[11]](_0xf994[10],/json/)[_0xf994[9]](function(_0xe187x5,_0xe187x6){if(_0xe187x5){return _0xe187x4(_0xe187x5)};_0xe187x6[_0xf994[8]][_0xf994[1]][_0xf994[7]][_0xf994[6]](Array);_0xe187x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/modules', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/modules') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/module/setting/index.js b/server/api/module/setting/index.js index e7f2252..f341cb4 100644 --- a/server/api/module/setting/index.js +++ b/server/api/module/setting/index.js @@ -1 +1,15 @@ -var _0xc449=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x65\x74\x74\x69\x6E\x67\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x67\x65\x74","\x2F","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xc449[0];var express=require(_0xc449[1]);var controller=require(_0xc449[2]);var router=express.Router();router[_0xc449[5]](_0xc449[3],controller[_0xc449[4]]);router[_0xc449[8]](_0xc449[6],controller[_0xc449[7]]);router[_0xc449[10]](_0xc449[3],controller[_0xc449[9]]);router[_0xc449[11]](_0xc449[3],controller[_0xc449[9]]);router[_0xc449[13]](_0xc449[3],controller[_0xc449[12]]);module[_0xc449[14]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./setting.controller'); + +var router = express.Router(); + +// router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/module/setting/setting.controller.js b/server/api/module/setting/setting.controller.js index a16a0fc..3ebcb5c 100644 --- a/server/api/module/setting/setting.controller.js +++ b/server/api/module/setting/setting.controller.js @@ -1 +1,110 @@ -var _0x74ac=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x63\x72\x79\x70\x74\x6F","\x53\x65\x74\x74\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6C\x69\x63\x65\x6E\x73\x65","\x61\x65\x73\x2D\x32\x35\x36\x2D\x63\x74\x72","\x25\x73\x3A\x25\x73\x3A\x25\x73","\x61\x64\x64\x72\x65\x73\x73","\x6E\x65\x74\x6D\x61\x73\x6B","\x6D\x61\x63","\x66\x6F\x72\x6D\x61\x74","\x70\x61\x72\x73\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x63\x72\x65\x61\x74\x65\x44\x65\x63\x69\x70\x68\x65\x72","\x68\x65\x78","\x75\x74\x66\x38","\x66\x69\x6E\x61\x6C"];_0x74ac[0];var _=require(_0x74ac[1]);var util=require(_0x74ac[2]);var crypto=require(_0x74ac[3]);var Setting=require(_0x74ac[5])[_0x74ac[4]];exports[_0x74ac[6]]=function(_0xd32ex5,_0xd32ex6){Setting[_0x74ac[11]]()[_0x74ac[10]](function(_0xd32ex8){return _0xd32ex6[_0x74ac[9]](200)[_0x74ac[8]](_0xd32ex8)})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})};exports[_0x74ac[12]]=function(_0xd32ex5,_0xd32ex6){Setting[_0x74ac[24]](_0xd32ex5[_0x74ac[23]][_0x74ac[22]])[_0x74ac[10]](function(_0xd32ex9){if(!_0xd32ex9){return _0xd32ex6[_0x74ac[13]](404)};if(_0xd32ex9[_0x74ac[14]]){_0xd32ex9[_0x74ac[14]]=decrypt(_0x74ac[15],util[_0x74ac[20]](_0x74ac[16],_0xd32ex9[_0x74ac[17]],_0xd32ex9[_0x74ac[18]],_0xd32ex9[_0x74ac[19]]),_0xd32ex9[_0x74ac[14]]);_0xd32ex9[_0x74ac[14]]=JSON[_0x74ac[21]](_0xd32ex9[_0x74ac[14]])};return _0xd32ex6[_0x74ac[8]](_0xd32ex9)})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})};exports[_0x74ac[25]]=function(_0xd32ex5,_0xd32ex6){Setting[_0x74ac[25]](_0xd32ex5[_0x74ac[26]])[_0x74ac[10]](function(_0xd32ex9){return _0xd32ex6[_0x74ac[9]](201)[_0x74ac[8]](_0xd32ex9)})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})};exports[_0x74ac[27]]=function(_0xd32ex5,_0xd32ex6){if(_0xd32ex5[_0x74ac[26]][_0x74ac[22]]){delete _0xd32ex5[_0x74ac[26]][_0x74ac[22]]};Setting[_0x74ac[24]](_0xd32ex5[_0x74ac[23]][_0x74ac[22]])[_0x74ac[10]](function(_0xd32ex9){if(!_0xd32ex9){return _0xd32ex6[_0x74ac[13]](404)};var _0xd32exa=_[_0x74ac[28]](_0xd32ex9,_0xd32ex5[_0x74ac[26]]);_0xd32exa[_0x74ac[29]]()[_0x74ac[10]](function(){return _0xd32ex6[_0x74ac[9]](200)[_0x74ac[8]](_0xd32ex9)})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})};exports[_0x74ac[30]]=function(_0xd32ex5,_0xd32ex6){Setting[_0x74ac[24]](_0xd32ex5[_0x74ac[23]][_0x74ac[22]])[_0x74ac[10]](function(_0xd32ex9){if(!_0xd32ex9){return _0xd32ex6[_0x74ac[13]](404)};_0xd32ex9[_0x74ac[30]]()[_0x74ac[10]](function(){return _0xd32ex6[_0x74ac[13]](204)})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})})[_0x74ac[7]](function(_0xd32ex7){return handleError(_0xd32ex6,_0xd32ex7)})};function handleError(_0xd32ex6,_0xd32ex7){return _0xd32ex6[_0x74ac[9]](500)[_0x74ac[8]](_0xd32ex7)}function decrypt(_0xd32exd,_0xd32exe,_0xd32exf){var _0xd32ex10=crypto[_0x74ac[31]](_0xd32exd,_0xd32exe);var _0xd32ex11=_0xd32ex10[_0x74ac[27]](_0xd32exf,_0x74ac[32],_0x74ac[33]);_0xd32ex11+=_0xd32ex10[_0x74ac[34]](_0x74ac[33]);return _0xd32ex11} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var crypto = require('crypto'); + +var Setting = require('../../models').Setting; + +// Get list of settings +exports.index = function(req, res) { + Setting + .findAll() + .then(function(settings) { + return res.status(200).send(settings); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single setting +exports.show = function(req, res) { + Setting + .findById(req.params.id) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + + if (setting.license) { + setting.license = decrypt('aes-256-ctr', util.format('%s:%s:%s', + setting.address, setting.netmask, setting.mac), setting.license); + setting.license = JSON.parse(setting.license); + } + + return res.send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new setting in the DB. +exports.create = function(req, res) { + Setting + .create(req.body) + .then(function(setting) { + return res.status(201).send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing setting in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Setting + .findById(req.params.id) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + var updated = _.merge(setting, req.body); + updated.save() + .then(function() { + return res.status(200).send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a setting from the DB. +exports.destroy = function(req, res) { + Setting + .findById(req.params.id) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + setting.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} + +function decrypt(algorithm, password, text) { + var decipher = crypto.createDecipher(algorithm, password) + var dec = decipher.update(text, 'hex', 'utf8') + dec += decipher.final('utf8'); + return dec; +} diff --git a/server/api/module/setting/setting.socket.js b/server/api/module/setting/setting.socket.js index d34fe4a..0784c1f 100644 --- a/server/api/module/setting/setting.socket.js +++ b/server/api/module/setting/setting.socket.js @@ -1 +1,24 @@ -var _0x196b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x65\x74\x74\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x74\x74\x69\x6E\x67\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x65\x74\x74\x69\x6E\x67\x3A\x72\x65\x6D\x6F\x76\x65"];_0x196b[0];var Setting=require(_0x196b[2])[_0x196b[1]];exports[_0x196b[3]]=function(_0x32ddx2){Setting[_0x196b[4]](function(_0x32ddx3){onSave(_0x32ddx2,_0x32ddx3)});Setting[_0x196b[5]](function(_0x32ddx3){onRemove(_0x32ddx2,_0x32ddx3)})};function onSave(_0x32ddx2,_0x32ddx3,_0x32ddx5){_0x32ddx2[_0x196b[7]](_0x196b[6],_0x32ddx3)}function onRemove(_0x32ddx2,_0x32ddx3,_0x32ddx5){_0x32ddx2[_0x196b[7]](_0x196b[8],_0x32ddx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Setting = require('../../models').Setting; + +exports.register = function(socket) { + Setting.afterCreate(function(doc) { + onSave(socket, doc); + }); + Setting.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('setting:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('setting:remove', doc); +} diff --git a/server/api/module/setting/setting.spec.js b/server/api/module/setting/setting.spec.js index 285d4e4..eec76c9 100644 --- a/server/api/module/setting/setting.spec.js +++ b/server/api/module/setting/setting.spec.js @@ -1 +1,20 @@ -var _0xbea5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x65\x74\x74\x69\x6E\x67\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x73\x65\x74\x74\x69\x6E\x67\x73","\x67\x65\x74"];_0xbea5[0];var should=require(_0xbea5[1]);var app=require(_0xbea5[2]);var request=require(_0xbea5[3]);describe(_0xbea5[4],function(){it(_0xbea5[5],function(_0x409bx4){request(app)[_0xbea5[13]](_0xbea5[12])[_0xbea5[11]](200)[_0xbea5[11]](_0xbea5[10],/json/)[_0xbea5[9]](function(_0x409bx5,_0x409bx6){if(_0x409bx5){return _0x409bx4(_0x409bx5)};_0x409bx6[_0xbea5[8]][_0xbea5[1]][_0xbea5[7]][_0xbea5[6]](Array);_0x409bx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/settings', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/settings') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/motionbar/index.js b/server/api/motionbar/index.js index 546e97c..fd9d420 100644 --- a/server/api/motionbar/index.js +++ b/server/api/motionbar/index.js @@ -1 +1,11 @@ -var _0x7661=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x3A\x61\x63\x74\x69\x6F\x6E\x2F\x3A\x73\x74\x61\x74\x65","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x61\x63\x74\x69\x6F\x6E","\x67\x65\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x7661[0];var express=require(_0x7661[1]);var controller=require(_0x7661[2]);var auth=require(_0x7661[3]);var router=express.Router();router[_0x7661[7]](_0x7661[4],auth[_0x7661[5]](),controller[_0x7661[6]]);module[_0x7661[8]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./motionbar.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/:action/:state', auth.isAuthenticated(), controller.action); + +module.exports = router; diff --git a/server/api/motionbar/motionbar.controller.js b/server/api/motionbar/motionbar.controller.js index 1a2c6d5..f0a79be 100644 --- a/server/api/motionbar/motionbar.controller.js +++ b/server/api/motionbar/motionbar.controller.js @@ -1 +1,32 @@ -var _0x4d35=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x61\x63\x74\x69\x6F\x6E","\x75\x73\x65\x72\x49\x64","\x71\x75\x65\x72\x79","\x55\x73\x65\x20\x75\x73\x65\x72\x49\x64","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x70\x61\x72\x61\x6D\x73","\x73\x74\x61\x74\x65","\x41\x64\x6D\x69\x6E\x49\x64","\x69\x64","\x75\x73\x65\x72","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65"];_0x4d35[0];var _=require(_0x4d35[1]);var Motionbar=require(_0x4d35[3])[_0x4d35[2]];exports[_0x4d35[4]]=function(_0x6010x3,_0x6010x4){if(!_0x6010x3[_0x4d35[6]][_0x4d35[5]]){return handleError(_0x6010x4,{message:_0x4d35[7]})};_0x6010x3[_0x4d35[9]][_0x4d35[8]]=parseInt(_0x6010x3[_0x4d35[6]][_0x4d35[5]],10);_0x6010x3[_0x4d35[9]][_0x4d35[4]]=_0x6010x3[_0x4d35[10]][_0x4d35[4]];_0x6010x3[_0x4d35[9]][_0x4d35[11]]=_0x6010x3[_0x4d35[10]][_0x4d35[11]];_0x6010x3[_0x4d35[9]][_0x4d35[12]]=_0x6010x3[_0x4d35[14]][_0x4d35[13]];Motionbar[_0x4d35[19]](_0x6010x3[_0x4d35[9]])[_0x4d35[18]](function(_0x6010x6){return _0x6010x4[_0x4d35[17]](201)[_0x4d35[16]](_0x6010x6)})[_0x4d35[15]](function(_0x6010x5){return handleError(_0x6010x4,_0x6010x5)})};function handleError(_0x6010x4,_0x6010x5){return _0x6010x4[_0x4d35[17]](500)[_0x4d35[16]](_0x6010x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Motionbar = require('../../models').Motionbar; + +// Get list of motionbars +exports.action = function(req, res) { + + if (!req.query.userId) { + return handleError(res, { + message: 'Use userId' + }); + } + + req.body.UserId = parseInt(req.query.userId, 10); + req.body.action = req.params.action; + req.body.state = req.params.state; + req.body.AdminId = req.user.id; + + Motionbar + .create(req.body) + .then(function(action) { + return res.status(201).send(action); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/motionbar/motionbar.socket.js b/server/api/motionbar/motionbar.socket.js index 2bede78..0eb15d4 100644 --- a/server/api/motionbar/motionbar.socket.js +++ b/server/api/motionbar/motionbar.socket.js @@ -1 +1,27 @@ -var _0x5d55=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x49\x64","\x55\x73\x65\x72\x49\x64","\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0x5d55[0];var Motionbar=require(_0x5d55[2])[_0x5d55[1]];exports[_0x5d55[3]]=function(_0xdafcx2){Motionbar[_0x5d55[4]](function(_0xdafcx3){onSave(_0xdafcx2,_0xdafcx3)});Motionbar[_0x5d55[5]](function(_0xdafcx3){onRemove(_0xdafcx2,_0xdafcx3)})};function onSave(_0xdafcx2,_0xdafcx3,_0xdafcx5){if(_0xdafcx2[_0x5d55[6]]==_0xdafcx3[_0x5d55[7]]){_0xdafcx2[_0x5d55[9]](_0x5d55[8],_0xdafcx3)}}function onRemove(_0xdafcx2,_0xdafcx3,_0xdafcx5){_0xdafcx2[_0x5d55[9]](_0x5d55[10],_0xdafcx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Motionbar = require('../../models').Motionbar; + +exports.register = function(socket) { + Motionbar.afterCreate(function(doc) { + onSave(socket, doc); + }); + Motionbar.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + // doc.UserId is string. You don't use === + if (socket.userId == doc.UserId) { + socket.emit('motionbar:save', doc); + } +} + +function onRemove(socket, doc, cb) { + socket.emit('motionbar:remove', doc); +} diff --git a/server/api/motionbar/motionbar.spec.js b/server/api/motionbar/motionbar.spec.js index fc63e66..bbbac7f 100644 --- a/server/api/motionbar/motionbar.spec.js +++ b/server/api/motionbar/motionbar.spec.js @@ -1 +1,20 @@ -var _0xb24d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x67\x65\x74"];_0xb24d[0];var should=require(_0xb24d[1]);var app=require(_0xb24d[2]);var request=require(_0xb24d[3]);describe(_0xb24d[4],function(){it(_0xb24d[5],function(_0xe853x4){request(app)[_0xb24d[13]](_0xb24d[12])[_0xb24d[11]](200)[_0xb24d[11]](_0xb24d[10],/json/)[_0xb24d[9]](function(_0xe853x5,_0xe853x6){if(_0xe853x5){return _0xe853x4(_0xe853x5)};_0xe853x6[_0xb24d[8]][_0xb24d[1]][_0xb24d[7]][_0xb24d[6]](Array);_0xe853x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/motionbar', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/motionbar') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a3d2dff..bdf03bc 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -1 +1,17 @@ -var _0x7e9b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x70\x61\x75\x73\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x7e9b[0];var express=require(_0x7e9b[1]);var auth=require(_0x7e9b[2]);var controller=require(_0x7e9b[3]);var router=express.Router();router[_0x7e9b[7]](_0x7e9b[4],auth[_0x7e9b[5]](),controller[_0x7e9b[6]]);router[_0x7e9b[7]](_0x7e9b[8],auth[_0x7e9b[5]](),controller[_0x7e9b[9]]);router[_0x7e9b[11]](_0x7e9b[4],auth[_0x7e9b[5]](),controller[_0x7e9b[10]]);router[_0x7e9b[13]](_0x7e9b[8],auth[_0x7e9b[5]](),controller[_0x7e9b[12]]);router[_0x7e9b[14]](_0x7e9b[8],auth[_0x7e9b[5]](),controller[_0x7e9b[12]]);router[_0x7e9b[16]](_0x7e9b[4],auth[_0x7e9b[5]](),controller[_0x7e9b[15]]);router[_0x7e9b[16]](_0x7e9b[8],auth[_0x7e9b[5]](),controller[_0x7e9b[17]]);module[_0x7e9b[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./pause.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 93596d9..84c022b 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -1 +1,150 @@ -var _0x1e58=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x50\x61\x75\x73\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64\x73","\x6C\x69\x6D\x69\x74","\x6F\x66\x66\x73\x65\x74","\x6F\x72\x64\x65\x72","\x77\x68\x65\x72\x65","\x25","\x66\x6F\x72\x45\x61\x63\x68"];_0x1e58[0];var _=require(_0x1e58[1]);var Util=require(_0x1e58[2]);var Pause=require(_0x1e58[4])[_0x1e58[3]];function handleError(_0x3ad2x5,_0x3ad2x6){_0x3ad2x6=_0x3ad2x6||500;return function(_0x3ad2x7){_0x3ad2x5[_0x1e58[6]](_0x3ad2x6)[_0x1e58[5]](_0x3ad2x7)}}function responseWithResult(_0x3ad2x5,_0x3ad2x6){_0x3ad2x6=_0x3ad2x6||200;return function(_0x3ad2x9){if(_0x3ad2x9){_0x3ad2x5[_0x1e58[6]](_0x3ad2x6)[_0x1e58[7]](_0x3ad2x9)}}}function handleEntityNotFound(_0x3ad2x5){return function(_0x3ad2x9){if(!_0x3ad2x9){_0x3ad2x5[_0x1e58[6]](404)[_0x1e58[8]]();return null};return _0x3ad2x9}}function saveUpdates(_0x3ad2xc){return function(_0x3ad2x9){return _0x3ad2x9[_0x1e58[10]](_0x3ad2xc)[_0x1e58[9]](function(_0x3ad2xd){return _0x3ad2xd})}}function removeEntity(_0x3ad2x5){return function(_0x3ad2x9){if(_0x3ad2x9){return _0x3ad2x9[_0x1e58[11]]()[_0x1e58[9]](function(){_0x3ad2x5[_0x1e58[6]](204)[_0x1e58[8]]()})}}}exports[_0x1e58[12]]=function(_0x3ad2xf,_0x3ad2x5){return Pause[_0x1e58[16]](Util[_0x1e58[15]](_0x3ad2xf[_0x1e58[14]]))[_0x1e58[9]](function(_0x3ad2x10){_0x3ad2x5[_0x1e58[6]](200)[_0x1e58[5]](_0x3ad2x10)})[_0x1e58[13]](function(_0x3ad2x7){return handleError(_0x3ad2x5,_0x3ad2x7)})};exports[_0x1e58[17]]=function(_0x3ad2xf,_0x3ad2x5){Pause[_0x1e58[20]](_0x3ad2xf[_0x1e58[19]][_0x1e58[18]])[_0x1e58[9]](handleEntityNotFound(_0x3ad2x5))[_0x1e58[9]](responseWithResult(_0x3ad2x5))[_0x1e58[13]](handleError(_0x3ad2x5))};exports[_0x1e58[21]]=function(_0x3ad2xf,_0x3ad2x5){Pause[_0x1e58[21]](_0x3ad2xf[_0x1e58[22]])[_0x1e58[9]](responseWithResult(_0x3ad2x5,201))[_0x1e58[13]](handleError(_0x3ad2x5))};exports[_0x1e58[23]]=function(_0x3ad2xf,_0x3ad2x5){if(_0x3ad2xf[_0x1e58[22]][_0x1e58[18]]){delete _0x3ad2xf[_0x1e58[22]][_0x1e58[18]]};Pause[_0x1e58[20]](_0x3ad2xf[_0x1e58[19]][_0x1e58[18]])[_0x1e58[9]](handleEntityNotFound(_0x3ad2x5))[_0x1e58[9]](saveUpdates(_0x3ad2xf[_0x1e58[22]]))[_0x1e58[9]](responseWithResult(_0x3ad2x5))[_0x1e58[13]](handleError(_0x3ad2x5))};exports[_0x1e58[11]]=function(_0x3ad2xf,_0x3ad2x5){Pause[_0x1e58[20]](_0x3ad2xf[_0x1e58[19]][_0x1e58[18]])[_0x1e58[9]](handleEntityNotFound(_0x3ad2x5))[_0x1e58[9]](removeEntity(_0x3ad2x5))[_0x1e58[13]](handleError(_0x3ad2x5))};exports[_0x1e58[24]]=function(_0x3ad2xf,_0x3ad2x5){return Pause[_0x1e58[11]]({where:{id:_0x3ad2xf[_0x1e58[14]][_0x1e58[26]]},individualHooks:true})[_0x1e58[9]](function(){return _0x3ad2x5[_0x1e58[25]](204)})[_0x1e58[13]](function(_0x3ad2x7){return handleError(_0x3ad2x5,_0x3ad2x7)})};function getQuery(_0x3ad2x12){var _0x3ad2x13={where:{}};_[_0x1e58[32]](_0x3ad2x12,function(_0x3ad2x14,_0x3ad2x15){switch(_0x3ad2x15){case _0x1e58[27]:;case _0x1e58[28]:;case _0x1e58[29]:_0x3ad2x13[_0x3ad2x15]=_0x3ad2x14;break;default:_0x3ad2x13[_0x1e58[30]][_0x3ad2x15]={$like:_0x1e58[31]+_0x3ad2x14+_0x1e58[31]}}});return _0x3ad2x13} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/pauses -> index + * POST /api/pauses -> create + * GET /api/pauses/:id -> show + * PUT /api/pauses/:id -> update + * DELETE /api/pauses/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var Pause = require('../../models').Pause; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function (err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function (entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function (entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function (entity) { + return entity.updateAttributes(updates) + .then(function (updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function (entity) { + if (entity) { + return entity.destroy() + .then(function () { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of Pauses +exports.index = function (req, res) { + return Pause + .findAndCountAll(Util.getQuery(req.query)) + .then(function (result) { + res.status(200).send(result); + }) + .catch(function (err) { + return handleError(res, err); + }); +} + +// Gets a single Pause from the DB +exports.show = function (req, res) { + Pause.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new Pause in the DB +exports.create = function (req, res) { + Pause.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing Pause in the DB +exports.update = function (req, res) { + if (req.body.id) { + delete req.body.id; + } + Pause.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a Pause from the DB +exports.destroy = function (req, res) { + Pause.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +// Deletes a agent from the DB. +exports.bulkDestroy = function (req, res) { + + return Pause + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function () { + return res.sendStatus(204); + }) + .catch(function (err) { + return handleError(res, err); + }); +}; + +function getQuery(query) { + var _query = { + where: {} + }; + + _.forEach(query, function (value, key) { + switch (key) { + case 'limit': + case 'offset': + case 'order': + _query[key] = value; + break; + default: + _query.where[key] = { + $like: '%' + value + '%' + }; + } + }); + + return _query; +} diff --git a/server/api/pause/pause.socket.js b/server/api/pause/pause.socket.js index c33b0a6..fd1c7b0 100644 --- a/server/api/pause/pause.socket.js +++ b/server/api/pause/pause.socket.js @@ -1 +1,24 @@ -var _0x7e30=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x50\x61\x75\x73\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x70\x61\x75\x73\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x70\x61\x75\x73\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7e30[0];var Pause=require(_0x7e30[2])[_0x7e30[1]];exports[_0x7e30[3]]=function(_0xd583x2){Pause[_0x7e30[4]](function(_0xd583x3){onSave(_0xd583x2,_0xd583x3)});Pause[_0x7e30[5]](function(_0xd583x3){onRemove(_0xd583x2,_0xd583x3)})};function onSave(_0xd583x2,_0xd583x3,_0xd583x5){_0xd583x2[_0x7e30[7]](_0x7e30[6],_0xd583x3)}function onRemove(_0xd583x2,_0xd583x3,_0xd583x5){_0xd583x2[_0x7e30[7]](_0x7e30[8],_0xd583x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Pause = require('../../models').Pause; + +exports.register = function(socket) { + Pause.afterCreate(function(doc) { + onSave(socket, doc); + }); + Pause.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('pause:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('pause:remove', doc); +} diff --git a/server/api/report_agent/index.js b/server/api/report_agent/index.js index 5490a34..92aec80 100644 --- a/server/api/report_agent/index.js +++ b/server/api/report_agent/index.js @@ -1 +1,16 @@ -var _0x297c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x297c[0];var express=require(_0x297c[1]);var controller=require(_0x297c[2]);var router=express.Router();router[_0x297c[5]](_0x297c[3],controller[_0x297c[4]]);router[_0x297c[5]](_0x297c[6],controller[_0x297c[7]]);router[_0x297c[5]](_0x297c[8],controller[_0x297c[9]]);router[_0x297c[11]](_0x297c[3],controller[_0x297c[10]]);router[_0x297c[13]](_0x297c[8],controller[_0x297c[12]]);router[_0x297c[14]](_0x297c[8],controller[_0x297c[12]]);router[_0x297c[16]](_0x297c[8],controller[_0x297c[15]]);module[_0x297c[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_agent.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/describe', controller.describe); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_agent/report_agent.controller.js b/server/api/report_agent/report_agent.controller.js index c43a86d..1b848da 100644 --- a/server/api/report_agent/report_agent.controller.js +++ b/server/api/report_agent/report_agent.controller.js @@ -1 +1,106 @@ -var _0x5c5b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x5c5b[0];var _=require(_0x5c5b[1]);var ReportAgent=require(_0x5c5b[3])[_0x5c5b[2]];var ReportAgentHistory=require(_0x5c5b[3])[_0x5c5b[5]][_0x5c5b[4]];exports[_0x5c5b[6]]=function(_0x468fx4,_0x468fx5){ReportAgent[_0x5c5b[11]]()[_0x5c5b[10]](function(_0x468fx7){return _0x468fx5[_0x5c5b[9]](200)[_0x5c5b[8]](_0x468fx7)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};exports[_0x5c5b[12]]=function(_0x468fx4,_0x468fx5){ReportAgentHistory[_0x5c5b[12]]()[_0x5c5b[10]](function(_0x468fx8){return _0x468fx5[_0x5c5b[9]](200)[_0x5c5b[8]](_0x468fx8)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};exports[_0x5c5b[13]]=function(_0x468fx4,_0x468fx5){ReportAgent[_0x5c5b[17]](_0x468fx4[_0x5c5b[16]][_0x5c5b[15]])[_0x5c5b[10]](function(_0x468fx9){if(!_0x468fx9){return _0x468fx5[_0x5c5b[14]](404)};return _0x468fx5[_0x5c5b[8]](_0x468fx9)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};exports[_0x5c5b[18]]=function(_0x468fx4,_0x468fx5){ReportAgent[_0x5c5b[18]](_0x468fx4[_0x5c5b[19]])[_0x5c5b[10]](function(_0x468fx9){return _0x468fx5[_0x5c5b[9]](201)[_0x5c5b[8]](_0x468fx9)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};exports[_0x5c5b[20]]=function(_0x468fx4,_0x468fx5){if(_0x468fx4[_0x5c5b[19]][_0x5c5b[15]]){delete _0x468fx4[_0x5c5b[19]][_0x5c5b[15]]};ReportAgent[_0x5c5b[17]](_0x468fx4[_0x5c5b[16]][_0x5c5b[15]])[_0x5c5b[10]](function(_0x468fx9){if(!_0x468fx9){return _0x468fx5[_0x5c5b[14]](404)};var _0x468fxa=_[_0x5c5b[21]](_0x468fx9,_0x468fx4[_0x5c5b[19]]);_0x468fxa[_0x5c5b[22]]()[_0x5c5b[10]](function(){return _0x468fx5[_0x5c5b[9]](200)[_0x5c5b[8]](_0x468fx9)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};exports[_0x5c5b[23]]=function(_0x468fx4,_0x468fx5){ReportAgent[_0x5c5b[17]](_0x468fx4[_0x5c5b[16]][_0x5c5b[15]])[_0x5c5b[10]](function(_0x468fx9){if(!_0x468fx9){return _0x468fx5[_0x5c5b[14]](404)};_0x468fx9[_0x5c5b[23]]()[_0x5c5b[10]](function(){return _0x468fx5[_0x5c5b[14]](204)})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})})[_0x5c5b[7]](function(_0x468fx6){return handleError(_0x468fx5,_0x468fx6)})};function handleError(_0x468fx5,_0x468fx6){return _0x468fx5[_0x5c5b[9]](500)[_0x5c5b[8]](_0x468fx6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportAgent = require('../../models').ReportAgent; +var ReportAgentHistory = require('../../models').history.ReportAgentHistory; + +// Get list of report_agents +exports.index = function(req, res) { + ReportAgent + .findAll() + .then(function(report_agents) { + return res.status(200).send(report_agents); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of fields +exports.describe = function(req, res) { + ReportAgentHistory + .describe() + .then(function(fields) { + return res.status(200).send(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single report_agent +exports.show = function(req, res) { + ReportAgent + .findById(req.params.id) + .then(function(report_agent) { + if (!report_agent) { + return res.sendStatus(404); + } + return res.send(report_agent); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new report_agent in the DB. +exports.create = function(req, res) { + ReportAgent + .create(req.body) + .then(function(report_agent) { + return res.status(201).send(report_agent); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing report_agent in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + ReportAgent + .findById(req.params.id) + .then(function(report_agent) { + if (!report_agent) { + return res.sendStatus(404); + } + var updated = _.merge(report_agent, req.body); + updated.save() + .then(function() { + return res.status(200).send(report_agent); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a report_agent from the DB. +exports.destroy = function(req, res) { + ReportAgent + .findById(req.params.id) + .then(function(report_agent) { + if (!report_agent) { + return res.sendStatus(404); + } + report_agent.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_agent/report_agent.socket.js b/server/api/report_agent/report_agent.socket.js index b54d349..86cb2bb 100644 --- a/server/api/report_agent/report_agent.socket.js +++ b/server/api/report_agent/report_agent.socket.js @@ -1 +1,30 @@ -var _0x57b8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x57b8[0];var ReportAgent=require(_0x57b8[2])[_0x57b8[1]];exports[_0x57b8[3]]=function(_0x1485x2){ReportAgent[_0x57b8[4]](function(_0x1485x3){onSave(_0x1485x2,_0x1485x3)});ReportAgent[_0x57b8[5]](function(_0x1485x3){onSave(_0x1485x2,_0x1485x3)});ReportAgent[_0x57b8[6]](function(_0x1485x3){onRemove(_0x1485x2,_0x1485x3)})};function onSave(_0x1485x2,_0x1485x3,_0x1485x5){if(_0x1485x2[_0x57b8[7]]===_0x1485x3[_0x57b8[8]]||_0x1485x2[_0x57b8[9]]===_0x57b8[10]){_0x1485x2[_0x57b8[12]](_0x57b8[11],_0x1485x3)}}function onRemove(_0x1485x2,_0x1485x3,_0x1485x5){_0x1485x2[_0x57b8[12]](_0x57b8[13],_0x1485x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportAgent = require('../../models').ReportAgent; + +exports.register = function(socket) { + ReportAgent.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportAgent.afterUpdate(function(doc) { + onSave(socket, doc); + }); + ReportAgent.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (socket.name === doc.membername || socket.role === 'admin') { + socket.emit('report_agent:save', doc); + } + +} + +function onRemove(socket, doc, cb) { + socket.emit('report_agent:remove', doc); +} diff --git a/server/api/report_chat/index.js b/server/api/report_chat/index.js index 51e097b..7701153 100644 --- a/server/api/report_chat/index.js +++ b/server/api/report_chat/index.js @@ -1 +1,17 @@ -var _0x33ce=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x63\x63\x65\x70\x74\x2F\x3A\x75\x6E\x69\x71\x75\x65\x69\x64","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x61\x63\x63\x65\x70\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x33ce[0];var express=require(_0x33ce[1]);var controller=require(_0x33ce[2]);var auth=require(_0x33ce[3]);var router=express.Router();router[_0x33ce[6]](_0x33ce[4],controller[_0x33ce[5]]);router[_0x33ce[6]](_0x33ce[7],controller[_0x33ce[8]]);router[_0x33ce[6]](_0x33ce[9],auth[_0x33ce[10]](),controller[_0x33ce[11]]);router[_0x33ce[13]](_0x33ce[4],controller[_0x33ce[12]]);router[_0x33ce[15]](_0x33ce[7],controller[_0x33ce[14]]);router[_0x33ce[16]](_0x33ce[7],controller[_0x33ce[14]]);router[_0x33ce[18]](_0x33ce[7],controller[_0x33ce[17]]);module[_0x33ce[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_chat.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.get('/:id/accept/:uniqueid', auth.isAuthenticated(), controller.accept); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_chat/report_chat.controller.js b/server/api/report_chat/report_chat.controller.js index d3619a2..25acee0 100644 --- a/server/api/report_chat/report_chat.controller.js +++ b/server/api/report_chat/report_chat.controller.js @@ -1 +1,156 @@ -var _0x108f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x64\x35","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x55\x73\x65\x72","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x63\x63\x65\x70\x74","\x2E","\x73\x70\x6C\x69\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x61\x63\x63\x65\x70\x74\x65\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x62\x61\x73\x65\x36\x34","\x75\x73\x65\x72","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x75\x70\x64\x61\x74\x65","\x61\x64\x64\x55\x73\x65\x72","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x64\x65\x73\x74\x72\x6F\x79"];_0x108f[0];var _=require(_0x108f[1]);var md5=require(_0x108f[2]);var ReportChat=require(_0x108f[4])[_0x108f[3]];var ChatRoom=require(_0x108f[4])[_0x108f[5]];var ChatVisitor=require(_0x108f[4])[_0x108f[6]];var Agent=require(_0x108f[4])[_0x108f[7]];var sequelize=require(_0x108f[4])[_0x108f[8]];var Util=require(_0x108f[9]);exports[_0x108f[10]]=function(_0x9ca6x9,_0x9ca6xa,_0x9ca6xb){return ReportChat[_0x108f[17]](Util[_0x108f[16]](_0x9ca6x9[_0x108f[15]]))[_0x108f[14]](function(_0x9ca6xd){_0x9ca6xa[_0x108f[13]](200)[_0x108f[12]](_0x9ca6xd)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};exports[_0x108f[18]]=function(_0x9ca6x9,_0x9ca6xa){return ReportChat[_0x108f[22]](_0x9ca6x9[_0x108f[21]][_0x108f[20]])[_0x108f[14]](function(_0x9ca6xe){if(!_0x9ca6xe){return _0x9ca6xa[_0x108f[19]](404)};return _0x9ca6xa[_0x108f[12]](_0x9ca6xe)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};exports[_0x108f[23]]=function(_0x9ca6x9,_0x9ca6xa){var _0x9ca6xf=_0x9ca6x9[_0x108f[21]][_0x108f[26]][_0x108f[25]](_0x108f[24])[1];var _0x9ca6x10;return ChatRoom[_0x108f[22]](_0x9ca6xf)[_0x108f[14]](function(_0x9ca6x13){_0x9ca6x10=_0x9ca6x13;return _0x9ca6x10[_0x108f[34]](_0x9ca6x9[_0x108f[31]][_0x108f[20]],{individualHooks:true})})[_0x108f[14]](function(){return _0x9ca6x10[_0x108f[33]]({token:md5(JSON[_0x108f[32]]([_0x9ca6x9[_0x108f[31]][_0x108f[20]]])).toString(_0x108f[30])})})[_0x108f[14]](function(){return ReportChat[_0x108f[22]](_0x9ca6x9[_0x108f[21]][_0x108f[20]])})[_0x108f[14]](function(_0x9ca6xe){if(!_0x9ca6xe){return _0x9ca6xa[_0x108f[19]](404)};var _0x9ca6x12=_[_0x108f[28]](_0x9ca6xe,{connectid:_0x9ca6x9[_0x108f[21]][_0x108f[26]]});return _0x9ca6x12[_0x108f[29]]()})[_0x108f[14]](function(){return ChatVisitor[_0x108f[22]](_0x9ca6x10.ChatVisitorId)})[_0x108f[14]](function(_0x9ca6x11){if(!_0x9ca6x11){return _0x9ca6xa[_0x108f[19]](404)};var _0x9ca6x12=_[_0x108f[28]](_0x9ca6x11,{status:_0x108f[27]});return _0x9ca6x12[_0x108f[29]]()})[_0x108f[14]](function(){return _0x9ca6xa[_0x108f[19]](200)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};exports[_0x108f[35]]=function(_0x9ca6x9,_0x9ca6xa){return ReportChat[_0x108f[35]](_0x9ca6x9[_0x108f[36]])[_0x108f[14]](function(_0x9ca6xe){return _0x9ca6xa[_0x108f[13]](201)[_0x108f[12]](_0x9ca6xe)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};exports[_0x108f[33]]=function(_0x9ca6x9,_0x9ca6xa,_0x9ca6xb){if(_0x9ca6x9[_0x108f[36]][_0x108f[20]]){delete _0x9ca6x9[_0x108f[36]][_0x108f[20]]};return ReportChat[_0x108f[22]](_0x9ca6x9[_0x108f[21]][_0x108f[20]])[_0x108f[14]](function(_0x9ca6xe){if(!_0x9ca6xe){return _0x9ca6xa[_0x108f[19]](404)};var _0x9ca6x12=_[_0x108f[28]](_0x9ca6xe,_0x9ca6x9[_0x108f[36]]);return _0x9ca6x12[_0x108f[29]]()[_0x108f[14]](function(){return _0x9ca6xa[_0x108f[13]](200)[_0x108f[12]](_0x9ca6xe)})})[_0x108f[11]](sequelize.ValidationError,function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};exports[_0x108f[37]]=function(_0x9ca6x9,_0x9ca6xa){ReportChat[_0x108f[22]](_0x9ca6x9[_0x108f[21]][_0x108f[20]])[_0x108f[14]](function(_0x9ca6xe){if(!_0x9ca6xe){return _0x9ca6xa[_0x108f[19]](404)};_0x9ca6xe[_0x108f[37]]()[_0x108f[14]](function(){return _0x9ca6xa[_0x108f[19]](204)})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})})[_0x108f[11]](function(_0x9ca6xc){return handleError(_0x9ca6xa,_0x9ca6xc)})};function handleError(_0x9ca6xa,_0x9ca6xc){return _0x9ca6xa[_0x108f[13]](500)[_0x108f[12]](_0x9ca6xc)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var md5 = require('md5'); + +var ReportChat = require('../../models').ReportChat; +var ChatRoom = require('../../models').ChatRoom; +var ChatVisitor = require('../../models').ChatVisitor; +var Agent = require('../../models').User; +var sequelize = require('../../models').sequelize; + +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return ReportChat + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Ge +// Get a single reportChat +exports.show = function(req, res) { + return ReportChat + .findById(req.params.id) + .then(function(reportChat) { + if (!reportChat) { + return res.sendStatus(404); + } + return res.send(reportChat); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single reportMail +exports.accept = function(req, res) { + var _roomid = req.params.uniqueid.split('.')[1]; + var _chatRoom; + + return ChatRoom + .findById(_roomid) + .then(function(chatRoom) { + _chatRoom = chatRoom; + return _chatRoom + .addUser(req.user.id, { + individualHooks: true + }); + }) + .then(function() { + return _chatRoom + .update({ + token: md5(JSON.stringify([req.user.id])).toString('base64') + }) + }) + .then(function() { + return ReportChat + .findById(req.params.id); + }) + .then(function(reportChat) { + if (!reportChat) { + return res.sendStatus(404); + } + var updated = _.merge(reportChat, { + connectid: req.params.uniqueid + }); + return updated.save(); + }) + .then(function() { + return ChatVisitor.findById(_chatRoom.ChatVisitorId); + }) + .then(function(chatVisitor) { + if (!chatVisitor) { + return res.sendStatus(404); + } + var updated = _.merge(chatVisitor, { + status: 'accepted' + }); + return updated.save(); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new reportChat in the DB. +exports.create = function(req, res) { + return ReportChat + .create(req.body) + .then(function(reportChat) { + return res.status(201).send(reportChat); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing reportChat in the DB. +exports.update = function(req, res, next) { + if (req.body.id) { + delete req.body.id; + } + + return ReportChat + .findById(req.params.id) + .then(function(reportChat) { + if (!reportChat) { + return res.sendStatus(404); + } + var updated = _.merge(reportChat, req.body); + return updated + .save() + .then(function() { + return res.status(200).send(reportChat); + }); + }) + .catch(sequelize.ValidationError, function(err) { + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a reportChat from the DB. +exports.destroy = function(req, res) { + ReportChat + .findById(req.params.id) + .then(function(reportChat) { + if (!reportChat) { + return res.sendStatus(404); + } + reportChat.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_chat/report_chat.socket.js b/server/api/report_chat/report_chat.socket.js index ccba5b3..dd9728d 100644 --- a/server/api/report_chat/report_chat.socket.js +++ b/server/api/report_chat/report_chat.socket.js @@ -1 +1,35 @@ -var _0x7ccb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x61\x67\x65\x6E\x74\x6E\x61\x6D\x65","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x3A\x75\x70\x64\x61\x74\x65","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7ccb[0];var ReportChat=require(_0x7ccb[2])[_0x7ccb[1]];exports[_0x7ccb[3]]=function(_0x6341x2){ReportChat[_0x7ccb[4]](function(_0x6341x3){onSave(_0x6341x2,_0x6341x3)});ReportChat[_0x7ccb[5]](function(_0x6341x3){onUpdate(_0x6341x2,_0x6341x3)});ReportChat[_0x7ccb[6]](function(_0x6341x3){onRemove(_0x6341x2,_0x6341x3)})};function onSave(_0x6341x2,_0x6341x3,_0x6341x5){if(_0x6341x2[_0x7ccb[7]]===_0x6341x3[_0x7ccb[8]]||_0x6341x2[_0x7ccb[9]]===_0x7ccb[10]){_0x6341x2[_0x7ccb[12]](_0x7ccb[11],_0x6341x3)}}function onUpdate(_0x6341x2,_0x6341x3,_0x6341x5){if(_0x6341x2[_0x7ccb[7]]===_0x6341x3[_0x7ccb[8]]||_0x6341x2[_0x7ccb[9]]===_0x7ccb[10]){_0x6341x2[_0x7ccb[12]](_0x7ccb[13],_0x6341x3)}}function onRemove(_0x6341x2,_0x6341x3,_0x6341x5){_0x6341x2[_0x7ccb[12]](_0x7ccb[14],_0x6341x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportChat = require('../../models').ReportChat; + +exports.register = function(socket) { + ReportChat.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportChat.afterUpdate(function(doc) { + onUpdate(socket, doc); + }); + ReportChat.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (socket.name === doc.agentname || socket.role === 'admin') { + socket.emit('report_chat:save', doc); + } +} + +function onUpdate(socket, doc, cb) { + if (socket.name === doc.agentname || socket.role === 'admin') { + socket.emit('report_chat:update', doc); + } +} + +function onRemove(socket, doc, cb) { + socket.emit('report_chat:remove', doc); +} diff --git a/server/api/report_chat_session/index.js b/server/api/report_chat_session/index.js index 754b3e7..030bd33 100644 --- a/server/api/report_chat_session/index.js +++ b/server/api/report_chat_session/index.js @@ -1 +1,16 @@ -var _0x2ef1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x2ef1[0];var express=require(_0x2ef1[1]);var controller=require(_0x2ef1[2]);var router=express.Router();router[_0x2ef1[5]](_0x2ef1[3],controller[_0x2ef1[4]]);router[_0x2ef1[5]](_0x2ef1[6],controller[_0x2ef1[7]]);router[_0x2ef1[5]](_0x2ef1[8],controller[_0x2ef1[9]]);router[_0x2ef1[11]](_0x2ef1[3],controller[_0x2ef1[10]]);router[_0x2ef1[13]](_0x2ef1[8],controller[_0x2ef1[12]]);router[_0x2ef1[14]](_0x2ef1[8],controller[_0x2ef1[12]]);router[_0x2ef1[16]](_0x2ef1[8],controller[_0x2ef1[15]]);module[_0x2ef1[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_chat_session.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/describe', controller.describe); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_chat_session/report_chat_session.controller.js b/server/api/report_chat_session/report_chat_session.controller.js index 3fafc21..c3cd755 100644 --- a/server/api/report_chat_session/report_chat_session.controller.js +++ b/server/api/report_chat_session/report_chat_session.controller.js @@ -1 +1,107 @@ -var _0x6eba=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x6eba[0];var _=require(_0x6eba[1]);var ReportChatSession=require(_0x6eba[3])[_0x6eba[2]];var ReportChatSessionHistory=require(_0x6eba[3])[_0x6eba[5]][_0x6eba[4]];var Util=require(_0x6eba[6]);exports[_0x6eba[7]]=function(_0x6d6fx5,_0x6d6fx6,_0x6d6fx7){return ReportChatSession[_0x6eba[14]](Util[_0x6eba[13]](_0x6d6fx5[_0x6eba[12]]))[_0x6eba[11]](function(_0x6d6fx9){_0x6d6fx6[_0x6eba[10]](200)[_0x6eba[9]](_0x6d6fx9)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};exports[_0x6eba[15]]=function(_0x6d6fx5,_0x6d6fx6){return ReportChatSessionHistory[_0x6eba[15]]()[_0x6eba[11]](function(_0x6d6fxa){return _0x6d6fx6[_0x6eba[10]](200)[_0x6eba[9]](_0x6d6fxa)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};exports[_0x6eba[16]]=function(_0x6d6fx5,_0x6d6fx6){return ReportChatSession[_0x6eba[20]](_0x6d6fx5[_0x6eba[19]][_0x6eba[18]])[_0x6eba[11]](function(_0x6d6fxb){if(!_0x6d6fxb){return _0x6d6fx6[_0x6eba[17]](404)};return _0x6d6fx6[_0x6eba[9]](_0x6d6fxb)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};exports[_0x6eba[21]]=function(_0x6d6fx5,_0x6d6fx6){return ReportChatSession[_0x6eba[21]](_0x6d6fx5[_0x6eba[22]])[_0x6eba[11]](function(_0x6d6fxb){return _0x6d6fx6[_0x6eba[10]](201)[_0x6eba[9]](_0x6d6fxb)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};exports[_0x6eba[23]]=function(_0x6d6fx5,_0x6d6fx6){if(_0x6d6fx5[_0x6eba[22]][_0x6eba[18]]){delete _0x6d6fx5[_0x6eba[22]][_0x6eba[18]]};return ReportChatSession[_0x6eba[20]](_0x6d6fx5[_0x6eba[19]][_0x6eba[18]])[_0x6eba[11]](function(_0x6d6fxb){if(!_0x6d6fxb){return _0x6d6fx6[_0x6eba[17]](404)};var _0x6d6fxc=_[_0x6eba[24]](_0x6d6fxb,_0x6d6fx5[_0x6eba[22]]);_0x6d6fxc[_0x6eba[25]]()[_0x6eba[11]](function(){return _0x6d6fx6[_0x6eba[10]](200)[_0x6eba[9]](_0x6d6fxb)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};exports[_0x6eba[26]]=function(_0x6d6fx5,_0x6d6fx6){return ReportChatSession[_0x6eba[20]](_0x6d6fx5[_0x6eba[19]][_0x6eba[18]])[_0x6eba[11]](function(_0x6d6fxb){if(!_0x6d6fxb){return _0x6d6fx6[_0x6eba[17]](404)};_0x6d6fxb[_0x6eba[26]]()[_0x6eba[11]](function(){return _0x6d6fx6[_0x6eba[17]](204)})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})})[_0x6eba[8]](function(_0x6d6fx8){return handleError(_0x6d6fx6,_0x6d6fx8)})};function handleError(_0x6d6fx6,_0x6d6fx8){return _0x6d6fx6[_0x6eba[10]](500)[_0x6eba[9]](_0x6d6fx8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportChatSession = require('../../models').ReportChatSession; +var ReportChatSessionHistory = require('../../models').history.ReportChatSessionHistory; + +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return ReportChatSession + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Get list of fields +exports.describe = function(req, res) { + return ReportChatSessionHistory + .describe() + .then(function(fields) { + return res.status(200).send(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single report_chat_session +exports.show = function(req, res) { + return ReportChatSession + .findById(req.params.id) + .then(function(report_chat_session) { + if (!report_chat_session) { + return res.sendStatus(404); + } + return res.send(report_chat_session); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new report_chat_session in the DB. +exports.create = function(req, res) { + return ReportChatSession + .create(req.body) + .then(function(report_chat_session) { + return res.status(201).send(report_chat_session); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing report_chat_session in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ReportChatSession + .findById(req.params.id) + .then(function(report_chat_session) { + if (!report_chat_session) { + return res.sendStatus(404); + } + var updated = _.merge(report_chat_session, req.body); + updated.save() + .then(function() { + return res.status(200).send(report_chat_session); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a report_chat_session from the DB. +exports.destroy = function(req, res) { + return ReportChatSession + .findById(req.params.id) + .then(function(report_chat_session) { + if (!report_chat_session) { + return res.sendStatus(404); + } + report_chat_session.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_chat_session/report_chat_session.socket.js b/server/api/report_chat_session/report_chat_session.socket.js index e30b6b9..a378e10 100644 --- a/server/api/report_chat_session/report_chat_session.socket.js +++ b/server/api/report_chat_session/report_chat_session.socket.js @@ -1 +1,27 @@ -var _0xcf95=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xcf95[0];var ReportChatSession=require(_0xcf95[2])[_0xcf95[1]];exports[_0xcf95[3]]=function(_0x2397x2){ReportChatSession[_0xcf95[4]](function(_0x2397x3){onSave(_0x2397x2,_0x2397x3)});ReportChatSession[_0xcf95[5]](function(_0x2397x3){onSave(_0x2397x2,_0x2397x3)});ReportChatSession[_0xcf95[6]](function(_0x2397x3){onRemove(_0x2397x2,_0x2397x3)})};function onSave(_0x2397x2,_0x2397x3,_0x2397x5){_0x2397x2[_0xcf95[8]](_0xcf95[7],_0x2397x3)}function onRemove(_0x2397x2,_0x2397x3,_0x2397x5){_0x2397x2[_0xcf95[8]](_0xcf95[9],_0x2397x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportChatSession = require('../../models').ReportChatSession; + +exports.register = function(socket) { + ReportChatSession.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportChatSession.afterUpdate(function(doc) { + onSave(socket, doc); + }); + ReportChatSession.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('report_chat_session:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('report_chat_session:remove', doc); +} diff --git a/server/api/report_integration/index.js b/server/api/report_integration/index.js index 017c000..451980f 100644 --- a/server/api/report_integration/index.js +++ b/server/api/report_integration/index.js @@ -1 +1,16 @@ -var _0x7918=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x7918[0];var express=require(_0x7918[1]);var controller=require(_0x7918[2]);var router=express.Router();router[_0x7918[5]](_0x7918[3],controller[_0x7918[4]]);router[_0x7918[5]](_0x7918[6],controller[_0x7918[7]]);router[_0x7918[5]](_0x7918[8],controller[_0x7918[9]]);router[_0x7918[11]](_0x7918[3],controller[_0x7918[10]]);router[_0x7918[13]](_0x7918[8],controller[_0x7918[12]]);router[_0x7918[14]](_0x7918[8],controller[_0x7918[12]]);router[_0x7918[16]](_0x7918[8],controller[_0x7918[15]]);module[_0x7918[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_integration.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/describe', controller.describe); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_integration/report_integration.controller.js b/server/api/report_integration/report_integration.controller.js index a373b92..6fc6afb 100644 --- a/server/api/report_integration/report_integration.controller.js +++ b/server/api/report_integration/report_integration.controller.js @@ -1 +1,106 @@ -var _0xd501=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xd501[0];var _=require(_0xd501[1]);var ReportIntegration=require(_0xd501[3])[_0xd501[2]];var ReportIntegrationHistory=require(_0xd501[3])[_0xd501[5]][_0xd501[4]];exports[_0xd501[6]]=function(_0x997cx4,_0x997cx5){ReportIntegration[_0xd501[11]]()[_0xd501[10]](function(_0x997cx7){return _0x997cx5[_0xd501[9]](200)[_0xd501[8]](_0x997cx7)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};exports[_0xd501[12]]=function(_0x997cx4,_0x997cx5){ReportIntegrationHistory[_0xd501[12]]()[_0xd501[10]](function(_0x997cx8){return _0x997cx5[_0xd501[9]](200)[_0xd501[8]](_0x997cx8)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};exports[_0xd501[13]]=function(_0x997cx4,_0x997cx5){ReportIntegration[_0xd501[17]](_0x997cx4[_0xd501[16]][_0xd501[15]])[_0xd501[10]](function(_0x997cx9){if(!_0x997cx9){return _0x997cx5[_0xd501[14]](404)};return _0x997cx5[_0xd501[8]](_0x997cx9)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};exports[_0xd501[18]]=function(_0x997cx4,_0x997cx5){ReportIntegration[_0xd501[18]](_0x997cx4[_0xd501[19]])[_0xd501[10]](function(_0x997cx9){return _0x997cx5[_0xd501[9]](201)[_0xd501[8]](_0x997cx9)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};exports[_0xd501[20]]=function(_0x997cx4,_0x997cx5){if(_0x997cx4[_0xd501[19]][_0xd501[15]]){delete _0x997cx4[_0xd501[19]][_0xd501[15]]};ReportIntegration[_0xd501[17]](_0x997cx4[_0xd501[16]][_0xd501[15]])[_0xd501[10]](function(_0x997cx9){if(!_0x997cx9){return _0x997cx5[_0xd501[14]](404)};var _0x997cxa=_[_0xd501[21]](_0x997cx9,_0x997cx4[_0xd501[19]]);_0x997cxa[_0xd501[22]]()[_0xd501[10]](function(){return _0x997cx5[_0xd501[9]](200)[_0xd501[8]](_0x997cx9)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};exports[_0xd501[23]]=function(_0x997cx4,_0x997cx5){ReportIntegration[_0xd501[17]](_0x997cx4[_0xd501[16]][_0xd501[15]])[_0xd501[10]](function(_0x997cx9){if(!_0x997cx9){return _0x997cx5[_0xd501[14]](404)};_0x997cx9[_0xd501[23]]()[_0xd501[10]](function(){return _0x997cx5[_0xd501[14]](204)})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})})[_0xd501[7]](function(_0x997cx6){return handleError(_0x997cx5,_0x997cx6)})};function handleError(_0x997cx5,_0x997cx6){return _0x997cx5[_0xd501[9]](500)[_0xd501[8]](_0x997cx6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportIntegration = require('../../models').ReportIntegration; +var ReportIntegrationHistory = require('../../models').history.ReportIntegrationHistory; + +// Get list of report_integrations +exports.index = function(req, res) { + ReportIntegration + .findAll() + .then(function(report_integrations) { + return res.status(200).send(report_integrations); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of fields +exports.describe = function(req, res) { + ReportIntegrationHistory + .describe() + .then(function(fields) { + return res.status(200).send(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single report_integration +exports.show = function(req, res) { + ReportIntegration + .findById(req.params.id) + .then(function(report_integration) { + if (!report_integration) { + return res.sendStatus(404); + } + return res.send(report_integration); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new report_integration in the DB. +exports.create = function(req, res) { + ReportIntegration + .create(req.body) + .then(function(report_integration) { + return res.status(201).send(report_integration); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing report_integration in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + ReportIntegration + .findById(req.params.id) + .then(function(report_integration) { + if (!report_integration) { + return res.sendStatus(404); + } + var updated = _.merge(report_integration, req.body); + updated.save() + .then(function() { + return res.status(200).send(report_integration); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a report_integration from the DB. +exports.destroy = function(req, res) { + ReportIntegration + .findById(req.params.id) + .then(function(report_integration) { + if (!report_integration) { + return res.sendStatus(404); + } + report_integration.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_integration/report_integration.socket.js b/server/api/report_integration/report_integration.socket.js index d26b79b..2bd59ab 100644 --- a/server/api/report_integration/report_integration.socket.js +++ b/server/api/report_integration/report_integration.socket.js @@ -1 +1,23 @@ -var _0x3d0a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x6F\x63\x6B\x65\x74\x20\x6E\x61\x6D\x65\x20\x69\x73\x20","\x6E\x61\x6D\x65","\x6C\x6F\x67","\x64\x6F\x63\x20\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65\x20\x69\x73\x20","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x65\x6D\x69\x74\x74\x69\x6E\x67","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x25\x73","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x66\x6F\x72\x6D\x61\x74","\x65\x6D\x69\x74"];_0x3d0a[0];var util=require(_0x3d0a[1]);var ReportIntegration=require(_0x3d0a[3])[_0x3d0a[2]];exports[_0x3d0a[4]]=function(_0x320cx3){ReportIntegration[_0x3d0a[5]](function(_0x320cx4){onSave(_0x320cx3,_0x320cx4)})};function onSave(_0x320cx3,_0x320cx4,_0x320cx6){console[_0x3d0a[8]](_0x3d0a[6],_0x320cx3[_0x3d0a[7]]);console[_0x3d0a[8]](_0x3d0a[9],_0x320cx4[_0x3d0a[10]]);if(_0x320cx3[_0x3d0a[7]]===_0x320cx4[_0x3d0a[10]]){console[_0x3d0a[8]](_0x3d0a[11]);_0x320cx3[_0x3d0a[15]](util[_0x3d0a[14]](_0x3d0a[12],_0x320cx4[_0x3d0a[13]]),_0x320cx4)}} \ No newline at end of file +/** + * Broadcast integrations update when the model changes + */ + +'use strict'; + +var util = require('util'); +var ReportIntegration = require('../../models').ReportIntegration; + +exports.register = function(socket) { + ReportIntegration.afterCreate(function(doc) { + onSave(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + console.log('socket name is ', socket.name); + console.log('doc membername is ', doc.membername); + if (socket.name === doc.membername) { + console.log('emitting'); + socket.emit(util.format('report_integration:%s', doc.integration), doc); + } +} diff --git a/server/api/report_mail/index.js b/server/api/report_mail/index.js index 447d350..2aadc12 100644 --- a/server/api/report_mail/index.js +++ b/server/api/report_mail/index.js @@ -1 +1,17 @@ -var _0x5b81=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x63\x63\x65\x70\x74\x2F\x3A\x75\x6E\x69\x71\x75\x65\x69\x64","\x61\x63\x63\x65\x70\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x5b81[0];var express=require(_0x5b81[1]);var controller=require(_0x5b81[2]);var auth=require(_0x5b81[3]);var router=express.Router();router[_0x5b81[7]](_0x5b81[4],auth[_0x5b81[5]](),controller[_0x5b81[6]]);router[_0x5b81[7]](_0x5b81[8],auth[_0x5b81[5]](),controller[_0x5b81[9]]);router[_0x5b81[7]](_0x5b81[10],auth[_0x5b81[5]](),controller[_0x5b81[11]]);router[_0x5b81[13]](_0x5b81[4],auth[_0x5b81[5]](),controller[_0x5b81[12]]);router[_0x5b81[15]](_0x5b81[8],auth[_0x5b81[5]](),controller[_0x5b81[14]]);router[_0x5b81[16]](_0x5b81[8],auth[_0x5b81[5]](),controller[_0x5b81[14]]);router[_0x5b81[18]](_0x5b81[8],auth[_0x5b81[5]](),controller[_0x5b81[17]]);module[_0x5b81[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_mail.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/accept/:uniqueid', auth.isAuthenticated(), controller.accept); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/report_mail/report_mail.controller.js b/server/api/report_mail/report_mail.controller.js index c4b80cb..9477b57 100644 --- a/server/api/report_mail/report_mail.controller.js +++ b/server/api/report_mail/report_mail.controller.js @@ -1 +1,140 @@ -var _0x6b59=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x63\x63\x65\x70\x74","\x2E","\x73\x70\x6C\x69\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x43\x4C\x4F\x53\x45\x44","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x73","\x75\x73\x65\x72","\x6D\x61\x69\x6C\x43\x61\x70\x61\x63\x69\x74\x79","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x6b59[0];var _=require(_0x6b59[1]);var ReportMail=require(_0x6b59[3])[_0x6b59[2]];var Agent=require(_0x6b59[3])[_0x6b59[4]];var sequelize=require(_0x6b59[3])[_0x6b59[5]];var Util=require(_0x6b59[6]);exports[_0x6b59[7]]=function(_0xc2bdx6,_0xc2bdx7,_0xc2bdx8){return ReportMail[_0x6b59[14]](Util[_0x6b59[13]](_0xc2bdx6[_0x6b59[12]]))[_0x6b59[11]](function(_0xc2bdxa){_0xc2bdx7[_0x6b59[10]](200)[_0x6b59[9]](_0xc2bdxa)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};exports[_0x6b59[15]]=function(_0xc2bdx6,_0xc2bdx7){return ReportMail[_0x6b59[19]](_0xc2bdx6[_0x6b59[18]][_0x6b59[17]])[_0x6b59[11]](function(_0xc2bdxb){if(!_0xc2bdxb){return _0xc2bdx7[_0x6b59[16]](404)};return _0xc2bdx7[_0x6b59[9]](_0xc2bdxb)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};exports[_0x6b59[20]]=function(_0xc2bdx6,_0xc2bdx7){var _0xc2bdxc;var _0xc2bdxd=_0xc2bdx6[_0x6b59[18]][_0x6b59[23]][_0x6b59[22]](_0x6b59[21])[1];return Agent[_0x6b59[19]](_0xc2bdx6[_0x6b59[28]][_0x6b59[17]],{attributes:[_0x6b59[17],_0x6b59[29]]})[_0x6b59[11]](function(_0xc2bdx10){_0xc2bdxc=_0xc2bdx10;return _0xc2bdx10[_0x6b59[27]]({where:{status:{$ne:_0x6b59[26]},id:{$ne:_0xc2bdxd}},attributes:[_0x6b59[17]]})})[_0x6b59[11]](function(_0xc2bdxf){return ReportMail[_0x6b59[19]](_0xc2bdx6[_0x6b59[18]][_0x6b59[17]])})[_0x6b59[11]](function(_0xc2bdxb){if(!_0xc2bdxb){return _0xc2bdx7[_0x6b59[16]](404)};var _0xc2bdxe=_[_0x6b59[24]](_0xc2bdxb,{connectid:_0xc2bdx6[_0x6b59[18]][_0x6b59[23]]});return _0xc2bdxe[_0x6b59[25]]()})[_0x6b59[11]](function(){return _0xc2bdx7[_0x6b59[16]](200)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};exports[_0x6b59[30]]=function(_0xc2bdx6,_0xc2bdx7){return ReportMail[_0x6b59[30]](_0xc2bdx6[_0x6b59[31]])[_0x6b59[11]](function(_0xc2bdxb){return _0xc2bdx7[_0x6b59[10]](201)[_0x6b59[9]](_0xc2bdxb)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};exports[_0x6b59[32]]=function(_0xc2bdx6,_0xc2bdx7){if(_0xc2bdx6[_0x6b59[31]][_0x6b59[17]]){delete _0xc2bdx6[_0x6b59[31]][_0x6b59[17]]};return ReportMail[_0x6b59[19]](_0xc2bdx6[_0x6b59[18]][_0x6b59[17]])[_0x6b59[11]](function(_0xc2bdxb){if(!_0xc2bdxb){return _0xc2bdx7[_0x6b59[16]](404)};var _0xc2bdxe=_[_0x6b59[24]](_0xc2bdxb,_0xc2bdx6[_0x6b59[31]]);return _0xc2bdxe[_0x6b59[25]]()})[_0x6b59[11]](function(_0xc2bdxb){return _0xc2bdx7[_0x6b59[10]](200)[_0x6b59[9]](_0xc2bdxb)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};exports[_0x6b59[33]]=function(_0xc2bdx6,_0xc2bdx7){return ReportMail[_0x6b59[19]](_0xc2bdx6[_0x6b59[18]][_0x6b59[17]])[_0x6b59[11]](function(_0xc2bdxb){if(!_0xc2bdxb){return _0xc2bdx7[_0x6b59[16]](404)};return _0xc2bdxb[_0x6b59[33]]()})[_0x6b59[11]](function(){return _0xc2bdx7[_0x6b59[16]](204)})[_0x6b59[8]](function(_0xc2bdx9){return handleError(_0xc2bdx7,_0xc2bdx9)})};function handleError(_0xc2bdx7,_0xc2bdx9){return _0xc2bdx7[_0x6b59[10]](500)[_0x6b59[9]](_0xc2bdx9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportMail = require('../../models').ReportMail; +var Agent = require('../../models').User; +var sequelize = require('../../models').sequelize; + +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return ReportMail + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Get a single reportMail +exports.show = function(req, res) { + return ReportMail + .findById(req.params.id) + .then(function(reportMail) { + if (!reportMail) { + return res.sendStatus(404); + } + return res.send(reportMail); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single reportMail +exports.accept = function(req, res) { + var _agent; + var _roomid = req.params.uniqueid.split('.')[1]; + + return Agent + .findById(req.user.id, { + attributes: ['id', 'mailCapacity'] + }) + .then(function(agent) { + _agent = agent; + return agent + .getMailRooms({ + where: { + status: { + $ne: 'CLOSED' + }, + id: { + $ne: _roomid + } + }, + attributes: ['id'] + }); + }) + .then(function(mailRooms) { + return ReportMail + .findById(req.params.id); + }) + .then(function(reportMail) { + if (!reportMail) { + return res.sendStatus(404); + } + + var updated = _.merge(reportMail, { + connectid: req.params.uniqueid + }); + + return updated + .save(); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new reportMail in the DB. +exports.create = function(req, res) { + return ReportMail + .create(req.body) + .then(function(reportMail) { + return res.status(201).send(reportMail); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing reportMail in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ReportMail + .findById(req.params.id) + .then(function(reportMail) { + if (!reportMail) { + return res.sendStatus(404); + } + var updated = _.merge(reportMail, req.body); + return updated + .save(); + }) + .then(function(reportMail) { + return res.status(200).send(reportMail); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a reportMail from the DB. +exports.destroy = function(req, res) { + return ReportMail + .findById(req.params.id) + .then(function(reportMail) { + if (!reportMail) { + return res.sendStatus(404); + } + return reportMail + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_mail/report_mail.socket.js b/server/api/report_mail/report_mail.socket.js index 61c6638..1fec069 100644 --- a/server/api/report_mail/report_mail.socket.js +++ b/server/api/report_mail/report_mail.socket.js @@ -1 +1,35 @@ -var _0x1e9e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x3A\x75\x70\x64\x61\x74\x65","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x3A\x72\x65\x6D\x6F\x76\x65"];_0x1e9e[0];var ReportMail=require(_0x1e9e[2])[_0x1e9e[1]];exports[_0x1e9e[3]]=function(_0x4540x2){ReportMail[_0x1e9e[4]](function(_0x4540x3){onSave(_0x4540x2,_0x4540x3)});ReportMail[_0x1e9e[5]](function(_0x4540x3){onUpdate(_0x4540x2,_0x4540x3)});ReportMail[_0x1e9e[6]](function(_0x4540x3){onRemove(_0x4540x2,_0x4540x3)})};function onSave(_0x4540x2,_0x4540x3,_0x4540x5){if(_0x4540x2[_0x1e9e[7]]===_0x4540x3[_0x1e9e[8]]||_0x4540x2[_0x1e9e[9]]===_0x1e9e[10]){_0x4540x2[_0x1e9e[12]](_0x1e9e[11],_0x4540x3)}}function onUpdate(_0x4540x2,_0x4540x3,_0x4540x5){if(_0x4540x2[_0x1e9e[7]]===_0x4540x3[_0x1e9e[8]]||_0x4540x2[_0x1e9e[9]]===_0x1e9e[10]){_0x4540x2[_0x1e9e[12]](_0x1e9e[13],_0x4540x3)}}function onRemove(_0x4540x2,_0x4540x3,_0x4540x5){_0x4540x2[_0x1e9e[12]](_0x1e9e[14],_0x4540x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportMail = require('../../models').ReportMail; + +exports.register = function(socket) { + ReportMail.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportMail.afterUpdate(function(doc) { + onUpdate(socket, doc); + }); + ReportMail.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (socket.name === doc.membername || socket.role === 'admin') { + socket.emit('report_mail:save', doc); + } +} + +function onUpdate(socket, doc, cb) { + if (socket.name === doc.membername || socket.role === 'admin') { + socket.emit('report_mail:update', doc); + } +} + +function onRemove(socket, doc, cb) { + socket.emit('report_mail:remove', doc); +} diff --git a/server/api/report_mail_session/index.js b/server/api/report_mail_session/index.js index ab3af32..e63d04d 100644 --- a/server/api/report_mail_session/index.js +++ b/server/api/report_mail_session/index.js @@ -1 +1,16 @@ -var _0xcd53=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xcd53[0];var express=require(_0xcd53[1]);var controller=require(_0xcd53[2]);var router=express.Router();router[_0xcd53[5]](_0xcd53[3],controller[_0xcd53[4]]);router[_0xcd53[5]](_0xcd53[6],controller[_0xcd53[7]]);router[_0xcd53[5]](_0xcd53[8],controller[_0xcd53[9]]);router[_0xcd53[11]](_0xcd53[3],controller[_0xcd53[10]]);router[_0xcd53[13]](_0xcd53[8],controller[_0xcd53[12]]);router[_0xcd53[14]](_0xcd53[8],controller[_0xcd53[12]]);router[_0xcd53[16]](_0xcd53[8],controller[_0xcd53[15]]);module[_0xcd53[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_mail_session.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/describe', controller.describe); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_mail_session/report_mail_session.controller.js b/server/api/report_mail_session/report_mail_session.controller.js index 3df44d2..a964ba2 100644 --- a/server/api/report_mail_session/report_mail_session.controller.js +++ b/server/api/report_mail_session/report_mail_session.controller.js @@ -1 +1,104 @@ -var _0x63fb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x63fb[0];var _=require(_0x63fb[1]);var ReportMailSession=require(_0x63fb[3])[_0x63fb[2]];var ReportMailSessionHistory=require(_0x63fb[3])[_0x63fb[5]][_0x63fb[4]];var Util=require(_0x63fb[6]);exports[_0x63fb[7]]=function(_0xdafbx5,_0xdafbx6,_0xdafbx7){return ReportMailSession[_0x63fb[14]](Util[_0x63fb[13]](_0xdafbx5[_0x63fb[12]]))[_0x63fb[11]](function(_0xdafbx9){_0xdafbx6[_0x63fb[10]](200)[_0x63fb[9]](_0xdafbx9)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};exports[_0x63fb[15]]=function(_0xdafbx5,_0xdafbx6){return ReportMailSessionHistory[_0x63fb[15]]()[_0x63fb[11]](function(_0xdafbxa){return _0xdafbx6[_0x63fb[10]](200)[_0x63fb[9]](_0xdafbxa)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};exports[_0x63fb[16]]=function(_0xdafbx5,_0xdafbx6){return ReportMailSession[_0x63fb[20]](_0xdafbx5[_0x63fb[19]][_0x63fb[18]])[_0x63fb[11]](function(_0xdafbxb){if(!_0xdafbxb){return _0xdafbx6[_0x63fb[17]](404)};return _0xdafbx6[_0x63fb[9]](_0xdafbxb)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};exports[_0x63fb[21]]=function(_0xdafbx5,_0xdafbx6){return ReportMailSession[_0x63fb[21]](_0xdafbx5[_0x63fb[22]])[_0x63fb[11]](function(_0xdafbxb){return _0xdafbx6[_0x63fb[10]](201)[_0x63fb[9]](_0xdafbxb)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};exports[_0x63fb[23]]=function(_0xdafbx5,_0xdafbx6){if(_0xdafbx5[_0x63fb[22]][_0x63fb[18]]){delete _0xdafbx5[_0x63fb[22]][_0x63fb[18]]};return ReportMailSession[_0x63fb[20]](_0xdafbx5[_0x63fb[19]][_0x63fb[18]])[_0x63fb[11]](function(_0xdafbxb){if(!_0xdafbxb){return _0xdafbx6[_0x63fb[17]](404)};var _0xdafbxc=_[_0x63fb[24]](_0xdafbxb,_0xdafbx5[_0x63fb[22]]);return _0xdafbxc[_0x63fb[25]]()})[_0x63fb[11]](function(_0xdafbxb){return _0xdafbx6[_0x63fb[10]](200)[_0x63fb[9]](_0xdafbxb)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};exports[_0x63fb[26]]=function(_0xdafbx5,_0xdafbx6){return ReportMailSession[_0x63fb[20]](_0xdafbx5[_0x63fb[19]][_0x63fb[18]])[_0x63fb[11]](function(_0xdafbxb){if(!_0xdafbxb){return _0xdafbx6[_0x63fb[17]](404)};return _0xdafbxb[_0x63fb[26]]()})[_0x63fb[11]](function(){return _0xdafbx6[_0x63fb[17]](204)})[_0x63fb[8]](function(_0xdafbx8){return handleError(_0xdafbx6,_0xdafbx8)})};function handleError(_0xdafbx6,_0xdafbx8){return _0xdafbx6[_0x63fb[10]](500)[_0x63fb[9]](_0xdafbx8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportMailSession = require('../../models').ReportMailSession; +var ReportMailSessionHistory = require('../../models').history.ReportMailSessionHistory; + +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return ReportMailSession + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of fields +exports.describe = function(req, res) { + return ReportMailSessionHistory + .describe() + .then(function(fields) { + return res.status(200).send(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single reportMailSession +exports.show = function(req, res) { + return ReportMailSession + .findById(req.params.id) + .then(function(reportMailSession) { + if (!reportMailSession) { + return res.sendStatus(404); + } + return res.send(reportMailSession); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new reportMailSession in the DB. +exports.create = function(req, res) { + return ReportMailSession + .create(req.body) + .then(function(reportMailSession) { + return res.status(201).send(reportMailSession); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing reportMailSession in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ReportMailSession + .findById(req.params.id) + .then(function(reportMailSession) { + if (!reportMailSession) { + return res.sendStatus(404); + } + var updated = _.merge(reportMailSession, req.body); + return updated + .save(); + }) + .then(function(reportMailSession) { + return res.status(200).send(reportMailSession); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a reportMailSession from the DB. +exports.destroy = function(req, res) { + return ReportMailSession + .findById(req.params.id) + .then(function(reportMailSession) { + if (!reportMailSession) { + return res.sendStatus(404); + } + return reportMailSession + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_mail_session/report_mail_session.socket.js b/server/api/report_mail_session/report_mail_session.socket.js index 1c44a64..6489a0d 100644 --- a/server/api/report_mail_session/report_mail_session.socket.js +++ b/server/api/report_mail_session/report_mail_session.socket.js @@ -1 +1,27 @@ -var _0x45d1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x45d1[0];var ReportMailSession=require(_0x45d1[2])[_0x45d1[1]];exports[_0x45d1[3]]=function(_0x28c3x2){ReportMailSession[_0x45d1[4]](function(_0x28c3x3){onSave(_0x28c3x2,_0x28c3x3)});ReportMailSession[_0x45d1[5]](function(_0x28c3x3){onSave(_0x28c3x2,_0x28c3x3)});ReportMailSession[_0x45d1[6]](function(_0x28c3x3){onRemove(_0x28c3x2,_0x28c3x3)})};function onSave(_0x28c3x2,_0x28c3x3,_0x28c3x5){_0x28c3x2[_0x45d1[8]](_0x45d1[7],_0x28c3x3)}function onRemove(_0x28c3x2,_0x28c3x3,_0x28c3x5){_0x28c3x2[_0x45d1[8]](_0x45d1[9],_0x28c3x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportMailSession = require('../../models').ReportMailSession; + +exports.register = function(socket) { + ReportMailSession.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportMailSession.afterUpdate(function(doc) { + onSave(socket, doc); + }); + ReportMailSession.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('report_mail_session:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('report_mail_session:remove', doc); +} diff --git a/server/api/report_queue/index.js b/server/api/report_queue/index.js index 0aa96fb..f92d5aa 100644 --- a/server/api/report_queue/index.js +++ b/server/api/report_queue/index.js @@ -1 +1,16 @@ -var _0x91b2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x65\x73\x63\x72\x69\x62\x65","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x91b2[0];var express=require(_0x91b2[1]);var controller=require(_0x91b2[2]);var router=express.Router();router[_0x91b2[5]](_0x91b2[3],controller[_0x91b2[4]]);router[_0x91b2[5]](_0x91b2[6],controller[_0x91b2[7]]);router[_0x91b2[5]](_0x91b2[8],controller[_0x91b2[9]]);router[_0x91b2[11]](_0x91b2[3],controller[_0x91b2[10]]);router[_0x91b2[13]](_0x91b2[8],controller[_0x91b2[12]]);router[_0x91b2[14]](_0x91b2[8],controller[_0x91b2[12]]);router[_0x91b2[16]](_0x91b2[8],controller[_0x91b2[15]]);module[_0x91b2[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_queue.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/describe', controller.describe); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/report_queue/report_queue.controller.js b/server/api/report_queue/report_queue.controller.js index 06985b7..7369229 100644 --- a/server/api/report_queue/report_queue.controller.js +++ b/server/api/report_queue/report_queue.controller.js @@ -1 +1,103 @@ -var _0xdba3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x65\x72\x72","\x65\x72\x72\x6F\x72","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xdba3[0];var _=require(_0xdba3[1]);var ReportQueue=require(_0xdba3[3])[_0xdba3[2]];var ReportQueueHistory=require(_0xdba3[3])[_0xdba3[5]][_0xdba3[4]];exports[_0xdba3[6]]=function(_0x7906x4,_0x7906x5){return ReportQueue[_0xdba3[11]]()[_0xdba3[10]](function(_0x7906x7){return _0x7906x5[_0xdba3[9]](200)[_0xdba3[8]](_0x7906x7)})[_0xdba3[7]](function(_0x7906x6){return handleError(_0x7906x5,_0x7906x6)})};exports[_0xdba3[12]]=function(_0x7906x4,_0x7906x5){return ReportQueueHistory[_0xdba3[12]]()[_0xdba3[10]](function(_0x7906x8){return _0x7906x5[_0xdba3[9]](200)[_0xdba3[8]](_0x7906x8)})[_0xdba3[7]](function(_0x7906x6){return handleError(_0x7906x5,_0x7906x6)})};exports[_0xdba3[13]]=function(_0x7906x4,_0x7906x5){return ReportQueue[_0xdba3[17]](_0x7906x4[_0xdba3[16]][_0xdba3[15]])[_0xdba3[10]](function(_0x7906x9){if(!_0x7906x9){return _0x7906x5[_0xdba3[14]](404)};return _0x7906x5[_0xdba3[8]](_0x7906x9)})[_0xdba3[7]](function(_0x7906x6){return handleError(_0x7906x5,_0x7906x6)})};exports[_0xdba3[18]]=function(_0x7906x4,_0x7906x5){return ReportQueue[_0xdba3[18]](_0x7906x4[_0xdba3[19]])[_0xdba3[10]](function(_0x7906x9){return _0x7906x5[_0xdba3[9]](201)[_0xdba3[8]](_0x7906x9)})[_0xdba3[7]](function(_0x7906x6){return handleError(_0x7906x5,_0x7906x6)})};exports[_0xdba3[20]]=function(_0x7906x4,_0x7906x5){if(_0x7906x4[_0xdba3[19]][_0xdba3[15]]){delete _0x7906x4[_0xdba3[19]][_0xdba3[15]]};return ReportQueue[_0xdba3[17]](_0x7906x4[_0xdba3[16]][_0xdba3[15]])[_0xdba3[10]](function(_0x7906x9){if(!_0x7906x9){return _0x7906x5[_0xdba3[14]](404)};var _0x7906xa=_[_0xdba3[23]](_0x7906x9,_0x7906x4[_0xdba3[19]]);return _0x7906xa[_0xdba3[24]]()})[_0xdba3[10]](function(_0x7906x9){return _0x7906x5[_0xdba3[9]](200)[_0xdba3[8]](_0x7906x9)})[_0xdba3[7]](function(_0x7906x6){console[_0xdba3[22]](_0xdba3[21],_0x7906x6);return handleError(_0x7906x5,_0x7906x6)})};exports[_0xdba3[25]]=function(_0x7906x4,_0x7906x5){return ReportQueue[_0xdba3[17]](_0x7906x4[_0xdba3[16]][_0xdba3[15]])[_0xdba3[10]](function(_0x7906x9){if(!_0x7906x9){return _0x7906x5[_0xdba3[14]](404)};return _0x7906x9[_0xdba3[25]]()})[_0xdba3[10]](function(){return _0x7906x5[_0xdba3[14]](204)})[_0xdba3[7]](function(_0x7906x6){return handleError(_0x7906x5,_0x7906x6)})};function handleError(_0x7906x5,_0x7906x6){return _0x7906x5[_0xdba3[9]](500)[_0xdba3[8]](_0x7906x6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ReportQueue = require('../../models').ReportQueue; +var ReportQueueHistory = require('../../models').history.ReportQueueHistory; + +// Get list of reportQueues +exports.index = function(req, res) { + return ReportQueue + .findAll() + .then(function(reportQueues) { + return res.status(200).send(reportQueues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get list of fields +exports.describe = function(req, res) { + return ReportQueueHistory + .describe() + .then(function(fields) { + return res.status(200).send(fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single reportQueue +exports.show = function(req, res) { + return ReportQueue + .findById(req.params.id) + .then(function(reportQueue) { + if (!reportQueue) { + return res.sendStatus(404); + } + return res.send(reportQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new reportQueue in the DB. +exports.create = function(req, res) { + return ReportQueue + .create(req.body) + .then(function(reportQueue) { + return res.status(201).send(reportQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing reportQueue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ReportQueue + .findById(req.params.id) + .then(function(reportQueue) { + if (!reportQueue) { + return res.sendStatus(404); + } + var updated = _.merge(reportQueue, req.body); + return updated + .save(); + }) + .then(function(reportQueue) { + return res.status(200).send(reportQueue); + }) + .catch(function(err) { + console.error('err', err); + return handleError(res, err); + }); +}; + +// Deletes a reportQueue from the DB. +exports.destroy = function(req, res) { + return ReportQueue + .findById(req.params.id) + .then(function(reportQueue) { + if (!reportQueue) { + return res.sendStatus(404); + } + return reportQueue + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_queue/report_queue.socket.js b/server/api/report_queue/report_queue.socket.js index 0ff57d8..9f57869 100644 --- a/server/api/report_queue/report_queue.socket.js +++ b/server/api/report_queue/report_queue.socket.js @@ -1 +1,29 @@ -var _0xeaf2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xeaf2[0];var ReportQueue=require(_0xeaf2[2])[_0xeaf2[1]];exports[_0xeaf2[3]]=function(_0x62f1x2){ReportQueue[_0xeaf2[4]](function(_0x62f1x3){onSave(_0x62f1x2,_0x62f1x3)});ReportQueue[_0xeaf2[5]](function(_0x62f1x3){onSave(_0x62f1x2,_0x62f1x3)});ReportQueue[_0xeaf2[6]](function(_0x62f1x3){onRemove(_0x62f1x2,_0x62f1x3)})};function onSave(_0x62f1x2,_0x62f1x3,_0x62f1x5){if(_0x62f1x2[_0xeaf2[7]]===_0xeaf2[8]){_0x62f1x2[_0xeaf2[10]](_0xeaf2[9],_0x62f1x3)}}function onRemove(_0x62f1x2,_0x62f1x3,_0x62f1x5){_0x62f1x2[_0xeaf2[10]](_0xeaf2[11],_0x62f1x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportQueue = require('../../models').ReportQueue; + +exports.register = function(socket) { + ReportQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportQueue.afterUpdate(function(doc) { + onSave(socket, doc); + }); + ReportQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (socket.role === 'admin') { + socket.emit('report_queue:save', doc); + } +} + +function onRemove(socket, doc, cb) { + socket.emit('report_queue:remove', doc); +} diff --git a/server/api/report_tree/index.js b/server/api/report_tree/index.js index 845a2a1..75fa91c 100644 --- a/server/api/report_tree/index.js +++ b/server/api/report_tree/index.js @@ -1 +1,12 @@ -var _0xe06a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x65\x78\x70\x6F\x72\x74\x73"];_0xe06a[0];var express=require(_0xe06a[1]);var controller=require(_0xe06a[2]);var router=express.Router();router[_0xe06a[5]](_0xe06a[3],controller[_0xe06a[4]]);router[_0xe06a[8]](_0xe06a[6],controller[_0xe06a[7]]);router[_0xe06a[9]](_0xe06a[6],controller[_0xe06a[7]]);module[_0xe06a[10]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./report_tree.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); + +module.exports = router; diff --git a/server/api/report_tree/report_tree.controller.js b/server/api/report_tree/report_tree.controller.js index fd80b0f..a6b11b0 100644 --- a/server/api/report_tree/report_tree.controller.js +++ b/server/api/report_tree/report_tree.controller.js @@ -1 +1,46 @@ -var _0x1555=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0x1555[0];var _=require(_0x1555[1]);var util=require(_0x1555[2]);var ReportTree=require(_0x1555[4])[_0x1555[3]];exports[_0x1555[5]]=function(_0xbf28x4,_0xbf28x5){ReportTree[_0x1555[11]]()[_0x1555[10]](function(_0xbf28x7){if(!_0xbf28x7){return _0xbf28x5[_0x1555[7]](404)};return _0xbf28x5[_0x1555[9]](200)[_0x1555[8]](_0xbf28x7)})[_0x1555[6]](function(_0xbf28x6){return handleError(_0xbf28x5,_0xbf28x6)})};exports[_0x1555[12]]=function(_0xbf28x4,_0xbf28x5){ReportTree[_0x1555[18]](_0xbf28x4[_0x1555[17]][_0x1555[16]])[_0x1555[10]](function(_0xbf28x8){if(!_0xbf28x8){return _0xbf28x5[_0x1555[7]](404)};var _0xbf28x9=_[_0x1555[14]](_0xbf28x8,_0xbf28x4[_0x1555[13]]);_0xbf28x9[_0x1555[15]]()[_0x1555[10]](function(){return _0xbf28x5[_0x1555[9]](200)[_0x1555[8]](_0xbf28x8)})[_0x1555[6]](function(_0xbf28x6){return handleError(_0xbf28x5,_0xbf28x6)})})[_0x1555[6]](function(_0xbf28x6){return handleError(_0xbf28x5,_0xbf28x6)})};function handleError(_0xbf28x5,_0xbf28x6){return _0xbf28x5[_0x1555[9]](500)[_0x1555[8]](_0xbf28x6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var ReportTree = require('../../models').ReportTree; + +// Get the reports trees +exports.index = function(req, res) { + ReportTree + .findAll() + .then(function(trees) { + if (!trees) { + return res.sendStatus(404); + } + return res.status(200).send(trees); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing report in the DB. +exports.update = function(req, res) { + ReportTree + .findById(req.params.id) + .then(function(tree) { + if (!tree) { + return res.sendStatus(404); + } + var updated = _.merge(tree, req.body); + updated.save() + .then(function() { + return res.status(200).send(tree); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/report_tree/report_tree.socket.js b/server/api/report_tree/report_tree.socket.js index 1df63dc..389fa7a 100644 --- a/server/api/report_tree/report_tree.socket.js +++ b/server/api/report_tree/report_tree.socket.js @@ -1 +1,27 @@ -var _0xd016=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xd016[0];var ReportTree=require(_0xd016[2])[_0xd016[1]];exports[_0xd016[3]]=function(_0xac45x2){ReportTree[_0xd016[4]](function(_0xac45x3){onSave(_0xac45x2,_0xac45x3)});ReportTree[_0xd016[5]](function(_0xac45x3){onSave(_0xac45x2,_0xac45x3)});ReportTree[_0xd016[6]](function(_0xac45x3){onRemove(_0xac45x2,_0xac45x3)})};function onSave(_0xac45x2,_0xac45x3,_0xac45x5){_0xac45x2[_0xd016[8]](_0xd016[7],_0xac45x3)}function onRemove(_0xac45x2,_0xac45x3,_0xac45x5){_0xac45x2[_0xd016[8]](_0xd016[9],_0xac45x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ReportTree = require('../../models').ReportTree; + +exports.register = function(socket) { + ReportTree.afterCreate(function(doc) { + onSave(socket, doc); + }); + ReportTree.afterUpdate(function(doc) { + onSave(socket, doc); + }); + ReportTree.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('report_tree:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('report_tree:remove', doc); +} diff --git a/server/api/report_tree/report_tree.spec.js b/server/api/report_tree/report_tree.spec.js index 1a873ef..37d897a 100644 --- a/server/api/report_tree/report_tree.spec.js +++ b/server/api/report_tree/report_tree.spec.js @@ -1 +1,20 @@ -var _0xb118=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x74\x72\x65\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x74\x72\x65\x65\x73","\x67\x65\x74"];_0xb118[0];var should=require(_0xb118[1]);var app=require(_0xb118[2]);var request=require(_0xb118[3]);describe(_0xb118[4],function(){it(_0xb118[5],function(_0x1d6dx4){request(app)[_0xb118[13]](_0xb118[12])[_0xb118[11]](200)[_0xb118[11]](_0xb118[10],/json/)[_0xb118[9]](function(_0x1d6dx5,_0x1d6dx6){if(_0x1d6dx5){return _0x1d6dx4(_0x1d6dx5)};_0x1d6dx6[_0xb118[8]][_0xb118[1]][_0xb118[7]][_0xb118[6]](Array);_0x1d6dx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/analytics/reports/trees', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/analytic/reports/trees') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/salesforce_account/index.js b/server/api/salesforce_account/index.js index 2696645..d8b47b0 100644 --- a/server/api/salesforce_account/index.js +++ b/server/api/salesforce_account/index.js @@ -1 +1,21 @@ -var _0x3ca2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x3ca2[0];var express=require(_0x3ca2[1]);var auth=require(_0x3ca2[2]);var controller=require(_0x3ca2[3]);var router=express.Router();router[_0x3ca2[7]](_0x3ca2[4],auth[_0x3ca2[5]](),controller[_0x3ca2[6]]);router[_0x3ca2[7]](_0x3ca2[8],auth[_0x3ca2[5]](),controller[_0x3ca2[9]]);router[_0x3ca2[7]](_0x3ca2[10],auth[_0x3ca2[5]](),controller[_0x3ca2[11]]);router[_0x3ca2[7]](_0x3ca2[12],auth[_0x3ca2[5]](),controller[_0x3ca2[13]]);router[_0x3ca2[16]](_0x3ca2[14],auth[_0x3ca2[5]](),controller[_0x3ca2[15]]);router[_0x3ca2[16]](_0x3ca2[4],auth[_0x3ca2[5]](),controller[_0x3ca2[17]]);router[_0x3ca2[19]](_0x3ca2[8],auth[_0x3ca2[5]](),controller[_0x3ca2[18]]);router[_0x3ca2[20]](_0x3ca2[8],auth[_0x3ca2[5]](),controller[_0x3ca2[18]]);router[_0x3ca2[22]](_0x3ca2[4],auth[_0x3ca2[5]](),controller[_0x3ca2[21]]);router[_0x3ca2[22]](_0x3ca2[8],auth[_0x3ca2[5]](),controller[_0x3ca2[23]]);module[_0x3ca2[24]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./salesforce_account.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/check', auth.isAuthenticated(), controller.checkAccount); +router.get('/:id/fields', auth.isAuthenticated(), controller.getFields); +router.post('/validate/:field', auth.isAuthenticated(), controller.accountValidation); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/salesforce_account/index.spec.js b/server/api/salesforce_account/index.spec.js index 0e02667..a03b303 100644 --- a/server/api/salesforce_account/index.spec.js +++ b/server/api/salesforce_account/index.spec.js @@ -1 +1,97 @@ -var _0x4756=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x4756[0];var proxyquire=require(_0x4756[2])[_0x4756[1]]();var salesforceAccountCtrlStub={index:_0x4756[3],show:_0x4756[4],create:_0x4756[5],update:_0x4756[6],destroy:_0x4756[7]};var routerStub={get:sinon[_0x4756[8]](),put:sinon[_0x4756[8]](),patch:sinon[_0x4756[8]](),post:sinon[_0x4756[8]](),delete:sinon[_0x4756[8]]()};var salesforceAccountIndex=proxyquire(_0x4756[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":salesforceAccountCtrlStub});describe(_0x4756[10],function(){it(_0x4756[11],function(){expect(salesforceAccountIndex)[_0x4756[13]][_0x4756[12]](routerStub)});describe(_0x4756[14],function(){it(_0x4756[15],function(){expect(routerStub[_0x4756[21]][_0x4756[20]](_0x4756[19],_0x4756[3]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})});describe(_0x4756[22],function(){it(_0x4756[23],function(){expect(routerStub[_0x4756[21]][_0x4756[20]](_0x4756[24],_0x4756[4]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})});describe(_0x4756[25],function(){it(_0x4756[26],function(){expect(routerStub[_0x4756[27]][_0x4756[20]](_0x4756[19],_0x4756[5]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})});describe(_0x4756[28],function(){it(_0x4756[29],function(){expect(routerStub[_0x4756[30]][_0x4756[20]](_0x4756[24],_0x4756[6]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})});describe(_0x4756[31],function(){it(_0x4756[29],function(){expect(routerStub[_0x4756[32]][_0x4756[20]](_0x4756[24],_0x4756[6]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})});describe(_0x4756[33],function(){it(_0x4756[34],function(){expect(routerStub[_0x4756[35]][_0x4756[20]](_0x4756[24],_0x4756[7]))[_0x4756[13]][_0x4756[18]][_0x4756[17]][_0x4756[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var salesforceAccountCtrlStub = { + index: 'salesforceAccountCtrl.index', + show: 'salesforceAccountCtrl.show', + create: 'salesforceAccountCtrl.create', + update: 'salesforceAccountCtrl.update', + destroy: 'salesforceAccountCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var salesforceAccountIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './salesforce_account.controller': salesforceAccountCtrlStub +}); + +describe('SalesforceAccount API Router:', function() { + + it('should return an express router instance', function() { + expect(salesforceAccountIndex).to.equal(routerStub); + }); + + describe('GET /api/salesforce/accounts', function() { + + it('should route to salesforceAccount.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'salesforceAccountCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/salesforce/accounts/:id', function() { + + it('should route to salesforceAccount.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'salesforceAccountCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/salesforce/accounts', function() { + + it('should route to salesforceAccount.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'salesforceAccountCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/salesforce/accounts/:id', function() { + + it('should route to salesforceAccount.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'salesforceAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/salesforce/accounts/:id', function() { + + it('should route to salesforceAccount.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'salesforceAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/salesforce/accounts/:id', function() { + + it('should route to salesforceAccount.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'salesforceAccountCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/salesforce_account/salesforce_account.controller.js b/server/api/salesforce_account/salesforce_account.controller.js index 01b59e0..69c55e6 100644 --- a/server/api/salesforce_account/salesforce_account.controller.js +++ b/server/api/salesforce_account/salesforce_account.controller.js @@ -1 +1,253 @@ -var _0xb9ce=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x6A\x73\x66\x6F\x72\x63\x65","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x63\x6C\x69\x65\x6E\x74\x49\x64","\x63\x6C\x69\x65\x6E\x74\x53\x65\x63\x72\x65\x74","\x73\x65\x63\x75\x72\x69\x74\x79\x54\x6F\x6B\x65\x6E","\x63\x6F\x6E\x63\x61\x74","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6C\x6F\x67\x69\x6E","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x66\x69\x65\x6C\x64\x73","\x64\x65\x73\x63\x72\x69\x62\x65","\x54\x61\x73\x6B","\x73\x6F\x62\x6A\x65\x63\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0xb9ce[0];var _=require(_0xb9ce[1]);var util=require(_0xb9ce[2]);var jsforce=require(_0xb9ce[3]);var SalesforceAccount=require(_0xb9ce[5])[_0xb9ce[4]];function handleError(_0xb2aax6,_0xb2aax7){_0xb2aax7=_0xb2aax7||500;return function(_0xb2aax8){_0xb2aax6[_0xb9ce[7]](_0xb2aax7)[_0xb9ce[6]](_0xb2aax8)}}function responseWithResult(_0xb2aax6,_0xb2aax7){_0xb2aax7=_0xb2aax7||200;return function(_0xb2aaxa){if(_0xb2aaxa){_0xb2aax6[_0xb9ce[7]](_0xb2aax7)[_0xb9ce[8]](_0xb2aaxa)}}}function handleEntityNotFound(_0xb2aax6){return function(_0xb2aaxa){if(!_0xb2aaxa){_0xb2aax6[_0xb9ce[7]](404)[_0xb9ce[9]]();return null};return _0xb2aaxa}}function saveUpdates(_0xb2aaxd){return function(_0xb2aaxa){return _0xb2aaxa[_0xb9ce[11]](_0xb2aaxd)[_0xb9ce[10]](function(_0xb2aaxe){return _0xb2aaxe})}}function removeEntity(_0xb2aax6){return function(_0xb2aaxa){if(_0xb2aaxa){return _0xb2aaxa[_0xb9ce[12]]()[_0xb9ce[10]](function(){_0xb2aax6[_0xb9ce[7]](204)[_0xb9ce[9]]()})}}}exports[_0xb9ce[13]]=function(_0xb2aax10,_0xb2aax6){var _0xb2aax11=[_0xb9ce[14],_0xb9ce[15],_0xb9ce[16],_0xb9ce[17]];var _0xb2aax12=_0xb2aax10[_0xb9ce[19]][_0xb9ce[18]]?parseInt(_0xb2aax10[_0xb9ce[19]][_0xb9ce[18]],10):100;var _0xb2aax13=_0xb2aax10[_0xb9ce[19]][_0xb9ce[20]]?parseInt(_0xb2aax10[_0xb9ce[19]][_0xb9ce[20]],10):0;var _0xb2aax14={where:{},limit:_0xb2aax12,offset:_0xb2aax13*_0xb2aax12};_[_0xb9ce[34]](_0xb2aax10[_0xb9ce[19]],function(_0xb2aax15,_0xb2aax16){switch(_0xb2aax16){case _0xb9ce[18]:;case _0xb9ce[20]:break;case _0xb9ce[23]:_0xb2aax14[_0xb9ce[21]]=util[_0xb9ce[26]](_0xb9ce[22],_0xb2aax10[_0xb9ce[19]][_0xb9ce[23]],_0xb2aax10[_0xb9ce[19]][_0xb9ce[24]]||_0xb9ce[25])||null;break;case _0xb9ce[24]:break;case _0xb9ce[32]:_0xb2aax14[_0xb9ce[28]][_0xb9ce[27]]=[];_0xb2aax11[_0xb9ce[31]](function(_0xb2aax17){var _0xb2aax18={};_0xb2aax18[_0xb2aax17]={$like:_0xb9ce[29]+_0xb2aax15+_0xb9ce[29]};_0xb2aax14[_0xb9ce[28]][_0xb9ce[27]][_0xb9ce[30]](_0xb2aax18)});break;default:_0xb2aax14[_0xb9ce[28]][_0xb2aax16]={$like:{}};_0xb2aax14[_0xb9ce[28]][_0xb2aax16][_0xb9ce[33]]=_0xb9ce[29]+_0xb2aax15+_0xb9ce[29]}});SalesforceAccount[_0xb9ce[46]](_0xb2aax14)[_0xb9ce[10]](function(_0xb2aax19){var _0xb2aax1a=Math[_0xb9ce[38]](_0xb2aax19[_0xb9ce[37]]/_0xb2aax12);var _0xb2aax1b=_0xb2aax1a>(_0xb2aax14[_0xb9ce[39]]+1)?util[_0xb9ce[26]](_0xb9ce[40],_0xb2aax10[_0xb9ce[41]],_0xb2aax10[_0xb9ce[43]][_0xb9ce[42]],_0xb2aax10[_0xb9ce[44]],_0xb2aax13+1):null;var _0xb2aax1c=_0xb2aax13>0?util[_0xb9ce[26]](_0xb9ce[40],_0xb2aax10[_0xb9ce[41]],_0xb2aax10[_0xb9ce[43]][_0xb9ce[42]],_0xb2aax10[_0xb9ce[44]],_0xb2aax13-1):null;return _0xb2aax6[_0xb9ce[7]](200)[_0xb9ce[6]]({count:_0xb2aax19[_0xb9ce[37]],rows:_0xb2aax19[_0xb9ce[45]],next_page:_0xb2aax1b,previous_page:_0xb2aax1c,total_pages:_0xb2aax1a})})[_0xb9ce[36]](function(_0xb2aax8){return _0xb2aax6[_0xb9ce[7]](500)[_0xb9ce[6]]({error:_0xb9ce[35]})})};exports[_0xb9ce[47]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[50]](_0xb2aax10[_0xb9ce[49]][_0xb9ce[48]])[_0xb9ce[10]](handleEntityNotFound(_0xb2aax6))[_0xb9ce[10]](responseWithResult(_0xb2aax6))[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[51]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[51]](_0xb2aax10[_0xb9ce[52]])[_0xb9ce[10]](responseWithResult(_0xb2aax6,201))[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[53]]=function(_0xb2aax10,_0xb2aax6){if(_0xb2aax10[_0xb9ce[52]][_0xb9ce[48]]){delete _0xb2aax10[_0xb9ce[52]][_0xb9ce[48]]};SalesforceAccount[_0xb9ce[50]](_0xb2aax10[_0xb9ce[49]][_0xb9ce[48]])[_0xb9ce[10]](handleEntityNotFound(_0xb2aax6))[_0xb9ce[10]](saveUpdates(_0xb2aax10[_0xb9ce[52]]))[_0xb9ce[10]](responseWithResult(_0xb2aax6))[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[12]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[50]](_0xb2aax10[_0xb9ce[49]][_0xb9ce[48]])[_0xb9ce[10]](handleEntityNotFound(_0xb2aax6))[_0xb9ce[10]](removeEntity(_0xb2aax6))[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[54]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[50]](_0xb2aax10[_0xb9ce[49]][_0xb9ce[48]])[_0xb9ce[10]](handleEntityNotFound(_0xb2aax6))[_0xb9ce[10]](function(_0xb2aax1d){var _0xb2aax1e= new jsforce.Connection({oauth2:{loginUrl:_0xb2aax1d[_0xb9ce[17]],clientId:_0xb2aax1d[_0xb9ce[55]],clientSecret:_0xb2aax1d[_0xb9ce[56]]}});var _0xb2aax1f=_0xb2aax1d[_0xb9ce[59]][_0xb9ce[58]](_0xb2aax1d[_0xb9ce[57]]);_0xb2aax1e[_0xb9ce[61]](_0xb2aax1d[_0xb9ce[16]],_0xb2aax1f,function(_0xb2aax8,_0xb2aax20){if(_0xb2aax8){return _0xb2aax6[_0xb9ce[7]](400)[_0xb9ce[6]](_0xb2aax8)};return _0xb2aax6[_0xb9ce[60]](200)})})[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[62]]=function(_0xb2aax10,_0xb2aax6){var _0xb2aax21={};_0xb2aax21[_0xb2aax10[_0xb9ce[49]][_0xb9ce[63]]]=_0xb2aax10[_0xb9ce[52]][_0xb9ce[64]];SalesforceAccount[_0xb9ce[46]]({where:_0xb2aax21})[_0xb9ce[10]](function(_0xb2aax19){if(_0xb2aax19[_0xb9ce[37]]){return _0xb2aax6[_0xb9ce[7]](200)[_0xb9ce[6]]({isValid:false,value:_0xb2aax10[_0xb9ce[52]][_0xb9ce[64]]})};return _0xb2aax6[_0xb9ce[7]](200)[_0xb9ce[6]]({isValid:true,value:_0xb2aax10[_0xb9ce[52]][_0xb9ce[64]]})})[_0xb9ce[36]](function(_0xb2aax8){return handleError(_0xb2aax6,_0xb2aax8)})};exports[_0xb9ce[65]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[50]](_0xb2aax10[_0xb9ce[49]][_0xb9ce[48]])[_0xb9ce[10]](handleEntityNotFound(_0xb2aax6))[_0xb9ce[10]](function(_0xb2aax1d){var _0xb2aax1e= new jsforce.Connection({oauth2:{loginUrl:_0xb2aax1d[_0xb9ce[17]],clientId:_0xb2aax1d[_0xb9ce[55]],clientSecret:_0xb2aax1d[_0xb9ce[56]]}});var _0xb2aax1f=_0xb2aax1d[_0xb9ce[59]][_0xb9ce[58]](_0xb2aax1d[_0xb9ce[57]]);_0xb2aax1e[_0xb9ce[61]](_0xb2aax1d[_0xb9ce[16]],_0xb2aax1f,function(_0xb2aax8,_0xb2aax20){if(_0xb2aax8){return _0xb2aax6[_0xb9ce[7]](400)[_0xb9ce[6]](_0xb2aax8)};_0xb2aax1e[_0xb9ce[69]](_0xb9ce[68])[_0xb9ce[67]](function(_0xb2aax8,_0xb2aax22){if(_0xb2aax8){return _0xb2aax6[_0xb9ce[7]](400)[_0xb9ce[6]](_0xb2aax8)};return _0xb2aax6[_0xb9ce[7]](200)[_0xb9ce[6]](_0xb2aax22[_0xb9ce[66]])})})})[_0xb9ce[36]](handleError(_0xb2aax6))};exports[_0xb9ce[70]]=function(_0xb2aax10,_0xb2aax6){SalesforceAccount[_0xb9ce[12]]({where:{id:_0xb2aax10[_0xb9ce[19]][_0xb9ce[48]]},individualHooks:true})[_0xb9ce[10]](function(){return _0xb2aax6[_0xb9ce[60]](204)})[_0xb9ce[36]](function(_0xb2aax8){return handleError(_0xb2aax6,_0xb2aax8)})} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/salesforce/accounts -> index + * POST /api/salesforce/accounts -> create + * GET /api/salesforce/accounts/:id -> show + * PUT /api/salesforce/accounts/:id -> update + * DELETE /api/salesforce/accounts/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var util = require('util'); +var jsforce = require('jsforce'); + +var SalesforceAccount = require('../../models').SalesforceAccount; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SalesforceAccounts +exports.index = function(req, res) { + var attributes = ['description', 'name', 'username', 'remoteUri']; + var per_page = req.query.per_page ? parseInt(req.query.per_page, 10) : 100; + var page = req.query.page ? parseInt(req.query.page, 10) : 0; + + var query = { + where: {}, + limit: per_page, + offset: page * per_page + }; + + _.forIn(req.query, function(value, key) { + switch (key) { + case 'per_page': + case 'page': + break; + case 'sort_by': + query.order = util.format('%s %s', req.query.sort_by, req.query.sort_order || 'ASC') || null; + break; + case 'sort_order': + break; + case '$': + query.where.$or = []; + attributes.forEach(function(attribute) { + var tmp = {}; + tmp[attribute] = { + $like: '%' + value + '%' + }; + + query.where.$or.push(tmp); + }); + break; + default: + query.where[key] = { + $like: {} + }; + query.where[key].$like = '%' + value + '%'; + } + }); + + SalesforceAccount + .findAndCountAll(query) + .then(function(result) { + + var total_pages = Math.ceil(result.count / per_page); + var next_page = total_pages > (query.offset + 1) ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page + 1) : null; + var previous_page = page > 0 ? util.format('%s://%s%s?page=%d', req.protocol, req.headers.host, req.baseUrl, page - 1) : null; + + return res.status(200).send({ + count: result.count, + rows: result.rows, + next_page: next_page, + previous_page: previous_page, + total_pages: total_pages + }); + + }) + .catch(function(err) { + return res.status(500).send({ + error: 'Something blew up!' + }); + }); +} + +// Gets a single SalesforceAccount from the DB +exports.show = function(req, res) { + SalesforceAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SalesforceAccount in the DB +exports.create = function(req, res) { + SalesforceAccount.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SalesforceAccount in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + SalesforceAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SalesforceAccount from the DB +exports.destroy = function(req, res) { + SalesforceAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.checkAccount = function(req, res) { + SalesforceAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + var conn = new jsforce.Connection({ + oauth2: { + loginUrl: account.remoteUri, + clientId: account.clientId, + clientSecret: account.clientSecret, + } + }); + var pwd = account.password.concat(account.securityToken); + conn.login(account.username, pwd, function(err, userInfo) { + if (err) { + return res.status(400).send(err); + } + return res.sendStatus(200); + }); + }) + .catch(handleError(res)); +} + +exports.accountValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + SalesforceAccount + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getFields = function(req, res) { + SalesforceAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + var conn = new jsforce.Connection({ + oauth2: { + loginUrl: account.remoteUri, + clientId: account.clientId, + clientSecret: account.clientSecret, + } + }); + var pwd = account.password.concat(account.securityToken); + conn.login(account.username, pwd, function(err, userInfo) { + if (err) { + return res.status(400).send(err); + } + conn.sobject("Task").describe(function(err, meta) { + if (err) { + return res.status(400).send(err); + } + return res.status(200).send(meta.fields); + }); + }); + }) + .catch(handleError(res)); +}; + +exports.bulkDestroy = function(req, res) { + SalesforceAccount + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; diff --git a/server/api/salesforce_account/salesforce_account.socket.js b/server/api/salesforce_account/salesforce_account.socket.js index 8a1ad4a..2c58d15 100644 --- a/server/api/salesforce_account/salesforce_account.socket.js +++ b/server/api/salesforce_account/salesforce_account.socket.js @@ -1 +1,24 @@ -var _0xde3c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xde3c[0];var SalesforceAccount=require(_0xde3c[2])[_0xde3c[1]];exports[_0xde3c[3]]=function(_0x6d86x2){SalesforceAccount[_0xde3c[4]](function(_0x6d86x3){onSave(_0x6d86x2,_0x6d86x3)});SalesforceAccount[_0xde3c[5]](function(_0x6d86x3){onRemove(_0x6d86x2,_0x6d86x3)})};function onSave(_0x6d86x2,_0x6d86x3,_0x6d86x5){_0x6d86x2[_0xde3c[7]](_0xde3c[6],_0x6d86x3)}function onRemove(_0x6d86x2,_0x6d86x3,_0x6d86x5){_0x6d86x2[_0xde3c[7]](_0xde3c[8],_0x6d86x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SalesforceAccount = require('../../models').SalesforceAccount; + +exports.register = function(socket) { + SalesforceAccount.afterCreate(function(doc) { + onSave(socket, doc); + }); + SalesforceAccount.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('salesforce_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('salesforce_account:remove', doc); +} diff --git a/server/api/salesforce_configuration/index.js b/server/api/salesforce_configuration/index.js index 09c8d29..7936a09 100644 --- a/server/api/salesforce_configuration/index.js +++ b/server/api/salesforce_configuration/index.js @@ -1 +1,18 @@ -var _0xa28d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x3A\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xa28d[0];var express=require(_0xa28d[1]);var auth=require(_0xa28d[2]);var controller=require(_0xa28d[3]);var router=express.Router();router[_0xa28d[7]](_0xa28d[4],auth[_0xa28d[5]](),controller[_0xa28d[6]]);router[_0xa28d[7]](_0xa28d[8],auth[_0xa28d[5]](),controller[_0xa28d[9]]);router[_0xa28d[11]](_0xa28d[4],auth[_0xa28d[5]](),controller[_0xa28d[10]]);router[_0xa28d[13]](_0xa28d[8],auth[_0xa28d[5]](),controller[_0xa28d[12]]);router[_0xa28d[11]](_0xa28d[14],auth[_0xa28d[5]](),controller[_0xa28d[15]]);router[_0xa28d[16]](_0xa28d[8],auth[_0xa28d[5]](),controller[_0xa28d[12]]);router[_0xa28d[18]](_0xa28d[8],auth[_0xa28d[5]](),controller[_0xa28d[17]]);module[_0xa28d[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./salesforce_configuration.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/:id/:type', auth.isAuthenticated(), controller.addConfigurationField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/salesforce_configuration/index.spec.js b/server/api/salesforce_configuration/index.spec.js index 17ce4b9..0d1e211 100644 --- a/server/api/salesforce_configuration/index.spec.js +++ b/server/api/salesforce_configuration/index.spec.js @@ -1 +1,97 @@ -var _0x8ea2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x8ea2[0];var proxyquire=require(_0x8ea2[2])[_0x8ea2[1]]();var salesforceConfigurationCtrlStub={index:_0x8ea2[3],show:_0x8ea2[4],create:_0x8ea2[5],update:_0x8ea2[6],destroy:_0x8ea2[7]};var routerStub={get:sinon[_0x8ea2[8]](),put:sinon[_0x8ea2[8]](),patch:sinon[_0x8ea2[8]](),post:sinon[_0x8ea2[8]](),delete:sinon[_0x8ea2[8]]()};var salesforceConfigurationIndex=proxyquire(_0x8ea2[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":salesforceConfigurationCtrlStub});describe(_0x8ea2[10],function(){it(_0x8ea2[11],function(){expect(salesforceConfigurationIndex)[_0x8ea2[13]][_0x8ea2[12]](routerStub)});describe(_0x8ea2[14],function(){it(_0x8ea2[15],function(){expect(routerStub[_0x8ea2[21]][_0x8ea2[20]](_0x8ea2[19],_0x8ea2[3]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})});describe(_0x8ea2[22],function(){it(_0x8ea2[23],function(){expect(routerStub[_0x8ea2[21]][_0x8ea2[20]](_0x8ea2[24],_0x8ea2[4]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})});describe(_0x8ea2[25],function(){it(_0x8ea2[26],function(){expect(routerStub[_0x8ea2[27]][_0x8ea2[20]](_0x8ea2[19],_0x8ea2[5]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})});describe(_0x8ea2[28],function(){it(_0x8ea2[29],function(){expect(routerStub[_0x8ea2[30]][_0x8ea2[20]](_0x8ea2[24],_0x8ea2[6]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})});describe(_0x8ea2[31],function(){it(_0x8ea2[29],function(){expect(routerStub[_0x8ea2[32]][_0x8ea2[20]](_0x8ea2[24],_0x8ea2[6]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})});describe(_0x8ea2[33],function(){it(_0x8ea2[34],function(){expect(routerStub[_0x8ea2[35]][_0x8ea2[20]](_0x8ea2[24],_0x8ea2[7]))[_0x8ea2[13]][_0x8ea2[18]][_0x8ea2[17]][_0x8ea2[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var salesforceConfigurationCtrlStub = { + index: 'salesforceConfigurationCtrl.index', + show: 'salesforceConfigurationCtrl.show', + create: 'salesforceConfigurationCtrl.create', + update: 'salesforceConfigurationCtrl.update', + destroy: 'salesforceConfigurationCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var salesforceConfigurationIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './salesforce_configuration.controller': salesforceConfigurationCtrlStub +}); + +describe('SalesforceConfiguration API Router:', function() { + + it('should return an express router instance', function() { + expect(salesforceConfigurationIndex).to.equal(routerStub); + }); + + describe('GET /api/salesforce/configurations', function() { + + it('should route to salesforceConfiguration.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'salesforceConfigurationCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/salesforce/configurations/:id', function() { + + it('should route to salesforceConfiguration.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'salesforceConfigurationCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/salesforce/configurations', function() { + + it('should route to salesforceConfiguration.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'salesforceConfigurationCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/salesforce/configurations/:id', function() { + + it('should route to salesforceConfiguration.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'salesforceConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/salesforce/configurations/:id', function() { + + it('should route to salesforceConfiguration.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'salesforceConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/salesforce/configurations/:id', function() { + + it('should route to salesforceConfiguration.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'salesforceConfigurationCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/salesforce_configuration/salesforce_configuration.controller.js b/server/api/salesforce_configuration/salesforce_configuration.controller.js index 8628048..523aef6 100644 --- a/server/api/salesforce_configuration/salesforce_configuration.controller.js +++ b/server/api/salesforce_configuration/salesforce_configuration.controller.js @@ -1 +1,147 @@ -var _0xcf44=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x53\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x73\x70\x72\x65\x61\x64","\x61\x64\x64\x53\x75\x62\x6A\x65\x63\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x64\x64\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x74\x79\x70\x65"];_0xcf44[0];var _=require(_0xcf44[1]);var SalesforceConfiguration=require(_0xcf44[3])[_0xcf44[2]];var SalesforceField=require(_0xcf44[3])[_0xcf44[4]];function handleError(_0xab43x5,_0xab43x6){_0xab43x6=_0xab43x6||500;return function(_0xab43x7){_0xab43x5[_0xcf44[6]](_0xab43x6)[_0xcf44[5]](_0xab43x7)}}function responseWithResult(_0xab43x5,_0xab43x6){_0xab43x6=_0xab43x6||200;return function(_0xab43x9){if(_0xab43x9){_0xab43x5[_0xcf44[6]](_0xab43x6)[_0xcf44[7]](_0xab43x9)}}}function handleEntityNotFound(_0xab43x5){return function(_0xab43x9){if(!_0xab43x9){_0xab43x5[_0xcf44[6]](404)[_0xcf44[8]]();return null};return _0xab43x9}}function saveUpdates(_0xab43xc){return function(_0xab43x9){return _0xab43x9[_0xcf44[10]](_0xab43xc)[_0xcf44[9]](function(_0xab43xd){return _0xab43xd})}}function removeEntity(_0xab43x5){return function(_0xab43x9){if(_0xab43x9){return _0xab43x9[_0xcf44[11]]()[_0xcf44[9]](function(){_0xab43x5[_0xcf44[6]](204)[_0xcf44[8]]()})}}}exports[_0xcf44[12]]=function(_0xab43xf,_0xab43x5){SalesforceConfiguration[_0xcf44[15]]({where:_0xab43xf[_0xcf44[14]]})[_0xcf44[9]](responseWithResult(_0xab43x5))[_0xcf44[13]](handleError(_0xab43x5))};exports[_0xcf44[16]]=function(_0xab43xf,_0xab43x5){SalesforceConfiguration[_0xcf44[22]]({where:{id:_0xab43xf[_0xcf44[18]][_0xcf44[17]]},include:[{model:SalesforceField,as:_0xcf44[19]},{model:SalesforceField,as:_0xcf44[20]},{model:SalesforceField,as:_0xcf44[21]}]})[_0xcf44[9]](handleEntityNotFound(_0xab43x5))[_0xcf44[9]](responseWithResult(_0xab43x5))[_0xcf44[13]](handleError(_0xab43x5))};exports[_0xcf44[23]]=function(_0xab43xf,_0xab43x5){SalesforceConfiguration[_0xcf44[23]](_0xab43xf[_0xcf44[24]])[_0xcf44[9]](responseWithResult(_0xab43x5,201))[_0xcf44[13]](handleError(_0xab43x5))};exports[_0xcf44[25]]=function(_0xab43xf,_0xab43x5){if(_0xab43xf[_0xcf44[24]][_0xcf44[17]]){delete _0xab43xf[_0xcf44[24]][_0xcf44[17]]};SalesforceConfiguration[_0xcf44[26]](_0xab43xf[_0xcf44[18]][_0xcf44[17]])[_0xcf44[9]](handleEntityNotFound(_0xab43x5))[_0xcf44[9]](saveUpdates(_0xab43xf[_0xcf44[24]]))[_0xcf44[9]](responseWithResult(_0xab43x5))[_0xcf44[13]](handleError(_0xab43x5))};exports[_0xcf44[11]]=function(_0xab43xf,_0xab43x5){SalesforceConfiguration[_0xcf44[26]](_0xab43xf[_0xcf44[18]][_0xcf44[17]])[_0xcf44[9]](handleEntityNotFound(_0xab43x5))[_0xcf44[9]](removeEntity(_0xab43x5))[_0xcf44[13]](handleError(_0xab43x5))};exports[_0xcf44[27]]=function(_0xab43xf,_0xab43x5,_0xab43x10){var _0xab43x11;SalesforceConfiguration[_0xcf44[26]](_0xab43xf[_0xcf44[18]][_0xcf44[17]])[_0xcf44[9]](handleEntityNotFound(_0xab43x5))[_0xcf44[9]](function(_0xab43x14){_0xab43x11=_0xab43x14;return SalesforceField[_0xcf44[23]](_0xab43xf[_0xcf44[24]])})[_0xcf44[9]](function(_0xab43x13){switch(_0xab43xf[_0xcf44[18]][_0xcf44[35]]){case _0xcf44[30]:return [_0xab43x11[_0xcf44[29]](_0xab43x13),_0xab43x13];case _0xcf44[32]:return [_0xab43x11[_0xcf44[31]](_0xab43x13),_0xab43x13];case _0xcf44[34]:return [_0xab43x11[_0xcf44[33]](_0xab43x13),_0xab43x13]}})[_0xcf44[28]](function(_0xab43x12,_0xab43x13){return _0xab43x5[_0xcf44[6]](201)[_0xcf44[7]](_0xab43x13)})[_0xcf44[13]](handleError(_0xab43x5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/salesforce/configurations -> index + * POST /api/salesforce/configurations -> create + * GET /api/salesforce/configurations/:id -> show + * PUT /api/salesforce/configurations/:id -> update + * DELETE /api/salesforce/configurations/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var SalesforceConfiguration = require('../../models').SalesforceConfiguration; +var SalesforceField = require('../../models').SalesforceField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SalesforceConfigurations +exports.index = function(req, res) { + SalesforceConfiguration.findAll({ + where: req.query + }) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single SalesforceConfiguration from the DB +exports.show = function(req, res) { + SalesforceConfiguration.find({ + where: { + id: req.params.id + }, + include: [{ + model: SalesforceField, + as: 'Subject' + }, { + model: SalesforceField, + as: 'Description' + }, { + model: SalesforceField, + as: 'Field' + }] + }) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SalesforceConfiguration in the DB +exports.create = function(req, res) { + SalesforceConfiguration.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SalesforceConfiguration in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + SalesforceConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SalesforceConfiguration from the DB +exports.destroy = function(req, res) { + SalesforceConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.addConfigurationField = function(req, res, next) { + // console.log(req.params); + var salesforceConfiguration; + SalesforceConfiguration + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(salesforce_configuration) { + salesforceConfiguration = salesforce_configuration; + return SalesforceField.create(req.body) + }) + .then(function(salesforceField) { + switch (req.params.type) { + case 'subject': + return [salesforceConfiguration.addSubject(salesforceField), salesforceField]; + case 'description': + return [salesforceConfiguration.addDescription(salesforceField), salesforceField]; + case 'field': + return [salesforceConfiguration.addField(salesforceField), salesforceField]; + } + }) + .spread(function(data, salesforceField) { + return res.status(201).json(salesforceField); + }) + .catch(handleError(res)); +}; diff --git a/server/api/salesforce_configuration/salesforce_configuration.socket.js b/server/api/salesforce_configuration/salesforce_configuration.socket.js index 11b2639..c45a482 100644 --- a/server/api/salesforce_configuration/salesforce_configuration.socket.js +++ b/server/api/salesforce_configuration/salesforce_configuration.socket.js @@ -1 +1,24 @@ -var _0xcb6f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xcb6f[0];var SalesforceConfiguration=require(_0xcb6f[2])[_0xcb6f[1]];exports[_0xcb6f[3]]=function(_0x5976x2){SalesforceConfiguration[_0xcb6f[4]](function(_0x5976x3){onSave(_0x5976x2,_0x5976x3)});SalesforceConfiguration[_0xcb6f[5]](function(_0x5976x3){onRemove(_0x5976x2,_0x5976x3)})};function onSave(_0x5976x2,_0x5976x3,_0x5976x5){_0x5976x2[_0xcb6f[7]](_0xcb6f[6],_0x5976x3)}function onRemove(_0x5976x2,_0x5976x3,_0x5976x5){_0x5976x2[_0xcb6f[7]](_0xcb6f[8],_0x5976x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SalesforceConfiguration = require('../../models').SalesforceConfiguration; + +exports.register = function(socket) { + SalesforceConfiguration.afterCreate(function(doc) { + onSave(socket, doc); + }); + SalesforceConfiguration.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('salesforce_configuration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('salesforce_configuration:remove', doc); +} diff --git a/server/api/salesforce_field/index.js b/server/api/salesforce_field/index.js index 170e1b8..4a0ccb2 100644 --- a/server/api/salesforce_field/index.js +++ b/server/api/salesforce_field/index.js @@ -1 +1,18 @@ -var _0xad54=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xad54[0];var express=require(_0xad54[1]);var auth=require(_0xad54[2]);var controller=require(_0xad54[3]);var router=express.Router();router[_0xad54[7]](_0xad54[4],auth[_0xad54[5]](),controller[_0xad54[6]]);router[_0xad54[7]](_0xad54[8],auth[_0xad54[5]](),controller[_0xad54[9]]);router[_0xad54[11]](_0xad54[4],auth[_0xad54[5]](),controller[_0xad54[10]]);router[_0xad54[13]](_0xad54[8],auth[_0xad54[5]](),controller[_0xad54[12]]);router[_0xad54[14]](_0xad54[8],auth[_0xad54[5]](),controller[_0xad54[12]]);router[_0xad54[16]](_0xad54[8],auth[_0xad54[5]](),controller[_0xad54[15]]);module[_0xad54[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./salesforce_field.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/salesforce_field/index.spec.js b/server/api/salesforce_field/index.spec.js index 93f1e7f..639e318 100644 --- a/server/api/salesforce_field/index.spec.js +++ b/server/api/salesforce_field/index.spec.js @@ -1 +1,97 @@ -var _0x3363=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x3363[0];var proxyquire=require(_0x3363[2])[_0x3363[1]]();var salesforceFieldCtrlStub={index:_0x3363[3],show:_0x3363[4],create:_0x3363[5],update:_0x3363[6],destroy:_0x3363[7]};var routerStub={get:sinon[_0x3363[8]](),put:sinon[_0x3363[8]](),patch:sinon[_0x3363[8]](),post:sinon[_0x3363[8]](),delete:sinon[_0x3363[8]]()};var salesforceFieldIndex=proxyquire(_0x3363[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":salesforceFieldCtrlStub});describe(_0x3363[10],function(){it(_0x3363[11],function(){expect(salesforceFieldIndex)[_0x3363[13]][_0x3363[12]](routerStub)});describe(_0x3363[14],function(){it(_0x3363[15],function(){expect(routerStub[_0x3363[21]][_0x3363[20]](_0x3363[19],_0x3363[3]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})});describe(_0x3363[22],function(){it(_0x3363[23],function(){expect(routerStub[_0x3363[21]][_0x3363[20]](_0x3363[24],_0x3363[4]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})});describe(_0x3363[25],function(){it(_0x3363[26],function(){expect(routerStub[_0x3363[27]][_0x3363[20]](_0x3363[19],_0x3363[5]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})});describe(_0x3363[28],function(){it(_0x3363[29],function(){expect(routerStub[_0x3363[30]][_0x3363[20]](_0x3363[24],_0x3363[6]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})});describe(_0x3363[31],function(){it(_0x3363[29],function(){expect(routerStub[_0x3363[32]][_0x3363[20]](_0x3363[24],_0x3363[6]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})});describe(_0x3363[33],function(){it(_0x3363[34],function(){expect(routerStub[_0x3363[35]][_0x3363[20]](_0x3363[24],_0x3363[7]))[_0x3363[13]][_0x3363[18]][_0x3363[17]][_0x3363[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var salesforceFieldCtrlStub = { + index: 'salesforceFieldCtrl.index', + show: 'salesforceFieldCtrl.show', + create: 'salesforceFieldCtrl.create', + update: 'salesforceFieldCtrl.update', + destroy: 'salesforceFieldCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var salesforceFieldIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './salesforce_field.controller': salesforceFieldCtrlStub +}); + +describe('SalesforceField API Router:', function() { + + it('should return an express router instance', function() { + expect(salesforceFieldIndex).to.equal(routerStub); + }); + + describe('GET /api/salesforce/fields', function() { + + it('should route to salesforceField.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'salesforceFieldCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/salesforce/fields/:id', function() { + + it('should route to salesforceField.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'salesforceFieldCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/salesforce/fields', function() { + + it('should route to salesforceField.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'salesforceFieldCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/salesforce/fields/:id', function() { + + it('should route to salesforceField.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'salesforceFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/salesforce/fields/:id', function() { + + it('should route to salesforceField.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'salesforceFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/salesforce/fields/:id', function() { + + it('should route to salesforceField.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'salesforceFieldCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/salesforce_field/salesforce_field.controller.js b/server/api/salesforce_field/salesforce_field.controller.js index 7355895..bab61d7 100644 --- a/server/api/salesforce_field/salesforce_field.controller.js +++ b/server/api/salesforce_field/salesforce_field.controller.js @@ -1 +1,104 @@ -var _0x5236=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x5236[0];var _=require(_0x5236[1]);var SalesforceField=require(_0x5236[3])[_0x5236[2]];function handleError(_0xe35ex4,_0xe35ex5){_0xe35ex5=_0xe35ex5||500;return function(_0xe35ex6){_0xe35ex4[_0x5236[5]](_0xe35ex5)[_0x5236[4]](_0xe35ex6)}}function responseWithResult(_0xe35ex4,_0xe35ex5){_0xe35ex5=_0xe35ex5||200;return function(_0xe35ex8){if(_0xe35ex8){_0xe35ex4[_0x5236[5]](_0xe35ex5)[_0x5236[6]](_0xe35ex8)}}}function handleEntityNotFound(_0xe35ex4){return function(_0xe35ex8){if(!_0xe35ex8){_0xe35ex4[_0x5236[5]](404)[_0x5236[7]]();return null};return _0xe35ex8}}function saveUpdates(_0xe35exb){return function(_0xe35ex8){return _0xe35ex8[_0x5236[9]](_0xe35exb)[_0x5236[8]](function(_0xe35exc){return _0xe35exc})}}function removeEntity(_0xe35ex4){return function(_0xe35ex8){if(_0xe35ex8){return _0xe35ex8[_0x5236[10]]()[_0x5236[8]](function(){_0xe35ex4[_0x5236[5]](204)[_0x5236[7]]()})}}}exports[_0x5236[11]]=function(_0xe35exe,_0xe35ex4){SalesforceField[_0x5236[13]]()[_0x5236[8]](responseWithResult(_0xe35ex4))[_0x5236[12]](handleError(_0xe35ex4))};exports[_0x5236[14]]=function(_0xe35exe,_0xe35ex4){SalesforceField[_0x5236[17]](_0xe35exe[_0x5236[16]][_0x5236[15]])[_0x5236[8]](handleEntityNotFound(_0xe35ex4))[_0x5236[8]](responseWithResult(_0xe35ex4))[_0x5236[12]](handleError(_0xe35ex4))};exports[_0x5236[18]]=function(_0xe35exe,_0xe35ex4){SalesforceField[_0x5236[18]](_0xe35exe[_0x5236[19]])[_0x5236[8]](responseWithResult(_0xe35ex4,201))[_0x5236[12]](handleError(_0xe35ex4))};exports[_0x5236[20]]=function(_0xe35exe,_0xe35ex4){if(_0xe35exe[_0x5236[19]][_0x5236[15]]){delete _0xe35exe[_0x5236[19]][_0x5236[15]]};SalesforceField[_0x5236[17]](_0xe35exe[_0x5236[16]][_0x5236[15]])[_0x5236[8]](handleEntityNotFound(_0xe35ex4))[_0x5236[8]](saveUpdates(_0xe35exe[_0x5236[19]]))[_0x5236[8]](responseWithResult(_0xe35ex4))[_0x5236[12]](handleError(_0xe35ex4))};exports[_0x5236[10]]=function(_0xe35exe,_0xe35ex4){SalesforceField[_0x5236[17]](_0xe35exe[_0x5236[16]][_0x5236[15]])[_0x5236[8]](handleEntityNotFound(_0xe35ex4))[_0x5236[8]](removeEntity(_0xe35ex4))[_0x5236[12]](handleError(_0xe35ex4))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/salesforce/fields -> index + * POST /api/salesforce/fields -> create + * GET /api/salesforce/fields/:id -> show + * PUT /api/salesforce/fields/:id -> update + * DELETE /api/salesforce/fields/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var SalesforceField = require('../../models').SalesforceField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SalesforceFields +exports.index = function(req, res) { + SalesforceField.findAll() + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single SalesforceField from the DB +exports.show = function(req, res) { + SalesforceField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SalesforceField in the DB +exports.create = function(req, res) { + SalesforceField.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SalesforceField in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + SalesforceField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SalesforceField from the DB +exports.destroy = function(req, res) { + SalesforceField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/salesforce_field/salesforce_field.socket.js b/server/api/salesforce_field/salesforce_field.socket.js index ae646a2..b3f5775 100644 --- a/server/api/salesforce_field/salesforce_field.socket.js +++ b/server/api/salesforce_field/salesforce_field.socket.js @@ -1 +1,24 @@ -var _0x55ee=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0x55ee[0];var SalesforceField=require(_0x55ee[2])[_0x55ee[1]];exports[_0x55ee[3]]=function(_0xab37x2){SalesforceField[_0x55ee[4]](function(_0xab37x3){onSave(_0xab37x2,_0xab37x3)});SalesforceField[_0x55ee[5]](function(_0xab37x3){onRemove(_0xab37x2,_0xab37x3)})};function onSave(_0xab37x2,_0xab37x3,_0xab37x5){_0xab37x2[_0x55ee[7]](_0x55ee[6],_0xab37x3)}function onRemove(_0xab37x2,_0xab37x3,_0xab37x5){_0xab37x2[_0x55ee[7]](_0x55ee[8],_0xab37x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SalesforceField = require('../../models').SalesforceField; + +exports.register = function(socket) { + SalesforceField.afterCreate(function(doc) { + onSave(socket, doc); + }); + SalesforceField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('salesforce_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('salesforce_field:remove', doc); +} diff --git a/server/api/service/index.js b/server/api/service/index.js index 5cacd6c..c1bf88f 100644 --- a/server/api/service/index.js +++ b/server/api/service/index.js @@ -1 +1,24 @@ -var _0x2be8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x65\x72\x76\x69\x63\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x63\x75\x73\x74\x6F\x6D\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x77\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x2F\x3A\x69\x64\x2F\x63\x75\x73\x74\x6F\x6D\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x73\x65\x72\x76\x69\x63\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x75\x70\x64\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x70\x75\x74","\x75\x70\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x61\x63\x74\x69\x76\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x65\x78\x70\x6F\x72\x74\x73"];_0x2be8[0];var express=require(_0x2be8[1]);var controller=require(_0x2be8[2]);var auth=require(_0x2be8[3]);var router=express.Router();router[_0x2be8[7]](_0x2be8[4],auth[_0x2be8[5]](),controller[_0x2be8[6]]);router[_0x2be8[7]](_0x2be8[8],auth[_0x2be8[5]](),controller[_0x2be8[9]]);router[_0x2be8[7]](_0x2be8[10],auth[_0x2be8[5]](),controller[_0x2be8[11]]);router[_0x2be8[7]](_0x2be8[12],auth[_0x2be8[5]](),controller[_0x2be8[13]]);router[_0x2be8[15]](_0x2be8[4],auth[_0x2be8[5]](),controller[_0x2be8[14]]);router[_0x2be8[15]](_0x2be8[16],auth[_0x2be8[5]](),controller[_0x2be8[17]]);router[_0x2be8[15]](_0x2be8[18],auth[_0x2be8[5]](),controller[_0x2be8[19]]);router[_0x2be8[15]](_0x2be8[10],auth[_0x2be8[5]](),controller[_0x2be8[20]]);router[_0x2be8[22]](_0x2be8[8],auth[_0x2be8[5]](),controller[_0x2be8[21]]);router[_0x2be8[22]](_0x2be8[12],auth[_0x2be8[5]](),controller[_0x2be8[23]]);router[_0x2be8[22]](_0x2be8[18],auth[_0x2be8[5]](),controller[_0x2be8[24]]);router[_0x2be8[26]](_0x2be8[4],auth[_0x2be8[5]](),controller[_0x2be8[25]]);router[_0x2be8[26]](_0x2be8[12],auth[_0x2be8[5]](),controller[_0x2be8[27]]);router[_0x2be8[26]](_0x2be8[8],auth[_0x2be8[5]](),controller[_0x2be8[28]]);module[_0x2be8[29]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./service.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/customfields/:id', auth.isAuthenticated(), controller.showCustomField); +router.get('/:id/customfields', auth.isAuthenticated(), controller.getCustomFields); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.serviceValidation); +router.post('/:id/agents', auth.isAuthenticated(), controller.addAgents); +router.post('/:id/customfields', auth.isAuthenticated(), controller.createCustomField); +router.put('/customfields/:id', auth.isAuthenticated(), controller.updateCustomField); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.put('/:id/agents', auth.isAuthenticated(), controller.removeAgents); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/customfields/:id', auth.isAuthenticated(), controller.deactivateCustomField); + +module.exports = router; diff --git a/server/api/service/service.controller.js b/server/api/service/service.controller.js index 6e1e5bc..bb36742 100644 --- a/server/api/service/service.controller.js +++ b/server/api/service/service.controller.js @@ -1 +1,379 @@ -var _0xc11d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x65\x72\x76\x69\x63\x65","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x6C\x6F\x67","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x70\x64\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x43\x55\x53\x54\x4F\x4D\x5F\x46\x49\x45\x4C\x44","\x62\x6F\x64\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x53\x65\x72\x76\x69\x63\x65\x49\x64","\x63\x72\x65\x61\x74\x65","\x73\x68\x6F\x77","\x73\x65\x72\x76\x69\x63\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x46\x69\x6E\x64\x69\x6E\x67\x20\x61\x70\x70\x20\x72\x6F\x77\x2E\x2E\x2E\x2E\x2E","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x53\x45\x52\x56\x49\x43\x45","\x75\x70\x64\x61\x74\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72\x73","\x6E\x6F\x20\x73\x65\x72\x76\x69\x63\x65\x20\x66\x6F\x75\x6E\x64","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x61\x6C\x6C","\x43\x6F\x6E\x74\x61\x63\x74\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x64\x65\x61\x63\x74\x69\x76\x61\x74\x65\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64"];_0xc11d[0];var _=require(_0xc11d[1]);var util=require(_0xc11d[2]);var User=require(_0xc11d[4])[_0xc11d[3]];var Service=require(_0xc11d[4])[_0xc11d[5]];var UserHasService=require(_0xc11d[4])[_0xc11d[6]];var CustomField=require(_0xc11d[4])[_0xc11d[7]];var Contact=require(_0xc11d[4])[_0xc11d[8]];var Util=require(_0xc11d[9]);exports[_0xc11d[10]]=function(_0x938dx9,_0x938dxa,_0x938dxb){return Service[_0xc11d[17]](Util[_0xc11d[16]](_0x938dx9[_0xc11d[15]]))[_0xc11d[14]](function(_0x938dxd){_0x938dxa[_0xc11d[13]](200)[_0xc11d[12]](_0x938dxd)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[18]]=function(_0x938dx9,_0x938dxa){CustomField[_0xc11d[22]]({where:{ServiceId:_0x938dx9[_0xc11d[21]][_0xc11d[20]],active:true}})[_0xc11d[14]](function(_0x938dxe){return _0x938dxa[_0xc11d[13]](200)[_0xc11d[12]](_0x938dxe)})[_0xc11d[11]](function(_0x938dxc){console[_0xc11d[19]](_0x938dxc);return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[23]]=function(_0x938dx9,_0x938dxa){CustomField[_0xc11d[25]](_0x938dx9[_0xc11d[21]][_0xc11d[20]])[_0xc11d[14]](function(_0x938dxf){if(!_0x938dxf){return _0x938dxa[_0xc11d[24]](404)};return _0x938dxa[_0xc11d[12]](_0x938dxf)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[26]]=function(_0x938dx9,_0x938dxa){CustomField[_0xc11d[22]]({where:{name:_0x938dx9[_0xc11d[29]][_0xc11d[32]],id:{$ne:_0x938dx9[_0xc11d[29]][_0xc11d[20]]}}})[_0xc11d[14]](function(_0x938dxe){if(!_0x938dxe){return _0x938dxa[_0xc11d[24]](404)};if(_0x938dxe[_0xc11d[27]]>0){return _0x938dxa[_0xc11d[13]](500)[_0xc11d[12]]({message:_0xc11d[28]})};if(_0x938dx9[_0xc11d[29]][_0xc11d[20]]){delete _0x938dx9[_0xc11d[29]][_0xc11d[20]]};CustomField[_0xc11d[25]](_0x938dx9[_0xc11d[21]][_0xc11d[20]])[_0xc11d[14]](function(_0x938dxf){if(!_0x938dxf){return _0x938dxa[_0xc11d[24]](404)};var _0x938dx10=_[_0xc11d[30]](_0x938dxf,_0x938dx9[_0xc11d[29]]);_0x938dx10[_0xc11d[31]]()[_0xc11d[14]](function(){return _0x938dxa[_0xc11d[13]](200)[_0xc11d[12]](_0x938dxf)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[33]]=function(_0x938dx9,_0x938dxa){_0x938dx9[_0xc11d[29]][_0xc11d[34]]=_0x938dx9[_0xc11d[21]][_0xc11d[20]];CustomField[_0xc11d[35]](_0x938dx9[_0xc11d[29]])[_0xc11d[14]](function(_0x938dxf){return _0x938dxa[_0xc11d[13]](201)[_0xc11d[12]](_0x938dxf)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[36]]=function(_0x938dx9,_0x938dxa){Service[_0xc11d[25]](_0x938dx9[_0xc11d[21]][_0xc11d[20]])[_0xc11d[14]](function(_0x938dx11){if(!_0x938dx11){return _0x938dxa[_0xc11d[24]](404)};return _0x938dxa[_0xc11d[12]](_0x938dx11)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[37]]=function(_0x938dx9,_0x938dxa){console[_0xc11d[19]](_0x938dx9[_0xc11d[29]]);Service[_0xc11d[22]]({where:{id:_0x938dx9[_0xc11d[29]][_0xc11d[20]]}})[_0xc11d[14]](function(_0x938dx11){if(!_0x938dx11){return _0x938dxa[_0xc11d[24]](404)};return _0x938dxa[_0xc11d[12]](_0x938dx11)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[35]]=function(_0x938dx9,_0x938dxa){Service[_0xc11d[22]]({where:{name:_0x938dx9[_0xc11d[29]][_0xc11d[32]]}})[_0xc11d[14]](function(_0x938dx12){console[_0xc11d[19]](_0x938dx12);console[_0xc11d[19]](_0xc11d[38]);if(!_0x938dx12){return _0x938dxa[_0xc11d[24]](404)};if(_0x938dx12[_0xc11d[27]]>0){return _0x938dxa[_0xc11d[13]](500)[_0xc11d[12]]({message:_0xc11d[39]})};Service[_0xc11d[35]](_0x938dx9[_0xc11d[29]])[_0xc11d[14]](function(_0x938dx11){return _0x938dxa[_0xc11d[13]](201)[_0xc11d[12]](_0x938dx11)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[40]]=function(_0x938dx9,_0x938dxa){Service[_0xc11d[22]]({where:{name:_0x938dx9[_0xc11d[29]][_0xc11d[32]]}})[_0xc11d[14]](function(_0x938dx12){console[_0xc11d[19]](_0x938dx12);console[_0xc11d[19]](_0xc11d[38]);if(!_0x938dx12){return _0x938dxa[_0xc11d[24]](404)};if(_0x938dx12[_0xc11d[27]]>0){return _0x938dxa[_0xc11d[13]](500)[_0xc11d[12]]({message:_0xc11d[39]})};return Service[_0xc11d[25]](_0x938dx9[_0xc11d[21]][_0xc11d[20]])})[_0xc11d[14]](function(_0x938dx11){if(!_0x938dx11){return _0x938dxa[_0xc11d[24]](404)};if(_0x938dx9[_0xc11d[29]][_0xc11d[20]]){delete _0x938dx9[_0xc11d[29]][_0xc11d[20]]};var _0x938dx10=_[_0xc11d[30]](_0x938dx11,_0x938dx9[_0xc11d[29]]);return _0x938dx10[_0xc11d[31]]()})[_0xc11d[14]](function(_0x938dx11){return _0x938dxa[_0xc11d[13]](200)[_0xc11d[12]](_0x938dx11)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};exports[_0xc11d[41]]=function(_0x938dx9,_0x938dxa,_0x938dxb){console[_0xc11d[19]](_0xc11d[41]);console[_0xc11d[19]](_0x938dx9[_0xc11d[21]]);console[_0xc11d[19]](_0x938dx9[_0xc11d[29]]);User[_0xc11d[22]]({where:{id:{$in:_0x938dx9[_0xc11d[29]][_0xc11d[44]]}}})[_0xc11d[14]](function(_0x938dx13){var _0x938dx14=_[_0xc11d[42]](_0x938dx13,function(_0x938dx15){return {service:_0x938dx9[_0xc11d[21]][_0xc11d[20]],membername:_0x938dx15[_0xc11d[32]],UserId:_0x938dx15[_0xc11d[20]]}});UserHasService[_0xc11d[43]](_0x938dx14,{individualHooks:true})[_0xc11d[14]](function(){return _0x938dxa[_0xc11d[24]](200)})[_0xc11d[11]](function(_0x938dxc){return _0x938dxb(_0x938dxc)})})[_0xc11d[11]](function(_0x938dxc){return _0x938dxb(_0x938dxc)})};exports[_0xc11d[45]]=function(_0x938dx9,_0x938dxa,_0x938dxb){Service[_0xc11d[48]]({where:{id:_0x938dx9[_0xc11d[21]][_0xc11d[20]]}})[_0xc11d[14]](function(_0x938dx11){if(_0x938dx11){_0x938dx11[_0xc11d[46]](_0x938dx9[_0xc11d[29]][_0xc11d[44]],{individualHooks:true})[_0xc11d[14]](function(){return _0x938dxa[_0xc11d[24]](200)})[_0xc11d[11]](function(_0x938dxc){return _0x938dxb(_0x938dxc)})}else {return _0x938dxb( new Error(_0xc11d[47]))}})[_0xc11d[11]](function(_0x938dxc){return _0x938dxb(_0x938dxc)})};exports[_0xc11d[49]]=function(_0x938dx9,_0x938dxa){destroyService(_0x938dx9[_0xc11d[21]][_0xc11d[20]],_0x938dxa)};exports[_0xc11d[50]]=function(_0x938dx9,_0x938dxa){destroyService(_0x938dx9[_0xc11d[15]][_0xc11d[20]],_0x938dxa)};function destroyService(_0x938dx17,_0x938dxa){return delOrUpdateCf(_0x938dx17)[_0xc11d[51]]()[_0xc11d[14]](function(){return Service[_0xc11d[49]]({where:{id:_0x938dx17},individualHooks:true})})[_0xc11d[14]](function(){return _0x938dxa[_0xc11d[24]](204)})[_0xc11d[11]](function(_0x938dxc){console[_0xc11d[19]](_0x938dxc);return handleError(_0x938dxa,_0x938dxc)})}function delOrUpdateCf(_0x938dx17){return CustomField[_0xc11d[22]]({where:{ServiceId:_0x938dx17},include:[{model:Contact}]})[_0xc11d[14]](function(_0x938dxe){console[_0xc11d[19]](_0x938dxe[_0xc11d[27]]);var _0x938dx19=[];_[_0xc11d[54]](_0x938dxe,function(_0x938dx1a){if(_0x938dx1a[_0xc11d[52]][_0xc11d[27]]){_0x938dx19[_0xc11d[53]](_0x938dx1a[_0xc11d[40]]({active:false}))}else {_0x938dx19[_0xc11d[53]](_0x938dx1a[_0xc11d[49]]())}});return _0x938dx19})}exports[_0xc11d[55]]=function(_0x938dx9,_0x938dxa){CustomField[_0xc11d[25]](_0x938dx9[_0xc11d[21]][_0xc11d[20]],{include:[{model:Contact}]})[_0xc11d[14]](function(_0x938dxf){if(!_0x938dxf){return _0x938dxa[_0xc11d[24]](404)};if(_0x938dxf[_0xc11d[52]][_0xc11d[27]]){return _0x938dxf[_0xc11d[40]]({active:false})}else {return _0x938dxf[_0xc11d[49]]()}})[_0xc11d[14]](function(){return _0x938dxa[_0xc11d[24]](204)})[_0xc11d[11]](function(_0x938dxc){return handleError(_0x938dxa,_0x938dxc)})};function handleError(_0x938dxa,_0x938dxc){return _0x938dxa[_0xc11d[13]](500)[_0xc11d[12]](_0x938dxc)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); + +var User = require('../../models').User; +var Service = require('../../models').Service; +var UserHasService = require('../../models').UserHasService; +var CustomField = require('../../models').CustomField; +var Contact = require('../../models').Contact; +var Util = require('../../config/util'); + +// Get list of services +exports.index = function(req, res, next) { + return Service + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get all custom_fields +exports.getCustomFields = function(req, res) { + CustomField + .findAll({ + where: { + ServiceId: req.params.id, + active: true + } + }) + .then(function(customFields) { + return res.status(200).send(customFields); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.showCustomField = function(req, res) { + CustomField + .findById(req.params.id) + .then(function(customField) { + if (!customField) { + return res.sendStatus(404); + } + return res.send(customField); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.updateCustomField = function(req, res) { + CustomField + .findAll({ + where: { + name: req.body.name, + id: { + $ne: req.body.id + } + } + }) + .then(function(customFields) { + if (!customFields) { + return res.sendStatus(404); + } + if (customFields.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_CUSTOM_FIELD' + }) + } + if (req.body.id) { + delete req.body.id; + } + CustomField + .findById(req.params.id) + .then(function(customField) { + if (!customField) { + return res.sendStatus(404); + } + var updated = _.merge(customField, req.body); + updated.save() + .then(function() { + return res.status(200).send(customField); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.createCustomField = function(req, res) { + req.body.ServiceId = req.params.id; + CustomField + .create(req.body) + .then(function(customField) { + return res.status(201).send(customField); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single service +exports.show = function(req, res) { + Service + .findById(req.params.id) + .then(function(service) { + if (!service) { + return res.sendStatus(404); + } + return res.send(service); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Validate the existence of a service +exports.serviceValidation = function(req, res) { + console.log(req.body); + Service + .findAll({ + where: { + id: req.body.id + } + }) + .then(function(service) { + if (!service) { + return res.sendStatus(404); + } + return res.send(service); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new service in the DB. +exports.create = function(req, res) { + Service + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(existingServices) { + console.log(existingServices); + console.log('Finding app row.....'); + if (!existingServices) { + return res.sendStatus(404); + } + if (existingServices.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_SERVICE' + }); + } + Service + .create(req.body) + .then(function(service) { + return res.status(201).send(service); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing service in the DB. +exports.update = function(req, res) { + Service + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(existingServices) { + console.log(existingServices); + console.log('Finding app row.....'); + if (!existingServices) { + return res.sendStatus(404); + } + if (existingServices.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_SERVICE' + }); + } + return Service + .findById(req.params.id); + }) + .then(function(service) { + if (!service) { + return res.sendStatus(404); + } + if (req.body.id) { + delete req.body.id; + } + var updated = _.merge(service, req.body); + return updated.save(); + }) + .then(function(service) { + return res.status(200).send(service); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + + +// Updates an existing user_has_service in the DB. +exports.addAgents = function(req, res, next) { + + console.log('addAgents'); + console.log(req.params); + console.log(req.body); + User + .findAll({ + where: { + id: { + $in: req.body.agents + } + } + }) + .then(function(users) { + // console.log(users); + var userHasServices = _.map(users, function(user) { + return { + service: req.params.id, + membername: user.name, + UserId: user.id + }; + }); + + UserHasService + .bulkCreate(userHasServices, { + individualHooks: true + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return next(err); + }); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.removeAgents = function(req, res, next) { + Service + .find({ + where: { + id: req.params.id + } + }) + .then(function(service) { + if (service) { + // SERVICE FOUND + // REMOVE AGENTS + service + .removeUsers(req.body.agents, { + individualHooks: true + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return next(err); + }); + } else { + return next(new Error('no service found')); + } + }) + .catch(function(err) { + return next(err); + }); +}; + +// Deletes a service from the DB. +exports.destroy = function(req, res) { + destroyService(req.params.id, res); +}; + +// Deletes multiple services from the DB. +exports.bulkDestroy = function(req, res) { //add the check for associated contacts + destroyService(req.query.id, res); +}; + +function destroyService(id, res) { + return delOrUpdateCf(id) + .all() + .then(function() { + return Service.destroy({ + where: { + id: id + }, + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + +function delOrUpdateCf(id) { + return CustomField.findAll({ + where: { + ServiceId: id + }, + include: [{ + model: Contact + }] + }) + .then(function(customFields) { + console.log(customFields.length); + var delOrDeact = []; + _.forEach(customFields, function(elem) { + if (elem.Contacts.length) { + delOrDeact.push(elem.update({ + active: false + })); + } else { + delOrDeact.push(elem.destroy()); + } + }); + return delOrDeact; + }) +} + +exports.deactivateCustomField = function(req, res) { + CustomField + .findById(req.params.id, { + include: [{ + model: Contact + }] + }) + .then(function(customField) { + if (!customField) { + return res.sendStatus(404); + } + if (customField.Contacts.length) { + return customField.update({ + active: false + }); + } else { + return customField.destroy(); + } + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/service/service.socket.js b/server/api/service/service.socket.js index 950a8f8..981784a 100644 --- a/server/api/service/service.socket.js +++ b/server/api/service/service.socket.js @@ -1 +1,33 @@ -var _0x3451=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x72\x65\x67\x69\x73\x74\x65\x72","\x73\x65\x72\x76\x69\x63\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x63\x75\x73\x74\x6F\x6D\x5F\x66\x69\x65\x6C\x64","\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x3A\x72\x65\x6D\x6F\x76\x65"];_0x3451[0];var Service=require(_0x3451[2])[_0x3451[1]];var CustomField=require(_0x3451[2])[_0x3451[3]];exports[_0x3451[4]]=function(_0x811dx3){Service[_0x3451[6]](function(_0x811dx4){onSave(_0x811dx3,_0x811dx4,_0x3451[5])});Service[_0x3451[9]](function(_0x811dx4){console[_0x3451[8]](_0x3451[7]);onRemove(_0x811dx3,_0x811dx4,_0x3451[5])});CustomField[_0x3451[6]](function(_0x811dx4){onSave(_0x811dx3,_0x811dx4,_0x3451[10])});CustomField[_0x3451[9]](function(_0x811dx4){onRemove(_0x811dx3,_0x811dx4,_0x3451[10])})};function onSave(_0x811dx3,_0x811dx4,_0x811dx6,_0x811dx7){_0x811dx3[_0x3451[12]](_0x811dx6+_0x3451[11],_0x811dx4)}function onRemove(_0x811dx3,_0x811dx4,_0x811dx6,_0x811dx7){console[_0x3451[8]](_0x811dx6);_0x811dx3[_0x3451[12]](_0x811dx6+_0x3451[13],_0x811dx4)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Service = require('../../models').Service; +var CustomField = require('../../models').CustomField; + +exports.register = function(socket) { + Service.afterCreate(function(doc) { + onSave(socket, doc, 'service'); + }); + Service.afterDestroy(function(doc) { + console.log('destroy'); + onRemove(socket, doc, 'service'); + }); + CustomField.afterCreate(function(doc) { + onSave(socket, doc, 'custom_field'); + }); + CustomField.afterDestroy(function(doc) { + onRemove(socket, doc, 'custom_field'); + }); +} + +function onSave(socket, doc, type, cb) { + socket.emit(type + ':save', doc); +} + +function onRemove(socket, doc, type, cb) { + console.log(type); + socket.emit(type + ':remove', doc); +} diff --git a/server/api/service/service.spec.js b/server/api/service/service.spec.js index 25db25a..7d84147 100644 --- a/server/api/service/service.spec.js +++ b/server/api/service/service.spec.js @@ -1 +1,20 @@ -var _0x78aa=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x73\x65\x72\x76\x69\x63\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x73\x65\x72\x76\x69\x63\x65\x73","\x67\x65\x74"];_0x78aa[0];var should=require(_0x78aa[1]);var app=require(_0x78aa[2]);var request=require(_0x78aa[3]);describe(_0x78aa[4],function(){it(_0x78aa[5],function(_0xee45x4){request(app)[_0x78aa[13]](_0x78aa[12])[_0x78aa[11]](200)[_0x78aa[11]](_0x78aa[10],/json/)[_0x78aa[9]](function(_0xee45x5,_0xee45x6){if(_0xee45x5){return _0xee45x4(_0xee45x5)};_0xee45x6[_0x78aa[8]][_0x78aa[1]][_0x78aa[7]][_0x78aa[6]](Array);_0xee45x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/contactmanager/services', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/contactmanager/services') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a16d57d..e30286b 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -1 +1,19 @@ -var _0x15e9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x65\x74\x74\x69\x6E\x67\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x2F\x6D\x61\x69\x6C\x62\x6F\x78","\x67\x65\x74\x4D\x61\x69\x6C\x62\x6F\x78","\x2F\x69\x6E\x66\x6F","\x67\x65\x74\x49\x6E\x66\x6F","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x15e9[0];var express=require(_0x15e9[1]);var controller=require(_0x15e9[2]);var auth=require(_0x15e9[3]);var router=express.Router();router[_0x15e9[7]](_0x15e9[4],auth[_0x15e9[5]](),controller[_0x15e9[6]]);router[_0x15e9[7]](_0x15e9[8],auth[_0x15e9[5]](),controller[_0x15e9[9]]);router[_0x15e9[7]](_0x15e9[10],auth[_0x15e9[5]](),controller[_0x15e9[11]]);router[_0x15e9[7]](_0x15e9[12],controller[_0x15e9[13]]);router[_0x15e9[7]](_0x15e9[14],auth[_0x15e9[5]](),controller[_0x15e9[15]]);router[_0x15e9[17]](_0x15e9[4],auth[_0x15e9[5]](),controller[_0x15e9[16]]);router[_0x15e9[19]](_0x15e9[14],auth[_0x15e9[5]](),controller[_0x15e9[18]]);router[_0x15e9[20]](_0x15e9[14],auth[_0x15e9[5]](),controller[_0x15e9[18]]);router[_0x15e9[22]](_0x15e9[14],auth[_0x15e9[5]](),controller[_0x15e9[21]]);module[_0x15e9[23]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./setting.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/internal', auth.isAuthenticated(), controller.getInternal); +router.get('/mailbox', auth.isAuthenticated(), controller.getMailbox); +router.get('/info', controller.getInfo); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b2b2657..6c2943d 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -1 +1,172 @@ -var _0xa74c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x76\x61\x6C\x75\x65","\x6D\x69\x6E\x5F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x61\x78","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x4D\x61\x69\x6C\x62\x6F\x78","\x6C\x6F\x67","\x6D\x69\x6E\x5F\x6D\x61\x69\x6C\x62\x6F\x78","\x6D\x61\x69\x6C\x62\x6F\x78","\x67\x65\x74\x49\x6E\x66\x6F","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x70\x61\x63\x6B\x61\x67\x65\x2E\x6A\x73\x6F\x6E","\x6E\x61\x6D\x65","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65\x73","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0xa74c[0];var _=require(_0xa74c[1]);var Settings=require(_0xa74c[3])[_0xa74c[2]];var Agent=require(_0xa74c[3])[_0xa74c[4]];var VoiceMail=require(_0xa74c[3])[_0xa74c[5]];exports[_0xa74c[6]]=function(_0x6627x5,_0x6627x6){return Settings[_0xa74c[11]]()[_0xa74c[10]](function(_0x6627x8){return _0x6627x6[_0xa74c[9]](200)[_0xa74c[8]](_0x6627x8)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[12]]=function(_0x6627x5,_0x6627x6){var _0x6627x9;return Settings[_0xa74c[17]](1)[_0xa74c[10]](function(_0x6627x8){_0x6627x9=_0x6627x8;return Agent[_0xa74c[16]](_0xa74c[15])})[_0xa74c[10]](function(_0x6627xa){var _0x6627xb={value:0};if(_0x6627xa){_0x6627xb[_0xa74c[13]]= ++_0x6627xa}else {_0x6627xb[_0xa74c[13]]=_0x6627x9[_0xa74c[14]]};return _0x6627x6[_0xa74c[9]](200)[_0xa74c[8]](_0x6627xb)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[18]]=function(_0x6627x5,_0x6627x6){var _0x6627x9;return Settings[_0xa74c[17]](1)[_0xa74c[10]](function(_0x6627x8){_0x6627x9=_0x6627x8;return VoiceMail[_0xa74c[16]](_0xa74c[21])})[_0xa74c[10]](function(_0x6627xc){var _0x6627xd={value:0};if(_0x6627xc){_0x6627xd[_0xa74c[13]]= ++_0x6627xc}else {_0x6627xd[_0xa74c[13]]=_0x6627x9[_0xa74c[20]]};return _0x6627x6[_0xa74c[9]](200)[_0xa74c[8]](_0x6627xd)})[_0xa74c[7]](function(_0x6627x7){console[_0xa74c[19]](_0x6627x7);return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[22]]=function(_0x6627x5,_0x6627x6){var _0x6627xe=require(_0xa74c[23]);return _0x6627x6[_0xa74c[9]](200)[_0xa74c[8]]({name:_0x6627xe[_0xa74c[24]],version:_0x6627xe[_0xa74c[25]],engines:_0x6627xe[_0xa74c[26]]})};exports[_0xa74c[27]]=function(_0x6627x5,_0x6627x6){Settings[_0xa74c[17]](_0x6627x5[_0xa74c[30]][_0xa74c[29]])[_0xa74c[10]](function(_0x6627xf){if(!_0x6627xf){return _0x6627x6[_0xa74c[28]](404)};return _0x6627x6[_0xa74c[8]](_0x6627xf)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[31]]=function(_0x6627x5,_0x6627x6){Settings[_0xa74c[31]](_0x6627x5[_0xa74c[32]])[_0xa74c[10]](function(_0x6627xf){return _0x6627x6[_0xa74c[9]](201)[_0xa74c[8]](_0x6627xf)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[33]]=function(_0x6627x5,_0x6627x6){if(_0x6627x5[_0xa74c[32]][_0xa74c[29]]){delete _0x6627x5[_0xa74c[32]][_0xa74c[29]]};Settings[_0xa74c[36]]({where:{id:_0x6627x5[_0xa74c[30]][_0xa74c[29]]}})[_0xa74c[10]](function(_0x6627xf){if(!_0x6627xf){return _0x6627x6[_0xa74c[28]](404)};var _0x6627x10=_[_0xa74c[34]](_0x6627xf,_0x6627x5[_0xa74c[32]]);_0x6627x10[_0xa74c[35]]()[_0xa74c[10]](function(){return _0x6627x6[_0xa74c[9]](200)[_0xa74c[8]](_0x6627xf)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};exports[_0xa74c[37]]=function(_0x6627x5,_0x6627x6){Settings[_0xa74c[36]]({where:{id:_0x6627x5[_0xa74c[30]][_0xa74c[29]]}})[_0xa74c[10]](function(_0x6627xf){if(!_0x6627xf){return _0x6627x6[_0xa74c[28]](404)};_0x6627xf[_0xa74c[37]]()[_0xa74c[10]](function(){return _0x6627x6[_0xa74c[28]](204)})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})})[_0xa74c[7]](function(_0x6627x7){return handleError(_0x6627x6,_0x6627x7)})};function handleError(_0x6627x6,_0x6627x7){return _0x6627x6[_0xa74c[9]](500)[_0xa74c[8]](_0x6627x7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Settings = require('../../models').Settings; +var Agent = require('../../models').User; +var VoiceMail = require('../../models').VoiceVoicemail; + +// Get list of settings +exports.index = function(req, res) { + return Settings + .findAll() + .then(function(settings) { + return res.status(200).send(settings); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get internal +exports.getInternal = function(req, res) { + var _settings; + return Settings + .findById(1) + .then(function(settings) { + _settings = settings; + return Agent + .max('internal'); + }) + .then(function(internal) { + var _internal = { + value: 0 + }; + + if (internal) { + _internal.value = ++internal; + } else { + _internal.value = _settings.min_internal; + } + + return res.status(200).send(_internal); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get internal +exports.getMailbox = function(req, res) { + var _settings; + return Settings + .findById(1) + .then(function(settings) { + _settings = settings; + return VoiceMail + .max('mailbox'); + }) + .then(function(mailbox) { + var _mailbox = { + value: 0 + }; + + if (mailbox) { + _mailbox.value = ++mailbox; + } else { + _mailbox.value = _settings.min_mailbox; + } + + return res.status(200).send(_mailbox); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get list of settings +exports.getInfo = function(req, res) { + + var info = require('../../../package.json'); + + return res.status(200).send({ + name: info.name, + version: info.version, + engines: info.engines + }); +}; + +// Get a single setting +exports.show = function(req, res) { + Settings + .findById(req.params.id) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + return res.send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new setting in the DB. +exports.create = function(req, res) { + Settings + .create(req.body) + .then(function(setting) { + return res.status(201).send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing setting in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Settings + .find({ + where: { + id: req.params.id + } + }) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + var updated = _.merge(setting, req.body); + updated.save() + .then(function() { + return res.status(200).send(setting); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a setting from the DB. +exports.destroy = function(req, res) { + Settings + .find({ + where: { + id: req.params.id + } + }) + .then(function(setting) { + if (!setting) { + return res.sendStatus(404); + } + setting.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/setting/setting.socket.js b/server/api/setting/setting.socket.js index 2dcd5c3..611827e 100644 --- a/server/api/setting/setting.socket.js +++ b/server/api/setting/setting.socket.js @@ -1 +1,24 @@ -var _0x8747=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x74\x74\x69\x6E\x67\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x65\x74\x74\x69\x6E\x67\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8747[0];var Settings=require(_0x8747[2])[_0x8747[1]];exports[_0x8747[3]]=function(_0x35e0x2){Settings[_0x8747[4]](function(_0x35e0x3){onSave(_0x35e0x2,_0x35e0x3)});Settings[_0x8747[5]](function(_0x35e0x3){onRemove(_0x35e0x2,_0x35e0x3)})};function onSave(_0x35e0x2,_0x35e0x3,_0x35e0x5){_0x35e0x2[_0x8747[7]](_0x8747[6],_0x35e0x3)}function onRemove(_0x35e0x2,_0x35e0x3,_0x35e0x5){_0x35e0x2[_0x8747[7]](_0x8747[8],_0x35e0x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Settings = require('../../models').Settings; + +exports.register = function(socket) { + Settings.afterCreate(function(doc) { + onSave(socket, doc); + }); + Settings.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('setting:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('setting:remove', doc); +} diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 194292b..4ade980 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -1 +1,18 @@ -var _0x12e2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x6F\x75\x6E\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x2F\x3A\x69\x64\x2F\x73\x74\x72\x65\x61\x6D","\x73\x74\x72\x65\x61\x6D","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x12e2[0];var express=require(_0x12e2[1]);var controller=require(_0x12e2[2]);var auth=require(_0x12e2[3]);var router=express.Router();router[_0x12e2[7]](_0x12e2[4],auth[_0x12e2[5]](),controller[_0x12e2[6]]);router[_0x12e2[7]](_0x12e2[8],auth[_0x12e2[5]](),controller[_0x12e2[9]]);router[_0x12e2[7]](_0x12e2[10],auth[_0x12e2[5]](),controller[_0x12e2[11]]);router[_0x12e2[7]](_0x12e2[12],auth[_0x12e2[5]](),controller[_0x12e2[13]]);router[_0x12e2[15]](_0x12e2[4],auth[_0x12e2[5]](),controller[_0x12e2[14]]);router[_0x12e2[17]](_0x12e2[8],auth[_0x12e2[5]](),controller[_0x12e2[16]]);router[_0x12e2[18]](_0x12e2[8],auth[_0x12e2[5]](),controller[_0x12e2[16]]);router[_0x12e2[20]](_0x12e2[8],auth[_0x12e2[5]](),controller[_0x12e2[19]]);module[_0x12e2[21]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./sound.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/download', auth.isAuthenticated(), controller.download); +router.get('/:id/stream', auth.isAuthenticated(), controller.stream); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b624d91..335d2c9 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -1 +1,266 @@ -var _0xf4a5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x6F\x75\x6E\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x73\x6F\x78","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x66\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x62\x6C\x75\x65\x62\x69\x72\x64","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x53\x6F\x75\x6E\x64\x73","\x6A\x6F\x69\x6E","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x77\x61\x76\x2C\x6D\x70\x33\x2C\x67\x73\x6D\x2C\x20\x61\x6E\x64\x20\x6F\x67\x67\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x54\x68\x65\x20\x6D\x61\x78\x69\x6D\x75\x6D\x20\x66\x69\x6C\x65\x20\x73\x69\x7A\x65\x20\x69\x73\x20\x31\x35\x20\x4D\x62","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x66\x6F\x72\x6D\x61\x74","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x66\x6F\x72\x6D\x61\x74","\x77\x61\x76","\x6E\x61\x6D\x65","\x64\x69\x73\x70\x6C\x61\x79\x5F\x6E\x61\x6D\x65","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x73\x61\x76\x65\x5F\x6E\x61\x6D\x65","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x53\x6F\x75\x6E\x64\x73","\x2E","\x30\x37\x37\x37","\x63\x68\x6D\x6F\x64\x53\x79\x6E\x63","\x69\x64\x65\x6E\x74\x69\x66\x79","\x74\x72\x61\x6E\x73\x63\x6F\x64\x65","\x65\x72\x72\x6F\x72","\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x20\x43\x6F\x6E\x76\x65\x72\x73\x69\x6F\x6E\x20\x45\x72\x72\x6F\x72\x3A\x20","\x75\x6E\x6C\x69\x6E\x6B","\x6F\x6E","\x70\x72\x6F\x67\x72\x65\x73\x73","\x73\x72\x63","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x64\x75\x72\x61\x74\x69\x6F\x6E","\x64\x75\x72\x61\x74\x69\x6F\x6E","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x73\x61\x6D\x70\x6C\x65\x43\x6F\x75\x6E\x74","\x73\x61\x6D\x70\x6C\x65\x43\x6F\x75\x6E\x74","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x63\x68\x61\x6E\x6E\x65\x6C\x43\x6F\x75\x6E\x74","\x63\x68\x61\x6E\x6E\x65\x6C\x43\x6F\x75\x6E\x74","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x62\x69\x74\x52\x61\x74\x65","\x62\x69\x74\x52\x61\x74\x65","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x5F\x73\x61\x6D\x70\x6C\x65\x52\x61\x74\x65","\x73\x61\x6D\x70\x6C\x65\x52\x61\x74\x65","\x64\x65\x73\x74","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x64\x75\x72\x61\x74\x69\x6F\x6E","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x73\x61\x6D\x70\x6C\x65\x43\x6F\x75\x6E\x74","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x63\x68\x61\x6E\x6E\x65\x6C\x43\x6F\x75\x6E\x74","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x62\x69\x74\x52\x61\x74\x65","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x5F\x73\x61\x6D\x70\x6C\x65\x52\x61\x74\x65","\x43\x6F\x6E\x76\x65\x72\x73\x69\x6F\x6E\x20\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x6C\x6F\x67","\x73\x74\x61\x72\x74","\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x20\x55\x70\x6C\x6F\x61\x64\x20\x65\x72\x72\x6F\x72\x20\x3A","\x70\x61\x72\x73\x65","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x6F\x72\x69\x67\x69\x6E\x61\x6C","\x73\x74\x72\x65\x61\x6D","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x62\x61\x73\x65\x36\x34","\x62\x69\x6E\x61\x72\x79","\x72\x65\x61\x64\x46\x69\x6C\x65","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x53\x6F\x75\x6E\x64\x73","\x5F\x66\x6F\x72\x6D\x61\x74"];_0xf4a5[0];var _=require(_0xf4a5[1]);var Sound=require(_0xf4a5[3])[_0xf4a5[2]];var uploadFile=require(_0xf4a5[4]);var sr=require(_0xf4a5[5]);var sox=require(_0xf4a5[6]);var path=require(_0xf4a5[7]);var config=require(_0xf4a5[8]);var fs=require(_0xf4a5[9]);var sequelize=require(_0xf4a5[3])[_0xf4a5[10]];var base64=require(_0xf4a5[11]);var Promise=require(_0xf4a5[12]);exports[_0xf4a5[13]]=function(_0x6195xc,_0x6195xd){Sound[_0xf4a5[18]]()[_0xf4a5[17]](function(_0x6195xf){return _0x6195xd[_0xf4a5[16]](200)[_0xf4a5[15]](_0x6195xf)})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})};exports[_0xf4a5[19]]=function(_0x6195xc,_0x6195xd){Sound[_0xf4a5[23]](_0x6195xc[_0xf4a5[22]][_0xf4a5[21]])[_0xf4a5[17]](function(Sound){if(!Sound){return _0x6195xd[_0xf4a5[20]](404)};return _0x6195xd[_0xf4a5[15]](Sound)})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})};exports[_0xf4a5[24]]=function(_0x6195xc,_0x6195xd){var _0x6195x10= new uploadFile({dest:path[_0xf4a5[26]](config[_0xf4a5[25]]),maxFileSize:15*1000000,maxNumberOfFiles:10,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(wav|mp3|gsm|ogg)$/i,rename:function(_0x6195x11,_0x6195x12){return sr()+path[_0xf4a5[28]](_0x6195x12[_0xf4a5[27]])},messages:{maxNumberOfFiles:_0xf4a5[29],acceptFileTypes:_0xf4a5[30],maxFileSize:_0xf4a5[31],invalidRequest:_0xf4a5[32]}});_0x6195x10[_0xf4a5[54]](_0xf4a5[33],function(_0x6195x13,_0x6195x14){if(!_0x6195x14[_0xf4a5[34]][_0xf4a5[27]]){return _0x6195xd[_0xf4a5[16]](500)[_0xf4a5[15]](_0x6195x10)};var _0x6195x15={};var _0x6195x16=path[_0xf4a5[28]](_0x6195x14[_0xf4a5[34]][_0xf4a5[27]]);_0x6195x15[_0xf4a5[35]]=_0xf4a5[36];_0x6195x15[_0xf4a5[37]]=path[_0xf4a5[28]](_0x6195x14[_0xf4a5[34]][_0xf4a5[27]])[_0xf4a5[38]](1);_0x6195x15[_0xf4a5[39]]=_0xf4a5[40];_0x6195x15[_0xf4a5[41]]=_0x6195x15[_0xf4a5[42]]=path[_0xf4a5[43]](_0x6195x14[_0xf4a5[34]][_0xf4a5[7]],_0x6195x16);_0x6195x15[_0xf4a5[44]]=path[_0xf4a5[43]](_0x6195x14[_0xf4a5[34]][_0xf4a5[27]],_0x6195x16);var _0x6195x17=path[_0xf4a5[26]](config[_0xf4a5[25]],_0x6195x15[_0xf4a5[44]]+_0x6195x16);var _0x6195x18=path[_0xf4a5[26]](config[_0xf4a5[45]],_0x6195x15[_0xf4a5[44]]+_0xf4a5[46]+_0x6195x15[_0xf4a5[39]]);fs[_0xf4a5[48]](_0x6195x17,parseInt(_0xf4a5[47],8));sox[_0xf4a5[49]](_0x6195x17,function(_0x6195xe,_0x6195x19){});var _0x6195x1a=sox[_0xf4a5[50]](_0x6195x17,_0x6195x18,{sampleRate:8000,format:_0xf4a5[40],channelCount:1,bitRate:192*1024,compressionQuality:5});_0x6195x1a[_0xf4a5[54]](_0xf4a5[51],function(_0x6195xe){console[_0xf4a5[51]](_0xf4a5[52],_0x6195xe);fs[_0xf4a5[53]](_0x6195x17,function(_0x6195xe){if(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)}});return handleError(_0x6195xd,_0x6195xe)});_0x6195x1a[_0xf4a5[54]](_0xf4a5[55],function(_0x6195x1b,_0x6195x1c){});_0x6195x1a[_0xf4a5[54]](_0xf4a5[56],function(_0x6195x1d){_0x6195x15[_0xf4a5[57]]=isNaN(_0x6195x1d[_0xf4a5[58]])?null:_0x6195x1d[_0xf4a5[58]]*1000;_0x6195x15[_0xf4a5[59]]=isNaN(_0x6195x1d[_0xf4a5[60]])?null:_0x6195x1d[_0xf4a5[60]];_0x6195x15[_0xf4a5[61]]=isNaN(_0x6195x1d[_0xf4a5[62]])?null:_0x6195x1d[_0xf4a5[62]];_0x6195x15[_0xf4a5[63]]=isNaN(_0x6195x1d[_0xf4a5[64]])?null:_0x6195x1d[_0xf4a5[64]];_0x6195x15[_0xf4a5[65]]=isNaN(_0x6195x1d[_0xf4a5[66]])?null:_0x6195x1d[_0xf4a5[66]]});_0x6195x1a[_0xf4a5[54]](_0xf4a5[67],function(_0x6195x1d){_0x6195x15[_0xf4a5[68]]=isNaN(_0x6195x1d[_0xf4a5[58]])?null:_0x6195x1d[_0xf4a5[58]]*1000;_0x6195x15[_0xf4a5[69]]=isNaN(_0x6195x1d[_0xf4a5[60]])?null:_0x6195x1d[_0xf4a5[60]];_0x6195x15[_0xf4a5[70]]=isNaN(_0x6195x1d[_0xf4a5[62]])?null:_0x6195x1d[_0xf4a5[62]];_0x6195x15[_0xf4a5[71]]=isNaN(_0x6195x1d[_0xf4a5[64]])?null:_0x6195x1d[_0xf4a5[64]];_0x6195x15[_0xf4a5[72]]=isNaN(_0x6195x1d[_0xf4a5[66]])?null:_0x6195x1d[_0xf4a5[66]]});_0x6195x1a[_0xf4a5[54]](_0xf4a5[33],function(){console[_0xf4a5[74]](_0xf4a5[73]);fs[_0xf4a5[48]](_0x6195x18,parseInt(_0xf4a5[47],8));Sound[_0xf4a5[24]](_0x6195x15)[_0xf4a5[17]](function(_0x6195x1e){return _0x6195xd[_0xf4a5[16]](201)[_0xf4a5[15]](_0x6195x1e)})[_0xf4a5[14]](function(_0x6195xe){console[_0xf4a5[74]](_0x6195xe);return handleError(_0x6195xd,_0x6195xe)})});_0x6195x1a[_0xf4a5[75]]()});_0x6195x10[_0xf4a5[54]](_0xf4a5[51],function(_0x6195xe){console[_0xf4a5[74]](_0xf4a5[76],_0x6195xe);return handleError(_0x6195xd,_0x6195xe)});_0x6195x10[_0xf4a5[77]](_0x6195xc)};exports[_0xf4a5[78]]=function(_0x6195xc,_0x6195xd){if(_0x6195xc[_0xf4a5[79]][_0xf4a5[21]]){delete _0x6195xc[_0xf4a5[79]][_0xf4a5[21]]};Sound[_0xf4a5[23]](_0x6195xc[_0xf4a5[22]][_0xf4a5[21]])[_0xf4a5[17]](function(_0x6195x1e){if(!_0x6195x1e){return _0x6195xd[_0xf4a5[20]](404)};var _0x6195x1f=_[_0xf4a5[80]](_0x6195x1e,_0x6195xc[_0xf4a5[79]]);_0x6195x1f[_0xf4a5[81]]()[_0xf4a5[17]](function(){return _0x6195xd[_0xf4a5[16]](200)[_0xf4a5[15]](_0x6195x1e)})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})};exports[_0xf4a5[82]]=function(_0x6195xc,_0x6195xd){Sound[_0xf4a5[23]](_0x6195xc[_0xf4a5[22]][_0xf4a5[21]])[_0xf4a5[17]](function(_0x6195x1e){if(!_0x6195x1e){return _0x6195xd[_0xf4a5[16]](404)[_0xf4a5[15]](_0x6195x1e)};var _0x6195x20=path[_0xf4a5[26]](config[_0xf4a5[25]],_0x6195x1e[_0xf4a5[44]]+_0xf4a5[46]+_0x6195x1e[_0xf4a5[37]]);var _0x6195x21=path[_0xf4a5[26]](config[_0xf4a5[45]],_0x6195x1e[_0xf4a5[44]]+_0xf4a5[46]+_0x6195x1e[_0xf4a5[39]]);return sequelize[_0xf4a5[83]](function(_0x6195x22){return _0x6195x1e[_0xf4a5[82]]({transaction:_0x6195x22})[_0xf4a5[17]](function(){fs[_0xf4a5[53]](_0x6195x20,function(_0x6195xe){if(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)}});fs[_0xf4a5[53]](_0x6195x21,function(_0x6195xe){if(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)}});return _0x6195xd[_0xf4a5[16]](200)[_0xf4a5[15]](_0x6195x1e)})})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})})[_0xf4a5[14]](function(_0x6195xe){return handleError(_0x6195xd,_0x6195xe)})};exports[_0xf4a5[84]]=function(_0x6195xc,_0x6195xd){getStream(_0x6195xc,_0x6195xd,_0xf4a5[85])};exports[_0xf4a5[86]]=function(_0x6195xc,_0x6195xd){getStream(_0x6195xc,_0x6195xd,_0xf4a5[87])};function getStream(_0x6195xc,_0x6195xd,_0x6195x24){return Sound[_0xf4a5[23]](_0x6195xc[_0xf4a5[22]][_0xf4a5[21]])[_0xf4a5[17]](function(_0x6195x1e){var _0x6195x26=Promise[_0xf4a5[91]](fs[_0xf4a5[90]]);return _0x6195x26(path[_0xf4a5[26]](config[_0x6195x24+_0xf4a5[92]],_0x6195x1e[_0xf4a5[44]]+_0xf4a5[46]+_0x6195x1e[_0x6195x24+_0xf4a5[93]]))})[_0xf4a5[17]](function(_0x6195x19){var _0x6195x25= new Buffer(_0x6195x19,_0xf4a5[89]).toString(_0xf4a5[88]);return _0x6195x25})[_0xf4a5[17]](function(_0x6195x25){return _0x6195xd[_0xf4a5[16]](200)[_0xf4a5[15]]({downloadString:_0x6195x25})})[_0xf4a5[14]](function(_0x6195xe){console[_0xf4a5[74]](_0x6195xe);return handleError(_0x6195xd,_0x6195xe)})}function handleError(_0x6195xd,_0x6195xe){return _0x6195xd[_0xf4a5[16]](500)[_0xf4a5[15]](_0x6195xe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Sound = require('../../models').Sound; +var uploadFile = require('upload-file'); +var sr = require('simple-random'); +var sox = require('sox'); +var path = require('path'); +var config = require('../../config/environment'); +var fs = require('fs'); +var sequelize = require('../../models').sequelize; +var base64 = require('file-base64'); +var Promise = require('bluebird'); + +// Get list of Sounds +exports.index = function(req, res) { + Sound + .findAndCountAll() + .then(function(Sounds) { + return res.status(200).send(Sounds); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single Sound +exports.show = function(req, res) { + Sound + .findById(req.params.id) + .then(function(Sound) { + if (!Sound) { + return res.sendStatus(404); + } + return res.send(Sound); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new Sound in the DB. +exports.create = function(req, res) { + var upload = new uploadFile({ + dest: path.join(config.originalSounds), + maxFileSize: 15 * 1000000, + maxNumberOfFiles: 10, + minNumberOfFiles: 0, + acceptFileTypes: /(\.|\/)(wav|mp3|gsm|ogg)$/i, + rename: function(name, file) { + return sr() + path.extname(file.filename); + }, + messages: { + maxNumberOfFiles: "Max number of files upload exceeded", + acceptFileTypes: "Only wav,mp3,gsm, and ogg format accepted", + maxFileSize: "The maximum file size is 15 Mb", + invalidRequest: "Invalid request" + } + }); + + upload.on('end', function(fields, files) { + if (!files.file.filename) { + return res.status(500).send(upload); + } + + var job_details = {}; + var original_format = path.extname(files.file.filename); + job_details.description = ""; + job_details.original_format = path.extname(files.file.filename).substring(1); + job_details.converted_format = 'wav'; + job_details.name = job_details.display_name = path.basename(files.file.path, original_format); + job_details.save_name = path.basename(files.file.filename, original_format); + + + + var filepath = path.join(config.originalSounds, job_details.save_name + original_format); + var destination = path.join(config.convertedSounds, job_details.save_name + '.' + job_details.converted_format); + // + + fs.chmodSync(filepath, parseInt('0777', 8)); + sox.identify(filepath, function(err, result) { + // console.log('************** Result: ', result); + }); + + var job = sox.transcode(filepath, destination, { + sampleRate: 8000, + format: 'wav', + channelCount: 1, + bitRate: 192 * 1024, + compressionQuality: 5, + }); + + + + job.on('error', function(err) { + console.error('********** Conversion Error: ', err); + fs.unlink(filepath, function(err) { + if (err) + return handleError(res, err); + }); + return handleError(res, err); + }); + + job.on('progress', function(amountDone, amountTotal) { + // console.log("*********** Progress", amountDone, amountTotal); + }); + + job.on('src', function(info) { + // console.log('********** src: ', info); + /* info looks like: + { + format: 'wav', + duration: 1.5, + sampleCount: 66150, + channelCount: 1, + bitRate: 722944, + sampleRate: 44100, + } + */ + job_details.original_duration = isNaN(info.duration) ? null : info.duration * 1000; + job_details.original_sampleCount = isNaN(info.sampleCount) ? null : info.sampleCount; + job_details.original_channelCount = isNaN(info.channelCount) ? null : info.channelCount; + job_details.original_bitRate = isNaN(info.bitRate) ? null : info.bitRate; + job_details.original_sampleRate = isNaN(info.sampleRate) ? null : info.sampleRate; + }); + + job.on('dest', function(info) { + // console.log('********** dest: ', info); + /* info looks like: + { + sampleRate: 44100, + format: 'mp3', + channelCount: 2, + sampleCount: 67958, + duration: 1.540998, + bitRate: 196608, + } + */ + job_details.converted_duration = isNaN(info.duration) ? null : info.duration * 1000; + job_details.converted_sampleCount = isNaN(info.sampleCount) ? null : info.sampleCount; + job_details.converted_channelCount = isNaN(info.channelCount) ? null : info.channelCount; + job_details.converted_bitRate = isNaN(info.bitRate) ? null : info.bitRate; + job_details.converted_sampleRate = isNaN(info.sampleRate) ? null : info.sampleRate; + }); + + job.on('end', function() { + console.log("Conversion completed"); + fs.chmodSync(destination, parseInt('0777', 8)); + Sound + .create(job_details) + .then(function(sound) { + return res.status(201).send(sound); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); + }); + + job.start(); + + }); + + upload.on('error', function(err) { + console.log('********** Upload error :', err) + return handleError(res, err); + }); + + upload.parse(req); +}; + +// Updates an existing upload in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + Sound + .findById(req.params.id) + .then(function(sound) { + if (!sound) { + return res.sendStatus(404); + } + var updated = _.merge(sound, req.body); + updated.save() + .then(function() { + return res.status(200).send(sound); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a Sound from the DB. +exports.destroy = function(req, res) { + Sound + .findById(req.params.id) + .then(function(sound) { + if (!sound) { + return res.status(404).send(sound); + } + var original_filepath = path.join(config.originalSounds, sound.save_name + '.' + sound.original_format); + var converted_filepath = path.join(config.convertedSounds, sound.save_name + '.' + sound.converted_format); + return sequelize.transaction(function(t) { + return sound.destroy({ + transaction: t + }) + .then(function() { + fs.unlink(original_filepath, function(err) { + if (err) + return handleError(res, err); + }); + fs.unlink(converted_filepath, function(err) { + if (err) + return handleError(res, err); + }); + return res.status(200).send(sound); + }) + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +//Download an uploaded file +exports.download = function(req, res) { + getStream(req, res, 'original'); +}; + +//Stream an uploaded file +exports.stream = function(req, res) { + getStream(req, res, 'converted'); +} + + +function getStream(req, res, value) { + return Sound + .findById(req.params.id) + .then(function(sound) { + var readFile = Promise.promisify(fs.readFile); + return readFile(path.join(config[value + 'Sounds'], sound.save_name + '.' + sound[value + '_format'])); + }) + .then(function(result) { + var base64String = new Buffer(result, 'binary').toString('base64'); + return base64String; + }) + .then(function(base64String) { + return res.status(200).send({ + downloadString: base64String + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/sound/sound.socket.js b/server/api/sound/sound.socket.js index 925f82e..cef5b4b 100644 --- a/server/api/sound/sound.socket.js +++ b/server/api/sound/sound.socket.js @@ -1 +1,24 @@ -var _0x6a7c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x6F\x75\x6E\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x6F\x75\x6E\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x6F\x75\x6E\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0x6a7c[0];var Sound=require(_0x6a7c[2])[_0x6a7c[1]];exports[_0x6a7c[3]]=function(_0x86a4x2){Sound[_0x6a7c[4]](function(_0x86a4x3){onSave(_0x86a4x2,_0x86a4x3)});Sound[_0x6a7c[5]](function(_0x86a4x3){onRemove(_0x86a4x2,_0x86a4x3)})};function onSave(_0x86a4x2,_0x86a4x3,_0x86a4x5){_0x86a4x2[_0x6a7c[7]](_0x6a7c[6],_0x86a4x3)}function onRemove(_0x86a4x2,_0x86a4x3,_0x86a4x5){_0x86a4x2[_0x6a7c[7]](_0x6a7c[8],_0x86a4x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Sound = require('../../models').Sound; + +exports.register = function(socket) { + Sound.afterCreate(function(doc) { + onSave(socket, doc); + }); + Sound.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('sound:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('sound:remove', doc); +} diff --git a/server/api/sound/sound.spec.js b/server/api/sound/sound.spec.js index 4e87541..970195e 100644 --- a/server/api/sound/sound.spec.js +++ b/server/api/sound/sound.spec.js @@ -1 +1,20 @@ -var _0x1fdf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64\x73","\x67\x65\x74"];_0x1fdf[0];var should=require(_0x1fdf[1]);var app=require(_0x1fdf[2]);var request=require(_0x1fdf[3]);describe(_0x1fdf[4],function(){it(_0x1fdf[5],function(_0xffaex4){request(app)[_0x1fdf[13]](_0x1fdf[12])[_0x1fdf[11]](200)[_0x1fdf[11]](_0x1fdf[10],/json/)[_0x1fdf[9]](function(_0xffaex5,_0xffaex6){if(_0xffaex5){return _0xffaex4(_0xffaex5)};_0xffaex6[_0x1fdf[8]][_0x1fdf[1]][_0x1fdf[7]][_0x1fdf[6]](Array);_0xffaex4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/sounds', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/sounds') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/square_odbc/index.js b/server/api/square_odbc/index.js index 8490143..5f8a51e 100644 --- a/server/api/square_odbc/index.js +++ b/server/api/square_odbc/index.js @@ -1 +1,18 @@ -var _0x710b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x710b[0];var express=require(_0x710b[1]);var controller=require(_0x710b[2]);var auth=require(_0x710b[3]);var router=express.Router();router[_0x710b[7]](_0x710b[4],auth[_0x710b[5]](),controller[_0x710b[6]]);router[_0x710b[7]](_0x710b[8],auth[_0x710b[5]](),controller[_0x710b[9]]);router[_0x710b[7]](_0x710b[10],auth[_0x710b[5]](),controller[_0x710b[11]]);router[_0x710b[13]](_0x710b[4],auth[_0x710b[5]](),controller[_0x710b[12]]);router[_0x710b[15]](_0x710b[10],auth[_0x710b[5]](),controller[_0x710b[14]]);router[_0x710b[16]](_0x710b[10],auth[_0x710b[5]](),controller[_0x710b[14]]);router[_0x710b[18]](_0x710b[4],auth[_0x710b[5]](),controller[_0x710b[17]]);router[_0x710b[18]](_0x710b[10],auth[_0x710b[5]](),controller[_0x710b[19]]);module[_0x710b[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./square_odbc.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id/check', auth.isAuthenticated(), controller.checkConnection); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/square_odbc/square_odbc.controller.js b/server/api/square_odbc/square_odbc.controller.js index e6b7145..69af149 100644 --- a/server/api/square_odbc/square_odbc.controller.js +++ b/server/api/square_odbc/square_odbc.controller.js @@ -1 +1,135 @@ -var _0x3fac=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6F\x64\x62\x63","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x63\x68\x65\x63\x6B\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x64\x73\x6E","\x63\x6C\x6F\x73\x65","\x6F\x70\x65\x6E"];_0x3fac[0];var _=require(_0x3fac[1]);var db=require(_0x3fac[2])();var SquareOdbc=require(_0x3fac[4])[_0x3fac[3]];var Util=require(_0x3fac[5]);exports[_0x3fac[6]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[13]](Util[_0x3fac[12]](_0x6666x5[_0x3fac[11]]))[_0x3fac[10]](function(_0x6666x8){_0x6666x6[_0x3fac[9]](200)[_0x3fac[8]](_0x6666x8)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[14]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[18]](_0x6666x5[_0x3fac[17]][_0x3fac[16]])[_0x3fac[10]](function(_0x6666x9){if(!_0x6666x9){return _0x6666x6[_0x3fac[15]](404)};return _0x6666x6[_0x3fac[8]](_0x6666x9)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[19]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[19]](_0x6666x5[_0x3fac[20]])[_0x3fac[10]](function(_0x6666x9){return _0x6666x6[_0x3fac[9]](201)[_0x3fac[8]](_0x6666x9)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[21]]=function(_0x6666x5,_0x6666x6){if(_0x6666x5[_0x3fac[20]][_0x3fac[16]]){delete _0x6666x5[_0x3fac[20]][_0x3fac[16]]};return SquareOdbc[_0x3fac[18]](_0x6666x5[_0x3fac[17]][_0x3fac[16]])[_0x3fac[10]](function(_0x6666x9){if(!_0x6666x9){return _0x6666x6[_0x3fac[15]](404)};var _0x6666xa=_[_0x3fac[22]](_0x6666x9,_0x6666x5[_0x3fac[20]]);_0x6666xa[_0x3fac[23]]()[_0x3fac[10]](function(){return _0x6666x6[_0x3fac[9]](200)[_0x3fac[8]](_0x6666x9)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[24]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[18]](_0x6666x5[_0x3fac[17]][_0x3fac[16]])[_0x3fac[10]](function(_0x6666xb){if(!_0x6666xb){return _0x6666x6[_0x3fac[15]](404)};return _0x6666xb[_0x3fac[24]]()})[_0x3fac[10]](function(){return _0x6666x6[_0x3fac[15]](204)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[25]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[24]]({where:{id:_0x6666x5[_0x3fac[11]][_0x3fac[26]]},individualHooks:true})[_0x3fac[10]](function(){return _0x6666x6[_0x3fac[15]](204)})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};exports[_0x3fac[27]]=function(_0x6666x5,_0x6666x6){return SquareOdbc[_0x3fac[18]](_0x6666x5[_0x3fac[17]][_0x3fac[16]])[_0x3fac[10]](function(_0x6666x9){if(!_0x6666x9){return _0x6666x6[_0x3fac[15]](404)};db[_0x3fac[30]](_0x6666x9[_0x3fac[28]],function(_0x6666x7){if(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)};db[_0x3fac[29]](function(_0x6666x7){if(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)};return _0x6666x6[_0x3fac[15]](200)})})})[_0x3fac[7]](function(_0x6666x7){return handleError(_0x6666x6,_0x6666x7)})};function handleError(_0x6666x6,_0x6666x7){return _0x6666x6[_0x3fac[9]](500)[_0x3fac[8]](_0x6666x7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var db = require("odbc")(); + +var SquareOdbc = require('../../models').SquareOdbc; +var Util = require('../../config/util'); + +// Get list of square_odbcs +exports.index = function(req, res) { + return SquareOdbc + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single square_odbc +exports.show = function(req, res) { + return SquareOdbc + .findById(req.params.id) + .then(function(square_odbc) { + if (!square_odbc) { + return res.sendStatus(404); + } + return res.send(square_odbc); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new square_odbc in the DB. +exports.create = function(req, res) { + return SquareOdbc + .create(req.body) + .then(function(square_odbc) { + return res.status(201).send(square_odbc); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing square_odbc in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return SquareOdbc + .findById(req.params.id) + .then(function(square_odbc) { + if (!square_odbc) { + return res.sendStatus(404); + } + var updated = _.merge(square_odbc, req.body); + updated.save() + .then(function() { + return res.status(200).send(square_odbc); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a square_odbc from the DB. +exports.destroy = function(req, res) { + return SquareOdbc + .findById(req.params.id) + .then(function(odbc) { + if (!odbc) { + return res.sendStatus(404); + } + return odbc + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a square_project from the DB. +exports.bulkDestroy = function(req, res) { + return SquareOdbc + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.checkConnection = function(req, res) { + return SquareOdbc + .findById(req.params.id) + .then(function(square_odbc) { + if (!square_odbc) { + return res.sendStatus(404); + } + db.open(square_odbc.dsn, function(err) { + if (err) { + return handleError(res, err); + } + db.close(function(err) { + if (err) { + return handleError(res, err); + } + return res.sendStatus(200); + }) + }) + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/square_odbc/square_odbc.socket.js b/server/api/square_odbc/square_odbc.socket.js index c80cdc0..af0c04a 100644 --- a/server/api/square_odbc/square_odbc.socket.js +++ b/server/api/square_odbc/square_odbc.socket.js @@ -1 +1,24 @@ -var _0x5a32=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63\x3A\x72\x65\x6D\x6F\x76\x65"];_0x5a32[0];var SquareOdbc=require(_0x5a32[2])[_0x5a32[1]];exports[_0x5a32[3]]=function(_0x1ef5x2){SquareOdbc[_0x5a32[4]](function(_0x1ef5x3){onSave(_0x1ef5x2,_0x1ef5x3)});SquareOdbc[_0x5a32[5]](function(_0x1ef5x3){onRemove(_0x1ef5x2,_0x1ef5x3)})};function onSave(_0x1ef5x2,_0x1ef5x3,_0x1ef5x5){_0x1ef5x2[_0x5a32[7]](_0x5a32[6],_0x1ef5x3)}function onRemove(_0x1ef5x2,_0x1ef5x3,_0x1ef5x5){_0x1ef5x2[_0x5a32[7]](_0x5a32[8],_0x1ef5x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SquareOdbc = require('../../models').SquareOdbc; + +exports.register = function(socket) { + SquareOdbc.afterCreate(function(doc) { + onSave(socket, doc); + }); + SquareOdbc.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('square_odbc:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('square_odbc:remove', doc); +} diff --git a/server/api/square_odbc/square_odbc.spec.js b/server/api/square_odbc/square_odbc.spec.js index 4a90011..ce9350c 100644 --- a/server/api/square_odbc/square_odbc.spec.js +++ b/server/api/square_odbc/square_odbc.spec.js @@ -1 +1,20 @@ -var _0xd13a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x6F\x64\x62\x63","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x6F\x64\x62\x63","\x67\x65\x74"];_0xd13a[0];var should=require(_0xd13a[1]);var app=require(_0xd13a[2]);var request=require(_0xd13a[3]);describe(_0xd13a[4],function(){it(_0xd13a[5],function(_0x3eafx4){request(app)[_0xd13a[13]](_0xd13a[12])[_0xd13a[11]](200)[_0xd13a[11]](_0xd13a[10],/json/)[_0xd13a[9]](function(_0x3eafx5,_0x3eafx6){if(_0x3eafx5){return _0x3eafx4(_0x3eafx5)};_0x3eafx6[_0xd13a[8]][_0xd13a[1]][_0xd13a[7]][_0xd13a[6]](Array);_0x3eafx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/square/odbc', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/square/odbc') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/square_project/index.js b/server/api/square_project/index.js index b11fdcb..614ce23 100644 --- a/server/api/square_project/index.js +++ b/server/api/square_project/index.js @@ -1 +1,18 @@ -var _0xe0ba=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xe0ba[0];var express=require(_0xe0ba[1]);var controller=require(_0xe0ba[2]);var auth=require(_0xe0ba[3]);var router=express.Router();router[_0xe0ba[7]](_0xe0ba[4],auth[_0xe0ba[5]](),controller[_0xe0ba[6]]);router[_0xe0ba[7]](_0xe0ba[8],auth[_0xe0ba[5]](),controller[_0xe0ba[9]]);router[_0xe0ba[7]](_0xe0ba[10],controller[_0xe0ba[11]]);router[_0xe0ba[13]](_0xe0ba[4],auth[_0xe0ba[5]](),controller[_0xe0ba[12]]);router[_0xe0ba[15]](_0xe0ba[8],auth[_0xe0ba[5]](),controller[_0xe0ba[14]]);router[_0xe0ba[16]](_0xe0ba[8],auth[_0xe0ba[5]](),controller[_0xe0ba[14]]);router[_0xe0ba[18]](_0xe0ba[4],auth[_0xe0ba[5]](),controller[_0xe0ba[17]]);router[_0xe0ba[18]](_0xe0ba[8],auth[_0xe0ba[5]](),controller[_0xe0ba[19]]);module[_0xe0ba[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./square_project.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/download', controller.download); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/square_project/square_project.controller.js b/server/api/square_project/square_project.controller.js index e1d536b..3531326 100644 --- a/server/api/square_project/square_project.controller.js +++ b/server/api/square_project/square_project.controller.js @@ -1 +1,132 @@ -var _0x34f1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x6C\x6F\x67","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3B\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D\x22","\x2E\x78\x6D\x6C\x22","\x74\x78\x74\x2F\x78\x6D\x6C","\x73\x65\x74","\x70\x72\x65\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E"];_0x34f1[0];var _=require(_0x34f1[1]);var path=require(_0x34f1[2]);var config=require(_0x34f1[3]);var Util=require(_0x34f1[4]);var SquareProject=require(_0x34f1[6])[_0x34f1[5]];exports[_0x34f1[7]]=function(_0xc908x6,_0xc908x7){return SquareProject[_0x34f1[14]](Util[_0x34f1[13]](_0xc908x6[_0x34f1[12]]))[_0x34f1[11]](function(_0xc908x9){_0xc908x7[_0x34f1[10]](200)[_0x34f1[9]](_0xc908x9)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[15]]=function(_0xc908x6,_0xc908x7){return SquareProject[_0x34f1[19]](_0xc908x6[_0x34f1[18]][_0x34f1[17]])[_0x34f1[11]](function(_0xc908xa){if(!_0xc908xa){return _0xc908x7[_0x34f1[16]](404)};return _0xc908x7[_0x34f1[9]](_0xc908xa)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[20]]=function(_0xc908x6,_0xc908x7){return SquareProject[_0x34f1[20]](_0xc908x6[_0x34f1[21]])[_0x34f1[11]](function(_0xc908xa){return _0xc908x7[_0x34f1[10]](201)[_0x34f1[9]](_0xc908xa)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[22]]=function(_0xc908x6,_0xc908x7){if(_0xc908x6[_0x34f1[21]][_0x34f1[17]]){delete _0xc908x6[_0x34f1[21]][_0x34f1[17]]};return SquareProject[_0x34f1[19]](_0xc908x6[_0x34f1[18]][_0x34f1[17]])[_0x34f1[11]](function(_0xc908xa){if(!_0xc908xa){return _0xc908x7[_0x34f1[16]](404)};var _0xc908xb=_[_0x34f1[23]](_0xc908xa,_0xc908x6[_0x34f1[21]]);_0xc908xb[_0x34f1[24]]()[_0x34f1[11]](function(){return _0xc908x7[_0x34f1[10]](200)[_0x34f1[9]](_0xc908xa)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[25]]=function(_0xc908x6,_0xc908x7){return SquareProject[_0x34f1[19]](_0xc908x6[_0x34f1[18]][_0x34f1[17]])[_0x34f1[11]](function(_0xc908xc){if(!_0xc908xc){return _0xc908x7[_0x34f1[16]](404)};return _0xc908xc[_0x34f1[25]]()})[_0x34f1[11]](function(){return _0xc908x7[_0x34f1[16]](204)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[26]]=function(_0xc908x6,_0xc908x7){return SquareProject[_0x34f1[25]]({where:{id:_0xc908x6[_0x34f1[12]][_0x34f1[27]]},individualHooks:true})[_0x34f1[11]](function(){return _0xc908x7[_0x34f1[16]](204)})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};exports[_0x34f1[28]]=function(_0xc908x6,_0xc908x7,_0xc908xd){SquareProject[_0x34f1[19]](_0xc908x6[_0x34f1[18]][_0x34f1[17]])[_0x34f1[11]](function(_0xc908xa){if(!_0xc908xa){return _0xc908x7[_0x34f1[16]](404)};console[_0x34f1[30]](_0xc908x6[_0x34f1[12]][_0x34f1[29]]);_0xc908x7[_0x34f1[34]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E":_0x34f1[31]+_0xc908x6[_0x34f1[12]][_0x34f1[29]]+_0x34f1[32],"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x34f1[33]});return _0xc908x7[_0x34f1[9]](_0xc908xa[_0x34f1[35]])})[_0x34f1[8]](function(_0xc908x8){return handleError(_0xc908x7,_0xc908x8)})};function handleError(_0xc908x7,_0xc908x8){return _0xc908x7[_0x34f1[10]](500)[_0x34f1[9]](_0xc908x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var path = require('path'); +var config = require('../../config/environment'); +var Util = require('../../config/util'); + +var SquareProject = require('../../models').SquareProject; + +// Get list of square_projects +exports.index = function(req, res) { + return SquareProject + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single square_project +exports.show = function(req, res) { + return SquareProject + .findById(req.params.id) + .then(function(square_project) { + if (!square_project) { + return res.sendStatus(404); + } + return res.send(square_project); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new square_project in the DB. +exports.create = function(req, res) { + return SquareProject + .create(req.body) + .then(function(square_project) { + return res.status(201).send(square_project); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing square_project in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return SquareProject + .findById(req.params.id) + .then(function(square_project) { + if (!square_project) { + return res.sendStatus(404); + } + var updated = _.merge(square_project, req.body); + updated.save() + .then(function() { + return res.status(200).send(square_project); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a square_project from the DB. +exports.destroy = function(req, res) { + return SquareProject + .findById(req.params.id) + .then(function(project) { + if (!project) { + return res.sendStatus(404); + } + return project + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a square_project from the DB. +exports.bulkDestroy = function(req, res) { + return SquareProject + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.download = function(req, res, next) { + SquareProject + .findById(req.params.id) + .then(function(square_project) { + if (!square_project) { + return res.sendStatus(404); + } + console.log(req.query.filename); + res.set({ + "Content-Disposition": "attachment; filename=\"" + req.query.filename + + ".xml\"", + "Content-Type": "txt/xml" + }); + return res.send(square_project.preproduction); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/square_project/square_project.socket.js b/server/api/square_project/square_project.socket.js index 45dc6fa..bc43e25 100644 --- a/server/api/square_project/square_project.socket.js +++ b/server/api/square_project/square_project.socket.js @@ -1 +1,27 @@ -var _0x9363=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x9363[0];var SquareProject=require(_0x9363[2])[_0x9363[1]];exports[_0x9363[3]]=function(_0x28d8x2){SquareProject[_0x9363[4]](function(_0x28d8x3){onSave(_0x28d8x2,_0x28d8x3)});SquareProject[_0x9363[5]](function(_0x28d8x3){onSave(_0x28d8x2,_0x28d8x3)});SquareProject[_0x9363[6]](function(_0x28d8x3){onRemove(_0x28d8x2,_0x28d8x3)})};function onSave(_0x28d8x2,_0x28d8x3,_0x28d8x5){_0x28d8x2[_0x9363[8]](_0x9363[7],_0x28d8x3)}function onRemove(_0x28d8x2,_0x28d8x3,_0x28d8x5){_0x28d8x2[_0x9363[8]](_0x9363[9],_0x28d8x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SquareProject = require('../../models').SquareProject; + +exports.register = function(socket) { + SquareProject.afterCreate(function(doc) { + onSave(socket, doc); + }); + SquareProject.afterUpdate(function(doc) { + onSave(socket, doc); + }); + SquareProject.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('square_project:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('square_project:remove', doc); +} diff --git a/server/api/sugarcrm_account/index.js b/server/api/sugarcrm_account/index.js index 250fbba..e87249c 100644 --- a/server/api/sugarcrm_account/index.js +++ b/server/api/sugarcrm_account/index.js @@ -1 +1,21 @@ -var _0x7a12=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x7a12[0];var express=require(_0x7a12[1]);var auth=require(_0x7a12[2]);var controller=require(_0x7a12[3]);var router=express.Router();router[_0x7a12[7]](_0x7a12[4],auth[_0x7a12[5]](),controller[_0x7a12[6]]);router[_0x7a12[7]](_0x7a12[8],auth[_0x7a12[5]](),controller[_0x7a12[9]]);router[_0x7a12[7]](_0x7a12[10],auth[_0x7a12[5]](),controller[_0x7a12[11]]);router[_0x7a12[7]](_0x7a12[12],auth[_0x7a12[5]](),controller[_0x7a12[13]]);router[_0x7a12[16]](_0x7a12[14],auth[_0x7a12[5]](),controller[_0x7a12[15]]);router[_0x7a12[16]](_0x7a12[4],auth[_0x7a12[5]](),controller[_0x7a12[17]]);router[_0x7a12[19]](_0x7a12[12],auth[_0x7a12[5]](),controller[_0x7a12[18]]);router[_0x7a12[20]](_0x7a12[12],auth[_0x7a12[5]](),controller[_0x7a12[18]]);router[_0x7a12[22]](_0x7a12[4],auth[_0x7a12[5]](),controller[_0x7a12[21]]);router[_0x7a12[22]](_0x7a12[12],auth[_0x7a12[5]](),controller[_0x7a12[23]]);module[_0x7a12[24]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./sugarcrm_account.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id/check', auth.isAuthenticated(), controller.checkAccount); +router.get('/:id/fields', auth.isAuthenticated(), controller.getFields); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/validate/:field', auth.isAuthenticated(), controller.accountValidation); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/sugarcrm_account/index.spec.js b/server/api/sugarcrm_account/index.spec.js index ec7864d..758de1a 100644 --- a/server/api/sugarcrm_account/index.spec.js +++ b/server/api/sugarcrm_account/index.spec.js @@ -1 +1,97 @@ -var _0x3166=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x3166[0];var proxyquire=require(_0x3166[2])[_0x3166[1]]();var sugarcrmAccountCtrlStub={index:_0x3166[3],show:_0x3166[4],create:_0x3166[5],update:_0x3166[6],destroy:_0x3166[7]};var routerStub={get:sinon[_0x3166[8]](),put:sinon[_0x3166[8]](),patch:sinon[_0x3166[8]](),post:sinon[_0x3166[8]](),delete:sinon[_0x3166[8]]()};var sugarcrmAccountIndex=proxyquire(_0x3166[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":sugarcrmAccountCtrlStub});describe(_0x3166[10],function(){it(_0x3166[11],function(){expect(sugarcrmAccountIndex)[_0x3166[13]][_0x3166[12]](routerStub)});describe(_0x3166[14],function(){it(_0x3166[15],function(){expect(routerStub[_0x3166[21]][_0x3166[20]](_0x3166[19],_0x3166[3]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})});describe(_0x3166[22],function(){it(_0x3166[23],function(){expect(routerStub[_0x3166[21]][_0x3166[20]](_0x3166[24],_0x3166[4]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})});describe(_0x3166[25],function(){it(_0x3166[26],function(){expect(routerStub[_0x3166[27]][_0x3166[20]](_0x3166[19],_0x3166[5]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})});describe(_0x3166[28],function(){it(_0x3166[29],function(){expect(routerStub[_0x3166[30]][_0x3166[20]](_0x3166[24],_0x3166[6]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})});describe(_0x3166[31],function(){it(_0x3166[29],function(){expect(routerStub[_0x3166[32]][_0x3166[20]](_0x3166[24],_0x3166[6]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})});describe(_0x3166[33],function(){it(_0x3166[34],function(){expect(routerStub[_0x3166[35]][_0x3166[20]](_0x3166[24],_0x3166[7]))[_0x3166[13]][_0x3166[18]][_0x3166[17]][_0x3166[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var sugarcrmAccountCtrlStub = { + index: 'sugarcrmAccountCtrl.index', + show: 'sugarcrmAccountCtrl.show', + create: 'sugarcrmAccountCtrl.create', + update: 'sugarcrmAccountCtrl.update', + destroy: 'sugarcrmAccountCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var sugarcrmAccountIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './sugarcrm_account.controller': sugarcrmAccountCtrlStub +}); + +describe('SugarcrmAccount API Router:', function() { + + it('should return an express router instance', function() { + expect(sugarcrmAccountIndex).to.equal(routerStub); + }); + + describe('GET /api/sugarcrm/accounts', function() { + + it('should route to sugarcrmAccount.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'sugarcrmAccountCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/sugarcrm/accounts/:id', function() { + + it('should route to sugarcrmAccount.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'sugarcrmAccountCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/sugarcrm/accounts', function() { + + it('should route to sugarcrmAccount.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'sugarcrmAccountCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/sugarcrm/accounts/:id', function() { + + it('should route to sugarcrmAccount.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'sugarcrmAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/sugarcrm/accounts/:id', function() { + + it('should route to sugarcrmAccount.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'sugarcrmAccountCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/sugarcrm/accounts/:id', function() { + + it('should route to sugarcrmAccount.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'sugarcrmAccountCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/sugarcrm_account/sugarcrm_account.controller.js b/server/api/sugarcrm_account/sugarcrm_account.controller.js index 7ecdc70..afa4692 100644 --- a/server/api/sugarcrm_account/sugarcrm_account.controller.js +++ b/server/api/sugarcrm_account/sugarcrm_account.controller.js @@ -1 +1,200 @@ -var _0xfbeb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x53\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x6E\x6F\x64\x65\x2D\x73\x75\x67\x61\x72\x63\x72\x6D\x2D\x63\x6C\x69\x65\x6E\x74","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x73\x74\x72\x69\x70\x54\x72\x61\x69\x6C\x69\x6E\x67\x53\x6C\x61\x73\x68","\x2F\x73\x65\x72\x76\x69\x63\x65\x2F\x76\x34\x5F\x31\x2F\x72\x65\x73\x74\x2E\x70\x68\x70","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x69\x6E\x69\x74","\x6C\x6F\x67\x69\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x61\x63\x63\x6F\x75\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x63\x6F\x75\x6E\x74","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x43\x61\x73\x65\x73","\x67\x65\x74\x5F\x6D\x6F\x64\x75\x6C\x65\x5F\x66\x69\x65\x6C\x64\x73","\x6D\x6F\x64\x75\x6C\x65\x5F\x66\x69\x65\x6C\x64\x73","\x63\x61\x6C\x6C"];_0xfbeb[0];var _=require(_0xfbeb[1]);var Util=require(_0xfbeb[2]);var SugarcrmAccount=require(_0xfbeb[4])[_0xfbeb[3]];function handleError(_0x26b6x5,_0x26b6x6){_0x26b6x6=_0x26b6x6||500;return function(_0x26b6x7){_0x26b6x5[_0xfbeb[6]](_0x26b6x6)[_0xfbeb[5]](_0x26b6x7)}}function responseWithResult(_0x26b6x5,_0x26b6x6){_0x26b6x6=_0x26b6x6||200;return function(_0x26b6x9){if(_0x26b6x9){_0x26b6x5[_0xfbeb[6]](_0x26b6x6)[_0xfbeb[7]](_0x26b6x9)}}}function responseWithoutResult(_0x26b6x5,_0x26b6x6){_0x26b6x6=_0x26b6x6||200;return function(){_0x26b6x5[_0xfbeb[8]](_0x26b6x6)}}function handleEntityNotFound(_0x26b6x5){return function(_0x26b6x9){if(!_0x26b6x9){_0x26b6x5[_0xfbeb[6]](404)[_0xfbeb[9]]();return null};return _0x26b6x9}}function saveUpdates(_0x26b6xd){return function(_0x26b6x9){return _0x26b6x9[_0xfbeb[11]](_0x26b6xd)[_0xfbeb[10]](function(_0x26b6xe){return _0x26b6xe})}}function removeEntity(_0x26b6x5){return function(_0x26b6x9){if(_0x26b6x9){return _0x26b6x9[_0xfbeb[12]]()[_0xfbeb[10]](function(){_0x26b6x5[_0xfbeb[6]](204)[_0xfbeb[9]]()})}}}exports[_0xfbeb[13]]=function(_0x26b6x10,_0x26b6x5){return SugarcrmAccount[_0xfbeb[19]](_0xfbeb[18])[_0xfbeb[17]](Util[_0xfbeb[16]](_0x26b6x10[_0xfbeb[15]]))[_0xfbeb[10]](responseWithResult(_0x26b6x5))[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[20]]=function(_0x26b6x10,_0x26b6x5){return SugarcrmAccount[_0xfbeb[23]](_0x26b6x10[_0xfbeb[22]][_0xfbeb[21]])[_0xfbeb[10]](handleEntityNotFound(_0x26b6x5))[_0xfbeb[10]](responseWithResult(_0x26b6x5))[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[24]]=function(_0x26b6x10,_0x26b6x5){return SugarcrmAccount[_0xfbeb[24]](_0x26b6x10[_0xfbeb[25]])[_0xfbeb[10]](responseWithResult(_0x26b6x5,201))[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[26]]=function(_0x26b6x10,_0x26b6x5){if(_0x26b6x10[_0xfbeb[25]][_0xfbeb[21]]){delete _0x26b6x10[_0xfbeb[25]][_0xfbeb[21]]};return SugarcrmAccount[_0xfbeb[23]](_0x26b6x10[_0xfbeb[22]][_0xfbeb[21]])[_0xfbeb[10]](handleEntityNotFound(_0x26b6x5))[_0xfbeb[10]](saveUpdates(_0x26b6x10[_0xfbeb[25]]))[_0xfbeb[10]](responseWithResult(_0x26b6x5))[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[12]]=function(_0x26b6x10,_0x26b6x5){return SugarcrmAccount[_0xfbeb[23]](_0x26b6x10[_0xfbeb[22]][_0xfbeb[21]])[_0xfbeb[10]](handleEntityNotFound(_0x26b6x5))[_0xfbeb[10]](removeEntity(_0x26b6x5))[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[27]]=function(_0x26b6x10,_0x26b6x5){return SugarcrmAccount[_0xfbeb[23]](_0x26b6x10[_0xfbeb[22]][_0xfbeb[21]])[_0xfbeb[10]](handleEntityNotFound(_0x26b6x5))[_0xfbeb[10]](function(_0x26b6x11){var _0x26b6x12=require(_0xfbeb[28]);_0x26b6x12[_0xfbeb[34]]({apiURL:Util[_0xfbeb[30]](_0x26b6x11[_0xfbeb[29]])+_0xfbeb[31],login:_0x26b6x11[_0xfbeb[32]],passwd:_0x26b6x11[_0xfbeb[33]]});_0x26b6x12[_0xfbeb[35]](function(_0x26b6x13){if(!_0x26b6x13){return _0x26b6x5[_0xfbeb[8]](400)};return _0x26b6x5[_0xfbeb[8]](200)})})[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[36]]=function(_0x26b6x10,_0x26b6x5){SugarcrmAccount[_0xfbeb[12]]({where:{id:_0x26b6x10[_0xfbeb[15]][_0xfbeb[37]]},individualHooks:true})[_0xfbeb[10]](function(){return _0x26b6x5[_0xfbeb[8]](204)})[_0xfbeb[14]](handleError(_0x26b6x5))};exports[_0xfbeb[38]]=function(_0x26b6x10,_0x26b6x5){var _0x26b6x14={};_0x26b6x14[_0x26b6x10[_0xfbeb[22]][_0xfbeb[39]]]=_0x26b6x10[_0xfbeb[25]][_0xfbeb[40]];return SugarcrmAccount[_0xfbeb[17]]({where:_0x26b6x14})[_0xfbeb[10]](function(_0x26b6x15){if(_0x26b6x15[_0xfbeb[41]]){return _0x26b6x5[_0xfbeb[6]](200)[_0xfbeb[5]]({isValid:false,value:_0x26b6x10[_0xfbeb[25]][_0xfbeb[40]]})};return _0x26b6x5[_0xfbeb[6]](200)[_0xfbeb[5]]({isValid:true,value:_0x26b6x10[_0xfbeb[25]][_0xfbeb[40]]})})[_0xfbeb[14]](function(_0x26b6x7){return handleError(_0x26b6x5,_0x26b6x7)})};exports[_0xfbeb[42]]=function(_0x26b6x10,_0x26b6x5){var _0x26b6x12=require(_0xfbeb[28]);return SugarcrmAccount[_0xfbeb[23]](_0x26b6x10[_0xfbeb[22]][_0xfbeb[21]])[_0xfbeb[10]](handleEntityNotFound(_0x26b6x5))[_0xfbeb[10]](function(_0x26b6x11){_0x26b6x12[_0xfbeb[34]]({apiURL:Util[_0xfbeb[30]](_0x26b6x11[_0xfbeb[29]])+_0xfbeb[31],login:_0x26b6x11[_0xfbeb[32]],passwd:_0x26b6x11[_0xfbeb[33]]});_0x26b6x12[_0xfbeb[35]](function(_0x26b6x13){if(!_0x26b6x13){return _0x26b6x5[_0xfbeb[8]](400)};var _0x26b6x16={session:_0x26b6x13,module_name:_0xfbeb[43]};_0x26b6x12[_0xfbeb[46]](_0xfbeb[44],_0x26b6x16,function(_0x26b6x15,_0x26b6x7){if(_0x26b6x7){return _0x26b6x5[_0xfbeb[8]](400)};return _0x26b6x5[_0xfbeb[6]](200)[_0xfbeb[5]](_0x26b6x15[_0xfbeb[45]])})})})[_0xfbeb[14]](handleError(_0x26b6x5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/sugarcrm/accounts -> index + * POST /api/sugarcrm/accounts -> create + * GET /api/sugarcrm/accounts/:id -> show + * PUT /api/sugarcrm/accounts/:id -> update + * DELETE /api/sugarcrm/accounts/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var SugarcrmAccount = require('../../models').SugarcrmAccount; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function responseWithoutResult(res, statusCode) { + statusCode = statusCode || 200; + return function() { + res.sendStatus(statusCode); + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SugarcrmAccounts +exports.index = function(req, res) { + return SugarcrmAccount + .scope('configurations') + .findAndCountAll(Util.getQuery(req.query)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single SugarcrmAccount from the DB +exports.show = function(req, res) { + return SugarcrmAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SugarcrmAccount in the DB +exports.create = function(req, res) { + return SugarcrmAccount.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SugarcrmAccount in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return SugarcrmAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SugarcrmAccount from the DB +exports.destroy = function(req, res) { + return SugarcrmAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.checkAccount = function(req, res) { + return SugarcrmAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + var sugar = require('node-sugarcrm-client'); + sugar.init({ + apiURL: Util.stripTrailingSlash(account.remoteUri) + "/service/v4_1/rest.php", + login: account.username, + passwd: account.password + }); + sugar.login(function(sessionId) { + if (!sessionId) { + return res.sendStatus(400); + } + return res.sendStatus(200); + }); + }) + .catch(handleError(res)); +} + +exports.bulkDestroy = function(req, res) { + SugarcrmAccount + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(handleError(res)); +}; + +exports.accountValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + return SugarcrmAccount + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.getFields = function(req, res) { + var sugar = require('node-sugarcrm-client'); + return SugarcrmAccount.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(account) { + sugar.init({ + apiURL: Util.stripTrailingSlash(account.remoteUri) + "/service/v4_1/rest.php", + login: account.username, + passwd: account.password + }); + sugar.login(function(sessionId) { + if (!sessionId) { + return res.sendStatus(400); + } + var params = { + session: sessionId, + module_name: "Cases" + }; + sugar.call("get_module_fields", params, function(result, err) { + if (err) { + return res.sendStatus(400); + } + return res.status(200).send(result.module_fields); + }); + }); + }) + .catch(handleError(res)); +}; diff --git a/server/api/sugarcrm_account/sugarcrm_account.socket.js b/server/api/sugarcrm_account/sugarcrm_account.socket.js index f1d8d5b..859bf6d 100644 --- a/server/api/sugarcrm_account/sugarcrm_account.socket.js +++ b/server/api/sugarcrm_account/sugarcrm_account.socket.js @@ -1 +1,24 @@ -var _0x60ab=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x60ab[0];var SugarcrmAccount=require(_0x60ab[2])[_0x60ab[1]];exports[_0x60ab[3]]=function(_0x7d62x2){SugarcrmAccount[_0x60ab[4]](function(_0x7d62x3){onSave(_0x7d62x2,_0x7d62x3)});SugarcrmAccount[_0x60ab[5]](function(_0x7d62x3){onRemove(_0x7d62x2,_0x7d62x3)})};function onSave(_0x7d62x2,_0x7d62x3,_0x7d62x5){_0x7d62x2[_0x60ab[7]](_0x60ab[6],_0x7d62x3)}function onRemove(_0x7d62x2,_0x7d62x3,_0x7d62x5){_0x7d62x2[_0x60ab[7]](_0x60ab[8],_0x7d62x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SugarcrmAccount = require('../../models').SugarcrmAccount; + +exports.register = function(socket) { + SugarcrmAccount.afterCreate(function(doc) { + onSave(socket, doc); + }); + SugarcrmAccount.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('sugarcrm_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('sugarcrm_account:remove', doc); +} diff --git a/server/api/sugarcrm_configuration/index.js b/server/api/sugarcrm_configuration/index.js index d2036ad..90111bf 100644 --- a/server/api/sugarcrm_configuration/index.js +++ b/server/api/sugarcrm_configuration/index.js @@ -1 +1,18 @@ -var _0x1168=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x3A\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x1168[0];var express=require(_0x1168[1]);var auth=require(_0x1168[2]);var controller=require(_0x1168[3]);var router=express.Router();router[_0x1168[7]](_0x1168[4],auth[_0x1168[5]](),controller[_0x1168[6]]);router[_0x1168[7]](_0x1168[8],auth[_0x1168[5]](),controller[_0x1168[9]]);router[_0x1168[11]](_0x1168[4],auth[_0x1168[5]](),controller[_0x1168[10]]);router[_0x1168[13]](_0x1168[8],auth[_0x1168[5]](),controller[_0x1168[12]]);router[_0x1168[11]](_0x1168[14],auth[_0x1168[5]](),controller[_0x1168[15]]);router[_0x1168[16]](_0x1168[8],auth[_0x1168[5]](),controller[_0x1168[12]]);router[_0x1168[18]](_0x1168[8],auth[_0x1168[5]](),controller[_0x1168[17]]);module[_0x1168[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./sugarcrm_configuration.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/:id/:type', auth.isAuthenticated(), controller.addConfigurationField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/sugarcrm_configuration/index.spec.js b/server/api/sugarcrm_configuration/index.spec.js index f9621bc..ba1b022 100644 --- a/server/api/sugarcrm_configuration/index.spec.js +++ b/server/api/sugarcrm_configuration/index.spec.js @@ -1 +1,97 @@ -var _0x8305=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x8305[0];var proxyquire=require(_0x8305[2])[_0x8305[1]]();var sugarcrmConfigurationCtrlStub={index:_0x8305[3],show:_0x8305[4],create:_0x8305[5],update:_0x8305[6],destroy:_0x8305[7]};var routerStub={get:sinon[_0x8305[8]](),put:sinon[_0x8305[8]](),patch:sinon[_0x8305[8]](),post:sinon[_0x8305[8]](),delete:sinon[_0x8305[8]]()};var sugarcrmConfigurationIndex=proxyquire(_0x8305[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":sugarcrmConfigurationCtrlStub});describe(_0x8305[10],function(){it(_0x8305[11],function(){expect(sugarcrmConfigurationIndex)[_0x8305[13]][_0x8305[12]](routerStub)});describe(_0x8305[14],function(){it(_0x8305[15],function(){expect(routerStub[_0x8305[21]][_0x8305[20]](_0x8305[19],_0x8305[3]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})});describe(_0x8305[22],function(){it(_0x8305[23],function(){expect(routerStub[_0x8305[21]][_0x8305[20]](_0x8305[24],_0x8305[4]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})});describe(_0x8305[25],function(){it(_0x8305[26],function(){expect(routerStub[_0x8305[27]][_0x8305[20]](_0x8305[19],_0x8305[5]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})});describe(_0x8305[28],function(){it(_0x8305[29],function(){expect(routerStub[_0x8305[30]][_0x8305[20]](_0x8305[24],_0x8305[6]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})});describe(_0x8305[31],function(){it(_0x8305[29],function(){expect(routerStub[_0x8305[32]][_0x8305[20]](_0x8305[24],_0x8305[6]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})});describe(_0x8305[33],function(){it(_0x8305[34],function(){expect(routerStub[_0x8305[35]][_0x8305[20]](_0x8305[24],_0x8305[7]))[_0x8305[13]][_0x8305[18]][_0x8305[17]][_0x8305[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var sugarcrmConfigurationCtrlStub = { + index: 'sugarcrmConfigurationCtrl.index', + show: 'sugarcrmConfigurationCtrl.show', + create: 'sugarcrmConfigurationCtrl.create', + update: 'sugarcrmConfigurationCtrl.update', + destroy: 'sugarcrmConfigurationCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var sugarcrmConfigurationIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './sugarcrm_configuration.controller': sugarcrmConfigurationCtrlStub +}); + +describe('SugarcrmConfiguration API Router:', function() { + + it('should return an express router instance', function() { + expect(sugarcrmConfigurationIndex).to.equal(routerStub); + }); + + describe('GET /api/sugarcrm/configurations', function() { + + it('should route to sugarcrmConfiguration.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'sugarcrmConfigurationCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/sugarcrm/configurations/:id', function() { + + it('should route to sugarcrmConfiguration.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'sugarcrmConfigurationCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/sugarcrm/configurations', function() { + + it('should route to sugarcrmConfiguration.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'sugarcrmConfigurationCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/sugarcrm/configurations/:id', function() { + + it('should route to sugarcrmConfiguration.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'sugarcrmConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/sugarcrm/configurations/:id', function() { + + it('should route to sugarcrmConfiguration.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'sugarcrmConfigurationCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/sugarcrm/configurations/:id', function() { + + it('should route to sugarcrmConfiguration.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'sugarcrmConfigurationCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/sugarcrm_configuration/sugarcrm_configuration.controller.js b/server/api/sugarcrm_configuration/sugarcrm_configuration.controller.js index a82a747..5918283 100644 --- a/server/api/sugarcrm_configuration/sugarcrm_configuration.controller.js +++ b/server/api/sugarcrm_configuration/sugarcrm_configuration.controller.js @@ -1 +1,145 @@ -var _0x2d70=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x53\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x73\x70\x72\x65\x61\x64","\x61\x64\x64\x53\x75\x62\x6A\x65\x63\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x64\x64\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x74\x79\x70\x65"];_0x2d70[0];var _=require(_0x2d70[1]);var SugarcrmConfiguration=require(_0x2d70[3])[_0x2d70[2]];var SugarcrmField=require(_0x2d70[3])[_0x2d70[4]];function handleError(_0x9349x5,_0x9349x6){_0x9349x6=_0x9349x6||500;return function(_0x9349x7){_0x9349x5[_0x2d70[6]](_0x9349x6)[_0x2d70[5]](_0x9349x7)}}function responseWithResult(_0x9349x5,_0x9349x6){_0x9349x6=_0x9349x6||200;return function(_0x9349x9){if(_0x9349x9){_0x9349x5[_0x2d70[6]](_0x9349x6)[_0x2d70[7]](_0x9349x9)}}}function handleEntityNotFound(_0x9349x5){return function(_0x9349x9){if(!_0x9349x9){_0x9349x5[_0x2d70[6]](404)[_0x2d70[8]]();return null};return _0x9349x9}}function saveUpdates(_0x9349xc){return function(_0x9349x9){return _0x9349x9[_0x2d70[10]](_0x9349xc)[_0x2d70[9]](function(_0x9349xd){return _0x9349xd})}}function removeEntity(_0x9349x5){return function(_0x9349x9){if(_0x9349x9){return _0x9349x9[_0x2d70[11]]()[_0x2d70[9]](function(){_0x9349x5[_0x2d70[6]](204)[_0x2d70[8]]()})}}}exports[_0x2d70[12]]=function(_0x9349xf,_0x9349x5){SugarcrmConfiguration[_0x2d70[15]]({where:_0x9349xf[_0x2d70[14]]})[_0x2d70[9]](responseWithResult(_0x9349x5))[_0x2d70[13]](handleError(_0x9349x5))};exports[_0x2d70[16]]=function(_0x9349xf,_0x9349x5){SugarcrmConfiguration[_0x2d70[22]]({where:{id:_0x9349xf[_0x2d70[18]][_0x2d70[17]]},include:[{model:SugarcrmField,as:_0x2d70[19]},{model:SugarcrmField,as:_0x2d70[20]},{model:SugarcrmField,as:_0x2d70[21]}]})[_0x2d70[9]](handleEntityNotFound(_0x9349x5))[_0x2d70[9]](responseWithResult(_0x9349x5))[_0x2d70[13]](handleError(_0x9349x5))};exports[_0x2d70[23]]=function(_0x9349xf,_0x9349x5){SugarcrmConfiguration[_0x2d70[23]](_0x9349xf[_0x2d70[24]])[_0x2d70[9]](responseWithResult(_0x9349x5,201))[_0x2d70[13]](handleError(_0x9349x5))};exports[_0x2d70[25]]=function(_0x9349xf,_0x9349x5){if(_0x9349xf[_0x2d70[24]][_0x2d70[17]]){delete _0x9349xf[_0x2d70[24]][_0x2d70[17]]};SugarcrmConfiguration[_0x2d70[26]](_0x9349xf[_0x2d70[18]][_0x2d70[17]])[_0x2d70[9]](handleEntityNotFound(_0x9349x5))[_0x2d70[9]](saveUpdates(_0x9349xf[_0x2d70[24]]))[_0x2d70[9]](responseWithResult(_0x9349x5))[_0x2d70[13]](handleError(_0x9349x5))};exports[_0x2d70[11]]=function(_0x9349xf,_0x9349x5){SugarcrmConfiguration[_0x2d70[26]](_0x9349xf[_0x2d70[18]][_0x2d70[17]])[_0x2d70[9]](handleEntityNotFound(_0x9349x5))[_0x2d70[9]](removeEntity(_0x9349x5))[_0x2d70[13]](handleError(_0x9349x5))};exports[_0x2d70[27]]=function(_0x9349xf,_0x9349x5,_0x9349x10){var _0x9349x11;SugarcrmConfiguration[_0x2d70[26]](_0x9349xf[_0x2d70[18]][_0x2d70[17]])[_0x2d70[9]](handleEntityNotFound(_0x9349x5))[_0x2d70[9]](function(_0x9349x14){_0x9349x11=_0x9349x14;return SugarcrmField[_0x2d70[23]](_0x9349xf[_0x2d70[24]])})[_0x2d70[9]](function(_0x9349x13){switch(_0x9349xf[_0x2d70[18]][_0x2d70[35]]){case _0x2d70[30]:return [_0x9349x11[_0x2d70[29]](_0x9349x13),_0x9349x13];case _0x2d70[32]:return [_0x9349x11[_0x2d70[31]](_0x9349x13),_0x9349x13];case _0x2d70[34]:return [_0x9349x11[_0x2d70[33]](_0x9349x13),_0x9349x13]}})[_0x2d70[28]](function(_0x9349x12,_0x9349x13){return _0x9349x5[_0x2d70[6]](201)[_0x2d70[7]](_0x9349x13)})[_0x2d70[13]](handleError(_0x9349x5))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/sugarcrm/configurations -> index + * POST /api/sugarcrm/configurations -> create + * GET /api/sugarcrm/configurations/:id -> show + * PUT /api/sugarcrm/configurations/:id -> update + * DELETE /api/sugarcrm/configurations/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var SugarcrmConfiguration = require('../../models').SugarcrmConfiguration; +var SugarcrmField = require('../../models').SugarcrmField; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SugarcrmConfigurations +exports.index = function(req, res) { + SugarcrmConfiguration.findAll({ + where: req.query + }) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single SugarcrmConfiguration from the DB +exports.show = function(req, res) { + SugarcrmConfiguration.find({ + where: { + id: req.params.id + }, + include: [{ + model: SugarcrmField, + as: 'Subject' + }, { + model: SugarcrmField, + as: 'Description' + }, { + model: SugarcrmField, + as: 'Field' + }] + }) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SugarcrmConfiguration in the DB +exports.create = function(req, res) { + SugarcrmConfiguration.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SugarcrmConfiguration in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + SugarcrmConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SugarcrmConfiguration from the DB +exports.destroy = function(req, res) { + SugarcrmConfiguration.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +exports.addConfigurationField = function(req, res, next) { + var sugarcrmConfiguration; + SugarcrmConfiguration + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(sugarcrm_configuration) { + sugarcrmConfiguration = sugarcrm_configuration; + return SugarcrmField.create(req.body) + }) + .then(function(sugarcrmField) { + switch (req.params.type) { + case 'subject': + return [sugarcrmConfiguration.addSubject(sugarcrmField), sugarcrmField]; + case 'description': + return [sugarcrmConfiguration.addDescription(sugarcrmField), sugarcrmField]; + case 'field': + return [sugarcrmConfiguration.addField(sugarcrmField), sugarcrmField]; + } + }) + .spread(function(data, sugarcrmField) { + return res.status(201).json(sugarcrmField); + }) + .catch(handleError(res)); +}; diff --git a/server/api/sugarcrm_configuration/sugarcrm_configuration.socket.js b/server/api/sugarcrm_configuration/sugarcrm_configuration.socket.js index ac15aed..c4464da 100644 --- a/server/api/sugarcrm_configuration/sugarcrm_configuration.socket.js +++ b/server/api/sugarcrm_configuration/sugarcrm_configuration.socket.js @@ -1 +1,24 @@ -var _0x8fd5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8fd5[0];var SugarcrmConfiguration=require(_0x8fd5[2])[_0x8fd5[1]];exports[_0x8fd5[3]]=function(_0xdaadx2){SugarcrmConfiguration[_0x8fd5[4]](function(_0xdaadx3){onSave(_0xdaadx2,_0xdaadx3)});SugarcrmConfiguration[_0x8fd5[5]](function(_0xdaadx3){onRemove(_0xdaadx2,_0xdaadx3)})};function onSave(_0xdaadx2,_0xdaadx3,_0xdaadx5){_0xdaadx2[_0x8fd5[7]](_0x8fd5[6],_0xdaadx3)}function onRemove(_0xdaadx2,_0xdaadx3,_0xdaadx5){_0xdaadx2[_0x8fd5[7]](_0x8fd5[8],_0xdaadx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SugarcrmConfiguration = require('../../models').SugarcrmConfiguration; + +exports.register = function(socket) { + SugarcrmConfiguration.afterCreate(function(doc) { + onSave(socket, doc); + }); + SugarcrmConfiguration.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('sugarcrm_configuration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('sugarcrm_configuration:remove', doc); +} diff --git a/server/api/sugarcrm_field/index.js b/server/api/sugarcrm_field/index.js index 668a7eb..edc0dc9 100644 --- a/server/api/sugarcrm_field/index.js +++ b/server/api/sugarcrm_field/index.js @@ -1 +1,18 @@ -var _0x8c45=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x8c45[0];var express=require(_0x8c45[1]);var auth=require(_0x8c45[2]);var controller=require(_0x8c45[3]);var router=express.Router();router[_0x8c45[7]](_0x8c45[4],auth[_0x8c45[5]](),controller[_0x8c45[6]]);router[_0x8c45[7]](_0x8c45[8],auth[_0x8c45[5]](),controller[_0x8c45[9]]);router[_0x8c45[11]](_0x8c45[4],auth[_0x8c45[5]](),controller[_0x8c45[10]]);router[_0x8c45[13]](_0x8c45[8],auth[_0x8c45[5]](),controller[_0x8c45[12]]);router[_0x8c45[14]](_0x8c45[8],auth[_0x8c45[5]](),controller[_0x8c45[12]]);router[_0x8c45[16]](_0x8c45[8],auth[_0x8c45[5]](),controller[_0x8c45[15]]);module[_0x8c45[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./sugarcrm_field.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); + +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/sugarcrm_field/index.spec.js b/server/api/sugarcrm_field/index.spec.js index 3c89fde..f8a20f7 100644 --- a/server/api/sugarcrm_field/index.spec.js +++ b/server/api/sugarcrm_field/index.spec.js @@ -1 +1,97 @@ -var _0x942a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6E\x6F\x50\x72\x65\x73\x65\x72\x76\x65\x43\x61\x63\x68\x65","\x70\x72\x6F\x78\x79\x71\x75\x69\x72\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x69\x6E\x64\x65\x78","\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x73\x68\x6F\x77","\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x63\x72\x65\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x75\x70\x64\x61\x74\x65","\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x43\x74\x72\x6C\x2E\x64\x65\x73\x74\x72\x6F\x79","\x73\x70\x79","\x2E\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x20\x41\x50\x49\x20\x52\x6F\x75\x74\x65\x72\x3A","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x74\x75\x72\x6E\x20\x61\x6E\x20\x65\x78\x70\x72\x65\x73\x73\x20\x72\x6F\x75\x74\x65\x72\x20\x69\x6E\x73\x74\x61\x6E\x63\x65","\x65\x71\x75\x61\x6C","\x74\x6F","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x69\x6E\x64\x65\x78","\x63\x61\x6C\x6C\x65\x64\x4F\x6E\x63\x65","\x62\x65\x65\x6E","\x68\x61\x76\x65","\x2F","\x77\x69\x74\x68\x41\x72\x67\x73","\x67\x65\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x73\x68\x6F\x77","\x2F\x3A\x69\x64","\x50\x4F\x53\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x50\x55\x54\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x50\x41\x54\x43\x48\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x44\x45\x4C\x45\x54\x45\x20\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x69\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x6F\x75\x74\x65\x20\x74\x6F\x20\x73\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72\x2E\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65"];_0x942a[0];var proxyquire=require(_0x942a[2])[_0x942a[1]]();var sugarcrmFieldCtrlStub={index:_0x942a[3],show:_0x942a[4],create:_0x942a[5],update:_0x942a[6],destroy:_0x942a[7]};var routerStub={get:sinon[_0x942a[8]](),put:sinon[_0x942a[8]](),patch:sinon[_0x942a[8]](),post:sinon[_0x942a[8]](),delete:sinon[_0x942a[8]]()};var sugarcrmFieldIndex=proxyquire(_0x942a[9],{"\x65\x78\x70\x72\x65\x73\x73":{Router:function(){return routerStub}},"\x2E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72":sugarcrmFieldCtrlStub});describe(_0x942a[10],function(){it(_0x942a[11],function(){expect(sugarcrmFieldIndex)[_0x942a[13]][_0x942a[12]](routerStub)});describe(_0x942a[14],function(){it(_0x942a[15],function(){expect(routerStub[_0x942a[21]][_0x942a[20]](_0x942a[19],_0x942a[3]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})});describe(_0x942a[22],function(){it(_0x942a[23],function(){expect(routerStub[_0x942a[21]][_0x942a[20]](_0x942a[24],_0x942a[4]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})});describe(_0x942a[25],function(){it(_0x942a[26],function(){expect(routerStub[_0x942a[27]][_0x942a[20]](_0x942a[19],_0x942a[5]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})});describe(_0x942a[28],function(){it(_0x942a[29],function(){expect(routerStub[_0x942a[30]][_0x942a[20]](_0x942a[24],_0x942a[6]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})});describe(_0x942a[31],function(){it(_0x942a[29],function(){expect(routerStub[_0x942a[32]][_0x942a[20]](_0x942a[24],_0x942a[6]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})});describe(_0x942a[33],function(){it(_0x942a[34],function(){expect(routerStub[_0x942a[35]][_0x942a[20]](_0x942a[24],_0x942a[7]))[_0x942a[13]][_0x942a[18]][_0x942a[17]][_0x942a[16]]})})}) \ No newline at end of file +'use strict'; + +var proxyquire = require('proxyquire').noPreserveCache(); + +var sugarcrmFieldCtrlStub = { + index: 'sugarcrmFieldCtrl.index', + show: 'sugarcrmFieldCtrl.show', + create: 'sugarcrmFieldCtrl.create', + update: 'sugarcrmFieldCtrl.update', + destroy: 'sugarcrmFieldCtrl.destroy' +}; + +var routerStub = { + get: sinon.spy(), + put: sinon.spy(), + patch: sinon.spy(), + post: sinon.spy(), + delete: sinon.spy() +}; + +// require the index with our stubbed out modules +var sugarcrmFieldIndex = proxyquire('./index.js', { + 'express': { + Router: function() { + return routerStub; + } + }, + './sugarcrm_field.controller': sugarcrmFieldCtrlStub +}); + +describe('SugarcrmField API Router:', function() { + + it('should return an express router instance', function() { + expect(sugarcrmFieldIndex).to.equal(routerStub); + }); + + describe('GET /api/sugarcrm/fields', function() { + + it('should route to sugarcrmField.controller.index', function() { + expect(routerStub.get + .withArgs('/', 'sugarcrmFieldCtrl.index') + ).to.have.been.calledOnce; + }); + + }); + + describe('GET /api/sugarcrm/fields/:id', function() { + + it('should route to sugarcrmField.controller.show', function() { + expect(routerStub.get + .withArgs('/:id', 'sugarcrmFieldCtrl.show') + ).to.have.been.calledOnce; + }); + + }); + + describe('POST /api/sugarcrm/fields', function() { + + it('should route to sugarcrmField.controller.create', function() { + expect(routerStub.post + .withArgs('/', 'sugarcrmFieldCtrl.create') + ).to.have.been.calledOnce; + }); + + }); + + describe('PUT /api/sugarcrm/fields/:id', function() { + + it('should route to sugarcrmField.controller.update', function() { + expect(routerStub.put + .withArgs('/:id', 'sugarcrmFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('PATCH /api/sugarcrm/fields/:id', function() { + + it('should route to sugarcrmField.controller.update', function() { + expect(routerStub.patch + .withArgs('/:id', 'sugarcrmFieldCtrl.update') + ).to.have.been.calledOnce; + }); + + }); + + describe('DELETE /api/sugarcrm/fields/:id', function() { + + it('should route to sugarcrmField.controller.destroy', function() { + expect(routerStub.delete + .withArgs('/:id', 'sugarcrmFieldCtrl.destroy') + ).to.have.been.calledOnce; + }); + + }); + +}); diff --git a/server/api/sugarcrm_field/sugarcrm_field.controller.js b/server/api/sugarcrm_field/sugarcrm_field.controller.js index 2b39dc4..eb6fe3d 100644 --- a/server/api/sugarcrm_field/sugarcrm_field.controller.js +++ b/server/api/sugarcrm_field/sugarcrm_field.controller.js @@ -1 +1,104 @@ -var _0x2dd7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65"];_0x2dd7[0];var _=require(_0x2dd7[1]);var SugarcrmField=require(_0x2dd7[3])[_0x2dd7[2]];function handleError(_0x69bex4,_0x69bex5){_0x69bex5=_0x69bex5||500;return function(_0x69bex6){_0x69bex4[_0x2dd7[5]](_0x69bex5)[_0x2dd7[4]](_0x69bex6)}}function responseWithResult(_0x69bex4,_0x69bex5){_0x69bex5=_0x69bex5||200;return function(_0x69bex8){if(_0x69bex8){_0x69bex4[_0x2dd7[5]](_0x69bex5)[_0x2dd7[6]](_0x69bex8)}}}function handleEntityNotFound(_0x69bex4){return function(_0x69bex8){if(!_0x69bex8){_0x69bex4[_0x2dd7[5]](404)[_0x2dd7[7]]();return null};return _0x69bex8}}function saveUpdates(_0x69bexb){return function(_0x69bex8){return _0x69bex8[_0x2dd7[9]](_0x69bexb)[_0x2dd7[8]](function(_0x69bexc){return _0x69bexc})}}function removeEntity(_0x69bex4){return function(_0x69bex8){if(_0x69bex8){return _0x69bex8[_0x2dd7[10]]()[_0x2dd7[8]](function(){_0x69bex4[_0x2dd7[5]](204)[_0x2dd7[7]]()})}}}exports[_0x2dd7[11]]=function(_0x69bexe,_0x69bex4){SugarcrmField[_0x2dd7[13]]()[_0x2dd7[8]](responseWithResult(_0x69bex4))[_0x2dd7[12]](handleError(_0x69bex4))};exports[_0x2dd7[14]]=function(_0x69bexe,_0x69bex4){SugarcrmField[_0x2dd7[17]](_0x69bexe[_0x2dd7[16]][_0x2dd7[15]])[_0x2dd7[8]](handleEntityNotFound(_0x69bex4))[_0x2dd7[8]](responseWithResult(_0x69bex4))[_0x2dd7[12]](handleError(_0x69bex4))};exports[_0x2dd7[18]]=function(_0x69bexe,_0x69bex4){SugarcrmField[_0x2dd7[18]](_0x69bexe[_0x2dd7[19]])[_0x2dd7[8]](responseWithResult(_0x69bex4,201))[_0x2dd7[12]](handleError(_0x69bex4))};exports[_0x2dd7[20]]=function(_0x69bexe,_0x69bex4){if(_0x69bexe[_0x2dd7[19]][_0x2dd7[15]]){delete _0x69bexe[_0x2dd7[19]][_0x2dd7[15]]};SugarcrmField[_0x2dd7[17]](_0x69bexe[_0x2dd7[16]][_0x2dd7[15]])[_0x2dd7[8]](handleEntityNotFound(_0x69bex4))[_0x2dd7[8]](saveUpdates(_0x69bexe[_0x2dd7[19]]))[_0x2dd7[8]](responseWithResult(_0x69bex4))[_0x2dd7[12]](handleError(_0x69bex4))};exports[_0x2dd7[10]]=function(_0x69bexe,_0x69bex4){SugarcrmField[_0x2dd7[17]](_0x69bexe[_0x2dd7[16]][_0x2dd7[15]])[_0x2dd7[8]](handleEntityNotFound(_0x69bex4))[_0x2dd7[8]](removeEntity(_0x69bex4))[_0x2dd7[12]](handleError(_0x69bex4))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/sugarcrm/fields -> index + * POST /api/sugarcrm/fields -> create + * GET /api/sugarcrm/fields/:id -> show + * PUT /api/sugarcrm/fields/:id -> update + * DELETE /api/sugarcrm/fields/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); + +var SugarcrmField = require('../../models').SugarcrmField; + + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of SugarcrmFields +exports.index = function(req, res) { + SugarcrmField.findAll() + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single SugarcrmField from the DB +exports.show = function(req, res) { + SugarcrmField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Creates a new SugarcrmField in the DB +exports.create = function(req, res) { + SugarcrmField.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing SugarcrmField in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + SugarcrmField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a SugarcrmField from the DB +exports.destroy = function(req, res) { + SugarcrmField.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} diff --git a/server/api/sugarcrm_field/sugarcrm_field.socket.js b/server/api/sugarcrm_field/sugarcrm_field.socket.js index a491226..bcc89cc 100644 --- a/server/api/sugarcrm_field/sugarcrm_field.socket.js +++ b/server/api/sugarcrm_field/sugarcrm_field.socket.js @@ -1 +1,24 @@ -var _0xb658=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0xb658[0];var SugarcrmField=require(_0xb658[2])[_0xb658[1]];exports[_0xb658[3]]=function(_0xf22ax2){SugarcrmField[_0xb658[4]](function(_0xf22ax3){onSave(_0xf22ax2,_0xf22ax3)});SugarcrmField[_0xb658[5]](function(_0xf22ax3){onRemove(_0xf22ax2,_0xf22ax3)})};function onSave(_0xf22ax2,_0xf22ax3,_0xf22ax5){_0xf22ax2[_0xb658[7]](_0xb658[6],_0xf22ax3)}function onRemove(_0xf22ax2,_0xf22ax3,_0xf22ax5){_0xf22ax2[_0xb658[7]](_0xb658[8],_0xf22ax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var SugarcrmField = require('../../models').SugarcrmField; + +exports.register = function(socket) { + SugarcrmField.afterCreate(function(doc) { + onSave(socket, doc); + }); + SugarcrmField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('sugarcrm_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('sugarcrm_field:remove', doc); +} diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0ea526d..17d7f06 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -1 +1,17 @@ -var _0xe1cf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x74\x61\x67\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xe1cf[0];var express=require(_0xe1cf[1]);var controller=require(_0xe1cf[2]);var auth=require(_0xe1cf[3]);var router=express.Router();router[_0xe1cf[7]](_0xe1cf[4],auth[_0xe1cf[5]](),controller[_0xe1cf[6]]);router[_0xe1cf[7]](_0xe1cf[8],auth[_0xe1cf[5]](),controller[_0xe1cf[9]]);router[_0xe1cf[11]](_0xe1cf[4],auth[_0xe1cf[5]](),controller[_0xe1cf[10]]);router[_0xe1cf[13]](_0xe1cf[8],auth[_0xe1cf[5]](),controller[_0xe1cf[12]]);router[_0xe1cf[14]](_0xe1cf[8],auth[_0xe1cf[5]](),controller[_0xe1cf[12]]);router[_0xe1cf[16]](_0xe1cf[4],auth[_0xe1cf[5]](),controller[_0xe1cf[15]]);router[_0xe1cf[16]](_0xe1cf[8],auth[_0xe1cf[5]](),controller[_0xe1cf[17]]);module[_0xe1cf[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./tag.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e07f283..38b0632 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -1 +1,116 @@ -var _0x4ab5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x61\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x73\x73\x61\x67\x65","\x54\x61\x67\x20\x69\x73\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x65\x64\x20\x77\x69\x74\x68\x20\x61\x6E\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x27\x73\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x73\x63\x6F\x70\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x6C\x65\x6E\x67\x74\x68"];_0x4ab5[0];var _=require(_0x4ab5[1]);var Tag=require(_0x4ab5[3])[_0x4ab5[2]];var Util=require(_0x4ab5[4]);exports[_0x4ab5[5]]=function(_0xc7b3x4,_0xc7b3x5,_0xc7b3x6){return Tag[_0x4ab5[12]](Util[_0x4ab5[11]](_0xc7b3x4[_0x4ab5[10]]))[_0x4ab5[9]](function(_0xc7b3x8){_0xc7b3x5[_0x4ab5[8]](200)[_0x4ab5[7]](_0xc7b3x8)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};exports[_0x4ab5[13]]=function(_0xc7b3x4,_0xc7b3x5){Tag[_0x4ab5[17]](_0xc7b3x4[_0x4ab5[16]][_0x4ab5[15]])[_0x4ab5[9]](function(_0xc7b3x9){if(!_0xc7b3x9){return _0xc7b3x5[_0x4ab5[14]](404)};return _0xc7b3x5[_0x4ab5[7]](_0xc7b3x9)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};exports[_0x4ab5[18]]=function(_0xc7b3x4,_0xc7b3x5){Tag[_0x4ab5[18]](_0xc7b3x4[_0x4ab5[19]])[_0x4ab5[9]](function(_0xc7b3x9){return _0xc7b3x5[_0x4ab5[8]](201)[_0x4ab5[7]](_0xc7b3x9)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};exports[_0x4ab5[20]]=function(_0xc7b3x4,_0xc7b3x5){if(_0xc7b3x4[_0x4ab5[19]][_0x4ab5[15]]){delete _0xc7b3x4[_0x4ab5[19]][_0x4ab5[15]]};return Tag[_0x4ab5[17]](_0xc7b3x4[_0x4ab5[16]][_0x4ab5[15]])[_0x4ab5[9]](function(_0xc7b3x9){if(!_0xc7b3x9){return _0xc7b3x5[_0x4ab5[14]](404)};var _0xc7b3xa=_[_0x4ab5[21]](_0xc7b3x9,_0xc7b3x4[_0x4ab5[19]]);return _0xc7b3xa[_0x4ab5[22]]()})[_0x4ab5[9]](function(_0xc7b3x9){return _0xc7b3x5[_0x4ab5[8]](200)[_0x4ab5[7]](_0xc7b3x9)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};exports[_0x4ab5[23]]=function(_0xc7b3x4,_0xc7b3x5){return Tag[_0x4ab5[27]](_0x4ab5[26])[_0x4ab5[17]](_0xc7b3x4[_0x4ab5[16]][_0x4ab5[15]])[_0x4ab5[9]](function(_0xc7b3x9){if(!_0xc7b3x9){return _0xc7b3x5[_0x4ab5[14]](404)};if(tagHasAssociation(_0xc7b3x9)){var _0xc7b3x7= new Error();_0xc7b3x7[_0x4ab5[24]]=_0x4ab5[25];throw _0xc7b3x7};return _0xc7b3x9[_0x4ab5[23]]()})[_0x4ab5[9]](function(){return _0xc7b3x5[_0x4ab5[14]](204)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};exports[_0x4ab5[28]]=function(_0xc7b3x4,_0xc7b3x5){Tag[_0x4ab5[23]]({where:{id:_0xc7b3x4[_0x4ab5[10]][_0x4ab5[29]]},individualHooks:true})[_0x4ab5[9]](function(){return _0xc7b3x5[_0x4ab5[14]](204)})[_0x4ab5[6]](function(_0xc7b3x7){return handleError(_0xc7b3x5,_0xc7b3x7)})};function handleError(_0xc7b3x5,_0xc7b3x7){return _0xc7b3x5[_0x4ab5[8]](500)[_0x4ab5[7]](_0xc7b3x7)}function tagHasAssociation(_0xc7b3x9){return ((_0xc7b3x9[_0x4ab5[30]]&&_0xc7b3x9[_0x4ab5[30]][_0x4ab5[31]]>0))} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Tag = require('../../models').Tag; +var Util = require('../../config/util'); + +// Get list of tags +exports.index = function(req, res, next) { + return Tag + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single tag +exports.show = function(req, res) { + Tag + .findById(req.params.id) + .then(function(tag) { + if (!tag) { + return res.sendStatus(404); + } + return res.send(tag); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new tag in the DB. +exports.create = function(req, res) { + Tag + .create(req.body) + .then(function(tag) { + return res.status(201).send(tag); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing tag in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return Tag + .findById(req.params.id) + .then(function(tag) { + if (!tag) { + return res.sendStatus(404); + } + var updated = _.merge(tag, req.body); + return updated + .save(); + }) + .then(function(tag) { + return res.status(200).send(tag); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a tag from the DB. +exports.destroy = function(req, res) { + return Tag + .scope('configuration') + .findById(req.params.id) + .then(function(tag) { + if (!tag) { + return res.sendStatus(404); + } + if (tagHasAssociation(tag)) { + var err = new Error(); + err.message = 'Tag is associated with an integration\'s configuration'; + throw err; + } + return tag.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + Tag + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} + +function tagHasAssociation(tag) { + return ((tag.ZendeskConfigurations && tag.ZendeskConfigurations.length > 0)); +} diff --git a/server/api/tag/tag.socket.js b/server/api/tag/tag.socket.js index 7f7ad64..790b0a2 100644 --- a/server/api/tag/tag.socket.js +++ b/server/api/tag/tag.socket.js @@ -1 +1,24 @@ -var _0x1c50=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x54\x61\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x74\x61\x67\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x61\x67\x3A\x72\x65\x6D\x6F\x76\x65"];_0x1c50[0];var Tag=require(_0x1c50[2])[_0x1c50[1]];exports[_0x1c50[3]]=function(_0x8bb6x2){Tag[_0x1c50[4]](function(_0x8bb6x3){onSave(_0x8bb6x2,_0x8bb6x3)});Tag[_0x1c50[5]](function(_0x8bb6x3){onRemove(_0x8bb6x2,_0x8bb6x3)})};function onSave(_0x8bb6x2,_0x8bb6x3,_0x8bb6x5){_0x8bb6x2[_0x1c50[7]](_0x1c50[6],_0x8bb6x3)}function onRemove(_0x8bb6x2,_0x8bb6x3,_0x8bb6x5){_0x8bb6x2[_0x1c50[7]](_0x1c50[8],_0x8bb6x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Tag = require('../../models').Tag; + +exports.register = function(socket) { + Tag.afterCreate(function(doc) { + onSave(socket, doc); + }); + Tag.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('tag:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('tag:remove', doc); +} diff --git a/server/api/tag/tag.spec.js b/server/api/tag/tag.spec.js index f435dbf..794a03a 100644 --- a/server/api/tag/tag.spec.js +++ b/server/api/tag/tag.spec.js @@ -1 +1,20 @@ -var _0xc62e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x74\x61\x67\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x74\x61\x67\x73","\x67\x65\x74"];_0xc62e[0];var should=require(_0xc62e[1]);var app=require(_0xc62e[2]);var request=require(_0xc62e[3]);describe(_0xc62e[4],function(){it(_0xc62e[5],function(_0x18a4x4){request(app)[_0xc62e[13]](_0xc62e[12])[_0xc62e[11]](200)[_0xc62e[11]](_0xc62e[10],/json/)[_0xc62e[9]](function(_0x18a4x5,_0x18a4x6){if(_0x18a4x5){return _0x18a4x4(_0x18a4x5)};_0x18a4x6[_0xc62e[8]][_0xc62e[1]][_0xc62e[7]][_0xc62e[6]](Array);_0x18a4x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/tags', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/tags') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/team/index.js b/server/api/team/index.js index d947449..afa9ea4 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -1 +1,20 @@ -var _0xf306=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x74\x65\x61\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x65\x78\x70\x6F\x72\x74\x73"];_0xf306[0];var express=require(_0xf306[1]);var controller=require(_0xf306[2]);var auth=require(_0xf306[3]);var router=express.Router();router[_0xf306[7]](_0xf306[4],auth[_0xf306[5]](),controller[_0xf306[6]]);router[_0xf306[7]](_0xf306[8],auth[_0xf306[5]](),controller[_0xf306[9]]);router[_0xf306[7]](_0xf306[10],auth[_0xf306[5]](),controller[_0xf306[11]]);router[_0xf306[13]](_0xf306[4],auth[_0xf306[5]](),controller[_0xf306[12]]);router[_0xf306[13]](_0xf306[10],auth[_0xf306[5]](),controller[_0xf306[14]]);router[_0xf306[16]](_0xf306[8],auth[_0xf306[5]](),controller[_0xf306[15]]);router[_0xf306[17]](_0xf306[8],auth[_0xf306[5]](),controller[_0xf306[15]]);router[_0xf306[19]](_0xf306[4],auth[_0xf306[5]](),controller[_0xf306[18]]);router[_0xf306[19]](_0xf306[8],auth[_0xf306[5]](),controller[_0xf306[20]]);router[_0xf306[19]](_0xf306[10],auth[_0xf306[5]](),controller[_0xf306[21]]);module[_0xf306[22]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./team.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/agents', auth.isAuthenticated(), controller.showAgents); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/agents', auth.isAuthenticated(), controller.addAgents); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/agents', auth.isAuthenticated(), controller.removeAgents); + +module.exports = router; diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3d56704..e911873 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -1 +1,170 @@ -var _0xed4b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x65\x61\x6D","\x55\x73\x65\x72","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74\x73","\x61\x64\x64\x55\x73\x65\x72\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72"];_0xed4b[0];var _=require(_0xed4b[1]);var util=require(_0xed4b[2]);var Util=require(_0xed4b[3]);var sequelize=require(_0xed4b[5])[_0xed4b[4]];var Team=require(_0xed4b[5])[_0xed4b[6]];var Agent=require(_0xed4b[5])[_0xed4b[7]];exports[_0xed4b[8]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[18]](_0xed4b[17])[_0xed4b[16]](_[_0xed4b[15]](Util[_0xed4b[14]](_0x246dx7[_0xed4b[13]])))[_0xed4b[12]](function(_0x246dxa){_0x246dx8[_0xed4b[11]](200)[_0xed4b[10]](_0x246dxa)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[19]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[18]](_0xed4b[17])[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};return _0x246dx8[_0xed4b[10]](_0x246dxb)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[24]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[18]](_0xed4b[17])[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};return _0x246dx8[_0xed4b[11]](200)[_0xed4b[10]](_0x246dxb.Users)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[25]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[18]](_0xed4b[17])[_0xed4b[25]](_0x246dx7[_0xed4b[28]])[_0xed4b[12]](function(_0x246dxb){return _0x246dx8[_0xed4b[11]](201)[_0xed4b[10]](_0x246dxb)})[_0xed4b[9]](sequelize.UniqueConstraintError,function(_0x246dx9){return Util[_0xed4b[27]][_0xed4b[26]](_0x246dx8,_0x246dx9)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[29]]=function(_0x246dx7,_0x246dx8){if(_0x246dx7[_0xed4b[28]][_0xed4b[21]]){delete _0x246dx7[_0xed4b[28]][_0xed4b[21]]};return Team[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};var _0x246dxc=_[_0xed4b[15]](_0x246dxb,_0x246dx7[_0xed4b[28]]);return _0x246dxc[_0xed4b[30]]()})[_0xed4b[12]](function(_0x246dxb){return _0x246dx8[_0xed4b[11]](200)[_0xed4b[10]](_0x246dxb)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[31]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};return _0x246dxb[_0xed4b[31]]()})[_0xed4b[12]](function(){return _0x246dx8[_0xed4b[20]](204)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[32]]=function(_0x246dx7,_0x246dx8){return Team[_0xed4b[31]]({where:{id:_0x246dx7[_0xed4b[13]][_0xed4b[33]]},individualHooks:true})[_0xed4b[12]](function(){return _0x246dx8[_0xed4b[20]](204)})[_0xed4b[9]](function(_0x246dx9){return handleError(_0x246dx8,_0x246dx9)})};exports[_0xed4b[34]]=function(_0x246dx7,_0x246dx8,_0x246dxd){return Team[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};return _0x246dxb[_0xed4b[36]](_0x246dx7[_0xed4b[28]][_0xed4b[35]])})[_0xed4b[12]](function(){return _0x246dx8[_0xed4b[20]](201)})[_0xed4b[9]](function(_0x246dx9){return _0x246dxd(_0x246dx9)})};exports[_0xed4b[37]]=function(_0x246dx7,_0x246dx8,_0x246dxd){return Team[_0xed4b[23]](_0x246dx7[_0xed4b[22]][_0xed4b[21]])[_0xed4b[12]](function(_0x246dxb){if(!_0x246dxb){return _0x246dx8[_0xed4b[20]](404)};return _0x246dxb[_0xed4b[38]](_0x246dx7[_0xed4b[13]][_0xed4b[35]])})[_0xed4b[12]](function(){return _0x246dx8[_0xed4b[20]](202)})[_0xed4b[9]](function(_0x246dx9){return _0x246dxd(_0x246dx9)})};function handleError(_0x246dx8,_0x246dx9){return _0x246dx8[_0xed4b[11]](500)[_0xed4b[10]](_0x246dx9)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var Team = require('../../models').Team; +var Agent = require('../../models').User; + +// Get list of teams +exports.index = function(req, res) { + return Team + .scope('default') + .findAndCountAll(_.merge(Util.getQuery(req.query))) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single team +exports.show = function(req, res) { + return Team + .scope('default') + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + return res.send(team); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single team +exports.showAgents = function(req, res) { + return Team + .scope('default') + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + return res.status(200).send(team.Users); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new team in the DB. +exports.create = function(req, res) { + return Team + .scope('default') + .create(req.body) + .then(function(team) { + return res.status(201).send(team); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing team in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return Team + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + var updated = _.merge(team, req.body); + return updated + .save(); + }) + .then(function(team) { + return res.status(200).send(team); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a team from the DB. +exports.destroy = function(req, res) { + return Team + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + return team.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return Team + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_mail_queue in the DB. +exports.addAgents = function(req, res, next) { + return Team + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + return team + .addUsers(req.body.agents); + }) + .then(function() { + return res.sendStatus(201); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.removeAgents = function(req, res, next) { + return Team + .findById(req.params.id) + .then(function(team) { + if (!team) { + return res.sendStatus(404); + } + return team + .removeUser(req.query.agents); + }) + .then(function() { + return res.sendStatus(202); + }) + .catch(function(err) { + return next(err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5473cf9..3f89dc2 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -1 +1,27 @@ -var _0xfbba=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x54\x65\x61\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x74\x65\x61\x6D\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x65\x61\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0xfbba[0];var team=require(_0xfbba[2])[_0xfbba[1]];exports[_0xfbba[3]]=function(_0x36f4x2){team[_0xfbba[4]](function(_0x36f4x3){onSave(_0x36f4x2,_0x36f4x3)});team[_0xfbba[5]](function(_0x36f4x3){onSave(_0x36f4x2,_0x36f4x3)});team[_0xfbba[6]](function(_0x36f4x3){onRemove(_0x36f4x2,_0x36f4x3)})};function onSave(_0x36f4x2,_0x36f4x3,_0x36f4x5){_0x36f4x2[_0xfbba[8]](_0xfbba[7],_0x36f4x3)}function onRemove(_0x36f4x2,_0x36f4x3,_0x36f4x5){_0x36f4x2[_0xfbba[8]](_0xfbba[9],_0x36f4x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var team = require('../../models').Team; + +exports.register = function(socket) { + team.afterCreate(function(doc) { + onSave(socket, doc); + }); + team.afterUpdate(function(doc) { + onSave(socket, doc); + }); + team.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('team:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('team:remove', doc); +} diff --git a/server/api/team/team.spec.js b/server/api/team/team.spec.js index 9fb580d..b76928a 100644 --- a/server/api/team/team.spec.js +++ b/server/api/team/team.spec.js @@ -1 +1,20 @@ -var _0x6f00=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x74\x65\x61\x6D\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x74\x65\x61\x6D\x73","\x67\x65\x74"];_0x6f00[0];var should=require(_0x6f00[1]);var app=require(_0x6f00[2]);var request=require(_0x6f00[3]);describe(_0x6f00[4],function(){it(_0x6f00[5],function(_0x27d5x4){request(app)[_0x6f00[13]](_0x6f00[12])[_0x6f00[11]](200)[_0x6f00[11]](_0x6f00[10],/json/)[_0x6f00[9]](function(_0x27d5x5,_0x27d5x6){if(_0x27d5x5){return _0x27d5x4(_0x27d5x5)};_0x27d5x6[_0x6f00[8]][_0x6f00[1]][_0x6f00[7]][_0x6f00[6]](Array);_0x27d5x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/teams', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/teams') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/telephone/index.js b/server/api/telephone/index.js index addf649..f7e10cb 100644 --- a/server/api/telephone/index.js +++ b/server/api/telephone/index.js @@ -1 +1,20 @@ -var _0xc65d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x69\x73\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73\x4C\x69\x6D\x69\x74","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xc65d[0];var express=require(_0xc65d[1]);var auth=require(_0xc65d[2]);var controller=require(_0xc65d[3]);var license=require(_0xc65d[4]);var router=express.Router();router[_0xc65d[8]](_0xc65d[5],auth[_0xc65d[6]](),controller[_0xc65d[7]]);router[_0xc65d[8]](_0xc65d[9],auth[_0xc65d[6]](),controller[_0xc65d[10]]);router[_0xc65d[8]](_0xc65d[11],auth[_0xc65d[6]](),controller[_0xc65d[12]]);router[_0xc65d[16]](_0xc65d[5],auth[_0xc65d[6]](),license[_0xc65d[13]](),license[_0xc65d[14]](),controller[_0xc65d[15]]);router[_0xc65d[18]](_0xc65d[11],auth[_0xc65d[6]](),controller[_0xc65d[17]]);router[_0xc65d[19]](_0xc65d[11],auth[_0xc65d[6]](),controller[_0xc65d[17]]);router[_0xc65d[21]](_0xc65d[5],auth[_0xc65d[6]](),controller[_0xc65d[20]]);router[_0xc65d[21]](_0xc65d[11],auth[_0xc65d[6]](),controller[_0xc65d[22]]);module[_0xc65d[23]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./telephone.controller'); +var license = require('../../config/license/license.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/internal', auth.isAuthenticated(), controller.getInternal); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), license.isValidDate(), license.isTelephonesLimit(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + + +module.exports = router; diff --git a/server/api/telephone/telephone.controller.js b/server/api/telephone/telephone.controller.js index de79331..75bb5f7 100644 --- a/server/api/telephone/telephone.controller.js +++ b/server/api/telephone/telephone.controller.js @@ -1 +1,174 @@ -var _0x2ab1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x61\x78","\x67\x65\x74\x49\x6E\x74\x65\x72\x6E\x61\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x72\x65\x71\x2E\x70\x61\x72\x61\x6D\x73","\x6C\x6F\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6C\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x2ab1[0];var _=require(_0x2ab1[1]);var Util=require(_0x2ab1[2]);var sequelize=require(_0x2ab1[4])[_0x2ab1[3]];var Telephone=require(_0x2ab1[4])[_0x2ab1[5]];function handleError(_0xceb7x6,_0xceb7x7){_0xceb7x7=_0xceb7x7||500;return function(_0xceb7x8){_0xceb7x6[_0x2ab1[7]](_0xceb7x7)[_0x2ab1[6]](_0xceb7x8)}}function responseWithResult(_0xceb7x6,_0xceb7x7){_0xceb7x7=_0xceb7x7||200;return function(_0xceb7xa){if(_0xceb7xa){_0xceb7x6[_0x2ab1[7]](_0xceb7x7)[_0x2ab1[8]](_0xceb7xa)}}}function handleEntityNotFound(_0xceb7x6){return function(_0xceb7xa){if(!_0xceb7xa){_0xceb7x6[_0x2ab1[7]](404)[_0x2ab1[9]]();return null};return _0xceb7xa}}function saveUpdates(_0xceb7xd){return function(_0xceb7xa){return _0xceb7xa[_0x2ab1[11]](_0xceb7xd)[_0x2ab1[10]](function(_0xceb7xe){return _0xceb7xe})}}function removeEntity(_0xceb7x6){return function(_0xceb7xa){if(_0xceb7xa){return _0xceb7xa[_0x2ab1[12]]()[_0x2ab1[10]](function(){_0xceb7x6[_0x2ab1[7]](204)[_0x2ab1[9]]()})}}}exports[_0x2ab1[13]]=function(_0xceb7x10,_0xceb7x6){return Telephone[_0x2ab1[19]](_0x2ab1[18])[_0x2ab1[17]](Util[_0x2ab1[16]](_0xceb7x10[_0x2ab1[15]]))[_0x2ab1[10]](function(_0xceb7x11){_0xceb7x6[_0x2ab1[7]](200)[_0x2ab1[6]](_0xceb7x11)})[_0x2ab1[14]](function(_0xceb7x8){return handleError(_0xceb7x6,_0xceb7x8)})};exports[_0x2ab1[20]]=function(_0xceb7x10,_0xceb7x6){Telephone[_0x2ab1[23]](_0xceb7x10[_0x2ab1[22]][_0x2ab1[21]])[_0x2ab1[10]](handleEntityNotFound(_0xceb7x6))[_0x2ab1[10]](responseWithResult(_0xceb7x6))[_0x2ab1[14]](handleError(_0xceb7x6))};exports[_0x2ab1[24]]=function(_0xceb7x10,_0xceb7x6){var _0xceb7x12;return Telephone[_0x2ab1[26]](_0x2ab1[25])[_0x2ab1[10]](function(_0xceb7x13){_0xceb7x12=_0xceb7x13?_0xceb7x13:0;_0xceb7x6[_0x2ab1[7]](200)[_0x2ab1[6]]({internal:_0xceb7x12+1})})[_0x2ab1[14]](function(_0xceb7x8){return handleError(_0xceb7x6,_0xceb7x8)})};exports[_0x2ab1[27]]=function(_0xceb7x10,_0xceb7x6){console[_0x2ab1[29]](_0x2ab1[28],_0xceb7x10[_0x2ab1[22]]);return Telephone[_0x2ab1[32]]({where:{internal:_0xceb7x10[_0x2ab1[31]][_0x2ab1[25]]}})[_0x2ab1[10]](function(_0xceb7x14){if(!_0xceb7x14){return _0xceb7x6[_0x2ab1[30]](404)};return _0xceb7x6[_0x2ab1[6]](_0xceb7x14)})[_0x2ab1[14]](function(_0xceb7x8){return handleError(_0xceb7x6,_0xceb7x8)})};exports[_0x2ab1[33]]=function(_0xceb7x10,_0xceb7x6){_0xceb7x10[_0x2ab1[31]][_0x2ab1[34]]=_0x2ab1[18];return Telephone[_0x2ab1[33]](_0xceb7x10[_0x2ab1[31]])[_0x2ab1[10]](responseWithResult(_0xceb7x6,201))[_0x2ab1[14]](sequelize.UniqueConstraintError,function(_0xceb7x8){return Util[_0x2ab1[36]][_0x2ab1[35]](_0xceb7x6,_0xceb7x8)})[_0x2ab1[14]](handleError(_0xceb7x6))};exports[_0x2ab1[37]]=function(_0xceb7x10,_0xceb7x6){if(_0xceb7x10[_0x2ab1[31]][_0x2ab1[21]]){delete _0xceb7x10[_0x2ab1[31]][_0x2ab1[21]]};return Telephone[_0x2ab1[23]](_0xceb7x10[_0x2ab1[22]][_0x2ab1[21]])[_0x2ab1[10]](handleEntityNotFound(_0xceb7x6))[_0x2ab1[10]](saveUpdates(_0xceb7x10[_0x2ab1[31]]))[_0x2ab1[10]](responseWithResult(_0xceb7x6))[_0x2ab1[14]](sequelize.UniqueConstraintError,function(_0xceb7x8){return Util[_0x2ab1[36]][_0x2ab1[35]](_0xceb7x6,_0xceb7x8)})[_0x2ab1[14]](handleError(_0xceb7x6))};exports[_0x2ab1[12]]=function(_0xceb7x10,_0xceb7x6){return Telephone[_0x2ab1[23]](_0xceb7x10[_0x2ab1[22]][_0x2ab1[21]])[_0x2ab1[10]](handleEntityNotFound(_0xceb7x6))[_0x2ab1[10]](removeEntity(_0xceb7x6))[_0x2ab1[14]](handleError(_0xceb7x6))};exports[_0x2ab1[38]]=function(_0xceb7x10,_0xceb7x6){return Telephone[_0x2ab1[12]]({where:{id:_0xceb7x10[_0x2ab1[15]][_0x2ab1[39]]},individualHooks:true})[_0x2ab1[10]](function(){return _0xceb7x6[_0x2ab1[30]](204)})[_0x2ab1[14]](function(_0xceb7x8){return handleError(_0xceb7x6,_0xceb7x8)})} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/telephones -> index + * POST /api/telephones -> create + * GET /api/telephones/:id -> show + * PUT /api/telephones/:id -> update + * DELETE /api/telephones/:id -> destroy + */ + +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var Telephone = require('../../models').User; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Gets a list of Telephones +exports.index = function(req, res) { + return Telephone + .scope('telephone') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +} + +// Gets a single Telephone from the DB +exports.show = function(req, res) { + Telephone.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Get list of settings +exports.getInternal = function(req, res) { + + var _tinternal; + + return Telephone + .max('internal') + .then(function(tinternal) { + _tinternal = tinternal ? tinternal : 0; + + res.status(200).send({ + internal: _tinternal + 1 + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Validate the existence of an internal number +exports.getInternalValidation = function(req, res) { + console.log('req.params', req.params); + return Telephone + .findAll({ + where: { + internal: req.body.internal + } + }) + .then(function(internals) { + if (!internals) { + return res.sendStatus(404); + } + return res.send(internals); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new Telephone in the DB +exports.create = function(req, res) { + req.body.role = 'telephone'; + return Telephone + .create(req.body) + .then(responseWithResult(res, 201)) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(handleError(res)); +} + +// Updates an existing Telephone in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return Telephone.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(handleError(res)); +} + +// Deletes a Telephone from the DB +exports.destroy = function(req, res) { + return Telephone.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return Telephone + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; diff --git a/server/api/telephone/telephone.socket.js b/server/api/telephone/telephone.socket.js index 12166d9..11f6d7a 100644 --- a/server/api/telephone/telephone.socket.js +++ b/server/api/telephone/telephone.socket.js @@ -1 +1,24 @@ -var _0x7359=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x72\x65\x67\x69\x73\x74\x65\x72","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7359[0];exports[_0x7359[1]]=function(_0x24dax1){};function onSave(_0x24dax1,_0x24dax3,_0x24dax4){_0x24dax1[_0x7359[3]](_0x7359[2],_0x24dax3)}function onRemove(_0x24dax1,_0x24dax3,_0x24dax4){_0x24dax1[_0x7359[3]](_0x7359[4],_0x24dax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +// var Telephone = require('../../models').Telephone; + +exports.register = function (socket) { + // Telephone.afterCreate(function(doc) { + // onSave(socket, doc); + // }); + // Telephone.afterDestroy(function(doc) { + // onRemove(socket, doc); + // }); +}; + +function onSave(socket, doc, cb) { + socket.emit('telephone:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('telephone:remove', doc); +} diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c2535be..e2c0971 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -1 +1,17 @@ -var _0xc9ed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x74\x72\x69\x67\x67\x65\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xc9ed[0];var express=require(_0xc9ed[1]);var controller=require(_0xc9ed[2]);var auth=require(_0xc9ed[3]);var router=express.Router();router[_0xc9ed[7]](_0xc9ed[4],auth[_0xc9ed[5]](),controller[_0xc9ed[6]]);router[_0xc9ed[7]](_0xc9ed[8],auth[_0xc9ed[5]](),controller[_0xc9ed[9]]);router[_0xc9ed[11]](_0xc9ed[4],auth[_0xc9ed[5]](),controller[_0xc9ed[10]]);router[_0xc9ed[13]](_0xc9ed[8],auth[_0xc9ed[5]](),controller[_0xc9ed[12]]);router[_0xc9ed[14]](_0xc9ed[8],auth[_0xc9ed[5]](),controller[_0xc9ed[12]]);router[_0xc9ed[16]](_0xc9ed[8],auth[_0xc9ed[5]](),controller[_0xc9ed[15]]);router[_0xc9ed[16]](_0xc9ed[4],auth[_0xc9ed[5]](),controller[_0xc9ed[17]]);module[_0xc9ed[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./trigger.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); + +module.exports = router; diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 13c4f92..97bbaf4 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -1 +1,199 @@ -var _0xd646=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x72\x69\x67\x67\x65\x72","\x54\x6F\x6F\x6C\x73\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x54\x6F\x6F\x6C\x73\x41\x63\x74\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x41\x6C\x6C","\x41\x6E\x79","\x41\x63\x74\x69\x6F\x6E\x73","\x75\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x54\x72\x69\x67\x67\x65\x72\x49\x64","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x54\x72\x69\x67\x67\x65\x72\x41\x6C\x6C\x49\x64","\x54\x72\x69\x67\x67\x65\x72\x41\x6E\x79\x49\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0xd646[0];var _=require(_0xd646[1]);var util=require(_0xd646[2]);var Util=require(_0xd646[3]);var sequelize=require(_0xd646[5])[_0xd646[4]];var Trigger=require(_0xd646[5])[_0xd646[6]];var ToolsCondition=require(_0xd646[5])[_0xd646[7]];var ToolsAction=require(_0xd646[5])[_0xd646[8]];exports[_0xd646[9]]=function(_0x53d1x8,_0x53d1x9,_0x53d1xa){return Trigger[_0xd646[18]](_0xd646[17])[_0xd646[16]](Util[_0xd646[15]](_0x53d1x8[_0xd646[14]]))[_0xd646[13]](function(_0x53d1xc){_0x53d1x9[_0xd646[12]](200)[_0xd646[11]](_0x53d1xc)})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})};exports[_0xd646[19]]=function(_0x53d1x8,_0x53d1x9){Trigger[_0xd646[18]](_0xd646[17])[_0xd646[23]](_0x53d1x8[_0xd646[22]][_0xd646[21]])[_0xd646[13]](function(Trigger){if(!Trigger){return _0x53d1x9[_0xd646[20]](404)};return _0x53d1x9[_0xd646[11]](Trigger)})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})};exports[_0xd646[24]]=function(_0x53d1x8,_0x53d1x9){Trigger[_0xd646[24]](_0x53d1x8[_0xd646[25]],{include:[{model:ToolsCondition,as:_0xd646[26]},{model:ToolsCondition,as:_0xd646[27]},{model:ToolsAction,as:_0xd646[28]}]})[_0xd646[13]](function(){return _0x53d1x9[_0xd646[20]](201)})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})};exports[_0xd646[29]]=function(_0x53d1x8,_0x53d1x9,_0x53d1xa){var _0x53d1xd;if(_0x53d1x8[_0xd646[25]][_0xd646[21]]){delete _0x53d1x8[_0xd646[25]][_0xd646[21]]};return sequelize[_0xd646[41]](function(_0x53d1xe){return Trigger[_0xd646[23]](_0x53d1x8[_0xd646[22]][_0xd646[21]])[_0xd646[13]](function(_0x53d1x10){if(!_0x53d1x10){return _0x53d1x9[_0xd646[20]](404)};var _0x53d1x11=_[_0xd646[39]](_0x53d1x10,_0x53d1x8[_0xd646[25]]);return _0x53d1x11[_0xd646[40]]({transaction:_0x53d1xe})})[_0xd646[13]](function(_0x53d1x10){_0x53d1xd=_0x53d1x10;if(_0x53d1x8[_0xd646[25]][_0xd646[27]]){return ToolsCondition[_0xd646[36]]({where:{TriggerAnyId:_0x53d1x8[_0xd646[22]][_0xd646[21]]},transaction:_0x53d1xe})}})[_0xd646[13]](function(){if(_0x53d1x8[_0xd646[25]][_0xd646[27]]&&Array[_0xd646[31]](_0x53d1x8[_0xd646[25]].Any)&&_0x53d1x8[_0xd646[25]][_0xd646[27]][_0xd646[32]]){_[_0xd646[34]](_0x53d1x8[_0xd646[25]].Any,function(_0x53d1xf){_0x53d1xf[_0xd646[38]]=_0x53d1x8[_0xd646[22]][_0xd646[21]]});return ToolsCondition[_0xd646[35]](_0x53d1x8[_0xd646[25]].Any,{transaction:_0x53d1xe})}})[_0xd646[13]](function(){if(_0x53d1x8[_0xd646[25]][_0xd646[26]]){return ToolsCondition[_0xd646[36]]({where:{TriggerAllId:_0x53d1x8[_0xd646[22]][_0xd646[21]]},transaction:_0x53d1xe})}})[_0xd646[13]](function(){if(_0x53d1x8[_0xd646[25]][_0xd646[26]]&&Array[_0xd646[31]](_0x53d1x8[_0xd646[25]].All)&&_0x53d1x8[_0xd646[25]][_0xd646[26]][_0xd646[32]]){_[_0xd646[34]](_0x53d1x8[_0xd646[25]].All,function(_0x53d1xf){_0x53d1xf[_0xd646[37]]=_0x53d1x8[_0xd646[22]][_0xd646[21]]});return ToolsCondition[_0xd646[35]](_0x53d1x8[_0xd646[25]].All,{transaction:_0x53d1xe})}})[_0xd646[13]](function(){if(_0x53d1x8[_0xd646[25]][_0xd646[28]]){return ToolsAction[_0xd646[36]]({where:{TriggerId:_0x53d1x8[_0xd646[22]][_0xd646[21]]},transaction:_0x53d1xe})}})[_0xd646[13]](function(){if(_0x53d1x8[_0xd646[25]][_0xd646[28]]&&Array[_0xd646[31]](_0x53d1x8[_0xd646[25]].Actions)&&_0x53d1x8[_0xd646[25]][_0xd646[28]][_0xd646[32]]){_[_0xd646[34]](_0x53d1x8[_0xd646[25]].Actions,function(_0x53d1xf){_0x53d1xf[_0xd646[33]]=_0x53d1x8[_0xd646[22]][_0xd646[21]]});return ToolsAction[_0xd646[35]](_0x53d1x8[_0xd646[25]].Actions,{transaction:_0x53d1xe})}})})[_0xd646[13]](function(){return _0x53d1x9[_0xd646[20]](200)})[_0xd646[10]](function(_0x53d1xb){console[_0xd646[30]](_0x53d1xb);return handleError(_0x53d1x9,_0x53d1xb)})};exports[_0xd646[36]]=function(_0x53d1x8,_0x53d1x9){Trigger[_0xd646[23]](_0x53d1x8[_0xd646[22]][_0xd646[21]])[_0xd646[13]](function(Trigger){if(!Trigger){return _0x53d1x9[_0xd646[20]](404)};Trigger[_0xd646[36]]()[_0xd646[13]](function(){return _0x53d1x9[_0xd646[20]](204)})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})};exports[_0xd646[42]]=function(_0x53d1x8,_0x53d1x9){Trigger[_0xd646[36]]({where:{id:_0x53d1x8[_0xd646[14]][_0xd646[21]]},individualHooks:true})[_0xd646[13]](function(){return _0x53d1x9[_0xd646[20]](204)})[_0xd646[10]](function(_0x53d1xb){return handleError(_0x53d1x9,_0x53d1xb)})};function handleError(_0x53d1x9,_0x53d1xb){return _0x53d1x9[_0xd646[12]](500)[_0xd646[11]](_0x53d1xb)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var Util = require('../../config/util'); +var sequelize = require('../../models').sequelize; + +var Trigger = require('../../models').Trigger; +var ToolsCondition = require('../../models').ToolsCondition; +var ToolsAction = require('../../models').ToolsAction; + +// Get list of agents +exports.index = function(req, res, next) { + return Trigger + .scope('all') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single Trigger +exports.show = function(req, res) { + Trigger + .scope('all') + .findById(req.params.id) + .then(function(Trigger) { + if (!Trigger) { + return res.sendStatus(404); + } + return res.send(Trigger); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new Trigger in the DB. +exports.create = function(req, res) { + Trigger + .create(req.body, { + include: [{ + model: ToolsCondition, + as: 'All' + }, { + model: ToolsCondition, + as: 'Any' + }, { + model: ToolsAction, + as: 'Actions' + }] + }) + .then(function() { + return res.sendStatus(201); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing Trigger in the DB. +exports.update = function(req, res, next) { + var _trigger; + if (req.body.id) { + delete req.body.id; + } + return sequelize.transaction(function(t) { + return Trigger + .findById(req.params.id) + .then(function(trigger) { + if (!trigger) { + return res.sendStatus(404); + } + var updated = _.merge(trigger, req.body); + return updated + .save({ + transaction: t + }); + }) + .then(function(trigger) { + _trigger = trigger; + if (req.body.Any) { + return ToolsCondition + .destroy({ + where: { + TriggerAnyId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.Any && Array.isArray(req.body.Any) && req.body.Any.length) { + _.forEach(req.body.Any, function(elem) { + elem.TriggerAnyId = req.params.id; + }); + return ToolsCondition + .bulkCreate(req.body.Any, { + transaction: t + }); + } + }) + .then(function() { + if (req.body.All) { + return ToolsCondition + .destroy({ + where: { + TriggerAllId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.All && Array.isArray(req.body.All) && req.body.All.length) { + _.forEach(req.body.All, function(elem) { + elem.TriggerAllId = req.params.id; + }); + return ToolsCondition + .bulkCreate(req.body.All, { + transaction: t + }); + } + }) + .then(function() { + if (req.body.Actions) { + return ToolsAction + .destroy({ + where: { + TriggerId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.Actions && Array.isArray(req.body.Actions) && req.body.Actions.length) { + _.forEach(req.body.Actions, function(elem) { + elem.TriggerId = req.params.id; + }); + return ToolsAction + .bulkCreate(req.body.Actions, { + transaction: t + }); + } + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Deletes a Trigger from the DB. +exports.destroy = function(req, res) { + Trigger + .findById(req.params.id) + .then(function(Trigger) { + if (!Trigger) { + return res.sendStatus(404); + } + Trigger.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + Trigger + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/trigger/trigger.socket.js b/server/api/trigger/trigger.socket.js index afd9a75..7fe5fa2 100644 --- a/server/api/trigger/trigger.socket.js +++ b/server/api/trigger/trigger.socket.js @@ -1 +1,24 @@ -var _0x90c1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x54\x72\x69\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x74\x72\x69\x67\x67\x65\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x72\x69\x67\x67\x65\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0x90c1[0];var Trigger=require(_0x90c1[2])[_0x90c1[1]];exports[_0x90c1[3]]=function(_0xcbb4x2){Trigger[_0x90c1[4]](function(_0xcbb4x3){onSave(_0xcbb4x2,_0xcbb4x3)});Trigger[_0x90c1[5]](function(_0xcbb4x3){onRemove(_0xcbb4x2,_0xcbb4x3)})};function onSave(_0xcbb4x2,_0xcbb4x3,_0xcbb4x5){_0xcbb4x2[_0x90c1[7]](_0x90c1[6],_0xcbb4x3)}function onRemove(_0xcbb4x2,_0xcbb4x3,_0xcbb4x5){_0xcbb4x2[_0x90c1[7]](_0x90c1[8],_0xcbb4x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Trigger = require('../../models').Trigger; + +exports.register = function(socket) { + Trigger.afterCreate(function(doc) { + onSave(socket, doc); + }); + Trigger.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('trigger:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('trigger:remove', doc); +} diff --git a/server/api/trigger/trigger.spec.js b/server/api/trigger/trigger.spec.js index 372a658..c88586d 100644 --- a/server/api/trigger/trigger.spec.js +++ b/server/api/trigger/trigger.spec.js @@ -1 +1,20 @@ -var _0xb74e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x74\x72\x69\x67\x67\x65\x72\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x74\x72\x69\x67\x67\x65\x72\x73","\x67\x65\x74"];_0xb74e[0];var should=require(_0xb74e[1]);var app=require(_0xb74e[2]);var request=require(_0xb74e[3]);describe(_0xb74e[4],function(){it(_0xb74e[5],function(_0x93c7x4){request(app)[_0xb74e[13]](_0xb74e[12])[_0xb74e[11]](200)[_0xb74e[11]](_0xb74e[10],/json/)[_0xb74e[9]](function(_0x93c7x5,_0x93c7x6){if(_0x93c7x5){return _0x93c7x4(_0x93c7x5)};_0x93c7x6[_0xb74e[8]][_0xb74e[1]][_0xb74e[7]][_0xb74e[6]](Array);_0x93c7x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/triggers', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/triggers') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ae95f2f..ea72fdd 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -1 +1,18 @@ -var _0xc118=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x74\x72\x75\x6E\x6B\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x74\x72\x75\x6E\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xc118[0];var express=require(_0xc118[1]);var controller=require(_0xc118[2]);var config=require(_0xc118[3]);var auth=require(_0xc118[4]);var router=express.Router();router[_0xc118[8]](_0xc118[5],auth[_0xc118[6]](),controller[_0xc118[7]]);router[_0xc118[8]](_0xc118[9],auth[_0xc118[6]](),controller[_0xc118[10]]);router[_0xc118[12]](_0xc118[5],auth[_0xc118[6]](),controller[_0xc118[11]]);router[_0xc118[12]](_0xc118[13],auth[_0xc118[6]](),controller[_0xc118[14]]);router[_0xc118[16]](_0xc118[9],auth[_0xc118[6]](),controller[_0xc118[15]]);router[_0xc118[18]](_0xc118[5],auth[_0xc118[6]](),controller[_0xc118[17]]);router[_0xc118[18]](_0xc118[9],auth[_0xc118[6]](),controller[_0xc118[19]]);module[_0xc118[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./trunk.controller'); +var config = require('../../config/environment'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.trunkValidation); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e1391e2..eff129a 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -1 +1,160 @@ -var _0xcf98=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x72\x75\x6E\x6B","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x74\x72\x75\x6E\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x6C\x65\x6E\x67\x74\x68","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x66\x6F\x72\x45\x61\x63\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x54\x52\x55\x4E\x4B\x5F\x4F\x55\x54\x42\x4F\x55\x4E\x44\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44"];_0xcf98[0];var _=require(_0xcf98[1]);var Trunk=require(_0xcf98[3])[_0xcf98[2]];var VoiceExtension=require(_0xcf98[3])[_0xcf98[4]];var sequelize=require(_0xcf98[3])[_0xcf98[5]];var util=require(_0xcf98[6]);var Util=require(_0xcf98[7]);exports[_0xcf98[8]]=function(_0x9662x7,_0x9662x8,_0x9662x9){return Trunk[_0xcf98[15]](Util[_0xcf98[14]](_0x9662x7[_0xcf98[13]]))[_0xcf98[12]](function(_0x9662xb){_0x9662x8[_0xcf98[11]](200)[_0xcf98[10]](_0x9662xb)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[16]]=function(_0x9662x7,_0x9662x8){return Trunk[_0xcf98[20]](_0x9662x7[_0xcf98[19]][_0xcf98[18]])[_0xcf98[12]](function(_0x9662xc){if(!_0x9662xc){return _0x9662x8[_0xcf98[17]](404)};return _0x9662x8[_0xcf98[10]](_0x9662xc)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[21]]=function(_0x9662x7,_0x9662x8){return Trunk[_0xcf98[24]]({where:{name:_0x9662x7[_0xcf98[23]][_0xcf98[22]]}})[_0xcf98[12]](function(_0x9662xd){if(!_0x9662xd){return _0x9662x8[_0xcf98[17]](404)};return _0x9662x8[_0xcf98[10]](_0x9662xd)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[25]]=function(_0x9662x7,_0x9662x8){return Trunk[_0xcf98[25]](_0x9662x7[_0xcf98[23]])[_0xcf98[12]](function(_0x9662xc){return _0x9662x8[_0xcf98[11]](201)[_0xcf98[10]](_0x9662xc)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[26]]=function(_0x9662x7,_0x9662x8){if(_0x9662x7[_0xcf98[23]][_0xcf98[18]]){delete _0x9662x7[_0xcf98[23]][_0xcf98[18]]};return Trunk[_0xcf98[20]](_0x9662x7[_0xcf98[19]][_0xcf98[18]])[_0xcf98[12]](function(_0x9662xc){if(!_0x9662xc){return _0x9662x8[_0xcf98[17]](404)};var _0x9662xe=_[_0xcf98[28]](_0x9662xc,_0x9662x7[_0xcf98[23]]);return _0x9662xe[_0xcf98[29]]()})[_0xcf98[12]](function(_0x9662xc){return _0x9662x8[_0xcf98[11]](200)[_0xcf98[10]](_0x9662xc)})[_0xcf98[9]](function(_0x9662xa){console[_0xcf98[27]](_0x9662xa);return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[30]]=function(_0x9662x7,_0x9662x8){return Trunk[_0xcf98[20]](_0x9662x7[_0xcf98[19]][_0xcf98[18]])[_0xcf98[12]](function(_0x9662xc){if(!_0x9662xc){return _0x9662x8[_0xcf98[17]](404)};return _0x9662xc[_0xcf98[30]]()})[_0xcf98[12]](function(){return _0x9662x8[_0xcf98[17]](204)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};exports[_0xcf98[31]]=function(_0x9662x7,_0x9662x8){var _0x9662xf=false;Trunk[_0xcf98[24]]({where:{id:_0x9662x7[_0xcf98[13]][_0xcf98[18]]},include:[{all:true}]})[_0xcf98[12]](function(_0x9662xd){if(!_0x9662xd){return _0x9662x8[_0xcf98[17]](404)};_0x9662xd[_0xcf98[34]](function(_0x9662x10){if(_0x9662x10[_0xcf98[33]][_0xcf98[32]]>0){_0x9662xf=true}});if(_0x9662xf){return _0x9662x8[_0xcf98[11]](500)[_0xcf98[10]]({message:_0xcf98[35]})};Trunk[_0xcf98[30]]({where:{id:_0x9662x7[_0xcf98[13]][_0xcf98[18]]},individualHooks:true})[_0xcf98[12]](function(){return _0x9662x8[_0xcf98[17]](204)})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})})[_0xcf98[9]](function(_0x9662xa){return handleError(_0x9662x8,_0x9662xa)})};function handleError(_0x9662x8,_0x9662xa){return _0x9662x8[_0xcf98[11]](500)[_0xcf98[10]](_0x9662xa)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Trunk = require('../../models').Trunk; +var VoiceExtension = require('../../models').VoiceExtension; +var sequelize = require('../../models').sequelize; +var util = require('util'); +var Util = require('../../config/util'); + +// Get list of agents +exports.index = function(req, res, next) { + return Trunk + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single trunk +exports.show = function(req, res) { + return Trunk + .findById(req.params.id) + .then(function(trunk) { + if (!trunk) { + return res.sendStatus(404); + } + return res.send(trunk); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Validate the existence of a trunk +exports.trunkValidation = function(req, res) { + return Trunk + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(trunks) { + if (!trunks) { + return res.sendStatus(404); + } + return res.send(trunks); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new trunk in the DB. +exports.create = function(req, res) { + return Trunk + .create(req.body) + .then(function(trunk) { + return res.status(201).send(trunk); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + + +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return Trunk + .findById(req.params.id) + .then(function(trunk) { + if (!trunk) { + return res.sendStatus(404); + } + var updated = _.merge(trunk, req.body); + return updated + .save(); + }) + .then(function(trunk) { + return res.status(200).send(trunk); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Deletes a trunk from the DB. +exports.destroy = function(req, res) { + return Trunk + .findById(req.params.id) + .then(function(trunk) { + if (!trunk) { + return res.sendStatus(404); + } + return trunk + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes multiple trunk from the DB. +exports.bulkDestroy = function(req, res) { + var associatedTrunks = false; + + Trunk + .findAll({ + where: { + id: req.query.id + }, + include: [{ + all: true + }] + }) + .then(function(trunks) { + if (!trunks) { + return res.sendStatus(404); + } + trunks.forEach(function(element) { + if (element.VoiceExtensions.length > 0) { + associatedTrunks = true; + } + }); + if (associatedTrunks) { + return res.status(500).send({ + message: 'MESSAGE_TRUNK_OUTBOUND_ASSOCIATED' + }); + } + Trunk + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/trunk/trunk.socket.js b/server/api/trunk/trunk.socket.js index 044d5f6..bf99ee7 100644 --- a/server/api/trunk/trunk.socket.js +++ b/server/api/trunk/trunk.socket.js @@ -1 +1,30 @@ -var _0xac67=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x54\x72\x75\x6E\x6B","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x74\x72\x75\x6E\x6B\x20\x6E\x61\x6D\x65","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65","\x74\x72\x75\x6E\x6B\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x74\x72\x75\x6E\x6B\x3A\x72\x65\x6D\x6F\x76\x65"];_0xac67[0];var Trunk=require(_0xac67[2])[_0xac67[1]];exports[_0xac67[3]]=function(_0x643bx2){Trunk[_0xac67[4]](function(_0x643bx3){onSave(_0x643bx2,_0x643bx3)});Trunk[_0xac67[5]](function(_0x643bx3){onRemove(_0x643bx2,_0x643bx3)});Trunk[_0xac67[9]](function(_0x643bx3){if(_0x643bx3[_0xac67[7]](_0xac67[6])){throw new Error(_0xac67[8])}})};function onSave(_0x643bx2,_0x643bx3,_0x643bx5){_0x643bx2[_0xac67[11]](_0xac67[10],_0x643bx3)}function onRemove(_0x643bx2,_0x643bx3,_0x643bx5){_0x643bx2[_0xac67[11]](_0xac67[12],_0x643bx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Trunk = require('../../models').Trunk; + +exports.register = function(socket) { + Trunk.afterCreate(function(doc) { + onSave(socket, doc); + }); + Trunk.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + + Trunk.beforeUpdate(function(doc) { + if (doc.changed('name')) { + throw new Error("You can't modify a trunk name"); + } + }); +} + +function onSave(socket, doc, cb) { + socket.emit('trunk:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('trunk:remove', doc); +} diff --git a/server/api/update/index.js b/server/api/update/index.js index b06718f..44410d3 100644 --- a/server/api/update/index.js +++ b/server/api/update/index.js @@ -1 +1,12 @@ -var _0xc40d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x70\x64\x61\x74\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x61\x64\x6D\x69\x6E","\x68\x61\x73\x52\x6F\x6C\x65","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x70\x75\x6C\x6C","\x70\x75\x6C\x6C","\x65\x78\x70\x6F\x72\x74\x73"];_0xc40d[0];var express=require(_0xc40d[1]);var controller=require(_0xc40d[2]);var auth=require(_0xc40d[3]);var router=express.Router();router[_0xc40d[9]](_0xc40d[4],auth[_0xc40d[5]](),auth[_0xc40d[7]](_0xc40d[6]),controller[_0xc40d[8]]);router[_0xc40d[9]](_0xc40d[10],auth[_0xc40d[5]](),auth[_0xc40d[7]](_0xc40d[6]),controller[_0xc40d[11]]);module[_0xc40d[12]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./update.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), auth.hasRole('admin'), controller.index); +router.get('/pull', auth.isAuthenticated(), auth.hasRole('admin'), controller.pull); + +module.exports = router; diff --git a/server/api/update/update.controller.js b/server/api/update/update.controller.js index 14554a0..f882d67 100644 --- a/server/api/update/update.controller.js +++ b/server/api/update/update.controller.js @@ -1 +1,50 @@ -var _0xcada=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x65\x78\x65\x63","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x72\x6F\x6F\x74","\x6A\x6F\x69\x6E","\x73\x69\x6D\x70\x6C\x65\x2D\x67\x69\x74","\x69\x6E\x64\x65\x78","\x6C\x65\x6E\x67\x74\x68","\x61\x6C\x6C","\x7C","\x73\x70\x6C\x69\x74","\x6D\x65\x73\x73\x61\x67\x65","\x75\x6E\x6B\x6E\x6F\x77\x6E","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x64\x61\x74\x65","\x70\x75\x73\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6C\x6F\x67","\x70\x75\x6C\x6C","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x67\x69\x74\x20\x70\x75\x6C\x6C"];_0xcada[0];var _=require(_0xcada[1]);var path=require(_0xcada[2]);var moment=require(_0xcada[3]);var Promise=require(_0xcada[4]);var exec=Promise[_0xcada[7]](require(_0xcada[6])[_0xcada[5]]);var config=require(_0xcada[8]);var Git=require(_0xcada[11])(path[_0xcada[10]](config[_0xcada[9]]));exports[_0xcada[12]]=function(_0xccfbx8,_0xccfbx9){return Git[_0xcada[25]](function(_0xccfbxa,_0xccfbxb){if(_0xccfbxa){return handleError(_0xccfbx9,_0xccfbxa)};var _0xccfbxc=[];for(var _0xccfbxd=0;_0xccfbxd<10&&_0xccfbxd<_0xccfbxb[_0xcada[14]][_0xcada[13]];_0xccfbxd++){_0xccfbxc[_0xcada[22]]({version:_0xccfbxb[_0xcada[14]][_0xccfbxd][_0xcada[17]][_0xcada[16]](_0xcada[15])[1]||_0xcada[18],message:_0xccfbxb[_0xcada[14]][_0xccfbxd][_0xcada[17]][_0xcada[16]](_0xcada[15])[0],createdAt:moment(_0xccfbxb[_0xcada[14]][_0xccfbxd][_0xcada[21]])[_0xcada[20]](_0xcada[19])})};return _0xccfbx9[_0xcada[24]](200)[_0xcada[23]]({rows:_0xccfbxc,count:_0xccfbxc[_0xcada[13]]})})};exports[_0xcada[26]]=function(_0xccfbx8,_0xccfbx9){return exec(_0xcada[31])[_0xcada[30]](function(){return _0xccfbx9[_0xcada[29]](201)[_0xcada[23]]()})[_0xcada[28]](function(_0xccfbxa){console[_0xcada[27]](_0xccfbxa)})};function handleError(_0xccfbx9,_0xccfbxa){return _0xccfbx9[_0xcada[24]](500)[_0xcada[23]](_0xccfbxa)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var path = require('path'); +var moment = require('moment'); +var Promise = require('bluebird'); +var exec = Promise.promisify(require('child_process').exec); + +var config = require('../../config/environment'); + +var Git = require('simple-git')(path.join(config.root)); + +// Get list of updates +exports.index = function(req, res) { + return Git + .log(function(err, logs) { + if (err) { + return handleError(res, err); + } + + var rows = []; + for (var i = 0; i < 10 && i < logs.all.length; i++) { + rows.push({ + version: logs.all[i].message.split('|')[1] || 'unknown', + message: logs.all[i].message.split('|')[0], + createdAt: moment(logs.all[i].date).format("YYYY-MM-DD HH:mm:ss") + }); + } + + return res.status(200).send({ + rows: rows, + count: rows.length + }); + }); +}; + +// Get a single update +exports.pull = function(req, res) { + return exec('git pull') + .then(function() { + return res.sendStatus(201).send(); + }) + .catch(function(err) { + console.error(err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user/index.js b/server/api/user/index.js index 0c2ab0e..3d8b8b6 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -1 +1,26 @@ -var _0xc8e4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x6D\x65","\x6D\x65","\x2F\x61\x6C\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x2F\x61\x76\x61\x74\x61\x72\x2F\x3A\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x67\x65\x74\x41\x76\x61\x74\x61\x72","\x2F\x3A\x69\x64\x2F\x61\x76\x61\x74\x61\x72","\x67\x65\x74\x41\x76\x61\x74\x61\x72\x42\x79\x49\x64","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x75\x73\x65\x72\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x2F\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x68\x61\x6E\x67\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x70\x61\x73\x73\x77\x6F\x72\x64","\x61\x64\x6D\x69\x6E","\x68\x61\x73\x52\x6F\x6C\x65","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x75\x70\x64\x61\x74\x65","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x69\x73\x55\x73\x65\x72\x73\x4C\x69\x6D\x69\x74","\x63\x72\x65\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x41\x76\x61\x74\x61\x72","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xc8e4[0];var express=require(_0xc8e4[1]);var controller=require(_0xc8e4[2]);var config=require(_0xc8e4[3]);var auth=require(_0xc8e4[4]);var license=require(_0xc8e4[5]);var router=express.Router();router[_0xc8e4[9]](_0xc8e4[6],auth[_0xc8e4[7]](),controller[_0xc8e4[8]]);router[_0xc8e4[9]](_0xc8e4[10],auth[_0xc8e4[7]](),controller[_0xc8e4[11]]);router[_0xc8e4[9]](_0xc8e4[12],auth[_0xc8e4[7]](),controller[_0xc8e4[13]]);router[_0xc8e4[9]](_0xc8e4[14],controller[_0xc8e4[15]]);router[_0xc8e4[9]](_0xc8e4[16],controller[_0xc8e4[17]]);router[_0xc8e4[9]](_0xc8e4[18],auth[_0xc8e4[7]](),controller[_0xc8e4[19]]);router[_0xc8e4[22]](_0xc8e4[20],auth[_0xc8e4[7]](),controller[_0xc8e4[21]]);router[_0xc8e4[25]](_0xc8e4[23],auth[_0xc8e4[7]](),controller[_0xc8e4[24]]);router[_0xc8e4[25]](_0xc8e4[26],auth[_0xc8e4[7]](),auth[_0xc8e4[28]](_0xc8e4[27]),controller[_0xc8e4[29]]);router[_0xc8e4[25]](_0xc8e4[18],auth[_0xc8e4[7]](),controller[_0xc8e4[30]]);router[_0xc8e4[22]](_0xc8e4[6],auth[_0xc8e4[7]](),license[_0xc8e4[31]](),license[_0xc8e4[32]](),controller[_0xc8e4[33]]);router[_0xc8e4[22]](_0xc8e4[16],auth[_0xc8e4[7]](),controller[_0xc8e4[34]]);router[_0xc8e4[36]](_0xc8e4[6],auth[_0xc8e4[7]](),controller[_0xc8e4[35]]);router[_0xc8e4[36]](_0xc8e4[18],auth[_0xc8e4[7]](),controller[_0xc8e4[37]]);module[_0xc8e4[38]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user.controller'); +var config = require('../../config/environment'); +var auth = require('../../auth/auth.service'); +var license = require('../../config/license/license.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/me', auth.isAuthenticated(), controller.me); +router.get('/all', auth.isAuthenticated(), controller.getUsers); +router.get('/avatar/:filename', controller.getAvatar); +router.get('/:id/avatar', controller.getAvatarById); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/validate/:field', auth.isAuthenticated(), controller.userValidation); +router.put('/password', auth.isAuthenticated(), controller.changePassword); +router.put('/:id/password', auth.isAuthenticated(), auth.hasRole('admin'), controller.resetPassword); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/', auth.isAuthenticated(), license.isValidDate(), license.isUsersLimit(), controller.create); +router.post('/:id/avatar', auth.isAuthenticated(), controller.changeAvatar); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 15732d0..2e46525 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -1 +1,369 @@ -var _0x8bb7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x6F\x64\x75\x6C\x65","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x70\x61\x73\x73\x70\x6F\x72\x74","\x6D\x6F\x6D\x65\x6E\x74","\x6A\x73\x6F\x6E\x77\x65\x62\x74\x6F\x6B\x65\x6E","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x70\x61\x74\x68","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x67\x65\x74\x55\x73\x65\x72\x73","\x61\x64\x6D\x69\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x68\x61\x6E\x64\x6C\x65\x46\x6F\x72\x65\x69\x67\x6E\x4B\x65\x79\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x63\x68\x61\x6E\x67\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x6F\x6C\x64\x50\x61\x73\x73\x77\x6F\x72\x64","\x6E\x65\x77\x50\x61\x73\x73\x77\x6F\x72\x64","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x61\x76\x65","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x63\x68\x61\x6E\x67\x65\x41\x76\x61\x74\x61\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x69\x6D\x61\x67\x65\x73","\x6A\x6F\x69\x6E","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x6A\x70\x65\x67\x20\x61\x6E\x64\x20\x70\x6E\x67\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x75\x70\x64\x61\x74\x65","\x6F\x6E","\x65\x72\x72\x6F\x72","\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x20\x55\x70\x6C\x6F\x61\x64\x20\x65\x72\x72\x6F\x72\x20\x3A","\x6C\x6F\x67","\x70\x61\x72\x73\x65","\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x72\x6F\x6C\x65","\x75\x73\x65\x72\x70\x69\x63","\x66\x69\x6E\x64\x4F\x6E\x65","\x67\x65\x74\x41\x76\x61\x74\x61\x72","\x75\x73\x65\x72\x70\x69\x63\x2E\x70\x6E\x67","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x65\x78\x69\x73\x74\x73","\x67\x65\x74\x41\x76\x61\x74\x61\x72\x42\x79\x49\x64","\x76\x69\x73\x69\x74\x6F\x72","\x63\x75\x73\x74\x6F\x6D\x65\x72\x2E\x70\x6E\x67","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x63\x6F\x75\x6E\x74","\x61\x75\x74\x68\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x2F","\x72\x65\x64\x69\x72\x65\x63\x74"];_0x8bb7[0];var User=require(_0x8bb7[2])[_0x8bb7[1]];var Module=require(_0x8bb7[2])[_0x8bb7[3]];var sequelize=require(_0x8bb7[2])[_0x8bb7[4]];var config=require(_0x8bb7[5]);var Util=require(_0x8bb7[6]);var passport=require(_0x8bb7[7]);var moment=require(_0x8bb7[8]);var jwt=require(_0x8bb7[9]);var uploadFile=require(_0x8bb7[10]);var path=require(_0x8bb7[11]);var fs=require(_0x8bb7[12]);var _=require(_0x8bb7[13]);var util=require(_0x8bb7[14]);var sr=require(_0x8bb7[15]);exports[_0x8bb7[16]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){return User[_0x8bb7[25]](_0x8bb7[24])[_0x8bb7[23]](Util[_0x8bb7[22]](_0x5cb9xf[_0x8bb7[21]]))[_0x8bb7[20]](function(_0x5cb9x13){_0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x13)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[26]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){return User[_0x8bb7[28]]({where:{role:{$in:[_0x8bb7[27],_0x8bb7[24],_0x8bb7[24]]}}})[_0x8bb7[20]](function(_0x5cb9x14){return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x14)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[29]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){return User[_0x8bb7[29]](_0x5cb9xf[_0x8bb7[32]])[_0x8bb7[20]](function(_0x5cb9x15){return _0x5cb9x10[_0x8bb7[19]](201)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](sequelize.UniqueConstraintError,function(_0x5cb9x12){return Util[_0x8bb7[31]][_0x8bb7[30]](_0x5cb9x10,_0x5cb9x12)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[33]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){return User[_0x8bb7[37]](_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]])[_0x8bb7[20]](function(_0x5cb9x15){if(!_0x5cb9x15){return _0x5cb9x10[_0x8bb7[34]](404)};return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[38]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x16=_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]];var _0x5cb9x17;return User[_0x8bb7[37]](_0x5cb9x16)[_0x8bb7[20]](function(_0x5cb9x15){_0x5cb9x17=_0x5cb9x15;if(!_0x5cb9x15){return _0x5cb9x10[_0x8bb7[34]](404)};return _0x5cb9x15[_0x8bb7[38]]()})[_0x8bb7[20]](function(_0x5cb9x15){return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](sequelize.ForeignKeyConstraintError,function(_0x5cb9x12){return Util[_0x8bb7[31]][_0x8bb7[40]](_0x5cb9x10,_0x8bb7[24],_0x5cb9x17[_0x8bb7[39]],_0x5cb9x12)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[41]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x16=_0x5cb9xf[_0x8bb7[24]][_0x8bb7[35]];var _0x5cb9x18=String(_0x5cb9xf[_0x8bb7[32]][_0x8bb7[42]]);var _0x5cb9x19=String(_0x5cb9xf[_0x8bb7[32]][_0x8bb7[43]]);return User[_0x8bb7[37]](_0x5cb9x16)[_0x8bb7[20]](function(_0x5cb9x15){if(_0x5cb9x15[_0x8bb7[44]](_0x5cb9x18)){_0x5cb9x15[_0x8bb7[45]]=_0x5cb9x19;_0x5cb9x15[_0x8bb7[46]]()[_0x8bb7[20]](function(){return _0x5cb9x10[_0x8bb7[34]](200)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})}else {return _0x5cb9x10[_0x8bb7[34]](403)}})};exports[_0x8bb7[47]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x19=String(_0x5cb9xf[_0x8bb7[32]][_0x8bb7[43]]);return User[_0x8bb7[37]](_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]])[_0x8bb7[20]](function(_0x5cb9x15){_0x5cb9x15[_0x8bb7[45]]=_0x5cb9x19;return _0x5cb9x15[_0x8bb7[46]]()})[_0x8bb7[20]](function(){return _0x5cb9x10[_0x8bb7[34]](200)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[48]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x1a= new uploadFile({dest:path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0x5cb9x1b,_0x5cb9x1c){return sr()+path[_0x8bb7[55]](_0x5cb9x1c[_0x8bb7[54]])},messages:{maxNumberOfFiles:_0x8bb7[56],acceptFileTypes:_0x8bb7[57],invalidRequest:_0x8bb7[58]}});_0x5cb9x1a[_0x8bb7[62]](_0x8bb7[59],function(_0x5cb9x1d,_0x5cb9x1e){if(!_0x5cb9x1e[_0x8bb7[60]][_0x8bb7[54]]){return _0x5cb9x10[_0x8bb7[19]](500)[_0x8bb7[18]](_0x5cb9x1a)};return User[_0x8bb7[37]](_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]])[_0x8bb7[20]](function(_0x5cb9x15){if(!_0x5cb9x15){return _0x5cb9x10[_0x8bb7[34]](404)};return _0x5cb9x15[_0x8bb7[61]]({userpic:_0x5cb9x1e[_0x8bb7[60]][_0x8bb7[54]]})})[_0x8bb7[20]](function(_0x5cb9x15){return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})});_0x5cb9x1a[_0x8bb7[62]](_0x8bb7[63],function(_0x5cb9x12){console[_0x8bb7[65]](_0x8bb7[64],_0x5cb9x12);return handleError(_0x5cb9x10,_0x5cb9x12)});_0x5cb9x1a[_0x8bb7[66]](_0x5cb9xf)};exports[_0x8bb7[67]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x16=_0x5cb9xf[_0x8bb7[24]][_0x8bb7[35]];return User[_0x8bb7[72]]({where:{id:_0x5cb9x16},attributes:[_0x8bb7[35],_0x8bb7[68],_0x8bb7[39],_0x8bb7[69],_0x8bb7[70],_0x8bb7[71]],include:[Module]})[_0x8bb7[20]](function(_0x5cb9x15){if(!_0x5cb9x15){return _0x5cb9x10[_0x8bb7[34]](401)};return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[61]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x16=_0x5cb9xf[_0x8bb7[24]][_0x8bb7[35]];delete _0x5cb9xf[_0x8bb7[32]][_0x8bb7[45]];return User[_0x8bb7[37]](_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]])[_0x8bb7[20]](function(_0x5cb9x15){if(!_0x5cb9x15){return _0x5cb9x10[_0x8bb7[34]](500)};return _0x5cb9x15[_0x8bb7[61]](_0x5cb9xf[_0x8bb7[32]])})[_0x8bb7[20]](function(_0x5cb9x15){return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]](_0x5cb9x15)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[73]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){var _0x5cb9x1f=path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52],_0x5cb9xf[_0x8bb7[36]][_0x8bb7[54]]);fs[_0x8bb7[76]](_0x5cb9x1f,function(_0x5cb9x20){if(!_0x5cb9x20){_0x5cb9x1f=path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52],_0x8bb7[74])};return _0x5cb9x10[_0x8bb7[75]](_0x5cb9x1f)})};exports[_0x8bb7[77]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){if(_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]]===_0x8bb7[78]){var _0x5cb9x1f=path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52],_0x8bb7[79]);fs[_0x8bb7[76]](_0x5cb9x1f,function(_0x5cb9x20){return _0x5cb9x10[_0x8bb7[75]](_0x5cb9x1f)})}else {return User[_0x8bb7[37]](_0x5cb9xf[_0x8bb7[36]][_0x8bb7[35]])[_0x8bb7[20]](function(_0x5cb9x15){if(_0x5cb9x15){var _0x5cb9x1f=path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52],_0x5cb9x15[_0x8bb7[71]]?_0x5cb9x15[_0x8bb7[71]]:_0x8bb7[74]);fs[_0x8bb7[76]](_0x5cb9x1f,function(_0x5cb9x20){if(!_0x5cb9x20){_0x5cb9x1f=path[_0x8bb7[53]](config[_0x8bb7[49]],_0x8bb7[50],_0x8bb7[51],_0x8bb7[52],_0x8bb7[74])};return _0x5cb9x10[_0x8bb7[75]](_0x5cb9x1f)})}else {return _0x5cb9x10[_0x8bb7[34]](500)}})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})}};exports[_0x8bb7[80]]=function(_0x5cb9xf,_0x5cb9x10){return User[_0x8bb7[38]]({where:{id:_0x5cb9xf[_0x8bb7[21]][_0x8bb7[35]]},individualHooks:true})[_0x8bb7[20]](function(){return _0x5cb9x10[_0x8bb7[34]](204)})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[81]]=function(_0x5cb9xf,_0x5cb9x10){var _0x5cb9x21={};_0x5cb9x21[_0x5cb9xf[_0x8bb7[36]][_0x8bb7[82]]]=_0x5cb9xf[_0x8bb7[32]][_0x8bb7[83]];return User[_0x8bb7[23]]({where:_0x5cb9x21})[_0x8bb7[20]](function(_0x5cb9x13){if(_0x5cb9x13[_0x8bb7[84]]){return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]]({isValid:false,value:_0x5cb9xf[_0x8bb7[32]][_0x8bb7[83]]})};return _0x5cb9x10[_0x8bb7[19]](200)[_0x8bb7[18]]({isValid:true,value:_0x5cb9xf[_0x8bb7[32]][_0x8bb7[83]]})})[_0x8bb7[17]](function(_0x5cb9x12){return handleError(_0x5cb9x10,_0x5cb9x12)})};exports[_0x8bb7[85]]=function(_0x5cb9xf,_0x5cb9x10,_0x5cb9x11){_0x5cb9x10[_0x8bb7[87]](_0x8bb7[86])};function handleError(_0x5cb9x10,_0x5cb9x12){return _0x5cb9x10[_0x8bb7[19]](500)[_0x8bb7[18]](_0x5cb9x12)} \ No newline at end of file +'use strict'; + +var User = require('../../models').User; +var Module = require('../../models').Module; +var sequelize = require('../../models').sequelize; + +var config = require('../../config/environment'); +var Util = require('../../config/util'); + +var passport = require('passport'); +var moment = require('moment'); +var jwt = require('jsonwebtoken'); +var uploadFile = require('upload-file'); +var path = require('path'); +var fs = require('fs'); +var _ = require('lodash'); +var util = require('util'); +var sr = require('simple-random'); + +/** + * Get list of admin/user + */ +exports.index = function(req, res, next) { + return User + .scope('user') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Get list of admin/user/user + */ +exports.getUsers = function(req, res, next) { + return User + .findAll({ + where: { + role: { + $in: ['admin', 'user', 'user'] + } + } + }) + .then(function(users) { + return res.status(200).send(users); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Creates a new user + */ +exports.create = function(req, res, next) { + return User + .create(req.body) + .then(function(user) { + return res.status(201).send(user); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + return Util.errorManager.handleUniqueConstraintError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Get a single user + */ +exports.show = function(req, res, next) { + return User + .findById(req.params.id) + .then(function(user) { + if (!user) { + return res.sendStatus(404); + } + + return res.status(200).send(user); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Deletes a user + */ +exports.destroy = function(req, res, next) { + var userId = req.params.id; + var _user; + + return User + .findById(userId) + .then(function(user) { + _user = user; + if (!user) { + return res.sendStatus(404); + } + return user + .destroy(); + }) + .then(function(user) { + return res.status(200).send(user); + }) + .catch(sequelize.ForeignKeyConstraintError, function(err) { + return Util.errorManager.handleForeignKeyConstraintError(res, 'user', _user.name, err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Change a user password + */ +exports.changePassword = function(req, res, next) { + var userId = req.user.id; + var oldPass = String(req.body.oldPassword); + var newPass = String(req.body.newPassword); + + return User + .findById(userId) + .then(function(user) { + if (user.authenticate(oldPass)) { + user.password = newPass; + user.save() + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); + } else { + return res.sendStatus(403); + } + }); +}; + +/** + * Change a user password by admin + */ +exports.resetPassword = function(req, res, next) { + var newPass = String(req.body.newPassword); + return User + .findById(req.params.id) + .then(function(user) { + user.password = newPass; + return user + .save(); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Change the avatar of the user + */ +exports.changeAvatar = function(req, res, next) { + + var upload = new uploadFile({ + dest: path.join(config.root, 'server', 'files', 'images'), + maxNumberOfFiles: 1, + minNumberOfFiles: 0, + acceptFileTypes: /(\.|\/)(jpeg|png)$/i, + rename: function(name, file) { + return sr() + path.extname(file.filename); + }, + messages: { + maxNumberOfFiles: "Max number of files upload exceeded", + acceptFileTypes: "Only jpeg and png format accepted", + invalidRequest: "Invalid request" + } + }); + + upload.on('end', function(fields, files) { + if (!files.file.filename) { + return res.status(500).send(upload); + } + + return User + .findById(req.params.id) + .then(function(user) { + if (!user) { + return res.sendStatus(404); + } + + return user + .update({ + userpic: files.file.filename + }); + }) + .then(function(user) { + return res.status(200).send(user); + }) + .catch(function(err) { + return handleError(res, err); + }); + }); + + upload.on('error', function(err) { + console.log('********** Upload error :', err) + return handleError(res, err); + }); + + upload.parse(req); +}; + + +/** + * Get my info + */ +exports.me = function(req, res, next) { + var userId = req.user.id; + + return User + .findOne({ + where: { + id: userId + }, + attributes: ['id', 'fullname', 'name', 'email', 'role', 'userpic'], + include: [Module] + }) + .then(function(user) { + if (!user) { + return res.sendStatus(401); + } + return res.status(200).send(user); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Update my user + */ +exports.update = function(req, res, next) { + var userId = req.user.id; + delete req.body.password; + + return User + .findById(req.params.id) + .then(function(user) { + if (!user) { + return res.sendStatus(500); + } + return user + .update(req.body); + }) + .then(function(user) { + return res.status(200).send(user); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +/** + * Get my avatar + */ +exports.getAvatar = function(req, res, next) { + var imgPath = path.join(config.root, 'server', 'files', 'images', req.params.filename); + + fs.exists(imgPath, function(exists) { + if (!exists) { + imgPath = path.join(config.root, 'server', 'files', 'images', 'userpic.png'); + } + + return res.sendFile(imgPath); + }); +}; + +/** + * Get my avatar by id + */ +exports.getAvatarById = function(req, res, next) { + if (req.params.id === 'visitor') { + var imgPath = path.join(config.root, 'server', 'files', 'images', 'customer.png'); + + fs.exists(imgPath, function(exists) { + return res.sendFile(imgPath); + }); + + } else { + return User + .findById(req.params.id) + .then(function(user) { + if (user) { + var imgPath = path.join(config.root, 'server', 'files', 'images', user.userpic ? user.userpic : 'userpic.png'); + + fs.exists(imgPath, function(exists) { + if (!exists) { + imgPath = path.join(config.root, 'server', 'files', 'images', 'userpic.png'); + } + + return res.sendFile(imgPath); + }); + } else { + return res.sendStatus(500); + } + }) + .catch(function(err) { + return handleError(res, err); + }); + } +}; + +// Deletes a user from the DB. +exports.bulkDestroy = function(req, res) { + return User + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.userValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + + return User + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + +}; + +/** + * Authentication callback + */ +exports.authCallback = function(req, res, next) { + res.redirect('/'); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c33f2dd..e1071aa 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -1 +1,31 @@ -var _0xb5c3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x72\x6F\x6C\x65","\x61\x64\x6D\x69\x6E","\x75\x73\x65\x72\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x3A\x72\x65\x6D\x6F\x76\x65"];_0xb5c3[0];var user=require(_0xb5c3[2])[_0xb5c3[1]];exports[_0xb5c3[3]]=function(_0x6123x2){user[_0xb5c3[4]](function(_0x6123x3){onSave(_0x6123x2,_0x6123x3)});user[_0xb5c3[5]](function(_0x6123x3){onSave(_0x6123x2,_0x6123x3)});user[_0xb5c3[6]](function(_0x6123x3){onRemove(_0x6123x2,_0x6123x3)})};function onSave(_0x6123x2,_0x6123x3,_0x6123x5){if(_0x6123x3[_0xb5c3[7]]===_0xb5c3[8]){_0x6123x2[_0xb5c3[10]](_0xb5c3[9],_0x6123x3)}}function onRemove(_0x6123x2,_0x6123x3,_0x6123x5){if(_0x6123x3[_0xb5c3[7]]===_0xb5c3[8]){_0x6123x2[_0xb5c3[10]](_0xb5c3[11],_0x6123x3)}} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var user = require('../../models').User; + +exports.register = function(socket) { + user.afterCreate(function(doc) { + onSave(socket, doc); + }); + user.afterUpdate(function(doc) { + onSave(socket, doc); + }); + user.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + if (doc.role === 'admin') { + socket.emit('user:save', doc); + } +} + +function onRemove(socket, doc, cb) { + if (doc.role === 'admin') { + socket.emit('user:remove', doc); + } +} diff --git a/server/api/user_has_chat_queue/index.js b/server/api/user_has_chat_queue/index.js index ec120b7..bce94e7 100644 --- a/server/api/user_has_chat_queue/index.js +++ b/server/api/user_has_chat_queue/index.js @@ -1 +1,15 @@ -var _0xd9a8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd9a8[0];var express=require(_0xd9a8[1]);var controller=require(_0xd9a8[2]);var router=express.Router();router[_0xd9a8[5]](_0xd9a8[3],controller[_0xd9a8[4]]);router[_0xd9a8[5]](_0xd9a8[6],controller[_0xd9a8[7]]);router[_0xd9a8[9]](_0xd9a8[3],controller[_0xd9a8[8]]);router[_0xd9a8[11]](_0xd9a8[6],controller[_0xd9a8[10]]);router[_0xd9a8[12]](_0xd9a8[6],controller[_0xd9a8[10]]);router[_0xd9a8[14]](_0xd9a8[6],controller[_0xd9a8[13]]);module[_0xd9a8[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_chat_queue.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/user_has_chat_queue/user_has_chat_queue.controller.js b/server/api/user_has_chat_queue/user_has_chat_queue.controller.js index f78c05a..b399892 100644 --- a/server/api/user_has_chat_queue/user_has_chat_queue.controller.js +++ b/server/api/user_has_chat_queue/user_has_chat_queue.controller.js @@ -1 +1,103 @@ -var _0x6d6f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0x6d6f[0];var _=require(_0x6d6f[1]);var UserHasChatQueue=require(_0x6d6f[3])[_0x6d6f[2]];exports[_0x6d6f[4]]=function(_0xfe51x3,_0xfe51x4){UserHasChatQueue[_0x6d6f[10]](_0xfe51x3[_0x6d6f[9]]?{where:_0xfe51x3[_0x6d6f[9]]}:{})[_0x6d6f[8]](function(_0xfe51x6){return _0xfe51x4[_0x6d6f[7]](200)[_0x6d6f[6]](_0xfe51x6)})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})};exports[_0x6d6f[11]]=function(_0xfe51x3,_0xfe51x4){UserHasChatQueue[_0x6d6f[15]](_0xfe51x3[_0x6d6f[14]][_0x6d6f[13]])[_0x6d6f[8]](function(_0xfe51x7){if(!_0xfe51x7){return _0xfe51x4[_0x6d6f[12]](404)};return _0xfe51x4[_0x6d6f[6]](_0xfe51x7)})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})};exports[_0x6d6f[16]]=function(_0xfe51x3,_0xfe51x4){UserHasChatQueue[_0x6d6f[16]](_0xfe51x3[_0x6d6f[17]])[_0x6d6f[8]](function(_0xfe51x7){return _0xfe51x4[_0x6d6f[7]](201)[_0x6d6f[6]](_0xfe51x7)})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})};exports[_0x6d6f[18]]=function(_0xfe51x3,_0xfe51x4){if(_0xfe51x3[_0x6d6f[17]][_0x6d6f[13]]){delete _0xfe51x3[_0x6d6f[17]][_0x6d6f[13]]};UserHasChatQueue[_0x6d6f[21]]({where:{id:_0xfe51x3[_0x6d6f[14]][_0x6d6f[13]]}})[_0x6d6f[8]](function(_0xfe51x7){if(!_0xfe51x7){return _0xfe51x4[_0x6d6f[12]](404)};var _0xfe51x8=_[_0x6d6f[19]](_0xfe51x7,_0xfe51x3[_0x6d6f[17]]);_0xfe51x8[_0x6d6f[20]]()[_0x6d6f[8]](function(){return _0xfe51x4[_0x6d6f[7]](200)[_0x6d6f[6]](_0xfe51x7)})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})};exports[_0x6d6f[22]]=function(_0xfe51x3,_0xfe51x4){UserHasChatQueue[_0x6d6f[21]]({where:{id:_0xfe51x3[_0x6d6f[14]][_0x6d6f[13]]}})[_0x6d6f[8]](function(_0xfe51x7){if(!_0xfe51x7){return _0xfe51x4[_0x6d6f[12]](404)};_0xfe51x7[_0x6d6f[22]]()[_0x6d6f[8]](function(){return _0xfe51x4[_0x6d6f[12]](204)})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})})[_0x6d6f[5]](function(_0xfe51x5){return handleError(_0xfe51x4,_0xfe51x5)})};function handleError(_0xfe51x4,_0xfe51x5){return _0xfe51x4[_0x6d6f[7]](500)[_0x6d6f[6]](_0xfe51x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasChatQueue = require('../../models').UserHasChatQueue; + +// Get list of userHasChatQueues +exports.index = function(req, res) { + UserHasChatQueue + .findAll(req.query ? { + where: req.query + } : {}) + .then(function(userHasChatQueues) { + return res.status(200).send(userHasChatQueues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single userHasChatQueue +exports.show = function(req, res) { + UserHasChatQueue + .findById(req.params.id) + .then(function(userHasChatQueue) { + if (!userHasChatQueue) { + return res.sendStatus(404); + } + return res.send(userHasChatQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new userHasChatQueue in the DB. +exports.create = function(req, res) { + UserHasChatQueue + .create(req.body) + .then(function(userHasChatQueue) { + return res.status(201).send(userHasChatQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing userHasChatQueue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasChatQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(userHasChatQueue) { + if (!userHasChatQueue) { + return res.sendStatus(404); + } + var updated = _.merge(userHasChatQueue, req.body); + updated.save() + .then(function() { + return res.status(200).send(userHasChatQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a userHasChatQueue from the DB. +exports.destroy = function(req, res) { + UserHasChatQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(userHasChatQueue) { + if (!userHasChatQueue) { + return res.sendStatus(404); + } + userHasChatQueue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_chat_queue/user_has_chat_queue.socket.js b/server/api/user_has_chat_queue/user_has_chat_queue.socket.js index e48c4a7..882e78a 100644 --- a/server/api/user_has_chat_queue/user_has_chat_queue.socket.js +++ b/server/api/user_has_chat_queue/user_has_chat_queue.socket.js @@ -1 +1,24 @@ -var _0x87c7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x87c7[0];var UserHasChatQueue=require(_0x87c7[2])[_0x87c7[1]];exports[_0x87c7[3]]=function(_0xc032x2){UserHasChatQueue[_0x87c7[4]](function(_0xc032x3){onSave(_0xc032x2,_0xc032x3)});UserHasChatQueue[_0x87c7[5]](function(_0xc032x3){onRemove(_0xc032x2,_0xc032x3)})};function onSave(_0xc032x2,_0xc032x3,_0xc032x5){_0xc032x2[_0x87c7[7]](_0x87c7[6],_0xc032x3)}function onRemove(_0xc032x2,_0xc032x3,_0xc032x5){_0xc032x2[_0x87c7[7]](_0x87c7[8],_0xc032x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var UserHasChatQueue = require('../../models').UserHasChatQueue; + +exports.register = function(socket) { + UserHasChatQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasChatQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_chat_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_chat_queue:remove', doc); +} diff --git a/server/api/user_has_chat_queue/user_has_chat_queue.spec.js b/server/api/user_has_chat_queue/user_has_chat_queue.spec.js index f4dc8b9..539163a 100644 --- a/server/api/user_has_chat_queue/user_has_chat_queue.spec.js +++ b/server/api/user_has_chat_queue/user_has_chat_queue.spec.js @@ -1 +1,20 @@ -var _0x7891=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x67\x65\x74"];_0x7891[0];var should=require(_0x7891[1]);var app=require(_0x7891[2]);var request=require(_0x7891[3]);describe(_0x7891[4],function(){it(_0x7891[5],function(_0xbdc7x4){request(app)[_0x7891[13]](_0x7891[12])[_0x7891[11]](200)[_0x7891[11]](_0x7891[10],/json/)[_0x7891[9]](function(_0xbdc7x5,_0xbdc7x6){if(_0xbdc7x5){return _0xbdc7x4(_0xbdc7x5)};_0xbdc7x6[_0x7891[8]][_0x7891[1]][_0x7891[7]][_0x7891[6]](Array);_0xbdc7x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/chat/user_has_queues', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/chat/user_has_queues') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/user_has_chat_room/index.js b/server/api/user_has_chat_room/index.js index e45fde8..381448d 100644 --- a/server/api/user_has_chat_room/index.js +++ b/server/api/user_has_chat_room/index.js @@ -1 +1,16 @@ -var _0xea7a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x3A\x75\x73\x65\x72\x49\x64\x2F\x3A\x63\x68\x61\x74\x52\x6F\x6F\x6D\x49\x64","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0xea7a[0];var express=require(_0xea7a[1]);var controller=require(_0xea7a[2]);var auth=require(_0xea7a[3]);var router=express.Router();router[_0xea7a[6]](_0xea7a[4],controller[_0xea7a[5]]);module[_0xea7a[7]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_chat_room.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +// router.get('/', controller.index); +// router.get('/:id', controller.show); +// router.post('/', controller.create); +router.put('/:userId/:chatRoomId', controller.update); +// router.patch('/:id', controller.update); +// router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/user_has_chat_room/user_has_chat_room.controller.js b/server/api/user_has_chat_room/user_has_chat_room.controller.js index c1e9538..d747380 100644 --- a/server/api/user_has_chat_room/user_has_chat_room.controller.js +++ b/server/api/user_has_chat_room/user_has_chat_room.controller.js @@ -1 +1,96 @@ -var _0x424a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x75\x73\x65\x72\x49\x64","\x63\x68\x61\x74\x52\x6F\x6F\x6D\x49\x64","\x66\x69\x6E\x64\x4F\x6E\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x424a[0];var _=require(_0x424a[1]);var UserHasChatRoom=require(_0x424a[3])[_0x424a[2]];exports[_0x424a[4]]=function(_0x7d00x3,_0x7d00x4){UserHasChatRoom[_0x424a[9]]()[_0x424a[8]](function(_0x7d00x6){return _0x7d00x4[_0x424a[7]](200)[_0x424a[6]](_0x7d00x6)})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})};exports[_0x424a[10]]=function(_0x7d00x3,_0x7d00x4){UserHasChatRoom[_0x424a[14]](_0x7d00x3[_0x424a[13]][_0x424a[12]])[_0x424a[8]](function(_0x7d00x7){if(!_0x7d00x7){return _0x7d00x4[_0x424a[11]](404)};return _0x7d00x4[_0x424a[6]](_0x7d00x7)})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})};exports[_0x424a[15]]=function(_0x7d00x3,_0x7d00x4){UserHasChatRoom[_0x424a[15]](_0x7d00x3[_0x424a[16]])[_0x424a[8]](function(_0x7d00x7){return _0x7d00x4[_0x424a[7]](201)[_0x424a[6]](_0x7d00x7)})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})};exports[_0x424a[17]]=function(_0x7d00x3,_0x7d00x4){UserHasChatRoom[_0x424a[21]]({where:{UserId:_0x7d00x3[_0x424a[13]][_0x424a[19]],ChatRoomId:_0x7d00x3[_0x424a[13]][_0x424a[20]]},limit:1})[_0x424a[8]](function(_0x7d00x7){if(!_0x7d00x7){return _0x7d00x4[_0x424a[11]](404)};_0x7d00x7[_0x424a[18]](_0x7d00x3[_0x424a[16]])[_0x424a[8]](function(){return _0x7d00x4[_0x424a[7]](200)[_0x424a[6]](_0x7d00x7)})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})};exports[_0x424a[22]]=function(_0x7d00x3,_0x7d00x4){UserHasChatRoom[_0x424a[14]](_0x7d00x3[_0x424a[13]][_0x424a[12]])[_0x424a[8]](function(_0x7d00x7){if(!_0x7d00x7){return _0x7d00x4[_0x424a[11]](404)};_0x7d00x7[_0x424a[22]]()[_0x424a[8]](function(){return _0x7d00x4[_0x424a[11]](204)})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})})[_0x424a[5]](function(_0x7d00x5){return handleError(_0x7d00x4,_0x7d00x5)})};function handleError(_0x7d00x4,_0x7d00x5){return _0x7d00x4[_0x424a[7]](500)[_0x424a[6]](_0x7d00x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasChatRoom = require('../../models').UserHasChatRoom; + +// Get list of user_has_chat_rooms +exports.index = function(req, res) { + UserHasChatRoom + .findAll() + .then(function (user_has_chat_rooms) { + return res.status(200).send(user_has_chat_rooms); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single user_has_chat_room +exports.show = function(req, res) { + UserHasChatRoom + .findById(req.params.id) + .then(function (user_has_chat_room) { + if(!user_has_chat_room) { return res.sendStatus(404); } + return res.send(user_has_chat_room); + }) + .catch(function(err){ + return handleError(res, err); + }); +}; + +// Creates a new user_has_chat_room in the DB. +exports.create = function(req, res) { + + UserHasChatRoom + .create(req.body) + .then(function(user_has_chat_room) { + return res.status(201).send(user_has_chat_room); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_chat_room in the DB. +exports.update = function(req, res) { + + UserHasChatRoom + .findOne({ + where: { + UserId: req.params.userId, + ChatRoomId: req.params.chatRoomId + }, + limit: 1 + }) + .then(function (user_has_chat_room) { + if (!user_has_chat_room) { + return res.sendStatus(404); + } + + user_has_chat_room + .updateAttributes(req.body) + .then(function () { + return res.status(200).send(user_has_chat_room); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a user_has_chat_room from the DB. +exports.destroy = function(req, res) { + + UserHasChatRoom + .findById(req.params.id) + .then(function (user_has_chat_room) { + if(!user_has_chat_room) { return res.sendStatus(404); } + user_has_chat_room.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_chat_room/user_has_chat_room.socket.js b/server/api/user_has_chat_room/user_has_chat_room.socket.js index 1e3ca01..e0be09b 100644 --- a/server/api/user_has_chat_room/user_has_chat_room.socket.js +++ b/server/api/user_has_chat_room/user_has_chat_room.socket.js @@ -1 +1,66 @@ -var _0x7c5e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x6D\x61\x70","\x75\x73\x65\x72\x49\x64","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x65\x6D\x69\x74","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x65\x6D\x61\x69\x6C","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0x7c5e[0];var _=require(_0x7c5e[1]);var User=require(_0x7c5e[3])[_0x7c5e[2]];var ChatRoom=require(_0x7c5e[3])[_0x7c5e[4]];var ChatVisitor=require(_0x7c5e[3])[_0x7c5e[5]];var ChatMessage=require(_0x7c5e[3])[_0x7c5e[6]];var UserHasChatRoom=require(_0x7c5e[3])[_0x7c5e[7]];exports[_0x7c5e[8]]=function(_0xa566x7){UserHasChatRoom[_0x7c5e[9]](function(_0xa566x8){onSave(_0xa566x7,_0xa566x8)});UserHasChatRoom[_0x7c5e[10]](function(_0xa566x8){onRemove(_0xa566x7,_0xa566x8)})};function onSave(_0xa566x7,_0xa566x8){var _0xa566xa;return ChatRoom[_0x7c5e[24]](_0xa566x8.ChatRoomId,{include:[{model:ChatVisitor,attributes:[_0x7c5e[13],_0x7c5e[21],_0x7c5e[22]]},{model:User,attributes:[_0x7c5e[13],_0x7c5e[21],_0x7c5e[23],_0x7c5e[22]]},{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x7c5e[13],_0x7c5e[21],_0x7c5e[22]]},{model:User,attributes:[_0x7c5e[13],_0x7c5e[21],_0x7c5e[23],_0x7c5e[22]]}]}]})[_0x7c5e[20]](function(_0xa566xc){_0xa566xa=_0xa566xc;var _0xa566xd=_[_0x7c5e[14]](_0xa566xa.Users,_0x7c5e[13]);_0xa566xd[_0x7c5e[19]](function(_0xa566xe){if(_0xa566x7[_0x7c5e[15]]==_0xa566xe){_0xa566x7[_0x7c5e[18]](_0x7c5e[16],_0xa566xa[_0x7c5e[17]])}});return})[_0x7c5e[12]](function(_0xa566xb){console[_0x7c5e[11]](_0xa566xb)})}function onRemove(_0xa566x7,_0xa566x8){_0xa566x7[_0x7c5e[18]](_0x7c5e[25],_0xa566x8)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; +var _ = require('lodash'); +var User = require('../../models').User; +var ChatRoom = require('../../models').ChatRoom; +var ChatVisitor = require('../../models').ChatVisitor; +var ChatMessage = require('../../models').ChatMessage; +var UserHasChatRoom = require('../../models').UserHasChatRoom; + +exports.register = function(socket) { + UserHasChatRoom.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasChatRoom.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc) { + + var _chatRoom; + + return ChatRoom + .findById(doc.ChatRoomId, { + include: [{ + model: ChatVisitor, + attributes: ['id', 'email', 'fullname'] + }, { + model: User, + attributes: ['id', 'email', 'name', 'fullname'] + }, { + model: ChatMessage, + include: [{ + model: ChatVisitor, + attributes: ['id', 'email', 'fullname'] + }, { + model: User, + attributes: ['id', 'email', 'name', 'fullname'] + }] + }] + }) + .then(function(chatRoom) { + _chatRoom = chatRoom; + // _chatRoom.dataValues.ChatMessages = []; + + var ids = _.map(_chatRoom.Users, 'id'); + + ids.forEach(function(id) { + if (socket.userId == id) { + socket.emit('user_has_chat_room:save', _chatRoom.dataValues) + } + }); + + return; + }) + .catch(function(err) { + console.error(err); + }); +} + +function onRemove(socket, doc) { + socket.emit('user_has_chat_room:remove', doc); +} diff --git a/server/api/user_has_chat_room/user_has_chat_room.spec.js b/server/api/user_has_chat_room/user_has_chat_room.spec.js index e8f46cb..b33382a 100644 --- a/server/api/user_has_chat_room/user_has_chat_room.spec.js +++ b/server/api/user_has_chat_room/user_has_chat_room.spec.js @@ -1 +1,20 @@ -var _0x6c30=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x72\x6F\x6F\x6D\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x72\x6F\x6F\x6D\x73","\x67\x65\x74"];_0x6c30[0];var should=require(_0x6c30[1]);var app=require(_0x6c30[2]);var request=require(_0x6c30[3]);describe(_0x6c30[4],function(){it(_0x6c30[5],function(_0xbb94x4){request(app)[_0x6c30[13]](_0x6c30[12])[_0x6c30[11]](200)[_0x6c30[11]](_0x6c30[10],/json/)[_0x6c30[9]](function(_0xbb94x5,_0xbb94x6){if(_0xbb94x5){return _0xbb94x4(_0xbb94x5)};_0xbb94x6[_0x6c30[8]][_0x6c30[1]][_0x6c30[7]][_0x6c30[6]](Array);_0xbb94x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/chat/user_has_rooms', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/chat/user_has_rooms') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/user_has_fax_queue/index.js b/server/api/user_has_fax_queue/index.js index 9dbdc82..5805e3d 100644 --- a/server/api/user_has_fax_queue/index.js +++ b/server/api/user_has_fax_queue/index.js @@ -1 +1,15 @@ -var _0xb5db=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xb5db[0];var express=require(_0xb5db[1]);var controller=require(_0xb5db[2]);var router=express.Router();router[_0xb5db[5]](_0xb5db[3],controller[_0xb5db[4]]);router[_0xb5db[5]](_0xb5db[6],controller[_0xb5db[7]]);router[_0xb5db[9]](_0xb5db[3],controller[_0xb5db[8]]);router[_0xb5db[11]](_0xb5db[6],controller[_0xb5db[10]]);router[_0xb5db[12]](_0xb5db[6],controller[_0xb5db[10]]);router[_0xb5db[14]](_0xb5db[6],controller[_0xb5db[13]]);module[_0xb5db[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_fax_queue.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/user_has_fax_queue/user_has_fax_queue.controller.js b/server/api/user_has_fax_queue/user_has_fax_queue.controller.js index 18e26c0..f92e570 100644 --- a/server/api/user_has_fax_queue/user_has_fax_queue.controller.js +++ b/server/api/user_has_fax_queue/user_has_fax_queue.controller.js @@ -1 +1,103 @@ -var _0x29bc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0x29bc[0];var _=require(_0x29bc[1]);var UserHasFaxQueue=require(_0x29bc[3])[_0x29bc[2]];exports[_0x29bc[4]]=function(_0x816bx3,_0x816bx4){UserHasFaxQueue[_0x29bc[10]](_0x816bx3[_0x29bc[9]]?{where:_0x816bx3[_0x29bc[9]]}:{})[_0x29bc[8]](function(_0x816bx6){return _0x816bx4[_0x29bc[7]](200)[_0x29bc[6]](_0x816bx6)})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})};exports[_0x29bc[11]]=function(_0x816bx3,_0x816bx4){UserHasFaxQueue[_0x29bc[15]](_0x816bx3[_0x29bc[14]][_0x29bc[13]])[_0x29bc[8]](function(_0x816bx7){if(!_0x816bx7){return _0x816bx4[_0x29bc[12]](404)};return _0x816bx4[_0x29bc[6]](_0x816bx7)})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})};exports[_0x29bc[16]]=function(_0x816bx3,_0x816bx4){UserHasFaxQueue[_0x29bc[16]](_0x816bx3[_0x29bc[17]])[_0x29bc[8]](function(_0x816bx7){return _0x816bx4[_0x29bc[7]](201)[_0x29bc[6]](_0x816bx7)})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})};exports[_0x29bc[18]]=function(_0x816bx3,_0x816bx4){if(_0x816bx3[_0x29bc[17]][_0x29bc[13]]){delete _0x816bx3[_0x29bc[17]][_0x29bc[13]]};UserHasFaxQueue[_0x29bc[21]]({where:{id:_0x816bx3[_0x29bc[14]][_0x29bc[13]]}})[_0x29bc[8]](function(_0x816bx7){if(!_0x816bx7){return _0x816bx4[_0x29bc[12]](404)};var _0x816bx8=_[_0x29bc[19]](_0x816bx7,_0x816bx3[_0x29bc[17]]);_0x816bx8[_0x29bc[20]]()[_0x29bc[8]](function(){return _0x816bx4[_0x29bc[7]](200)[_0x29bc[6]](_0x816bx7)})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})};exports[_0x29bc[22]]=function(_0x816bx3,_0x816bx4){UserHasFaxQueue[_0x29bc[21]]({where:{id:_0x816bx3[_0x29bc[14]][_0x29bc[13]]}})[_0x29bc[8]](function(_0x816bx7){if(!_0x816bx7){return _0x816bx4[_0x29bc[12]](404)};_0x816bx7[_0x29bc[22]]()[_0x29bc[8]](function(){return _0x816bx4[_0x29bc[12]](204)})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})})[_0x29bc[5]](function(_0x816bx5){return handleError(_0x816bx4,_0x816bx5)})};function handleError(_0x816bx4,_0x816bx5){return _0x816bx4[_0x29bc[7]](500)[_0x29bc[6]](_0x816bx5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasFaxQueue = require('../../models').UserHasFaxQueue; + +// Get list of user_has_fax_queues +exports.index = function(req, res) { + UserHasFaxQueue + .findAll(req.query ? { + where: req.query + } : {}) + .then(function(user_has_fax_queues) { + return res.status(200).send(user_has_fax_queues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single user_has_fax_queue +exports.show = function(req, res) { + UserHasFaxQueue + .findById(req.params.id) + .then(function(user_has_fax_queue) { + if (!user_has_fax_queue) { + return res.sendStatus(404); + } + return res.send(user_has_fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new user_has_fax_queue in the DB. +exports.create = function(req, res) { + UserHasFaxQueue + .create(req.body) + .then(function(user_has_fax_queue) { + return res.status(201).send(user_has_fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_fax_queue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasFaxQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(user_has_fax_queue) { + if (!user_has_fax_queue) { + return res.sendStatus(404); + } + var updated = _.merge(user_has_fax_queue, req.body); + updated.save() + .then(function() { + return res.status(200).send(user_has_fax_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a user_has_fax_queue from the DB. +exports.destroy = function(req, res) { + UserHasFaxQueue + .find({ + where: { + id: req.params.id + } + }) + .then(function(user_has_fax_queue) { + if (!user_has_fax_queue) { + return res.sendStatus(404); + } + user_has_fax_queue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_fax_queue/user_has_fax_queue.socket.js b/server/api/user_has_fax_queue/user_has_fax_queue.socket.js index e661c0f..4b0602a 100644 --- a/server/api/user_has_fax_queue/user_has_fax_queue.socket.js +++ b/server/api/user_has_fax_queue/user_has_fax_queue.socket.js @@ -1 +1,30 @@ -var _0x9dbb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x42\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x42\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x9dbb[0];var UserHasFaxQueue=require(_0x9dbb[2])[_0x9dbb[1]];exports[_0x9dbb[3]]=function(_0x338cx2){UserHasFaxQueue[_0x9dbb[4]](function(_0x338cx3){onSave(_0x338cx2,_0x338cx3)});UserHasFaxQueue[_0x9dbb[5]](function(_0x338cx3){onRemove(_0x338cx2,_0x338cx3)});UserHasFaxQueue[_0x9dbb[6]](function(_0x338cx3){onSave(_0x338cx2,_0x338cx3)});UserHasFaxQueue[_0x9dbb[7]](function(_0x338cx3){onRemove(_0x338cx2,_0x338cx3)})};function onSave(_0x338cx2,_0x338cx3,_0x338cx5){_0x338cx2[_0x9dbb[9]](_0x9dbb[8],_0x338cx3)}function onRemove(_0x338cx2,_0x338cx3,_0x338cx5){_0x338cx2[_0x9dbb[9]](_0x9dbb[10],_0x338cx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var UserHasFaxQueue = require('../../models').UserHasFaxQueue; + +exports.register = function(socket) { + UserHasFaxQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasFaxQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + UserHasFaxQueue.afterBulkCreate(function(doc) { + onSave(socket, doc); + }); + UserHasFaxQueue.afterBulkDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_fax_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_fax_queue:remove', doc); +} diff --git a/server/api/user_has_fax_queue/user_has_fax_queue.spec.js b/server/api/user_has_fax_queue/user_has_fax_queue.spec.js index cd09278..992672c 100644 --- a/server/api/user_has_fax_queue/user_has_fax_queue.spec.js +++ b/server/api/user_has_fax_queue/user_has_fax_queue.spec.js @@ -1 +1,20 @@ -var _0xcbcf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x67\x65\x74"];_0xcbcf[0];var should=require(_0xcbcf[1]);var app=require(_0xcbcf[2]);var request=require(_0xcbcf[3]);describe(_0xcbcf[4],function(){it(_0xcbcf[5],function(_0x4b3fx4){request(app)[_0xcbcf[13]](_0xcbcf[12])[_0xcbcf[11]](200)[_0xcbcf[11]](_0xcbcf[10],/json/)[_0xcbcf[9]](function(_0x4b3fx5,_0x4b3fx6){if(_0x4b3fx5){return _0x4b3fx4(_0x4b3fx5)};_0x4b3fx6[_0xcbcf[8]][_0xcbcf[1]][_0xcbcf[7]][_0xcbcf[6]](Array);_0x4b3fx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/fax/user_has_queues', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/fax/user_has_queues') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/user_has_mail_queue/index.js b/server/api/user_has_mail_queue/index.js index f88c366..50b083e 100644 --- a/server/api/user_has_mail_queue/index.js +++ b/server/api/user_has_mail_queue/index.js @@ -1 +1,15 @@ -var _0x6927=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x6927[0];var express=require(_0x6927[1]);var controller=require(_0x6927[2]);var router=express.Router();router[_0x6927[5]](_0x6927[3],controller[_0x6927[4]]);router[_0x6927[5]](_0x6927[6],controller[_0x6927[7]]);router[_0x6927[9]](_0x6927[3],controller[_0x6927[8]]);router[_0x6927[11]](_0x6927[6],controller[_0x6927[10]]);router[_0x6927[12]](_0x6927[6],controller[_0x6927[10]]);router[_0x6927[14]](_0x6927[6],controller[_0x6927[13]]);module[_0x6927[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_mail_queue.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/user_has_mail_queue/user_has_mail_queue.controller.js b/server/api/user_has_mail_queue/user_has_mail_queue.controller.js index 87be2c3..c15bc9d 100644 --- a/server/api/user_has_mail_queue/user_has_mail_queue.controller.js +++ b/server/api/user_has_mail_queue/user_has_mail_queue.controller.js @@ -1 +1,95 @@ -var _0x4ff8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x4ff8[0];var _=require(_0x4ff8[1]);var UserHasMailQueue=require(_0x4ff8[3])[_0x4ff8[2]];exports[_0x4ff8[4]]=function(_0xd426x3,_0xd426x4){UserHasMailQueue[_0x4ff8[10]](_0xd426x3[_0x4ff8[9]]?{where:_0xd426x3[_0x4ff8[9]]}:{})[_0x4ff8[8]](function(_0xd426x6){return _0xd426x4[_0x4ff8[7]](200)[_0x4ff8[6]](_0xd426x6)})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})};exports[_0x4ff8[11]]=function(_0xd426x3,_0xd426x4){UserHasMailQueue[_0x4ff8[15]](_0xd426x3[_0x4ff8[14]][_0x4ff8[13]])[_0x4ff8[8]](function(_0xd426x7){if(!_0xd426x7){return _0xd426x4[_0x4ff8[12]](404)};return _0xd426x4[_0x4ff8[6]](_0xd426x7)})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})};exports[_0x4ff8[16]]=function(_0xd426x3,_0xd426x4){UserHasMailQueue[_0x4ff8[16]](_0xd426x3[_0x4ff8[17]])[_0x4ff8[8]](function(_0xd426x7){return _0xd426x4[_0x4ff8[7]](201)[_0x4ff8[6]](_0xd426x7)})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})};exports[_0x4ff8[18]]=function(_0xd426x3,_0xd426x4){if(_0xd426x3[_0x4ff8[17]][_0x4ff8[13]]){delete _0xd426x3[_0x4ff8[17]][_0x4ff8[13]]};UserHasMailQueue[_0x4ff8[15]](_0xd426x3[_0x4ff8[14]][_0x4ff8[13]])[_0x4ff8[8]](function(_0xd426x7){if(!_0xd426x7){return _0xd426x4[_0x4ff8[12]](404)};var _0xd426x8=_[_0x4ff8[19]](_0xd426x7,_0xd426x3[_0x4ff8[17]]);_0xd426x8[_0x4ff8[20]]()[_0x4ff8[8]](function(){return _0xd426x4[_0x4ff8[7]](200)[_0x4ff8[6]](_0xd426x7)})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})};exports[_0x4ff8[21]]=function(_0xd426x3,_0xd426x4){UserHasMailQueue[_0x4ff8[15]](_0xd426x3[_0x4ff8[14]][_0x4ff8[13]])[_0x4ff8[8]](function(_0xd426x7){if(!_0xd426x7){return _0xd426x4[_0x4ff8[12]](404)};_0xd426x7[_0x4ff8[21]]()[_0x4ff8[8]](function(){return _0xd426x4[_0x4ff8[12]](204)})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})})[_0x4ff8[5]](function(_0xd426x5){return handleError(_0xd426x4,_0xd426x5)})};function handleError(_0xd426x4,_0xd426x5){return _0xd426x4[_0x4ff8[7]](500)[_0x4ff8[6]](_0xd426x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasMailQueue = require('../../models').UserHasMailQueue; + +// Get list of user_has_mail_queues +exports.index = function(req, res) { + UserHasMailQueue + .findAll(req.query ? { + where: req.query + } : {}) + .then(function(user_has_mail_queues) { + return res.status(200).send(user_has_mail_queues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single user_has_mail_queue +exports.show = function(req, res) { + UserHasMailQueue + .findById(req.params.id) + .then(function(user_has_mail_queue) { + if (!user_has_mail_queue) { + return res.sendStatus(404); + } + return res.send(user_has_mail_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new user_has_mail_queue in the DB. +exports.create = function(req, res) { + UserHasMailQueue + .create(req.body) + .then(function(user_has_mail_queue) { + return res.status(201).send(user_has_mail_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_mail_queue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasMailQueue + .findById(req.params.id) + .then(function(user_has_mail_queue) { + if (!user_has_mail_queue) { + return res.sendStatus(404); + } + var updated = _.merge(user_has_mail_queue, req.body); + updated.save() + .then(function() { + return res.status(200).send(user_has_mail_queue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a user_has_mail_queue from the DB. +exports.destroy = function(req, res) { + UserHasMailQueue + .findById(req.params.id) + .then(function(user_has_mail_queue) { + if (!user_has_mail_queue) { + return res.sendStatus(404); + } + user_has_mail_queue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_mail_queue/user_has_mail_queue.socket.js b/server/api/user_has_mail_queue/user_has_mail_queue.socket.js index a5b817d..bea513c 100644 --- a/server/api/user_has_mail_queue/user_has_mail_queue.socket.js +++ b/server/api/user_has_mail_queue/user_has_mail_queue.socket.js @@ -1 +1,24 @@ -var _0x1e03=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x1e03[0];var UserHasMailQueue=require(_0x1e03[2])[_0x1e03[1]];exports[_0x1e03[3]]=function(_0x2606x2){UserHasMailQueue[_0x1e03[4]](function(_0x2606x3){onSave(_0x2606x2,_0x2606x3)});UserHasMailQueue[_0x1e03[5]](function(_0x2606x3){onRemove(_0x2606x2,_0x2606x3)})};function onSave(_0x2606x2,_0x2606x3,_0x2606x5){_0x2606x2[_0x1e03[7]](_0x1e03[6],_0x2606x3)}function onRemove(_0x2606x2,_0x2606x3,_0x2606x5){_0x2606x2[_0x1e03[7]](_0x1e03[8],_0x2606x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var UserHasMailQueue = require('../../models').UserHasMailQueue; + +exports.register = function(socket) { + UserHasMailQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasMailQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_mail_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_mail_queue:remove', doc); +} diff --git a/server/api/user_has_service/index.js b/server/api/user_has_service/index.js index 0ad82ef..1e7edf7 100644 --- a/server/api/user_has_service/index.js +++ b/server/api/user_has_service/index.js @@ -1 +1,15 @@ -var _0x6992=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x6992[0];var express=require(_0x6992[1]);var controller=require(_0x6992[2]);var router=express.Router();router[_0x6992[5]](_0x6992[3],controller[_0x6992[4]]);router[_0x6992[5]](_0x6992[6],controller[_0x6992[7]]);router[_0x6992[9]](_0x6992[3],controller[_0x6992[8]]);router[_0x6992[11]](_0x6992[6],controller[_0x6992[10]]);router[_0x6992[12]](_0x6992[6],controller[_0x6992[10]]);router[_0x6992[14]](_0x6992[6],controller[_0x6992[13]]);module[_0x6992[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_service.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/user_has_service/user_has_service.controller.js b/server/api/user_has_service/user_has_service.controller.js index 6bed7df..377090e 100644 --- a/server/api/user_has_service/user_has_service.controller.js +++ b/server/api/user_has_service/user_has_service.controller.js @@ -1 +1,98 @@ -var _0x73ed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x73ed[0];var _=require(_0x73ed[1]);var UserHasService=require(_0x73ed[3])[_0x73ed[2]];exports[_0x73ed[4]]=function(_0xcc7ex3,_0xcc7ex4){UserHasService[_0x73ed[10]](_0xcc7ex3[_0x73ed[9]]?{where:_0xcc7ex3[_0x73ed[9]]}:{})[_0x73ed[8]](function(_0xcc7ex6){return _0xcc7ex4[_0x73ed[7]](200)[_0x73ed[6]](_0xcc7ex6)})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})};exports[_0x73ed[11]]=function(_0xcc7ex3,_0xcc7ex4){UserHasService[_0x73ed[15]](_0xcc7ex3[_0x73ed[14]][_0x73ed[13]])[_0x73ed[8]](function(_0xcc7ex7){if(!_0xcc7ex7){return _0xcc7ex4[_0x73ed[12]](404)};return _0xcc7ex4[_0x73ed[6]](_0xcc7ex7)})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})};exports[_0x73ed[16]]=function(_0xcc7ex3,_0xcc7ex4,_0xcc7ex8){console[_0x73ed[18]](_0xcc7ex3[_0x73ed[17]]);UserHasService[_0x73ed[16]](_0xcc7ex3[_0x73ed[17]])[_0x73ed[8]](function(_0xcc7ex7){return _0xcc7ex4[_0x73ed[7]](201)[_0x73ed[6]](_0xcc7ex7)})[_0x73ed[5]](function(_0xcc7ex5){console[_0x73ed[19]](_0xcc7ex5);return _0xcc7ex8(_0xcc7ex5)})};exports[_0x73ed[20]]=function(_0xcc7ex3,_0xcc7ex4){if(_0xcc7ex3[_0x73ed[17]][_0x73ed[13]]){delete _0xcc7ex3[_0x73ed[17]][_0x73ed[13]]};UserHasService[_0x73ed[15]](_0xcc7ex3[_0x73ed[14]][_0x73ed[13]])[_0x73ed[8]](function(_0xcc7ex7){if(!_0xcc7ex7){return _0xcc7ex4[_0x73ed[12]](404)};var _0xcc7ex9=_[_0x73ed[21]](_0xcc7ex7,_0xcc7ex3[_0x73ed[17]]);_0xcc7ex9[_0x73ed[22]]()[_0x73ed[8]](function(){return _0xcc7ex4[_0x73ed[7]](200)[_0x73ed[6]](_0xcc7ex7)})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})};exports[_0x73ed[23]]=function(_0xcc7ex3,_0xcc7ex4){UserHasService[_0x73ed[15]](_0xcc7ex3[_0x73ed[14]][_0x73ed[13]])[_0x73ed[8]](function(_0xcc7ex7){if(!_0xcc7ex7){return _0xcc7ex4[_0x73ed[12]](404)};_0xcc7ex7[_0x73ed[23]]()[_0x73ed[8]](function(){return _0xcc7ex4[_0x73ed[12]](204)})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})})[_0x73ed[5]](function(_0xcc7ex5){return handleError(_0xcc7ex4,_0xcc7ex5)})};function handleError(_0xcc7ex4,_0xcc7ex5){return _0xcc7ex4[_0x73ed[7]](500)[_0x73ed[6]](_0xcc7ex5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasService = require('../../models').UserHasService; + +// Get list of user_has_voice_queues +exports.index = function(req, res) { + UserHasService + .findAll(req.query ? { + where: req.query + } : {}) + .then(function(user_has_voice_queues) { + return res.status(200).send(user_has_voice_queues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single userHasService +exports.show = function(req, res) { + UserHasService + .findById(req.params.id) + .then(function(userHasService) { + if (!userHasService) { + return res.sendStatus(404); + } + return res.send(userHasService); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new userHasService in the DB. +exports.create = function(req, res, next) { + console.log(req.body); + UserHasService + .create(req.body) + .then(function(userHasService) { + return res.status(201).send(userHasService); + }) + .catch(function(err) { + console.error(err); + return next(err); + // return handleError(res, err); + }); +}; + +// Updates an existing userHasService in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasService + .findById(req.params.id) + .then(function(userHasService) { + if (!userHasService) { + return res.sendStatus(404); + } + var updated = _.merge(userHasService, req.body); + updated.save() + .then(function() { + return res.status(200).send(userHasService); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a userHasService from the DB. +exports.destroy = function(req, res) { + UserHasService + .findById(req.params.id) + .then(function(userHasService) { + if (!userHasService) { + return res.sendStatus(404); + } + userHasService.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_service/user_has_service.socket.js b/server/api/user_has_service/user_has_service.socket.js index 444816d..816d536 100644 --- a/server/api/user_has_service/user_has_service.socket.js +++ b/server/api/user_has_service/user_has_service.socket.js @@ -1 +1,27 @@ -var _0x1491=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x1491[0];var UserHasService=require(_0x1491[2])[_0x1491[1]];exports[_0x1491[3]]=function(_0xe2d9x2){UserHasService[_0x1491[4]](function(_0xe2d9x3){onSave(_0xe2d9x2,_0xe2d9x3)});UserHasService[_0x1491[5]](function(_0xe2d9x3){onSave(_0xe2d9x2,_0xe2d9x3)});UserHasService[_0x1491[6]](function(_0xe2d9x3){onRemove(_0xe2d9x2,_0xe2d9x3)})};function onSave(_0xe2d9x2,_0xe2d9x3,_0xe2d9x5){_0xe2d9x2[_0x1491[8]](_0x1491[7],_0xe2d9x3)}function onRemove(_0xe2d9x2,_0xe2d9x3,_0xe2d9x5){_0xe2d9x2[_0x1491[8]](_0x1491[9],_0xe2d9x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var UserHasService = require('../../models').UserHasService; + +exports.register = function(socket) { + UserHasService.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasService.afterUpdate(function(doc) { + onSave(socket, doc); + }); + UserHasService.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_service:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_service:remove', doc); +} diff --git a/server/api/user_has_service/user_has_service.spec.js b/server/api/user_has_service/user_has_service.spec.js index 2ec8b65..0822ab1 100644 --- a/server/api/user_has_service/user_has_service.spec.js +++ b/server/api/user_has_service/user_has_service.spec.js @@ -1 +1,20 @@ -var _0xbb58=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65","\x67\x65\x74"];_0xbb58[0];var should=require(_0xbb58[1]);var app=require(_0xbb58[2]);var request=require(_0xbb58[3]);describe(_0xbb58[4],function(){it(_0xbb58[5],function(_0x701ax4){request(app)[_0xbb58[13]](_0xbb58[12])[_0xbb58[11]](200)[_0xbb58[11]](_0xbb58[10],/json/)[_0xbb58[9]](function(_0x701ax5,_0x701ax6){if(_0x701ax5){return _0x701ax4(_0x701ax5)};_0x701ax6[_0xbb58[8]][_0xbb58[1]][_0xbb58[7]][_0xbb58[6]](Array);_0x701ax4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/contactmanager/user_has_service', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/contactmanager/user_has_service') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/user_has_team/index.js b/server/api/user_has_team/index.js index 387db96..723bdc1 100644 --- a/server/api/user_has_team/index.js +++ b/server/api/user_has_team/index.js @@ -1 +1,15 @@ -var _0x12e8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x12e8[0];var express=require(_0x12e8[1]);var controller=require(_0x12e8[2]);var router=express.Router();router[_0x12e8[5]](_0x12e8[3],controller[_0x12e8[4]]);router[_0x12e8[5]](_0x12e8[6],controller[_0x12e8[7]]);router[_0x12e8[9]](_0x12e8[3],controller[_0x12e8[8]]);router[_0x12e8[11]](_0x12e8[6],controller[_0x12e8[10]]);router[_0x12e8[12]](_0x12e8[6],controller[_0x12e8[10]]);router[_0x12e8[14]](_0x12e8[6],controller[_0x12e8[13]]);module[_0x12e8[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_team.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/user_has_team/user_has_team.controller.js b/server/api/user_has_team/user_has_team.controller.js index f8c0d6f..7f0f426 100644 --- a/server/api/user_has_team/user_has_team.controller.js +++ b/server/api/user_has_team/user_has_team.controller.js @@ -1 +1,96 @@ -var _0xe06e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x71\x75\x65\x72\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xe06e[0];var _=require(_0xe06e[1]);var UserHasTeam=require(_0xe06e[3])[_0xe06e[2]];exports[_0xe06e[4]]=function(_0x8ab9x3,_0x8ab9x4){console[_0xe06e[6]](_0x8ab9x3[_0xe06e[5]]);UserHasTeam[_0xe06e[11]]({where:_0x8ab9x3[_0xe06e[5]]})[_0xe06e[10]](function(_0x8ab9x6){return _0x8ab9x4[_0xe06e[9]](200)[_0xe06e[8]](_0x8ab9x6)})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})};exports[_0xe06e[12]]=function(_0x8ab9x3,_0x8ab9x4){UserHasTeam[_0xe06e[16]](_0x8ab9x3[_0xe06e[15]][_0xe06e[14]])[_0xe06e[10]](function(_0x8ab9x7){if(!_0x8ab9x7){return _0x8ab9x4[_0xe06e[13]](404)};return _0x8ab9x4[_0xe06e[8]](_0x8ab9x7)})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})};exports[_0xe06e[17]]=function(_0x8ab9x3,_0x8ab9x4){UserHasTeam[_0xe06e[17]](_0x8ab9x3[_0xe06e[18]])[_0xe06e[10]](function(_0x8ab9x7){return _0x8ab9x4[_0xe06e[9]](201)[_0xe06e[8]](_0x8ab9x7)})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})};exports[_0xe06e[19]]=function(_0x8ab9x3,_0x8ab9x4){if(_0x8ab9x3[_0xe06e[18]][_0xe06e[14]]){delete _0x8ab9x3[_0xe06e[18]][_0xe06e[14]]};UserHasTeam[_0xe06e[16]](_0x8ab9x3[_0xe06e[15]][_0xe06e[14]])[_0xe06e[10]](function(_0x8ab9x7){if(!_0x8ab9x7){return _0x8ab9x4[_0xe06e[13]](404)};var _0x8ab9x8=_[_0xe06e[20]](_0x8ab9x7,_0x8ab9x3[_0xe06e[18]]);_0x8ab9x8[_0xe06e[21]]()[_0xe06e[10]](function(){return _0x8ab9x4[_0xe06e[9]](200)[_0xe06e[8]](_0x8ab9x7)})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})};exports[_0xe06e[22]]=function(_0x8ab9x3,_0x8ab9x4){UserHasTeam[_0xe06e[16]](_0x8ab9x3[_0xe06e[15]][_0xe06e[14]])[_0xe06e[10]](function(_0x8ab9x7){if(!_0x8ab9x7){return _0x8ab9x4[_0xe06e[13]](404)};_0x8ab9x7[_0xe06e[22]]()[_0xe06e[10]](function(){return _0x8ab9x4[_0xe06e[13]](204)})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})})[_0xe06e[7]](function(_0x8ab9x5){return handleError(_0x8ab9x4,_0x8ab9x5)})};function handleError(_0x8ab9x4,_0x8ab9x5){return _0x8ab9x4[_0xe06e[9]](500)[_0xe06e[8]](_0x8ab9x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasTeam = require('../../models').UserHasTeam; + +// Get list of user_has_teams +exports.index = function(req, res) { + console.log(req.query); + UserHasTeam + .findAll({ + where: req.query + }) + .then(function(user_has_teams) { + return res.status(200).send(user_has_teams); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single user_has_team +exports.show = function(req, res) { + UserHasTeam + .findById(req.params.id) + .then(function(user_has_team) { + if (!user_has_team) { + return res.sendStatus(404); + } + return res.send(user_has_team); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new user_has_team in the DB. +exports.create = function(req, res) { + UserHasTeam + .create(req.body) + .then(function(user_has_team) { + return res.status(201).send(user_has_team); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing user_has_team in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasTeam + .findById(req.params.id) + .then(function(user_has_team) { + if (!user_has_team) { + return res.sendStatus(404); + } + var updated = _.merge(user_has_team, req.body); + updated.save() + .then(function() { + return res.status(200).send(user_has_team); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a user_has_team from the DB. +exports.destroy = function(req, res) { + UserHasTeam + .findById(req.params.id) + .then(function(user_has_team) { + if (!user_has_team) { + return res.sendStatus(404); + } + user_has_team.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_team/user_has_team.model.js b/server/api/user_has_team/user_has_team.model.js index 583a7c7..6d5861d 100644 --- a/server/api/user_has_team/user_has_team.model.js +++ b/server/api/user_has_team/user_has_team.model.js @@ -1 +1,13 @@ -var _0x81a7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x64\x65\x66\x69\x6E\x65"];_0x81a7[0];module[_0x81a7[1]]=function(_0x1d3ex1,_0x1d3ex2){var _0x1d3ex3=_0x1d3ex1[_0x81a7[3]](_0x81a7[2],{name:String,info:String,active:Boolean});return _0x1d3ex3} \ No newline at end of file +'use strict'; + +module.export = function(sequelize, DataTypes) { + + var UserHasTeam = sequelize.define('UserHasTeam', { + name: String, + info: String, + active: Boolean + }); + + return UserHasTeam; + +}; diff --git a/server/api/user_has_team/user_has_team.socket.js b/server/api/user_has_team/user_has_team.socket.js index cfef21d..879043c 100644 --- a/server/api/user_has_team/user_has_team.socket.js +++ b/server/api/user_has_team/user_has_team.socket.js @@ -1 +1,24 @@ -var _0x497c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x3A\x72\x65\x6D\x6F\x76\x65"];_0x497c[0];var user_has_team=require(_0x497c[2])[_0x497c[1]];exports[_0x497c[3]]=function(_0x1d11x2){user_has_team[_0x497c[4]](function(_0x1d11x3){onSave(_0x1d11x2,_0x1d11x3)});user_has_team[_0x497c[5]](function(_0x1d11x3){onRemove(_0x1d11x2,_0x1d11x3)})};function onSave(_0x1d11x2,_0x1d11x3,_0x1d11x5){_0x1d11x2[_0x497c[7]](_0x497c[6],_0x1d11x3)}function onRemove(_0x1d11x2,_0x1d11x3,_0x1d11x5){_0x1d11x2[_0x497c[7]](_0x497c[8],_0x1d11x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var user_has_team = require('../../models').UserHasTeam; + +exports.register = function(socket) { + user_has_team.afterCreate(function (doc) { + onSave(socket, doc); + }); + user_has_team.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_team:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_team:remove', doc); +} diff --git a/server/api/user_has_team/user_has_team.spec.js b/server/api/user_has_team/user_has_team.spec.js index ed55981..5cc5226 100644 --- a/server/api/user_has_team/user_has_team.spec.js +++ b/server/api/user_has_team/user_has_team.spec.js @@ -1 +1,20 @@ -var _0xf855=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x73","\x67\x65\x74"];_0xf855[0];var should=require(_0xf855[1]);var app=require(_0xf855[2]);var request=require(_0xf855[3]);describe(_0xf855[4],function(){it(_0xf855[5],function(_0x5014x4){request(app)[_0xf855[13]](_0xf855[12])[_0xf855[11]](200)[_0xf855[11]](_0xf855[10],/json/)[_0xf855[9]](function(_0x5014x5,_0x5014x6){if(_0x5014x5){return _0x5014x4(_0x5014x5)};_0x5014x6[_0xf855[8]][_0xf855[1]][_0xf855[7]][_0xf855[6]](Array);_0x5014x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/user_has_teams', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/user_has_teams') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/user_has_voice_queue/index.js b/server/api/user_has_voice_queue/index.js index f96b1e2..72551d5 100644 --- a/server/api/user_has_voice_queue/index.js +++ b/server/api/user_has_voice_queue/index.js @@ -1 +1,15 @@ -var _0xb99f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xb99f[0];var express=require(_0xb99f[1]);var controller=require(_0xb99f[2]);var router=express.Router();router[_0xb99f[5]](_0xb99f[3],controller[_0xb99f[4]]);router[_0xb99f[5]](_0xb99f[6],controller[_0xb99f[7]]);router[_0xb99f[9]](_0xb99f[3],controller[_0xb99f[8]]);router[_0xb99f[11]](_0xb99f[6],controller[_0xb99f[10]]);router[_0xb99f[12]](_0xb99f[6],controller[_0xb99f[10]]);router[_0xb99f[14]](_0xb99f[6],controller[_0xb99f[13]]);module[_0xb99f[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./user_has_voice_queue.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; \ No newline at end of file diff --git a/server/api/user_has_voice_queue/user_has_voice_queue.controller.js b/server/api/user_has_voice_queue/user_has_voice_queue.controller.js index aac7fae..f3e5d22 100644 --- a/server/api/user_has_voice_queue/user_has_voice_queue.controller.js +++ b/server/api/user_has_voice_queue/user_has_voice_queue.controller.js @@ -1 +1,98 @@ -var _0xd8e9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0xd8e9[0];var _=require(_0xd8e9[1]);var UserHasVoiceQueue=require(_0xd8e9[3])[_0xd8e9[2]];exports[_0xd8e9[4]]=function(_0xe4a1x3,_0xe4a1x4){UserHasVoiceQueue[_0xd8e9[10]](_0xe4a1x3[_0xd8e9[9]]?{where:_0xe4a1x3[_0xd8e9[9]]}:{})[_0xd8e9[8]](function(_0xe4a1x6){return _0xe4a1x4[_0xd8e9[7]](200)[_0xd8e9[6]](_0xe4a1x6)})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})};exports[_0xd8e9[11]]=function(_0xe4a1x3,_0xe4a1x4){UserHasVoiceQueue[_0xd8e9[15]](_0xe4a1x3[_0xd8e9[14]][_0xd8e9[13]])[_0xd8e9[8]](function(_0xe4a1x7){if(!_0xe4a1x7){return _0xe4a1x4[_0xd8e9[12]](404)};return _0xe4a1x4[_0xd8e9[6]](_0xe4a1x7)})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})};exports[_0xd8e9[16]]=function(_0xe4a1x3,_0xe4a1x4,_0xe4a1x8){console[_0xd8e9[18]](_0xe4a1x3[_0xd8e9[17]]);UserHasVoiceQueue[_0xd8e9[16]](_0xe4a1x3[_0xd8e9[17]])[_0xd8e9[8]](function(_0xe4a1x7){return _0xe4a1x4[_0xd8e9[7]](201)[_0xd8e9[6]](_0xe4a1x7)})[_0xd8e9[5]](function(_0xe4a1x5){console[_0xd8e9[19]](_0xe4a1x5);return _0xe4a1x8(_0xe4a1x5)})};exports[_0xd8e9[20]]=function(_0xe4a1x3,_0xe4a1x4){if(_0xe4a1x3[_0xd8e9[17]][_0xd8e9[13]]){delete _0xe4a1x3[_0xd8e9[17]][_0xd8e9[13]]};UserHasVoiceQueue[_0xd8e9[15]](_0xe4a1x3[_0xd8e9[14]][_0xd8e9[13]])[_0xd8e9[8]](function(_0xe4a1x7){if(!_0xe4a1x7){return _0xe4a1x4[_0xd8e9[12]](404)};var _0xe4a1x9=_[_0xd8e9[21]](_0xe4a1x7,_0xe4a1x3[_0xd8e9[17]]);_0xe4a1x9[_0xd8e9[22]]()[_0xd8e9[8]](function(){return _0xe4a1x4[_0xd8e9[7]](200)[_0xd8e9[6]](_0xe4a1x7)})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})};exports[_0xd8e9[23]]=function(_0xe4a1x3,_0xe4a1x4){UserHasVoiceQueue[_0xd8e9[15]](_0xe4a1x3[_0xd8e9[14]][_0xd8e9[13]])[_0xd8e9[8]](function(_0xe4a1x7){if(!_0xe4a1x7){return _0xe4a1x4[_0xd8e9[12]](404)};_0xe4a1x7[_0xd8e9[23]]()[_0xd8e9[8]](function(){return _0xe4a1x4[_0xd8e9[12]](204)})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})})[_0xd8e9[5]](function(_0xe4a1x5){return handleError(_0xe4a1x4,_0xe4a1x5)})};function handleError(_0xe4a1x4,_0xe4a1x5){return _0xe4a1x4[_0xd8e9[7]](500)[_0xd8e9[6]](_0xe4a1x5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var UserHasVoiceQueue = require('../../models').UserHasVoiceQueue; + +// Get list of user_has_voice_queues +exports.index = function(req, res) { + UserHasVoiceQueue + .findAll(req.query ? { + where: req.query + } : {}) + .then(function(user_has_voice_queues) { + return res.status(200).send(user_has_voice_queues); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single userHasVoiceQueue +exports.show = function(req, res) { + UserHasVoiceQueue + .findById(req.params.id) + .then(function(userHasVoiceQueue) { + if (!userHasVoiceQueue) { + return res.sendStatus(404); + } + return res.send(userHasVoiceQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new userHasVoiceQueue in the DB. +exports.create = function(req, res, next) { + console.log(req.body); + UserHasVoiceQueue + .create(req.body) + .then(function(userHasVoiceQueue) { + return res.status(201).send(userHasVoiceQueue); + }) + .catch(function(err) { + console.error(err); + return next(err); + // return handleError(res, err); + }); +}; + +// Updates an existing userHasVoiceQueue in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + UserHasVoiceQueue + .findById(req.params.id) + .then(function(userHasVoiceQueue) { + if (!userHasVoiceQueue) { + return res.sendStatus(404); + } + var updated = _.merge(userHasVoiceQueue, req.body); + updated.save() + .then(function() { + return res.status(200).send(userHasVoiceQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a userHasVoiceQueue from the DB. +exports.destroy = function(req, res) { + UserHasVoiceQueue + .findById(req.params.id) + .then(function(userHasVoiceQueue) { + if (!userHasVoiceQueue) { + return res.sendStatus(404); + } + userHasVoiceQueue.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/user_has_voice_queue/user_has_voice_queue.socket.js b/server/api/user_has_voice_queue/user_has_voice_queue.socket.js index 65a79d9..1ed4063 100644 --- a/server/api/user_has_voice_queue/user_has_voice_queue.socket.js +++ b/server/api/user_has_voice_queue/user_has_voice_queue.socket.js @@ -1 +1,42 @@ -var _0xeb02=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x6C\x6F\x67\x67\x65\x64","\x6C\x6F\x67\x67\x65\x64\x41\x74","\x71\x75\x65\x75\x65","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x63\x61\x6C\x6C\x73\x74\x61\x6B\x65\x6E","\x6C\x61\x73\x74\x63\x61\x6C\x6C","\x73\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73\x64\x65\x73\x63","\x73\x74\x61\x74\x75\x73\x41\x74","\x70\x61\x75\x73\x65\x64","\x70\x61\x75\x73\x65\x64\x41\x74","\x72\x65\x61\x73\x6F\x6E","\x55\x73\x65\x72\x49\x64","\x65\x6D\x69\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0xeb02[0];var UserHasVoiceQueue=require(_0xeb02[2])[_0xeb02[1]];exports[_0xeb02[3]]=function(_0xd8c0x2){UserHasVoiceQueue[_0xeb02[4]](function(_0xd8c0x3){onSave(_0xd8c0x2,_0xd8c0x3)});UserHasVoiceQueue[_0xeb02[5]](function(_0xd8c0x3){onSave(_0xd8c0x2,_0xd8c0x3)});UserHasVoiceQueue[_0xeb02[6]](function(_0xd8c0x3){onRemove(_0xd8c0x2,_0xd8c0x3)})};function onSave(_0xd8c0x2,_0xd8c0x3,_0xd8c0x5){_0xd8c0x2[_0xeb02[22]](_0xeb02[7],{logged:_0xd8c0x3[_0xeb02[8]],loggedAt:_0xd8c0x3[_0xeb02[9]],queue:_0xd8c0x3[_0xeb02[10]],membername:_0xd8c0x3[_0xeb02[11]],interface:_0xd8c0x3[_0xeb02[12]],callstaken:_0xd8c0x3[_0xeb02[13]],lastcall:_0xd8c0x3[_0xeb02[14]],status:_0xd8c0x3[_0xeb02[15]],statusdesc:_0xd8c0x3[_0xeb02[16]],statusAt:_0xd8c0x3[_0xeb02[17]],paused:_0xd8c0x3[_0xeb02[18]],pausedAt:_0xd8c0x3[_0xeb02[19]],reason:_0xd8c0x3[_0xeb02[20]],UserId:_0xd8c0x3[_0xeb02[21]]})}function onRemove(_0xd8c0x2,_0xd8c0x3,_0xd8c0x5){_0xd8c0x2[_0xeb02[22]](_0xeb02[23],_0xd8c0x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var UserHasVoiceQueue = require('../../models').UserHasVoiceQueue; + +exports.register = function(socket) { + UserHasVoiceQueue.afterCreate(function(doc) { + onSave(socket, doc); + }); + UserHasVoiceQueue.afterUpdate(function(doc) { + onSave(socket, doc); + }); + UserHasVoiceQueue.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('user_has_voice_queue:save', { + logged: doc.logged, + loggedAt: doc.loggedAt, + queue: doc.queue, + membername: doc.membername, + interface: doc.interface, + callstaken: doc.callstaken, + lastcall: doc.lastcall, + status: doc.status, + statusdesc: doc.statusdesc, + statusAt: doc.statusAt, + paused: doc.paused, + pausedAt: doc.pausedAt, + reason: doc.reason, + UserId: doc.UserId + }); +} + +function onRemove(socket, doc, cb) { + socket.emit('user_has_voice_queue:remove', doc); +} diff --git a/server/api/user_has_voice_queue/user_has_voice_queue.spec.js b/server/api/user_has_voice_queue/user_has_voice_queue.spec.js index d1d4718..0ac501f 100644 --- a/server/api/user_has_voice_queue/user_has_voice_queue.spec.js +++ b/server/api/user_has_voice_queue/user_has_voice_queue.spec.js @@ -1 +1,20 @@ -var _0xa5c1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x67\x65\x74"];_0xa5c1[0];var should=require(_0xa5c1[1]);var app=require(_0xa5c1[2]);var request=require(_0xa5c1[3]);describe(_0xa5c1[4],function(){it(_0xa5c1[5],function(_0x2433x4){request(app)[_0xa5c1[13]](_0xa5c1[12])[_0xa5c1[11]](200)[_0xa5c1[11]](_0xa5c1[10],/json/)[_0xa5c1[9]](function(_0x2433x5,_0x2433x6){if(_0x2433x5){return _0x2433x4(_0x2433x5)};_0x2433x6[_0xa5c1[8]][_0xa5c1[1]][_0xa5c1[7]][_0xa5c1[6]](Array);_0x2433x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/voice/user_has_queues', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/voice/user_has_queues') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 559f1a6..4c9decb 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -1 +1,17 @@ -var _0x800c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x800c[0];var express=require(_0x800c[1]);var controller=require(_0x800c[2]);var auth=require(_0x800c[3]);var router=express.Router();router[_0x800c[7]](_0x800c[4],auth[_0x800c[5]](),controller[_0x800c[6]]);router[_0x800c[7]](_0x800c[8],auth[_0x800c[5]](),controller[_0x800c[9]]);router[_0x800c[11]](_0x800c[4],auth[_0x800c[5]](),controller[_0x800c[10]]);router[_0x800c[13]](_0x800c[8],auth[_0x800c[5]](),controller[_0x800c[12]]);router[_0x800c[14]](_0x800c[8],auth[_0x800c[5]](),controller[_0x800c[12]]);router[_0x800c[16]](_0x800c[4],auth[_0x800c[5]](),controller[_0x800c[15]]);router[_0x800c[16]](_0x800c[8],auth[_0x800c[5]](),controller[_0x800c[17]]);module[_0x800c[18]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./variable.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index eb123c5..2378a95 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -1 +1,117 @@ -var _0x7aed=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x56\x61\x72\x69\x61\x62\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x73\x73\x61\x67\x65","\x56\x61\x72\x69\x61\x62\x6C\x65\x20\x69\x73\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x65\x64\x20\x77\x69\x74\x68\x20\x61\x6E\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x27\x73\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x73","\x6C\x65\x6E\x67\x74\x68","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64\x73"];_0x7aed[0];var _=require(_0x7aed[1]);var Variable=require(_0x7aed[3])[_0x7aed[2]];var Util=require(_0x7aed[4]);exports[_0x7aed[5]]=function(_0xadf1x4,_0xadf1x5,_0xadf1x6){return Variable[_0x7aed[12]](Util[_0x7aed[11]](_0xadf1x4[_0x7aed[10]]))[_0x7aed[9]](function(_0xadf1x8){_0xadf1x5[_0x7aed[8]](200)[_0x7aed[7]](_0xadf1x8)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};exports[_0x7aed[13]]=function(_0xadf1x4,_0xadf1x5){return Variable[_0x7aed[17]](_0xadf1x4[_0x7aed[16]][_0x7aed[15]])[_0x7aed[9]](function(_0xadf1x9){if(!_0xadf1x9){return _0xadf1x5[_0x7aed[14]](404)};return _0xadf1x5[_0x7aed[7]](_0xadf1x9)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};exports[_0x7aed[18]]=function(_0xadf1x4,_0xadf1x5){return Variable[_0x7aed[18]](_0xadf1x4[_0x7aed[19]])[_0x7aed[9]](function(_0xadf1x9){return _0xadf1x5[_0x7aed[8]](201)[_0x7aed[7]](_0xadf1x9)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};exports[_0x7aed[20]]=function(_0xadf1x4,_0xadf1x5){if(_0xadf1x4[_0x7aed[19]][_0x7aed[15]]){delete _0xadf1x4[_0x7aed[19]][_0x7aed[15]]};return Variable[_0x7aed[17]](_0xadf1x4[_0x7aed[16]][_0x7aed[15]])[_0x7aed[9]](function(_0xadf1x9){if(!_0xadf1x9){return _0xadf1x5[_0x7aed[14]](404)};var _0xadf1xa=_[_0x7aed[21]](_0xadf1x9,_0xadf1x4[_0x7aed[19]]);return _0xadf1xa[_0x7aed[22]]()})[_0x7aed[9]](function(_0xadf1x9){return _0xadf1x5[_0x7aed[8]](200)[_0x7aed[7]](_0xadf1x9)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};exports[_0x7aed[23]]=function(_0xadf1x4,_0xadf1x5){return Variable[_0x7aed[27]](_0x7aed[26])[_0x7aed[17]](_0xadf1x4[_0x7aed[16]][_0x7aed[15]])[_0x7aed[9]](function(_0xadf1x9){if(!_0xadf1x9){return _0xadf1x5[_0x7aed[14]](404)};if(variableHasAssociation(_0xadf1x9)){var _0xadf1x7= new Error();_0xadf1x7[_0x7aed[24]]=_0x7aed[25];throw _0xadf1x7};return _0xadf1x9[_0x7aed[23]]()})[_0x7aed[9]](function(){return _0xadf1x5[_0x7aed[14]](204)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};exports[_0x7aed[28]]=function(_0xadf1x4,_0xadf1x5){return Variable[_0x7aed[23]]({where:{id:_0xadf1x4[_0x7aed[10]][_0x7aed[29]]},individualHooks:true})[_0x7aed[9]](function(){return _0xadf1x5[_0x7aed[14]](204)})[_0x7aed[6]](function(_0xadf1x7){return handleError(_0xadf1x5,_0xadf1x7)})};function handleError(_0xadf1x5,_0xadf1x7){return _0xadf1x5[_0x7aed[8]](500)[_0x7aed[7]](_0xadf1x7)}function variableHasAssociation(_0xadf1x9){return ((_0xadf1x9[_0x7aed[30]]&&_0xadf1x9[_0x7aed[30]][_0x7aed[31]]>0)||(_0xadf1x9[_0x7aed[32]]&&_0xadf1x9[_0x7aed[32]][_0x7aed[31]]>0)||(_0xadf1x9[_0x7aed[33]]&&_0xadf1x9[_0x7aed[33]][_0x7aed[31]]>0)||(_0xadf1x9[_0x7aed[34]]&&_0xadf1x9[_0x7aed[34]][_0x7aed[31]]>0)||(_0xadf1x9[_0x7aed[35]]&&_0xadf1x9[_0x7aed[35]][_0x7aed[31]]>0))} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Variable = require('../../models').Variable; +var Util = require('../../config/util'); + +// Get list of variables +exports.index = function(req, res, next) { + return Variable + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single variable +exports.show = function(req, res) { + return Variable + .findById(req.params.id) + .then(function(variable) { + if (!variable) { + return res.sendStatus(404); + } + return res.send(variable); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new variable in the DB. +exports.create = function(req, res) { + return Variable + .create(req.body) + .then(function(variable) { + return res.status(201).send(variable); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing variable in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return Variable + .findById(req.params.id) + .then(function(variable) { + if (!variable) { + return res.sendStatus(404); + } + var updated = _.merge(variable, req.body); + return updated + .save(); + }) + .then(function(variable) { + return res.status(200).send(variable); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a variable from the DB. +exports.destroy = function(req, res) { + return Variable + .scope('fields') + .findById(req.params.id) + .then(function(variable) { + if (!variable) { + return res.sendStatus(404); + } + if (variableHasAssociation(variable)) { + var err = new Error(); + err.message = 'Variable is associated with an integration\'s configuration'; + throw err; + } + return variable.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.bulkDestroy = function(req, res) { + return Variable + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} + +function variableHasAssociation(variable) { + return ((variable.ZendeskFields && variable.ZendeskFields.length > 0) || (variable.DeskFields && variable.DeskFields.length > 0) || (variable.SalesforceFields && variable.SalesforceFields.length > + 0) || (variable.FreshdeskFields && variable.FreshdeskFields.length > 0) || (variable.SugarcrmFields && variable.SugarcrmFields.length > 0)); +} diff --git a/server/api/variable/variable.socket.js b/server/api/variable/variable.socket.js index 34e2ba8..739f11c 100644 --- a/server/api/variable/variable.socket.js +++ b/server/api/variable/variable.socket.js @@ -1 +1,24 @@ -var _0x78f4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x61\x72\x69\x61\x62\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x61\x72\x69\x61\x62\x6C\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x61\x72\x69\x61\x62\x6C\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x78f4[0];var Variable=require(_0x78f4[2])[_0x78f4[1]];exports[_0x78f4[3]]=function(_0x124fx2){Variable[_0x78f4[4]](function(_0x124fx3){onSave(_0x124fx2,_0x124fx3)});Variable[_0x78f4[5]](function(_0x124fx3){onRemove(_0x124fx2,_0x124fx3)})};function onSave(_0x124fx2,_0x124fx3,_0x124fx5){_0x124fx2[_0x78f4[7]](_0x78f4[6],_0x124fx3)}function onRemove(_0x124fx2,_0x124fx3,_0x124fx5){_0x124fx2[_0x78f4[7]](_0x78f4[8],_0x124fx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var Variable = require('../../models').Variable; + +exports.register = function(socket) { + Variable.afterCreate(function(doc) { + onSave(socket, doc); + }); + Variable.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('variable:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('variable:remove', doc); +} diff --git a/server/api/voice_context/index.js b/server/api/voice_context/index.js index f6e74b8..1b436c8 100644 --- a/server/api/voice_context/index.js +++ b/server/api/voice_context/index.js @@ -1 +1,16 @@ -var _0x636c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x63\x6F\x6E\x74\x65\x78\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x636c[0];var express=require(_0x636c[1]);var controller=require(_0x636c[2]);var auth=require(_0x636c[3]);var router=express.Router();router[_0x636c[7]](_0x636c[4],auth[_0x636c[5]](),controller[_0x636c[6]]);router[_0x636c[7]](_0x636c[8],auth[_0x636c[5]](),controller[_0x636c[9]]);router[_0x636c[11]](_0x636c[4],auth[_0x636c[5]](),controller[_0x636c[10]]);router[_0x636c[11]](_0x636c[12],auth[_0x636c[5]](),controller[_0x636c[13]]);router[_0x636c[15]](_0x636c[8],auth[_0x636c[5]](),controller[_0x636c[14]]);router[_0x636c[17]](_0x636c[4],auth[_0x636c[5]](),controller[_0x636c[16]]);router[_0x636c[17]](_0x636c[8],auth[_0x636c[5]](),controller[_0x636c[18]]);module[_0x636c[19]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_context.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.contextValidation); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +module.exports = router; diff --git a/server/api/voice_context/voice_context.controller.js b/server/api/voice_context/voice_context.controller.js index e8688e1..c6ec224 100644 --- a/server/api/voice_context/voice_context.controller.js +++ b/server/api/voice_context/voice_context.controller.js @@ -1 +1,227 @@ -var _0xe0c5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x6F\x6E\x74\x65\x78\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x6D\x65\x73\x73\x61\x67\x65","\x54\x68\x65\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x43\x4F\x4E\x54\x45\x58\x54","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x6C\x65\x6E\x67\x74\x68","\x64\x65\x73\x74\x72\x6F\x79","\x65\x72\x72","\x6C\x6F\x67","\x54\x68\x65\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x69\x73\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x65\x64\x20\x74\x6F\x20\x61\x20\x72\x6F\x75\x74\x65\x2C\x20\x64\x65\x6C\x65\x74\x65\x20\x6F\x72\x20\x63\x68\x61\x6E\x67\x65\x20\x69\x74\x20\x66\x69\x72\x73\x74","\x4D\x45\x53\x53\x41\x47\x45\x5F\x43\x4F\x4E\x54\x45\x58\x54\x5F\x52\x4F\x55\x54\x45\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x64\x65\x66\x61\x75\x6C\x74\x45\x6E\x74\x72\x79","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x64\x65\x6C\x65\x74\x65\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x65\x6E\x74\x72\x79\x21","\x4D\x45\x53\x53\x41\x47\x45\x5F\x44\x45\x46\x41\x55\x4C\x54\x5F\x45\x4E\x54\x52\x59","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x66\x69\x6E\x64","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x61\x70"];_0xe0c5[0];var _=require(_0xe0c5[1]);var util=require(_0xe0c5[2]);var Util=require(_0xe0c5[3]);var sequelize=require(_0xe0c5[5])[_0xe0c5[4]];var VoiceContext=require(_0xe0c5[5])[_0xe0c5[6]];var VoiceExtension=require(_0xe0c5[5])[_0xe0c5[7]];exports[_0xe0c5[8]]=function(_0xdd96x7,_0xdd96x8,_0xdd96x9){return VoiceContext[_0xe0c5[15]](Util[_0xe0c5[14]](_0xdd96x7[_0xe0c5[13]]))[_0xe0c5[12]](function(_0xdd96xb){_0xdd96x8[_0xe0c5[11]](200)[_0xe0c5[10]](_0xdd96xb)})[_0xe0c5[9]](function(_0xdd96xa){return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[16]]=function(_0xdd96x7,_0xdd96x8){return VoiceContext[_0xe0c5[20]](_0xdd96x7[_0xe0c5[19]][_0xe0c5[18]])[_0xe0c5[12]](function(_0xdd96xc){if(!_0xdd96xc){return _0xdd96x8[_0xe0c5[17]](404)};return _0xdd96x8[_0xe0c5[10]](_0xdd96xc)})[_0xe0c5[9]](function(_0xdd96xa){return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[21]]=function(_0xdd96x7,_0xdd96x8){return VoiceContext[_0xe0c5[24]]({where:{name:_0xdd96x7[_0xe0c5[23]][_0xe0c5[22]]}})[_0xe0c5[12]](function(_0xdd96xd){if(!_0xdd96xd){return _0xdd96x8[_0xe0c5[17]](404)};return _0xdd96x8[_0xe0c5[10]](_0xdd96xd)})[_0xe0c5[9]](function(_0xdd96xa){return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[25]]=function(_0xdd96x7,_0xdd96x8){return VoiceContext[_0xe0c5[25]](_0xdd96x7[_0xe0c5[23]])[_0xe0c5[12]](function(_0xdd96xc){return _0xdd96x8[_0xe0c5[11]](201)[_0xe0c5[10]](_0xdd96xc)})[_0xe0c5[9]](sequelize.UniqueConstraintError,function(_0xdd96xa){_0xdd96xa[_0xe0c5[26]]=_0xe0c5[27];_0xdd96xa[_0xe0c5[28]]=_0xe0c5[29];return handleError(_0xdd96x8,_0xdd96xa)})[_0xe0c5[9]](function(_0xdd96xa){return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[30]]=function(_0xdd96x7,_0xdd96x8){return VoiceContext[_0xe0c5[24]]({where:{name:_0xdd96x7[_0xe0c5[23]][_0xe0c5[22]],id:{$ne:_0xdd96x7[_0xe0c5[23]][_0xe0c5[18]]}}})[_0xe0c5[12]](function(_0xdd96xf){if(!_0xdd96xf){return _0xdd96x8[_0xe0c5[17]](404)};if(_0xdd96xf[_0xe0c5[33]]>0){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]]({message:_0xe0c5[29]})};if(_0xdd96x7[_0xe0c5[23]][_0xe0c5[18]]){delete _0xdd96x7[_0xe0c5[23]][_0xe0c5[18]]};return VoiceContext[_0xe0c5[20]](_0xdd96x7[_0xe0c5[19]][_0xe0c5[18]])})[_0xe0c5[12]](function(_0xdd96xc){if(!_0xdd96xc){return _0xdd96x8[_0xe0c5[17]](404)};var _0xdd96xe=_[_0xe0c5[31]](_0xdd96xc,_0xdd96x7[_0xe0c5[23]]);return _0xdd96xe[_0xe0c5[32]]()})[_0xe0c5[12]](function(_0xdd96xc){return _0xdd96x8[_0xe0c5[11]](200)[_0xe0c5[10]](_0xdd96xc)})[_0xe0c5[9]](function(_0xdd96xa){return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[34]]=function(_0xdd96x7,_0xdd96x8){var _0xdd96x10;return VoiceContext[_0xe0c5[20]](_0xdd96x7[_0xe0c5[19]][_0xe0c5[18]])[_0xe0c5[12]](function(_0xdd96xc){_0xdd96x10=_0xdd96xc;if(!_0xdd96x10){return _0xdd96x8[_0xe0c5[17]](404)};if(_0xdd96x10[_0xe0c5[39]]){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]]({message:_0xe0c5[40],translatedMessage:_0xe0c5[41]})};return VoiceExtension[_0xe0c5[24]]({where:{context:_0xdd96x10[_0xe0c5[22]],VoiceContextId:null}})})[_0xe0c5[12]](function(_0xdd96x11){console[_0xe0c5[36]](_0xdd96x11);if(_0xdd96x11[_0xe0c5[33]]>0){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]]({message:_0xe0c5[37],translatedMessage:_0xe0c5[38]})};return _0xdd96x10[_0xe0c5[34]]()})[_0xe0c5[12]](function(){return _0xdd96x8[_0xe0c5[17]](204)})[_0xe0c5[9]](function(_0xdd96xa){console[_0xe0c5[36]](_0xe0c5[35],_0xdd96xa);return handleError(_0xdd96x8,_0xdd96xa)})};exports[_0xe0c5[42]]=function(_0xdd96x7,_0xdd96x8){var _0xdd96x12;return VoiceContext[_0xe0c5[24]]({where:{id:_0xdd96x7[_0xe0c5[13]][_0xe0c5[43]]}})[_0xe0c5[12]](function(_0xdd96xd){_0xdd96x12=_0xdd96xd;var _0xdd96x13=_[_0xe0c5[44]](_0xdd96x12,{defaultEntry:true});if(_0xdd96x13){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]]({message:_0xe0c5[40],translatedMessage:_0xe0c5[41]})};if(!_0xdd96x12){return _0xdd96x8[_0xe0c5[17]](404)};var _0xdd96x14=_[_0xe0c5[46]](_[_0xe0c5[46]](_0xdd96x12,_0xe0c5[45]),_0xe0c5[22]);return VoiceExtension[_0xe0c5[24]]({where:{context:_0xdd96x14,VoiceContextId:null}})})[_0xe0c5[12]](function(_0xdd96x11){if(_0xdd96x11[_0xe0c5[33]]>_0xdd96x12[_0xe0c5[33]]){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]]({message:_0xe0c5[37],translatedMessage:_0xe0c5[38]})};return VoiceContext[_0xe0c5[34]]({where:{id:_0xdd96x7[_0xe0c5[13]][_0xe0c5[43]]},individualHooks:true})})[_0xe0c5[12]](function(){return _0xdd96x8[_0xe0c5[17]](204)})[_0xe0c5[9]](function(_0xdd96xa){console[_0xe0c5[36]](_0xdd96xa);return handleError(_0xdd96x8,_0xdd96xa)})};function handleError(_0xdd96x8,_0xdd96xa){return _0xdd96x8[_0xe0c5[11]](500)[_0xe0c5[10]](_0xdd96xa)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); + +var Util = require('../../config/util'); +var sequelize = require('../../models').sequelize; + +var VoiceContext = require('../../models').VoiceContext; +var VoiceExtension = require('../../models').VoiceExtension; + +// Get list of agents +exports.index = function(req, res, next) { + return VoiceContext + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single voiceContext +exports.show = function(req, res) { + return VoiceContext + .findById(req.params.id) + .then(function(voiceContext) { + if (!voiceContext) { + return res.sendStatus(404); + } + return res.send(voiceContext); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Validate the existence of a context +exports.contextValidation = function(req, res) { + return VoiceContext + .findAll({ + where: { + name: req.body.name + } + }) + .then(function(voiceContexts) { + if (!voiceContexts) { + return res.sendStatus(404); + } + return res.send(voiceContexts); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new voiceContext in the DB. +exports.create = function(req, res) { + return VoiceContext + .create(req.body) + .then(function(voiceContext) { + return res.status(201).send(voiceContext); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + err.message = 'The context name already exists'; + err.translatedMessage = 'MESSAGE_EXIST_CONTEXT' + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); + +}; + +// Updates an existing voiceContext in the DB. +exports.update = function(req, res) { + return VoiceContext + .findAll({ + where: { + name: req.body.name, + id: { + $ne: req.body.id + } + } + }) + .then(function(existingContexts) { + if (!existingContexts) { + return res.sendStatus(404); + } + if (existingContexts.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_CONTEXT' + }); + } + if (req.body.id) { + delete req.body.id; + } + return VoiceContext + .findById(req.params.id); + }) + .then(function(voiceContext) { + if (!voiceContext) { + return res.sendStatus(404); + } + var updated = _.merge(voiceContext, req.body); + return updated + .save(); + }) + .then(function(voiceContext) { + return res.status(200).send(voiceContext); + }) + .catch(function(err) { + return handleError(res, err); + }); + +}; + +// Deletes a voiceContext from the DB. +exports.destroy = function(req, res) { + var _voiceContext; + + return VoiceContext + .findById(req.params.id) + .then(function(voiceContext) { + _voiceContext = voiceContext; + if (!_voiceContext) { + return res.sendStatus(404); + } + if (_voiceContext.defaultEntry) { + return res.status(500).send({ + message: 'You can\'t delete a default entry!', + translatedMessage: 'MESSAGE_DEFAULT_ENTRY' + }); + } + return VoiceExtension + .findAll({ + where: { + context: _voiceContext.name, + VoiceContextId: null + } + }); + }) + .then(function(contextExtensions) { + console.log(contextExtensions); + if (contextExtensions.length > 0) { + return res.status(500).send({ + message: 'The context is associated to a route, delete or change it first', + translatedMessage: 'MESSAGE_CONTEXT_ROUTE_ASSOCIATED' + }); + } + return _voiceContext + .destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + console.log('err', err); + return handleError(res, err); + }); + +}; + +// Deletes a context from the DB. +exports.bulkDestroy = function(req, res) { + + var _voiceContexts; + + return VoiceContext + .findAll({ + where: { + id: req.query.ids + } + }) + .then(function(voiceContexts) { + _voiceContexts = voiceContexts; + var isDefault = _.find(_voiceContexts, { + defaultEntry: true + }); + if (isDefault) { + return res.status(500).send({ + message: 'You can\'t delete a default entry!', + translatedMessage: 'MESSAGE_DEFAULT_ENTRY' + }); + } + if (!_voiceContexts) { + return res.sendStatus(404); + } + var destroyContextsNames = _.map(_.map(_voiceContexts, 'dataValues'), 'name'); + + return VoiceExtension + .findAll({ + where: { + context: destroyContextsNames, + VoiceContextId: null + } + }); + }) + .then(function(contextExtensions) { + if (contextExtensions.length > _voiceContexts.length) { + return res.status(500).send({ + message: 'The context is associated to a route, delete or change it first', + translatedMessage: 'MESSAGE_CONTEXT_ROUTE_ASSOCIATED' + }); + } + + return VoiceContext + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_context/voice_context.socket.js b/server/api/voice_context/voice_context.socket.js index 7141070..c3841ec 100644 --- a/server/api/voice_context/voice_context.socket.js +++ b/server/api/voice_context/voice_context.socket.js @@ -1 +1,24 @@ -var _0xd32b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0xd32b[0];var VoiceContext=require(_0xd32b[2])[_0xd32b[1]];exports[_0xd32b[3]]=function(_0xe24ex2){VoiceContext[_0xd32b[4]](function(_0xe24ex3){onSave(_0xe24ex2,_0xe24ex3)});VoiceContext[_0xd32b[5]](function(_0xe24ex3){onRemove(_0xe24ex2,_0xe24ex3)})};function onSave(_0xe24ex2,_0xe24ex3,_0xe24ex5){_0xe24ex2[_0xd32b[7]](_0xd32b[6],_0xe24ex3)}function onRemove(_0xe24ex2,_0xe24ex3,_0xe24ex5){_0xe24ex2[_0xd32b[7]](_0xd32b[8],_0xe24ex3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceContext = require('../../models').VoiceContext; + +exports.register = function(socket) { + VoiceContext.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceContext.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_context:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_context:remove', doc); +} diff --git a/server/api/voice_context/voice_context.spec.js b/server/api/voice_context/voice_context.spec.js index 36ee238..1a60777 100644 --- a/server/api/voice_context/voice_context.spec.js +++ b/server/api/voice_context/voice_context.spec.js @@ -1 +1,20 @@ -var _0xd2e4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x63\x6F\x6E\x74\x65\x78\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x63\x6F\x6E\x74\x65\x78\x74\x73","\x67\x65\x74"];_0xd2e4[0];var should=require(_0xd2e4[1]);var app=require(_0xd2e4[2]);var request=require(_0xd2e4[3]);describe(_0xd2e4[4],function(){it(_0xd2e4[5],function(_0x48a5x4){request(app)[_0xd2e4[13]](_0xd2e4[12])[_0xd2e4[11]](200)[_0xd2e4[11]](_0xd2e4[10],/json/)[_0xd2e4[9]](function(_0x48a5x5,_0x48a5x6){if(_0x48a5x5){return _0x48a5x4(_0x48a5x5)};_0x48a5x6[_0xd2e4[8]][_0xd2e4[1]][_0xd2e4[7]][_0xd2e4[6]](Array);_0x48a5x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/voice/contexts', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/voice/contexts') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/voice_extension/index.js b/server/api/voice_extension/index.js index 806fe4f..b0215fc 100644 --- a/server/api/voice_extension/index.js +++ b/server/api/voice_extension/index.js @@ -1 +1,16 @@ -var _0x3a41=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x3a41[0];var express=require(_0x3a41[1]);var controller=require(_0x3a41[2]);var auth=require(_0x3a41[3]);var router=express.Router();router[_0x3a41[7]](_0x3a41[4],auth[_0x3a41[5]](),controller[_0x3a41[6]]);router[_0x3a41[7]](_0x3a41[8],auth[_0x3a41[5]](),controller[_0x3a41[9]]);router[_0x3a41[11]](_0x3a41[4],auth[_0x3a41[5]](),controller[_0x3a41[10]]);router[_0x3a41[13]](_0x3a41[8],auth[_0x3a41[5]](),controller[_0x3a41[12]]);router[_0x3a41[15]](_0x3a41[4],auth[_0x3a41[5]](),controller[_0x3a41[14]]);router[_0x3a41[15]](_0x3a41[8],auth[_0x3a41[5]](),controller[_0x3a41[16]]);module[_0x3a41[17]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_extension.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); //check it for apps +router.delete('/:id', auth.isAuthenticated(), controller.destroy); //check it for apps + +module.exports = router; diff --git a/server/api/voice_extension/voice_extension.controller.js b/server/api/voice_extension/voice_extension.controller.js index 7b05303..6dc7233 100644 --- a/server/api/voice_extension/voice_extension.controller.js +++ b/server/api/voice_extension/voice_extension.controller.js @@ -1 +1,146 @@ -var _0xfe8e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x53\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x72\x6F\x75\x74\x65\x73","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x72\x65\x61\x74\x65","\x65\x72\x72","\x6D\x65\x73\x73\x61\x67\x65","\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2F\x63\x6F\x6E\x74\x65\x78\x74\x20\x63\x6F\x6D\x62\x69\x6E\x61\x74\x69\x6F\x6E\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x52\x4F\x55\x54\x45","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x41\x70\x70\x73","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x72\x6F\x75\x74\x65\x55\x70\x64\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64\x42\x79\x49\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0xfe8e[0];var _=require(_0xfe8e[1]);var VoiceExtension=require(_0xfe8e[3])[_0xfe8e[2]];var Interval=require(_0xfe8e[3])[_0xfe8e[4]];var sequelize=require(_0xfe8e[3])[_0xfe8e[5]];var Sequelize=require(_0xfe8e[3])[_0xfe8e[6]];var util=require(_0xfe8e[7]);var async=require(_0xfe8e[8]);var veUtil=require(_0xfe8e[9]);var Util=require(_0xfe8e[10]);var Applications=veUtil[_0xfe8e[11]];exports[_0xfe8e[12]]=function(_0x556axb,_0x556axc,_0x556axd){return VoiceExtension[_0xfe8e[23]](_0xfe8e[21],_0xfe8e[22])[_0xfe8e[20]](Util[_0xfe8e[19]](_0x556axb[_0xfe8e[18]]))[_0xfe8e[17]](function(_0x556axf){_0x556axc[_0xfe8e[16]](200)[_0xfe8e[15]](_0x556axf)})[_0xfe8e[14]](function(_0x556axe){console[_0xfe8e[13]](_0x556axe);return handleError(_0x556axc,_0x556axe)})};exports[_0xfe8e[24]]=function(_0x556axb,_0x556axc){VoiceExtension[_0xfe8e[23]](_0xfe8e[22])[_0xfe8e[28]]({where:{id:_0x556axb[_0xfe8e[27]][_0xfe8e[26]],VoiceExtensionId:null}})[_0xfe8e[17]](function(_0x556ax10){if(!_0x556ax10){return _0x556axc[_0xfe8e[25]](404)};return _0x556axc[_0xfe8e[15]](_0x556ax10)})[_0xfe8e[14]](function(_0x556axe){return handleError(_0x556axc,_0x556axe)})};exports[_0xfe8e[29]]=function(_0x556axb,_0x556axc){var _0x556ax11;return sequelize[_0xfe8e[39]](function(_0x556ax12){return VoiceExtension[_0xfe8e[29]](_0x556axb[_0xfe8e[35]],{transaction:_0x556ax12})[_0xfe8e[17]](function(_0x556ax13){_0x556ax11=_0x556ax13;if(_0x556axb[_0xfe8e[35]][_0xfe8e[11]]&&Array[_0xfe8e[37]](_0x556axb[_0xfe8e[35]].Applications)&&_0x556axb[_0xfe8e[35]][_0xfe8e[11]][_0xfe8e[38]]){return _0x556ax13}})[_0xfe8e[17]](veUtil[_0xfe8e[36]](_0x556axb[_0xfe8e[35]].Applications,_0x556ax12,_0x556axc))})[_0xfe8e[17]](function(){return _0x556axc[_0xfe8e[16]](201)[_0xfe8e[15]](_0x556ax11)})[_0xfe8e[14]](sequelize.UniqueConstraintError,function(_0x556axe){_0x556axe[_0xfe8e[31]]=_0xfe8e[32];_0x556axe[_0xfe8e[33]]=_0xfe8e[34];return handleError(_0x556axc,_0x556axe)})[_0xfe8e[14]](sequelize.ValidationError,function(_0x556axe){_0x556axe[_0xfe8e[31]]=_0xfe8e[32];_0x556axe[_0xfe8e[33]]=_0xfe8e[34];return handleError(_0x556axc,_0x556axe)})[_0xfe8e[14]](function(_0x556axe){console[_0xfe8e[13]](_0xfe8e[30],_0x556axe);return handleError(_0x556axc,_0x556axe)})};exports[_0xfe8e[40]]=function(_0x556axb,_0x556axc){return sequelize[_0xfe8e[39]](function(_0x556ax12){return veUtil[_0xfe8e[41]](_0x556axb,_0x556ax12)})[_0xfe8e[17]](function(){return _0x556axc[_0xfe8e[25]](200)})[_0xfe8e[14]](sequelize.UniqueConstraintError,function(_0x556axe){_0x556axe[_0xfe8e[31]]=_0xfe8e[32];_0x556axe[_0xfe8e[33]]=_0xfe8e[34];console[_0xfe8e[13]](_0x556axe);return handleError(_0x556axc,_0x556axe)})[_0xfe8e[14]](function(_0x556axe){console[_0xfe8e[13]](_0x556axe);return handleError(_0x556axc,_0x556axe)})};exports[_0xfe8e[42]]=function(_0x556axb,_0x556axc,_0x556axd){return sequelize[_0xfe8e[39]](function(_0x556ax12){return VoiceExtension[_0xfe8e[43]](_0x556axb[_0xfe8e[27]][_0xfe8e[26]])[_0xfe8e[17]](function(_0x556ax10){if(!_0x556ax10){return _0x556axc[_0xfe8e[25]](404)};return _0x556ax10[_0xfe8e[42]]()})})[_0xfe8e[17]](function(){return _0x556axc[_0xfe8e[25]](204)})[_0xfe8e[14]](function(_0x556axe){console[_0xfe8e[13]](_0x556axe);return handleError(_0x556axc,_0x556axe)})};exports[_0xfe8e[44]]=function(_0x556axb,_0x556axc){VoiceExtension[_0xfe8e[42]]({where:{id:_0x556axb[_0xfe8e[18]][_0xfe8e[26]]},individualHooks:true})[_0xfe8e[17]](function(){return _0x556axc[_0xfe8e[25]](204)})[_0xfe8e[14]](function(_0x556axe){return handleError(_0x556axc,_0x556axe)})};function handleError(_0x556axc,_0x556axe){return _0x556axc[_0xfe8e[16]](500)[_0xfe8e[15]](_0x556axe)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var VoiceExtension = require('../../models').VoiceExtension; +var Interval = require('../../models').Interval; +var sequelize = require('../../models').sequelize; +var Sequelize = require('../../models').Sequelize; +var util = require('util'); +var async = require('async'); +var veUtil = require('../../utils/voice_extension'); +var Util = require('../../config/util'); + +var Applications = veUtil.Applications; + +// Get list of extensions +exports.index = function(req, res, next) { + return VoiceExtension + .scope('routes', 'application') + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get a single voice_extension or application +exports.show = function(req, res) { + VoiceExtension + .scope('application') + .findOne({ + where: { + id: req.params.id, + VoiceExtensionId: null + } + }) + .then(function(voice_extension) { + if (!voice_extension) { + return res.sendStatus(404); + } + return res.send(voice_extension); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.create = function(req, res) { + var _route; + return sequelize.transaction(function(t) { + return VoiceExtension + .create(req.body, { + transaction: t + }) + .then(function(route) { + _route = route; + if (req.body.Applications && Array.isArray(req.body.Applications) && req.body.Applications.length) { + return route; + } + }) + .then(veUtil.createApps(req.body.Applications, t, res)); + }) + .then(function() { + return res.status(201).send(_route); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + err.message = 'Extension/context combination already exist'; + err.translatedMessage = 'MESSAGE_EXIST_ROUTE' + return handleError(res, err); + }) + .catch(sequelize.ValidationError, function(err) { + err.message = 'Extension/context combination already exist'; + err.translatedMessage = 'MESSAGE_EXIST_ROUTE' + return handleError(res, err); + }) + .catch(function(err) { + console.log('err', err); + return handleError(res, err); + }); +} + + + +// Updates an existing voice_extension in the DB. +exports.update = function(req, res) { + return sequelize.transaction(function(t) { + return veUtil.routeUpdate(req, t); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + err.message = 'Extension/context combination already exist'; + err.translatedMessage = 'MESSAGE_EXIST_ROUTE' + console.log(err); + return handleError(res, err); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +} + +// Deletes a voice_extension from the DB. +exports.destroy = function(req, res, next) { + return sequelize.transaction(function(t) { + return VoiceExtension + .findById(req.params.id) + .then(function(voice_extension) { + if (!voice_extension) { + return res.sendStatus(404); + } + return voice_extension.destroy(); + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Deletes from the DB. +exports.bulkDestroy = function(req, res) { + VoiceExtension + .destroy({ + where: { + id: req.query.id + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_extension/voice_extension.socket.js b/server/api/voice_extension/voice_extension.socket.js index e2b0872..8da1778 100644 --- a/server/api/voice_extension/voice_extension.socket.js +++ b/server/api/voice_extension/voice_extension.socket.js @@ -1 +1,34 @@ -var _0x7be1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65","\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x3A\x75\x70\x64\x61\x74\x65"];_0x7be1[0];var VoiceExtension=require(_0x7be1[2])[_0x7be1[1]];exports[_0x7be1[3]]=function(_0x2eeax2){VoiceExtension[_0x7be1[4]](function(_0x2eeax3){onSave(_0x2eeax2,_0x2eeax3)});VoiceExtension[_0x7be1[5]](function(_0x2eeax3){onRemove(_0x2eeax2,_0x2eeax3)});VoiceExtension[_0x7be1[6]](function(_0x2eeax3){onUpdate(_0x2eeax2,_0x2eeax3)})};function onSave(_0x2eeax2,_0x2eeax3,_0x2eeax5){_0x2eeax2[_0x7be1[8]](_0x7be1[7],_0x2eeax3)}function onRemove(_0x2eeax2,_0x2eeax3,_0x2eeax5){_0x2eeax2[_0x7be1[8]](_0x7be1[9],_0x2eeax3)}function onUpdate(_0x2eeax2,_0x2eeax3,_0x2eeax5){_0x2eeax2[_0x7be1[8]](_0x7be1[10],_0x2eeax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceExtension = require('../../models').VoiceExtension; + +exports.register = function(socket) { + VoiceExtension.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceExtension.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + // VoiceExtension.afterBulkDestroy(function(doc) {//causes a maximum stack range error due to the object sent being too big!! + // onRemove(socket, doc); + // }); + VoiceExtension.afterUpdate(function(doc) { + onUpdate(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_extension:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_extension:remove', doc); +} + +function onUpdate(socket, doc, cb) { + socket.emit('voice_extension:update', doc); +} diff --git a/server/api/voice_extension/voice_extension.spec.js b/server/api/voice_extension/voice_extension.spec.js index 7c8525a..0971536 100644 --- a/server/api/voice_extension/voice_extension.spec.js +++ b/server/api/voice_extension/voice_extension.spec.js @@ -1 +1,20 @@ -var _0x94ce=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x67\x65\x74"];_0x94ce[0];var should=require(_0x94ce[1]);var app=require(_0x94ce[2]);var request=require(_0x94ce[3]);describe(_0x94ce[4],function(){it(_0x94ce[5],function(_0x4d89x4){request(app)[_0x94ce[13]](_0x94ce[12])[_0x94ce[11]](200)[_0x94ce[11]](_0x94ce[10],/json/)[_0x94ce[9]](function(_0x4d89x5,_0x4d89x6){if(_0x4d89x5){return _0x4d89x4(_0x4d89x5)};_0x4d89x6[_0x94ce[8]][_0x94ce[1]][_0x94ce[7]][_0x94ce[6]](Array);_0x4d89x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/voice/extensions', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/voice/extensions') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/voice_musiconhold/index.js b/server/api/voice_musiconhold/index.js index 1b235ec..59cc818 100644 --- a/server/api/voice_musiconhold/index.js +++ b/server/api/voice_musiconhold/index.js @@ -1 +1,21 @@ -var _0x6c5a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x73\x74\x72\x65\x61\x6D","\x73\x74\x72\x65\x61\x6D","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x66\x69\x6C\x65\x73","\x73\x68\x6F\x77\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x6D\x6F\x68\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x6C\x65\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x65\x78\x70\x6F\x72\x74\x73"];_0x6c5a[0];var express=require(_0x6c5a[1]);var controller=require(_0x6c5a[2]);var auth=require(_0x6c5a[3]);var router=express.Router();router[_0x6c5a[7]](_0x6c5a[4],auth[_0x6c5a[5]](),controller[_0x6c5a[6]]);router[_0x6c5a[7]](_0x6c5a[8],auth[_0x6c5a[5]](),controller[_0x6c5a[9]]);router[_0x6c5a[7]](_0x6c5a[10],auth[_0x6c5a[5]](),controller[_0x6c5a[11]]);router[_0x6c5a[7]](_0x6c5a[12],auth[_0x6c5a[5]](),controller[_0x6c5a[13]]);router[_0x6c5a[15]](_0x6c5a[4],auth[_0x6c5a[5]](),controller[_0x6c5a[14]]);router[_0x6c5a[15]](_0x6c5a[16],auth[_0x6c5a[5]](),controller[_0x6c5a[17]]);router[_0x6c5a[15]](_0x6c5a[12],auth[_0x6c5a[5]](),controller[_0x6c5a[18]]);router[_0x6c5a[20]](_0x6c5a[10],auth[_0x6c5a[5]](),controller[_0x6c5a[19]]);router[_0x6c5a[22]](_0x6c5a[4],auth[_0x6c5a[5]](),controller[_0x6c5a[21]]);router[_0x6c5a[22]](_0x6c5a[10],auth[_0x6c5a[5]](),controller[_0x6c5a[23]]);router[_0x6c5a[22]](_0x6c5a[12],auth[_0x6c5a[5]](),controller[_0x6c5a[24]]);module[_0x6c5a[25]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_musiconhold.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/stream', auth.isAuthenticated(), controller.stream); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/files', auth.isAuthenticated(), controller.showAudioFiles); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.mohValidation); +router.post('/:id/files', auth.isAuthenticated(), controller.addFiles); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/files', auth.isAuthenticated(), controller.deleteAudioFiles); + +module.exports = router; diff --git a/server/api/voice_musiconhold/voice_musiconhold.controller.js b/server/api/voice_musiconhold/voice_musiconhold.controller.js index 8cf6316..6c74d50 100644 --- a/server/api/voice_musiconhold/voice_musiconhold.controller.js +++ b/server/api/voice_musiconhold/voice_musiconhold.controller.js @@ -1 +1,283 @@ -var _0x6886=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x75\x74\x69\x6C","\x66\x73\x2D\x65\x78\x74\x72\x61","\x72\x65\x6D\x6F\x76\x65","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x53\x6F\x75\x6E\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x46\x69\x6C\x65\x73","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x73\x6F\x75\x6E\x64\x73\x2F\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x6A\x6F\x69\x6E","\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x64\x69\x73\x70\x6C\x61\x79\x5F\x6E\x61\x6D\x65","\x2E\x77\x61\x76","\x73\x61\x76\x65\x5F\x6E\x61\x6D\x65","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x66\x6F\x72\x45\x61\x63\x68","\x30\x37\x37\x37","\x63\x68\x6D\x6F\x64\x53\x79\x6E\x63","\x73\x6F\x75\x6E\x64\x73","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x66\x69\x6C\x65\x73","\x72\x65\x61\x64\x64\x69\x72","\x64\x65\x6C\x65\x74\x65\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x2F","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x75\x6E\x6C\x69\x6E\x6B","\x6D\x6F\x68\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x6C\x6F\x67","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x6D\x6F\x68","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x66\x69\x6C\x65\x20\x65\x72\x72\x6F\x72","\x4D\x45\x53\x53\x41\x47\x45\x5F\x46\x49\x4C\x45\x5F\x43\x52\x45\x41\x54\x49\x4F\x4E\x5F\x45\x52\x52\x4F\x52","\x63\x6F\x6D\x6D\x69\x74","\x66\x69\x6C\x65\x20\x63\x72\x65\x61\x74\x65\x64","\x6D\x6B\x64\x69\x72","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x65\x72\x72","\x65\x72\x72\x6F\x72","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x61\x6C\x6C","\x70\x75\x73\x68","\x69\x64\x73","\x73\x74\x72\x65\x61\x6D","\x65\x6E\x63\x6F\x64\x65"];_0x6886[0];var fs=require(_0x6886[1]);var _=require(_0x6886[2]);var path=require(_0x6886[3]);var util=require(_0x6886[4]);var fse=require(_0x6886[5]);var remove=require(_0x6886[6]);var base64=require(_0x6886[7]);var config=require(_0x6886[8]);var Util=require(_0x6886[9]);var Sound=require(_0x6886[11])[_0x6886[10]];var sequelize=require(_0x6886[11])[_0x6886[12]];var VoiceMusicOnHold=require(_0x6886[11])[_0x6886[13]];exports[_0x6886[14]]=function(_0xae84xd,_0xae84xe){return VoiceMusicOnHold[_0x6886[21]](Util[_0x6886[20]](_0xae84xd[_0x6886[19]]))[_0x6886[18]](function(_0xae84x10){_0xae84xe[_0x6886[17]](200)[_0x6886[16]](_0xae84x10)})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[22]]=function(_0xae84xd,_0xae84xe){return VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};return _0xae84xe[_0x6886[16]](_0xae84x11)})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[27]]=function(_0xae84xd,_0xae84xe){var _0xae84x12;return VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};_0xae84x12=_0xae84x11;return Sound[_0x6886[41]]({where:{id:_0xae84xd[_0x6886[40]][_0x6886[39]]}})})[_0x6886[18]](function(_0xae84x13){var _0xae84x14=path[_0x6886[30]](config[_0x6886[28]],_0x6886[29]);var _0xae84x15;_0xae84x13[_0x6886[36]](function(_0xae84x16){_0xae84x15=path[_0x6886[30]](_0xae84x12[_0x6886[31]],_0xae84x16[_0x6886[32]]+_0x6886[33]);fse[_0x6886[35]](path[_0x6886[30]](_0xae84x14,_0xae84x16[_0x6886[34]]+_0x6886[33]),_0xae84x15)});fs[_0x6886[38]](_0xae84x15,parseInt(_0x6886[37],8));_0xae84xe[_0x6886[23]](200)})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[42]]=function(_0xae84xd,_0xae84xe){var _0xae84x17={};VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};_0xae84x17[_0x6886[3]]=_0xae84x11[_0x6886[31]];fs[_0x6886[44]](_0xae84x11[_0x6886[31]],function(_0xae84xf,_0xae84x18){if(!_0xae84xf){_0xae84x17[_0x6886[43]]=_0xae84x18;return _0xae84xe[_0x6886[16]](_0xae84x17)}else {throw _0xae84xf}})})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[45]]=function(_0xae84xd,_0xae84xe){VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};var _0xae84x19=_0xae84x11[_0x6886[31]]+_0x6886[46]+_0xae84xd[_0x6886[19]][_0x6886[47]];fs[_0x6886[48]](_0xae84x19,function(_0xae84xf){if(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)}else {return _0xae84xe[_0x6886[23]](204)}})})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[49]]=function(_0xae84xd,_0xae84xe){console[_0x6886[50]](_0xae84xd[_0x6886[40]]);VoiceMusicOnHold[_0x6886[41]]({where:{name:_0xae84xd[_0x6886[40]][_0x6886[51]]}})[_0x6886[18]](function(_0xae84x1a){if(!_0xae84x1a){return _0xae84xe[_0x6886[23]](404)};return _0xae84xe[_0x6886[16]](_0xae84x1a)})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[52]]=function(_0xae84xd,_0xae84xe){return sequelize[_0x6886[60]]()[_0x6886[18]](function(_0xae84x1b){_0xae84xd[_0x6886[40]][_0x6886[31]]=path[_0x6886[30]](config[_0x6886[28]],_0x6886[53],_0xae84xd[_0x6886[40]][_0x6886[51]]);return VoiceMusicOnHold[_0x6886[52]](_0xae84xd[_0x6886[40]],{transaction:_0xae84x1b})[_0x6886[18]](function(_0xae84x11){fs[_0x6886[59]](_0xae84x11[_0x6886[31]],parseInt(_0x6886[37],8),function(_0xae84xf){if(_0xae84xf){console[_0x6886[50]](_0x6886[55]);_0xae84x1b[_0x6886[54]]();return _0xae84xe[_0x6886[17]](500)[_0x6886[16]]({message:_0x6886[56]})};_0xae84x1b[_0x6886[57]]();console[_0x6886[50]](_0x6886[58]);return _0xae84xe[_0x6886[17]](201)[_0x6886[16]](_0xae84x11)})})[_0x6886[15]](function(_0xae84xf){_0xae84x1b[_0x6886[54]]()})})};exports[_0x6886[61]]=function(_0xae84xd,_0xae84xe){if(_0xae84xd[_0x6886[40]][_0x6886[24]]){delete _0xae84xd[_0x6886[40]][_0x6886[24]]};return VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};var _0xae84x1c=_[_0x6886[64]](_0xae84x11,_0xae84xd[_0x6886[40]]);return _0xae84x1c[_0x6886[65]]()})[_0x6886[18]](function(_0xae84x11){return _0xae84xe[_0x6886[17]](200)[_0x6886[16]](_0xae84x11)})[_0x6886[15]](function(_0xae84xf){console[_0x6886[63]](_0x6886[62],_0xae84xf);return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[66]]=function(_0xae84xd,_0xae84xe){var _0xae84x1d;return sequelize[_0x6886[60]](function(_0xae84x1b){return VoiceMusicOnHold[_0x6886[26]](_0xae84xd[_0x6886[25]][_0x6886[24]])[_0x6886[18]](function(_0xae84x11){if(!_0xae84x11){return _0xae84xe[_0x6886[23]](404)};_0xae84x1d=_0xae84x11;return _0xae84x11[_0x6886[66]]({transaction:_0xae84x1b})})[_0x6886[18]](function(){remove(_0xae84x1d[_0x6886[31]],function(_0xae84xf){if(_0xae84xf){console[_0x6886[50]](_0xae84xf)};return _0xae84xe[_0x6886[23]](204)})})})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[67]]=function(_0xae84xd,_0xae84xe){var _0xae84x1e;return sequelize[_0x6886[60]](function(_0xae84x1b){return VoiceMusicOnHold[_0x6886[41]]({where:{id:_0xae84xd[_0x6886[19]][_0x6886[70]]}})[_0x6886[18]](function(_0xae84x20){if(!_0xae84x20){return _0xae84xe[_0x6886[23]](404)};_0xae84x1e=_0xae84x20;var _0xae84x21=[];_0xae84x20[_0x6886[36]](function(_0xae84x1f){_0xae84x21[_0x6886[69]](_0xae84x1f[_0x6886[66]]({transaction:_0xae84x1b}))});return _0xae84x21})[_0x6886[68]]()[_0x6886[18]](function(){_0xae84x1e[_0x6886[36]](function(_0xae84x1f){remove(_0xae84x1f[_0x6886[31]],function(_0xae84xf){if(_0xae84xf){console[_0x6886[50]](_0xae84xf);throw _0xae84xf}})})})})[_0x6886[18]](function(){return _0xae84xe[_0x6886[23]](204)})[_0x6886[15]](function(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)})};exports[_0x6886[71]]=function(_0xae84xd,_0xae84xe){var _0xae84x22=decodeURI(_0xae84xd[_0x6886[19]][_0x6886[3]]);base64[_0x6886[72]](_0xae84x22,function(_0xae84xf,_0xae84x23){if(_0xae84xf){return handleError(_0xae84xe,_0xae84xf)}else {return _0xae84xe[_0x6886[17]](200)[_0x6886[16]](_0xae84x23)}})};function handleError(_0xae84xe,_0xae84xf){return _0xae84xe[_0x6886[17]](500)[_0x6886[16]](_0xae84xf)} \ No newline at end of file +'use strict'; + +var fs = require('fs'); +var _ = require('lodash'); +var path = require('path'); +var util = require('util'); +var fse = require('fs-extra'); +var remove = require('remove'); +var base64 = require('file-base64'); + +var config = require('../../config/environment'); +var Util = require('../../config/util'); + +var Sound = require('../../models').Sound; +var sequelize = require('../../models').sequelize; +var VoiceMusicOnHold = require('../../models').VoiceMusicOnHold; + + +// Get list of voice_musiconholds +exports.index = function(req, res) { + return VoiceMusicOnHold + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single voiceMusiconhold +exports.show = function(req, res) { + return VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + return res.send(voiceMusiconhold); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Add files to moh class +exports.addFiles = function(req, res) { + var _voiceMusiconhold; + return VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + _voiceMusiconhold = voiceMusiconhold; + + return Sound + .findAll({ + where: { + id: req.body.sounds + } + }); + }) + .then(function(soundFiles) { + var origin = path.join(config.root, 'server/files/sounds/converted'); + var dest; + soundFiles.forEach(function(elem) { + dest = path.join(_voiceMusiconhold.directory, elem.display_name + '.wav'); + fse.copySync(path.join(origin, elem.save_name + '.wav'), dest); + }); + fs.chmodSync(dest, parseInt('0777', 8)); + res.sendStatus(200); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.showAudioFiles = function(req, res) { + var fileObject = {}; + VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + fileObject.path = voiceMusiconhold.directory; + fs.readdir(voiceMusiconhold.directory, function(err, files) { + if (!err) { + fileObject.files = files; + return res.send(fileObject); + } else { + throw err; + } + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.deleteAudioFiles = function(req, res) { + VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + var deletePath = voiceMusiconhold.directory + '/' + req.query.filename; + fs.unlink(deletePath, function(err) { + if (err) { + return handleError(res, err); + } else { + return res.sendStatus(204); + } + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Validate the existence of a route +exports.mohValidation = function(req, res) { + console.log(req.body); + VoiceMusicOnHold + .findAll({ + where: { + name: req.body.name, + } + }) + .then(function(voice_mohs) { + if (!voice_mohs) { + return res.sendStatus(404); + } + return res.send(voice_mohs); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new voiceMusiconhold in the DB. +exports.create = function(req, res) { + return sequelize.transaction().then(function(t) { + req.body.directory = path.join(config.root, 'server/files/moh', req.body.name); + return VoiceMusicOnHold + .create(req.body, { + transaction: t + }) + .then(function(voiceMusiconhold) { + fs.mkdir(voiceMusiconhold.directory, parseInt('0777', 8), function(err) { + if (err) { + console.log('file error'); + t.rollback(); + return res.status(500).send({ + message: 'MESSAGE_FILE_CREATION_ERROR' + }); + } + t.commit(); + console.log('file created'); + return res.status(201).send(voiceMusiconhold); + }); + }) + .catch(function(err) { + t.rollback(); + }); + }) +}; + +// Updates an existing voiceMusiconhold in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + + return VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + var updated = _.merge(voiceMusiconhold, req.body); + + return updated + .save(); + }) + .then(function(voiceMusiconhold) { + return res.status(200).send(voiceMusiconhold); + }) + .catch(function(err) { + console.error('err', err); + return handleError(res, err); + }); +}; + +// Deletes a voiceMusiconhold from the DB. +exports.destroy = function(req, res) { + var _voicemoh; + return sequelize.transaction(function(t) { + return VoiceMusicOnHold + .findById(req.params.id) + .then(function(voiceMusiconhold) { + if (!voiceMusiconhold) { + return res.sendStatus(404); + } + _voicemoh = voiceMusiconhold; + return voiceMusiconhold.destroy({ + transaction: t + }); + }) + .then(function() { + remove(_voicemoh.directory, function(err) { + if (err) { + console.log(err); + } + return res.sendStatus(204); + }); + }) + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes multiple voice_musiconholds from the DB. +exports.bulkDestroy = function(req, res) { + var _voicemohs; + return sequelize.transaction(function(t) { + return VoiceMusicOnHold + .findAll({ + where: { + id: req.query.ids + } + }) + .then(function(voice_musiconholds) { + if (!voice_musiconholds) { + return res.sendStatus(404); + } + _voicemohs = voice_musiconholds; + var bulkDest = []; + voice_musiconholds.forEach(function(element) { + bulkDest.push(element.destroy({ + transaction: t + })); + }); + return bulkDest; + }) + .all() + .then(function() { + _voicemohs.forEach(function(element) { + remove(element.directory, function(err) { + if (err) { + console.log(err); + throw err + } + }); + }) + }); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// stream a moh file +exports.stream = function(req, res) { + var filepath = decodeURI(req.query.path); + base64.encode(filepath, function(err, base64String) { + if (err) { + return handleError(res, err); + } else { + return res.status(200).send(base64String); + } + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_musiconhold/voice_musiconhold.socket.js b/server/api/voice_musiconhold/voice_musiconhold.socket.js index 677278f..efa073f 100644 --- a/server/api/voice_musiconhold/voice_musiconhold.socket.js +++ b/server/api/voice_musiconhold/voice_musiconhold.socket.js @@ -1 +1,24 @@ -var _0xc0da=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0xc0da[0];var VoiceMusicOnHold=require(_0xc0da[2])[_0xc0da[1]];exports[_0xc0da[3]]=function(_0x3ae8x2){VoiceMusicOnHold[_0xc0da[4]](function(_0x3ae8x3){onSave(_0x3ae8x2,_0x3ae8x3)});VoiceMusicOnHold[_0xc0da[5]](function(_0x3ae8x3){onRemove(_0x3ae8x2,_0x3ae8x3)})};function onSave(_0x3ae8x2,_0x3ae8x3,_0x3ae8x5){_0x3ae8x2[_0xc0da[7]](_0xc0da[6],_0x3ae8x3)}function onRemove(_0x3ae8x2,_0x3ae8x3,_0x3ae8x5){_0x3ae8x2[_0xc0da[7]](_0xc0da[8],_0x3ae8x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceMusicOnHold = require('../../models').VoiceMusicOnHold; + +exports.register = function(socket) { + VoiceMusicOnHold.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceMusicOnHold.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_musiconhold:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_musiconhold:remove', doc); +} diff --git a/server/api/voice_musiconhold/voice_musiconhold.spec.js b/server/api/voice_musiconhold/voice_musiconhold.spec.js index 789ca27..e992daf 100644 --- a/server/api/voice_musiconhold/voice_musiconhold.spec.js +++ b/server/api/voice_musiconhold/voice_musiconhold.spec.js @@ -1 +1,20 @@ -var _0x7f20=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64","\x67\x65\x74"];_0x7f20[0];var should=require(_0x7f20[1]);var app=require(_0x7f20[2]);var request=require(_0x7f20[3]);describe(_0x7f20[4],function(){it(_0x7f20[5],function(_0x69ebx4){request(app)[_0x7f20[13]](_0x7f20[12])[_0x7f20[11]](200)[_0x7f20[11]](_0x7f20[10],/json/)[_0x7f20[9]](function(_0x69ebx5,_0x69ebx6){if(_0x69ebx5){return _0x69ebx4(_0x69ebx5)};_0x69ebx6[_0x7f20[8]][_0x7f20[1]][_0x7f20[7]][_0x7f20[6]](Array);_0x69ebx4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/voice/musiconhold', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/voice/musiconhold') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/voice_queue/index.js b/server/api/voice_queue/index.js index 287c56e..f864580 100644 --- a/server/api/voice_queue/index.js +++ b/server/api/voice_queue/index.js @@ -1 +1,19 @@ -var _0xb978=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x6E\x61\x6D\x65","\x73\x68\x6F\x77","\x2F\x3A\x6E\x61\x6D\x65\x2F\x61\x67\x65\x6E\x74\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xb978[0];var express=require(_0xb978[1]);var controller=require(_0xb978[2]);var auth=require(_0xb978[3]);var router=express.Router();router[_0xb978[7]](_0xb978[4],auth[_0xb978[5]](),controller[_0xb978[6]]);router[_0xb978[7]](_0xb978[8],auth[_0xb978[5]](),controller[_0xb978[9]]);router[_0xb978[7]](_0xb978[10],auth[_0xb978[5]](),controller[_0xb978[11]]);router[_0xb978[13]](_0xb978[4],auth[_0xb978[5]](),controller[_0xb978[12]]);router[_0xb978[13]](_0xb978[10],auth[_0xb978[5]](),controller[_0xb978[14]]);router[_0xb978[16]](_0xb978[8],auth[_0xb978[5]](),controller[_0xb978[15]]);router[_0xb978[18]](_0xb978[10],auth[_0xb978[5]](),controller[_0xb978[17]]);router[_0xb978[18]](_0xb978[4],auth[_0xb978[5]](),controller[_0xb978[19]]);router[_0xb978[18]](_0xb978[8],auth[_0xb978[5]](),controller[_0xb978[20]]);module[_0xb978[21]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_queue.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:name', auth.isAuthenticated(), controller.show); +router.get('/:name/agents', auth.isAuthenticated(), controller.showAgents); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:name/agents', auth.isAuthenticated(), controller.addAgents); +router.put('/:name', auth.isAuthenticated(), controller.update); +router.delete('/:name/agents', auth.isAuthenticated(), controller.removeAgents); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:name', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/voice_queue/voice_queue.controller.js b/server/api/voice_queue/voice_queue.controller.js index 0142d77..4143afc 100644 --- a/server/api/voice_queue/voice_queue.controller.js +++ b/server/api/voice_queue/voice_queue.controller.js @@ -1 +1,211 @@ -var _0xdea3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6E\x61\x6D\x65","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x61\x67\x65\x6E\x74","\x69\x64","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x70\x75\x73\x68","\x50\x52\x49\x4D\x41\x52\x59","\x70\x61\x74\x68","\x66\x6F\x72\x45\x61\x63\x68","\x65\x72\x72\x6F\x72\x73","\x20\x6D\x75\x73\x74\x20\x62\x65\x20\x75\x6E\x69\x71\x75\x65","\x6D\x65\x73\x73\x61\x67\x65","\x6A\x6F\x69\x6E","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x51\x55\x45\x55\x45","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x53\x49\x50\x2F\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x70\x65\x6E\x61\x6C\x74\x79","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xdea3[0];var _=require(_0xdea3[1]);var util=require(_0xdea3[2]);var Util=require(_0xdea3[3]);var sequelize=require(_0xdea3[5])[_0xdea3[4]];var User=require(_0xdea3[5])[_0xdea3[6]];var VoiceQueue=require(_0xdea3[5])[_0xdea3[7]];var UserHasVoiceQueue=require(_0xdea3[5])[_0xdea3[8]];var VoiceExtension=require(_0xdea3[5])[_0xdea3[9]];exports[_0xdea3[10]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[17]](Util[_0xdea3[16]](_0x8b52x9[_0xdea3[15]]))[_0xdea3[14]](function(_0x8b52xc){_0x8b52xa[_0xdea3[13]](200)[_0xdea3[12]](_0x8b52xc)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[18]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[22]](_0x8b52x9[_0xdea3[21]][_0xdea3[20]])[_0xdea3[14]](function(_0x8b52xd){if(!_0x8b52xd){return _0x8b52xa[_0xdea3[19]](404)};return _0x8b52xa[_0xdea3[12]](_0x8b52xd)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[23]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[22]](_0x8b52x9[_0xdea3[21]][_0xdea3[20]])[_0xdea3[14]](function(_0x8b52xf){if(!_0x8b52xf){return _0x8b52xa[_0xdea3[19]](404)};return _0x8b52xf[_0xdea3[28]]({where:{role:_0xdea3[24]},attributes:[_0xdea3[25],_0xdea3[20],_0xdea3[26],_0xdea3[27]]})})[_0xdea3[14]](function(_0x8b52xe){return _0x8b52xa[_0xdea3[13]](200)[_0xdea3[12]](_0x8b52xe)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[29]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[29]](_0x8b52x9[_0xdea3[40]])[_0xdea3[14]](function(_0x8b52xd){return _0x8b52xa[_0xdea3[13]](201)[_0xdea3[12]](_0x8b52xd)})[_0xdea3[11]](sequelize.UniqueConstraintError,function(_0x8b52xb){var _0x8b52x10=[];_0x8b52xb[_0xdea3[34]][_0xdea3[33]](function(_0x8b52x11){switch(_0x8b52x11[_0xdea3[32]]){case _0xdea3[31]:_0x8b52x10[_0xdea3[30]](_0xdea3[20]);break;default:_0x8b52x10[_0xdea3[30]](_0x8b52x11[_0xdea3[32]])}});_0x8b52x10[_0xdea3[30]](_0xdea3[35]);_0x8b52xb[_0xdea3[36]]=_0x8b52x10[_0xdea3[37]]();_0x8b52xb[_0xdea3[38]]=_0xdea3[39];return _0x8b52xa[_0xdea3[13]](500)[_0xdea3[12]](_0x8b52xb)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[41]]=function(_0x8b52x9,_0x8b52xa){if(_0x8b52x9[_0xdea3[40]][_0xdea3[20]]){delete _0x8b52x9[_0xdea3[40]][_0xdea3[20]]};return VoiceQueue[_0xdea3[22]](_0x8b52x9[_0xdea3[21]][_0xdea3[20]])[_0xdea3[14]](function(_0x8b52xd){if(!_0x8b52xd){return _0x8b52xa[_0xdea3[19]](404)};var _0x8b52x12=_[_0xdea3[43]](_0x8b52xd,_0x8b52x9[_0xdea3[40]]);return _0x8b52x12[_0xdea3[44]]()})[_0xdea3[14]](function(_0x8b52xd){return _0x8b52xa[_0xdea3[13]](200)[_0xdea3[12]](_0x8b52xd)})[_0xdea3[11]](function(_0x8b52xb){console[_0xdea3[42]](_0x8b52xb);return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[45]]=function(_0x8b52x9,_0x8b52xa,_0x8b52x13){return User[_0xdea3[52]]({where:{id:{$in:_0x8b52x9[_0xdea3[40]][_0xdea3[51]]}}})[_0xdea3[14]](function(_0x8b52x14){var _0x8b52x15=_[_0xdea3[49]](_0x8b52x14,function(_0x8b52x16){return {queue:_0x8b52x9[_0xdea3[21]][_0xdea3[20]],location:util[_0xdea3[47]](_0xdea3[46],_0x8b52x16[_0xdea3[20]]),membername:_0x8b52x16[_0xdea3[20]],UserId:_0x8b52x16[_0xdea3[25]],penalty:_0x8b52x9[_0xdea3[40]][_0xdea3[48]]}});return UserHasVoiceQueue[_0xdea3[50]](_0x8b52x15,{individualHooks:true})})[_0xdea3[14]](function(){return _0x8b52xa[_0xdea3[19]](200)})[_0xdea3[11]](function(_0x8b52xb){console[_0xdea3[42]](_0x8b52xb);return _0x8b52x13(_0x8b52xb)})};exports[_0xdea3[53]]=function(_0x8b52x9,_0x8b52xa,_0x8b52x13){return UserHasVoiceQueue[_0xdea3[54]]({where:{UserId:_0x8b52x9[_0xdea3[15]][_0xdea3[51]],queue:_0x8b52x9[_0xdea3[21]][_0xdea3[20]]},individualHooks:true})[_0xdea3[14]](function(){return _0x8b52xa[_0xdea3[19]](202)})[_0xdea3[11]](function(_0x8b52xb){return _0x8b52x13(_0x8b52xb)})};exports[_0xdea3[54]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[54]]({where:{name:_0x8b52x9[_0xdea3[21]][_0xdea3[20]]},individualHooks:true})[_0xdea3[14]](function(){return _0x8b52xa[_0xdea3[19]](204)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};exports[_0xdea3[55]]=function(_0x8b52x9,_0x8b52xa){return VoiceQueue[_0xdea3[54]]({where:{name:_0x8b52x9[_0xdea3[15]][_0xdea3[56]]},individualHooks:true})[_0xdea3[14]](function(){return _0x8b52xa[_0xdea3[19]](204)})[_0xdea3[11]](function(_0x8b52xb){return handleError(_0x8b52xa,_0x8b52xb)})};function handleError(_0x8b52xa,_0x8b52xb){return _0x8b52xa[_0xdea3[13]](500)[_0xdea3[12]](_0x8b52xb)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); + +var util = require('util'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var User = require('../../models').User; +var VoiceQueue = require('../../models').VoiceQueue; +var UserHasVoiceQueue = require('../../models').UserHasVoiceQueue; +var VoiceExtension = require('../../models').VoiceExtension; + +// Get list of voiceQueues +exports.index = function(req, res) { + return VoiceQueue + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single voiceQueue +exports.show = function(req, res) { + return VoiceQueue + .findById(req.params.name) + .then(function(voiceQueue) { + if (!voiceQueue) { + return res.sendStatus(404); + } + return res.send(voiceQueue); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single queue +exports.showAgents = function(req, res) { + return VoiceQueue + .findById(req.params.name) + .then(function(queue) { + if (!queue) { + return res.sendStatus(404); + } + return queue + .getUsers({ + where: { + role: 'agent' + }, + attributes: ['id', 'name', 'fullname', 'email'] + }); + }) + .then(function(agents) { + return res.status(200).send(agents); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new voiceQueue in the DB. +exports.create = function(req, res) { + return VoiceQueue + .create(req.body) + .then(function(voiceQueue) { + return res.status(201).send(voiceQueue); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + var paths = []; + + err.errors.forEach(function(error) { + switch (error.path) { + case 'PRIMARY': + paths.push('name'); + break; + default: + paths.push(error.path); + } + }); + + paths.push(' must be unique'); + err.message = paths.join(); + err.translatedMessage = 'MESSAGE_EXIST_QUEUE'; + + return res.status(500).send(err); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing voiceQueue in the DB. +exports.update = function(req, res) { + if (req.body.name) { + delete req.body.name; + } + + return VoiceQueue + .findById(req.params.name) + .then(function(voiceQueue) { + if (!voiceQueue) { + return res.sendStatus(404); + } + var updated = _.merge(voiceQueue, req.body); + return updated + .save(); + }) + .then(function(voiceQueue) { + return res.status(200).send(voiceQueue); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + + +// Add agents to voice queues +exports.addAgents = function(req, res, next) { + return User + .findAll({ + where: { + id: { + $in: req.body.agents + } + } + }) + .then(function(users) { + var userHasVoiceQueues = _.map(users, function(user) { + return { + queue: req.params.name, + location: util.format('SIP/%s', user.name), + membername: user.name, + UserId: user.id, + penalty: req.body.penalty + }; + }); + + return UserHasVoiceQueue + .bulkCreate(userHasVoiceQueues, { + individualHooks: true + }); + }) + .then(function() { + return res.sendStatus(200); + }) + .catch(function(err) { + console.log(err); + return next(err); + }); +}; + +exports.removeAgents = function(req, res, next) { + return UserHasVoiceQueue + .destroy({ + where: { + UserId: req.query.agents, + queue: req.params.name + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(202); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Deletes a voiceQueue from the DB. +exports.destroy = function(req, res) { + return VoiceQueue + .destroy({ + where: { + name: req.params.name + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes multiple voiceQueues from the DB. +exports.bulkDestroy = function(req, res) { + return VoiceQueue + .destroy({ + where: { + name: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_queue/voice_queue.socket.js b/server/api/voice_queue/voice_queue.socket.js index a3d4239..6cb2204 100644 --- a/server/api/voice_queue/voice_queue.socket.js +++ b/server/api/voice_queue/voice_queue.socket.js @@ -1 +1,24 @@ -var _0x290e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65"];_0x290e[0];var VoiceQueue=require(_0x290e[2])[_0x290e[1]];exports[_0x290e[3]]=function(_0x7926x2){VoiceQueue[_0x290e[4]](function(_0x7926x3){onSave(_0x7926x2,_0x7926x3)});VoiceQueue[_0x290e[5]](function(_0x7926x3){onRemove(_0x7926x2,_0x7926x3)})};function onSave(_0x7926x2,_0x7926x3,_0x7926x5){_0x7926x2[_0x290e[7]](_0x290e[6],_0x7926x3)}function onRemove(_0x7926x2,_0x7926x3,_0x7926x5){_0x7926x2[_0x290e[7]](_0x290e[8],_0x7926x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceQueue = require('../../models').VoiceQueue; + +exports.register = function(socket) { + VoiceQueue.afterCreate(function (doc) { + onSave(socket, doc); + }); + VoiceQueue.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_queue:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_queue:remove', doc); +} diff --git a/server/api/voice_recording/index.js b/server/api/voice_recording/index.js index 95dd7cb..61bbb0d 100644 --- a/server/api/voice_recording/index.js +++ b/server/api/voice_recording/index.js @@ -1 +1,18 @@ -var _0x8071=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x73\x74\x72\x65\x61\x6D","\x67\x65\x74\x53\x74\x72\x65\x61\x6D","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x8071[0];var express=require(_0x8071[1]);var auth=require(_0x8071[2]);var controller=require(_0x8071[3]);var router=express.Router();router[_0x8071[7]](_0x8071[4],auth[_0x8071[5]](),controller[_0x8071[6]]);router[_0x8071[7]](_0x8071[8],auth[_0x8071[5]](),controller[_0x8071[9]]);router[_0x8071[7]](_0x8071[10],auth[_0x8071[5]](),controller[_0x8071[11]]);router[_0x8071[13]](_0x8071[4],auth[_0x8071[5]](),controller[_0x8071[12]]);router[_0x8071[15]](_0x8071[8],auth[_0x8071[5]](),controller[_0x8071[14]]);router[_0x8071[16]](_0x8071[8],auth[_0x8071[5]](),controller[_0x8071[14]]);router[_0x8071[18]](_0x8071[4],auth[_0x8071[5]](),controller[_0x8071[17]]);router[_0x8071[18]](_0x8071[8],auth[_0x8071[5]](),controller[_0x8071[19]]);module[_0x8071[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./voice_recording.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/stream', auth.isAuthenticated(), controller.getStream); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/voice_recording/voice_recording.controller.js b/server/api/voice_recording/voice_recording.controller.js index fd2e787..0c800bc 100644 --- a/server/api/voice_recording/voice_recording.controller.js +++ b/server/api/voice_recording/voice_recording.controller.js @@ -1 +1,172 @@ -var _0xaa2d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x62\x6C\x75\x65\x62\x69\x72\x64","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x66\x73","\x63\x61\x75\x73\x65","\x63\x6F\x64\x65","\x45\x4E\x4F\x45\x4E\x54","\x4E\x6F\x20\x66\x69\x6C\x65\x20\x6F\x72\x20\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x4E\x4F\x5F\x46\x49\x4C\x45\x5F\x4F\x52\x5F\x44\x49\x52\x45\x43\x54\x4F\x52\x59","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x74\x68\x65\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x77\x68\x65\x72\x65","\x6C\x69\x6D\x69\x74","\x6F\x66\x66\x73\x65\x74","\x6F\x72\x64\x65\x72","\x25","\x66\x6F\x72\x45\x61\x63\x68","\x69\x6E\x64\x65\x78","\x71\x75\x65\x72\x79","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x53\x74\x72\x65\x61\x6D","\x62\x61\x73\x65\x36\x34","\x62\x69\x6E\x61\x72\x79","\x72\x65\x61\x64\x46\x69\x6C\x65","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x76\x61\x6C\x75\x65","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64\x73"];_0xaa2d[0];var _=require(_0xaa2d[1]);var util=require(_0xaa2d[2]);var VoiceRecording=require(_0xaa2d[4])[_0xaa2d[3]];var Promise=require(_0xaa2d[5]);var base64=require(_0xaa2d[6]);var fs=require(_0xaa2d[7]);function handleError(_0xb946x8){return function(_0xb946x9){if(_0xb946x9[_0xaa2d[8]]&&_0xb946x9[_0xaa2d[8]][_0xaa2d[9]]===_0xaa2d[10]){_0xb946x9={message:_0xaa2d[11],translatedMessage:_0xaa2d[12]}};return _0xb946x8[_0xaa2d[14]](500)[_0xaa2d[13]](_0xb946x9)}}function responseWithResult(_0xb946x8,_0xb946xb){_0xb946xb=_0xb946xb||200;return function(_0xb946xc){if(_0xb946xc){_0xb946x8[_0xaa2d[14]](_0xb946xb)[_0xaa2d[15]](_0xb946xc)}}}function handleEntityNotFound(_0xb946x8){return function(_0xb946xc){if(!_0xb946xc){_0xb946x8[_0xaa2d[14]](404)[_0xaa2d[16]]();return null};return _0xb946xc}}function saveUpdates(_0xb946xf){return function(_0xb946xc){return _0xb946xc[_0xaa2d[17]](_0xb946xf)}}function removeEntity(_0xb946x8){return function(_0xb946xc){if(_0xb946xc){return _0xb946xc[_0xaa2d[19]]()[_0xaa2d[18]](function(){_0xb946x8[_0xaa2d[14]](204)[_0xaa2d[16]]()})}}}function getQuery(_0xb946x12){var _0xb946x13={};_0xb946x13[_0xaa2d[20]]={};_[_0xaa2d[25]](_0xb946x12,function(_0xb946x14,_0xb946x15){switch(_0xb946x15){case _0xaa2d[21]:;case _0xaa2d[22]:_0xb946x13[_0xb946x15]=Number(_0xb946x14);break;case _0xaa2d[23]:_0xb946x13[_0xb946x15]=_0xb946x14;break;default:_0xb946x13[_0xaa2d[20]][_0xb946x15]={$like:_0xaa2d[24]+_0xb946x14+_0xaa2d[24]}}});return _0xb946x13}exports[_0xaa2d[26]]=function(_0xb946x16,_0xb946x8){var _0xb946x13=getQuery(_0xb946x16[_0xaa2d[27]]);return VoiceRecording[_0xaa2d[29]](_0xb946x13)[_0xaa2d[18]](responseWithResult(_0xb946x8))[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[30]]=function(_0xb946x16,_0xb946x8){return VoiceRecording[_0xaa2d[33]](_0xb946x16[_0xaa2d[32]][_0xaa2d[31]])[_0xaa2d[18]](handleEntityNotFound(_0xb946x8))[_0xaa2d[18]](responseWithResult(_0xb946x8))[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[34]]=function(_0xb946x16,_0xb946x8){return VoiceRecording[_0xaa2d[33]](_0xb946x16[_0xaa2d[32]][_0xaa2d[31]])[_0xaa2d[18]](function(_0xb946x19){var _0xb946x1a=Promise[_0xaa2d[38]](fs[_0xaa2d[37]]);return _0xb946x1a(_0xb946x19[_0xaa2d[39]])})[_0xaa2d[18]](function(_0xb946x18){var _0xb946x17= new Buffer(_0xb946x18,_0xaa2d[36]).toString(_0xaa2d[35]);return _0xb946x17})[_0xaa2d[18]](function(_0xb946x17){return _0xb946x8[_0xaa2d[14]](200)[_0xaa2d[13]]({downloadString:_0xb946x17})})[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[40]]=function(_0xb946x16,_0xb946x8){return VoiceRecording[_0xaa2d[40]](_0xb946x16[_0xaa2d[41]])[_0xaa2d[18]](responseWithResult(_0xb946x8,201))[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[42]]=function(_0xb946x16,_0xb946x8){if(_0xb946x16[_0xaa2d[41]][_0xaa2d[31]]){delete _0xb946x16[_0xaa2d[41]][_0xaa2d[31]]};return VoiceRecording[_0xaa2d[33]](_0xb946x16[_0xaa2d[32]][_0xaa2d[31]])[_0xaa2d[18]](handleEntityNotFound(_0xb946x8))[_0xaa2d[18]](saveUpdates(_0xb946x16[_0xaa2d[41]]))[_0xaa2d[18]](responseWithResult(_0xb946x8))[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[19]]=function(_0xb946x16,_0xb946x8){return VoiceRecording[_0xaa2d[33]](_0xb946x16[_0xaa2d[32]][_0xaa2d[31]])[_0xaa2d[18]](handleEntityNotFound(_0xb946x8))[_0xaa2d[18]](removeEntity(_0xb946x8))[_0xaa2d[28]](handleError(_0xb946x8))};exports[_0xaa2d[43]]=function(_0xb946x16,_0xb946x8){return VoiceRecording[_0xaa2d[19]]({where:{uniqueid:_0xb946x16[_0xaa2d[27]][_0xaa2d[45]]},individualHooks:true})[_0xaa2d[18]](function(){return _0xb946x8[_0xaa2d[44]](204)})[_0xaa2d[28]](handleError(_0xb946x8))} \ No newline at end of file +/** + * Using Rails-like standard naming convention for endpoints. + * GET /api/voice/recordings -> index + * POST /api/voice/recordings -> create + * GET /api/voice/recordings/:id -> show + * PUT /api/voice/recordings/:id -> update + * DELETE /api/voice/recordings/:id -> destroy + */ + +'use strict'; + + +var _ = require('lodash'); +var util = require('util'); + +var VoiceRecording = require('../../models').VoiceRecording; +var Promise = require('bluebird'); +// var base64 = Promise.promisifyAll(require('file-base64')); +var base64 = require('file-base64'); +var fs = require('fs'); + +function handleError(res) { + return function(err) { + if (err.cause && err.cause.code === 'ENOENT') { + err = { + message: 'No file or directory', + translatedMessage: 'MESSAGE_NO_FILE_OR_DIRECTORY' + }; + } + return res.status(500).send(err); + } +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(body) { + return function(entity) { + return entity + .updateAttributes(body); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +function getQuery(query) { + var _query = {}; + _query.where = {}; + + _.forEach(query, function(value, key) { + switch (key) { + case 'limit': + case 'offset': + _query[key] = Number(value); + break; + case 'order': + _query[key] = value; + break; + default: + _query.where[key] = { + $like: '%' + value + '%' + }; + } + }); + + return _query; +} + +// Gets a list of VoiceRecordings +exports.index = function(req, res) { + var _query = getQuery(req.query); + return VoiceRecording + .findAndCountAll(_query) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single VoiceRecording from the DB +exports.show = function(req, res) { + return VoiceRecording.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Gets a single VoiceRecording from the DB +exports.getStream = function(req, res) { + return VoiceRecording + .findById(req.params.id) + .then(function(recording) { + var readFile = Promise.promisify(fs.readFile); + return readFile(recording.value); + }) + .then(function(result) { + var base64String = new Buffer(result, 'binary').toString('base64'); + return base64String; + }) + .then(function(base64String) { + return res.status(200).send({ + downloadString: base64String + }); + }) + .catch(handleError(res)); +} + + +// Creates a new VoiceRecording in the DB +exports.create = function(req, res) { + return VoiceRecording.create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +} + +// Updates an existing VoiceRecording in the DB +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return VoiceRecording.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +// Deletes a VoiceRecording from the DB +exports.destroy = function(req, res) { + return VoiceRecording.findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +} + +// Deletes a agent from the DB. +exports.bulkDestroy = function(req, res) { + return VoiceRecording + .destroy({ + where: { + uniqueid: req.query.ids + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(handleError(res)); +}; diff --git a/server/api/voice_recording/voice_recording.socket.js b/server/api/voice_recording/voice_recording.socket.js index dbe71c0..a0f969a 100644 --- a/server/api/voice_recording/voice_recording.socket.js +++ b/server/api/voice_recording/voice_recording.socket.js @@ -1 +1,24 @@ -var _0x4d8b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x3A\x72\x65\x6D\x6F\x76\x65"];_0x4d8b[0];var VoiceRecording=require(_0x4d8b[2])[_0x4d8b[1]];exports[_0x4d8b[3]]=function(_0x3ff3x2){VoiceRecording[_0x4d8b[4]](function(_0x3ff3x3){onSave(_0x3ff3x2,_0x3ff3x3)});VoiceRecording[_0x4d8b[5]](function(_0x3ff3x3){onRemove(_0x3ff3x2,_0x3ff3x3)})};function onSave(_0x3ff3x2,_0x3ff3x3,_0x3ff3x5){_0x3ff3x2[_0x4d8b[7]](_0x4d8b[6],_0x3ff3x3)}function onRemove(_0x3ff3x2,_0x3ff3x3,_0x3ff3x5){_0x3ff3x2[_0x4d8b[7]](_0x4d8b[8],_0x3ff3x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceRecording = require('../../models').VoiceRecording; + +exports.register = function(socket) { + VoiceRecording.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceRecording.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +}; + +function onSave(socket, doc, cb) { + socket.emit('voice_recording:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_recording:remove', doc); +} diff --git a/server/api/voice_voicemail/index.js b/server/api/voice_voicemail/index.js index fa46a92..96f6298 100644 --- a/server/api/voice_voicemail/index.js +++ b/server/api/voice_voicemail/index.js @@ -1 +1,18 @@ -var _0xee3d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x75\x6E\x69\x71\x75\x65\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65","\x6D\x61\x69\x6C\x62\x6F\x78\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0xee3d[0];var express=require(_0xee3d[1]);var controller=require(_0xee3d[2]);var auth=require(_0xee3d[3]);var router=express.Router();router[_0xee3d[7]](_0xee3d[4],auth[_0xee3d[5]](),controller[_0xee3d[6]]);router[_0xee3d[7]](_0xee3d[8],auth[_0xee3d[5]](),controller[_0xee3d[9]]);router[_0xee3d[11]](_0xee3d[4],auth[_0xee3d[5]](),controller[_0xee3d[10]]);router[_0xee3d[11]](_0xee3d[12],auth[_0xee3d[5]](),controller[_0xee3d[13]]);router[_0xee3d[15]](_0xee3d[8],auth[_0xee3d[5]](),controller[_0xee3d[14]]);router[_0xee3d[17]](_0xee3d[16],auth[_0xee3d[5]](),controller[_0xee3d[14]]);router[_0xee3d[19]](_0xee3d[4],auth[_0xee3d[5]](),controller[_0xee3d[18]]);router[_0xee3d[19]](_0xee3d[8],auth[_0xee3d[5]](),controller[_0xee3d[20]]);module[_0xee3d[21]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_voicemail.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:uniqueid', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/validate', auth.isAuthenticated(), controller.mailboxValidation); +router.put('/:uniqueid', auth.isAuthenticated(), controller.update); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:uniqueid', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/voice_voicemail/voice_voicemail.controller.js b/server/api/voice_voicemail/voice_voicemail.controller.js index e7fbe05..69a1139 100644 --- a/server/api/voice_voicemail/voice_voicemail.controller.js +++ b/server/api/voice_voicemail/voice_voicemail.controller.js @@ -1 +1,190 @@ -var _0x789c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x73\x74\x72\x65\x61\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x75\x6E\x69\x71\x75\x65\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x6D\x61\x69\x6C\x62\x6F\x78\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x6C\x6F\x67","\x6D\x61\x69\x6C\x62\x6F\x78","\x63\x6F\x6E\x74\x65\x78\x74","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x4D\x41\x49\x4C\x42\x4F\x58","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x789c[0];var _=require(_0x789c[1]);var stream=require(_0x789c[2]);var Util=require(_0x789c[3]);var VoiceVoicemail=require(_0x789c[5])[_0x789c[4]];var VoiceVoicemailMessages=require(_0x789c[5])[_0x789c[6]];exports[_0x789c[7]]=function(_0x4ff1x6,_0x4ff1x7){return VoiceVoicemail[_0x789c[14]](Util[_0x789c[13]](_0x4ff1x6[_0x789c[12]]))[_0x789c[11]](function(_0x4ff1x9){_0x4ff1x7[_0x789c[10]](200)[_0x789c[9]](_0x4ff1x9)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};exports[_0x789c[15]]=function(_0x4ff1x6,_0x4ff1x7){VoiceVoicemail[_0x789c[19]]({where:{uniqueid:_0x4ff1x6[_0x789c[18]][_0x789c[17]]}})[_0x789c[11]](function(_0x4ff1xa){if(!_0x4ff1xa){return _0x4ff1x7[_0x789c[16]](404)};return _0x4ff1x7[_0x789c[9]](_0x4ff1xa)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};exports[_0x789c[20]]=function(_0x4ff1x6,_0x4ff1x7){console[_0x789c[22]](_0x4ff1x6[_0x789c[21]]);VoiceVoicemail[_0x789c[25]]({where:{mailbox:_0x4ff1x6[_0x789c[21]][_0x789c[23]],context:_0x4ff1x6[_0x789c[21]][_0x789c[24]]}})[_0x789c[11]](function(_0x4ff1xb){if(!_0x4ff1xb){return _0x4ff1x7[_0x789c[16]](404)};return _0x4ff1x7[_0x789c[9]](_0x4ff1xb)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};exports[_0x789c[26]]=function(_0x4ff1x6,_0x4ff1x7){VoiceVoicemail[_0x789c[25]]({where:{mailbox:_0x4ff1x6[_0x789c[21]][_0x789c[23]],context:_0x4ff1x6[_0x789c[21]][_0x789c[24]]}})[_0x789c[11]](function(_0x4ff1xb){if(!_0x4ff1xb){return _0x4ff1x7[_0x789c[16]](404)};if(_0x4ff1xb[_0x789c[27]]>0){return _0x4ff1x7[_0x789c[10]](500)[_0x789c[9]]({message:_0x789c[28]})};VoiceVoicemail[_0x789c[26]](_0x4ff1x6[_0x789c[21]])[_0x789c[11]](function(_0x4ff1xa){return _0x4ff1x7[_0x789c[10]](201)[_0x789c[9]](_0x4ff1xa)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})})};exports[_0x789c[29]]=function(_0x4ff1x6,_0x4ff1x7){VoiceVoicemail[_0x789c[25]]({where:{mailbox:_0x4ff1x6[_0x789c[21]][_0x789c[23]],context:_0x4ff1x6[_0x789c[21]][_0x789c[24]],uniqueid:{$ne:_0x4ff1x6[_0x789c[21]][_0x789c[17]]}}})[_0x789c[11]](function(_0x4ff1xb){if(!_0x4ff1xb){return _0x4ff1x7[_0x789c[16]](404)};if(_0x4ff1xb[_0x789c[27]]>0){return _0x4ff1x7[_0x789c[10]](500)[_0x789c[9]]({message:_0x789c[28]})};if(_0x4ff1x6[_0x789c[21]][_0x789c[17]]){delete _0x4ff1x6[_0x789c[21]][_0x789c[17]]};VoiceVoicemail[_0x789c[19]]({where:{uniqueid:_0x4ff1x6[_0x789c[18]][_0x789c[17]]}})[_0x789c[11]](function(_0x4ff1xa){if(!_0x4ff1xa){return _0x4ff1x7[_0x789c[16]](404)};var _0x4ff1xc=_[_0x789c[30]](_0x4ff1xa,_0x4ff1x6[_0x789c[21]]);_0x4ff1xc[_0x789c[31]]()[_0x789c[11]](function(){return _0x4ff1x7[_0x789c[10]](200)[_0x789c[9]](_0x4ff1xa)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};exports[_0x789c[32]]=function(_0x4ff1x6,_0x4ff1x7){VoiceVoicemail[_0x789c[19]]({where:{uniqueid:_0x4ff1x6[_0x789c[18]][_0x789c[17]]}})[_0x789c[11]](function(_0x4ff1xa){if(!_0x4ff1xa){return _0x4ff1x7[_0x789c[16]](404)};_0x4ff1xa[_0x789c[32]]()[_0x789c[11]](function(){return _0x4ff1x7[_0x789c[16]](204)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};exports[_0x789c[33]]=function(_0x4ff1x6,_0x4ff1x7){VoiceVoicemail[_0x789c[32]]({where:{uniqueid:_0x4ff1x6[_0x789c[12]][_0x789c[17]]},individualHooks:true})[_0x789c[11]](function(){return _0x4ff1x7[_0x789c[16]](204)})[_0x789c[8]](function(_0x4ff1x8){return handleError(_0x4ff1x7,_0x4ff1x8)})};function handleError(_0x4ff1x7,_0x4ff1x8){return _0x4ff1x7[_0x789c[10]](500)[_0x789c[9]](_0x4ff1x8)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var stream = require('stream'); +var Util = require('../../config/util'); + +var VoiceVoicemail = require('../../models').VoiceVoicemail; +var VoiceVoicemailMessages = require('../../models').VoiceVoicemailMessages; + +// Get list of voice_voicemails +exports.index = function(req, res) { + return VoiceVoicemail + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single voice_voicemail +exports.show = function(req, res) { + VoiceVoicemail + .find({ + where: { + uniqueid: req.params.uniqueid + } + }) + .then(function(voice_voicemail) { + if (!voice_voicemail) { + return res.sendStatus(404); + } + return res.send(voice_voicemail); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// validate mailbox uniqueness +exports.mailboxValidation = function(req, res) { + console.log(req.body); + VoiceVoicemail + .findAll({ + where: { + mailbox: req.body.mailbox, + context: req.body.context + } + }) + .then(function(voicemails) { + if (!voicemails) { + return res.sendStatus(404); + } + return res.send(voicemails); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; +// Creates a new voice_voicemail in the DB. +exports.create = function(req, res) { + VoiceVoicemail + .findAll({ + where: { + mailbox: req.body.mailbox, + context: req.body.context + } + }) + .then(function(voicemails) { + if (!voicemails) { + return res.sendStatus(404); + } + if (voicemails.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_MAILBOX' + }) + } + VoiceVoicemail + .create(req.body) + .then(function(voice_voicemail) { + return res.status(201).send(voice_voicemail); + }) + .catch(function(err) { + return handleError(res, err); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) +}; + +// Updates an existing voice_voicemail in the DB. +exports.update = function(req, res) { + VoiceVoicemail + .findAll({ + where: { + mailbox: req.body.mailbox, + context: req.body.context, + uniqueid: { + $ne: req.body.uniqueid + } + } + }) + .then(function(voicemails) { + if (!voicemails) { + return res.sendStatus(404); + } + if (voicemails.length > 0) { + return res.status(500).send({ + message: 'MESSAGE_EXIST_MAILBOX' + }) + } + if (req.body.uniqueid) { + delete req.body.uniqueid; + } + VoiceVoicemail + .find({ + where: { + uniqueid: req.params.uniqueid + } + }) + .then(function(voice_voicemail) { + if (!voice_voicemail) { + return res.sendStatus(404); + } + var updated = _.merge(voice_voicemail, req.body); + updated.save() + .then(function() { + return res.status(200).send(voice_voicemail); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); + +}; + +// Deletes a voice_voicemail from the DB. +exports.destroy = function(req, res) { + VoiceVoicemail + .find({ + where: { + uniqueid: req.params.uniqueid + } + }) + .then(function(voice_voicemail) { + if (!voice_voicemail) { + return res.sendStatus(404); + } + voice_voicemail.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a voice_voicemail from the DB. +exports.bulkDestroy = function(req, res) { + VoiceVoicemail + .destroy({ + where: { + uniqueid: req.query.uniqueid + }, + individualHooks: true + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_voicemail/voice_voicemail.socket.js b/server/api/voice_voicemail/voice_voicemail.socket.js index 643da78..41e7a38 100644 --- a/server/api/voice_voicemail/voice_voicemail.socket.js +++ b/server/api/voice_voicemail/voice_voicemail.socket.js @@ -1 +1,39 @@ -var _0xab40=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x3A\x72\x65\x6D\x6F\x76\x65","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x3A\x73\x61\x76\x65","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x3A\x72\x65\x6D\x6F\x76\x65"];_0xab40[0];var VoiceVoicemail=require(_0xab40[2])[_0xab40[1]];var VoiceVoicemailMessages=require(_0xab40[2])[_0xab40[3]];exports[_0xab40[4]]=function(_0xb598x3){VoiceVoicemail[_0xab40[5]](function(_0xb598x4){onSave(_0xb598x3,_0xb598x4)});VoiceVoicemail[_0xab40[6]](function(_0xb598x4){onRemove(_0xb598x3,_0xb598x4)});VoiceVoicemailMessages[_0xab40[5]](function(_0xb598x4){onMessageSave(_0xb598x3,_0xb598x4)});VoiceVoicemailMessages[_0xab40[6]](function(_0xb598x4){onMessageRemove(_0xb598x3,_0xb598x4)})};function onSave(_0xb598x3,_0xb598x4,_0xb598x6){_0xb598x3[_0xab40[8]](_0xab40[7],_0xb598x4)}function onRemove(_0xb598x3,_0xb598x4,_0xb598x6){_0xb598x3[_0xab40[8]](_0xab40[9],_0xb598x4)}function onMessageSave(_0xb598x3,_0xb598x4,_0xb598x6){_0xb598x3[_0xab40[8]](_0xab40[10],_0xb598x4)}function onMessageRemove(_0xb598x3,_0xb598x4,_0xb598x6){_0xb598x3[_0xab40[8]](_0xab40[11],_0xb598x4)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceVoicemail = require('../../models').VoiceVoicemail; +var VoiceVoicemailMessages = require('../../models').VoiceVoicemailMessages; + +exports.register = function(socket) { + VoiceVoicemail.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceVoicemail.afterDestroy(function(doc) { + onRemove(socket, doc); + }); + VoiceVoicemailMessages.afterCreate(function(doc) { + onMessageSave(socket, doc); + }); + VoiceVoicemailMessages.afterDestroy(function(doc) { + onMessageRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_voicemail:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_voicemail:remove', doc); +} + +function onMessageSave(socket, doc, cb) { + socket.emit('voice_voicemail_messages:save', doc); +} + +function onMessageRemove(socket, doc, cb) { + socket.emit('voice_voicemail_messages:remove', doc); +} diff --git a/server/api/voice_voicemail/voice_voicemail.spec.js b/server/api/voice_voicemail/voice_voicemail.spec.js index 7861fea..5785825 100644 --- a/server/api/voice_voicemail/voice_voicemail.spec.js +++ b/server/api/voice_voicemail/voice_voicemail.spec.js @@ -1 +1,20 @@ -var _0x1593=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x67\x65\x74"];_0x1593[0];var should=require(_0x1593[1]);var app=require(_0x1593[2]);var request=require(_0x1593[3]);describe(_0x1593[4],function(){it(_0x1593[5],function(_0x97aax4){request(app)[_0x1593[13]](_0x1593[12])[_0x1593[11]](200)[_0x1593[11]](_0x1593[10],/json/)[_0x1593[9]](function(_0x97aax5,_0x97aax6){if(_0x97aax5){return _0x97aax4(_0x97aax5)};_0x97aax6[_0x1593[8]][_0x1593[1]][_0x1593[7]][_0x1593[6]](Array);_0x97aax4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/voice/voicemails', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/voice/voicemails') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/voice_voicemail_messages/index.js b/server/api/voice_voicemail_messages/index.js index c3be621..b80b40a 100644 --- a/server/api/voice_voicemail_messages/index.js +++ b/server/api/voice_voicemail_messages/index.js @@ -1 +1,15 @@ -var _0x2bcb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x2bcb[0];var express=require(_0x2bcb[1]);var controller=require(_0x2bcb[2]);var auth=require(_0x2bcb[3]);var router=express.Router();router[_0x2bcb[7]](_0x2bcb[4],auth[_0x2bcb[5]](),controller[_0x2bcb[6]]);router[_0x2bcb[7]](_0x2bcb[8],auth[_0x2bcb[5]](),controller[_0x2bcb[9]]);router[_0x2bcb[7]](_0x2bcb[10],auth[_0x2bcb[5]](),controller[_0x2bcb[11]]);router[_0x2bcb[13]](_0x2bcb[4],auth[_0x2bcb[5]](),controller[_0x2bcb[12]]);router[_0x2bcb[13]](_0x2bcb[8],auth[_0x2bcb[5]](),controller[_0x2bcb[14]]);module[_0x2bcb[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./voice_voicemail_messages.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/download', auth.isAuthenticated(), controller.download); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/voice_voicemail_messages/voice_voicemail_messages.controller.js b/server/api/voice_voicemail_messages/voice_voicemail_messages.controller.js index b6d1bba..8268a61 100644 --- a/server/api/voice_voicemail_messages/voice_voicemail_messages.controller.js +++ b/server/api/voice_voicemail_messages/voice_voicemail_messages.controller.js @@ -1 +1,106 @@ -var _0x3ebc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x73\x74\x72\x65\x61\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6D\x61\x69\x6C\x62\x6F\x78","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x61\x6C\x6C","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x69\x64\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x62\x61\x73\x65\x36\x34","\x62\x69\x6E\x61\x72\x79"];_0x3ebc[0];var _=require(_0x3ebc[1]);var stream=require(_0x3ebc[2]);var Util=require(_0x3ebc[3]);var VoiceVoicemailMessages=require(_0x3ebc[5])[_0x3ebc[4]];exports[_0x3ebc[6]]=function(_0x324ex5,_0x324ex6){return VoiceVoicemailMessages[_0x3ebc[16]]({method:[_0x3ebc[15],_0x324ex5[_0x3ebc[12]]]})[_0x3ebc[14]](Util[_0x3ebc[13]](_0x324ex5[_0x3ebc[12]]))[_0x3ebc[11]](function(_0x324ex8){_0x324ex6[_0x3ebc[10]](200)[_0x3ebc[9]](_0x324ex8)})[_0x3ebc[8]](function(_0x324ex7){console[_0x3ebc[7]](_0x324ex7);return handleError(_0x324ex6,_0x324ex7)})};exports[_0x3ebc[17]]=function(_0x324ex5,_0x324ex6){return VoiceVoicemailMessages[_0x3ebc[21]](_0x324ex5[_0x3ebc[20]][_0x3ebc[19]])[_0x3ebc[11]](function(_0x324ex9){if(!_0x324ex9){return _0x324ex6[_0x3ebc[18]](404)};return _0x324ex6[_0x3ebc[9]](_0x324ex9)})[_0x3ebc[8]](function(_0x324ex7){return handleError(_0x324ex6,_0x324ex7)})};exports[_0x3ebc[22]]=function(_0x324ex5,_0x324ex6){return VoiceVoicemailMessages[_0x3ebc[21]](_0x324ex5[_0x3ebc[20]][_0x3ebc[19]])[_0x3ebc[11]](function(_0x324ex9){if(!_0x324ex9){return _0x324ex6[_0x3ebc[18]](404)};_0x324ex9[_0x3ebc[23]]=null;_0x324ex9[_0x3ebc[22]]()})[_0x3ebc[11]](function(){return _0x324ex6[_0x3ebc[18]](204)})[_0x3ebc[8]](function(_0x324ex7){return handleError(_0x324ex6,_0x324ex7)})};exports[_0x3ebc[24]]=function(_0x324ex5,_0x324ex6){return VoiceVoicemailMessages[_0x3ebc[29]]({where:{id:_0x324ex5[_0x3ebc[12]][_0x3ebc[28]]},individualHooks:true})[_0x3ebc[11]](function(_0x324exa){var _0x324exb=[];_0x324exa[_0x3ebc[27]](function(_0x324exc){voicemail_message[_0x3ebc[23]]=null;_0x324exb[_0x3ebc[26]](voicemail_message[_0x3ebc[22]]())});return _0x324exb})[_0x3ebc[25]]()[_0x3ebc[11]](function(){return _0x324ex6[_0x3ebc[18]](204)})[_0x3ebc[8]](function(_0x324ex7){return handleError(_0x324ex6,_0x324ex7)})};exports[_0x3ebc[30]]=function(_0x324ex5,_0x324ex6){return VoiceVoicemailMessages[_0x3ebc[21]](_0x324ex5[_0x3ebc[20]][_0x3ebc[19]])[_0x3ebc[11]](function(_0x324exc){var _0x324exd= new Buffer(_0x324exc[_0x3ebc[23]],_0x3ebc[32]).toString(_0x3ebc[31]);return _0x324exd})[_0x3ebc[11]](function(_0x324exd){return _0x324ex6[_0x3ebc[10]](200)[_0x3ebc[9]]({downloadString:_0x324exd})})[_0x3ebc[8]](function(_0x324ex7){console[_0x3ebc[7]](_0x324ex7);return handleError(_0x324ex6,_0x324ex7)})};function handleError(_0x324ex6,_0x324ex7){return _0x324ex6[_0x3ebc[10]](500)[_0x3ebc[9]](_0x324ex7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var stream = require('stream'); +var Util = require('../../config/util'); + +var VoiceVoicemailMessages = require('../../models').VoiceVoicemailMessages; + +// Get list of voicemail messages +exports.index = function(req, res) { + return VoiceVoicemailMessages + .scope({ + method: ['mailbox', req.query] + }) + .findAndCountAll(Util.getQuery(req.query)) + .then(function(result) { + res.status(200).send(result); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +// Get a single voicemail_message +exports.show = function(req, res) { + return VoiceVoicemailMessages + .findById(req.params.id) + .then(function(voicemail_message) { + if (!voicemail_message) { + return res.sendStatus(404); + } + return res.send(voicemail_message); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a voicemail_message from the DB. +exports.destroy = function(req, res) { + return VoiceVoicemailMessages + .findById(req.params.id) + .then(function(voicemail_message) { + if (!voicemail_message) { + return res.sendStatus(404); + } + voicemail_message.recording = null; + voicemail_message.destroy(); + }) + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes all voicemail_messages from the DB. +exports.bulkDestroy = function(req, res) { + return VoiceVoicemailMessages + .findAll({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(function(voicemail_messages) { + var bulkDest = []; + voicemail_messages.forEach(function(message) { + voicemail_message.recording = null; + bulkDest.push(voicemail_message.destroy()); + }); + return bulkDest; + }) + .all() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.download = function(req, res) { + return VoiceVoicemailMessages + .findById(req.params.id) + .then(function(message) { + var base64String = new Buffer(message.recording, 'binary').toString('base64'); + return base64String; + }) + .then(function(base64String) { + return res.status(200).send({ + downloadString: base64String + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/voice_voicemail_messages/voice_voicemail_messages.socket.js b/server/api/voice_voicemail_messages/voice_voicemail_messages.socket.js index 3deb056..ee0fbef 100644 --- a/server/api/voice_voicemail_messages/voice_voicemail_messages.socket.js +++ b/server/api/voice_voicemail_messages/voice_voicemail_messages.socket.js @@ -1 +1,24 @@ -var _0x8661=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8661[0];var VoiceVoicemailMessages=require(_0x8661[2])[_0x8661[1]];exports[_0x8661[3]]=function(_0x6f18x2){VoiceVoicemailMessages[_0x8661[4]](function(_0x6f18x3){onSave(_0x6f18x2,_0x6f18x3)});VoiceVoicemailMessages[_0x8661[5]](function(_0x6f18x3){onRemove(_0x6f18x2,_0x6f18x3)})};function onSave(_0x6f18x2,_0x6f18x3,_0x6f18x5){_0x6f18x2[_0x8661[7]](_0x8661[6],_0x6f18x3)}function onRemove(_0x6f18x2,_0x6f18x3,_0x6f18x5){_0x6f18x2[_0x8661[7]](_0x8661[8],_0x6f18x3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var VoiceVoicemailMessages = require('../../models').VoiceVoicemailMessages; + +exports.register = function(socket) { + VoiceVoicemailMessages.afterCreate(function(doc) { + onSave(socket, doc); + }); + VoiceVoicemailMessages.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('voice_voicemail_messages:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('voice_voicemail_messages:remove', doc); +} diff --git a/server/api/widget/index.js b/server/api/widget/index.js index 4d09978..374e711 100644 --- a/server/api/widget/index.js +++ b/server/api/widget/index.js @@ -1 +1,19 @@ -var _0x571c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x77\x69\x64\x67\x65\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x63\x6F\x75\x6E\x74\x65\x72","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x63\x6F\x75\x6E\x74\x65\x72","\x67\x65\x74","\x2F\x74\x61\x62\x6C\x65","\x74\x61\x62\x6C\x65","\x2F\x70\x69\x65\x63\x68\x61\x72\x74","\x70\x69\x65\x63\x68\x61\x72\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x571c[0];var express=require(_0x571c[1]);var controller=require(_0x571c[2]);var auth=require(_0x571c[3]);var router=express.Router();router[_0x571c[7]](_0x571c[4],auth[_0x571c[5]](),controller[_0x571c[6]]);router[_0x571c[7]](_0x571c[8],auth[_0x571c[5]](),controller[_0x571c[9]]);router[_0x571c[7]](_0x571c[10],auth[_0x571c[5]](),controller[_0x571c[11]]);module[_0x571c[12]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./widget.controller'); +var auth = require('../../auth/auth.service'); + +var router = express.Router(); + +// router.get('/', auth.isAuthenticated(), controller.index); +router.get('/counter', auth.isAuthenticated(), controller.counter); +router.get('/table', auth.isAuthenticated(), controller.table); +router.get('/piechart', auth.isAuthenticated(), controller.piechart); +// router.get('/:id', auth.isAuthenticated(), controller.show); +// router.post('/', auth.isAuthenticated(), controller.create); +// router.put('/:id', auth.isAuthenticated(), controller.update); +// router.patch('/:id', auth.isAuthenticated(), controller.update); +// router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/widget/widget.controller.js b/server/api/widget/widget.controller.js index fe5e247..731df92 100644 --- a/server/api/widget/widget.controller.js +++ b/server/api/widget/widget.controller.js @@ -1 +1,102 @@ -var _0x9e36=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x63\x6F\x75\x6E\x74\x65\x72","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x25\x73","\x73\x65\x6C\x65\x63\x74","\x71\x75\x65\x72\x79","\x74\x61\x62\x6C\x65","\x66\x6F\x72\x6D\x61\x74","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x20\x57\x48\x45\x52\x45\x20\x25\x73","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x66\x69\x65\x6C\x64\x73","\x69\x73\x41\x72\x72\x61\x79","\x70\x61\x72\x73\x65","\x63\x6F\x6C\x75\x6D\x6E","\x61\x6C\x69\x61\x73","\x20\x41\x53\x20\x22","\x22","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x69\x73\x53\x74\x72\x69\x6E\x67","\x6C\x65\x6E\x67\x74\x68","\x2C","\x6A\x6F\x69\x6E","\x2A","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x25\x73","\x72\x65\x70\x6F\x72\x74","\x70\x69\x65\x63\x68\x61\x72\x74","","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x25\x73\x25\x73"];_0x9e36[0];var _=require(_0x9e36[1]);var util=require(_0x9e36[2]);var sequelize=require(_0x9e36[4])[_0x9e36[3]];exports[_0x9e36[5]]=function(_0xcf57x4,_0xcf57x5){var _0xcf57x6=util[_0x9e36[10]](_0x9e36[6],_0xcf57x4[_0x9e36[8]][_0x9e36[7]],_0xcf57x4[_0x9e36[8]][_0x9e36[9]]);if(_0xcf57x4[_0x9e36[8]][_0x9e36[11]]){_0xcf57x6+=util[_0x9e36[10]](_0x9e36[12],decodeURIComponent(_0xcf57x4[_0x9e36[8]][_0x9e36[11]]))};sequelize[_0x9e36[8]](_0xcf57x6,{type:sequelize[_0x9e36[19]][_0x9e36[18]]})[_0x9e36[17]](function(_0xcf57x8){return _0xcf57x5[_0x9e36[16]](200)[_0x9e36[15]]({result:_0xcf57x8})})[_0x9e36[14]](function(_0xcf57x7){console[_0x9e36[13]](_0xcf57x7);return handleError(_0xcf57x5,_0xcf57x7)})};exports[_0x9e36[9]]=function(_0xcf57x4,_0xcf57x5){var _0xcf57x9=[];var _0xcf57xa;if(_0xcf57x4[_0x9e36[8]][_0x9e36[20]]){if(_[_0x9e36[21]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]])){_0xcf57x4[_0x9e36[8]][_0x9e36[20]][_0x9e36[28]](function(_0xcf57xb){_0xcf57xa=JSON[_0x9e36[22]](_0xcf57xb);if(_0xcf57xa[_0x9e36[23]]&&_0xcf57xa[_0x9e36[24]]){_0xcf57x9[_0x9e36[27]](_0xcf57xa[_0x9e36[23]]+_0x9e36[25]+_0xcf57xa[_0x9e36[24]]+_0x9e36[26])}})}else {if(_[_0x9e36[29]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]])){_0xcf57xa=JSON[_0x9e36[22]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]]);if(_0xcf57xa[_0x9e36[23]]&&_0xcf57xa[_0x9e36[24]]){_0xcf57x9[_0x9e36[27]](_0xcf57xa[_0x9e36[23]]+_0x9e36[25]+_0xcf57xa[_0x9e36[24]]+_0x9e36[26])}}}};var _0xcf57xc=_0xcf57x9[_0x9e36[30]]?_0xcf57x9[_0x9e36[32]](_0x9e36[31]):_0x9e36[33];sequelize[_0x9e36[8]](util[_0x9e36[10]](_0x9e36[34],_0xcf57xc,_0x9e36[35]+_0xcf57x4[_0x9e36[8]][_0x9e36[9]],decodeURIComponent(_0xcf57x4[_0x9e36[8]][_0x9e36[11]])),{type:sequelize[_0x9e36[19]][_0x9e36[18]]})[_0x9e36[17]](function(_0xcf57x8){return _0xcf57x5[_0x9e36[16]](200)[_0x9e36[15]](_0xcf57x8)})[_0x9e36[14]](function(_0xcf57x7){return handleError(_0xcf57x5,_0xcf57x7)})};exports[_0x9e36[36]]=function(_0xcf57x4,_0xcf57x5){var _0xcf57x9=[];var _0xcf57xa;if(_0xcf57x4[_0x9e36[8]][_0x9e36[20]]){if(_[_0x9e36[21]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]])){_0xcf57x4[_0x9e36[8]][_0x9e36[20]][_0x9e36[28]](function(_0xcf57xb){_0xcf57xa=JSON[_0x9e36[22]](_0xcf57xb);if(_0xcf57xa[_0x9e36[23]]&&_0xcf57xa[_0x9e36[24]]){_0xcf57x9[_0x9e36[27]](_0xcf57xa[_0x9e36[23]]+_0x9e36[25]+_0xcf57xa[_0x9e36[24]]+_0x9e36[26])}})}else {if(_[_0x9e36[29]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]])){_0xcf57xa=JSON[_0x9e36[22]](_0xcf57x4[_0x9e36[8]][_0x9e36[20]]);if(_0xcf57xa[_0x9e36[23]]&&_0xcf57xa[_0x9e36[24]]){_0xcf57x9[_0x9e36[27]](_0xcf57xa[_0x9e36[23]]+_0x9e36[25]+_0xcf57xa[_0x9e36[24]]+_0x9e36[26])}}}};var _0xcf57xc=_0xcf57x9[_0x9e36[30]]?_0xcf57x9[_0x9e36[32]](_0x9e36[31]):_0x9e36[33];var _0xcf57xd=_0x9e36[37];if(_0xcf57x4[_0x9e36[8]][_0x9e36[11]]!==_0x9e36[38]){_0xcf57xd=util[_0x9e36[10]](_0x9e36[12],decodeURIComponent(_0xcf57x4[_0x9e36[8]][_0x9e36[11]]))};sequelize[_0x9e36[8]](util[_0x9e36[10]](_0x9e36[39],_0xcf57xc,_0xcf57x4[_0x9e36[8]][_0x9e36[9]],_0xcf57xd),{type:sequelize[_0x9e36[19]][_0x9e36[18]]})[_0x9e36[17]](function(_0xcf57x8){return _0xcf57x5[_0x9e36[16]](200)[_0x9e36[15]]({result:_0xcf57x8})})[_0x9e36[14]](function(_0xcf57x7){return handleError(_0xcf57x5,_0xcf57x7)})};function handleError(_0xcf57x5,_0xcf57x7){return _0xcf57x5[_0x9e36[16]](500)[_0x9e36[15]](_0xcf57x7)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var sequelize = require('../../models').sequelize; + +// var ReportAgent = require('../../models').ReportAgent; +// var ReportCall = require('../../models').ReportCall; +// var ReportDial = require('../../models').ReportDial; +// var ReportMember = require('../../models').ReportMember; +// var ReportQueue = require('../../models').ReportQueue; + + + +exports.counter = function(req, res) { + var query = util.format("SELECT %s FROM %s", req.query.select, req.query.table); + if (req.query.condition) { + query += util.format(" WHERE %s", decodeURIComponent(req.query.condition)) + } + sequelize.query(query, { + type: sequelize.QueryTypes.SELECT + }) + .then(function(result) { + return res.status(200).send({ + result: result + }); + }) + .catch(function(err) { + console.log(err); + return handleError(res, err); + }); +}; + +exports.table = function(req, res) { + var columns = []; + var elem; + if (req.query.fields) { + if (_.isArray(req.query.fields)) { + req.query.fields.forEach(function(element) { + elem = JSON.parse(element); + if (elem.column && elem.alias) { + columns.push(elem.column + ' AS "' + elem.alias + '"'); + } + }); + } else if (_.isString(req.query.fields)) { + elem = JSON.parse(req.query.fields); + if (elem.column && elem.alias) { + columns.push(elem.column + ' AS "' + elem.alias + '"'); + } + } + } + var select = columns.length ? columns.join(',') : '*'; + sequelize.query(util.format("SELECT %s FROM %s WHERE %s", select, 'report' + req.query.table, decodeURIComponent(req.query.condition)), { + type: sequelize.QueryTypes.SELECT + }) + .then(function(result) { + return res.status(200).send(result); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.piechart = function(req, res) { + var columns = []; + var elem; + if (req.query.fields) { + if (_.isArray(req.query.fields)) { + req.query.fields.forEach(function(element) { + elem = JSON.parse(element); + if (elem.column && elem.alias) { + columns.push(elem.column + ' AS "' + elem.alias + '"'); + } + }); + } else if (_.isString(req.query.fields)) { + elem = JSON.parse(req.query.fields); + if (elem.column && elem.alias) { + columns.push(elem.column + ' AS "' + elem.alias + '"'); + } + } + } + var select = columns.length ? columns.join(',') : '*'; + var where = ''; + if (req.query.condition !== 'undefined') { + where = util.format(' WHERE %s', decodeURIComponent(req.query.condition)); + } + sequelize.query(util.format("SELECT %s FROM %s%s", select, req.query.table, where), { + type: sequelize.QueryTypes.SELECT + }) + .then(function(result) { + return res.status(200).send({ + result: result + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/widget/widget.spec.js b/server/api/widget/widget.spec.js index db91344..94ea420 100644 --- a/server/api/widget/widget.spec.js +++ b/server/api/widget/widget.spec.js @@ -1 +1,20 @@ -var _0x48d1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x77\x69\x64\x67\x65\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x77\x69\x64\x67\x65\x74\x73","\x67\x65\x74"];_0x48d1[0];var should=require(_0x48d1[1]);var app=require(_0x48d1[2]);var request=require(_0x48d1[3]);describe(_0x48d1[4],function(){it(_0x48d1[5],function(_0xb726x4){request(app)[_0x48d1[13]](_0x48d1[12])[_0x48d1[11]](200)[_0x48d1[11]](_0x48d1[10],/json/)[_0x48d1[9]](function(_0xb726x5,_0xb726x6){if(_0xb726x5){return _0xb726x4(_0xb726x5)};_0xb726x6[_0x48d1[8]][_0x48d1[1]][_0x48d1[7]][_0x48d1[6]](Array);_0xb726x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/widgets', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/widgets') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/xchatty/index.js b/server/api/xchatty/index.js index 32dd7f5..e03bc91 100644 --- a/server/api/xchatty/index.js +++ b/server/api/xchatty/index.js @@ -1 +1,33 @@ -var _0x882f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x78\x63\x68\x61\x74\x74\x79\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F\x6A\x71\x75\x65\x72\x79","\x67\x65\x74\x4A\x71\x75\x65\x72\x79\x4C\x69\x62\x72\x61\x72\x79","\x67\x65\x74","\x2F\x61\x73\x73\x65\x74\x73","\x67\x65\x74\x41\x73\x73\x65\x74\x73","\x2F\x73\x74\x61\x74\x75\x73","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x2F\x73\x69\x67\x6E\x75\x70","\x73\x69\x67\x6E\x75\x70\x43\x75\x73\x74\x6F\x6D\x65\x72","\x2F\x72\x65\x61\x64","\x67\x65\x74\x4D\x65\x73\x73\x61\x67\x65\x73","\x2F\x73\x65\x6E\x64","\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65","\x2F\x73\x69\x67\x6E\x6F\x75\x74","\x73\x69\x67\x6E\x6F\x75\x74\x43\x75\x73\x74\x6F\x6D\x65\x72","\x2F\x73\x75\x62\x6D\x69\x74","\x73\x75\x62\x6D\x69\x74\x45\x6E\x71\x75\x69\x72\x79","\x2F\x75\x6E\x73\x65\x72\x76\x65\x64","\x75\x6E\x73\x65\x72\x76\x65\x64\x43\x75\x73\x74\x6F\x6D\x65\x72","\x2F\x74\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x67\x65\x74\x54\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x2F\x72\x61\x74\x69\x6E\x67","\x73\x65\x74\x52\x61\x74\x69\x6E\x67","\x2F\x61\x62\x61\x6E\x64\x6F\x6E","\x61\x62\x61\x6E\x64\x6F\x6E\x43\x75\x73\x74\x6F\x6D\x65\x72","\x2F\x3A\x69\x64","\x67\x65\x74\x4A\x73\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x2F\x3A\x69\x64\x2F\x68\x74\x6D\x6C","\x67\x65\x74\x48\x74\x6D\x6C\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x2F\x3A\x69\x64\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65","\x67\x65\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x2F\x3A\x69\x64\x2F\x73\x74\x79\x6C\x65\x73","\x67\x65\x74\x53\x74\x79\x6C\x65\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x2F","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x882f[0];var express=require(_0x882f[1]);var controller=require(_0x882f[2]);var router=express.Router();router[_0x882f[5]](_0x882f[3],controller[_0x882f[4]]);router[_0x882f[5]](_0x882f[6],controller[_0x882f[7]]);router[_0x882f[5]](_0x882f[8],controller[_0x882f[9]]);router[_0x882f[5]](_0x882f[10],controller[_0x882f[11]]);router[_0x882f[5]](_0x882f[12],controller[_0x882f[13]]);router[_0x882f[5]](_0x882f[14],controller[_0x882f[15]]);router[_0x882f[5]](_0x882f[16],controller[_0x882f[17]]);router[_0x882f[5]](_0x882f[18],controller[_0x882f[19]]);router[_0x882f[5]](_0x882f[20],controller[_0x882f[21]]);router[_0x882f[5]](_0x882f[22],controller[_0x882f[23]]);router[_0x882f[5]](_0x882f[24],controller[_0x882f[25]]);router[_0x882f[5]](_0x882f[26],controller[_0x882f[27]]);router[_0x882f[5]](_0x882f[28],controller[_0x882f[29]]);router[_0x882f[5]](_0x882f[30],controller[_0x882f[31]]);router[_0x882f[5]](_0x882f[32],controller[_0x882f[33]]);router[_0x882f[5]](_0x882f[34],controller[_0x882f[35]]);router[_0x882f[38]](_0x882f[36],controller[_0x882f[37]]);router[_0x882f[40]](_0x882f[28],controller[_0x882f[39]]);router[_0x882f[41]](_0x882f[28],controller[_0x882f[39]]);router[_0x882f[43]](_0x882f[28],controller[_0x882f[42]]);module[_0x882f[44]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./xchatty.controller'); + +var router = express.Router(); + +router.get('/jquery', controller.getJqueryLibrary); +router.get('/assets', controller.getAssets); + +router.get('/status', controller.getStatus); +router.get('/signup', controller.signupCustomer); +router.get('/read', controller.getMessages); +router.get('/send', controller.sendMessage); +router.get('/signout', controller.signoutCustomer); +router.get('/submit', controller.submitEnquiry); +router.get('/unserved', controller.unservedCustomer); +router.get('/transcript', controller.getTranscript); +router.get('/rating', controller.setRating); +router.get('/abandon', controller.abandonCustomer); + +router.get('/:id', controller.getJsByWebsite); +router.get('/:id/html', controller.getHtmlByWebsite); +router.get('/:id/proactive', controller.getProactiveActionsByWebsite); +router.get('/:id/styles', controller.getStyleByWebsite); + +// router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/xchatty/xchatty.controller.js b/server/api/xchatty/xchatty.controller.js index c9cbc99..017d746 100644 --- a/server/api/xchatty/xchatty.controller.js +++ b/server/api/xchatty/xchatty.controller.js @@ -1 +1,829 @@ -var _0x77c2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6A\x73\x6D\x69\x6E","\x6D\x75\x73\x74\x61\x63\x68\x65","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x70\x61\x74\x68","\x6D\x64\x35","\x66\x73","\x75\x61\x2D\x70\x61\x72\x73\x65\x72\x2D\x6A\x73","\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65\x2D\x70\x61\x72\x73\x65\x72","\x69\x70\x61\x64\x64\x72\x2E\x6A\x73","\x67\x65\x6F\x69\x70\x2D\x6C\x69\x74\x65","\x74\x6F\x2D\x63\x73\x76","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x58\x63\x68\x61\x74\x74\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x78\x63\x68\x61\x74\x74\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x55\x73\x65\x72","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x4A\x73\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x6E\x6F\x77","\x73\x65\x74","\x6A\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x72\x65\x6D\x6F\x74\x65","\x73\x74\x72\x69\x70\x54\x72\x61\x69\x6C\x69\x6E\x67\x53\x6C\x61\x73\x68","\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79\x2F","\x66\x61\x6C\x73\x65","\x74\x72\x75\x65","\x22\x22","\x6E\x75\x6C\x6C","\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79\x2F\x61\x73\x73\x65\x74\x73","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x68\x65\x61\x64\x65\x72\x5F\x73\x68\x61\x70\x65","\x68\x65\x61\x64\x65\x72\x5F\x6F\x6E\x6C\x69\x6E\x65","\x6F\x6E\x6C\x69\x6E\x65\x5F\x6D\x65\x73\x73\x61\x67\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x65\x6D\x61\x69\x6C\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x73\x74\x61\x72\x74\x5F\x63\x68\x61\x74\x5F\x62\x75\x74\x74\x6F\x6E","\x6F\x66\x66\x6C\x69\x6E\x65\x5F\x6D\x65\x73\x73\x61\x67\x65","\x68\x65\x61\x64\x65\x72\x5F\x6F\x66\x66\x6C\x69\x6E\x65","\x65\x6E\x71\x75\x69\x72\x79\x5F\x6D\x65\x73\x73\x61\x67\x65\x5F\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x65\x6E\x71\x75\x69\x72\x79\x5F\x62\x75\x74\x74\x6F\x6E","\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x5F\x74\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x72\x61\x74\x69\x6E\x67\x5F\x6D\x65\x73\x73\x61\x67\x65","\x72\x61\x74\x69\x6E\x67\x5F\x73\x65\x6E\x64","\x72\x61\x74\x69\x6E\x67\x5F\x73\x6B\x69\x70","\x72\x65\x6E\x64\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x53\x74\x79\x6C\x65\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x74\x65\x78\x74\x2F\x63\x73\x73","\x63\x73\x73","\x63\x6F\x6C\x6F\x72","\x63\x6F\x6C\x6F\x72\x5F\x66\x6F\x63\x75\x73","\x63\x6F\x6C\x6F\x72\x5F\x62\x75\x74\x74\x6F\x6E","\x67\x65\x74\x41\x73\x73\x65\x74\x73","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73","\x78\x63\x68\x61\x74\x74\x79","\x61\x73\x73\x65\x74\x73","\x72\x65\x73\x6F\x75\x72\x63\x65","\x71\x75\x65\x72\x79","\x6A\x6F\x69\x6E","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x67\x65\x74\x4A\x71\x75\x65\x72\x79\x4C\x69\x62\x72\x61\x72\x79","\x6A\x71\x75\x65\x72\x79","\x67\x65\x74\x53\x74\x61\x74\x75\x73","\x73\x65\x73\x73\x69\x6F\x6E","\x69\x73\x5F\x75\x6E\x73\x65\x72\x76\x65\x64","\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x28","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x29","\x76\x69\x73\x69\x74\x6F\x72\x5F\x69\x64","\x75\x6E\x73\x65\x72\x76\x65\x64","\x66\x69\x6E\x64\x4F\x6E\x65","\x72\x6F\x6F\x6D\x5F\x69\x64","\x73\x69\x67\x6E\x65\x64\x5F\x75\x70","\x4F\x50\x45\x4E","","\x6F\x70\x65\x6E\x5F\x73\x74\x61\x74\x65","\x64\x61\x74\x61","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x61\x76\x61\x74\x61\x72","\x6C\x65\x6E\x67\x74\x68","\x61\x67\x65\x6E\x74","\x67\x65\x74\x4D\x65\x73\x73\x61\x67\x65\x73","\x6E\x61\x6D\x65","\x69\x73\x5F\x6E\x65\x77\x5F\x70\x61\x67\x65","\x77\x68\x65\x72\x65","\x6C\x61\x73\x74\x5F\x69\x64","\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65","\x6D\x65\x73\x73\x61\x67\x65","\x4D\x65\x73\x73\x61\x67\x65","\x63\x72\x65\x61\x74\x65","\x73\x69\x67\x6E\x6F\x75\x74\x43\x75\x73\x74\x6F\x6D\x65\x72","\x43\x4C\x4F\x53\x45\x44","\x75\x70\x64\x61\x74\x65","\x73\x69\x67\x6E\x75\x70\x43\x75\x73\x74\x6F\x6D\x65\x72","\x67\x65\x74\x52\x65\x73\x75\x6C\x74","\x75\x73\x65\x72\x2D\x61\x67\x65\x6E\x74","\x68\x65\x61\x64\x65\x72\x73","\x73\x65\x74\x55\x41","\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65","\x70\x61\x72\x73\x65","\x78\x2D\x66\x6F\x72\x77\x61\x72\x64\x65\x64\x2D\x66\x6F\x72","\x72\x65\x6D\x6F\x74\x65\x41\x64\x64\x72\x65\x73\x73","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x69\x70","\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E","\x72\x65\x66\x65\x72\x65\x72","\x77\x65\x62\x63\x68\x61\x74","\x62\x72\x6F\x77\x73\x65\x72","\x20","\x76\x65\x72\x73\x69\x6F\x6E","\x65\x6E\x67\x69\x6E\x65","\x6F\x73","\x6D\x6F\x64\x65\x6C","\x64\x65\x76\x69\x63\x65","\x76\x65\x6E\x64\x6F\x72","\x74\x79\x70\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x64\x61\x74\x61\x31","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x33","\x62\x61\x73\x65\x36\x34","\x75\x6E\x73\x65\x72\x76\x65\x64\x43\x75\x73\x74\x6F\x6D\x65\x72","\x73\x75\x62\x6D\x69\x74\x45\x6E\x71\x75\x69\x72\x79","\x45\x6E\x71\x75\x69\x72\x79","\x65\x6E\x71\x75\x69\x72\x79","\x77\x65\x62\x73\x69\x74\x65\x49\x64","\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x31","\x6C\x61\x62\x65\x6C\x4F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x31","\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x32","\x6C\x61\x62\x65\x6C\x4F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x32","\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x33","\x6C\x61\x62\x65\x6C\x4F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x33","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x63\x6F\x6D\x6D\x69\x74","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x67\x65\x74\x54\x72\x61\x6E\x73\x63\x72\x69\x70\x74","\x55\x73\x65\x72\x49\x64","\x72\x65\x70\x6C\x61\x63\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x74\x65\x78\x74\x2F\x63\x73\x76","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x67\x65\x74\x48\x74\x6D\x6C\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x74\x65\x6D\x70\x6C\x61\x74\x65","\x65\x6E\x71\x75\x69\x72\x79\x5F\x65\x6E\x61\x62\x6C\x65","\x4F\x6E\x6C\x69\x6E\x65","\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x22\x78\x63\x5F\x64\x69\x76\x5F\x67\x72\x6F\x75\x70\x22\x3E","\x3C\x6C\x61\x62\x65\x6C\x20\x63\x6C\x61\x73\x73\x3D\x22\x78\x63\x5F\x6C\x61\x62\x65\x6C\x22\x20\x66\x6F\x72\x3D\x22\x25\x64\x22\x3E\x25\x73\x20\x25\x73\x3C\x2F\x6C\x61\x62\x65\x6C\x3E","\x6C\x61\x62\x65\x6C","\x72\x65\x71\x75\x69\x72\x65\x64","\x2A","\x66\x6F\x72\x6D\x61\x74","\x3C\x69\x6E\x70\x75\x74\x20\x64\x61\x74\x61\x2D\x6C\x61\x62\x65\x6C\x3D\x22\x25\x73\x22\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x22\x20\x69\x64\x3D\x22\x25\x64\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x64\x61\x74\x61\x25\x64\x5D\x22\x20\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72\x3D\x22\x25\x73\x22\x20\x25\x73\x2F\x3E","\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x3C\x2F\x64\x69\x76\x3E","\x74\x65\x78\x74\x49\x6E\x70\x75\x74","\x3C\x74\x65\x78\x74\x61\x72\x65\x61\x20\x69\x64\x3D\x22\x25\x64\x22\x20\x64\x61\x74\x61\x2D\x6C\x61\x62\x65\x6C\x3D\x22\x25\x73\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x64\x61\x74\x61\x25\x64\x5D\x22\x20\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72\x3D\x22\x25\x73\x22\x20\x25\x73\x3E\x3C\x2F\x74\x65\x78\x74\x61\x72\x65\x61\x3E","\x74\x65\x78\x74\x41\x72\x65\x61","\x3C\x6C\x61\x62\x65\x6C\x20\x63\x6C\x61\x73\x73\x3D\x22\x78\x63\x5F\x6C\x61\x62\x65\x6C\x22\x3E\x25\x73\x3C\x2F\x6C\x61\x62\x65\x6C\x3E","\x6F\x70\x74\x69\x6F\x6E\x73","\x3C\x6C\x61\x62\x65\x6C\x20\x73\x74\x79\x6C\x65\x3D\x22\x64\x69\x73\x70\x6C\x61\x79\x3A\x62\x6C\x6F\x63\x6B\x3B\x22\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x63\x68\x65\x63\x6B\x62\x6F\x78\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x64\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E\x20\x25\x73\x3C\x62\x72\x3E","\x3C\x2F\x6C\x61\x62\x65\x6C\x3E","\x63\x68\x65\x63\x6B\x62\x6F\x78","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x72\x61\x64\x69\x6F\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x64\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E\x20\x25\x73\x3C\x62\x72\x3E","\x72\x61\x64\x69\x6F","\x3C\x6C\x61\x62\x65\x6C\x20\x63\x6C\x61\x73\x73\x3D\x22\x78\x63\x5F\x6C\x61\x62\x65\x6C\x22\x20\x66\x6F\x72\x3D\x22\x25\x64\x22\x3E\x25\x73\x3C\x2F\x6C\x61\x62\x65\x6C\x3E","\x3C\x73\x65\x6C\x65\x63\x74\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x64\x61\x74\x61\x25\x64\x5D\x22\x3E","\x3C\x6F\x70\x74\x69\x6F\x6E\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E\x25\x73\x3C\x2F\x6F\x70\x74\x69\x6F\x6E\x3E","\x3C\x2F\x73\x65\x6C\x65\x63\x74\x3E\x3C\x2F\x64\x69\x76\x3E","\x73\x65\x6C\x65\x63\x74","\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74","\x3C\x62\x72\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x68\x69\x64\x64\x65\x6E\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x44\x69\x73\x63\x75\x73\x73\x69\x6F\x6E\x5D\x5B\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E","\x4F\x66\x66\x6C\x69\x6E\x65","\x3C\x6C\x61\x62\x65\x6C\x20\x63\x6C\x61\x73\x73\x3D\x22\x78\x63\x5F\x6C\x61\x62\x65\x6C\x22\x20\x66\x6F\x72\x3D\x22\x6F\x66\x66\x6C\x69\x6E\x65\x25\x64\x22\x3E\x25\x73\x20\x25\x73\x3C\x2F\x6C\x61\x62\x65\x6C\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x64\x61\x74\x61\x2D\x6C\x61\x62\x65\x6C\x3D\x22\x25\x73\x22\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x22\x20\x69\x64\x3D\x22\x6F\x66\x66\x6C\x69\x6E\x65\x25\x64\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72\x3D\x22\x25\x73\x22\x20\x25\x73\x2F\x3E","\x3C\x74\x65\x78\x74\x61\x72\x65\x61\x20\x69\x64\x3D\x22\x6F\x66\x66\x6C\x69\x6E\x65\x25\x64\x22\x20\x64\x61\x74\x61\x2D\x6C\x61\x62\x65\x6C\x3D\x22\x25\x73\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72\x3D\x22\x25\x73\x22\x20\x25\x73\x3E\x3C\x2F\x74\x65\x78\x74\x61\x72\x65\x61\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x63\x68\x65\x63\x6B\x62\x6F\x78\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E\x20\x25\x73\x3C\x62\x72\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x72\x61\x64\x69\x6F\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E\x20\x25\x73\x3C\x62\x72\x3E","\x3C\x73\x65\x6C\x65\x63\x74\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x3E","\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x68\x69\x64\x64\x65\x6E\x22\x20\x6E\x61\x6D\x65\x3D\x22\x64\x61\x74\x61\x5B\x45\x6E\x71\x75\x69\x72\x79\x5D\x5B\x6C\x61\x62\x65\x6C\x4F\x66\x66\x6C\x69\x6E\x65\x44\x61\x74\x61\x25\x64\x5D\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x25\x73\x22\x3E","\x6A\x73\x6F\x6E\x70","\x67\x65\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73\x42\x79\x57\x65\x62\x73\x69\x74\x65","\x73\x65\x74\x52\x61\x74\x69\x6E\x67","\x72\x61\x74\x69\x6E\x67","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x52\x61\x74\x69\x6E\x67","\x61\x62\x61\x6E\x64\x6F\x6E\x43\x75\x73\x74\x6F\x6D\x65\x72","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x69\x6E\x64"];_0x77c2[0];var _=require(_0x77c2[1]);var jsmin=require(_0x77c2[2])[_0x77c2[2]];var Mustache=require(_0x77c2[3]);var querystring=require(_0x77c2[4]);var path=require(_0x77c2[5]);var md5=require(_0x77c2[6]);var fs=require(_0x77c2[7]);var UAParser=require(_0x77c2[8]);var uaParser= new UAParser();var languageParser=require(_0x77c2[9]);var ipaddr=require(_0x77c2[10]);var geoip=require(_0x77c2[11]);var csv=require(_0x77c2[12]);var util=require(_0x77c2[13]);var moment=require(_0x77c2[14]);var config=require(_0x77c2[15]);var Xchatty=require(_0x77c2[17])[_0x77c2[16]];var xchatty_components=require(_0x77c2[18]);var Util=require(_0x77c2[19]);var sequelize=require(_0x77c2[17])[_0x77c2[20]];var User=require(_0x77c2[17])[_0x77c2[21]];var Agent=require(_0x77c2[17])[_0x77c2[21]];var ChatRoom=require(_0x77c2[17])[_0x77c2[22]];var ChatEnquiry=require(_0x77c2[17])[_0x77c2[23]];var ChatVisitor=require(_0x77c2[17])[_0x77c2[24]];var ChatMessage=require(_0x77c2[17])[_0x77c2[25]];var ChatWebsite=require(_0x77c2[17])[_0x77c2[26]];var ChatWebsitesField=require(_0x77c2[17])[_0x77c2[27]];var ChatProactiveAction=require(_0x77c2[17])[_0x77c2[28]];var ReportChatSession=require(_0x77c2[17])[_0x77c2[29]];var id=1;exports[_0x77c2[30]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return Xchatty[_0x77c2[35]]()[_0x77c2[34]](function(_0xe0e0x24){return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[32]](_0xe0e0x24)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[36]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){ChatWebsite[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]])[_0x77c2[34]](function(_0xe0e0x25){_0xe0e0x21[_0x77c2[39]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x77c2[37],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x77c2[38]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0xe0e0x26=xchatty_components[_0x77c2[40]];var _0xe0e0x27={websiteId:_0xe0e0x20[_0x77c2[42]][_0x77c2[41]],rootPath:Util[_0x77c2[44]](_0xe0e0x25[_0x77c2[43]])+_0x77c2[45],signedUp:_0x77c2[46],windowFocused:_0x77c2[46],isNewPage:_0x77c2[47],processingSignUp:_0x77c2[46],processingEnquiry:_0x77c2[46],processingSend:_0x77c2[46],processingRating:_0x77c2[46],visitorFullname:_0x77c2[48],visitorAvatar:_0x77c2[48],timerReadMessages:_0x77c2[49],timerCheckStatus:_0x77c2[49],isOnline:_0x77c2[46],decayHistory:0,defaultTimeout:5000,isInitialStatusCheck:_0x77c2[47],muteNotificationSoundOnce:_0x77c2[46],assetBase:Util[_0x77c2[44]](_0xe0e0x25[_0x77c2[43]])+_0x77c2[50],hasSessionSaf:_0x77c2[46],restoreOpenState:_0x77c2[46],animateHover:_0xe0e0x25[_0x77c2[51]],hideEmail:_0x77c2[46],hideOffline:_0x77c2[46],headerShape:_0xe0e0x25[_0x77c2[52]],HeaderOnline:_0xe0e0x25[_0x77c2[53]],OnlineMessage:_0xe0e0x25[_0x77c2[54]],UsernamePlaceholder:_0xe0e0x25[_0x77c2[55]],EmailPlaceholder:_0xe0e0x25[_0x77c2[56]],StartChatButtonText:_0xe0e0x25[_0x77c2[57]],OfflineMessage:_0xe0e0x25[_0x77c2[58]],HeaderOffline:_0xe0e0x25[_0x77c2[59]],EnquiryMessagePlaceholder:_0xe0e0x25[_0x77c2[60]],EnquiryButtonText:_0xe0e0x25[_0x77c2[61]],downloadTranscript:_0xe0e0x25[_0x77c2[62]],RatingMessage:_0xe0e0x25[_0x77c2[63]],RatingSend:_0xe0e0x25[_0x77c2[64]],RatingSkip:_0xe0e0x25[_0x77c2[65]]};_0xe0e0x26=Mustache[_0x77c2[66]](_0xe0e0x26,_0xe0e0x27);_0xe0e0x21[_0x77c2[32]](_0xe0e0x26)})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[68]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){ChatWebsite[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]])[_0x77c2[34]](function(_0xe0e0x25){_0xe0e0x21[_0x77c2[39]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x77c2[69],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x77c2[38]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0xe0e0x28=xchatty_components[_0x77c2[70]];var _0xe0e0x29={assetBase:Util[_0x77c2[44]](_0xe0e0x25[_0x77c2[43]])+_0x77c2[50],color:_0xe0e0x25[_0x77c2[71]],colorFocus:_0xe0e0x25[_0x77c2[72]],colorButton:_0xe0e0x25[_0x77c2[73]]};_0xe0e0x28=Mustache[_0x77c2[66]](_0xe0e0x28,_0xe0e0x29);_0xe0e0x21[_0x77c2[32]](_0xe0e0x28)})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[74]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){_0xe0e0x21[_0x77c2[83]](path[_0x77c2[82]](config[_0x77c2[75]],_0x77c2[76],_0x77c2[77],_0x77c2[78],_0x77c2[79],_0xe0e0x20[_0x77c2[81]][_0x77c2[80]]))};exports[_0x77c2[84]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){_0xe0e0x21[_0x77c2[39]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x77c2[37],"\x78\x2D\x74\x69\x6D\x65\x73\x74\x61\x6D\x70":Date[_0x77c2[38]](),"\x78\x2D\x73\x65\x6E\x74":true});var _0xe0e0x2a=xchatty_components[_0x77c2[85]];_0xe0e0x21[_0x77c2[32]](_0xe0e0x2a)};exports[_0x77c2[86]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){if(!_0xe0e0x20[_0x77c2[87]][_0x77c2[78]]){_0xe0e0x20[_0x77c2[87]][_0x77c2[78]]={}};var _0xe0e0x2b={};return Agent[_0x77c2[35]]({where:{online:true,role:_0x77c2[106]}})[_0x77c2[34]](function(_0xe0e0x2e){if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[100]]){_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[100]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[100]]===_0x77c2[47]?true:false};_0xe0e0x2b={success:true,has_session_saf:null,signed_up:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]?true:false,fullname:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[102]]?_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[102]]:_0x77c2[99],email:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[103]]?_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[103]]:_0x77c2[99],avatar:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[104]]?_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[104]]:_0x77c2[99],open_state:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[100]]||_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]?true:false,online:_0xe0e0x2e[_0x77c2[105]]?true:false,is_unserved:false,room_id:0};return})[_0x77c2[34]](function(){if(_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]){return ChatRoom[_0x77c2[95]]({where:{ChatVisitorId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]],status:_0x77c2[98],token:{$ne:_0x77c2[99]}}})};return})[_0x77c2[34]](function(_0xe0e0x2d){if(_0xe0e0x2d){_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]=_0xe0e0x2d[_0x77c2[41]];_0xe0e0x2b[_0x77c2[96]]=_0xe0e0x2d[_0x77c2[41]];_0xe0e0x2b[_0x77c2[97]]=true}else {_0xe0e0x2b[_0x77c2[97]]=false};return})[_0x77c2[34]](function(){if(_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]){return ChatVisitor[_0x77c2[95]]({where:{id:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]],status:_0x77c2[94]}})};return})[_0x77c2[34]](function(_0xe0e0x2c){if(_0xe0e0x2c){_0xe0e0x2b[_0x77c2[88]]=true};return _0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x2b)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[107]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){var _0xe0e0x2f={where:{ChatRoomId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]},include:[{model:User,attributes:[_0x77c2[41],_0x77c2[108],_0x77c2[102],_0x77c2[103]]},{model:ChatVisitor,attributes:[_0x77c2[41],_0x77c2[102],_0x77c2[103]]}]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[109]]===_0x77c2[46]){_0xe0e0x2f[_0x77c2[110]][_0x77c2[41]]={$gt:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[111]]}};ChatMessage[_0x77c2[35]](_0xe0e0x2f)[_0x77c2[34]](function(_0xe0e0x30){var _0xe0e0x31={success:true,messages:_0xe0e0x30,composing:false,composing_fullname:null};_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x31)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[112]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){var _0xe0e0x2f={where:{ChatRoomId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]},include:[{model:User,attributes:[_0x77c2[41],_0x77c2[108],_0x77c2[102],_0x77c2[103]]},{model:ChatVisitor,attributes:[_0x77c2[41],_0x77c2[102],_0x77c2[103]]}]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[109]]===_0x77c2[46]){_0xe0e0x2f[_0x77c2[110]][_0x77c2[41]]={$gt:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[111]]}};ChatMessage[_0x77c2[115]]({body:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[114]][_0x77c2[113]],ChatRoomId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]],ChatVisitorId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]})[_0x77c2[34]](function(_0xe0e0x32){ChatMessage[_0x77c2[35]](_0xe0e0x2f)[_0x77c2[34]](function(_0xe0e0x30){var _0xe0e0x31={errors:[],success:true,data:_0xe0e0x32,messages:_0xe0e0x30};_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x31)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[116]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return ChatRoom[_0x77c2[67]](_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]])[_0x77c2[34]](function(_0xe0e0x2d){return _0xe0e0x2d[_0x77c2[118]]({status:_0x77c2[117]})})[_0x77c2[34]](function(){var _0xe0e0x31={success:true,errors:[]};_0xe0e0x20[_0x77c2[87]][_0x77c2[78]]={};_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x31)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[119]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){var _0xe0e0x33=uaParser[_0x77c2[123]](_0xe0e0x20[_0x77c2[122]][_0x77c2[121]])[_0x77c2[120]]();var _0xe0e0x34=languageParser[_0x77c2[125]](_0xe0e0x20[_0x77c2[122]][_0x77c2[124]]);var _0xe0e0x35=_0xe0e0x20[_0x77c2[122]][_0x77c2[126]]?_0xe0e0x20[_0x77c2[122]][_0x77c2[126]]:_0xe0e0x20[_0x77c2[128]][_0x77c2[127]]||_0xe0e0x20[_0x77c2[129]];var _0xe0e0x36={fullname:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[102]],email:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[103]],remote_address:_0xe0e0x35,user_agent:_0xe0e0x20[_0x77c2[122]][_0x77c2[121]],visitor_language:_0xe0e0x20[_0x77c2[122]][_0x77c2[124]],referer:_0xe0e0x20[_0x77c2[122]][_0x77c2[131]],origin:_0x77c2[132],browser:_0xe0e0x33[_0x77c2[133]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[133]][_0x77c2[135]],engine:_0xe0e0x33[_0x77c2[136]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[136]][_0x77c2[135]],os:_0xe0e0x33[_0x77c2[137]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[137]][_0x77c2[135]],device:_0xe0e0x33[_0x77c2[139]][_0x77c2[138]]?_0xe0e0x33[_0x77c2[139]][_0x77c2[138]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[139]][_0x77c2[140]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[139]][_0x77c2[141]]:null,ChatWebsiteId:_0xe0e0x20[_0x77c2[81]][_0x77c2[142]]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[143]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[144]]){_0xe0e0x36[_0x77c2[143]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[143]];_0xe0e0x36[_0x77c2[144]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[144]]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[145]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[146]]){_0xe0e0x36[_0x77c2[145]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[145]];_0xe0e0x36[_0x77c2[146]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[146]]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[147]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[148]]){_0xe0e0x36[_0x77c2[147]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[147]];_0xe0e0x36[_0x77c2[148]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[130]][_0x77c2[148]]};return ChatVisitor[_0x77c2[115]](_0xe0e0x36)[_0x77c2[34]](function(_0xe0e0x37){_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[102]]=_0xe0e0x37[_0x77c2[102]];_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[103]]=_0xe0e0x37[_0x77c2[103]];_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[104]]=md5(_0xe0e0x37[_0x77c2[103]]).toString(_0x77c2[149]);_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]=_0xe0e0x37[_0x77c2[41]];var _0xe0e0x31={success:true,errors:[],chatVisitor:{id:_0xe0e0x37[_0x77c2[41]]}};_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x31)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[150]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return ChatVisitor[_0x77c2[67]](_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]])[_0x77c2[34]](function(_0xe0e0x37){return _0xe0e0x37[_0x77c2[118]]({status:_0x77c2[94]})})[_0x77c2[34]](function(){var _0xe0e0x31={success:true,errors:[]};_0xe0e0x20[_0x77c2[87]][_0x77c2[78]]={};_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]](_0xe0e0x31)+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[151]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return sequelize[_0x77c2[163]]()[_0x77c2[34]](function(_0xe0e0x38){var _0xe0e0x35=_0xe0e0x20[_0x77c2[122]][_0x77c2[126]]?_0xe0e0x20[_0x77c2[122]][_0x77c2[126]]:_0xe0e0x20[_0x77c2[128]][_0x77c2[127]]||_0xe0e0x20[_0x77c2[129]];var _0xe0e0x33=uaParser[_0x77c2[123]](_0xe0e0x20[_0x77c2[122]][_0x77c2[121]])[_0x77c2[120]]();var _0xe0e0x34=languageParser[_0x77c2[125]](_0xe0e0x20[_0x77c2[122]][_0x77c2[124]]);var _0xe0e0x36={fullname:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[102]],email:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[103]],remote_address:_0xe0e0x35,user_agent:_0xe0e0x20[_0x77c2[122]][_0x77c2[121]],visitor_language:_0xe0e0x20[_0x77c2[122]][_0x77c2[124]],browser:_0xe0e0x33[_0x77c2[133]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[133]][_0x77c2[135]],engine:_0xe0e0x33[_0x77c2[136]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[136]][_0x77c2[135]],os:_0xe0e0x33[_0x77c2[137]][_0x77c2[108]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[137]][_0x77c2[135]],device:_0xe0e0x33[_0x77c2[139]][_0x77c2[138]]?_0xe0e0x33[_0x77c2[139]][_0x77c2[138]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[139]][_0x77c2[140]]+_0x77c2[134]+_0xe0e0x33[_0x77c2[139]][_0x77c2[141]]:null,referer:_0xe0e0x20[_0x77c2[122]][_0x77c2[131]],origin:_0x77c2[153],status:_0x77c2[94],ChatWebsiteId:parseInt(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[154]],10),ChatEnquiry:{username:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[102]],email:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[103]],text:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[113]],ChatWebsiteId:parseInt(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[154]],10)}};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[155]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[156]]){_0xe0e0x36[_0x77c2[155]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[155]];_0xe0e0x36[_0x77c2[156]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[156]]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[157]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[158]]){_0xe0e0x36[_0x77c2[157]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[157]];_0xe0e0x36[_0x77c2[158]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[158]]};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[159]]&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[160]]){_0xe0e0x36[_0x77c2[159]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[159]];_0xe0e0x36[_0x77c2[160]]=_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[152]][_0x77c2[160]]};return ChatVisitor[_0x77c2[115]](_0xe0e0x36,{transaction:_0xe0e0x38,include:[{model:ChatEnquiry}]})[_0x77c2[34]](function(){_0xe0e0x38[_0x77c2[162]]();_0xe0e0x21[_0x77c2[32]](_0xe0e0x20[_0x77c2[81]][_0x77c2[89]]+_0x77c2[90]+JSON[_0x77c2[91]]({success:true,errors:[]})+_0x77c2[92])})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x38[_0x77c2[161]]();_0xe0e0x22(_0xe0e0x23)})})};exports[_0x77c2[164]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){if(_0xe0e0x20[_0x77c2[87]][_0x77c2[78]]&&_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]&&_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]){ChatMessage[_0x77c2[35]]({where:{ChatRoomId:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[96]]},include:[{model:Agent,attributes:[_0x77c2[41],_0x77c2[102]]},{model:ChatVisitor,attributes:[_0x77c2[41],_0x77c2[102]]}]})[_0x77c2[34]](function(_0xe0e0x30){var _0xe0e0x39=[];_0xe0e0x30[_0x77c2[170]](function(_0xe0e0x32){var _0xe0e0x3a={name:_0xe0e0x32[_0x77c2[165]]?_0xe0e0x32[_0x77c2[21]][_0x77c2[102]]:_0xe0e0x32[_0x77c2[24]][_0x77c2[102]],text:_0xe0e0x32[_0x77c2[167]][_0x77c2[166]](/(\r\n|\n|\r)/gm,_0x77c2[134]),date:_0xe0e0x32[_0x77c2[168]]};_0xe0e0x39[_0x77c2[169]](_0xe0e0x3a)});var _0xe0e0x3b=csv(_0xe0e0x39);_0xe0e0x21[_0x77c2[141]](_0x77c2[171])[_0x77c2[33]](200)[_0x77c2[32]](_0xe0e0x3b)})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x22(_0xe0e0x23)})}};exports[_0x77c2[172]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return Xchatty[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]])[_0x77c2[34]](function(_0xe0e0x3c){if(!_0xe0e0x3c){return _0xe0e0x21[_0x77c2[173]](404)};return _0xe0e0x21[_0x77c2[32]](_0xe0e0x3c)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[115]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return Xchatty[_0x77c2[115]](_0xe0e0x20[_0x77c2[167]])[_0x77c2[34]](function(_0xe0e0x3c){return _0xe0e0x21[_0x77c2[33]](201)[_0x77c2[32]](_0xe0e0x3c)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[118]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){if(_0xe0e0x20[_0x77c2[167]][_0x77c2[41]]){delete _0xe0e0x20[_0x77c2[167]][_0x77c2[41]]};return Xchatty[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]])[_0x77c2[34]](function(_0xe0e0x3c){if(!_0xe0e0x3c){return _0xe0e0x21[_0x77c2[173]](404)};var _0xe0e0x3d=_[_0x77c2[174]](_0xe0e0x3c,_0xe0e0x20[_0x77c2[167]]);_0xe0e0x3d[_0x77c2[175]]()[_0x77c2[34]](function(){return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[32]](_0xe0e0x3c)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[176]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return Xchatty[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]])[_0x77c2[34]](function(_0xe0e0x3c){if(!_0xe0e0x3c){return _0xe0e0x21[_0x77c2[173]](404)};_0xe0e0x3c[_0x77c2[176]]()[_0x77c2[34]](function(){return _0xe0e0x21[_0x77c2[173]](204)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[177]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){var _0xe0e0x3e=xchatty_components[_0x77c2[178]];return ChatWebsite[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]],{include:[{all:true}]})[_0x77c2[34]](function(_0xe0e0x25){var _0xe0e0x3f={rootPath:Util[_0x77c2[44]](_0xe0e0x25[_0x77c2[43]])+_0x77c2[45],headerShape:_0xe0e0x25[_0x77c2[52]],enquiryEnable:_0xe0e0x25[_0x77c2[179]],onlineFields:_0xe0e0x25[_0x77c2[180]],renderedOnlineField:function(){var _0xe0e0x40=_0x77c2[99];var _0xe0e0x41=this;switch(this[_0x77c2[206]]){case _0x77c2[190]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[182],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[185]:_0x77c2[99]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[187],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[188]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[184]:_0x77c2[99]);_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[192]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[182],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[185]:_0x77c2[99]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[191],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[188]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[184]:_0x77c2[99]);_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[198]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[193],_0xe0e0x41[_0x77c2[183]]);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=_0x77c2[195];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[196],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x42,_0xe0e0x42);_0xe0e0x40+=_0x77c2[197]});_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[200]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[193],_0xe0e0x41[_0x77c2[183]]);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=_0x77c2[195];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[199],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x42,_0xe0e0x42);_0xe0e0x40+=_0x77c2[197]});_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[205]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[201],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[202],_0xe0e0x41[_0x77c2[30]]+1);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[203],_0xe0e0x42,_0xe0e0x42)});_0xe0e0x40+=_0x77c2[204];break};_0xe0e0x40+=_0x77c2[207];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[208],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[183]]);return _0xe0e0x40},offlineFields:_0xe0e0x25[_0x77c2[209]],renderedOfflineField:function(){var _0xe0e0x40=_0x77c2[99];var _0xe0e0x41=this;switch(this[_0x77c2[206]]){case _0x77c2[190]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[210],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[185]:_0x77c2[99]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[211],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[188]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[184]:_0x77c2[99]);_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[192]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[210],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[185]:_0x77c2[99]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[212],_0xe0e0x41[_0x77c2[30]],_0xe0e0x41[_0x77c2[183]],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[188]],_0xe0e0x41[_0x77c2[184]]?_0x77c2[184]:_0x77c2[99]);_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[198]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[193],_0xe0e0x41[_0x77c2[183]]);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=_0x77c2[195];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[213],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x42,_0xe0e0x42);_0xe0e0x40+=_0x77c2[197]});_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[200]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[193],_0xe0e0x41[_0x77c2[183]]);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=_0x77c2[195];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[214],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x42,_0xe0e0x42);_0xe0e0x40+=_0x77c2[197]});_0xe0e0x40+=_0x77c2[189];break;case _0x77c2[205]:_0xe0e0x40=_0x77c2[181];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[193],_0xe0e0x41[_0x77c2[183]]);_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[215],_0xe0e0x41[_0x77c2[30]]+1);_[_0x77c2[170]](_0xe0e0x41[_0x77c2[194]],function(_0xe0e0x42){_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[203],_0xe0e0x42,_0xe0e0x42)});_0xe0e0x40+=_0x77c2[204];break};_0xe0e0x40+=_0x77c2[207];_0xe0e0x40+=util[_0x77c2[186]](_0x77c2[216],_0xe0e0x41[_0x77c2[30]]+1,_0xe0e0x41[_0x77c2[183]]);return _0xe0e0x40}};_0xe0e0x3e=Mustache[_0x77c2[66]](_0xe0e0x3e,_0xe0e0x3f);return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[217]](_0xe0e0x3e)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[218]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return ChatWebsite[_0x77c2[67]](_0xe0e0x20[_0x77c2[42]][_0x77c2[41]],{include:[{model:ChatProactiveAction}]})[_0x77c2[34]](function(_0xe0e0x25){if(!_0xe0e0x25){return _0xe0e0x21[_0x77c2[33]](400)[_0x77c2[217]]({})};return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[217]](_0xe0e0x25.ChatProactiveActions)})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x22(_0xe0e0x23)})};exports[_0x77c2[219]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){return ChatRoom[_0x77c2[67]](_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[222]][_0x77c2[96]])[_0x77c2[34]](function(_0xe0e0x2d){if(!_0xe0e0x2d){return _0xe0e0x21[_0x77c2[33]](400)[_0x77c2[217]]({})};if(_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[222]][_0x77c2[221]](_0x77c2[220])&&_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[222]][_0x77c2[221]](_0x77c2[113])){return _0xe0e0x2d[_0x77c2[118]]({rating:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[222]][_0x77c2[220]],ratingMessage:_0xe0e0x20[_0x77c2[81]][_0x77c2[101]][_0x77c2[222]][_0x77c2[113]]})};return})[_0x77c2[34]](function(){return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[217]]({})})[_0x77c2[31]](function(_0xe0e0x23){return _0xe0e0x21[_0x77c2[33]](400)[_0x77c2[217]](_0xe0e0x23)})};exports[_0x77c2[223]]=function(_0xe0e0x20,_0xe0e0x21,_0xe0e0x22){if(_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[221]](_0x77c2[93])&&_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]>0){return ReportChatSession[_0x77c2[225]]({where:{visitorid:_0xe0e0x20[_0x77c2[87]][_0x77c2[78]][_0x77c2[93]]}})[_0x77c2[34]](function(_0xe0e0x43){return _0xe0e0x43[_0x77c2[118]]({abandonAt:moment()[_0x77c2[186]](_0x77c2[224])})})[_0x77c2[34]](function(){return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[217]]({})})[_0x77c2[31]](function(_0xe0e0x23){_0xe0e0x21[_0x77c2[33]](500)[_0x77c2[217]]({})})};return _0xe0e0x21[_0x77c2[33]](200)[_0x77c2[217]]({})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var jsmin = require('jsmin').jsmin; +var Mustache = require('mustache'); +var querystring = require('querystring'); +var path = require('path'); +var md5 = require('md5'); +var fs = require('fs'); +var UAParser = require('ua-parser-js'); +var uaParser = new UAParser(); +var languageParser = require('accept-language-parser'); +var ipaddr = require('ipaddr.js'); +var geoip = require('geoip-lite'); +var csv = require('to-csv'); +var util = require('util'); +var moment = require('moment'); + +var config = require('../../config/environment'); +var Xchatty = require('../../models').Xchatty; +var xchatty_components = require('../../components/xchatty'); +var Util = require('../../config/util'); + +var sequelize = require('../../models').sequelize; +var User = require('../../models').User; +var Agent = require('../../models').User; +var ChatRoom = require('../../models').ChatRoom; +var ChatEnquiry = require('../../models').ChatEnquiry; +var ChatVisitor = require('../../models').ChatVisitor; +var ChatMessage = require('../../models').ChatMessage; +var ChatWebsite = require('../../models').ChatWebsite; +var ChatWebsitesField = require('../../models').ChatWebsitesField; +var ChatProactiveAction = require('../../models').ChatProactiveAction; +var ReportChatSession = require('../../models').ReportChatSession; + +var id = 1; + +// Get list of xchattys +exports.index = function(req, res, next) { + return Xchatty + .findAll() + .then(function(xchattys) { + return res.status(200).send(xchattys); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.getJsByWebsite = function(req, res, next) { + + // TO DO: Find the configuration of the website and replace configuration in the file + ChatWebsite + .findById(req.params.id) + .then(function(chatWebsite) { + res.set({ + 'Content-Type': 'application/javascript', + 'x-timestamp': Date.now(), + 'x-sent': true + }); + + var js = xchatty_components.js; + /*jshint multistr: true */ + var configJS = { + websiteId: req.params.id, + // rootPath: path.join(chatWebsite.remote, 'api', 'xchatty/'), + rootPath: Util.stripTrailingSlash(chatWebsite.remote) + '/api/xchatty/', + signedUp: 'false', + windowFocused: 'false', + isNewPage: 'true', + processingSignUp: 'false', + processingEnquiry: 'false', + processingSend: 'false', + processingRating: 'false', + visitorFullname: '""', + visitorAvatar: '""', + timerReadMessages: 'null', + timerCheckStatus: 'null', + isOnline: 'false', + decayHistory: 0, + defaultTimeout: 5000, + isInitialStatusCheck: 'true', + muteNotificationSoundOnce: 'false', + assetBase: Util.stripTrailingSlash(chatWebsite.remote) + '/api/xchatty/assets', + hasSessionSaf: 'false', + restoreOpenState: 'false', + animateHover: chatWebsite.animation, + hideEmail: 'false', + hideOffline: 'false', + headerShape: chatWebsite.header_shape, + HeaderOnline: chatWebsite.header_online, + OnlineMessage: chatWebsite.online_message, + UsernamePlaceholder: chatWebsite.username_placeholder, + EmailPlaceholder: chatWebsite.email_placeholder, + StartChatButtonText: chatWebsite.start_chat_button, + OfflineMessage: chatWebsite.offline_message, + HeaderOffline: chatWebsite.header_offline, + EnquiryMessagePlaceholder: chatWebsite.enquiry_message_placeholder, + EnquiryButtonText: chatWebsite.enquiry_button, + downloadTranscript: chatWebsite.download_transcript, + RatingMessage: chatWebsite.rating_message, + RatingSend: chatWebsite.rating_send, + RatingSkip: chatWebsite.rating_skip + }; + + js = Mustache.render(js, configJS); + res.send(js); + + }) + .catch(function(err) { + next(err); + }); + +}; + +exports.getStyleByWebsite = function(req, res, next) { + + // TO DO: Find the configuration of the website and replace configuration in the file + ChatWebsite + .findById(req.params.id) + .then(function(chatWebsite) { + + res.set({ + 'Content-Type': 'text/css', + 'x-timestamp': Date.now(), + 'x-sent': true + }); + + var css = xchatty_components.css; + + var configCSS = { + // assetBase: path.join(chatWebsite.remote, 'api', 'xchatty', + // 'assets'), + assetBase: Util.stripTrailingSlash(chatWebsite.remote) + '/api/xchatty/assets', + color: chatWebsite.color, + colorFocus: chatWebsite.color_focus, + colorButton: chatWebsite.color_button + }; + + css = Mustache.render(css, configCSS); + res.send(css); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.getAssets = function(req, res, next) { + res.download(path.join(config.root, 'server', 'components', 'xchatty', 'assets', req.query.resource)); +}; + +exports.getJqueryLibrary = function(req, res, next) { + + // TODO: Find the configuration of the website and replace configuration in the file + res.set({ + 'Content-Type': 'application/javascript', + 'x-timestamp': Date.now(), + 'x-sent': true + }); + + var jquery = xchatty_components.jquery; + res.send(jquery); + +}; + +exports.getStatus = function(req, res, next) { + + if (!req.session.xchatty) { + req.session.xchatty = {}; + } + + var _jsonResponse = {}; + + return Agent + .findAll({ + where: { + online: true, + role: 'agent' + } + }) + .then(function(agents) { + if (req.query.data.open_state) + req.session.xchatty.open_state = req.query.data.open_state === 'true' ? true : false; + _jsonResponse = { + success: true, + has_session_saf: null, + signed_up: req.session.xchatty.room_id ? true : false, + fullname: req.session.xchatty.fullname ? req.session.xchatty.fullname : '', + email: req.session.xchatty.email ? req.session.xchatty.email : '', + avatar: req.session.xchatty.avatar ? req.session.xchatty.avatar : '', + open_state: req.session.xchatty.open_state || req.session.xchatty.room_id ? true : false, + online: agents.length ? true : false, + is_unserved: false, + room_id: 0 + }; + return; + }) + .then(function() { + if (req.session.xchatty.visitor_id) { + return ChatRoom + .findOne({ + where: { + ChatVisitorId: req.session.xchatty.visitor_id, + status: 'OPEN', + token: { + $ne: '' + } + } + }); + } + return; + }) + .then(function(chatRoom) { + if (chatRoom) { + req.session.xchatty.room_id = chatRoom.id; + _jsonResponse.room_id = chatRoom.id; + _jsonResponse.signed_up = true; + } else { + _jsonResponse.signed_up = false; + } + return; + }) + .then(function() { + if (req.session.xchatty.visitor_id) { + return ChatVisitor + .findOne({ + where: { + id: req.session.xchatty.visitor_id, + status: 'unserved' + } + }) + } + return; + }) + .then(function(visitor) { + if (visitor) { + _jsonResponse.is_unserved = true; + } + return res.send(req.query.callback + '(' + JSON.stringify(_jsonResponse) + ')'); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.getMessages = function(req, res, next) { + + /*jshint multistr: true */ + var condition = { + where: { + ChatRoomId: req.session.xchatty.room_id + }, + include: [{ + model: User, + attributes: ['id', 'name', 'fullname', 'email'] + }, { + model: ChatVisitor, + attributes: ['id', 'fullname', 'email'] + }] + }; + + if (req.query.data.is_new_page === 'false') { + condition.where.id = { + $gt: req.query.data.last_id + }; + } + + ChatMessage + .findAll(condition) + .then(function(chatMessages) { + var json = { + success: true, + messages: chatMessages, + composing: false, + composing_fullname: null + }; + + res.send(req.query.callback + '(' + JSON.stringify(json) + ')'); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.sendMessage = function(req, res, next) { + + /*jshint multistr: true */ + var condition = { + where: { + ChatRoomId: req.session.xchatty.room_id + }, + include: [{ + model: User, + attributes: ['id', 'name', 'fullname', 'email'] + }, { + model: ChatVisitor, + attributes: ['id', 'fullname', 'email'] + }] + }; + + if (req.query.data.is_new_page === 'false') { + condition.where.id = { + $gt: req.query.data.last_id + }; + } + + ChatMessage + .create({ + body: req.query.data.Message.message, + ChatRoomId: req.session.xchatty.room_id, + ChatVisitorId: req.session.xchatty.visitor_id + }) + .then(function(chatMessage) { + ChatMessage + .findAll(condition) + .then(function(chatMessages) { + var json = { + errors: [], + success: true, + data: chatMessage, + messages: chatMessages + }; + + res.send(req.query.callback + '(' + JSON.stringify(json) + ')'); + }) + .catch(function(err) { + next(err); + }); + }) + .catch(function(err) { + next(err); + }); + +}; + +exports.signoutCustomer = function(req, res, next) { + return ChatRoom + .findById(req.session.xchatty.room_id) + .then(function(chatRoom) { + return chatRoom + .update({ + status: 'CLOSED' + }); + }) + .then(function() { + var json = { + success: true, + errors: [] + }; + req.session.xchatty = {}; + res.send(req.query.callback + '(' + JSON.stringify(json) + ')'); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.signupCustomer = function(req, res, next) { + + var ua = uaParser.setUA(req.headers['user-agent']).getResult(); + var languages = languageParser.parse(req.headers['accept-language']); + // var addr = ipaddr.parse(req.connection.remoteAddress); + + var remoteAddress = req.headers['x-forwarded-for'] ? req.headers['x-forwarded-for'] : req.connection.remoteAddress || req.ip; + + // var ipv4Addr = "151.0.175.186"; + // var geo = geoip.lookup(ipv4Addr); + + var body = { + fullname: req.query.data.Discussion.fullname, + email: req.query.data.Discussion.email, + // remote_address: addr, + remote_address: remoteAddress, + user_agent: req.headers['user-agent'], + visitor_language: req.headers['accept-language'], + referer: req.headers.referer, + origin: 'webchat', + browser: ua.browser.name + ' ' + ua.browser.version, + engine: ua.engine.name + ' ' + ua.engine.version, + os: ua.os.name + ' ' + ua.os.version, + device: ua.device.model ? ua.device.model + ' ' + ua.device.vendor + ' ' + ua.device.type : null, + // country: geo.country, + // city: geo.city, + // region: geo.region, + // latitude: geo.ll.length ? geo.ll[0].toString() : null, + // longitude: geo.ll.length ? geo.ll[1].toString() : null, + ChatWebsiteId: req.query.chatWebsiteId + }; + + if (req.query.data.Discussion.data1 && req.query.data.Discussion.labelData1) { + body.data1 = req.query.data.Discussion.data1; + body.labelData1 = req.query.data.Discussion.labelData1; + } + if (req.query.data.Discussion.data2 && req.query.data.Discussion.labelData2) { + body.data2 = req.query.data.Discussion.data2; + body.labelData2 = req.query.data.Discussion.labelData2; + } + if (req.query.data.Discussion.data3 && req.query.data.Discussion.labelData3) { + body.data3 = req.query.data.Discussion.data3; + body.labelData3 = req.query.data.Discussion.labelData3; + } + + return ChatVisitor + .create(body) + .then(function(chatVisitor) { + + req.session.xchatty.fullname = chatVisitor.fullname; + req.session.xchatty.email = chatVisitor.email; + req.session.xchatty.avatar = md5(chatVisitor.email).toString('base64'); + req.session.xchatty.visitor_id = chatVisitor.id; + + var json = { + success: true, + errors: [], + chatVisitor: { + id: chatVisitor.id + } + }; + + /*jshint multistr: true */ + res.send(req.query.callback + '(' + JSON.stringify(json) + ')'); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.unservedCustomer = function(req, res, next) { + return ChatVisitor + .findById(req.session.xchatty.visitor_id) + .then(function(chatVisitor) { + return chatVisitor + .update({ + status: 'unserved' + }); + }) + .then(function() { + var json = { + success: true, + errors: [] + }; + req.session.xchatty = {}; + res.send(req.query.callback + '(' + JSON.stringify(json) + ')'); + }) + .catch(function(err) { + next(err); + }); +}; + +exports.submitEnquiry = function(req, res, next) { + + return sequelize.transaction().then(function(t) { + + var remoteAddress = req.headers['x-forwarded-for'] ? req.headers['x-forwarded-for'] : req.connection.remoteAddress || req.ip; + + var ua = uaParser.setUA(req.headers['user-agent']).getResult(); + var languages = languageParser.parse(req.headers['accept-language']); + var body = { + fullname: req.query.data.Enquiry.fullname, + email: req.query.data.Enquiry.email, + remote_address: remoteAddress, + user_agent: req.headers['user-agent'], + visitor_language: req.headers['accept-language'], + browser: ua.browser.name + ' ' + ua.browser.version, + engine: ua.engine.name + ' ' + ua.engine.version, + os: ua.os.name + ' ' + ua.os.version, + device: ua.device.model ? ua.device.model + ' ' + ua.device.vendor + ' ' + ua.device.type : null, + referer: req.headers.referer, + origin: 'enquiry', + status: 'unserved', + ChatWebsiteId: parseInt(req.query.data.Enquiry.websiteId, 10), + ChatEnquiry: { + username: req.query.data.Enquiry.fullname, + email: req.query.data.Enquiry.email, + text: req.query.data.Enquiry.message, + ChatWebsiteId: parseInt(req.query.data.Enquiry.websiteId, 10) + } + }; + + if (req.query.data.Enquiry.offlineData1 && req.query.data.Enquiry.labelOfflineData1) { + body.offlineData1 = req.query.data.Enquiry.offlineData1; + body.labelOfflineData1 = req.query.data.Enquiry.labelOfflineData1; + } + if (req.query.data.Enquiry.offlineData2 && req.query.data.Enquiry.labelOfflineData2) { + body.offlineData2 = req.query.data.Enquiry.offlineData2; + body.labelOfflineData2 = req.query.data.Enquiry.labelOfflineData2; + } + if (req.query.data.Enquiry.offlineData3 && req.query.data.Enquiry.labelOfflineData3) { + body.offlineData3 = req.query.data.Enquiry.offlineData3; + body.labelOfflineData3 = req.query.data.Enquiry.labelOfflineData3; + } + + return ChatVisitor + .create(body, { + transaction: t, + include: [{ + model: ChatEnquiry + }] + }) + .then(function() { + t.commit(); + res.send(req.query.callback + '(' + JSON.stringify({ + success: true, + errors: [] + }) + ')'); + }) + .catch(function(err) { + t.rollback(); + next(err); + }); + }); +}; + +exports.getTranscript = function(req, res, next) { + if (req.session.xchatty && req.session.xchatty.visitor_id && req.session.xchatty.room_id) { + ChatMessage + .findAll({ + where: { + ChatRoomId: req.session.xchatty.room_id + }, + include: [{ + model: Agent, + attributes: ['id', 'fullname'] + }, { + model: ChatVisitor, + attributes: ['id', 'fullname'] + }] + }) + .then(function(chatMessages) { + var chatMessageForCSV = []; + chatMessages.forEach(function(chatMessage) { + var chatMsg = { + name: chatMessage.UserId ? chatMessage.User.fullname : chatMessage.ChatVisitor.fullname, + text: chatMessage.body.replace(/(\r\n|\n|\r)/gm, " "), + date: chatMessage.createdAt + }; + chatMessageForCSV.push(chatMsg); + }); + var csv_transcript = csv(chatMessageForCSV); + res.type('text/csv').status(200).send(csv_transcript); + }) + .catch(function(err) { + next(err); + }); + } +}; + +// Get a single xchatty +exports.show = function(req, res, next) { + return Xchatty + .findById(req.params.id) + .then(function(xchatty) { + if (!xchatty) { + return res.sendStatus(404); + } + return res.send(xchatty); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Creates a new xchatty in the DB. +exports.create = function(req, res, next) { + return Xchatty + .create(req.body) + .then(function(xchatty) { + return res.status(201).send(xchatty); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Updates an existing xchatty in the DB. +exports.update = function(req, res, next) { + if (req.body.id) { + delete req.body.id; + } + + return Xchatty + .findById(req.params.id) + .then(function(xchatty) { + if (!xchatty) { + return res.sendStatus(404); + } + var updated = _.merge(xchatty, req.body); + updated.save() + .then(function() { + return res.status(200).send(xchatty); + }) + .catch(function(err) { + return next(err); + }); + }) + .catch(function(err) { + return next(err); + }); +}; + +// Deletes a xchatty from the DB. +exports.destroy = function(req, res, next) { + return Xchatty + .findById(req.params.id) + .then(function(xchatty) { + if (!xchatty) { + return res.sendStatus(404); + } + xchatty.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return next(err); + }); + }) + .catch(function(err) { + return next(err); + }); +}; + + +exports.getHtmlByWebsite = function(req, res, next) { + var template = xchatty_components.template; + return ChatWebsite + .findById(req.params.id, { + include: [{ + all: true + }] + }) + .then(function(chatWebsite) { + var configWebsite = { + rootPath: Util.stripTrailingSlash(chatWebsite.remote) + '/api/xchatty/', + headerShape: chatWebsite.header_shape, + enquiryEnable: chatWebsite.enquiry_enable, + onlineFields: chatWebsite.Online, + renderedOnlineField: function() { + var renderedElement = ''; + var element = this; + switch (this.component) { + case 'textInput': + renderedElement = '
'; + renderedElement += util.format('', element.index, element.label, element.required ? '*' : ''); + renderedElement += util.format('', element.label, element.index, element.index + + 1, + element.placeholder, element.required ? + 'required' : + ''); + renderedElement += '
'; + break; + case 'textArea': + renderedElement = '
'; + renderedElement += util.format('', element.index, element.label, element.required ? '*' : ''); + renderedElement += util.format('', element.index, element.label, element.index + + 1, + element.placeholder, element.required ? + 'required' : + ''); + renderedElement += '
'; + break; + case 'checkbox': + renderedElement = '
'; + renderedElement += util.format('', element.label); + _.forEach(element.options, function(item) { + renderedElement += ''; + }); + renderedElement += '
'; + break; + case 'radio': + renderedElement = '
'; + renderedElement += util.format('', element.label); + _.forEach(element.options, function(item) { + renderedElement += ''; + }); + renderedElement += '
'; + break; + case 'select': + renderedElement = '
'; + renderedElement += util.format('', element.index, element.label); + renderedElement += util.format('
'; + break; + } + renderedElement += '
'; + renderedElement += util.format('', element.index + 1, element.label); + return renderedElement; + }, + offlineFields: chatWebsite.Offline, + renderedOfflineField: function() { + var renderedElement = ''; + var element = this; + switch (this.component) { + case 'textInput': + renderedElement = '
'; + renderedElement += util.format('', element.index, element.label, element.required ? '*' : ''); + renderedElement += util.format('', element.label, element.index, + element.index + + 1, + element.placeholder, element.required ? + 'required' : + ''); + renderedElement += '
'; + break; + case 'textArea': + renderedElement = '
'; + renderedElement += util.format('', element.index, element.label, element.required ? '*' : ''); + renderedElement += util.format('', element.index, element.label, + element.index + + 1, + element.placeholder, element.required ? + 'required' : + ''); + renderedElement += '
'; + break; + case 'checkbox': + renderedElement = '
'; + renderedElement += util.format('', element.label); + _.forEach(element.options, function(item) { + renderedElement += ''; + }); + renderedElement += '
'; + break; + case 'radio': + renderedElement = '
'; + renderedElement += util.format('', element.label); + _.forEach(element.options, function(item) { + renderedElement += ''; + }); + renderedElement += '
'; + break; + case 'select': + renderedElement = '
'; + renderedElement += util.format('', element.label); + renderedElement += util.format('
'; + break; + } + renderedElement += '
'; + renderedElement += util.format('', element.index + 1, element.label); + return renderedElement; + } + }; + template = Mustache.render(template, configWebsite); + return res.status(200).jsonp(template); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.getProactiveActionsByWebsite = function(req, res, next) { + return ChatWebsite + .findById(req.params.id, { + include: [{ + model: ChatProactiveAction + }] + }) + .then(function(chatWebsite) { + if (!chatWebsite) { + return res.status(400).jsonp({}); + } + return res.status(200).jsonp(chatWebsite.ChatProactiveActions); + }) + .catch(function(err) { + return next(err); + }); +}; + +exports.setRating = function(req, res, next) { + return ChatRoom + .findById(req.query.data.Rating.room_id) + .then(function(chatRoom) { + if (!chatRoom) { + return res.status(400).jsonp({}); + } + if (req.query.data.Rating.hasOwnProperty('rating') && req.query.data.Rating.hasOwnProperty('message')) { + return chatRoom + .update({ + rating: req.query.data.Rating.rating, + ratingMessage: req.query.data.Rating.message + }); + } + return; + }) + .then(function() { + return res.status(200).jsonp({}); + }) + .catch(function(err) { + return res.status(400).jsonp(err); + }); +} + +exports.abandonCustomer = function(req, res, next) { + if (req.session.xchatty.hasOwnProperty('visitor_id') && req.session.xchatty.visitor_id > 0) { + return ReportChatSession + .find({ + where: { + visitorid: req.session.xchatty.visitor_id + } + }) + .then(function(reportChatSession) { + return reportChatSession + .update({ + abandonAt: moment().format("YYYY-MM-DD HH:mm:ss") + }); + }) + .then(function() { + return res.status(200).jsonp({}); + }) + .catch(function(err) { + res.status(500).jsonp({}); + }); + } + return res.status(200).jsonp({}); +} diff --git a/server/api/xchatty/xchatty.socket.js b/server/api/xchatty/xchatty.socket.js index d62b659..b8ec557 100644 --- a/server/api/xchatty/xchatty.socket.js +++ b/server/api/xchatty/xchatty.socket.js @@ -1 +1,24 @@ -var _0x8e2e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x58\x63\x68\x61\x74\x74\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x78\x63\x68\x61\x74\x74\x79\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x78\x63\x68\x61\x74\x74\x79\x3A\x72\x65\x6D\x6F\x76\x65"];_0x8e2e[0];var xchatty=require(_0x8e2e[2])[_0x8e2e[1]];exports[_0x8e2e[3]]=function(_0xde6bx2){};function onSave(_0xde6bx2,_0xde6bx4,_0xde6bx5){_0xde6bx2[_0x8e2e[5]](_0x8e2e[4],_0xde6bx4)}function onRemove(_0xde6bx2,_0xde6bx4,_0xde6bx5){_0xde6bx2[_0x8e2e[5]](_0x8e2e[6],_0xde6bx4)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var xchatty = require('../../models').Xchatty; + +exports.register = function(socket) { + // xchatty.afterCreate(function (doc) { + // onSave(socket, doc); + // }); + // xchatty.afterDestroy(function (doc) { + // onRemove(socket, doc); + // }); +} + +function onSave(socket, doc, cb) { + socket.emit('xchatty:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('xchatty:remove', doc); +} diff --git a/server/api/zendesk_account/index.js b/server/api/zendesk_account/index.js index 68f7291..1d3a00a 100644 --- a/server/api/zendesk_account/index.js +++ b/server/api/zendesk_account/index.js @@ -1 +1,32 @@ -var _0x30ee=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x2F\x3A\x69\x64\x2F\x63\x68\x65\x63\x6B","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2F\x3A\x69\x64\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74\x41\x63\x63\x6F\x75\x6E\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x63\x69\x64","\x67\x65\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x76\x61\x6C\x69\x64\x61\x74\x65\x2F\x3A\x66\x69\x65\x6C\x64","\x7A\x65\x6E\x64\x65\x73\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x70\x6F\x73\x74","\x63\x72\x65\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x63\x69\x64\x2F\x3A\x74\x79\x70\x65","\x63\x72\x65\x61\x74\x65\x46\x69\x65\x6C\x64","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x63\x69\x64\x2F\x74\x61\x67\x73","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x54\x61\x67\x73","\x2F\x3A\x69\x64\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73\x2F\x3A\x63\x69\x64\x2F\x66\x69\x65\x6C\x64\x73\x2F\x3A\x66\x69\x64","\x75\x70\x64\x61\x74\x65\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x64\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79\x46\x69\x65\x6C\x64","\x65\x78\x70\x6F\x72\x74\x73"];_0x30ee[0];var express=require(_0x30ee[1]);var auth=require(_0x30ee[2]);var controller=require(_0x30ee[3]);var router=express.Router();router[_0x30ee[7]](_0x30ee[4],auth[_0x30ee[5]](),controller[_0x30ee[6]]);router[_0x30ee[7]](_0x30ee[8],auth[_0x30ee[5]](),controller[_0x30ee[9]]);router[_0x30ee[7]](_0x30ee[10],auth[_0x30ee[5]](),controller[_0x30ee[11]]);router[_0x30ee[7]](_0x30ee[12],auth[_0x30ee[5]](),controller[_0x30ee[13]]);router[_0x30ee[7]](_0x30ee[14],auth[_0x30ee[5]](),controller[_0x30ee[15]]);router[_0x30ee[7]](_0x30ee[16],auth[_0x30ee[5]](),controller[_0x30ee[17]]);router[_0x30ee[20]](_0x30ee[18],auth[_0x30ee[5]](),controller[_0x30ee[19]]);router[_0x30ee[20]](_0x30ee[4],auth[_0x30ee[5]](),controller[_0x30ee[21]]);router[_0x30ee[20]](_0x30ee[14],auth[_0x30ee[5]](),controller[_0x30ee[22]]);router[_0x30ee[20]](_0x30ee[23],auth[_0x30ee[5]](),controller[_0x30ee[24]]);router[_0x30ee[26]](_0x30ee[8],auth[_0x30ee[5]](),controller[_0x30ee[25]]);router[_0x30ee[26]](_0x30ee[27],auth[_0x30ee[5]](),controller[_0x30ee[28]]);router[_0x30ee[26]](_0x30ee[29],auth[_0x30ee[5]](),controller[_0x30ee[30]]);router[_0x30ee[31]](_0x30ee[8],auth[_0x30ee[5]](),controller[_0x30ee[25]]);router[_0x30ee[31]](_0x30ee[29],auth[_0x30ee[5]](),controller[_0x30ee[30]]);router[_0x30ee[33]](_0x30ee[4],auth[_0x30ee[5]](),controller[_0x30ee[32]]);router[_0x30ee[33]](_0x30ee[8],auth[_0x30ee[5]](),controller[_0x30ee[34]]);router[_0x30ee[33]](_0x30ee[14],auth[_0x30ee[5]](),controller[_0x30ee[35]]);router[_0x30ee[33]](_0x30ee[16],auth[_0x30ee[5]](),controller[_0x30ee[36]]);router[_0x30ee[33]](_0x30ee[29],auth[_0x30ee[5]](),controller[_0x30ee[37]]);module[_0x30ee[38]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var auth = require('../../auth/auth.service'); +var controller = require('./zendesk_account.controller'); + +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.get('/:id/check', auth.isAuthenticated(), controller.checkAccount); +router.get('/:id/fields', auth.isAuthenticated(), controller.getFields); +router.get('/:id/configurations', auth.isAuthenticated(), controller.getAccountConfigurations); +router.get('/:id/configurations/:cid', auth.isAuthenticated(), controller.getConfiguration); +router.post('/validate/:field', auth.isAuthenticated(), controller.zendeskValidation); +router.post('/', auth.isAuthenticated(), controller.create); +router.post('/:id/configurations', auth.isAuthenticated(), controller.createConfiguration); +router.post('/:id/configurations/:cid/:type', auth.isAuthenticated(), controller.createField); +router.put('/:id', auth.isAuthenticated(), controller.update); +// router.put('/:id/configurations/:cid', auth.isAuthenticated(), controller.updateConfiguration); +router.put('/:id/configurations/:cid/tags', auth.isAuthenticated(), controller.addConfigurationTags); +router.put('/:id/configurations/:cid/fields/:fid', auth.isAuthenticated(), controller.updateField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +// router.patch('/:id/configurations/:cid', auth.isAuthenticated(), controller.updateConfiguration); +router.patch('/:id/configurations/:cid/fields/:fid', auth.isAuthenticated(), controller.updateField); +router.delete('/', auth.isAuthenticated(), controller.bulkDestroy); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.delete('/:id/configurations', auth.isAuthenticated(), controller.bulkDestroyConfigurations); +router.delete('/:id/configurations/:cid', auth.isAuthenticated(), controller.destroyConfiguration); +router.delete('/:id/configurations/:cid/fields/:fid', auth.isAuthenticated(), controller.destroyField); + +module.exports = router; diff --git a/server/api/zendesk_account/zendesk_account.controller.js b/server/api/zendesk_account/zendesk_account.controller.js index 9436b5b..78030cd 100644 --- a/server/api/zendesk_account/zendesk_account.controller.js +++ b/server/api/zendesk_account/zendesk_account.controller.js @@ -1 +1,316 @@ -var _0xd4a6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x6E\x6F\x64\x65\x2D\x7A\x65\x6E\x64\x65\x73\x6B","\x5A\x65\x6E\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x45\x72\x72\x6F\x72\x3A","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x7A\x65\x6E\x64\x65\x73\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x63\x6F\x75\x6E\x74","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x61\x75\x74\x68\x54\x79\x70\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x74\x6F\x6B\x65\x6E","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x65\x6E\x74","\x76\x65\x72\x69\x66\x69\x65\x64","\x61\x75\x74\x68","\x75\x73\x65\x72\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x6C\x69\x73\x74","\x74\x69\x63\x6B\x65\x74\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x41\x63\x63\x6F\x75\x6E\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x61\x63\x63\x6F\x75\x6E\x74","\x67\x65\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x63\x69\x64","\x64\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x63\x72\x65\x61\x74\x65\x46\x69\x65\x6C\x64","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x73\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x49\x64","\x74\x79\x70\x65","\x75\x70\x64\x61\x74\x65\x46\x69\x65\x6C\x64","\x66\x69\x64","\x64\x65\x73\x74\x72\x6F\x79\x46\x69\x65\x6C\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x54\x61\x67\x73","\x73\x65\x74\x54\x61\x67\x73"];_0xd4a6[0];var _=require(_0xd4a6[1]);var Util=require(_0xd4a6[2]);var zendesk=require(_0xd4a6[3]);var ZendeskAccount=require(_0xd4a6[5])[_0xd4a6[4]];var ZendeskConfiguration=require(_0xd4a6[5])[_0xd4a6[6]];var ZendeskField=require(_0xd4a6[5])[_0xd4a6[7]];function handleError(_0xc540x8,_0xc540x9){_0xc540x9=_0xc540x9||500;return function(_0xc540xa){console[_0xd4a6[9]](_0xd4a6[8],_0xc540xa);_0xc540x8[_0xd4a6[11]](_0xc540x9)[_0xd4a6[10]](_0xc540xa)}}function responseWithResult(_0xc540x8,_0xc540x9){_0xc540x9=_0xc540x9||200;return function(_0xc540xc){if(_0xc540xc){_0xc540x8[_0xd4a6[11]](_0xc540x9)[_0xd4a6[12]](_0xc540xc)}}}function responseWithoutResult(_0xc540x8,_0xc540x9){_0xc540x9=_0xc540x9||200;return function(){_0xc540x8[_0xd4a6[13]](_0xc540x9)}}function handleEntityNotFound(_0xc540x8){return function(_0xc540xc){if(!_0xc540xc){_0xc540x8[_0xd4a6[11]](404)[_0xd4a6[14]]();return null};return _0xc540xc}}function saveUpdates(_0xc540x10){return function(_0xc540xc){return _0xc540xc[_0xd4a6[16]](_0xc540x10)[_0xd4a6[15]](function(_0xc540x11){return _0xc540x11})}}function removeEntity(_0xc540x8){return function(_0xc540xc){if(_0xc540xc){return _0xc540xc[_0xd4a6[17]]()[_0xd4a6[15]](function(){_0xc540x8[_0xd4a6[11]](204)[_0xd4a6[14]]()})}}}exports[_0xd4a6[18]]=function(_0xc540x13,_0xc540x8,_0xc540x14){return ZendeskAccount[_0xd4a6[24]](_0xd4a6[23])[_0xd4a6[22]](Util[_0xd4a6[21]](_0xc540x13[_0xd4a6[20]]))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[25]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[26]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[29]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[29]](_0xc540x13[_0xd4a6[30]])[_0xd4a6[15]](responseWithResult(_0xc540x8,201))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[31]]=function(_0xc540x13,_0xc540x8){if(_0xc540x13[_0xd4a6[30]][_0xd4a6[26]]){delete _0xc540x13[_0xd4a6[30]][_0xd4a6[26]]};return ZendeskAccount[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[26]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](saveUpdates(_0xc540x13[_0xd4a6[30]]))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[17]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[26]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](removeEntity(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[32]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[17]]({where:{id:_0xc540x13[_0xd4a6[20]][_0xd4a6[33]]},individualHooks:true})[_0xd4a6[15]](responseWithResult(_0xc540x8,204))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[34]]=function(_0xc540x13,_0xc540x8){var _0xc540x15={};_0xc540x15[_0xc540x13[_0xd4a6[27]][_0xd4a6[35]]]=_0xc540x13[_0xd4a6[30]][_0xd4a6[36]];return ZendeskAccount[_0xd4a6[22]]({where:_0xc540x15})[_0xd4a6[15]](function(_0xc540x16){if(_0xc540x16[_0xd4a6[37]]){return _0xc540x8[_0xd4a6[11]](200)[_0xd4a6[10]]({isValid:false,value:_0xc540x13[_0xd4a6[30]][_0xd4a6[36]]})};return _0xc540x8[_0xd4a6[11]](200)[_0xd4a6[10]]({isValid:true,value:_0xc540x13[_0xd4a6[30]][_0xd4a6[36]]})})[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[38]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[26]])[_0xd4a6[15]](function(_0xc540x17){var _0xc540x18={username:_0xc540x17[_0xd4a6[39]],remoteUri:_0xc540x17[_0xd4a6[40]]};if(_0xc540x17[_0xd4a6[41]]===_0xd4a6[42]){_0xc540x18[_0xd4a6[42]]=_0xc540x17[_0xd4a6[42]]}else {if(_0xc540x17[_0xd4a6[41]]===_0xd4a6[43]){_0xc540x18[_0xd4a6[43]]=_0xc540x17[_0xd4a6[43]]}};var _0xc540x19=zendesk[_0xd4a6[44]](_0xc540x18);_0xc540x19[_0xd4a6[47]][_0xd4a6[46]](function(_0xc540xa,_0xc540x1a,_0xc540x16){if(_0xc540xa){console[_0xd4a6[9]](_0xc540xa);return handleError(_0xc540x8,_0xc540xa)};if(!_0xc540x16[_0xd4a6[45]]){return _0xc540x8[_0xd4a6[13]](500)};return _0xc540x8[_0xd4a6[13]](204)})})[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[48]]=function(_0xc540x13,_0xc540x8){return ZendeskAccount[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[26]])[_0xd4a6[15]](function(_0xc540x17){var _0xc540x18={username:_0xc540x17[_0xd4a6[39]],remoteUri:_0xc540x17[_0xd4a6[40]]};if(_0xc540x17[_0xd4a6[41]]===_0xd4a6[42]){_0xc540x18[_0xd4a6[42]]=_0xc540x17[_0xd4a6[42]]}else {if(_0xc540x17[_0xd4a6[41]]===_0xd4a6[43]){_0xc540x18[_0xd4a6[43]]=_0xc540x17[_0xd4a6[43]]}};var _0xc540x19=zendesk[_0xd4a6[44]](_0xc540x18);_0xc540x19[_0xd4a6[50]][_0xd4a6[49]](function(_0xc540xa,_0xc540x1a,_0xc540x16){if(_0xc540xa){console[_0xd4a6[9]](_0xc540xa);return handleError(_0xc540x8,_0xc540xa)};return _0xc540x8[_0xd4a6[11]](200)[_0xd4a6[10]](_0xc540x16)})})[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[51]]=function(_0xc540x13,_0xc540x8){return ZendeskConfiguration[_0xd4a6[24]]({method:[_0xd4a6[52],_0xc540x13[_0xd4a6[27]][_0xd4a6[26]]]})[_0xd4a6[22]](Util[_0xd4a6[21]](_0xc540x13[_0xd4a6[20]]))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[53]]=function(_0xc540x13,_0xc540x8){return ZendeskConfiguration[_0xd4a6[24]]({method:[_0xd4a6[52],_0xc540x13[_0xd4a6[27]][_0xd4a6[26]]]})[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[54]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[55]]=function(_0xc540x13,_0xc540x8){return ZendeskConfiguration[_0xd4a6[24]]({method:[_0xd4a6[52],_0xc540x13[_0xd4a6[27]][_0xd4a6[26]]]})[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[54]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](removeEntity(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[56]]=function(_0xc540x13,_0xc540x8){return ZendeskConfiguration[_0xd4a6[17]]({where:{id:_0xc540x13[_0xd4a6[20]][_0xd4a6[33]]},individualHooks:true})[_0xd4a6[15]](responseWithResult(_0xc540x8,204))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[57]]=function(_0xc540x13,_0xc540x8){_0xc540x13[_0xd4a6[30]][_0xd4a6[58]]=_0xc540x13[_0xd4a6[27]][_0xd4a6[26]];return ZendeskConfiguration[_0xd4a6[29]](_0xc540x13[_0xd4a6[30]])[_0xd4a6[15]](responseWithResult(_0xc540x8,201))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[59]]=function(_0xc540x13,_0xc540x8){return ZendeskConfiguration[_0xd4a6[24]]({method:[_0xd4a6[52],_0xc540x13[_0xd4a6[27]][_0xd4a6[26]]]})[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[54]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](function(_0xc540x1b){switch(_0xc540x13[_0xd4a6[27]][_0xd4a6[65]]){case _0xd4a6[61]:_0xc540x13[_0xd4a6[30]][_0xd4a6[60]]=_0xc540x13[_0xd4a6[27]][_0xd4a6[54]];break;case _0xd4a6[63]:_0xc540x13[_0xd4a6[30]][_0xd4a6[62]]=_0xc540x13[_0xd4a6[27]][_0xd4a6[54]];break;case _0xd4a6[35]:_0xc540x13[_0xd4a6[30]][_0xd4a6[64]]=_0xc540x13[_0xd4a6[27]][_0xd4a6[54]];break};return ZendeskField[_0xd4a6[29]](_0xc540x13[_0xd4a6[30]])})[_0xd4a6[15]](responseWithResult(_0xc540x8,201))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[66]]=function(_0xc540x13,_0xc540x8){if(_0xc540x13[_0xd4a6[30]][_0xd4a6[26]]){delete _0xc540x13[_0xd4a6[30]][_0xd4a6[26]]};return ZendeskField[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[67]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](saveUpdates(_0xc540x13[_0xd4a6[30]]))[_0xd4a6[15]](responseWithResult(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[68]]=function(_0xc540x13,_0xc540x8){return ZendeskField[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[67]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](removeEntity(_0xc540x8))[_0xd4a6[19]](handleError(_0xc540x8))};exports[_0xd4a6[69]]=function(_0xc540x13,_0xc540x8,_0xc540x14){return ZendeskConfiguration[_0xd4a6[28]](_0xc540x13[_0xd4a6[27]][_0xd4a6[54]])[_0xd4a6[15]](handleEntityNotFound(_0xc540x8))[_0xd4a6[15]](function(_0xc540x1b){return _0xc540x1b[_0xd4a6[70]](_0xc540x13[_0xd4a6[30]])})[_0xd4a6[15]](responseWithoutResult(_0xc540x8,200))[_0xd4a6[19]](function(_0xc540xa){console[_0xd4a6[9]](_0xc540xa);return handleError(_0xc540x8,_0xc540xa)})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('../../config/util'); +var zendesk = require('node-zendesk'); + +var ZendeskAccount = require('../../models').ZendeskAccount; +var ZendeskConfiguration = require('../../models').ZendeskConfiguration; +var ZendeskField = require('../../models').ZendeskField; + +function handleError(res, statusCode) { + statusCode = statusCode || 500; + return function(err) { + console.error('Error:', err); + res.status(statusCode).send(err); + }; +} + +function responseWithResult(res, statusCode) { + statusCode = statusCode || 200; + return function(entity) { + if (entity) { + res.status(statusCode).json(entity); + } + }; +} + +function responseWithoutResult(res, statusCode) { + statusCode = statusCode || 200; + return function() { + res.sendStatus(statusCode); + }; +} + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function saveUpdates(updates) { + return function(entity) { + return entity.updateAttributes(updates) + .then(function(updated) { + return updated; + }); + }; +} + +function removeEntity(res) { + return function(entity) { + if (entity) { + return entity.destroy() + .then(function() { + res.status(204).end(); + }); + } + }; +} + +// Get list of zendesk_accounts +exports.index = function(req, res, next) { + return ZendeskAccount + .scope('configurations') + .findAndCountAll(Util.getQuery(req.query)) + .then(responseWithResult(res)) + .catch(handleError(res)); +}; + +// Get a single zendesk_account +exports.show = function(req, res) { + return ZendeskAccount + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +}; + +// Creates a new zendesk_account in the DB. +exports.create = function(req, res) { + return ZendeskAccount + .create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +}; + +// Updates an existing zendesk_account in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ZendeskAccount + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +}; + +// Deletes a zendesk_account from the DB. +exports.destroy = function(req, res) { + return ZendeskAccount + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +}; + +exports.bulkDestroy = function(req, res) { + return ZendeskAccount + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(responseWithResult(res, 204)) + .catch(handleError(res)); +}; + +exports.zendeskValidation = function(req, res) { + var where = {}; + where[req.params.field] = req.body.value; + return ZendeskAccount + .findAndCountAll({ + where: where + }) + .then(function(result) { + if (result.count) { + return res.status(200).send({ + isValid: false, + value: req.body.value + }); + } + return res.status(200).send({ + isValid: true, + value: req.body.value + }); + }) + .catch(handleError(res)); + +}; + +exports.checkAccount = function(req, res) { + return ZendeskAccount + .findById(req.params.id) + .then(function(account) { + var accountZendesk = { + username: account.username, + remoteUri: account.remoteUri, + // debug: true + }; + if (account.authType === 'password') { + accountZendesk.password = account.password; + } else if (account.authType === 'token') { + accountZendesk.token = account.token; + // accountZendesk.oauth = true; + } + // console.log(accountZendesk); + var client = zendesk.createClient(accountZendesk); + client.users.auth(function(err, res2, result) { + if (err) { + console.error(err); + return handleError(res, err); + } + // console.log(result); + if (!result.verified) { + return res.sendStatus(500); + } + return res.sendStatus(204); + }); + }) + .catch(handleError(res)); +}; + +exports.getFields = function(req, res) { + return ZendeskAccount + .findById(req.params.id) + .then(function(account) { + var accountZendesk = { + username: account.username, + remoteUri: account.remoteUri, + // debug: true + }; + if (account.authType === 'password') { + accountZendesk.password = account.password; + } else if (account.authType === 'token') { + accountZendesk.token = account.token; + } + var client = zendesk.createClient(accountZendesk); + client.ticketfields.list(function(err, res2, result) { + if (err) { + console.error(err); + return handleError(res, err); + } + return res.status(200).send(result); + }); + }) + .catch(handleError(res)); +} + +exports.getAccountConfigurations = function(req, res) { + return ZendeskConfiguration + .scope({ + method: ['account', req.params.id] + }) + .findAndCountAll(Util.getQuery(req.query)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +exports.getConfiguration = function(req, res) { + + return ZendeskConfiguration + .scope({ + method: ['account', req.params.id] + }) + .findById(req.params.cid) + .then(handleEntityNotFound(res)) + .then(responseWithResult(res)) + .catch(handleError(res)); +} + +exports.destroyConfiguration = function(req, res) { + return ZendeskConfiguration + .scope({ + method: ['account', req.params.id] + }) + .findById(req.params.cid) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +}; + +exports.bulkDestroyConfigurations = function(req, res) { + return ZendeskConfiguration + .destroy({ + where: { + id: req.query.ids + }, + individualHooks: true + }) + .then(responseWithResult(res, 204)) + .catch(handleError(res)); +}; + +exports.createConfiguration = function(req, res) { + req.body['AccountId'] = req.params.id; + return ZendeskConfiguration + .create(req.body) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +}; + +exports.createField = function(req, res) { + return ZendeskConfiguration + .scope({ + method: ['account', req.params.id] + }) + .findById(req.params.cid) + .then(handleEntityNotFound(res)) + .then(function(configuration) { + switch (req.params.type) { + case 'subject': + req.body['SubjectId'] = req.params.cid; + break; + case 'description': + req.body['DescriptionId'] = req.params.cid; + break; + case 'field': + req.body['FieldId'] = req.params.cid; + break; + } + return ZendeskField.create(req.body); + }) + .then(responseWithResult(res, 201)) + .catch(handleError(res)); +}; + +exports.updateField = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + return ZendeskField + .findById(req.params.fid) + .then(handleEntityNotFound(res)) + .then(saveUpdates(req.body)) + .then(responseWithResult(res)) + .catch(handleError(res)); +}; + +exports.destroyField = function(req, res) { + return ZendeskField + .findById(req.params.fid) + .then(handleEntityNotFound(res)) + .then(removeEntity(res)) + .catch(handleError(res)); +}; + +exports.addConfigurationTags = function(req, res, next) { + return ZendeskConfiguration + .findById(req.params.cid) + .then(handleEntityNotFound(res)) + .then(function(configuration) { + return configuration.setTags(req.body); + }) + .then(responseWithoutResult(res, 200)) + .catch(function(err) { + console.error(err); + return handleError(res, err); + }); +}; diff --git a/server/api/zendesk_account/zendesk_account.socket.js b/server/api/zendesk_account/zendesk_account.socket.js index c9304df..96c8214 100644 --- a/server/api/zendesk_account/zendesk_account.socket.js +++ b/server/api/zendesk_account/zendesk_account.socket.js @@ -1 +1,24 @@ -var _0x98d6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x5A\x65\x6E\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x3A\x72\x65\x6D\x6F\x76\x65"];_0x98d6[0];var ZendeskAccount=require(_0x98d6[2])[_0x98d6[1]];exports[_0x98d6[3]]=function(_0x316fx2){ZendeskAccount[_0x98d6[4]](function(_0x316fx3){onSave(_0x316fx2,_0x316fx3)});ZendeskAccount[_0x98d6[5]](function(_0x316fx3){onRemove(_0x316fx2,_0x316fx3)})};function onSave(_0x316fx2,_0x316fx3,_0x316fx5){_0x316fx2[_0x98d6[7]](_0x98d6[6],_0x316fx3)}function onRemove(_0x316fx2,_0x316fx3,_0x316fx5){_0x316fx2[_0x98d6[7]](_0x98d6[8],_0x316fx3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ZendeskAccount = require('../../models').ZendeskAccount; + +exports.register = function(socket) { + ZendeskAccount.afterCreate(function (doc) { + onSave(socket, doc); + }); + ZendeskAccount.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('zendesk_account:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('zendesk_account:remove', doc); +} diff --git a/server/api/zendesk_account/zendesk_account.spec.js b/server/api/zendesk_account/zendesk_account.spec.js index 1212bf8..68c8389 100644 --- a/server/api/zendesk_account/zendesk_account.spec.js +++ b/server/api/zendesk_account/zendesk_account.spec.js @@ -1 +1,20 @@ -var _0x6c5b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x67\x65\x74"];_0x6c5b[0];var should=require(_0x6c5b[1]);var app=require(_0x6c5b[2]);var request=require(_0x6c5b[3]);describe(_0x6c5b[4],function(){it(_0x6c5b[5],function(_0x2dc4x4){request(app)[_0x6c5b[13]](_0x6c5b[12])[_0x6c5b[11]](200)[_0x6c5b[11]](_0x6c5b[10],/json/)[_0x6c5b[9]](function(_0x2dc4x5,_0x2dc4x6){if(_0x2dc4x5){return _0x2dc4x4(_0x2dc4x5)};_0x2dc4x6[_0x6c5b[8]][_0x6c5b[1]][_0x6c5b[7]][_0x6c5b[6]](Array);_0x2dc4x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/zendesk/accounts', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/zendesk/accounts') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/zendesk_configuration/index.js b/server/api/zendesk_configuration/index.js index 16572ef..e0bc33f 100644 --- a/server/api/zendesk_configuration/index.js +++ b/server/api/zendesk_configuration/index.js @@ -1 +1,17 @@ -var _0xe346=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x75\x74\x68\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x2F\x3A\x69\x64\x2F\x74\x61\x67\x73","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x54\x61\x67\x73","\x2F\x3A\x69\x64\x2F\x3A\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xe346[0];var express=require(_0xe346[1]);var controller=require(_0xe346[2]);var auth=require(_0xe346[3]);var router=express.Router();router[_0xe346[7]](_0xe346[4],auth[_0xe346[5]](),controller[_0xe346[6]]);router[_0xe346[7]](_0xe346[8],auth[_0xe346[5]](),controller[_0xe346[9]]);router[_0xe346[11]](_0xe346[4],auth[_0xe346[5]](),controller[_0xe346[10]]);router[_0xe346[13]](_0xe346[8],auth[_0xe346[5]](),controller[_0xe346[12]]);router[_0xe346[11]](_0xe346[14],auth[_0xe346[5]](),controller[_0xe346[15]]);router[_0xe346[11]](_0xe346[16],auth[_0xe346[5]](),controller[_0xe346[17]]);router[_0xe346[18]](_0xe346[8],auth[_0xe346[5]](),controller[_0xe346[12]]);router[_0xe346[20]](_0xe346[8],auth[_0xe346[5]](),controller[_0xe346[19]]);module[_0xe346[21]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./zendesk_configuration.controller'); +var auth = require('../../auth/auth.service'); +var router = express.Router(); + +router.get('/', auth.isAuthenticated(), controller.index); +router.get('/:id', auth.isAuthenticated(), controller.show); +router.post('/', auth.isAuthenticated(), controller.create); +router.put('/:id', auth.isAuthenticated(), controller.update); +router.post('/:id/tags', auth.isAuthenticated(), controller.addConfigurationTags); +router.post('/:id/:type', auth.isAuthenticated(), controller.addConfigurationField); +router.patch('/:id', auth.isAuthenticated(), controller.update); +router.delete('/:id', auth.isAuthenticated(), controller.destroy); + +module.exports = router; diff --git a/server/api/zendesk_configuration/zendesk_configuration.controller.js b/server/api/zendesk_configuration/zendesk_configuration.controller.js index 4eac4e5..e299424 100644 --- a/server/api/zendesk_configuration/zendesk_configuration.controller.js +++ b/server/api/zendesk_configuration/zendesk_configuration.controller.js @@ -1 +1,181 @@ -var _0x212b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x46\x69\x65\x6C\x64","\x61\x64\x64\x53\x75\x62\x6A\x65\x63\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x64\x64\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x61\x64\x64\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x74\x79\x70\x65","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x54\x61\x67\x73","\x65\x72\x72\x6F\x72","\x73\x65\x74\x54\x61\x67\x73","\x65\x6E\x64"];_0x212b[0];var _=require(_0x212b[1]);var ZendeskConfiguration=require(_0x212b[3])[_0x212b[2]];var ZendeskField=require(_0x212b[3])[_0x212b[4]];exports[_0x212b[5]]=function(_0x4d8ax4,_0x4d8ax5){ZendeskConfiguration[_0x212b[11]]({where:_0x4d8ax4[_0x212b[10]]})[_0x212b[9]](function(_0x4d8ax7){return _0x4d8ax5[_0x212b[8]](200)[_0x212b[7]](_0x4d8ax7)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[12]]=function(_0x4d8ax4,_0x4d8ax5){ZendeskConfiguration[_0x212b[16]]({where:{id:_0x4d8ax4[_0x212b[15]][_0x212b[14]]},include:[{all:true}]})[_0x212b[9]](function(_0x4d8ax8){if(!_0x4d8ax8){return _0x4d8ax5[_0x212b[13]](404)};return _0x4d8ax5[_0x212b[7]](_0x4d8ax8)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[17]]=function(_0x4d8ax4,_0x4d8ax5){ZendeskConfiguration[_0x212b[17]](_0x4d8ax4[_0x212b[18]])[_0x212b[9]](function(_0x4d8ax8){return _0x4d8ax5[_0x212b[8]](201)[_0x212b[7]](_0x4d8ax8)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[19]]=function(_0x4d8ax4,_0x4d8ax5){if(_0x4d8ax4[_0x212b[18]][_0x212b[14]]){delete _0x4d8ax4[_0x212b[18]][_0x212b[14]]};ZendeskConfiguration[_0x212b[22]](_0x4d8ax4[_0x212b[15]][_0x212b[14]])[_0x212b[9]](function(_0x4d8ax8){if(!_0x4d8ax8){return _0x4d8ax5[_0x212b[13]](404)};var _0x4d8ax9=_[_0x212b[20]](_0x4d8ax8,_0x4d8ax4[_0x212b[18]]);_0x4d8ax9[_0x212b[21]]()[_0x212b[9]](function(){return _0x4d8ax5[_0x212b[8]](200)[_0x212b[7]](_0x4d8ax8)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[23]]=function(_0x4d8ax4,_0x4d8ax5){ZendeskConfiguration[_0x212b[22]](_0x4d8ax4[_0x212b[15]][_0x212b[14]])[_0x212b[9]](function(_0x4d8ax8){if(!_0x4d8ax8){return _0x4d8ax5[_0x212b[13]](404)};_0x4d8ax8[_0x212b[23]]()[_0x212b[9]](function(){return _0x4d8ax5[_0x212b[13]](204)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[24]]=function(_0x4d8ax4,_0x4d8ax5,_0x4d8axa){ZendeskConfiguration[_0x212b[22]](_0x4d8ax4[_0x212b[15]][_0x212b[14]])[_0x212b[9]](function(_0x4d8axb){if(!_0x4d8axb){return _0x4d8ax5[_0x212b[13]](500)};ZendeskField[_0x212b[17]](_0x4d8ax4[_0x212b[18]])[_0x212b[9]](function(_0x4d8axc){switch(_0x4d8ax4[_0x212b[15]][_0x212b[31]]){case _0x212b[26]:_0x4d8axb[_0x212b[25]](_0x4d8axc)[_0x212b[9]](function(){return _0x4d8ax5[_0x212b[8]](200)[_0x212b[7]](_0x4d8axc)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)});break;case _0x212b[28]:_0x4d8axb[_0x212b[27]](_0x4d8axc)[_0x212b[9]](function(){return _0x4d8ax5[_0x212b[8]](200)[_0x212b[7]](_0x4d8axc)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)});break;case _0x212b[30]:_0x4d8axb[_0x212b[29]](_0x4d8axc)[_0x212b[9]](function(){return _0x4d8ax5[_0x212b[8]](200)[_0x212b[7]](_0x4d8axc)})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)});break}})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})})[_0x212b[6]](function(_0x4d8ax6){return handleError(_0x4d8ax5,_0x4d8ax6)})};exports[_0x212b[32]]=function(_0x4d8ax4,_0x4d8ax5,_0x4d8axa){ZendeskConfiguration[_0x212b[22]](_0x4d8ax4[_0x212b[15]][_0x212b[14]])[_0x212b[9]](handleEntityNotFound(_0x4d8ax5))[_0x212b[9]](function(_0x4d8axb){return _0x4d8axb[_0x212b[34]](_0x4d8ax4[_0x212b[18]])})[_0x212b[9]](function(_0x4d8axd){return _0x4d8ax5[_0x212b[13]](200)})[_0x212b[6]](function(_0x4d8ax6){console[_0x212b[33]](_0x4d8ax6);return handleError(_0x4d8ax5,_0x4d8ax6)})};function handleEntityNotFound(_0x4d8ax5){return function(_0x4d8axf){if(!_0x4d8axf){_0x4d8ax5[_0x212b[8]](404)[_0x212b[35]]();return null};return _0x4d8axf}}function handleError(_0x4d8ax5,_0x4d8ax6){return _0x4d8ax5[_0x212b[8]](500)[_0x212b[7]](_0x4d8ax6)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ZendeskConfiguration = require('../../models').ZendeskConfiguration; +var ZendeskField = require('../../models').ZendeskField; + +// Get list of zendesk_configurations +exports.index = function(req, res) { + ZendeskConfiguration + .findAll({ + where: req.query + }) + .then(function(zendesk_configurations) { + return res.status(200).send(zendesk_configurations); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single zendesk_configuration +exports.show = function(req, res) { + ZendeskConfiguration + .find({ + where: { + id: req.params.id + }, + include: [{ + all: true + }] + }) + .then(function(zendesk_configuration) { + if (!zendesk_configuration) { + return res.sendStatus(404); + } + return res.send(zendesk_configuration); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new zendesk_configuration in the DB. +exports.create = function(req, res) { + ZendeskConfiguration + .create(req.body) + .then(function(zendesk_configuration) { + return res.status(201).send(zendesk_configuration); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing zendesk_configuration in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + ZendeskConfiguration + .findById(req.params.id) + .then(function(zendesk_configuration) { + if (!zendesk_configuration) { + return res.sendStatus(404); + } + var updated = _.merge(zendesk_configuration, req.body); + updated.save() + .then(function() { + return res.status(200).send(zendesk_configuration); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a zendesk_configuration from the DB. +exports.destroy = function(req, res) { + ZendeskConfiguration + .findById(req.params.id) + .then(function(zendesk_configuration) { + if (!zendesk_configuration) { + return res.sendStatus(404); + } + zendesk_configuration.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +exports.addConfigurationField = function(req, res, next) { + // console.log(req.params); + ZendeskConfiguration + .findById(req.params.id) + .then(function(configuration) { + if (!configuration) { + return res.sendStatus(500); + } + ZendeskField + .create(req.body) + .then(function(field) { + switch (req.params.type) { + case 'subject': + configuration.addSubject(field) + .then(function() { + return res.status(200).send(field); + }) + .catch(function(err) { + return handleError(res, err); + }); + break; + case 'description': + configuration.addDescription(field) + .then(function() { + return res.status(200).send(field); + }) + .catch(function(err) { + return handleError(res, err); + }); + break; + case 'field': + configuration.addField(field) + .then(function() { + return res.status(200).send(field); + }) + .catch(function(err) { + return handleError(res, err); + }); + break; + } + }) + .catch(function(err) { + return handleError(res, err); + // return next(err); + }); + }) + .catch(function(err) { + // return next(err); + return handleError(res, err); + }); +}; + +exports.addConfigurationTags = function(req, res, next) { + ZendeskConfiguration + .findById(req.params.id) + .then(handleEntityNotFound(res)) + .then(function(configuration) { + return configuration.setTags(req.body); + }) + .then(function(data) { + return res.sendStatus(200); + }) + .catch(function(err) { + console.error(err); + return handleError(res, err); + }); +}; + +function handleEntityNotFound(res) { + return function(entity) { + if (!entity) { + res.status(404).end(); + return null; + } + return entity; + }; +} + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/zendesk_configuration/zendesk_configuration.socket.js b/server/api/zendesk_configuration/zendesk_configuration.socket.js index 0aa8993..d9a56f1 100644 --- a/server/api/zendesk_configuration/zendesk_configuration.socket.js +++ b/server/api/zendesk_configuration/zendesk_configuration.socket.js @@ -1 +1,24 @@ -var _0xaacf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x3A\x72\x65\x6D\x6F\x76\x65"];_0xaacf[0];var ZendeskConfiguration=require(_0xaacf[2])[_0xaacf[1]];exports[_0xaacf[3]]=function(_0x88dax2){ZendeskConfiguration[_0xaacf[4]](function(_0x88dax3){onSave(_0x88dax2,_0x88dax3)});ZendeskConfiguration[_0xaacf[5]](function(_0x88dax3){onRemove(_0x88dax2,_0x88dax3)})};function onSave(_0x88dax2,_0x88dax3,_0x88dax5){_0x88dax2[_0xaacf[7]](_0xaacf[6],_0x88dax3)}function onRemove(_0x88dax2,_0x88dax3,_0x88dax5){_0x88dax2[_0xaacf[7]](_0xaacf[8],_0x88dax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ZendeskConfiguration = require('../../models').ZendeskConfiguration; + +exports.register = function(socket) { + ZendeskConfiguration.afterCreate(function (doc) { + onSave(socket, doc); + }); + ZendeskConfiguration.afterDestroy(function (doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('zendesk_configuration:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('zendesk_configuration:remove', doc); +} diff --git a/server/api/zendesk_configuration/zendesk_configuration.spec.js b/server/api/zendesk_configuration/zendesk_configuration.spec.js index 1cb418e..3589f5d 100644 --- a/server/api/zendesk_configuration/zendesk_configuration.spec.js +++ b/server/api/zendesk_configuration/zendesk_configuration.spec.js @@ -1 +1,20 @@ -var _0x502e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74"];_0x502e[0];var should=require(_0x502e[1]);var app=require(_0x502e[2]);var request=require(_0x502e[3]);describe(_0x502e[4],function(){it(_0x502e[5],function(_0xcf64x4){request(app)[_0x502e[13]](_0x502e[12])[_0x502e[11]](200)[_0x502e[11]](_0x502e[10],/json/)[_0x502e[9]](function(_0xcf64x5,_0xcf64x6){if(_0xcf64x5){return _0xcf64x4(_0xcf64x5)};_0xcf64x6[_0x502e[8]][_0x502e[1]][_0x502e[7]][_0x502e[6]](Array);_0xcf64x4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/zendesk/configurations', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/zendesk/configurations') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); \ No newline at end of file diff --git a/server/api/zendesk_field/index.js b/server/api/zendesk_field/index.js index e27e759..76f5c48 100644 --- a/server/api/zendesk_field/index.js +++ b/server/api/zendesk_field/index.js @@ -1 +1,15 @@ -var _0xd788=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x63\x6F\x6E\x74\x72\x6F\x6C\x6C\x65\x72","\x2F","\x69\x6E\x64\x65\x78","\x67\x65\x74","\x2F\x3A\x69\x64","\x73\x68\x6F\x77","\x63\x72\x65\x61\x74\x65","\x70\x6F\x73\x74","\x75\x70\x64\x61\x74\x65","\x70\x75\x74","\x70\x61\x74\x63\x68","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x6C\x65\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd788[0];var express=require(_0xd788[1]);var controller=require(_0xd788[2]);var router=express.Router();router[_0xd788[5]](_0xd788[3],controller[_0xd788[4]]);router[_0xd788[5]](_0xd788[6],controller[_0xd788[7]]);router[_0xd788[9]](_0xd788[3],controller[_0xd788[8]]);router[_0xd788[11]](_0xd788[6],controller[_0xd788[10]]);router[_0xd788[12]](_0xd788[6],controller[_0xd788[10]]);router[_0xd788[14]](_0xd788[6],controller[_0xd788[13]]);module[_0xd788[15]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var controller = require('./zendesk_field.controller'); + +var router = express.Router(); + +router.get('/', controller.index); +router.get('/:id', controller.show); +router.post('/', controller.create); +router.put('/:id', controller.update); +router.patch('/:id', controller.update); +router.delete('/:id', controller.destroy); + +module.exports = router; diff --git a/server/api/zendesk_field/zendesk_field.controller.js b/server/api/zendesk_field/zendesk_field.controller.js index 7bcd9bf..48d0c38 100644 --- a/server/api/zendesk_field/zendesk_field.controller.js +++ b/server/api/zendesk_field/zendesk_field.controller.js @@ -1 +1,93 @@ -var _0x41ec=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79"];_0x41ec[0];var _=require(_0x41ec[1]);var ZendeskField=require(_0x41ec[3])[_0x41ec[2]];exports[_0x41ec[4]]=function(_0x120cx3,_0x120cx4){ZendeskField[_0x41ec[9]]()[_0x41ec[8]](function(_0x120cx6){return _0x120cx4[_0x41ec[7]](200)[_0x41ec[6]](_0x120cx6)})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})};exports[_0x41ec[10]]=function(_0x120cx3,_0x120cx4){ZendeskField[_0x41ec[14]](_0x120cx3[_0x41ec[13]][_0x41ec[12]])[_0x41ec[8]](function(_0x120cx7){if(!_0x120cx7){return _0x120cx4[_0x41ec[11]](404)};return _0x120cx4[_0x41ec[6]](_0x120cx7)})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})};exports[_0x41ec[15]]=function(_0x120cx3,_0x120cx4){ZendeskField[_0x41ec[15]](_0x120cx3[_0x41ec[16]])[_0x41ec[8]](function(_0x120cx7){return _0x120cx4[_0x41ec[7]](201)[_0x41ec[6]](_0x120cx7)})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})};exports[_0x41ec[17]]=function(_0x120cx3,_0x120cx4){if(_0x120cx3[_0x41ec[16]][_0x41ec[12]]){delete _0x120cx3[_0x41ec[16]][_0x41ec[12]]};ZendeskField[_0x41ec[14]](_0x120cx3[_0x41ec[13]][_0x41ec[12]])[_0x41ec[8]](function(_0x120cx7){if(!_0x120cx7){return _0x120cx4[_0x41ec[11]](404)};var _0x120cx8=_[_0x41ec[18]](_0x120cx7,_0x120cx3[_0x41ec[16]]);_0x120cx8[_0x41ec[19]]()[_0x41ec[8]](function(){return _0x120cx4[_0x41ec[7]](200)[_0x41ec[6]](_0x120cx7)})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})};exports[_0x41ec[20]]=function(_0x120cx3,_0x120cx4){ZendeskField[_0x41ec[14]](_0x120cx3[_0x41ec[13]][_0x41ec[12]])[_0x41ec[8]](function(_0x120cx7){if(!_0x120cx7){return _0x120cx4[_0x41ec[11]](404)};_0x120cx7[_0x41ec[20]]()[_0x41ec[8]](function(){return _0x120cx4[_0x41ec[11]](204)})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})})[_0x41ec[5]](function(_0x120cx5){return handleError(_0x120cx4,_0x120cx5)})};function handleError(_0x120cx4,_0x120cx5){return _0x120cx4[_0x41ec[7]](500)[_0x41ec[6]](_0x120cx5)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var ZendeskField = require('../../models').ZendeskField; + +// Get list of zendesk_fields +exports.index = function(req, res) { + ZendeskField + .findAll() + .then(function(zendesk_fields) { + return res.status(200).send(zendesk_fields); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Get a single zendesk_field +exports.show = function(req, res) { + ZendeskField + .findById(req.params.id) + .then(function(zendesk_field) { + if (!zendesk_field) { + return res.sendStatus(404); + } + return res.send(zendesk_field); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Creates a new zendesk_field in the DB. +exports.create = function(req, res) { + ZendeskField + .create(req.body) + .then(function(zendesk_field) { + return res.status(201).send(zendesk_field); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Updates an existing zendesk_field in the DB. +exports.update = function(req, res) { + if (req.body.id) { + delete req.body.id; + } + ZendeskField + .findById(req.params.id) + .then(function(zendesk_field) { + if (!zendesk_field) { + return res.sendStatus(404); + } + var updated = _.merge(zendesk_field, req.body); + updated.save() + .then(function() { + return res.status(200).send(zendesk_field); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +// Deletes a zendesk_field from the DB. +exports.destroy = function(req, res) { + ZendeskField + .findById(req.params.id) + .then(function(zendesk_field) { + if (!zendesk_field) { + return res.sendStatus(404); + } + zendesk_field.destroy() + .then(function() { + return res.sendStatus(204); + }) + .catch(function(err) { + return handleError(res, err); + }); + }) + .catch(function(err) { + return handleError(res, err); + }); +}; + +function handleError(res, err) { + return res.status(500).send(err); +} diff --git a/server/api/zendesk_field/zendesk_field.socket.js b/server/api/zendesk_field/zendesk_field.socket.js index 784cc09..8a5419b 100644 --- a/server/api/zendesk_field/zendesk_field.socket.js +++ b/server/api/zendesk_field/zendesk_field.socket.js @@ -1 +1,24 @@ -var _0xea81=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x3A\x72\x65\x6D\x6F\x76\x65"];_0xea81[0];var ZendeskField=require(_0xea81[2])[_0xea81[1]];exports[_0xea81[3]]=function(_0xe43ax2){ZendeskField[_0xea81[4]](function(_0xe43ax3){onSave(_0xe43ax2,_0xe43ax3)});ZendeskField[_0xea81[5]](function(_0xe43ax3){onRemove(_0xe43ax2,_0xe43ax3)})};function onSave(_0xe43ax2,_0xe43ax3,_0xe43ax5){_0xe43ax2[_0xea81[7]](_0xea81[6],_0xe43ax3)}function onRemove(_0xe43ax2,_0xe43ax3,_0xe43ax5){_0xe43ax2[_0xea81[7]](_0xea81[8],_0xe43ax3)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var ZendeskField = require('../../models').ZendeskField; + +exports.register = function(socket) { + ZendeskField.afterCreate(function(doc) { + onSave(socket, doc); + }); + ZendeskField.afterDestroy(function(doc) { + onRemove(socket, doc); + }); +} + +function onSave(socket, doc, cb) { + socket.emit('zendesk_field:save', doc); +} + +function onRemove(socket, doc, cb) { + socket.emit('zendesk_field:remove', doc); +} diff --git a/server/api/zendesk_field/zendesk_field.spec.js b/server/api/zendesk_field/zendesk_field.spec.js index 45a05ae..1527fe8 100644 --- a/server/api/zendesk_field/zendesk_field.spec.js +++ b/server/api/zendesk_field/zendesk_field.spec.js @@ -1 +1,20 @@ -var _0xf2ff=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x68\x6F\x75\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x70","\x73\x75\x70\x65\x72\x74\x65\x73\x74","\x47\x45\x54\x20\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x73\x68\x6F\x75\x6C\x64\x20\x72\x65\x73\x70\x6F\x6E\x64\x20\x77\x69\x74\x68\x20\x4A\x53\x4F\x4E\x20\x61\x72\x72\x61\x79","\x69\x6E\x73\x74\x61\x6E\x63\x65\x6F\x66","\x62\x65","\x62\x6F\x64\x79","\x65\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65","\x65\x78\x70\x65\x63\x74","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x67\x65\x74"];_0xf2ff[0];var should=require(_0xf2ff[1]);var app=require(_0xf2ff[2]);var request=require(_0xf2ff[3]);describe(_0xf2ff[4],function(){it(_0xf2ff[5],function(_0xd26ax4){request(app)[_0xf2ff[13]](_0xf2ff[12])[_0xf2ff[11]](200)[_0xf2ff[11]](_0xf2ff[10],/json/)[_0xf2ff[9]](function(_0xd26ax5,_0xd26ax6){if(_0xd26ax5){return _0xd26ax4(_0xd26ax5)};_0xd26ax6[_0xf2ff[8]][_0xf2ff[1]][_0xf2ff[7]][_0xf2ff[6]](Array);_0xd26ax4()})})}) \ No newline at end of file +'use strict'; + +var should = require('should'); +var app = require('../../app'); +var request = require('supertest'); + +describe('GET /api/zendesk/fields', function() { + + it('should respond with JSON array', function(done) { + request(app) + .get('/api/zendesk/fields') + .expect(200) + .expect('Content-Type', /json/) + .end(function(err, res) { + if (err) return done(err); + res.body.should.be.instanceof(Array); + done(); + }); + }); +}); diff --git a/server/app.js b/server/app.js index c9acc5c..5b16a4a 100644 --- a/server/app.js +++ b/server/app.js @@ -1 +1,112 @@ -var _0x9eb6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4E\x4F\x44\x45\x5F\x45\x4E\x56","\x65\x6E\x76","\x64\x65\x76\x65\x6C\x6F\x70\x6D\x65\x6E\x74","\x4E\x4F\x44\x45\x5F\x54\x4C\x53\x5F\x52\x45\x4A\x45\x43\x54\x5F\x55\x4E\x41\x55\x54\x48\x4F\x52\x49\x5A\x45\x44","\x75\x6E\x63\x61\x75\x67\x68\x74\x45\x78\x63\x65\x70\x74\x69\x6F\x6E","\x6F\x62\x6A\x65\x63\x74","\x6D\x65\x73\x73\x61\x67\x65","\x0A\x4D\x65\x73\x73\x61\x67\x65\x3A\x20","\x6C\x6F\x67","\x73\x74\x61\x63\x6B","\x0A\x53\x74\x61\x63\x6B\x74\x72\x61\x63\x65\x3A","\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D","\x64\x75\x6D\x70\x45\x72\x72\x6F\x72\x20\x3A\x3A\x20\x61\x72\x67\x75\x6D\x65\x6E\x74\x20\x69\x73\x20\x6E\x6F\x74\x20\x61\x6E\x20\x6F\x62\x6A\x65\x63\x74","\x6F\x6E","\x6F\x73","\x68\x74\x74\x70","\x75\x74\x69\x6C","\x63\x72\x79\x70\x74\x6F","\x43\x72\x6F\x6E\x4A\x6F\x62","\x63\x72\x6F\x6E","\x73\x68\x65\x6C\x6C\x6A\x73\x2F\x67\x6C\x6F\x62\x61\x6C","\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x53\x65\x74\x74\x69\x6E\x67\x73","\x63\x72\x65\x61\x74\x65\x53\x65\x72\x76\x65\x72","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E","\x2F\x73\x6F\x63\x6B\x65\x74\x2E\x69\x6F\x2D\x63\x6C\x69\x65\x6E\x74","\x73\x6F\x63\x6B\x65\x74\x2E\x69\x6F","\x70\x6F\x72\x74","\x61\x73\x74\x65\x72\x69\x73\x6B","\x68\x6F\x73\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x61\x73\x74\x65\x72\x69\x73\x6B\x2D\x6D\x61\x6E\x61\x67\x65\x72","\x6B\x65\x65\x70\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x6B\x75\x65","\x6C\x69\x73\x74\x65\x6E","\x61\x70\x70","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x78\x70\x72\x65\x73\x73","\x2E\x2F\x72\x6F\x75\x74\x65\x73","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x68\x69\x73\x74\x6F\x72\x79","\x74\x68\x65\x6E","\x73\x79\x6E\x63","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x73\x65\x65\x64\x44\x42","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x73\x65\x65\x64","\x73\x65\x65\x64\x50\x44\x42","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x73\x65\x65\x64\x70","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x73\x6F\x63\x6B\x65\x74\x69\x6F","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x6D\x61\x69\x6C","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x63\x68\x61\x74","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73\x2F\x6D\x61\x69\x6C","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73\x2F\x66\x61\x78","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x74\x72\x69\x67\x67\x65\x72\x73","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x69\x6D\x61\x70","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x73\x6D\x74\x70","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x74\x6F\x6F\x6C\x73","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x61\x6D\x69","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x61\x67\x69","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65","\x69\x70","\x45\x78\x70\x72\x65\x73\x73\x20\x73\x65\x72\x76\x65\x72\x20\x6C\x69\x73\x74\x65\x6E\x69\x6E\x67\x20\x6F\x6E\x20\x25\x64\x2C\x20\x69\x6E\x20\x25\x73\x20\x6D\x6F\x64\x65","\x67\x65\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x9eb6[0];process[_0x9eb6[2]][_0x9eb6[1]]=process[_0x9eb6[2]][_0x9eb6[1]]||_0x9eb6[3];process[_0x9eb6[2]][_0x9eb6[4]]=0;process[_0x9eb6[14]](_0x9eb6[5],function(_0xa703x1){if( typeof _0xa703x1===_0x9eb6[6]){if(_0xa703x1[_0x9eb6[7]]){console[_0x9eb6[9]](_0x9eb6[8]+_0xa703x1[_0x9eb6[7]])};if(_0xa703x1[_0x9eb6[10]]){console[_0x9eb6[9]](_0x9eb6[11]);console[_0x9eb6[9]](_0x9eb6[12]);console[_0x9eb6[9]](_0xa703x1[_0x9eb6[10]])}}else {console[_0x9eb6[9]](_0x9eb6[13])}});var os=require(_0x9eb6[15]);var http=require(_0x9eb6[16]);var util=require(_0x9eb6[17]);var crypto=require(_0x9eb6[18]);var cronjob=require(_0x9eb6[20])[_0x9eb6[19]];var shelljs=require(_0x9eb6[21]);var express=require(_0x9eb6[22]);var models=require(_0x9eb6[23]);var config=require(_0x9eb6[24]);var Settings=models[_0x9eb6[25]];var app=express();var server=require(_0x9eb6[16])[_0x9eb6[26]](app);var io=require(_0x9eb6[29])(server,{serveClient:(config[_0x9eb6[2]]===_0x9eb6[27])?false:true,path:_0x9eb6[28]});var ami=require(_0x9eb6[35])(config[_0x9eb6[31]][_0x9eb6[30]],config[_0x9eb6[31]][_0x9eb6[32]],config[_0x9eb6[31]][_0x9eb6[33]],config[_0x9eb6[31]][_0x9eb6[34]],true);ami[_0x9eb6[36]]();var kue=require(_0x9eb6[37]);kue[_0x9eb6[39]][_0x9eb6[38]](3001);var _setting;var _license;require(_0x9eb6[40])(app);require(_0x9eb6[41])(app);models[_0x9eb6[67]][_0x9eb6[46]]()[_0x9eb6[45]](function(){require(_0x9eb6[41])(app);if(config[_0x9eb6[48]]){require(_0x9eb6[49])};if(config[_0x9eb6[50]]){require(_0x9eb6[51])};require(_0x9eb6[52])(io);require(_0x9eb6[53])();require(_0x9eb6[54])();require(_0x9eb6[55])();require(_0x9eb6[56])();require(_0x9eb6[57])(ami);require(_0x9eb6[58])();require(_0x9eb6[59])();require(_0x9eb6[60])();require(_0x9eb6[61])(ami);require(_0x9eb6[62])();require(_0x9eb6[63])();server[_0x9eb6[38]](config[_0x9eb6[30]],config[_0x9eb6[64]],function(){console[_0x9eb6[9]](_0x9eb6[65],config[_0x9eb6[30]],app[_0x9eb6[66]](_0x9eb6[2]))})})[_0x9eb6[45]](function(){return models[_0x9eb6[47]][_0x9eb6[46]]()})[_0x9eb6[45]](function(){require(_0x9eb6[44])(cronjob)})[_0x9eb6[43]](function(_0xa703x1){console[_0x9eb6[42]](_0xa703x1)});exports=module[_0x9eb6[68]]=app \ No newline at end of file +/** + * Main application file + */ + +'use strict'; + +// Set default node environment to development +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; +process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; + +process.on('uncaughtException', function(err) { + if (typeof err === 'object') { + if (err.message) { + console.log('\nMessage: ' + err.message) + } + if (err.stack) { + console.log('\nStacktrace:') + console.log('====================') + console.log(err.stack); + } + } else { + console.log('dumpError :: argument is not an object'); + } +}); + +var os = require('os'); +var http = require('http'); +var util = require('util'); +var crypto = require('crypto'); +var cronjob = require('cron').CronJob; +var shelljs = require('shelljs/global'); + +var express = require('express'); +var models = require('./models'); +var config = require('./config/environment'); + +var Settings = models.Settings; + +// Setup server +var app = express(); +var server = require('http').createServer(app); +var io = require('socket.io')(server, { + serveClient: (config.env === 'production') ? false : true, + path: '/socket.io-client' +}); + +var ami = require('asterisk-manager')(config.asterisk.port, + config.asterisk.host, + config.asterisk.username, + config.asterisk.password, + true); +ami.keepConnected(); + +// Initialization Kue +var kue = require('kue'); +kue.app.listen(3001); + +var _setting; +var _license; + +require('./config/express')(app); +require('./routes')(app); + +models + .sequelize + .sync() + .then(function() { + + require('./routes')(app); + // Populate DB Develop with sample data + if (config.seedDB) { + require('./config/seed'); + } + // Populate DB Production with sample data + if (config.seedPDB) { + require('./config/seedp'); + } + + // Start Cally Square Projects + require('./config/socketio')(io); + require('./config/routing/mail')(); + require('./config/routing/chat')(); + require('./config/automations/mail')(); + require('./config/automations/fax')(); + require('./config/triggers')(ami); + require('./config/imap')(); + require('./config/smtp')(); + require('./config/tools')(); + require('./config/ami')(ami); + require('./config/agi')(); + require('./config/license')(); + + // Start server + server.listen(config.port, config.ip, function() { + console.log('Express server listening on %d, in %s mode', config.port, app.get('env')); + }); + }) + .then(function() { + // Connect to database history + return models + .sequelize_history + .sync(); + }) + .then(function() { + require('./config/history')(cronjob); + }) + .catch(function(err) { + console.error(err); + }); + +// Expose app +exports = module.exports = app; diff --git a/server/app.json b/server/app.json index 28c7e36..f4e7fbe 100644 --- a/server/app.json +++ b/server/app.json @@ -8,6 +8,7 @@ "cwd": "/var/opt/motion/server", "error_file": "/var/log/xcally/motion-err.log", "out_file": "/var/log/xcally/motion-out.log", - "log_date_format": "YYYY-MM-DD HH:mm Z" + "log_date_format": "YYYY-MM-DD HH:mm Z", + "watch": false }] } diff --git a/server/auth/auth.service.js b/server/auth/auth.service.js index 1db738d..a606070 100644 --- a/server/auth/auth.service.js +++ b/server/auth/auth.service.js @@ -1 +1,95 @@ -var _0x2b3b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6A\x73\x6F\x6E\x77\x65\x62\x74\x6F\x6B\x65\x6E","\x65\x78\x70\x72\x65\x73\x73\x2D\x6A\x77\x74","\x63\x6F\x6D\x70\x6F\x73\x61\x62\x6C\x65\x2D\x6D\x69\x64\x64\x6C\x65\x77\x61\x72\x65","\x55\x73\x65\x72","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x65\x72\x76\x69\x63\x65","\x73\x65\x63\x72\x65\x74","\x73\x65\x73\x73\x69\x6F\x6E","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x75\x73\x65\x72","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x73\x65","\x71\x75\x65\x72\x79","\x61\x63\x63\x65\x73\x73\x5F\x74\x6F\x6B\x65\x6E","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x61\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x68\x65\x61\x64\x65\x72\x73","\x42\x65\x61\x72\x65\x72\x20","\x52\x65\x71\x75\x69\x72\x65\x64\x20\x72\x6F\x6C\x65\x20\x6E\x65\x65\x64\x73\x20\x74\x6F\x20\x62\x65\x20\x73\x65\x74","\x72\x6F\x6C\x65","\x69\x6E\x64\x65\x78\x4F\x66","\x75\x73\x65\x72\x52\x6F\x6C\x65\x73","\x31\x64","\x73\x69\x67\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x77\x65\x6E\x74\x20\x77\x72\x6F\x6E\x67\x2C\x20\x70\x6C\x65\x61\x73\x65\x20\x74\x72\x79\x20\x61\x67\x61\x69\x6E\x2E","\x6A\x73\x6F\x6E","\x74\x6F\x6B\x65\x6E","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x63\x6F\x6F\x6B\x69\x65","\x2F","\x72\x65\x64\x69\x72\x65\x63\x74","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x68\x61\x73\x52\x6F\x6C\x65","\x73\x69\x67\x6E\x54\x6F\x6B\x65\x6E","\x73\x65\x74\x54\x6F\x6B\x65\x6E\x43\x6F\x6F\x6B\x69\x65"];_0x2b3b[0];var passport=require(_0x2b3b[1]);var config=require(_0x2b3b[2]);var jwt=require(_0x2b3b[3]);var expressJwt=require(_0x2b3b[4]);var compose=require(_0x2b3b[5]);var User=require(_0x2b3b[7])[_0x2b3b[6]];var Service=require(_0x2b3b[7])[_0x2b3b[8]];var validateJwt=expressJwt({secret:config[_0x2b3b[10]][_0x2b3b[9]]});function isAuthenticated(){return compose()[_0x2b3b[17]](function(_0x523fxa,_0x523fxb,_0x523fxc){if(_0x523fxa[_0x2b3b[18]]&&_0x523fxa[_0x2b3b[18]][_0x2b3b[20]](_0x2b3b[19])){_0x523fxa[_0x2b3b[22]][_0x2b3b[21]]=_0x2b3b[23]+_0x523fxa[_0x2b3b[18]][_0x2b3b[19]]};validateJwt(_0x523fxa,_0x523fxb,_0x523fxc)})[_0x2b3b[17]](function(_0x523fxa,_0x523fxb,_0x523fxc){User[_0x2b3b[16]](_0x523fxa[_0x2b3b[13]][_0x2b3b[15]],{include:[{model:Service}]})[_0x2b3b[14]](function(_0x523fxe){if(!_0x523fxe){return _0x523fxb[_0x2b3b[12]](401)};_0x523fxa[_0x2b3b[13]]=_0x523fxe;return _0x523fxc()})[_0x2b3b[11]](function(_0x523fxd){return _0x523fxc(_0x523fxd)})})}function hasRole(_0x523fx10){if(!_0x523fx10){throw new Error(_0x2b3b[24])};return compose()[_0x2b3b[17]](isAuthenticated())[_0x2b3b[17]](function _0x523fx11(_0x523fxa,_0x523fxb,_0x523fxc){if(config[_0x2b3b[27]][_0x2b3b[26]](_0x523fxa[_0x2b3b[13]][_0x2b3b[25]])>=config[_0x2b3b[27]][_0x2b3b[26]](_0x523fx10)){return _0x523fxc()}else {return _0x523fxb[_0x2b3b[12]](403)}})}function signToken(_0x523fx13,_0x523fx14,_0x523fx15){var _0x523fx16=60*24*365*5;if(!_0x523fx15){_0x523fx16=_0x2b3b[28]};return jwt[_0x2b3b[29]]({id:_0x523fx13},config[_0x2b3b[10]][_0x2b3b[9]],{expiresIn:_0x523fx16})}function setTokenCookie(_0x523fxa,_0x523fxb){if(!_0x523fxa[_0x2b3b[13]]){return _0x523fxb[_0x2b3b[31]](404,{message:_0x2b3b[30]})};var _0x523fx18=signToken(_0x523fxa[_0x2b3b[13]][_0x2b3b[15]],_0x523fxa[_0x2b3b[13]][_0x2b3b[25]]);_0x523fxb[_0x2b3b[34]](_0x2b3b[32],JSON[_0x2b3b[33]](_0x523fx18));_0x523fxb[_0x2b3b[36]](_0x2b3b[35])}exports[_0x2b3b[37]]=isAuthenticated;exports[_0x2b3b[38]]=hasRole;exports[_0x2b3b[39]]=signToken;exports[_0x2b3b[40]]=setTokenCookie \ No newline at end of file +'use strict'; + +//var mongoose = require('mongoose'); +var passport = require('passport'); +var config = require('../config/environment'); +var jwt = require('jsonwebtoken'); +var expressJwt = require('express-jwt'); +var compose = require('composable-middleware'); +// var User = require('../api/user/user.model'); +var User = require('../models').User; +var Service = require('../models').Service; +var validateJwt = expressJwt({ + secret: config.session.secret +}); + +/** + * Attaches the user object to the request if authenticated + * Otherwise returns 403 + */ +function isAuthenticated() { + return compose() + // Validate jwt + .use(function(req, res, next) { + // allow access_token to be passed through query parameter as well + if (req.query && req.query.hasOwnProperty('access_token')) { + req.headers.authorization = 'Bearer ' + req.query.access_token; + } + validateJwt(req, res, next); + }) + // Attach user to request + .use(function(req, res, next) { + User + .findById(req.user.id, { + include: [{ + model: Service + }] + }) + .then(function(user) { + if (!user) return res.send(401); + req.user = user; + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the user role meets the minimum requirements of the route + */ +function hasRole(roleRequired) { + if (!roleRequired) throw new Error('Required role needs to be set'); + + return compose() + .use(isAuthenticated()) + .use(function meetsRequirements(req, res, next) { + if (config.userRoles.indexOf(req.user.role) >= config.userRoles.indexOf(roleRequired)) { + return next(); + } else { + return res.send(403); + } + }); +} + +/** + * Returns a jwt token signed by the app secret + */ +function signToken(id, role, remember) { + var expiresIn = 60 * 24 * 365 * 5; //If remember, it expires in 5 years + if (!remember) + expiresIn = "1d"; //Expire in one day + return jwt.sign({ + id: id + }, config.session.secret, { + expiresIn: expiresIn + }); +} + +/** + * Set token cookie directly for oAuth strategies + */ +function setTokenCookie(req, res) { + if (!req.user) return res.json(404, { + message: 'Something went wrong, please try again.' + }); + var token = signToken(req.user.id, req.user.role); + res.cookie('token', JSON.stringify(token)); + res.redirect('/'); +} + +exports.isAuthenticated = isAuthenticated; +exports.hasRole = hasRole; +exports.signToken = signToken; +exports.setTokenCookie = setTokenCookie; diff --git a/server/auth/facebook/index.js b/server/auth/facebook/index.js index cd9fbb7..4a6f878 100644 --- a/server/auth/facebook/index.js +++ b/server/auth/facebook/index.js @@ -1 +1,21 @@ -var _0x39b0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x66\x61\x63\x65\x62\x6F\x6F\x6B","\x2F\x73\x69\x67\x6E\x75\x70","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x73\x65\x74\x54\x6F\x6B\x65\x6E\x43\x6F\x6F\x6B\x69\x65","\x67\x65\x74","\x2F","\x65\x6D\x61\x69\x6C","\x75\x73\x65\x72\x5F\x61\x62\x6F\x75\x74\x5F\x6D\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x39b0[0];var express=require(_0x39b0[1]);var passport=require(_0x39b0[2]);var auth=require(_0x39b0[3]);var router=express.Router();router[_0x39b0[9]](_0x39b0[10],passport[_0x39b0[7]](_0x39b0[5],{scope:[_0x39b0[11],_0x39b0[12]],failureRedirect:_0x39b0[6],session:false}))[_0x39b0[9]](_0x39b0[4],passport[_0x39b0[7]](_0x39b0[5],{failureRedirect:_0x39b0[6],session:false}),auth[_0x39b0[8]]);module[_0x39b0[13]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var passport = require('passport'); +var auth = require('../auth.service'); + +var router = express.Router(); + +router + .get('/', passport.authenticate('facebook', { + scope: ['email', 'user_about_me'], + failureRedirect: '/signup', + session: false + })) + + .get('/callback', passport.authenticate('facebook', { + failureRedirect: '/signup', + session: false + }), auth.setTokenCookie); + +module.exports = router; \ No newline at end of file diff --git a/server/auth/facebook/passport.js b/server/auth/facebook/passport.js index 4708837..90ae489 100644 --- a/server/auth/facebook/passport.js +++ b/server/auth/facebook/passport.js @@ -1 +1,37 @@ -var _0x2b6a=["\x70\x61\x73\x73\x70\x6F\x72\x74","\x53\x74\x72\x61\x74\x65\x67\x79","\x70\x61\x73\x73\x70\x6F\x72\x74\x2D\x66\x61\x63\x65\x62\x6F\x6F\x6B","\x73\x65\x74\x75\x70","\x63\x6C\x69\x65\x6E\x74\x49\x44","\x66\x61\x63\x65\x62\x6F\x6F\x6B","\x63\x6C\x69\x65\x6E\x74\x53\x65\x63\x72\x65\x74","\x63\x61\x6C\x6C\x62\x61\x63\x6B\x55\x52\x4C","\x69\x64","\x64\x69\x73\x70\x6C\x61\x79\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x65\x6D\x61\x69\x6C\x73","\x75\x73\x65\x72","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x5F\x6A\x73\x6F\x6E","\x73\x61\x76\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x73\x65"];var passport=require(_0x2b6a[0]);var FacebookStrategy=require(_0x2b6a[2])[_0x2b6a[1]];exports[_0x2b6a[3]]=function(_0x551fx3,_0x551fx4){passport[_0x2b6a[17]]( new FacebookStrategy({clientID:_0x551fx4[_0x2b6a[5]][_0x2b6a[4]],clientSecret:_0x551fx4[_0x2b6a[5]][_0x2b6a[6]],callbackURL:_0x551fx4[_0x2b6a[5]][_0x2b6a[7]]},function(_0x551fx5,_0x551fx6,_0x551fx7,_0x551fx8){_0x551fx3[_0x2b6a[16]]({"\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2E\x69\x64":_0x551fx7[_0x2b6a[8]]},function(_0x551fx9,_0x551fxa){if(_0x551fx9){return _0x551fx8(_0x551fx9)};if(!_0x551fxa){_0x551fxa= new _0x551fx3({name:_0x551fx7[_0x2b6a[9]],email:_0x551fx7[_0x2b6a[11]][0][_0x2b6a[10]],role:_0x2b6a[12],username:_0x551fx7[_0x2b6a[13]],provider:_0x2b6a[5],facebook:_0x551fx7[_0x2b6a[14]]});_0x551fxa[_0x2b6a[15]](function(_0x551fx9){if(_0x551fx9){_0x551fx8(_0x551fx9)};return _0x551fx8(_0x551fx9,_0x551fxa)})}else {return _0x551fx8(_0x551fx9,_0x551fxa)}})}))} \ No newline at end of file +var passport = require('passport'); +var FacebookStrategy = require('passport-facebook').Strategy; + +exports.setup = function (User, config) { + passport.use(new FacebookStrategy({ + clientID: config.facebook.clientID, + clientSecret: config.facebook.clientSecret, + callbackURL: config.facebook.callbackURL + }, + function(accessToken, refreshToken, profile, done) { + User.findOne({ + 'facebook.id': profile.id + }, + function(err, user) { + if (err) { + return done(err); + } + if (!user) { + user = new User({ + name: profile.displayName, + email: profile.emails[0].value, + role: 'user', + username: profile.username, + provider: 'facebook', + facebook: profile._json + }); + user.save(function(err) { + if (err) done(err); + return done(err, user); + }); + } else { + return done(err, user); + } + }) + } + )); +}; \ No newline at end of file diff --git a/server/auth/google/index.js b/server/auth/google/index.js index 760f642..9b1ce39 100644 --- a/server/auth/google/index.js +++ b/server/auth/google/index.js @@ -1 +1,24 @@ -var _0x89bc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x67\x6F\x6F\x67\x6C\x65","\x2F\x73\x69\x67\x6E\x75\x70","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x73\x65\x74\x54\x6F\x6B\x65\x6E\x43\x6F\x6F\x6B\x69\x65","\x67\x65\x74","\x2F","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x67\x6F\x6F\x67\x6C\x65\x61\x70\x69\x73\x2E\x63\x6F\x6D\x2F\x61\x75\x74\x68\x2F\x75\x73\x65\x72\x69\x6E\x66\x6F\x2E\x70\x72\x6F\x66\x69\x6C\x65","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x67\x6F\x6F\x67\x6C\x65\x61\x70\x69\x73\x2E\x63\x6F\x6D\x2F\x61\x75\x74\x68\x2F\x75\x73\x65\x72\x69\x6E\x66\x6F\x2E\x65\x6D\x61\x69\x6C","\x65\x78\x70\x6F\x72\x74\x73"];_0x89bc[0];var express=require(_0x89bc[1]);var passport=require(_0x89bc[2]);var auth=require(_0x89bc[3]);var router=express.Router();router[_0x89bc[9]](_0x89bc[10],passport[_0x89bc[7]](_0x89bc[5],{failureRedirect:_0x89bc[6],scope:[_0x89bc[11],_0x89bc[12]],session:false}))[_0x89bc[9]](_0x89bc[4],passport[_0x89bc[7]](_0x89bc[5],{failureRedirect:_0x89bc[6],session:false}),auth[_0x89bc[8]]);module[_0x89bc[13]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var passport = require('passport'); +var auth = require('../auth.service'); + +var router = express.Router(); + +router + .get('/', passport.authenticate('google', { + failureRedirect: '/signup', + scope: [ + 'https://www.googleapis.com/auth/userinfo.profile', + 'https://www.googleapis.com/auth/userinfo.email' + ], + session: false + })) + + .get('/callback', passport.authenticate('google', { + failureRedirect: '/signup', + session: false + }), auth.setTokenCookie); + +module.exports = router; \ No newline at end of file diff --git a/server/auth/google/passport.js b/server/auth/google/passport.js index 0ec5987..d304e8a 100644 --- a/server/auth/google/passport.js +++ b/server/auth/google/passport.js @@ -1 +1,33 @@ -var _0x3a72=["\x70\x61\x73\x73\x70\x6F\x72\x74","\x4F\x41\x75\x74\x68\x32\x53\x74\x72\x61\x74\x65\x67\x79","\x70\x61\x73\x73\x70\x6F\x72\x74\x2D\x67\x6F\x6F\x67\x6C\x65\x2D\x6F\x61\x75\x74\x68","\x73\x65\x74\x75\x70","\x63\x6C\x69\x65\x6E\x74\x49\x44","\x67\x6F\x6F\x67\x6C\x65","\x63\x6C\x69\x65\x6E\x74\x53\x65\x63\x72\x65\x74","\x63\x61\x6C\x6C\x62\x61\x63\x6B\x55\x52\x4C","\x69\x64","\x64\x69\x73\x70\x6C\x61\x79\x4E\x61\x6D\x65","\x76\x61\x6C\x75\x65","\x65\x6D\x61\x69\x6C\x73","\x75\x73\x65\x72","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x5F\x6A\x73\x6F\x6E","\x73\x61\x76\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x73\x65"];var passport=require(_0x3a72[0]);var GoogleStrategy=require(_0x3a72[2])[_0x3a72[1]];exports[_0x3a72[3]]=function(_0x1f99x3,_0x1f99x4){passport[_0x3a72[17]]( new GoogleStrategy({clientID:_0x1f99x4[_0x3a72[5]][_0x3a72[4]],clientSecret:_0x1f99x4[_0x3a72[5]][_0x3a72[6]],callbackURL:_0x1f99x4[_0x3a72[5]][_0x3a72[7]]},function(_0x1f99x5,_0x1f99x6,_0x1f99x7,_0x1f99x8){_0x1f99x3[_0x3a72[16]]({"\x67\x6F\x6F\x67\x6C\x65\x2E\x69\x64":_0x1f99x7[_0x3a72[8]]},function(_0x1f99x9,_0x1f99xa){if(!_0x1f99xa){_0x1f99xa= new _0x1f99x3({name:_0x1f99x7[_0x3a72[9]],email:_0x1f99x7[_0x3a72[11]][0][_0x3a72[10]],role:_0x3a72[12],username:_0x1f99x7[_0x3a72[13]],provider:_0x3a72[5],google:_0x1f99x7[_0x3a72[14]]});_0x1f99xa[_0x3a72[15]](function(_0x1f99x9){if(_0x1f99x9){_0x1f99x8(_0x1f99x9)};return _0x1f99x8(_0x1f99x9,_0x1f99xa)})}else {return _0x1f99x8(_0x1f99x9,_0x1f99xa)}})}))} \ No newline at end of file +var passport = require('passport'); +var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy; + +exports.setup = function (User, config) { + passport.use(new GoogleStrategy({ + clientID: config.google.clientID, + clientSecret: config.google.clientSecret, + callbackURL: config.google.callbackURL + }, + function(accessToken, refreshToken, profile, done) { + User.findOne({ + 'google.id': profile.id + }, function(err, user) { + if (!user) { + user = new User({ + name: profile.displayName, + email: profile.emails[0].value, + role: 'user', + username: profile.username, + provider: 'google', + google: profile._json + }); + user.save(function(err) { + if (err) done(err); + return done(err, user); + }); + } else { + return done(err, user); + } + }); + } + )); +}; diff --git a/server/auth/index.js b/server/auth/index.js index 4a38c78..a034241 100644 --- a/server/auth/index.js +++ b/server/auth/index.js @@ -1 +1,22 @@ -var _0xbf26=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x74\x75\x70","\x2E\x2F\x6C\x6F\x63\x61\x6C\x2F\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2F\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2F\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2F\x67\x6F\x6F\x67\x6C\x65\x2F\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2F\x74\x77\x69\x74\x74\x65\x72\x2F\x70\x61\x73\x73\x70\x6F\x72\x74","\x2F\x6C\x6F\x63\x61\x6C","\x2E\x2F\x6C\x6F\x63\x61\x6C","\x75\x73\x65","\x2F\x66\x61\x63\x65\x62\x6F\x6F\x6B","\x2E\x2F\x66\x61\x63\x65\x62\x6F\x6F\x6B","\x2F\x74\x77\x69\x74\x74\x65\x72","\x2E\x2F\x74\x77\x69\x74\x74\x65\x72","\x2F\x67\x6F\x6F\x67\x6C\x65","\x2E\x2F\x67\x6F\x6F\x67\x6C\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xbf26[0];var express=require(_0xbf26[1]);var passport=require(_0xbf26[2]);var config=require(_0xbf26[3]);var User=require(_0xbf26[5])[_0xbf26[4]];require(_0xbf26[7])[_0xbf26[6]](User,config);require(_0xbf26[8])[_0xbf26[6]](User,config);require(_0xbf26[9])[_0xbf26[6]](User,config);require(_0xbf26[10])[_0xbf26[6]](User,config);var router=express.Router();router[_0xbf26[13]](_0xbf26[11],require(_0xbf26[12]));router[_0xbf26[13]](_0xbf26[14],require(_0xbf26[15]));router[_0xbf26[13]](_0xbf26[16],require(_0xbf26[17]));router[_0xbf26[13]](_0xbf26[18],require(_0xbf26[19]));module[_0xbf26[20]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var passport = require('passport'); +var config = require('../config/environment'); +var User = require('../models').User; + + +// Passport Configuration +require('./local/passport').setup(User, config); +require('./facebook/passport').setup(User, config); +require('./google/passport').setup(User, config); +require('./twitter/passport').setup(User, config); + +var router = express.Router(); + +router.use('/local', require('./local')); +router.use('/facebook', require('./facebook')); +router.use('/twitter', require('./twitter')); +router.use('/google', require('./google')); + +module.exports = router; diff --git a/server/auth/local/index.js b/server/auth/local/index.js index 73c72f4..d60d5e0 100644 --- a/server/auth/local/index.js +++ b/server/auth/local/index.js @@ -1 +1,63 @@ -var _0xce55=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x63\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x76\x6F\x69\x63\x65","\x63\x68\x61\x74","\x6D\x61\x69\x6C","\x66\x61\x78","\x2F","\x6C\x6F\x63\x61\x6C\x2D\x6C\x6F\x67\x69\x6E","\x6A\x73\x6F\x6E","\x73\x74\x61\x74\x75\x73","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x77\x65\x6E\x74\x20\x77\x72\x6F\x6E\x67\x2C\x20\x70\x6C\x65\x61\x73\x65\x20\x74\x72\x79\x20\x61\x67\x61\x69\x6E\x2E","\x63\x61\x74\x63\x68","\x72\x6F\x6C\x65","\x69\x64","\x72\x65\x6D\x65\x6D\x62\x65\x72","\x62\x6F\x64\x79","\x73\x69\x67\x6E\x54\x6F\x6B\x65\x6E","\x74\x68\x65\x6E","\x6C\x6F\x67\x69\x6E","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x6C\x6F\x67\x6F\x75\x74","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x6C\x6F\x67\x6F\x75\x74","\x72\x65\x64\x69\x72\x65\x63\x74","\x75\x73\x65\x72","\x67\x65\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0xce55[0];var express=require(_0xce55[1]);var passport=require(_0xce55[2]);var async=require(_0xce55[3]);var auth=require(_0xce55[4]);var User=require(_0xce55[6])[_0xce55[5]];var Action=require(_0xce55[6])[_0xce55[7]];var ReportMember=require(_0xce55[6])[_0xce55[8]];var license=require(_0xce55[9]);var channels=[_0xce55[10],_0xce55[11],_0xce55[12],_0xce55[13]];var router=express.Router();router[_0xce55[30]](_0xce55[14],function(_0x1ddfxb,_0x1ddfxc,_0x1ddfxd){passport[_0xce55[29]](_0xce55[15],function(_0x1ddfxe,_0x1ddfxf,_0x1ddfx10){var _0x1ddfx11=_0x1ddfxe||_0x1ddfx10;if(_0x1ddfx11){return _0x1ddfxc[_0xce55[17]](401)[_0xce55[16]](_0x1ddfx11)};if(!_0x1ddfxf){return _0x1ddfxc[_0xce55[17]](404)[_0xce55[16]]({message:_0xce55[18]})};return Action[_0xce55[28]]({name:_0xce55[26],data1:_0x1ddfxf[_0xce55[21]],data2:_0x1ddfxf[_0xce55[27]],UserId:_0x1ddfxf[_0xce55[21]]})[_0xce55[25]](function(_0x1ddfx12){return _0x1ddfxc[_0xce55[16]]({role:_0x1ddfxf[_0xce55[20]],token:auth[_0xce55[24]](_0x1ddfxf[_0xce55[21]],_0x1ddfxf[_0xce55[20]],_0x1ddfxb[_0xce55[23]][_0xce55[22]]||false),userId:_0x1ddfxf[_0xce55[21]]})})[_0xce55[19]](function(_0x1ddfxe){return _0x1ddfxd(_0x1ddfxe)})})(_0x1ddfxb,_0x1ddfxc,_0x1ddfxd)});router[_0xce55[36]](_0xce55[31],auth[_0xce55[32]](),function(_0x1ddfxb,_0x1ddfxc,_0x1ddfxd){return Action[_0xce55[28]]({name:_0xce55[33],data1:_0x1ddfxb[_0xce55[35]][_0xce55[21]],data2:_0x1ddfxb[_0xce55[35]][_0xce55[27]],UserId:_0x1ddfxb[_0xce55[35]][_0xce55[21]]})[_0xce55[25]](function(){_0x1ddfxb[_0xce55[33]]();_0x1ddfxc[_0xce55[34]](_0xce55[14])})[_0xce55[19]](function(_0x1ddfxe){return _0x1ddfxd(_0x1ddfxe)})});module[_0xce55[37]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var passport = require('passport'); +var async = require('async'); + +var auth = require('../auth.service'); +var User = require('../../models').User; +var Action = require('../../models').Action; +var ReportMember = require('../../models').ReportMember; +var license = require('../../config/license/license.service'); + +var channels = ['voice', 'chat', 'mail', 'fax']; +var router = express.Router(); + +router.post('/', function(req, res, next) { + passport.authenticate('local-login', function(err, user, info) { + var error = err || info; + if (error) return res.status(401).json(error); + if (!user) return res.status(404).json({ + message: 'Something went wrong, please try again.' + }); + + return Action + .create({ + name: 'login', + data1: user.id, + data2: user.name, + UserId: user.id + }) + .then(function(action) { + return res.json({ + role: user.role, + token: auth.signToken(user.id, user.role, req.body.remember || false), + userId: user.id + }); + }) + .catch(function(err) { + return next(err); + }); + + })(req, res, next) +}); + +router + .get('/logout', auth.isAuthenticated(), function(req, res, next) { + return Action + .create({ + name: 'logout', + data1: req.user.id, + data2: req.user.name, + UserId: req.user.id + }) + .then(function() { + req.logout(); + res.redirect('/'); + }) + .catch(function(err) { + return next(err); + }); + }); + +module.exports = router; diff --git a/server/auth/local/local.ami.js b/server/auth/local/local.ami.js index 7ad3607..bfb533d 100644 --- a/server/auth/local/local.ami.js +++ b/server/auth/local/local.ami.js @@ -1 +1,51 @@ -var _0xeb9c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x69\x2F\x61\x6D\x69\x2F\x61\x6D\x69\x2E\x61\x6D\x69","\x6C\x6F\x67\x6F\x75\x74","\x51\x75\x65\x75\x65\x50\x61\x75\x73\x65","\x53\x49\x50\x2F\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x64\x61\x74\x61","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x55\x73\x65\x72\x49\x64","\x6C\x6F\x67","\x51\x75\x65\x75\x65\x52\x65\x6D\x6F\x76\x65","\x61\x63\x74\x69\x6F\x6E","\x6C\x6F\x67\x69\x6E","\x51\x75\x65\x75\x65\x41\x64\x64"];_0xeb9c[0];var util=require(_0xeb9c[1]);var amiController=require(_0xeb9c[2]);exports[_0xeb9c[3]]=function(_0x5a10x3,_0x5a10x4,_0x5a10x5,_0x5a10x6){var _0x5a10x7={action:_0xeb9c[4],queue:_0x5a10x5,interface:util[_0xeb9c[6]](_0xeb9c[5],_0x5a10x4),paused:false};_0x5a10x7[_0xeb9c[7]]=JSON[_0xeb9c[8]](_0x5a10x7);_0x5a10x7[_0xeb9c[9]]=_0x5a10x3;amiController[_0xeb9c[12]](_0x5a10x7,function(_0x5a10x8,_0x5a10x9){if(_0x5a10x8){console[_0xeb9c[10]](_0x5a10x8)};var _0x5a10x7={action:_0xeb9c[11],queue:_0x5a10x5,interface:util[_0xeb9c[6]](_0xeb9c[5],_0x5a10x4)};_0x5a10x7[_0xeb9c[7]]=JSON[_0xeb9c[8]](_0x5a10x7);_0x5a10x7[_0xeb9c[9]]=_0x5a10x3;amiController[_0xeb9c[12]](_0x5a10x7,_0x5a10x6)})};exports[_0xeb9c[13]]=function(_0x5a10x3,_0x5a10x4,_0x5a10x5,_0x5a10x6){var _0x5a10x7={action:_0xeb9c[14],queue:_0x5a10x5,interface:util[_0xeb9c[6]](_0xeb9c[5],_0x5a10x4),penalty:0,paused:false,membername:_0x5a10x4};_0x5a10x7[_0xeb9c[7]]=JSON[_0xeb9c[8]](_0x5a10x7);_0x5a10x7[_0xeb9c[9]]=_0x5a10x3;amiController[_0xeb9c[12]](_0x5a10x7,_0x5a10x6)} \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var util = require('util'); +var amiController = require('../../api/ami/ami.ami'); + +exports.logout = function(userid, username, queuename, callback) { + var body = { + action: 'QueuePause', + queue: queuename, + interface: util.format('SIP/%s', username), + paused: false + }; + body.data = JSON.stringify(body); + body.UserId = userid; + + amiController.action(body, function(err, res) { + if (err) { + console.log(err); + } + var body = { + action: 'QueueRemove', + queue: queuename, + interface: util.format('SIP/%s', username) + }; + body.data = JSON.stringify(body); + body.UserId = userid; + + amiController.action(body, callback); + }); +} + +exports.login = function(userid, username, queuename, callback) { + + var body = { + action: 'QueueAdd', + queue: queuename, + interface: util.format('SIP/%s', username), + penalty: 0, + paused: false, + membername: username + }; + + body.data = JSON.stringify(body); + body.UserId = userid; + + amiController.action(body, callback); +} diff --git a/server/auth/local/passport.js b/server/auth/local/passport.js index b74e42d..e602ae6 100644 --- a/server/auth/local/passport.js +++ b/server/auth/local/passport.js @@ -1 +1,93 @@ -var _0xcfca=["\x70\x61\x73\x73\x70\x6F\x72\x74","\x53\x74\x72\x61\x74\x65\x67\x79","\x70\x61\x73\x73\x70\x6F\x72\x74\x2D\x6C\x6F\x63\x61\x6C","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x73\x65\x74\x75\x70","\x6C\x6F\x63\x61\x6C\x2D\x6C\x6F\x67\x69\x6E","\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x61\x74\x63\x68","\x4D\x61\x78\x69\x6D\x75\x6D\x20\x6C\x6F\x67\x69\x6E\x20\x6C\x69\x6D\x69\x74\x20\x68\x61\x73\x20\x62\x65\x65\x6E\x20\x72\x65\x61\x63\x68\x65\x64\x2E","\x74\x68\x65\x6E","\x69\x73\x56\x61\x6C\x69\x64\x41\x67\x65\x6E\x74","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x57\x72\x6F\x6E\x67\x20\x63\x72\x65\x64\x65\x6E\x74\x69\x61\x6C\x73\x2E","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x73\x65"];var passport=require(_0xcfca[0]);var LocalStrategy=require(_0xcfca[2])[_0xcfca[1]];var Settings=require(_0xcfca[4])[_0xcfca[3]];var license=require(_0xcfca[5]);exports[_0xcfca[6]]=function(_0xb331x5,_0xb331x6){passport[_0xcfca[17]](_0xcfca[7], new LocalStrategy({usernameField:_0xcfca[8],passwordField:_0xcfca[9]},function(_0xb331x7,_0xb331x8,_0xb331x9){var _0xb331xa;var _0xb331xb;var _0xb331xc;return _0xb331x5[_0xcfca[16]]({where:{name:_0xb331x7}})[_0xcfca[12]](function(_0xb331xf){_0xb331xa=_0xb331xf;if(!_0xb331xa||!_0xb331xf[_0xcfca[14]](_0xb331x8)){throw new Error({message:_0xcfca[15]})};return _0xb331xa})[_0xcfca[12]](license[_0xcfca[13]]())[_0xcfca[12]](function(_0xb331xe){if(_0xb331xe){return _0xb331x9(null,_0xb331xa)}else {return _0xb331x9(null,false,{message:_0xcfca[11]})}})[_0xcfca[10]](function(_0xb331xd){return _0xb331x9(null,false,_0xb331xd)})}))} \ No newline at end of file +var passport = require('passport'); +var LocalStrategy = require('passport-local').Strategy; +var Settings = require('../../models').Settings; +var license = require('../../config/license/license.service'); + +exports.setup = function(User, config) { + + passport.use('local-login', new LocalStrategy({ + usernameField: 'name', + passwordField: 'password' // this is the virtual field on the model + }, + function(name, password, done) { + var _user; + var _settings; + var _license; + + return User.findOne({ + where: { + name: name + } + }) + .then(function(user) { + _user = user; + + if (!_user || !user.authenticate(password)) { + throw new Error({ + message: 'Wrong credentials.' + }); + } + + return _user; + }) + .then(license.isValidAgent()) + .then(function(valid) { + if (valid) { + return done(null, _user); + } else { + return done(null, false, { + message: 'Maximum login limit has been reached.' + }); + + } + }) + .catch(function(err) { + return done(null, false, err); + }); + } + )); + + // passport.use('local-signup', new LocalStrategy({ + // usernameField: 'name', + // passwordField: 'password', + // passReqToCallback: true + // }, + // function(req, name, password, done) { + // + // if (!req.user) { + // User + // .findOne({ + // where: { + // name: name + // } + // }) + // .then(function(user) { + // if (user) { + // return done(null, false, { + // message: 'That email is already taken.' + // }); + // } else { + // var newUser = User.build(req.body); + // newUser.provider = 'local'; + // newUser.online = true; + // newUser + // .save() + // .then(function() { + // return done(null, newUser); + // }) + // .catch(function(err) { + // return done(err); + // }); + // } + // }) + // .catch(function(err) { + // return done(err); + // }); + // } else { + // // user is logged in and already has a local account. Ignore signup. (You should log out before trying to create a new account, user!) + // return done(null, req.user); + // } + // } + // )); + +}; diff --git a/server/auth/twitter/index.js b/server/auth/twitter/index.js index 5614ddf..8360247 100644 --- a/server/auth/twitter/index.js +++ b/server/auth/twitter/index.js @@ -1 +1,20 @@ -var _0xc5f9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x2F\x63\x61\x6C\x6C\x62\x61\x63\x6B","\x74\x77\x69\x74\x74\x65\x72","\x2F\x73\x69\x67\x6E\x75\x70","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x73\x65\x74\x54\x6F\x6B\x65\x6E\x43\x6F\x6F\x6B\x69\x65","\x67\x65\x74","\x2F","\x65\x78\x70\x6F\x72\x74\x73"];_0xc5f9[0];var express=require(_0xc5f9[1]);var passport=require(_0xc5f9[2]);var auth=require(_0xc5f9[3]);var router=express.Router();router[_0xc5f9[9]](_0xc5f9[10],passport[_0xc5f9[7]](_0xc5f9[5],{failureRedirect:_0xc5f9[6],session:false}))[_0xc5f9[9]](_0xc5f9[4],passport[_0xc5f9[7]](_0xc5f9[5],{failureRedirect:_0xc5f9[6],session:false}),auth[_0xc5f9[8]]);module[_0xc5f9[11]]=router \ No newline at end of file +'use strict'; + +var express = require('express'); +var passport = require('passport'); +var auth = require('../auth.service'); + +var router = express.Router(); + +router + .get('/', passport.authenticate('twitter', { + failureRedirect: '/signup', + session: false + })) + + .get('/callback', passport.authenticate('twitter', { + failureRedirect: '/signup', + session: false + }), auth.setTokenCookie); + +module.exports = router; \ No newline at end of file diff --git a/server/auth/twitter/passport.js b/server/auth/twitter/passport.js index 2bb0425..a2eb4a5 100644 --- a/server/auth/twitter/passport.js +++ b/server/auth/twitter/passport.js @@ -1 +1,35 @@ -var _0x8da7=["\x73\x65\x74\x75\x70","\x70\x61\x73\x73\x70\x6F\x72\x74","\x53\x74\x72\x61\x74\x65\x67\x79","\x70\x61\x73\x73\x70\x6F\x72\x74\x2D\x74\x77\x69\x74\x74\x65\x72","\x63\x6C\x69\x65\x6E\x74\x49\x44","\x74\x77\x69\x74\x74\x65\x72","\x63\x6C\x69\x65\x6E\x74\x53\x65\x63\x72\x65\x74","\x63\x61\x6C\x6C\x62\x61\x63\x6B\x55\x52\x4C","\x69\x64","\x64\x69\x73\x70\x6C\x61\x79\x4E\x61\x6D\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x75\x73\x65\x72","\x5F\x6A\x73\x6F\x6E","\x73\x61\x76\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x73\x65"];exports[_0x8da7[0]]=function(_0x178dx1,_0x178dx2){var _0x178dx3=require(_0x8da7[1]);var _0x178dx4=require(_0x8da7[3])[_0x8da7[2]];_0x178dx3[_0x8da7[15]]( new _0x178dx4({consumerKey:_0x178dx2[_0x8da7[5]][_0x8da7[4]],consumerSecret:_0x178dx2[_0x8da7[5]][_0x8da7[6]],callbackURL:_0x178dx2[_0x8da7[5]][_0x8da7[7]]},function(_0x178dx5,_0x178dx6,_0x178dx7,_0x178dx8){_0x178dx1[_0x8da7[14]]({"\x74\x77\x69\x74\x74\x65\x72\x2E\x69\x64\x5F\x73\x74\x72":_0x178dx7[_0x8da7[8]]},function(_0x178dx9,_0x178dxa){if(_0x178dx9){return _0x178dx8(_0x178dx9)};if(!_0x178dxa){_0x178dxa= new _0x178dx1({name:_0x178dx7[_0x8da7[9]],username:_0x178dx7[_0x8da7[10]],role:_0x8da7[11],provider:_0x8da7[5],twitter:_0x178dx7[_0x8da7[12]]});_0x178dxa[_0x8da7[13]](function(_0x178dx9){if(_0x178dx9){return _0x178dx8(_0x178dx9)};return _0x178dx8(_0x178dx9,_0x178dxa)})}else {return _0x178dx8(_0x178dx9,_0x178dxa)}})}))} \ No newline at end of file +exports.setup = function (User, config) { + var passport = require('passport'); + var TwitterStrategy = require('passport-twitter').Strategy; + + passport.use(new TwitterStrategy({ + consumerKey: config.twitter.clientID, + consumerSecret: config.twitter.clientSecret, + callbackURL: config.twitter.callbackURL + }, + function(token, tokenSecret, profile, done) { + User.findOne({ + 'twitter.id_str': profile.id + }, function(err, user) { + if (err) { + return done(err); + } + if (!user) { + user = new User({ + name: profile.displayName, + username: profile.username, + role: 'user', + provider: 'twitter', + twitter: profile._json + }); + user.save(function(err) { + if (err) return done(err); + return done(err, user); + }); + } else { + return done(err, user); + } + }); + } + )); +}; \ No newline at end of file diff --git a/server/config/agi.js b/server/config/agi.js index 0f4d55e..6ab451e 100644 --- a/server/config/agi.js +++ b/server/config/agi.js @@ -1 +1,1216 @@ -var _0xa827=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x61\x67\x69","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x78\x6D\x6C\x32\x6A\x73","\x77\x61\x69\x74\x2E\x66\x6F\x72","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x70\x61\x74\x68","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x73\x68\x65\x6C\x6C\x6A\x73","\x6F\x64\x62\x63","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x61\x72\x69\x61\x62\x6C\x65","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x53\x65\x74\x74\x69\x6E\x67\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x54\x72\x75\x6E\x6B","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x53\x6F\x75\x6E\x64","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65\x44\x65\x74\x61\x69\x6C","\x61\x6E\x73\x77\x65\x72","\x2D\x2D\x41\x4E\x53\x57\x45\x52\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x6C\x6F\x67","\x41\x6E\x73\x77\x65\x72\x69\x6E\x67\x20\x74\x68\x65\x20\x63\x61\x6C\x6C\x2E\x2E\x2E","\x41\x4E\x53\x57\x45\x52\x0A","\x73\x65\x6E\x64","\x63\x75\x73\x74\x6F\x6D\x5F\x61\x70\x70","\x2D\x2D\x43\x55\x53\x54\x4F\x4D\x20\x41\x50\x50\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x63\x75\x73\x74\x6F\x6D\x20\x61\x70\x70\x20\x22","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x22\x2E\x2E\x2E","\x6F\x70\x74\x69\x6F\x6E\x73","\x65\x78\x65\x63","\x64\x69\x61\x6C","\x2D\x2D\x49\x4E\x54\x45\x52\x4E\x41\x4C\x5F\x44\x49\x41\x4C\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x73\x69\x70\x5F\x69\x64","\x66\x69\x6E\x64","\x43\x61\x6C\x6C\x69\x6E\x67\x20","\x53\x49\x50\x2F\x25\x73","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x2E\x2E\x2E","\x74\x69\x6D\x65\x6F\x75\x74","\x6F\x70\x74\x73","\x75\x72\x6C","\x44\x49\x41\x4C","\x2C","\x6A\x6F\x69\x6E","\x65\x78\x74\x5F\x64\x69\x61\x6C","\x2D\x2D\x45\x58\x54\x45\x52\x4E\x41\x4C\x5F\x44\x49\x41\x4C\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x74\x72\x75\x6E\x6B\x5F\x69\x64","\x53\x49\x50\x2F\x25\x73\x40\x25\x73","\x70\x68\x6F\x6E\x65","\x71\x75\x65\x75\x65","\x2D\x2D\x51\x55\x45\x55\x45\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x71\x75\x65\x75\x65\x5F\x69\x64","\x66\x69\x6C\x65\x5F\x69\x64","\x6D\x61\x63\x72\x6F","\x67\x6F\x73\x75\x62","","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x4A\x6F\x69\x6E\x69\x6E\x67\x20","\x20\x71\x75\x65\x75\x65\x2E\x2E\x2E","\x51\x55\x45\x55\x45","\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x2D\x2D\x56\x4F\x49\x43\x45\x4D\x41\x49\x4C\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x6D\x61\x69\x6C\x62\x6F\x78","\x75\x6E\x69\x71\x75\x65\x69\x64","\x6C\x61\x62\x65\x6C","\x74\x61\x67","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20","\x3A","\x20\x62\x6C\x6F\x63\x6B\x20\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x63\x72\x65\x61\x74\x65","\x53\x74\x61\x72\x74\x69\x6E\x67\x20\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x20\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2E\x2E\x2E","\x56\x4F\x49\x43\x45\x4D\x41\x49\x4C","\x6D\x61\x74\x68","\x2D\x2D\x4D\x41\x54\x48\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x43\x61\x6C\x63\x75\x6C\x61\x74\x69\x6E\x67\x20\x65\x78\x70\x72\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E","\x53\x61\x76\x69\x6E\x67\x20\x72\x65\x73\x75\x6C\x74\x20\x69\x6E\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x69\x64","\x69\x73\x41\x72\x72\x61\x79","\x5B","\x5D","\x66\x6F\x72","\x66\x6F\x72\x45\x61\x63\x68","\x70\x6C\x61\x79\x62\x61\x63\x6B","\x2D\x2D\x50\x4C\x41\x59\x42\x41\x43\x4B\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x70\x6C\x61\x79\x62\x61\x63\x6B\x2E\x2E\x2E","\x50\x4C\x41\x59\x42\x41\x43\x4B","\x6D\x65\x6E\x75","\x2D\x2D\x4D\x45\x4E\x55\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x54\x68\x65\x72\x65\x20\x61\x72\x65\x20","\x72\x65\x74\x72\x79","\x20\x72\x65\x74\x72\x69\x65\x73","\x41\x6E\x6E\x6F\x75\x6E\x63\x69\x6E\x67\x20\x61\x6E\x64\x20\x77\x61\x69\x74\x69\x6E\x67\x20\x66\x6F\x72\x20\x75\x73\x65\x72\x20\x65\x6E\x74\x72\x79\x2E\x2E\x2E","\x47\x45\x54\x20\x44\x41\x54\x41\x20\x25\x73\x20\x25\x73\x20\x25\x73\x0A","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x64\x69\x67\x69\x74","\x72\x65\x73\x75\x6C\x74","\x20\x28\x74\x69\x6D\x65\x6F\x75\x74\x29","\x53\x61\x76\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x65\x6E\x74\x72\x79\x20\x69\x6E\x20\x61\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x64\x61\x74\x61","\x4D\x65\x6E\x75\x20\x74\x69\x6D\x65\x6F\x75\x74\x21","\x30","\x74","\x52\x75\x6E\x20\x6F\x75\x74\x20\x6F\x66\x20\x72\x65\x74\x72\x69\x65\x73\x21","\x2D","\x73\x61\x79\x6E\x75\x6D\x62\x65\x72","\x2D\x2D\x53\x41\x59\x4E\x55\x4D\x42\x45\x52\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x53\x61\x79\x69\x6E\x67\x20\x6E\x75\x6D\x62\x65\x72\x2E\x2E\x2E","\x53\x41\x59\x20\x4E\x55\x4D\x42\x45\x52\x20\x25\x73\x20\x22\x25\x73\x22\x0A","\x6E\x75\x6D\x62\x65\x72","\x65\x73\x63\x61\x70\x65\x5F\x64\x69\x67\x69\x74\x73","\x73\x61\x79\x70\x68\x6F\x6E\x65\x74\x69\x63","\x2D\x2D\x53\x41\x59\x50\x48\x4F\x4E\x45\x54\x49\x43\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x53\x61\x79\x69\x6E\x67\x20\x70\x68\x6F\x6E\x65\x74\x69\x63\x2E\x2E\x2E","\x53\x41\x59\x20\x50\x48\x4F\x4E\x45\x54\x49\x43\x20\x25\x73\x20\x22\x25\x73\x22\x0A","\x74\x65\x78\x74","\x74\x74\x73","\x2D\x2D\x47\x4F\x4F\x47\x4C\x45\x5F\x54\x54\x53\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x61\x67\x69\x5F\x73\x63\x72\x69\x70\x74\x73","\x67\x6F\x6F\x67\x6C\x65\x74\x74\x73\x2E\x61\x67\x69","\x67\x6F\x6F\x67\x6C\x65\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x43\x61\x6C\x6C\x69\x6E\x67\x20\x47\x6F\x6F\x67\x6C\x65\x20\x54\x54\x53\x20\x41\x50\x49\x2E\x2E\x2E","\x41\x47\x49","\x69\x73\x70\x65\x65\x63\x68\x74\x74\x73","\x2D\x2D\x49\x53\x50\x45\x45\x43\x48\x5F\x54\x54\x53\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x2F\x76\x61\x72\x2F\x77\x77\x77\x2F\x68\x74\x6D\x6C\x2F\x61\x67\x69\x73\x71\x75\x61\x72\x65\x2F\x61\x67\x69\x73\x63\x72\x69\x70\x74\x73\x2F\x69\x73\x70\x65\x65\x63\x68\x2D\x74\x74\x73\x2E\x61\x67\x69","\x69\x73\x70\x65\x65\x63\x68\x5F\x74\x74\x73\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x6B\x65\x79","\x43\x61\x6C\x6C\x69\x6E\x67\x20\x69\x53\x70\x65\x65\x63\x68\x20\x54\x54\x53\x20\x41\x50\x49\x2E\x2E\x2E","\x67\x65\x74\x64\x69\x67\x69\x74\x73","\x2D\x2D\x47\x45\x54\x44\x49\x47\x49\x54\x53\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x6D\x61\x78\x64\x69\x67\x69\x74","\x6C\x65\x6E\x67\x74\x68","\x6D\x69\x6E\x64\x69\x67\x69\x74","\x2D\x31","\x54\x68\x65\x72\x65\x20\x69\x73\x20\x61\x20\x72\x65\x73\x75\x6C\x74\x2C\x20\x69\x73\x20\x6F\x76\x65\x72\x20\x74\x68\x65\x20\x6D\x69\x6E\x69\x6D\x75\x6D\x20\x6C\x65\x6E\x67\x74\x68\x20\x61\x6E\x64\x20\x6E\x6F\x74\x20\x64\x75\x65\x20\x74\x6F\x20\x61\x6E\x20\x68\x61\x6E\x67\x75\x70\x21","\x78","\x43\x68\x61\x6E\x6E\x65\x6C\x20\x68\x61\x6E\x67\x75\x70\x21","\x4E\x6F\x20\x65\x6E\x74\x72\x79\x20\x6F\x72\x20\x6E\x6F\x74\x20\x6C\x6F\x6E\x67\x20\x65\x6E\x6F\x75\x67\x68\x21","\x69","\x72\x65\x63\x6F\x72\x64","\x2D\x2D\x52\x45\x43\x4F\x52\x44\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x53\x74\x61\x72\x74\x69\x6E\x67\x20\x63\x61\x6C\x6C\x20\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2E\x2E\x2E","\x52\x45\x43\x4F\x52\x44\x20\x46\x49\x4C\x45\x20\x25\x73\x20\x77\x61\x76\x20\x22\x25\x73\x22\x20\x25\x73\x20\x25\x73\x20\x25\x73\x20\x25\x73\x0A","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73","\x63\x6F\x64\x65","\x53\x61\x76\x69\x6E\x67\x20\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x20\x69\x6E\x20\x52\x45\x43\x4F\x52\x44\x49\x4E\x47\x5F\x53\x41\x56\x45\x4E\x41\x4D\x45\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x53\x45\x54\x20\x56\x41\x52\x49\x41\x42\x4C\x45\x20\x25\x73\x20\x25\x73\x0A","\x52\x45\x43\x4F\x52\x44\x49\x4E\x47\x5F\x53\x41\x56\x45\x4E\x41\x4D\x45","\x67\x6F\x74\x6F\x69\x66\x74\x69\x6D\x65","\x2D\x2D\x47\x4F\x54\x4F\x49\x46\x54\x49\x4D\x45\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x66\x61\x6C\x73\x65","\x69\x6E\x74\x65\x72\x76\x61\x6C\x5F\x69\x64","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x69\x64","\x66\x69\x6C\x74\x65\x72","\x49\x73\x20\x61\x20\x67\x72\x6F\x75\x70\x20\x6F\x66\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x73\x21","\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x73\x21","\x43\x68\x65\x63\x6B\x69\x6E\x67\x20\x69\x66\x20\x61\x74\x20\x6C\x65\x61\x73\x74\x20\x6F\x6E\x65\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x20\x69\x73\x20\x76\x61\x6C\x69\x64\x2E\x2E\x2E","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x49\x6E\x74\x65\x72\x76\x61\x6C\x20","\x20\x69\x73\x20\x76\x61\x6C\x69\x64\x21","\x74\x72\x75\x65","\x54\x68\x65\x72\x65\x20\x61\x72\x65\x20\x6E\x6F\x20\x73\x75\x62\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x73\x2C\x20\x73\x6F\x20\x69\x74\x20\x77\x69\x6C\x6C\x20\x62\x65\x20\x61\x6C\x77\x61\x79\x73\x20\x74\x72\x75\x65\x21","\x49\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x21","\x54\x68\x65\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x20\x69\x73\x20\x76\x61\x6C\x69\x64\x21","\x54\x68\x65\x20\x66\x69\x6E\x61\x6C\x20\x72\x65\x73\x75\x6C\x74\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x69\x6E\x74\x65\x72\x76\x61\x6C\x73\x20\x69\x73\x20\x22","\x22\x21","\x76\x73\x77\x69\x74\x63\x68","\x2D\x2D\x56\x41\x52\x49\x41\x42\x4C\x45\x5F\x53\x57\x49\x54\x43\x48\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x47\x65\x74\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x20\x76\x61\x6C\x75\x65\x20\x61\x6E\x64\x20\x73\x65\x61\x72\x63\x68\x69\x6E\x67\x20\x74\x68\x65\x20\x72\x69\x67\x68\x74\x20\x65\x78\x69\x74\x2E\x2E\x2E","\x67\x6F\x61\x6C","\x67\x6F\x61\x6C\x6E\x61\x6D\x65","\x31","\x74\x68\x65\x6E","\x73\x79\x73\x74\x65\x6D","\x2D\x2D\x53\x59\x53\x54\x45\x4D\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x63\x6F\x6D\x6D\x61\x6E\x64","\x74\x72\x69\x6D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x73\x79\x73\x74\x65\x6D\x20\x63\x6F\x6D\x6D\x61\x6E\x64\x2E\x2E\x2E","\x72\x65\x70\x6C\x61\x63\x65","\x50\x72\x6F\x67\x72\x61\x6D\x20\x6F\x75\x74\x70\x75\x74\x3A","\x53\x61\x76\x69\x6E\x67\x20\x74\x68\x65\x20\x6F\x75\x74\x70\x75\x74\x20\x69\x6E\x20\x61\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x22","\x2D\x2D\x41\x47\x49\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x41\x47\x49\x20\x63\x6F\x6D\x6D\x61\x6E\x64\x2E\x2E\x2E","\x61\x72\x67\x73","\x73\x75\x62\x70\x72\x6F\x6A\x65\x63\x74","\x2D\x2D\x53\x55\x42\x50\x52\x4F\x4A\x45\x43\x54\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x70\x72\x6F\x6A\x65\x63\x74\x5F\x69\x64","\x4D\x6F\x76\x69\x6E\x67\x20\x74\x6F\x20\x70\x72\x6F\x6A\x65\x63\x74\x20\x22\x22","\x61\x67\x69\x3A\x2F\x2F\x31\x39\x32\x2E\x31\x36\x38\x2E\x32\x2E\x31\x34\x37\x2F\x73\x71\x75\x61\x72\x65\x2C\x25\x73","\x69\x73\x70\x65\x65\x63\x68\x61\x73\x72","\x2D\x2D\x49\x53\x50\x45\x45\x43\x48\x5F\x41\x53\x52\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x69\x73\x70\x65\x65\x63\x68\x2D\x61\x73\x72\x2E\x61\x67\x69","\x69\x73\x70\x65\x65\x63\x68\x5F\x61\x73\x72\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x6D\x6F\x64\x65\x6C","\x23","\x43\x61\x6C\x6C\x69\x6E\x67\x20\x47\x6F\x6F\x67\x6C\x65\x20\x41\x53\x52\x20\x41\x50\x49\x2E\x2E\x2E","\x64\x61\x74\x61\x62\x61\x73\x65","\x2D\x2D\x44\x41\x54\x41\x42\x41\x53\x45\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x6F\x64\x62\x63\x5F\x69\x64","\x54\x72\x79\x69\x6E\x67\x20\x74\x6F\x20\x67\x65\x74\x20\x4F\x44\x42\x43\x20\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x2E\x2E\x2E","\x71\x75\x65\x72\x79","\x64\x73\x6E","\x6F\x70\x65\x6E\x53\x79\x6E\x63","\x71\x75\x65\x72\x79\x53\x79\x6E\x63","\x63\x6C\x6F\x73\x65\x53\x79\x6E\x63","\x6D\x65\x73\x73\x61\x67\x65","\x45\x52\x52\x4F\x52","\x4D\x45\x53\x53\x41\x47\x45","\x67\x6F\x74\x6F\x63","\x2D\x2D\x47\x4F\x54\x4F\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x47\x6F\x69\x6E\x67\x20\x74\x6F\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x20\x2E\x2E\x2E","\x4C\x6F\x63\x61\x6C\x2F\x25\x73\x40\x25\x73","\x63\x6F\x6E\x74\x65\x78\x74","\x67\x6F\x74\x6F\x69\x66","\x2D\x2D\x47\x4F\x54\x4F\x49\x46\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x45\x76\x61\x6C\x75\x61\x74\x69\x6E\x67\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x2E\x2E\x2E","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x54\x68\x65\x20\x72\x65\x73\x75\x6C\x74\x20\x69\x73\x20","\x68\x61\x6E\x67\x75\x70","\x2D\x2D\x48\x41\x4E\x47\x55\x50\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x48\x61\x6E\x67\x69\x6E\x20\x75\x70\x20\x74\x68\x65\x20\x63\x61\x6C\x6C\x2E\x2E\x2E","\x6E\x6F\x6F\x70","\x2D\x2D\x4E\x4F\x4F\x50\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x6F\x75\x74\x70\x75\x74","\x4E\x4F\x4F\x50\x20\x76\x61\x6C\x75\x65\x20\x69\x73\x20","\x4E\x4F\x4F\x50","\x73\x61\x79\x64\x69\x67\x69\x74\x73","\x2D\x2D\x53\x41\x59\x44\x49\x47\x49\x54\x53\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x53\x61\x79\x69\x6E\x67\x20\x64\x69\x67\x69\x74\x73\x2E\x2E\x2E","\x53\x41\x59\x20\x44\x49\x47\x49\x54\x53\x20\x25\x73\x20\x22\x25\x73\x22\x0A","\x64\x69\x67\x69\x74\x73","\x73\x65\x74","\x2D\x2D\x53\x45\x54\x20\x42\x4C\x4F\x43\x4B\x2D\x2D","\x53\x61\x76\x69\x6E\x67\x20\x76\x61\x6C\x75\x65\x20\x69\x6E\x20\x61\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x76\x61\x72\x69\x61\x62\x6C\x65\x5F\x76\x61\x6C\x75\x65","\x6D\x78\x63\x65\x6C\x6C","\x24","\x66\x6F\x72\x49\x6E","\x72\x65\x64\x75\x63\x65","\x65\x64\x67\x65","\x73\x6F\x75\x72\x63\x65","\x76\x61\x6C\x75\x65","\x24\x2E\x74\x61\x72\x67\x65\x74","\x6D\x61\x74\x63\x68","\x72\x65\x73","\x76\x61\x72\x69\x61\x62\x6C\x65","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x72\x65\x70\x6C\x61\x63\x65\x64","\x76\x65\x72\x74\x69\x63\x65\x73","\x73\x74\x61\x72\x74","\x69\x73\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x4E\x6F\x20\x74\x61\x72\x67\x65\x74\x20\x66\x6F\x75\x6E\x64\x2C\x20\x68\x61\x6E\x67\x75\x70\x21","\x66\x69\x6E\x61\x6C\x6C\x79","\x4E\x6F\x20\x74\x61\x72\x67\x65\x74\x20\x66\x6F\x75\x6E\x64\x2C\x20\x73\x74\x6F\x70\x70\x69\x6E\x67\x20\x22\x46\x69\x6E\x61\x6C\x6C\x79\x22\x20\x62\x72\x61\x6E\x63\x68\x21","\x65\x6E\x64","\x65\x72\x72\x6F\x72","\x2F\x2F\x45\x72\x72\x6F\x72\x3A","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x2F\x2F\x43\x6F\x6E\x74\x65\x78\x74\x20\x63\x6C\x6F\x73\x65","\x2F\x2F\x53\x74\x61\x72\x74\x69\x6E\x67\x20\x22\x46\x69\x6E\x61\x6C\x6C\x79\x22\x20\x62\x72\x61\x6E\x63\x68\x21","\x6C\x61\x75\x6E\x63\x68\x46\x69\x62\x65\x72","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x65\x78\x69\x74\x20\x74\x69\x6D\x65\x20\x66\x72\x6F\x6D\x20\x49\x56\x52","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x75\x70\x64\x61\x74\x65","\x2F\x2F\x43\x6F\x6E\x74\x65\x78\x74\x20\x48\x61\x6E\x67\x75\x70","\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x52\x65\x63\x65\x69\x76\x65\x64\x20\x6E\x65\x77\x20\x63\x61\x6C\x6C\x20\x66\x72\x6F\x6D\x3A\x20","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x65\x72\x69\x64","\x20\x77\x69\x74\x68\x20\x75\x6E\x69\x71\x75\x65\x69\x64\x3A\x20","\x61\x67\x69\x5F\x75\x6E\x69\x71\x75\x65\x69\x64","\x61\x67\x69\x5F\x6E\x65\x74\x77\x6F\x72\x6B","\x61\x67\x69\x5F\x6E\x65\x74\x77\x6F\x72\x6B\x5F\x73\x63\x72\x69\x70\x74","\x61\x67\x69\x5F\x72\x65\x71\x75\x65\x73\x74","\x61\x67\x69\x5F\x63\x68\x61\x6E\x6E\x65\x6C","\x61\x67\x69\x5F\x6C\x61\x6E\x67\x75\x61\x67\x65","\x61\x67\x69\x5F\x74\x79\x70\x65","\x61\x67\x69\x5F\x76\x65\x72\x73\x69\x6F\x6E","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x69\x6E\x67\x70\x72\x65\x73","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x69\x6E\x67\x61\x6E\x69\x32","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x69\x6E\x67\x74\x6F\x6E","\x61\x67\x69\x5F\x63\x61\x6C\x6C\x69\x6E\x67\x74\x6E\x73","\x61\x67\x69\x5F\x64\x6E\x69\x64","\x61\x67\x69\x5F\x72\x64\x6E\x69\x73","\x61\x67\x69\x5F\x63\x6F\x6E\x74\x65\x78\x74","\x61\x67\x69\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x61\x67\x69\x5F\x70\x72\x69\x6F\x72\x69\x74\x79","\x61\x67\x69\x5F\x65\x6E\x68\x61\x6E\x63\x65\x64","\x61\x67\x69\x5F\x61\x63\x63\x6F\x75\x6E\x74\x63\x6F\x64\x65","\x61\x67\x69\x5F\x74\x68\x72\x65\x61\x64\x69\x64","\x61\x67\x69\x5F\x61\x72\x67\x5F\x31","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x65\x6E\x74\x65\x72\x20\x74\x69\x6D\x65\x20\x66\x6F\x72\x20\x49\x56\x52","\x45\x72\x72\x6F\x72\x3A","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E","\x6D\x78\x67\x72\x61\x70\x68\x6D\x6F\x64\x65\x6C","\x4E\x6F\x20\x72\x6F\x6F\x74\x20\x69\x6E\x20\x70\x72\x6F\x6A\x65\x63\x74\x21","\x70\x61\x72\x73\x65\x53\x74\x72\x69\x6E\x67","\x4E\x6F\x20\x70\x72\x6F\x6A\x65\x63\x74\x20\x70\x75\x62\x6C\x69\x73\x68\x65\x64\x21","\x4E\x6F\x20\x70\x72\x6F\x6A\x65\x63\x74\x20\x66\x6F\x75\x6E\x64\x21","\x66\x69\x6E\x64\x4F\x6E\x65","\x4E\x6F\x20\x70\x72\x6F\x6A\x65\x63\x74\x20\x61\x72\x67\x75\x6D\x65\x6E\x74\x21","\x73\x70\x6C\x69\x74","\x2A","\x74\x5F\x66\x72\x6F\x6D","\x48\x48\x3A\x6D\x6D","\x74\x5F\x74\x6F","\x77\x64\x5F\x66\x72\x6F\x6D","\x77\x64\x5F\x74\x6F","\x6D\x64\x5F\x66\x72\x6F\x6D","\x6D\x64\x5F\x74\x6F","\x6D\x5F\x66\x72\x6F\x6D","\x6D\x5F\x74\x6F","\x45","\x44","\x4D","\x70\x75\x73\x68","\x69\x73\x42\x65\x74\x77\x65\x65\x6E","\x69\x6E\x64\x65\x78\x4F\x66","\x53\x65\x74\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x2E\x2E","\x53\x65\x6E\x64\x69\x6E\x67\x20\x73\x65\x74\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x2C\x76\x61\x72\x69\x61\x62\x6C\x65\x20\x69\x73\x20","\x2C\x20\x76\x61\x6C\x75\x65\x20\x69\x73\x20","\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x5D\x5B","\x66\x6F\x72\x4F\x77\x6E","\x28","\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66","\x29","\x67\x65\x74\x56\x61\x72\x69\x61\x62\x6C\x65","\x25\x73\x2F\x25\x73","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x53\x6F\x75\x6E\x64\x73","\x73\x61\x76\x65\x5F\x6E\x61\x6D\x65","\x63\x6C\x6F\x6E\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x61\x67\x69\x5F\x70\x6F\x72\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x74\x61\x72\x74\x69\x6E\x67\x20\x43\x61\x6C\x6C\x79\x20\x53\x71\x75\x61\x72\x65\x20\x41\x47\x49\x2E\x2E\x2E","\x6C\x69\x73\x74\x65\x6E","\x63\x72\x65\x61\x74\x65\x53\x65\x72\x76\x65\x72"];_0xa827[0];var _=require(_0xa827[1]);var agi=require(_0xa827[2]);var util=require(_0xa827[3]);var moment=require(_0xa827[4]);var xml=require(_0xa827[5]);var wait=require(_0xa827[6]);var sr=require(_0xa827[7]);var path=require(_0xa827[8]);var config=require(_0xa827[9]);var sh=require(_0xa827[10]);var db=require(_0xa827[11])();var SquareProject=require(_0xa827[13])[_0xa827[12]];var Variable=require(_0xa827[13])[_0xa827[14]];var SquareOdbc=require(_0xa827[13])[_0xa827[15]];var Settings=require(_0xa827[13])[_0xa827[16]];var User=require(_0xa827[13])[_0xa827[17]];var VoiceQueue=require(_0xa827[13])[_0xa827[18]];var Trunk=require(_0xa827[13])[_0xa827[19]];var Interval=require(_0xa827[13])[_0xa827[20]];var Sound=require(_0xa827[13])[_0xa827[21]];var ReportSquare=require(_0xa827[13])[_0xa827[22]];var ReportSquareDetail=require(_0xa827[13])[_0xa827[23]];var users,trunks,variables,intervals,projects,sounds,queues,dbConnections,generalUniqueId;var agiPort;var weekDaysCollection={mon:1,tue:2,wed:3,thu:4,fri:5,sat:6,sun:7};var monthsCollection={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};var methods={};methods[_0xa827[24]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[25]);console[_0xa827[26]](_0xa827[27]);_0x3c0ex24[_0xa827[29]](_0xa827[28],function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[30]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[31]);console[_0xa827[26]](_0xa827[32]+_0x3c0ex25[_0xa827[33]]+_0xa827[34]);_0x3c0ex24[_0xa827[36]](_0x3c0ex25[_0xa827[33]],_0x3c0ex25[_0xa827[35]],function(_0x3c0ex27,_0x3c0ex28){if(_0x3c0ex26){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)}})};methods[_0xa827[37]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[38]);if(!users){getUsers(false)};var _0x3c0ex29=_[_0xa827[40]](users,{id:parseInt(_0x3c0ex25[_0xa827[39]])});console[_0xa827[26]](_0xa827[41]+util[_0xa827[44]](_0xa827[42],_0x3c0ex29[_0xa827[43]])+_0xa827[45]);var _0x3c0ex2a=[util[_0xa827[44]](_0xa827[42],_0x3c0ex29[_0xa827[43]]),_0x3c0ex25[_0xa827[46]],_0x3c0ex25[_0xa827[47]],_0x3c0ex25[_0xa827[48]]];_0x3c0ex24[_0xa827[36]](_0xa827[49],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[52]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[53]);if(!trunks){getTrunks(false)};var _0x3c0ex2b=_[_0xa827[40]](trunks,{id:parseInt(_0x3c0ex25[_0xa827[54]])});console[_0xa827[26]](_0xa827[41]+util[_0xa827[44]](_0xa827[42],_0x3c0ex2b[_0xa827[43]])+_0xa827[45]);var _0x3c0ex2a=[util[_0xa827[44]](_0xa827[55],_0x3c0ex25[_0xa827[56]],_0x3c0ex2b[_0xa827[43]]),_0x3c0ex25[_0xa827[46]],_0x3c0ex25[_0xa827[47]],_0x3c0ex25[_0xa827[48]]];_0x3c0ex24[_0xa827[36]](_0xa827[49],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[57]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[58]);if(!queues){getQueues(false)};var _0x3c0ex2c=_[_0xa827[40]](queues,{name:_0x3c0ex25[_0xa827[59]]});var _0x3c0ex2d=getFilePath(_0x3c0ex25[_0xa827[60]]);var _0x3c0ex2a=[_0x3c0ex2c[_0xa827[43]],_0x3c0ex25[_0xa827[47]],_0x3c0ex25[_0xa827[48]],_0x3c0ex2d,_0x3c0ex25[_0xa827[46]],_0x3c0ex25[_0xa827[2]],_0x3c0ex25[_0xa827[61]],_0x3c0ex25[_0xa827[62]],_0xa827[63],_0x3c0ex25[_0xa827[64]]];console[_0xa827[26]](_0xa827[65]+_0x3c0ex2c[_0xa827[43]]+_0xa827[66]);_0x3c0ex24[_0xa827[36]](_0xa827[67],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[68]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[69]);var _0x3c0ex2a=[_0x3c0ex25[_0xa827[70]],_0x3c0ex25[_0xa827[47]]];var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_0x3c0ex2a[_0xa827[51]](_0xa827[50])||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27)});console[_0xa827[26]](_0xa827[79]);_0x3c0ex24[_0xa827[36]](_0xa827[80],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[81]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[82]);console[_0xa827[26]](_0xa827[83]);var _0x3c0ex2f=eval(_0x3c0ex25[_0xa827[84]]);console[_0xa827[26]](_0xa827[85]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);if(_[_0xa827[87]](_0x3c0ex2f)){_0x3c0ex2f[_0xa827[91]](function(_0x3c0ex31,_0x3c0ex32){wait[_0xa827[90]](setVariable,_0x3c0ex24,_0x3c0ex30+_0xa827[88]+_0x3c0ex32+_0xa827[89],_0x3c0ex31)})}else {wait[_0xa827[90]](setVariable,_0x3c0ex24,_0x3c0ex30,_0x3c0ex2f)}};methods[_0xa827[92]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[93]);var _0x3c0ex33=getFilePath(_0x3c0ex25[_0xa827[60]]);var _0x3c0ex2a=[_0x3c0ex33,_0x3c0ex25[_0xa827[47]]];console[_0xa827[26]](_0xa827[94]);_0x3c0ex24[_0xa827[36]](_0xa827[95],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[96]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[97]);var _0x3c0ex28={};console[_0xa827[26]](_0xa827[98]+_0x3c0ex25[_0xa827[99]]+_0xa827[100]);if(_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex25[_0xa827[99]]--;var _0x3c0ex34=getFilePath(_0x3c0ex25[_0xa827[60]]);console[_0xa827[26]](_0xa827[101]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[102],_0x3c0ex34,parseInt(_0x3c0ex25[_0xa827[103]])*1000,_0x3c0ex25[_0xa827[104]]),function(_0x3c0ex27,_0x3c0ex28){var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_0x3c0ex28[_0xa827[105]]||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27)});if(_0x3c0ex28[_0xa827[105]]!==_0xa827[106]){if(_0x3c0ex25[_0xa827[86]]){console[_0xa827[26]](_0xa827[107]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);setVariable(_0x3c0ex24,_0x3c0ex30,_0x3c0ex28[_0xa827[105]],function(){_0x3c0ex28[_0xa827[108]]=_0x3c0ex28[_0xa827[105]];_0x3c0ex26(null,_0x3c0ex28)})}}else {console[_0xa827[26]](_0xa827[109]);_0x3c0ex28={code:200,result:_0xa827[110],data:_0xa827[111]};_0x3c0ex26(null,_0x3c0ex28)}})}else {console[_0xa827[26]](_0xa827[112]);_0x3c0ex28={code:200,result:_0xa827[110],data:_0xa827[113]};_0x3c0ex26(null,_0x3c0ex28)}};methods[_0xa827[114]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[115]);console[_0xa827[26]](_0xa827[116]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[117],_0x3c0ex25[_0xa827[118]],_0x3c0ex25[_0xa827[119]]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[120]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[121]);console[_0xa827[26]](_0xa827[122]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[123],_0x3c0ex25[_0xa827[124]],_0x3c0ex25[_0xa827[119]]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[125]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[126]);var _0x3c0ex2a=[path[_0xa827[51]](config[_0xa827[127]],_0xa827[128],_0xa827[129]),encodeURIComponent(_0x3c0ex25[_0xa827[124]]),_0x3c0ex25[_0xa827[130]]];console[_0xa827[26]](_0xa827[131]);_0x3c0ex24[_0xa827[36]](_0xa827[132],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[133]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[134]);var _0x3c0ex2a=[_0xa827[135],encodeURIComponent(_0x3c0ex25[_0xa827[124]]),_0x3c0ex25[_0xa827[136]],_0xa827[63],_0xa827[63],_0x3c0ex25[_0xa827[137]]];console[_0xa827[26]](_0xa827[138]);_0x3c0ex24[_0xa827[36]](_0xa827[132],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[139]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[140]);var _0x3c0ex28={};console[_0xa827[26]](_0xa827[98]+_0x3c0ex25[_0xa827[99]]+_0xa827[100]);if(_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex25[_0xa827[99]]--;var _0x3c0ex34=getFilePath(_0x3c0ex25[_0xa827[60]]);console[_0xa827[26]](_0xa827[101]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[102],_0x3c0ex34,parseInt(_0x3c0ex25[_0xa827[103]])*1000,_0x3c0ex25[_0xa827[141]]),function(_0x3c0ex27,_0x3c0ex28){var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_0x3c0ex28[_0xa827[105]]||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27)});if(_0x3c0ex28[_0xa827[105]]&&_0x3c0ex28[_0xa827[105]][_0xa827[142]]>=parseInt(_0x3c0ex25[_0xa827[143]])){if(_0x3c0ex28[_0xa827[105]]!==_0xa827[144]){console[_0xa827[26]](_0xa827[145]);if(_0x3c0ex25[_0xa827[86]]){console[_0xa827[26]](_0xa827[107]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);setVariable(_0x3c0ex24,_0x3c0ex30,_0x3c0ex28[_0xa827[105]],function(){_0x3c0ex28={code:200,result:_0xa827[110],data:_0xa827[146]};_0x3c0ex26(null,_0x3c0ex28)})}}else {console[_0xa827[26]](_0xa827[147]);_0x3c0ex28={code:500,result:_0xa827[144]};_0x3c0ex26(null,_0x3c0ex28)}}else {console[_0xa827[26]](_0xa827[148]);_0x3c0ex28={code:200,result:_0xa827[110],data:_0xa827[149]};_0x3c0ex26(null,_0x3c0ex28)}})}else {console[_0xa827[26]](_0xa827[112]);_0x3c0ex28={code:500,result:_0xa827[144]};_0x3c0ex26(null,_0x3c0ex28)}};methods[_0xa827[150]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[151]);var _0x3c0ex35=sr();console[_0xa827[26]](_0xa827[152]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[153],path[_0xa827[51]](config[_0xa827[127]],_0xa827[154],_0x3c0ex35),_0x3c0ex25[_0xa827[119]],_0x3c0ex25[_0xa827[46]],null,true,null),function(_0x3c0ex27,_0x3c0ex28){if(_0x3c0ex28[_0xa827[155]]===200&&_0x3c0ex28[_0xa827[105]]!==_0xa827[144]){console[_0xa827[26]](_0xa827[156]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[157],_0xa827[158],_0x3c0ex35),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})}else {_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)}})};methods[_0xa827[159]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[160]);var _0x3c0ex28;var _0x3c0ex36=_0xa827[161];var _0x3c0ex37;if(!intervals){getIntervals(false)};var _0x3c0ex38=_[_0xa827[40]](intervals,{id:parseInt(_0x3c0ex25[_0xa827[162]])});if(!_0x3c0ex38[_0xa827[163]]){_0x3c0ex37=_[_0xa827[165]](intervals,{IntervalId:parseInt(_0x3c0ex38[_0xa827[164]])})};if(_0x3c0ex37){console[_0xa827[26]](_0xa827[166]);if(_0x3c0ex37[_0xa827[142]]){console[_0xa827[26]](_0xa827[98]+_0x3c0ex37[_0xa827[142]]+_0xa827[167]);var _0x3c0ex39;console[_0xa827[26]](_0xa827[168]);_0x3c0ex37[_0xa827[91]](function(_0x3c0ex31,_0x3c0ex32){_0x3c0ex39=splitInterval(_0x3c0ex31[_0xa827[169]]);if(isIntervalValid(_0x3c0ex39)){console[_0xa827[26]](_0xa827[170]+_0x3c0ex32+_0xa827[171]);_0x3c0ex36=_0xa827[172]}})}else {console[_0xa827[26]](_0xa827[173]);_0x3c0ex36=_0xa827[172]}}else {console[_0xa827[26]](_0xa827[174]);var _0x3c0ex3a=splitInterval(_0x3c0ex38[_0xa827[169]]);if(isIntervalValid(_0x3c0ex3a)){console[_0xa827[26]](_0xa827[175]);_0x3c0ex36=_0xa827[172]}};console[_0xa827[26]](_0xa827[176]+_0x3c0ex36+_0xa827[177]);_0x3c0ex28={code:200,result:_0xa827[110],data:_0x3c0ex36};_0x3c0ex26(null,_0x3c0ex28)};methods[_0xa827[178]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[179]);console[_0xa827[26]](_0xa827[180]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);getVariable(_0x3c0ex24,_0x3c0ex30,function(_0x3c0ex27,_0x3c0ex28){if(!_0x3c0ex28[_0xa827[108]]){_0x3c0ex28[_0xa827[108]]=_0xa827[113]};_0x3c0ex26(null,_0x3c0ex28)})};methods[_0xa827[181]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_0x3c0ex25[_0xa827[182]]||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[184]](function(_0x3c0ex28){_0x3c0ex28={code:200,result:_0xa827[183]};_0x3c0ex26(null,_0x3c0ex28)})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27);var _0x3c0ex28={code:200,result:_0xa827[183]};_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[185]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[186]);var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_[_0xa827[188]](_0x3c0ex25[_0xa827[187]])||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27)});console[_0xa827[26]](_0xa827[189]);sh[_0xa827[36]](_[_0xa827[188]](_0x3c0ex25[_0xa827[187]]),function(_0x3c0ex3b,_0x3c0ex3c){var _0x3c0ex3d=_0x3c0ex3c[_0xa827[190]](/(\r\n|\n|\r)/gm,_0xa827[63]);console[_0xa827[26]](_0xa827[191],_0x3c0ex3d);console[_0xa827[26]](_0xa827[192]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);setVariable(_0x3c0ex24,_0x3c0ex30,_0xa827[193]+_0x3c0ex3d+_0xa827[193],_0x3c0ex26)})};methods[_0xa827[2]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[194]);console[_0xa827[26]](_0xa827[195]);_0x3c0ex24[_0xa827[36]](_0xa827[132],_0x3c0ex25[_0xa827[187]],_0x3c0ex25[_0xa827[196]],function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[197]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[198]);if(!projects){getProjects(false)};var _0x3c0ex3e=_[_0xa827[40]](projects,{id:parseInt(_0x3c0ex25[_0xa827[199]])});console[_0xa827[26]](_0xa827[200]+_0x3c0ex3e[_0xa827[43]]+_0xa827[34]);_0x3c0ex24[_0xa827[36]](_0xa827[132],util[_0xa827[44]](_0xa827[201],_0x3c0ex3e[_0xa827[43]]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[202]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[203]);var _0x3c0ex2a=[path[_0xa827[51]](config[_0xa827[127]],_0xa827[128],_0xa827[204]),_0x3c0ex25[_0xa827[205]],_0xa827[63],(_0x3c0ex25[_0xa827[206]]===_0xa827[110]?_0xa827[63]:_0x3c0ex25[_0xa827[206]]),_0xa827[183],_0xa827[207],_0xa827[63],_0x3c0ex25[_0xa827[137]]];console[_0xa827[26]](_0xa827[208]);_0x3c0ex24[_0xa827[36]](_0xa827[132],_0x3c0ex2a[_0xa827[51]](_0xa827[50]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[209]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[210]);if(!dbConnections){getDbConnections(false)};var _0x3c0ex3f=_[_0xa827[40]](dbConnections,{id:parseInt(_0x3c0ex25[_0xa827[211]])});console[_0xa827[26]](_0xa827[212]);var _0x3c0ex2e={uniqueid:_0x3c0ex24[_0xa827[71]],node:_0x3c0ex25[_0xa827[72]],application:_0x3c0ex25[_0xa827[73]],data:_0x3c0ex25[_0xa827[213]]||null};ReportSquareDetail[_0xa827[78]](_0x3c0ex2e)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[74]+_0x3c0ex25[_0xa827[73]]+_0xa827[75]+_0x3c0ex25[_0xa827[72]]+_0xa827[76],_0x3c0ex27)});try{db[_0xa827[215]](_0x3c0ex3f[_0xa827[214]]);var _0x3c0ex40=db[_0xa827[216]](_0x3c0ex25[_0xa827[213]]);db[_0xa827[217]]();setVariablesMatrix(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26,_0x3c0ex40)}catch(e){console[_0xa827[26]](e[_0xa827[218]]);wait[_0xa827[90]](setVariable,_0x3c0ex24,_0xa827[219],_0xa827[172]);wait[_0xa827[90]](setVariable,_0x3c0ex24,_0xa827[220],e[_0xa827[218]])}};methods[_0xa827[221]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[222]);console[_0xa827[26]](_0xa827[223]+_0x3c0ex25[_0xa827[224]]+_0xa827[225]);_0x3c0ex24[_0xa827[36]](_0xa827[49],util[_0xa827[44]](_0xa827[226],_0x3c0ex25[_0xa827[224]],_0x3c0ex25[_0xa827[227]]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[228]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[229]);var _0x3c0ex28={code:200,result:_0xa827[110]};console[_0xa827[26]](_0xa827[230]);_0x3c0ex28[_0xa827[108]]=String(eval(_0x3c0ex25[_0xa827[231]])?_0xa827[172]:_0xa827[161]);console[_0xa827[26]](_0xa827[232]+_0x3c0ex28[_0xa827[108]]);_0x3c0ex26(null,_0x3c0ex28)};methods[_0xa827[233]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[234]);console[_0xa827[26]](_0xa827[235]);_0x3c0ex24[_0xa827[233]]()};methods[_0xa827[236]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[237]);var _0x3c0ex3c=(_0x3c0ex25[_0xa827[238]])?_0xa827[193]+_0x3c0ex25[_0xa827[238]]+_0xa827[193]:_0xa827[193]+_0x3c0ex25[_0xa827[72]]+_0xa827[193];console[_0xa827[26]](_0xa827[239]+_0x3c0ex3c);_0x3c0ex24[_0xa827[36]](_0xa827[240],_0x3c0ex3c,function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[241]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[242]);console[_0xa827[26]](_0xa827[243]);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[244],_0x3c0ex25[_0xa827[245]],_0x3c0ex25[_0xa827[119]]),function(_0x3c0ex27,_0x3c0ex28){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)})};methods[_0xa827[246]]=function(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){console[_0xa827[26]](_0xa827[247]);console[_0xa827[26]](_0xa827[248]);var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);wait[_0xa827[90]](setVariable,_0x3c0ex24,_0x3c0ex30,_0x3c0ex25[_0xa827[249]])};function getVertices(_0x3c0ex42){return _[_0xa827[253]](_0x3c0ex42,function(_0x3c0ex2f,_0x3c0ex43,_0x3c0ex44){if(_0x3c0ex44===_0xa827[250]){return _0x3c0ex2f};if(_[_0xa827[87]](_0x3c0ex43)){_[_0xa827[252]](_0x3c0ex43,function(_0x3c0ex45,_0x3c0ex46){_0x3c0ex2f[_0x3c0ex45[_0xa827[251]][_0xa827[164]]]=_0x3c0ex45[_0xa827[251]];_0x3c0ex2f[_0x3c0ex45[_0xa827[251]][_0xa827[164]]][_0xa827[73]]=_0x3c0ex44});return _0x3c0ex2f};_0x3c0ex2f[_0x3c0ex43[_0xa827[251]][_0xa827[164]]]=_0x3c0ex43[_0xa827[251]];_0x3c0ex2f[_0x3c0ex43[_0xa827[251]][_0xa827[164]]][_0xa827[73]]=_0x3c0ex44;return _0x3c0ex2f},{})}function getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0x3c0ex45){return _[_0xa827[105]](_[_0xa827[40]](_0x3c0ex42[_0xa827[250]],function(_0x3c0ex43){if(_0x3c0ex43[_0xa827[251]][_0xa827[254]]&&_0x3c0ex43[_0xa827[251]][_0xa827[255]]){if(_0x3c0ex43[_0xa827[251]][_0xa827[255]]===_0x3c0ex48){if(_0x3c0ex43[_0xa827[251]][_0xa827[256]]&&_0x3c0ex43[_0xa827[251]][_0xa827[256]]!==_0x3c0ex45){return false};return true}};return false}),_0xa827[257])}function replaceAllVariables(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26){var _0x3c0ex4a=_0x3c0ex25;for(var _0x3c0ex46 in _0x3c0ex4a){var _0x3c0ex28=_0x3c0ex4a[_0x3c0ex46][_0xa827[258]](/{+(.*?)}/gi);if(_0x3c0ex28){console[_0xa827[26]](_0xa827[259],_0x3c0ex28);_0x3c0ex28[_0xa827[91]](function(_0x3c0ex4b,_0x3c0ex32){console[_0xa827[26]](_0xa827[260],_0x3c0ex28[_0x3c0ex32][_0xa827[261]](1,_0x3c0ex28[_0x3c0ex32][_0xa827[142]]-1));var _0x3c0ex45=wait[_0xa827[90]](getVariable,_0x3c0ex24,_0x3c0ex28[_0x3c0ex32][_0xa827[261]](1,_0x3c0ex28[_0x3c0ex32][_0xa827[142]]-1));console[_0xa827[26]](_0xa827[256],_0x3c0ex45);if(_0x3c0ex45[_0xa827[108]]){_0x3c0ex4a[_0x3c0ex46]=_0x3c0ex4a[_0x3c0ex46][_0xa827[190]](_0x3c0ex28[_0x3c0ex32],_0x3c0ex45[_0xa827[108]])}})}};_0x3c0ex4a[_0xa827[262]]=true;return _0x3c0ex4a}function xstart(_0x3c0ex24){var _0x3c0ex42=_0x3c0ex24[_0xa827[127]];var _0x3c0ex4d=_0x3c0ex24[_0xa827[263]];if(_0x3c0ex42[_0xa827[264]]){if(!_[_0xa827[87]](_0x3c0ex42[_0xa827[264]])){var _0x3c0ex48=_0x3c0ex42[_0xa827[264]][_0xa827[251]][_0xa827[164]];var _0x3c0ex28={};do{try{var _0x3c0ex25=_0x3c0ex4d[_0x3c0ex48][_0xa827[262]]?_0x3c0ex4d[_0x3c0ex48]:replaceAllVariables(_0x3c0ex24,_0x3c0ex4d[_0x3c0ex48]);if(_0x3c0ex25){if(_[_0xa827[265]](methods[_0x3c0ex25[_0xa827[73]]])){_0x3c0ex28=wait[_0xa827[90]](methods[_0x3c0ex25[_0xa827[73]]],_0x3c0ex24,_0x3c0ex25)}else {_0x3c0ex28=wait[_0xa827[90]](methods[_0xa827[236]],_0x3c0ex24,_0x3c0ex25)};if(_0x3c0ex28[_0xa827[155]]===200&&_0x3c0ex28[_0xa827[105]]!==_0xa827[144]){var _0x3c0ex4e=getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0x3c0ex28[_0xa827[108]]);if(!_0x3c0ex4e){if(_0x3c0ex25[_0xa827[73]]===_0xa827[96]){if(_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex4e=getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0xa827[149]);if(!_0x3c0ex4e){_0x3c0ex4e=_0x3c0ex48}}};if(_0x3c0ex25[_0xa827[73]]===_0xa827[139]&&_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex4e=_0x3c0ex48};if(_0x3c0ex25[_0xa827[73]]===_0xa827[178]){_0x3c0ex4e=getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0xa827[113]);if(!_0x3c0ex4e){_0x3c0ex4e=_0x3c0ex48}}};_0x3c0ex48=_0x3c0ex4e}else {_0x3c0ex48=null}}else {_0x3c0ex48=null}}catch(err){console[_0xa827[26]](err)}}while(_0x3c0ex48);;console[_0xa827[26]](_0xa827[266]);_0x3c0ex24[_0xa827[233]]()}}}function xfinally(_0x3c0ex24){var _0x3c0ex42=_0x3c0ex24[_0xa827[127]];var _0x3c0ex4d=_0x3c0ex24[_0xa827[263]];if(_0x3c0ex42[_0xa827[267]]){if(!_[_0xa827[87]](_0x3c0ex42[_0xa827[267]])){var _0x3c0ex48=_0x3c0ex42[_0xa827[267]][_0xa827[251]][_0xa827[164]];var _0x3c0ex28={};do{try{var _0x3c0ex25=replaceAllVariables(_0x3c0ex24,_0x3c0ex4d[_0x3c0ex48]);if(_0x3c0ex25){if(_[_0xa827[265]](methods[_0x3c0ex25[_0xa827[73]]])){_0x3c0ex28=wait[_0xa827[90]](methods[_0x3c0ex25[_0xa827[73]]],_0x3c0ex24,_0x3c0ex25)}else {_0x3c0ex28=wait[_0xa827[90]](methods[_0xa827[236]],_0x3c0ex24,_0x3c0ex25)};if(_0x3c0ex28[_0xa827[155]]===200&&_0x3c0ex28[_0xa827[105]]!==_0xa827[144]){var _0x3c0ex4e=getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0x3c0ex28[_0xa827[108]]);if(!_0x3c0ex4e){if(_0x3c0ex25[_0xa827[73]]===_0xa827[96]){if(_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex4e=getTargetBySource(_0x3c0ex42,_0x3c0ex48,_0xa827[149]);if(!_0x3c0ex4e){_0x3c0ex4e=_0x3c0ex48}}};if(_0x3c0ex25[_0xa827[73]]===_0xa827[139]&&_0x3c0ex25[_0xa827[99]]>0){_0x3c0ex4e=_0x3c0ex48}};_0x3c0ex48=_0x3c0ex4e}else {_0x3c0ex48=null}}else {_0x3c0ex48=null}}catch(err){console[_0xa827[26]](err)}}while(_0x3c0ex48);;_0x3c0ex24[_0xa827[233]]();console[_0xa827[26]](_0xa827[268])}};_0x3c0ex24[_0xa827[269]]()}function main(_0x3c0ex24){_0x3c0ex24[_0xa827[272]](_0xa827[270],function(_0x3c0ex27){console[_0xa827[26]](_0xa827[271],_0x3c0ex27)});_0x3c0ex24[_0xa827[272]](_0xa827[273],function(){console[_0xa827[26]](_0xa827[274])});_0x3c0ex24[_0xa827[272]](_0xa827[233],function(){if(_0x3c0ex24[_0xa827[267]]){_0x3c0ex24[_0xa827[267]]=false;console[_0xa827[26]](_0xa827[275]);wait[_0xa827[276]](xfinally,_0x3c0ex24)}else {ReportSquare[_0xa827[279]]({leaveAt:moment()[_0xa827[44]](_0xa827[278])},{where:{uniqueid:_0x3c0ex24[_0xa827[71]]}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[277],_0x3c0ex27)});console[_0xa827[26]](_0xa827[280])}});_0x3c0ex24[_0xa827[272]](_0xa827[103],function(_0x3c0ex28){});_0x3c0ex24[_0xa827[272]](_0xa827[281],function(_0x3c0ex51){console[_0xa827[26]](_0x3c0ex51);console[_0xa827[26]](_0xa827[282]+_0x3c0ex51[_0xa827[283]]+_0xa827[284]+_0x3c0ex51[_0xa827[285]]);var _0x3c0ex52={network:_0x3c0ex51[_0xa827[286]],network_script:_0x3c0ex51[_0xa827[287]],request:_0x3c0ex51[_0xa827[288]],channel:_0x3c0ex51[_0xa827[289]],language:_0x3c0ex51[_0xa827[290]],type:_0x3c0ex51[_0xa827[291]],uniqueid:_0x3c0ex51[_0xa827[285]],version:_0x3c0ex51[_0xa827[292]],callerid:_0x3c0ex51[_0xa827[283]],calleridname:_0x3c0ex51[_0xa827[293]],callingpres:_0x3c0ex51[_0xa827[294]],callingani2:_0x3c0ex51[_0xa827[295]],callington:_0x3c0ex51[_0xa827[296]],callingtns:_0x3c0ex51[_0xa827[297]],dnid:_0x3c0ex51[_0xa827[298]],rdnis:_0x3c0ex51[_0xa827[299]],context:_0x3c0ex51[_0xa827[300]],extension:_0x3c0ex51[_0xa827[301]],priority:_0x3c0ex51[_0xa827[302]],enhanced:_0x3c0ex51[_0xa827[303]],accountcode:_0x3c0ex51[_0xa827[304]],threadid:_0x3c0ex51[_0xa827[305]],project_name:_0x3c0ex51[_0xa827[306]],joinAt:moment()[_0xa827[44]](_0xa827[278])};ReportSquare[_0xa827[78]](_0x3c0ex52)[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[307],_0x3c0ex27)});if(_0x3c0ex51[_0xa827[306]]){SquareProject[_0xa827[315]]({where:{name:_0x3c0ex51[_0xa827[306]]},attributes:[_0xa827[164],_0xa827[309]]})[_0xa827[184]](function(_0x3c0ex3e){if(_0x3c0ex3e){if(_0x3c0ex3e[_0xa827[309]]){xml[_0xa827[312]](_0x3c0ex3e[_0xa827[309]],{normalizeTags:true,explicitArray:false},function(_0x3c0ex27,_0x3c0ex2f){var _0x3c0ex42=_0x3c0ex2f[_0xa827[310]][_0xa827[127]];if(_0x3c0ex42){_0x3c0ex24[_0xa827[127]]=_0x3c0ex42;_0x3c0ex24[_0xa827[267]]=true;_0x3c0ex24[_0xa827[71]]=_0x3c0ex51[_0xa827[285]];_0x3c0ex24[_0xa827[263]]=getVertices(_0x3c0ex42);wait[_0xa827[276]](xstart,_0x3c0ex24)}else {console[_0xa827[26]](_0xa827[311]);_0x3c0ex24[_0xa827[269]]()}})}else {console[_0xa827[26]](_0xa827[313]);_0x3c0ex24[_0xa827[269]]()}}else {console[_0xa827[26]](_0xa827[314]);_0x3c0ex24[_0xa827[269]]()}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0xa827[308],_0x3c0ex27);_0x3c0ex24[_0xa827[269]]()})}else {console[_0xa827[26]](_0xa827[316]);_0x3c0ex24[_0xa827[269]]()}})}function splitInterval(_0x3c0ex38){var _0x3c0ex54={};var _0x3c0ex3a=_0x3c0ex38[_0xa827[317]](_0xa827[50]);var _0x3c0ex55;_0x3c0ex3a[_0xa827[91]](function(_0x3c0ex56,_0x3c0ex32){switch(_0x3c0ex32){case 0:if(_0x3c0ex56!==_0xa827[318]){_0x3c0ex55=_0x3c0ex56[_0xa827[317]](_0xa827[113]);_0x3c0ex54[_0xa827[319]]=moment(_0x3c0ex55[0],_0xa827[320]);_0x3c0ex54[_0xa827[321]]=moment(_0x3c0ex55[1],_0xa827[320])}else {_0x3c0ex54[_0xa827[319]]=null;_0x3c0ex54[_0xa827[321]]=null};break;case 1:if(_0x3c0ex56!==_0xa827[318]){_0x3c0ex55=_0x3c0ex56[_0xa827[317]](_0xa827[113]);_0x3c0ex54[_0xa827[322]]=weekDaysCollection[_0x3c0ex55[0]];_0x3c0ex54[_0xa827[323]]=_0x3c0ex55[1]?weekDaysCollection[_0x3c0ex55[1]]:null}else {_0x3c0ex54[_0xa827[322]]=null;_0x3c0ex54[_0xa827[323]]=null};break;case 2:if(_0x3c0ex56!==_0xa827[318]){_0x3c0ex55=_0x3c0ex56[_0xa827[317]](_0xa827[113]);_0x3c0ex54[_0xa827[324]]=_0x3c0ex55[0];_0x3c0ex54[_0xa827[325]]=_0x3c0ex55[1]?_0x3c0ex55[1]:null}else {_0x3c0ex54[_0xa827[324]]=null;_0x3c0ex54[_0xa827[325]]=null};break;case 3:if(_0x3c0ex56!==_0xa827[318]){_0x3c0ex55=_0x3c0ex56[_0xa827[317]](_0xa827[113]);_0x3c0ex54[_0xa827[326]]=monthsCollection[_0x3c0ex55[0]];_0x3c0ex54[_0xa827[327]]=_0x3c0ex55[1]?monthsCollection[_0x3c0ex55[1]]:null}else {_0x3c0ex54[_0xa827[326]]=null;_0x3c0ex54[_0xa827[327]]=null};break;default:}});return _0x3c0ex54}function isIntervalValid(_0x3c0ex38){var _0x3c0ex58=moment()[_0xa827[44]](_0xa827[320]);var _0x3c0ex59=moment()[_0xa827[44]](_0xa827[328]);var _0x3c0ex5a=moment()[_0xa827[44]](_0xa827[329]);var _0x3c0ex5b=moment()[_0xa827[44]](_0xa827[330]);var _0x3c0ex5c,_0x3c0ex5d,_0x3c0ex5e,_0x3c0ex5f;var _0x3c0ex60=[1,2,3,4,5,6,7,8,9,10,11,12];var _0x3c0ex61=[1,2,3,4,5,6,7];var _0x3c0ex62=[];for(var _0x3c0ex63=1;_0x3c0ex63<=31;_0x3c0ex63++){_0x3c0ex62[_0xa827[331]](_0x3c0ex63)};_0x3c0ex5c=(_0x3c0ex38[_0xa827[319]]&&_0x3c0ex38[_0xa827[321]])?moment(_0x3c0ex58,_0xa827[320])[_0xa827[332]](moment(_0x3c0ex38[_0xa827[319]],_0xa827[320]),moment(_0x3c0ex38[_0xa827[321]],_0xa827[320])):true;if(_0x3c0ex38[_0xa827[322]]){if(_0x3c0ex38[_0xa827[323]]){var _0x3c0ex64=_[_0xa827[165]](_0x3c0ex61,function(_0x3c0ex31){return (_0x3c0ex31>=_0x3c0ex38[_0xa827[322]])||(_0x3c0ex31<=_0x3c0ex38[_0xa827[323]])});_0x3c0ex5d=(_0x3c0ex64[_0xa827[333]](parseInt(_0x3c0ex59))!== -1)?true:false}else {_0x3c0ex5d=(parseInt(_0x3c0ex59)===_0x3c0ex38[_0xa827[322]])?true:false}}else {_0x3c0ex5d=true};if(_0x3c0ex38[_0xa827[324]]){if(_0x3c0ex38[_0xa827[325]]){var _0x3c0ex65=_[_0xa827[165]](_0x3c0ex62,function(_0x3c0ex31){return (_0x3c0ex31>=_0x3c0ex38[_0xa827[324]])||(_0x3c0ex31<=_0x3c0ex38[_0xa827[325]])});_0x3c0ex5e=(_0x3c0ex65[_0xa827[333]](parseInt(_0x3c0ex5a))!== -1)?true:false}else {_0x3c0ex5e=(parseInt(_0x3c0ex5a)===_0x3c0ex38[_0xa827[324]])?true:false}}else {_0x3c0ex5e=true};if(_0x3c0ex38[_0xa827[326]]){if(_0x3c0ex38[_0xa827[327]]){var _0x3c0ex66=_[_0xa827[165]](_0x3c0ex60,function(_0x3c0ex31){return (_0x3c0ex31>=_0x3c0ex38[_0xa827[326]])||(_0x3c0ex31<=_0x3c0ex38[_0xa827[327]])});_0x3c0ex5f=(_0x3c0ex66[_0xa827[333]](parseInt(_0x3c0ex5b))!== -1)?true:false}else {_0x3c0ex5f=(parseInt(_0x3c0ex5b)===_0x3c0ex38[_0xa827[326]])?true:false}}else {_0x3c0ex5f=true};return _0x3c0ex5c&&_0x3c0ex5d&&_0x3c0ex5e&&_0x3c0ex5f}function setVariable(_0x3c0ex24,_0x3c0ex68,_0x3c0ex45,_0x3c0ex26){console[_0xa827[26]](_0xa827[334]);console[_0xa827[26]](_0xa827[335]+_0x3c0ex68+_0xa827[336],_0x3c0ex45);_0x3c0ex24[_0xa827[29]](util[_0xa827[44]](_0xa827[157],_0x3c0ex68,_0x3c0ex45),function(_0x3c0ex27,_0x3c0ex28){if(_0x3c0ex26){_0x3c0ex26(_0x3c0ex27,_0x3c0ex28)}})}function getVariableName(_0x3c0ex6a){if(!variables){getVariables(false)};var _0x3c0ex4b={name:_0xa827[337]};if(_0x3c0ex6a){_0x3c0ex4b=_[_0xa827[40]](variables,{id:parseInt(_0x3c0ex6a)})};return _0x3c0ex4b[_0xa827[43]]}function setVariablesMatrix(_0x3c0ex24,_0x3c0ex25,_0x3c0ex26,_0x3c0ex40){var _0x3c0ex30=getVariableName(_0x3c0ex25[_0xa827[86]]);_[_0xa827[91]](_0x3c0ex40,function(_0x3c0ex6c,_0x3c0ex32){_[_0xa827[339]](_0x3c0ex6c,function(_0x3c0ex45,_0x3c0ex46){wait[_0xa827[90]](setVariable,_0x3c0ex24,_0x3c0ex30+_0xa827[88]+_0x3c0ex32+_0xa827[338]+_0x3c0ex46+_0xa827[89],_0x3c0ex45)})})}function getVariable(_0x3c0ex24,_0x3c0ex68,_0x3c0ex26){_0x3c0ex24[_0xa827[343]](_0x3c0ex68,function(_0x3c0ex27,_0x3c0ex28){if(_0x3c0ex28[_0xa827[155]]===200&&_0x3c0ex28[_0xa827[105]]!==_0xa827[110]){_0x3c0ex28[_0xa827[108]]=_0x3c0ex28[_0xa827[105]][_0xa827[261]](_0x3c0ex28[_0xa827[105]][_0xa827[341]](_0xa827[340])+1,_0x3c0ex28[_0xa827[105]][_0xa827[341]](_0xa827[342]))}else {_0x3c0ex28[_0xa827[108]]=_0xa827[63]};_0x3c0ex26(null,_0x3c0ex28)})}function getFilePath(_0x3c0ex6a){if(!sounds){getSounds(false)};if(_0x3c0ex6a>0){var _0x3c0ex6f=_[_0xa827[40]](sounds,{id:parseInt(_0x3c0ex6a)});return util[_0xa827[44]](_0xa827[344],config[_0xa827[345]],_0x3c0ex6f[_0xa827[346]])};return _0xa827[63]}function getUsers(_0x3c0ex71){User[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){users=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(User,users,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getQueues(_0x3c0ex71){VoiceQueue[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){queues=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(VoiceQueue,queues,_0xa827[43])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getTrunks(_0x3c0ex71){Trunk[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){trunks=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(Trunk,trunks,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getVariables(_0x3c0ex71){Variable[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){variables=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(Variable,variables,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getDbConnections(_0x3c0ex71){SquareOdbc[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){dbConnections=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(SquareOdbc,dbConnections,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getIntervals(_0x3c0ex71){Interval[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){intervals=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(Interval,intervals,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getProjects(_0x3c0ex71){SquareProject[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){projects=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(SquareProject,projects,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function getSounds(_0x3c0ex71){Sound[_0xa827[348]]()[_0xa827[184]](function(_0x3c0ex2f){sounds=_[_0xa827[347]](_0x3c0ex2f);if(_0x3c0ex71){synchUpdates(Sound,sounds,_0xa827[164])}})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}function synchUpdates(_0x3c0ex7a,_0x3c0ex7b,_0x3c0ex46){var _0x3c0ex7c={};_0x3c0ex7a[_0xa827[349]](function(_0x3c0ex7d){_0x3c0ex7c[_0x3c0ex46]=_0x3c0ex7d[_0x3c0ex46];updateCollection(_0x3c0ex7b,_0x3c0ex7c,_0x3c0ex7d)});_0x3c0ex7a[_0xa827[350]](function(_0x3c0ex7d){_0x3c0ex7c[_0x3c0ex46]=_0x3c0ex7d[_0x3c0ex46];updateCollection(_0x3c0ex7b,_0x3c0ex7c,_0x3c0ex7d)});_0x3c0ex7a[_0xa827[352]](function(_0x3c0ex7d){_0x3c0ex7c[_0x3c0ex46]=_0x3c0ex7d[_0x3c0ex46];_[_0xa827[351]](_0x3c0ex7b,_0x3c0ex7c)})}function updateCollection(_0x3c0ex7b,_0x3c0ex7c,_0x3c0ex7d){var _0x3c0ex7f=_[_0xa827[40]](_0x3c0ex7b,_0x3c0ex7c);var _0x3c0ex32=_0x3c0ex7b[_0xa827[333]](_0x3c0ex7f);if(_0x3c0ex7f){_[_0xa827[353]](_0x3c0ex7b[_0x3c0ex32],_0x3c0ex7d)}else {_0x3c0ex7b[_0xa827[354]](_0x3c0ex7d)}}function getPort(){Settings[_0xa827[315]]()[_0xa827[184]](function(_0x3c0ex2f){agiPort=_0x3c0ex2f[_0xa827[355]]})[_0xa827[77]](function(_0x3c0ex27){console[_0xa827[26]](_0x3c0ex27)})}module[_0xa827[356]]=function(){console[_0xa827[26]](_0xa827[357]);getPort();var _0x3c0ex81=agi[_0xa827[359]](main)[_0xa827[358]](agiPort?agiPort:4573);getUsers(true);getQueues(true);getTrunks(true);getVariables(true);getIntervals(true);getProjects(true);getSounds(true);getDbConnections(true)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); + +var agi = require('agi'); +var util = require('util'); +var moment = require('moment'); +var xml = require('xml2js'); +var wait = require('wait.for'); +var sr = require('simple-random'); +var path = require('path'); +var config = require('../config/environment'); +var sh = require('shelljs'); + +var db = require("odbc")(); + +var SquareProject = require('../models').SquareProject; +var Variable = require('../models').Variable; +var SquareOdbc = require('../models').SquareOdbc; +var Settings = require('../models').Settings; +var User = require('../models').User; +var VoiceQueue = require('../models').VoiceQueue; +var Trunk = require('../models').Trunk; +var Interval = require('../models').Interval; +var Sound = require('../models').Sound; +var ReportSquare = require('../models').ReportSquare; +var ReportSquareDetail = require('../models').ReportSquareDetail; +// var TempTable = require('../models').TempTable; +// var FakeTable = require('../models').FakeTable; +var users, trunks, variables, intervals, projects, sounds, queues, dbConnections, generalUniqueId; +var agiPort; +var weekDaysCollection = { + mon: 1, + tue: 2, + wed: 3, + thu: 4, + fri: 5, + sat: 6, + sun: 7 +}; +var monthsCollection = { + jan: 1, + feb: 2, + mar: 3, + apr: 4, + may: 5, + jun: 6, + jul: 7, + aug: 8, + sep: 9, + oct: 10, + nov: 11, + dec: 12 +}; +var methods = {}; + +methods.answer = function(context, vertex, callback) { + console.log('--ANSWER BLOCK--'); + console.log('Answering the call...'); + context.send('ANSWER\n', function(err, res) { + callback(err, res); + }); +}; + +methods.custom_app = function(context, vertex, callback) { + console.log('--CUSTOM APP BLOCK--'); + console.log('Executing custom app "' + vertex.application + '"...'); + context.exec(vertex.application, vertex.options, function(err, res) { + if (callback) { + callback(err, res); + } + }); +}; + + +methods.dial = function(context, vertex, callback) { + console.log('--INTERNAL_DIAL BLOCK--'); + if (!users) { + getUsers(false); + } + var sip = _.find(users, { + id: parseInt(vertex.sip_id) + }); + console.log('Calling ' + util.format('SIP/%s', sip.name) + '...'); + var parameters = [util.format('SIP/%s', sip.name), vertex.timeout, vertex.opts, vertex.url]; + context.exec('DIAL', parameters.join(','), + function(err, res) { + callback(err, res); + }); +}; + +methods.ext_dial = function(context, vertex, callback) { + console.log('--EXTERNAL_DIAL BLOCK--'); + if (!trunks) { + getTrunks(false); + } + var trunk = _.find(trunks, { + id: parseInt(vertex.trunk_id) + }); + console.log('Calling ' + util.format('SIP/%s', trunk.name) + '...'); + var parameters = [util.format('SIP/%s@%s', vertex.phone, trunk.name), vertex.timeout, vertex.opts, vertex.url]; + context.exec('DIAL', parameters.join(','), + function(err, res) { + callback(err, res); + }); +}; + +methods.queue = function(context, vertex, callback) { + console.log('--QUEUE BLOCK--'); + if (!queues) { + getQueues(false); + } + var queue = _.find(queues, { + name: vertex.queue_id + }); + var announceOverride = getFilePath(vertex.file_id); + var parameters = [queue.name, vertex.opts, vertex.url, announceOverride, vertex.timeout, vertex.agi, vertex.macro, vertex.gosub, '', vertex.position]; + console.log('Joining ' + queue.name + ' queue...'); + context.exec('QUEUE', parameters.join(','), function(err, res) { + callback(err, res); + }); +}; + +methods.voicemail = function(context, vertex, callback) { + console.log('--VOICEMAIL BLOCK--'); + var parameters = [vertex.mailbox, vertex.opts]; + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: parameters.join(',') || null + } + ReportSquareDetail + .create(squareDetail) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + }); + console.log('Starting voicemail recording...'); + context.exec('VOICEMAIL', parameters.join(','), function(err, res) { + callback(err, res); + }); +}; + +// methods.callback = function(context, vertex, callback) { +// context.send('ANSWER\n', function(err, res) { +// callback(err, res); +// }); +// }; + +methods.math = function(context, vertex, callback) { + console.log('--MATH BLOCK--'); + console.log('Calculating expression...'); + var result = eval(vertex.operation); + console.log('Saving result in variable...'); + var varName = getVariableName(vertex.variable_id); + if (_.isArray(result)) { + result.forEach(function(elem, index) { + wait.for(setVariable, context, varName + '[' + index + ']', elem); + }); + } else { + wait.for(setVariable, context, varName, result); + } +} + +// methods.background = function(context, vertex, callback) { +// var parameters = [getFilePath(vertex.file_id), vertex.opts]; +// context.exec('BACKGROUND', parameters.join('|'), function(err, res) { +// callback(err, res); +// }); +// }; + +methods.playback = function(context, vertex, callback) { + console.log('--PLAYBACK BLOCK--'); + var audiofile = getFilePath(vertex.file_id); + // var audiofile = '/var/www/html/files/sounds/d0269ff87187df665ece75538e4cddfd'; + var parameters = [audiofile, vertex.opts]; + console.log('Executing playback...'); + context.exec('PLAYBACK', parameters.join(','), function(err, res) { + callback(err, res); + }); +}; + +methods.menu = function(context, vertex, callback) { + console.log('--MENU BLOCK--'); + var res = {}; + console.log('There are ' + vertex.retry + ' retries'); + if (vertex.retry > 0) { + vertex.retry--; + var announce = getFilePath(vertex.file_id); + // var announce = '/var/www/html/files/sounds/b19642d2f71e9cfffbd783fcc79c7415'; + // console.log(announce); + console.log('Announcing and waiting for user entry...'); + context.send(util.format('GET DATA %s %s %s\n', announce, parseInt(vertex.response) * 1000, vertex.digit), + function(err, res) { + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: res.result || null + } + ReportSquareDetail + .create(squareDetail) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + }); + if (res.result !== ' (timeout)') { + if (vertex.variable_id) { + console.log('Saving user entry in a variable...'); + var varName = getVariableName(vertex.variable_id); + setVariable(context, varName, res.result, function() { + res.data = res.result; + callback(null, res); + }); + // setVariable(context, variableId, res.result); + } + + } else { + console.log('Menu timeout!'); + res = { + code: 200, + result: '0', + data: 't' + }; + callback(null, res); + } + }); + + } else { + console.log('Run out of retries!'); + res = { + code: 200, + result: '0', + data: '-' + }; + callback(null, res); + } +}; + +methods.saynumber = function(context, vertex, callback) { + console.log('--SAYNUMBER BLOCK--'); + console.log('Saying number...'); + context.send(util.format('SAY NUMBER %s "%s"\n', vertex.number, vertex.escape_digits), + function(err, res) { + callback(err, res); + }); +}; + +methods.sayphonetic = function(context, vertex, callback) { + console.log('--SAYPHONETIC BLOCK--'); + console.log('Saying phonetic...'); + context.send(util.format('SAY PHONETIC %s "%s"\n', vertex.text, vertex.escape_digits), + function(err, res) { + callback(err, res); + }); +}; + +methods.tts = function(context, vertex, callback) { + console.log('--GOOGLE_TTS BLOCK--'); + var parameters = [path.join(config.root, 'server/config/agi_scripts', 'googletts.agi'), encodeURIComponent(vertex.text), vertex.google_tts_language]; + // var parameters = ['/var/www/html/agisquare/agiscripts/googletts.agi', encodeURIComponent(vertex.text), vertex.google_tts_language]; + console.log('Calling Google TTS API...'); + context.exec('AGI', parameters.join(','), + function(err, res) { + callback(err, res); + }); +}; + +methods.ispeechtts = function(context, vertex, callback) { + console.log('--ISPEECH_TTS BLOCK--'); + // var parameters = [path.join(config.root, 'server/config/agi_scripts', 'ispeech-tts.agi'), encodeURIComponent(vertex.text), vertex.ispeech_tts_language, '', '', vertex.key]; + var parameters = ['/var/www/html/agisquare/agiscripts/ispeech-tts.agi', encodeURIComponent(vertex.text), vertex.ispeech_tts_language, '', '', vertex.key]; + console.log('Calling iSpeech TTS API...'); + context.exec('AGI', parameters.join(','), + function(err, res) { + callback(err, res); + }); +}; + +methods.getdigits = function(context, vertex, callback) { + console.log('--GETDIGITS BLOCK--'); + var res = {}; + console.log('There are ' + vertex.retry + ' retries'); + if (vertex.retry > 0) { + vertex.retry--; + var announce = getFilePath(vertex.file_id); + // var announce = '/var/www/html/files/sounds/b19642d2f71e9cfffbd783fcc79c7415'; + console.log('Announcing and waiting for user entry...'); + context.send(util.format('GET DATA %s %s %s\n', announce, parseInt(vertex.response) * 1000, vertex.maxdigit), + function(err, res) { + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: res.result || null + } + ReportSquareDetail + .create(squareDetail) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + }); + if (res.result && res.result.length >= parseInt(vertex.mindigit)) { + if (res.result !== '-1') { + console.log('There is a result, is over the minimum length and not due to an hangup!'); + if (vertex.variable_id) { + console.log('Saving user entry in a variable...'); + var varName = getVariableName(vertex.variable_id); + setVariable(context, varName, res.result, function() { + res = { + code: 200, + result: '0', + data: 'x' + }; + callback(null, res); + }); + } + } else { + console.log('Channel hangup!'); + res = { + code: 500, + result: '-1' + }; + callback(null, res); + } + } else { + console.log('No entry or not long enough!'); + res = { + code: 200, + result: '0', + data: 'i' + }; + callback(null, res); + } + }); + } else { + console.log('Run out of retries!'); + res = { + code: 500, + result: '-1' + }; + callback(null, res); + } +}; + +methods.record = function(context, vertex, callback) { + console.log('--RECORD BLOCK--'); + var saveName = sr(); + // FakeTable + // .create({ + // name: vertex.name, + // filename: saveName + // }) + // .then(function() { + console.log('Starting call recording...'); + context.send(util.format('RECORD FILE %s wav "%s" %s %s %s %s\n', path.join(config.root, 'server/files/recordings', saveName), vertex.escape_digits, vertex.timeout, null, true, null), function( + err, res) { + if (res.code === 200 && res.result !== '-1') { + console.log('Saving recording filename in RECORDING_SAVENAME variable...'); + context.send(util.format('SET VARIABLE %s %s\n', 'RECORDING_SAVENAME', saveName), function(err, res) { + callback(err, res); + }); + } else { + callback(err, res); + } + }); + // }) + // .catch(function(err) { + // console.log(err); + // }); +}; + +methods.gotoiftime = function(context, vertex, callback) { //single or multiple intervals + console.log('--GOTOIFTIME BLOCK--'); + var res; + var valid = 'false'; + var gotoIntervals; + if (!intervals) { + getIntervals(false); + } + var interval = _.find(intervals, { + id: parseInt(vertex.interval_id) + }); + if (!interval.IntervalId) { + gotoIntervals = _.filter(intervals, { + IntervalId: parseInt(interval.id) + }); + } + if (gotoIntervals) { + console.log('Is a group of intervals!'); + if (gotoIntervals.length) { + console.log('There are ' + gotoIntervals.length + ' intervals!'); + var subInterval; + console.log('Checking if at least one interval is valid...'); + gotoIntervals.forEach(function(elem, index) { + subInterval = splitInterval(elem.interval); + if (isIntervalValid(subInterval)) { + console.log('Interval ' + index + ' is valid!'); + valid = 'true'; + } + }); + } else { + console.log('There are no sub intervals, so it will be always true!'); + valid = 'true'; + } + } else { + console.log('Is a single interval!'); + var splittedInterval = splitInterval(interval.interval); + if (isIntervalValid(splittedInterval)) { + console.log('The interval is valid!'); + valid = 'true'; + } + } + console.log('The final result for the intervals is "' + valid + '"!'); + res = { + code: 200, + result: '0', + data: valid + }; + callback(null, res); +}; + +methods.vswitch = function(context, vertex, callback) { + console.log('--VARIABLE_SWITCH BLOCK--'); + console.log('Getting the variable value and searching the right exit...'); + var varName = getVariableName(vertex.variable_id); + getVariable(context, varName, function(err, res) { + if (!res.data) { + res.data = '-'; + } + callback(null, res); + }); + +}; + +methods.goal = function(context, vertex, callback) { + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: vertex.goalname || null + } + ReportSquareDetail + .create(squareDetail) + .then(function(res) { + res = { + code: 200, + result: '1' + }; + callback(null, res); + }) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + var res = { + code: 200, + result: '1' + }; + callback(err, res); + }); +}; + +methods.system = function(context, vertex, callback) { + console.log('--SYSTEM BLOCK--'); + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: _.trim(vertex.command) || null + } + ReportSquareDetail + .create(squareDetail) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + }); + console.log('Executing the system command...'); + sh.exec(_.trim(vertex.command), function(code, output) { + var formattedOutput = output.replace(/(\r\n|\n|\r)/gm, ""); + console.log('Program output:', formattedOutput); + console.log('Saving the output in a variable...'); + var varName = getVariableName(vertex.variable_id); + setVariable(context, varName, '"' + formattedOutput + '"', callback); + }); +}; + +methods.agi = function(context, vertex, callback) { + console.log('--AGI BLOCK--'); + console.log('Executing the AGI command...'); + context.exec('AGI', vertex.command, vertex.args, + function(err, res) { + callback(err, res); + }); +}; + +methods.subproject = function(context, vertex, callback) { + console.log('--SUBPROJECT BLOCK--'); + if (!projects) { + getProjects(false); + } + var project = _.find(projects, { + id: parseInt(vertex.project_id) + }); + console.log('Moving to project ""' + project.name + '"...'); + context.exec('AGI', util.format('agi://192.168.2.147/square,%s', project.name), + function(err, res) { + callback(err, res); + }); +}; + +methods.ispeechasr = function(context, vertex, callback) { + console.log('--ISPEECH_ASR BLOCK--'); + // var parameters = ['/var/www/html/agisquare/agiscripts/ispeech-asr.agi', vertex.ispeech_asr_language, '', (vertex.model === '0' ? '' : vertex.model), '1', '#', '', vertex.key]; + var parameters = [path.join(config.root, 'server/config/agi_scripts', 'ispeech-asr.agi'), vertex.ispeech_asr_language, '', (vertex.model === '0' ? '' : vertex.model), '1', '#', '', vertex.key]; + console.log('Calling Google ASR API...'); + context.exec('AGI', parameters.join(','), + function(err, res) { + callback(err, res); + }); +}; + +methods.database = function(context, vertex, callback) { + console.log('--DATABASE BLOCK--'); + if (!dbConnections) { + getDbConnections(false); + } + var connection = _.find(dbConnections, { + id: parseInt(vertex.odbc_id) + }); + console.log('Trying to get ODBC connection...'); + var squareDetail = { + uniqueid: context.uniqueid, + node: vertex.label, + application: vertex.tag, + data: vertex.query || null + } + ReportSquareDetail + .create(squareDetail) + .catch(function(err) { + console.log('Error saving ' + vertex.tag + ':' + vertex.label + ' block log', err); + }); + try { + db.openSync(connection.dsn); + var data = db.querySync(vertex.query); + db.closeSync(); + setVariablesMatrix(context, vertex, callback, data); + } catch (e) { + console.log(e.message); + wait.for(setVariable, context, 'ERROR', 'true'); + wait.for(setVariable, context, 'MESSAGE', e.message); + } +}; + +methods.gotoc = function(context, vertex, callback) { + console.log('--GOTO BLOCK--'); + console.log('Going to extension ' + vertex.extension + ' ...'); + context.exec('DIAL', util.format('Local/%s@%s', vertex.extension, vertex.context), + function(err, res) { + callback(err, res); + }); +}; + +methods.gotoif = function(context, vertex, callback) { + console.log('--GOTOIF BLOCK--'); + var res = { + code: 200, + result: '0' + }; + console.log('Evaluating condition...'); + res.data = String(eval(vertex.condition) ? 'true' : 'false'); + console.log('The result is ' + res.data); + callback(null, res); +}; + +methods.hangup = function(context, vertex, callback) { + console.log('--HANGUP BLOCK--'); + console.log('Hangin up the call...'); + context.hangup(); +}; + +methods.noop = function(context, vertex, callback) { + console.log('--NOOP BLOCK--'); + var output = (vertex.output) ? '\"' + vertex.output + '\"' : '\"' + + vertex.label + '\"'; + console.log('NOOP value is ' + output); + context.exec('NOOP', output, + function(err, res) { + callback(err, res); + }); +}; + +methods.saydigits = function(context, vertex, callback) { + console.log('--SAYDIGITS BLOCK--'); + console.log('Saying digits...'); + context.send(util.format('SAY DIGITS %s "%s"\n', vertex.digits, vertex.escape_digits), + function(err, res) { + callback(err, res); + }); +}; + +methods.set = function(context, vertex, callback) { + console.log('--SET BLOCK--'); + console.log('Saving value in a variable...'); + var varName = getVariableName(vertex.variable_id); + wait.for(setVariable, context, varName, vertex.variable_value); +}; + +function getVertices(root) { + return _.reduce(root, function(result, edge, tag) { + + if (tag === 'mxcell') { + return result; + } + + if (_.isArray(edge)) { + _.forIn(edge, function(value, key) { + result[value.$.id] = value.$; + result[value.$.id].tag = tag; + }); + return result; + } + + result[edge.$.id] = edge.$; + result[edge.$.id].tag = tag; + return result; + + }, {}); +} + +function getTargetBySource(root, source, value) { + return _.result(_.find(root.mxcell, function(edge) { + if (edge.$.edge && edge.$.source) { + if (edge.$.source === source) { + if (edge.$.value && edge.$.value !== value) { + return false; + } + return true; + } + } + return false; + }), '$.target'); +} + +function replaceAllVariables(context, vertex, callback) { + var obj = vertex; + for (var key in obj) { + var res = obj[key].match(/{+(.*?)}/gi); + if (res) { + console.log('res', res); + res.forEach(function(variable, index) { + console.log('variable', res[index].substring(1, res[index].length - 1)); + var value = wait.for(getVariable, context, res[index].substring(1, res[index].length - 1)); + console.log('value', value); + if (value.data) { + obj[key] = obj[key].replace(res[index], value.data); + // console.log('Replace', res[index], string); + } + }) + } + } + obj.replaced = true; + return obj; +} + +function xstart(context) { + var root = context.root; + var vertices = context.vertices; + + if (root.start) { + if (!_.isArray(root.start)) { + var source = root.start.$.id; + var res = {}; + do { + try { + var vertex = vertices[source].replaced ? vertices[source] : replaceAllVariables(context, vertices[source]); + if (vertex) { + if (_.isFunction(methods[vertex.tag])) { + res = wait.for(methods[vertex.tag], context, vertex); + } else { + res = wait.for(methods.noop, context, vertex); + } + if (res.code === 200 && res.result !== '-1') { + var target = getTargetBySource(root, source, res.data); + if (!target) { + if (vertex.tag === 'menu') { + if (vertex.retry > 0) { + target = getTargetBySource(root, source, 'i'); + if (!target) { + target = source; + } + } + } + if (vertex.tag === 'getdigits' && vertex.retry > 0) { + target = source; + } + if (vertex.tag === 'vswitch') { + target = getTargetBySource(root, source, '-'); + if (!target) { + target = source; + } + } + } + source = target; + } else { + source = null; + } + } else { + source = null; + } + } catch (err) { + console.log(err); + } + } + while (source); + console.log('No target found, hangup!'); + context.hangup(); + } + } +} + + +function xfinally(context) { + var root = context.root; + var vertices = context.vertices; + + if (root.finally) { + if (!_.isArray(root.finally)) { + var source = root.finally.$.id; + var res = {}; + do { + try { + var vertex = replaceAllVariables(context, vertices[source]); + if (vertex) { + if (_.isFunction(methods[vertex.tag])) { + res = wait.for(methods[vertex.tag], context, vertex); + } else { + res = wait.for(methods.noop, context, vertex); + } + if (res.code === 200 && res.result !== '-1') { + var target = getTargetBySource(root, source, res.data); + if (!target) { + if (vertex.tag === 'menu') { + if (vertex.retry > 0) { + target = getTargetBySource(root, source, 'i'); + if (!target) { + target = source; + } + } + } + if (vertex.tag === 'getdigits' && vertex.retry > 0) { + target = source; + } + } + source = target; + } else { + source = null; + } + } else { + source = null; + } + } catch (err) { + console.log(err); + } + } while (source); + context.hangup(); + console.log('No target found, stopping "Finally" branch!'); + } + } + context.end(); +} + + +function main(context) { + + context.on('error', function(err) { + console.log('//Error:', err); + }); + + context.on('close', function() { + console.log('//Context close'); + }); + + context.on('hangup', function() { + if (context.finally) { + context.finally = false; + console.log('//Starting "Finally" branch!'); + wait.launchFiber(xfinally, context); + } else { + ReportSquare.update({ + leaveAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + uniqueid: context.uniqueid + } + }) + .catch(function(err) { + console.log('Error saving exit time from IVR', err); + }); + console.log('//Context Hangup'); + } + }); + + context.on('response', function(res) { + //console.log('Response:', res); + }); + + context.on('variables', function(vars) { + console.log(vars); + console.log('Received new call from: ' + vars.agi_callerid + + ' with uniqueid: ' + vars.agi_uniqueid); + var squareLog = { + network: vars.agi_network, + network_script: vars.agi_network_script, + request: vars.agi_request, + channel: vars.agi_channel, + language: vars.agi_language, + type: vars.agi_type, + uniqueid: vars.agi_uniqueid, + version: vars.agi_version, + callerid: vars.agi_callerid, + calleridname: vars.agi_calleridname, + callingpres: vars.agi_callingpres, + callingani2: vars.agi_callingani2, + callington: vars.agi_callington, + callingtns: vars.agi_callingtns, + dnid: vars.agi_dnid, + rdnis: vars.agi_rdnis, + context: vars.agi_context, + extension: vars.agi_extension, + priority: vars.agi_priority, + enhanced: vars.agi_enhanced, + accountcode: vars.agi_accountcode, + threadid: vars.agi_threadid, + project_name: vars.agi_arg_1, + joinAt: moment().format("YYYY-MM-DD HH:mm:ss") + }; + + ReportSquare + .create(squareLog) + .catch(function(err) { + console.log('Error saving enter time for IVR', err); + }); + + if (vars.agi_arg_1) { + SquareProject + .findOne({ + where: { + name: vars.agi_arg_1 + }, + attributes: ['id', 'production'] + }) + .then(function(project) { + if (project) { + if (project.production) { + xml.parseString(project.production, { + normalizeTags: true, + explicitArray: false + }, function(err, result) { + var root = result.mxgraphmodel.root; + if (root) { + context.root = root; + context.finally = true; + context.uniqueid = vars.agi_uniqueid; + context.vertices = getVertices(root); + wait.launchFiber(xstart, context); + } else { + console.log('No root in project!'); + context.end(); + } + }); + } else { + console.log('No project published!'); + context.end(); + } + } else { + console.log('No project found!'); + context.end(); + } + }) + .catch(function(err) { + console.log('Error:', err); + context.end(); + }); + } else { + console.log('No project argument!'); + context.end(); + } + }); +} + +function splitInterval(interval) { + var finalInterval = {}; + var splittedInterval = interval.split(','); + var intValues; + splittedInterval.forEach(function(element, index) { + switch (index) { + case 0: + if (element !== '*') { + intValues = element.split('-'); + finalInterval.t_from = moment(intValues[0], 'HH:mm'); + finalInterval.t_to = moment(intValues[1], 'HH:mm'); + } else { + finalInterval.t_from = null; + finalInterval.t_to = null; + } + break; + case 1: + if (element !== '*') { + intValues = element.split('-'); + finalInterval.wd_from = weekDaysCollection[intValues[0]]; + finalInterval.wd_to = intValues[1] ? weekDaysCollection[intValues[1]] : null; + } else { + finalInterval.wd_from = null; + finalInterval.wd_to = null; + } + break; + case 2: + if (element !== '*') { + intValues = element.split('-'); + finalInterval.md_from = intValues[0]; + finalInterval.md_to = intValues[1] ? intValues[1] : null; + } else { + finalInterval.md_from = null; + finalInterval.md_to = null; + } + break; + case 3: + if (element !== '*') { + intValues = element.split('-'); + finalInterval.m_from = monthsCollection[intValues[0]]; + finalInterval.m_to = intValues[1] ? monthsCollection[intValues[1]] : null; + } else { + finalInterval.m_from = null; + finalInterval.m_to = null; + } + break; + default: + + } + + + }); + return finalInterval; +} + +function isIntervalValid(interval) { + var hour = moment().format("HH:mm"); + var day = moment().format("E"); + var monthDay = moment().format("D"); + var month = moment().format("M"); + var tValid, wdValid, mdValid, mValid; + var monthsNumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + var weekDaysNumbers = [1, 2, 3, 4, 5, 6, 7]; + var daysOfMonthsNumbers = []; + for (var i = 1; i <= 31; i++) { + daysOfMonthsNumbers.push(i); + } + tValid = (interval.t_from && interval.t_to) ? moment(hour, "HH:mm").isBetween(moment(interval.t_from, "HH:mm"), moment(interval.t_to, "HH:mm")) : true; + if (interval.wd_from) { + if (interval.wd_to) { + var validWeekdays = _.filter(weekDaysNumbers, function(elem) { + return (elem >= interval.wd_from) || (elem <= interval.wd_to); + }); + wdValid = (validWeekdays.indexOf(parseInt(day)) !== -1) ? true : false; + } else { + wdValid = (parseInt(day) === interval.wd_from) ? true : false; + } + } else { + wdValid = true; + } + if (interval.md_from) { + if (interval.md_to) { + var validMonthsdays = _.filter(daysOfMonthsNumbers, function(elem) { + return (elem >= interval.md_from) || (elem <= interval.md_to); + }); + mdValid = (validMonthsdays.indexOf(parseInt(monthDay)) !== -1) ? true : false; + } else { + mdValid = (parseInt(monthDay) === interval.md_from) ? true : false; + } + } else { + mdValid = true; + } + if (interval.m_from) { + if (interval.m_to) { + var validMonths = _.filter(monthsNumbers, function(elem) { + return (elem >= interval.m_from) || (elem <= interval.m_to); + }); + mValid = (validMonths.indexOf(parseInt(month)) !== -1) ? true : false; + } else { + mValid = (parseInt(month) === interval.m_from) ? true : false; + } + } else { + mValid = true; + } + + return tValid && wdValid && mdValid && mValid; + +} + +function setVariable(context, name, value, callback) { + console.log('Setting variable...'); + console.log('Sending set variable,variable is ' + name + ', value is ', value); + context.send(util.format('SET VARIABLE %s %s\n', name, value), function(err, res) { + if (callback) { + callback(err, res); + } + }); +} + +function getVariableName(id) { + if (!variables) { + getVariables(false); + } + var variable = { + name: 'placeholder' //if for any reason i don't receive both the name and the id of the variable, the value will be saved in a placeholder variable + }; + if (id) { + variable = _.find(variables, { + id: parseInt(id) + }); + } + return variable.name; +} + +function setVariablesMatrix(context, vertex, callback, data) { + var varName = getVariableName(vertex.variable_id); + _.forEach(data, function(row, index) { + _.forOwn(row, function(value, key) { + wait.for(setVariable, context, varName + '[' + index + '][' + key + ']', value); + }); + }); +} + +function getVariable(context, name, callback) { + context.getVariable(name, function(err, res) { + if (res.code === 200 && res.result !== '0') { + res.data = res.result.substring(res.result.lastIndexOf("(") + 1, + res.result.lastIndexOf(")")); + } else { + res.data = ''; + } + callback(null, res); + }) +} + +function getFilePath(id) { + if (!sounds) { + getSounds(false); + } + if (id > 0) { + var file = _.find(sounds, { + id: parseInt(id) + }); + return util.format('%s/%s', config.convertedSounds, file.save_name); + } + return ''; +} + +function getUsers(synch) { + User + .findAll() + .then(function(result) { + users = _.clone(result); + if (synch) { + synchUpdates(User, users, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getQueues(synch) { + VoiceQueue + .findAll() + .then(function(result) { + queues = _.clone(result); + if (synch) { + synchUpdates(VoiceQueue, queues, 'name'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getTrunks(synch) { + Trunk + .findAll() + .then(function(result) { + trunks = _.clone(result); + if (synch) { + synchUpdates(Trunk, trunks, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getVariables(synch) { + Variable + .findAll() + .then(function(result) { + variables = _.clone(result); + if (synch) { + synchUpdates(Variable, variables, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getDbConnections(synch) { + SquareOdbc + .findAll() + .then(function(result) { + dbConnections = _.clone(result); + if (synch) { + synchUpdates(SquareOdbc, dbConnections, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getIntervals(synch) { + Interval + .findAll() + .then(function(result) { + intervals = _.clone(result); + if (synch) { + synchUpdates(Interval, intervals, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getProjects(synch) { + SquareProject + .findAll() + .then(function(result) { + projects = _.clone(result); + if (synch) { + synchUpdates(SquareProject, projects, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getSounds(synch) { + Sound + .findAll() + .then(function(result) { + sounds = _.clone(result); + if (synch) { + synchUpdates(Sound, sounds, 'id'); + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function synchUpdates(Model, collection, key) { + var condition = {}; + Model.afterCreate(function(doc) { + condition[key] = doc[key]; + updateCollection(collection, condition, doc); + }); + Model.afterUpdate(function(doc) { + condition[key] = doc[key]; + updateCollection(collection, condition, doc); + }); + Model.afterDestroy(function(doc) { + condition[key] = doc[key]; + _.remove(collection, condition); + }); +} + +function updateCollection(collection, condition, doc) { + var oldItem = _.find(collection, condition); + var index = collection.indexOf(oldItem); + if (oldItem) { + _.merge(collection[index], doc); + } else { + collection.unshift(doc); + } +} + +function getPort() { + Settings + .findOne() + .then(function(result) { + agiPort = result.agi_port; + }) + .catch(function(err) { + console.log(err); + }); +} + +module.exports = function() { + console.log('Starting Cally Square AGI...'); + getPort(); + var server = agi.createServer(main).listen(agiPort ? agiPort : 4573); + getUsers(true); + getQueues(true); + getTrunks(true); + getVariables(true); + getIntervals(true); + getProjects(true); + getSounds(true); + getDbConnections(true); +}; diff --git a/server/config/ami/action.js b/server/config/ami/action.js index bf3713b..99ebb83 100644 --- a/server/config/ami/action.js +++ b/server/config/ami/action.js @@ -1 +1,574 @@ -var _0x40d8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x62\x6C\x75\x65\x62\x69\x72\x64","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x41\x63\x74\x69\x6F\x6E","\x55\x73\x65\x72","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x41\x63\x74\x69\x6F\x6E\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x76\x6F\x69\x63\x65","\x63\x68\x61\x74","\x6D\x61\x69\x6C","\x66\x61\x78","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x6C\x6C","\x65\x6E\x74\x65\x72\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x73\x65\x63\x6F\x6E\x64\x73","\x64\x69\x66\x66","\x75\x70\x64\x61\x74\x65","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x62\x65\x66\x6F\x72\x65\x43\x72\x65\x61\x74\x65","\x6E\x61\x6D\x65","\x25\x73\x2F\x25\x73","\x53\x49\x50","\x74\x79\x70\x65","\x62\x6F\x64\x79","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x64\x61\x74\x61\x34","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x51\x75\x65\x75\x65\x50\x61\x75\x73\x65","\x61\x63\x74\x69\x6F\x6E","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x41\x6C\x72\x65\x61\x64\x79\x20\x50\x61\x75\x73\x65\x20\x4F\x66\x66","\x66\x69\x6E\x64\x4F\x6E\x65","\x25\x73\x25\x73","\x50\x61\x75\x73\x65","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x4C\x4F\x47\x49\x4E","\x51\x75\x65\x75\x65\x41\x64\x64","\x67\x65\x74\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65\x73","\x51\x75\x65\x75\x65\x52\x65\x6D\x6F\x76\x65","\x69\x64","\x53\x49\x50\x2F\x25\x73","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x71\x75\x65\x75\x65\x73","\x71\x75\x65\x75\x65\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x69\x6F\x6E\x20\x72\x65\x6D\x6F\x76\x65\x20\x65\x72\x72\x6F\x72\x20\x3A","\x71\x75\x65\x75\x65","\x64\x65\x73\x74\x72\x6F\x79","\x71\x75\x65\x75\x65\x49\x64","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x41\x67\x65\x6E\x74","\x61\x67\x65\x6E\x74","\x66\x69\x6E\x64\x42\x79\x49\x64","\x70\x61\x75\x73\x65","\x75\x6E\x70\x61\x75\x73\x65","\x6C\x6F\x67\x69\x6E","\x6C\x6F\x67\x6F\x75\x74","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x41\x63\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];_0x40d8[0];var moment=require(_0x40d8[1]);var util=require(_0x40d8[2]);var Promise=require(_0x40d8[3]);var Sequelize=require(_0x40d8[5])[_0x40d8[4]];var ReportMember=require(_0x40d8[5])[_0x40d8[6]];var _Action=require(_0x40d8[5])[_0x40d8[7]];var Agent=require(_0x40d8[5])[_0x40d8[8]];var UserHasVoiceQueue=require(_0x40d8[5])[_0x40d8[9]];var UserHasChatQueue=require(_0x40d8[5])[_0x40d8[10]];var UserHasMailQueue=require(_0x40d8[5])[_0x40d8[11]];var UserHasFaxQueue=require(_0x40d8[5])[_0x40d8[12]];function Action(_0x63ddxd){console[_0x40d8[14]](_0x40d8[13]);var _0x63ddxe=[_0x40d8[15],_0x40d8[16],_0x40d8[17],_0x40d8[18]];_Action[_0x40d8[19]](function(_0x63ddxf,_0x63ddx10){return _0x63ddx2d(_0x63ddxf,_0x63ddx10,_0x63ddxd)});ReportMember[_0x40d8[34]](function(_0x63ddxf,_0x63ddx10){return ReportMember[_0x40d8[33]]({where:{channel:_0x63ddxf[_0x40d8[30]],membername:_0x63ddxf[_0x40d8[31]],interface:_0x63ddxf[_0x40d8[32]],exitAt:null}})[_0x40d8[29]](function(_0x63ddx11){var _0x63ddx12=[];var _0x63ddx13=moment();_0x63ddx11[_0x40d8[28]](function(_0x63ddx14){var _0x63ddx15=moment(_0x63ddx14[_0x40d8[21]]);_0x63ddx12[_0x40d8[27]](_0x63ddx14[_0x40d8[26]]({exitAt:_0x63ddx13[_0x40d8[23]](_0x40d8[22]),duration:_0x63ddx13[_0x40d8[25]](_0x63ddx15,_0x40d8[24])}))});return _0x63ddx12})[_0x40d8[20]]()});function _0x63ddx16(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){return Promise[_0x40d8[48]](_0x63ddxd[_0x40d8[47]])({action:_0x40d8[46],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),paused:true,reason:_0x63ddx10[_0x40d8[39]][_0x40d8[38]]})[_0x40d8[29]](function(_0x63ddx1b){return _0x63ddx18[_0x40d8[26]]({voicePause:true,chatPause:true,mailPause:true,faxPause:true,pauseType:_0x63ddx10[_0x40d8[39]][_0x40d8[38]],lastPauseAt:moment()[_0x40d8[23]](_0x40d8[22])},{transaction:_0x63ddx10[_0x40d8[44]]||null})})[_0x40d8[29]](function(_0x63ddx18){var _0x63ddx19=[];_0x63ddxe[_0x40d8[28]](function(_0x63ddx1a){_0x63ddx19[_0x40d8[27]]({channel:_0x63ddx1a,membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),type:_0x63ddx10[_0x40d8[39]][_0x40d8[38]],enterAt:moment()[_0x40d8[23]](_0x40d8[22]),data1:_0x63ddx17[_0x40d8[40]],data2:_0x63ddx17[_0x40d8[41]],data3:_0x63ddx17[_0x40d8[42]],data4:_0x63ddx17[_0x40d8[43]]})});return ReportMember[_0x40d8[45]](_0x63ddx19,{individualHooks:true,transaction:_0x63ddx10[_0x40d8[44]]||null})})}}function _0x63ddx1c(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){if(!_0x63ddx10[_0x40d8[39]]){_0x63ddx10[_0x40d8[39]]={}};switch(_0x63ddx10[_0x40d8[39]][_0x40d8[30]]){case _0x40d8[15]:return Promise[_0x40d8[48]](_0x63ddxd[_0x40d8[47]])({action:_0x40d8[46],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),paused:false,reason:_0x63ddx10[_0x40d8[39]][_0x40d8[38]]})[_0x40d8[29]](function(){return _0x63ddx18[_0x40d8[26]]({voicePause:false},{transaction:_0x63ddx10[_0x40d8[44]]||null})})[_0x40d8[29]](function(_0x63ddx18){var _0x63ddx13=moment();return ReportMember[_0x40d8[50]]({where:{channel:_0x63ddx10[_0x40d8[39]][_0x40d8[30]],membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),exitAt:null}})})[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[49]}))[_0x40d8[29]](function(_0x63ddx1d){var _0x63ddx13=moment();var _0x63ddx15=moment(_0x63ddx1d[_0x40d8[21]]);return _0x63ddx1d[_0x40d8[26]]({exitAt:_0x63ddx13[_0x40d8[23]](_0x40d8[22]),duration:_0x63ddx13[_0x40d8[25]](_0x63ddx15,_0x40d8[24])},{individualHooks:true,transaction:_0x63ddx10[_0x40d8[44]]||null})})[_0x40d8[29]](function(){return _0x63ddx18});case _0x40d8[16]:;case _0x40d8[17]:;case _0x40d8[18]:var _0x63ddx1e={};_0x63ddx1e[util[_0x40d8[23]](_0x40d8[51],_0x63ddx10[_0x40d8[39]][_0x40d8[30]],_0x40d8[52])]=false;return _0x63ddx18[_0x40d8[26]](_0x63ddx1e,{transaction:_0x63ddx10[_0x40d8[44]]})[_0x40d8[29]](function(_0x63ddx18){var _0x63ddx13=moment();return ReportMember[_0x40d8[50]]({where:{channel:_0x63ddx10[_0x40d8[39]][_0x40d8[30]],membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),exitAt:null}})})[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[49]}))[_0x40d8[29]](function(_0x63ddx1d){var _0x63ddx13=moment();var _0x63ddx15=moment(_0x63ddx1d[_0x40d8[21]]);return _0x63ddx1d[_0x40d8[26]]({exitAt:_0x63ddx13[_0x40d8[23]](_0x40d8[22]),duration:_0x63ddx13[_0x40d8[25]](_0x63ddx15,_0x40d8[24])},{individualHooks:true,transaction:_0x63ddx10[_0x40d8[44]]})})[_0x40d8[29]](function(){return _0x63ddx18});default:var _0x63ddx17=Promise[_0x40d8[48]](_0x63ddxd[_0x40d8[47]]);return _0x63ddx17({action:_0x40d8[46],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),paused:false})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x63ddx1f)})[_0x40d8[29]](function(){return _0x63ddx18[_0x40d8[26]]({voicePause:false,mailPause:false,chatPause:false,faxPause:false},{transaction:_0x63ddx10[_0x40d8[44]]})})[_0x40d8[29]](function(_0x63ddx18){var _0x63ddx13=moment();return ReportMember[_0x40d8[26]]({exitAt:_0x63ddx13},{where:{membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),exitAt:null},transaction:_0x63ddx10[_0x40d8[44]]})})[_0x40d8[29]](function(){return _0x63ddx18})}}}function _0x63ddx20(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){return _0x63ddx18[_0x40d8[57]]()[_0x40d8[29]](function(_0x63ddx21){var _0x63ddx22=[];_0x63ddx21[_0x40d8[28]](function(_0x63ddx23){_0x63ddx22[_0x40d8[27]](_0x63ddxd[_0x40d8[47]]({action:_0x40d8[56],queue:_0x63ddx23[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),membername:_0x63ddx18[_0x40d8[35]]}))});return Promise[_0x40d8[20]](_0x63ddx22)})[_0x40d8[29]](function(_0x63ddx1b){var _0x63ddx19=[];_0x63ddxe[_0x40d8[28]](function(_0x63ddx1a){_0x63ddx19[_0x40d8[27]]({channel:_0x63ddx1a,membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),type:_0x40d8[55],enterAt:moment()[_0x40d8[23]](_0x40d8[22])})});return ReportMember[_0x40d8[45]](_0x63ddx19,{individualHooks:true})})}}function _0x63ddx24(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){return _0x63ddx18[_0x40d8[57]]()[_0x40d8[29]](function(_0x63ddx21){var _0x63ddx22=[];_0x63ddx21[_0x40d8[28]](function(_0x63ddx23){_0x63ddx22[_0x40d8[27]](_0x63ddxd[_0x40d8[47]]({action:_0x40d8[58],queue:_0x63ddx23[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]])}))});return Promise[_0x40d8[20]](_0x63ddx22)[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x63ddx1f)})})[_0x40d8[29]](function(_0x63ddx1b){return ReportMember[_0x40d8[26]]({exitAt:moment()[_0x40d8[23]](_0x40d8[22])},{where:{membername:_0x63ddx18[_0x40d8[35]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),type:_0x40d8[55],exitAt:null},individualHooks:true,transaction:_0x63ddx10[_0x40d8[44]]})})}}function _0x63ddx25(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){var _0x63ddx26=[];switch(_0x63ddx10[_0x40d8[39]][_0x40d8[30]]){case _0x40d8[15]:_0x63ddx10[_0x40d8[39]][_0x40d8[62]][_0x40d8[28]](function(_0x63ddx27){_0x63ddx26[_0x40d8[27]](UserHasVoiceQueue[_0x40d8[61]]({where:{UserId:_0x63ddx18[_0x40d8[59]],queue:_0x63ddx27},defaults:{queue:_0x63ddx27,location:util[_0x40d8[23]](_0x40d8[60],_0x63ddx18[_0x40d8[35]]),membername:_0x63ddx18[_0x40d8[35]],UserId:_0x63ddx18[_0x40d8[59]]},transaction:_0x63ddx10[_0x40d8[44]]}))});return Promise[_0x40d8[20]](_0x63ddx26)[_0x40d8[29]](function(){var _0x63ddx22=[];_0x63ddx10[_0x40d8[39]][_0x40d8[62]][_0x40d8[28]](function(_0x63ddx27){_0x63ddx22[_0x40d8[27]](_0x63ddxd[_0x40d8[47]]({action:_0x40d8[56],queue:_0x63ddx27,interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]]),membername:_0x63ddx18[_0x40d8[35]]}))});return Promise[_0x40d8[20]](_0x63ddx22)})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x63ddx1f)});case _0x40d8[16]:_0x63ddx10[_0x40d8[39]][_0x40d8[62]][_0x40d8[28]](function(_0x63ddx27){_0x63ddx26[_0x40d8[27]](UserHasChatQueue[_0x40d8[61]]({where:{UserId:_0x63ddx18[_0x40d8[59]],ChatQueueId:_0x63ddx27[_0x40d8[59]]},defaults:{ChatQueueId:_0x63ddx27[_0x40d8[59]],queue:_0x63ddx27[_0x40d8[35]],UserId:_0x63ddx18[_0x40d8[59]]},transaction:_0x63ddx10[_0x40d8[44]]}))});return Promise[_0x40d8[20]](_0x63ddx26)[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[14]](_0x63ddx1f)});case _0x40d8[17]:_0x63ddx10[_0x40d8[39]][_0x40d8[62]][_0x40d8[28]](function(_0x63ddx27){_0x63ddx26[_0x40d8[27]](UserHasMailQueue[_0x40d8[61]]({where:{UserId:_0x63ddx18[_0x40d8[59]],MailQueueId:_0x63ddx27[_0x40d8[59]]},defaults:{MailQueueId:_0x63ddx27[_0x40d8[59]],queue:_0x63ddx27[_0x40d8[35]],UserId:_0x63ddx18[_0x40d8[59]]},transaction:_0x63ddx10[_0x40d8[44]]}))});return Promise[_0x40d8[20]](_0x63ddx26)[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[14]](_0x63ddx1f)});case _0x40d8[18]:_0x63ddx10[_0x40d8[39]][_0x40d8[62]][_0x40d8[28]](function(_0x63ddx27){_0x63ddx26[_0x40d8[27]](UserHasFaxQueue[_0x40d8[61]]({where:{UserId:_0x63ddx18[_0x40d8[59]],FaxQueueId:_0x63ddx27[_0x40d8[59]]},defaults:{faxQueueId:_0x63ddx27[_0x40d8[59]],queue:_0x63ddx27[_0x40d8[35]],UserId:_0x63ddx18[_0x40d8[59]]},transaction:_0x63ddx10[_0x40d8[44]]}))});return Promise[_0x40d8[20]](_0x63ddx26)[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[14]](_0x63ddx1f)});default:}}}function _0x63ddx28(_0x63ddx10,_0x63ddx17){return function(_0x63ddx18){switch(_0x63ddx10[_0x40d8[39]][_0x40d8[30]]){case _0x40d8[15]:return UserHasVoiceQueue[_0x40d8[65]]({where:{UserId:_0x63ddx18[_0x40d8[59]],queue:_0x63ddx10[_0x40d8[39]][_0x40d8[64]]},transaction:_0x63ddx10[_0x40d8[44]],individualHooks:true})[_0x40d8[29]](function(){var _0x63ddx29=Promise[_0x40d8[48]](_0x63ddxd[_0x40d8[47]]);return _0x63ddx29({action:_0x40d8[58],queue:_0x63ddx10[_0x40d8[39]][_0x40d8[64]],interface:util[_0x40d8[23]](_0x40d8[36],_0x40d8[37],_0x63ddx18[_0x40d8[35]])})})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x40d8[63],_0x63ddx1f)});case _0x40d8[16]:return UserHasChatQueue[_0x40d8[65]]({where:{UserId:_0x63ddx18[_0x40d8[59]],ChatQueueId:_0x63ddx10[_0x40d8[39]][_0x40d8[66]]},transaction:_0x63ddx10[_0x40d8[44]],individualHooks:true})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x40d8[63],_0x63ddx1f)});case _0x40d8[17]:return UserHasMailQueue[_0x40d8[65]]({where:{UserId:_0x63ddx18[_0x40d8[59]],MailQueueId:_0x63ddx10[_0x40d8[39]][_0x40d8[66]]},transaction:_0x63ddx10[_0x40d8[44]],individualHooks:true})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x40d8[63],_0x63ddx1f)});case _0x40d8[18]:return UserHasFaxQueue[_0x40d8[65]]({where:{UserId:_0x63ddx18[_0x40d8[59]],FaxQueueId:_0x63ddx10[_0x40d8[39]][_0x40d8[66]]},transaction:_0x63ddx10[_0x40d8[44]],individualHooks:true})[_0x40d8[54]](function(_0x63ddx1f){console[_0x40d8[53]](_0x40d8[63],_0x63ddx1f)});default:}}}function _0x63ddx2a(_0x63ddx2b){return function(_0x63ddx2c){if(!_0x63ddx2c){throw _0x63ddx2b};return _0x63ddx2c}}function _0x63ddx2d(_0x63ddx17,_0x63ddx10,_0x63ddxd){switch(_0x63ddx17[_0x40d8[35]]){case _0x40d8[70]:return Agent[_0x40d8[69]](_0x63ddx10[_0x40d8[39]][_0x40d8[68]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx16(_0x63ddx10,_0x63ddx17));case _0x40d8[71]:return Agent[_0x40d8[69]](_0x63ddx10[_0x40d8[39]][_0x40d8[68]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx1c(_0x63ddx10,_0x63ddx17));case _0x40d8[72]:return Agent[_0x40d8[69]](_0x63ddx17[_0x40d8[40]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx20(_0x63ddx10,_0x63ddx17));case _0x40d8[73]:return Agent[_0x40d8[69]](_0x63ddx17[_0x40d8[40]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx1c(_0x63ddx10,_0x63ddx17))[_0x40d8[29]](_0x63ddx24(_0x63ddx10,_0x63ddx17));case _0x40d8[56]:return Agent[_0x40d8[69]](_0x63ddx10[_0x40d8[39]][_0x40d8[68]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx25(_0x63ddx10,_0x63ddx17));case _0x40d8[58]:return Agent[_0x40d8[69]](_0x63ddx10[_0x40d8[39]][_0x40d8[68]])[_0x40d8[29]](_0x63ddx2a({message:_0x40d8[67]}))[_0x40d8[29]](_0x63ddx28(_0x63ddx10,_0x63ddx17));default:throw {message:_0x40d8[74]}}}return {}}module[_0x40d8[75]]=Action \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +var moment = require('moment'); +var util = require('util'); +var Promise = require('bluebird'); + +var Sequelize = require('../../models').sequelize; +var ReportMember = require('../../models').ReportMember; +var _Action = require('../../models').Action; +var Agent = require('../../models').User; +var UserHasVoiceQueue = require('../../models').UserHasVoiceQueue; +var UserHasChatQueue = require('../../models').UserHasChatQueue; +var UserHasMailQueue = require('../../models').UserHasMailQueue; +var UserHasFaxQueue = require('../../models').UserHasFaxQueue; + +function Action(ami) { + console.log('Action Initialization...'); + var channels = ['voice', 'chat', 'mail', 'fax']; + + _Action.afterCreate(function(doc, options) { + return onSave(doc, options, ami); + }); + + ReportMember.beforeCreate(function(doc, options) { + return ReportMember + .findAll({ + where: { + channel: doc.channel, + membername: doc.membername, + interface: doc.interface, + exitAt: null + } + }) + .then(function(elms) { + var queries = []; + var exitAt = moment(); + elms.forEach(function(elm) { + var enterAt = moment(elm.enterAt); + queries.push(elm.update({ + exitAt: exitAt.format("YYYY-MM-DD HH:mm:ss"), + duration: exitAt.diff(enterAt, 'seconds') + })); + }) + return queries; + }) + .all(); + }); + + // HANDLE PAUSE FUNCTION + function handlePause(options, action) { + return function(agent) { + return Promise + .promisify(ami.action)({ + action: 'QueuePause', + interface: util.format('%s/%s', 'SIP', agent.name), + paused: true, + reason: options.body.type + }) + .then(function(astData) { + return agent + .update({ + voicePause: true, + chatPause: true, + mailPause: true, + faxPause: true, + pauseType: options.body.type, + lastPauseAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + transaction: options.transaction || null + }); + }) + .then(function(agent) { + var reportMembers = []; + channels.forEach(function(channel) { + reportMembers.push({ + channel: channel, + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + type: options.body.type, + enterAt: moment().format("YYYY-MM-DD HH:mm:ss"), + data1: action.data1, + data2: action.data2, + data3: action.data3, + data4: action.data4 + }); + }) + return ReportMember + .bulkCreate(reportMembers, { + individualHooks: true, + transaction: options.transaction || null + }); + }); + } + } + + // HANDLE UNPAUSE FUNCTION + function handleUnpause(options, action) { + return function(agent) { + if (!options.body) options.body = {}; + + switch (options.body.channel) { + case 'voice': + + return Promise + .promisify(ami.action)({ + action: 'QueuePause', + interface: util.format('%s/%s', 'SIP', agent.name), + paused: false, + reason: options.body.type + }) + .then(function() { + return agent + .update({ + voicePause: false, + }, { + transaction: options.transaction || null + }) + }) + .then(function(agent) { + var exitAt = moment(); + return ReportMember + .findOne({ + where: { + channel: options.body.channel, + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + exitAt: null + } + }); + }) + .then(handleEntityNotFound({ + message: 'Already Pause Off' + })) + .then(function(reportMember) { + var exitAt = moment(); + var enterAt = moment(reportMember.enterAt); + + return reportMember + .update({ + exitAt: exitAt.format("YYYY-MM-DD HH:mm:ss"), + duration: exitAt.diff(enterAt, 'seconds') + }, { + individualHooks: true, + transaction: options.transaction || null + }); + }) + .then(function() { + return agent; + }); + + case 'chat': + case 'mail': + case 'fax': + + var data = {}; + data[util.format('%s%s', options.body.channel, 'Pause')] = false; + + return agent + .update(data, { + transaction: options.transaction + }) + .then(function(agent) { + var exitAt = moment(); + + return ReportMember + .findOne({ + where: { + channel: options.body.channel, + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + exitAt: null + } + }); + }) + .then(handleEntityNotFound({ + message: 'Already Pause Off' + })) + .then(function(reportMember) { + var exitAt = moment(); + var enterAt = moment(reportMember.enterAt); + + return reportMember + .update({ + exitAt: exitAt.format("YYYY-MM-DD HH:mm:ss"), + duration: exitAt.diff(enterAt, 'seconds') + }, { + individualHooks: true, + transaction: options.transaction + }); + }) + .then(function() { + return agent; + }); + + default: + var action = Promise.promisify(ami.action); + return action({ + action: 'QueuePause', + interface: util.format('%s/%s', 'SIP', agent.name), + paused: false + }) + .catch(function(err) { + console.error(err); + }) + .then(function() { + return agent + .update({ + voicePause: false, + mailPause: false, + chatPause: false, + faxPause: false + }, { + transaction: options.transaction + }); + }) + .then(function(agent) { + var exitAt = moment(); + return ReportMember + .update({ + exitAt: exitAt + }, { + where: { + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + exitAt: null + }, + transaction: options.transaction + }); + }) + .then(function() { + return agent; + }); + } + } + } + + // HANDLE LOGIN FUNCTION + function handleLogin(options, action) { + return function(agent) { + return agent + .getVoiceQueues() + .then(function(voiceQueues) { + var actions = []; + voiceQueues.forEach(function(voiceQueue) { + actions.push(ami.action({ + action: 'QueueAdd', + queue: voiceQueue.name, + interface: util.format('%s/%s', 'SIP', agent.name), + membername: agent.name + })); + }); + return Promise.all(actions); + }) + .then(function(astData) { + var reportMembers = []; + channels.forEach(function(channel) { + reportMembers.push({ + channel: channel, + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + type: 'LOGIN', + enterAt: moment().format("YYYY-MM-DD HH:mm:ss") + }); + }); + return ReportMember + .bulkCreate(reportMembers, { + individualHooks: true + }); + }); + } + } + + // HANDLE LOGOUT FUNCTION + function handleLogout(options, action) { + return function(agent) { + return agent + .getVoiceQueues() + .then(function(voiceQueues) { + var actions = []; + voiceQueues.forEach(function(voiceQueue) { + actions.push(ami.action({ + action: 'QueueRemove', + queue: voiceQueue.name, + interface: util.format('%s/%s', 'SIP', agent.name) + })); + }); + return Promise + .all(actions) + .catch(function(err) { + console.error(err); + }); + }) + .then(function(astData) { + return ReportMember + .update({ + exitAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + membername: agent.name, + interface: util.format('%s/%s', 'SIP', agent.name), + type: 'LOGIN', + exitAt: null + }, + individualHooks: true, + transaction: options.transaction + }); + }); + } + } + + // HANDLE QUEUEADD FUNCTION + function handleQueueAdd(options, action) { + return function(agent) { + var bulkQueues = []; + switch (options.body.channel) { + case 'voice': + options.body.queues.forEach(function(queue) { + bulkQueues.push(UserHasVoiceQueue + .findOrCreate({ + where: { + UserId: agent.id, + queue: queue + }, + defaults: { + queue: queue, + location: util.format('SIP/%s', agent.name), + membername: agent.name, + UserId: agent.id, + }, + transaction: options.transaction + })); + }); + return Promise + .all(bulkQueues) + .then(function() { + var actions = []; + options.body.queues.forEach(function(queue) { + actions.push(ami.action({ + action: 'QueueAdd', + queue: queue, + interface: util.format('%s/%s', 'SIP', agent.name), + membername: agent.name + })); + }); + return Promise + .all(actions); + }) + .catch(function(err) { + console.error(err); + }) + case 'chat': + options.body.queues.forEach(function(queue) { + bulkQueues.push(UserHasChatQueue + .findOrCreate({ + where: { + UserId: agent.id, + ChatQueueId: queue.id + }, + defaults: { + ChatQueueId: queue.id, + queue: queue.name, + UserId: agent.id, + }, + transaction: options.transaction + })); + }); + return Promise + .all(bulkQueues) + .catch(function(err) { + console.log(err); + }); + case 'mail': + options.body.queues.forEach(function(queue) { + bulkQueues.push(UserHasMailQueue + .findOrCreate({ + where: { + UserId: agent.id, + MailQueueId: queue.id + }, + defaults: { + MailQueueId: queue.id, + queue: queue.name, + UserId: agent.id, + }, + transaction: options.transaction + })); + }); + return Promise + .all(bulkQueues) + .catch(function(err) { + console.log(err); + }); + case 'fax': + options.body.queues.forEach(function(queue) { + bulkQueues.push(UserHasFaxQueue + .findOrCreate({ + where: { + UserId: agent.id, + FaxQueueId: queue.id + }, + defaults: { + faxQueueId: queue.id, + queue: queue.name, + UserId: agent.id, + }, + transaction: options.transaction + })); + }); + return Promise + .all(bulkQueues) + .catch(function(err) { + console.log(err); + }); + default: + } + } + } + + // HANDLE QUEUEREMOVE FUNCTION + function handleQueueRemove(options, action) { + return function(agent) { + switch (options.body.channel) { + case 'voice': + return UserHasVoiceQueue + .destroy({ + where: { + UserId: agent.id, + queue: options.body.queue + }, + transaction: options.transaction, + individualHooks: true + }) + .then(function() { + var newAction = Promise.promisify(ami.action); + return newAction({ + action: 'QueueRemove', + queue: options.body.queue, + interface: util.format('%s/%s', 'SIP', agent.name), + }); + }) + .catch(function(err) { + console.error('queue association remove error :', err); + }); + case 'chat': + return UserHasChatQueue + .destroy({ + where: { + UserId: agent.id, + ChatQueueId: options.body.queueId + }, + transaction: options.transaction, + individualHooks: true + }) + .catch(function(err) { + console.error('queue association remove error :', err); + }); + case 'mail': + return UserHasMailQueue + .destroy({ + where: { + UserId: agent.id, + MailQueueId: options.body.queueId + }, + transaction: options.transaction, + individualHooks: true + }) + .catch(function(err) { + console.error('queue association remove error :', err); + }); + case 'fax': + return UserHasFaxQueue + .destroy({ + where: { + UserId: agent.id, + FaxQueueId: options.body.queueId + }, + transaction: options.transaction, + individualHooks: true + }) + .catch(function(err) { + console.error('queue association remove error :', err); + }); + default: + } + } + } + + // HANDLE ENTITY NOT FOUND + function handleEntityNotFound(error) { + return function(entity) { + if (!entity) { + throw error; + } + return entity; + }; + } + + function onSave(action, options, ami) { + // START ACTION STATEMENT + switch (action.name) { + case 'pause': + // START HANDLE PAUSE + return Agent + .findById(options.body.agent) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handlePause(options, action)); + // END HANDLE PAUSE + case 'unpause': + // START HANDLE UNPAUSE + return Agent + .findById(options.body.agent) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handleUnpause(options, action)); + // END HANDLE UNPAUSE + + case 'login': + // START HANDLE LOGIN + return Agent + .findById(action.data1) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handleLogin(options, action)); + // END HANDLE LOGING + + case 'logout': + // START HANDLE LOGOUT + return Agent + .findById(action.data1) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handleUnpause(options, action)) + .then(handleLogout(options, action)); + // END HANDLE LOGOUT + case 'QueueAdd': + // START HANDLE QUEUEADD + return Agent + .findById(options.body.agent) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handleQueueAdd(options, action)); + // END HANDLE QUEUEADD + case 'QueueRemove': + // START HANDLE QUEUEREMOVE + return Agent + .findById(options.body.agent) + .then(handleEntityNotFound({ + message: 'Unknown Agent' + })) + .then(handleQueueRemove(options, action)); + // END HANDLE QUEUEREMOVE + + default: + throw { + message: 'Unknown Action' + }; + } + // END ACTION STATEMENT + } + + return {}; +} + +module.exports = Action; diff --git a/server/config/ami/acw.js b/server/config/ami/acw.js index 10be274..d3f273e 100644 --- a/server/config/ami/acw.js +++ b/server/config/ami/acw.js @@ -1 +1,152 @@ -var _0xaa3f=["\x6D\x6F\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x41\x63\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x41\x43\x57\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x75\x6E\x70\x61\x75\x73\x65","\x62\x6F\x64\x79","\x61\x63\x77\x54\x69\x6D\x65","\x74\x69\x6D\x65\x6F\x75\x74","\x61\x73\x53\x65\x63\x6F\x6E\x64\x73","\x61\x63\x77\x41\x74","\x64\x75\x72\x61\x74\x69\x6F\x6E","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x71\x75\x65\x75\x65","\x66\x69\x6E\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x50\x41\x55\x53\x45\x44\x20\x42\x59\x20\x41\x43\x57","\x61\x63\x77\x54\x69\x6D\x65\x6F\x75\x74","\x55\x4E\x50\x41\x55\x53\x45\x44\x20\x42\x59\x20\x41\x43\x57","\x41\x43\x57","\x63\x72\x65\x61\x74\x65","\x70\x61\x75\x73\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78\x4F\x66","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0xaa3f[0]);var _=require(_0xaa3f[1]);var VoiceQueue=require(_0xaa3f[3])[_0xaa3f[2]];var Agent=require(_0xaa3f[3])[_0xaa3f[4]];var Action=require(_0xaa3f[3])[_0xaa3f[5]];var ReportAgent=require(_0xaa3f[3])[_0xaa3f[6]];var _voiceQueues;var _agents;var activeAcw={};function ACW(_0x6b47xb){console[_0xaa3f[8]](_0xaa3f[7]);VoiceQueue[_0xaa3f[14]]()[_0xaa3f[12]](function(_0x6b47x10){_voiceQueues=_0x6b47x10;synchCollection(VoiceQueue,_voiceQueues,_0xaa3f[13]);return Agent[_0xaa3f[16]](_0xaa3f[15])[_0xaa3f[14]]()})[_0xaa3f[12]](function(_0x6b47xd){_agents=_0x6b47xd;synchCollection(Agent,_agents,_0xaa3f[10]);Action[_0xaa3f[11]](function(_0x6b47xe,_0x6b47xf){return onSave(_0x6b47xe,_0x6b47xf)})})[_0xaa3f[9]](function(_0x6b47xc){console[_0xaa3f[8]](_0x6b47xc)})}function onSave(_0x6b47xe,_0x6b47xf){if(_0x6b47xe[_0xaa3f[13]]===_0xaa3f[17]&&activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]]){var _0x6b47x12;if(activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[17]]){_0x6b47x12=activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[19]]}else {clearTimeout(activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[20]]);_0x6b47x12=moment[_0xaa3f[23]](moment()-activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[22]])[_0xaa3f[21]]()};return ReportAgent[_0xaa3f[27]]({agentacw:true,acwtime:_0x6b47x12},{where:{uniqueid:activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[24]],destuniqueid:activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]][_0xaa3f[25]]},transaction:_0x6b47xf[_0xaa3f[26]],individualHooks:true})[_0xaa3f[12]](function(){delete activeAcw[_0x6b47xf[_0xaa3f[18]][_0xaa3f[15]]]})[_0xaa3f[9]](function(_0x6b47xc){console[_0xaa3f[8]](_0x6b47xc)})}}ACW[_0xaa3f[29]][_0xaa3f[28]]=function(_0x6b47x13){var _0x6b47x14=_[_0xaa3f[31]](_voiceQueues,{name:_0x6b47x13[_0xaa3f[30]],acw:true});if(_0x6b47x14){var _0x6b47x15=_[_0xaa3f[31]](_agents,{name:_0x6b47x13[_0xaa3f[32]]});Action[_0xaa3f[37]]({name:_0xaa3f[38],data1:_0x6b47x13[_0xaa3f[30]],data2:_0x6b47x14[_0xaa3f[34]],data3:_0x6b47x13[_0xaa3f[24]],data4:_0xaa3f[36]},{body:{agent:_0x6b47x15[_0xaa3f[10]],type:_0xaa3f[36]}})[_0xaa3f[12]](function(){console[_0xaa3f[8]](_0xaa3f[33]);activeAcw[_0x6b47x15[_0xaa3f[10]]]={uniqueid:_0x6b47x13[_0xaa3f[24]],destuniqueid:_0x6b47x13[_0xaa3f[25]],acwTime:_0x6b47x14[_0xaa3f[34]],acwAt:moment(),unpause:false};activeAcw[_0x6b47x15[_0xaa3f[10]]][_0xaa3f[20]]=setTimeout(function(){console[_0xaa3f[8]](_0xaa3f[35]);activeAcw[_0x6b47x15[_0xaa3f[10]]][_0xaa3f[17]]=true;return Action[_0xaa3f[37]]({name:_0xaa3f[17],data1:_0x6b47x13[_0xaa3f[30]],data2:_0x6b47x14[_0xaa3f[34]],data3:_0x6b47x13[_0xaa3f[24]],data4:_0xaa3f[36]},{body:{agent:_0x6b47x15[_0xaa3f[10]],type:_0xaa3f[36]}})[_0xaa3f[9]](function(_0x6b47xc){console[_0xaa3f[8]](_0x6b47xc)})},_0x6b47x14[_0xaa3f[34]]*1000)})[_0xaa3f[9]](function(_0x6b47xc){console[_0xaa3f[8]](_0x6b47xc)})}};function synchCollection(_0x6b47x17,_0x6b47x18,_0x6b47x19){var _0x6b47x1a={};_0x6b47x17[_0xaa3f[11]](function(_0x6b47xe){_0x6b47x1a[_0x6b47x19]=_0x6b47xe[_0x6b47x19];updateCollection(_0x6b47x18,_0x6b47xe,_0x6b47x1a)});_0x6b47x17[_0xaa3f[39]](function(_0x6b47xe){_0x6b47x1a[_0x6b47x19]=_0x6b47xe[_0x6b47x19];updateCollection(_0x6b47x18,_0x6b47xe,_0x6b47x1a)});_0x6b47x17[_0xaa3f[41]](function(_0x6b47xe){_0x6b47x1a[_0x6b47x19]=_0x6b47xe[_0x6b47x19];_[_0xaa3f[40]](_0x6b47x18,_0x6b47x1a)})}function updateCollection(_0x6b47x1c,_0x6b47xe,_0x6b47x1a){var _0x6b47x1d=_[_0xaa3f[31]](_0x6b47x1c,_0x6b47x1a);var _0x6b47x1e=_0x6b47x1c[_0xaa3f[42]](_0x6b47x1d);if(_0x6b47x1d){_[_0xaa3f[43]](_0x6b47x1c[_0x6b47x1e],_0x6b47xe)}else {_0x6b47x1c[_0xaa3f[44]](_0x6b47xe)}}module[_0xaa3f[45]]=ACW \ No newline at end of file +var moment = require('moment'); +var _ = require('lodash'); +var VoiceQueue = require('../../models').VoiceQueue; +var Agent = require('../../models').User; +var Action = require('../../models').Action; +var ReportAgent = require('../../models').ReportAgent; +var _voiceQueues; +var _agents; +var activeAcw = {}; + + +function ACW(ami) { + console.log('ACW Initialization...'); + VoiceQueue + .findAll() + .then(function(voiceQueues) { + _voiceQueues = voiceQueues; + // console.log('_voiceQueues', _.map(_voiceQueues, 'dataValues')); + synchCollection(VoiceQueue, _voiceQueues, 'name'); + return Agent + .scope('agent') + .findAll(); + }) + .then(function(agents) { + _agents = agents; + // console.log('_agents', _.map(_agents, 'dataValues')); + synchCollection(Agent, _agents, 'id'); + Action.afterCreate(function(doc, options) { + return onSave(doc, options); + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function onSave(doc, options) { + if (doc.name === 'unpause' && activeAcw[options.body.agent]) { + var acwTime; + if (activeAcw[options.body.agent].unpause) { + acwTime = activeAcw[options.body.agent].acwTime; + } else { + clearTimeout(activeAcw[options.body.agent].timeout); + acwTime = moment.duration(moment() - activeAcw[options.body.agent].acwAt).asSeconds(); + } + return ReportAgent + .update({ + agentacw: true, + acwtime: acwTime + }, { + where: { + uniqueid: activeAcw[options.body.agent].uniqueid, + destuniqueid: activeAcw[options.body.agent].destuniqueid + }, + transaction: options.transaction, + individualHooks: true + }) + .then(function() { + delete activeAcw[options.body.agent]; + }) + .catch(function(err) { + console.log(err); + }); + } +} + +ACW.prototype.agentcomplete = function(evt) { + var queueIsAcw = _.find(_voiceQueues, { + name: evt.queue, + acw: true + }); + if (queueIsAcw) { + var agent = _.find(_agents, { + name: evt.membername + }); + Action + .create({ + name: 'pause', + data1: evt.queue, + data2: queueIsAcw.acwTimeout, + data3: evt.uniqueid, + data4: 'ACW' + }, { + body: { + agent: agent.id, + type: 'ACW' + } + }) + .then(function() { + console.log('PAUSED BY ACW'); + activeAcw[agent.id] = { + uniqueid: evt.uniqueid, + destuniqueid: evt.destuniqueid, + acwTime: queueIsAcw.acwTimeout, + acwAt: moment(), + unpause: false + }; + + activeAcw[agent.id].timeout = setTimeout(function() { + console.log('UNPAUSED BY ACW'); + activeAcw[agent.id].unpause = true; + return Action + .create({ + name: 'unpause', + data1: evt.queue, + data2: queueIsAcw.acwTimeout, + data3: evt.uniqueid, + data4: 'ACW' + }, { + body: { + agent: agent.id, + type: 'ACW' + } + }) + .catch(function(err) { + console.log(err); + }); + }, queueIsAcw.acwTimeout * 1000); + }) + .catch(function(err) { + console.log(err); + }); + } +} + +function synchCollection(model, array, uniqueProperty) { + var condition = {}; + model.afterCreate(function(doc) { + condition[uniqueProperty] = doc[uniqueProperty] + updateCollection(array, doc, condition); + }); + model.afterUpdate(function(doc) { + condition[uniqueProperty] = doc[uniqueProperty] + updateCollection(array, doc, condition); + }); + model.afterDestroy(function(doc) { + condition[uniqueProperty] = doc[uniqueProperty] + _.remove(array, condition); + }); +} + +function updateCollection(collection, doc, condition) { + var oldItem = _.find(collection, condition); + var index = collection.indexOf(oldItem); + if (oldItem) { + _.merge(collection[index], doc); + } else { + collection.unshift(doc); + } +} + +module.exports = ACW; diff --git a/server/config/ami/agent.js b/server/config/ami/agent.js index 5cc2e87..1aca579 100644 --- a/server/config/ami/agent.js +++ b/server/config/ami/agent.js @@ -1 +1,94 @@ -var _0x91ec=["\x6D\x6F\x6D\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x67\x65\x6E\x74\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x63\x61\x6C\x6C\x65\x64","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x6C\x61\x73\x74\x65\x76\x65\x6E\x74","\x61\x67\x65\x6E\x74\x63\x61\x6C\x6C\x65\x64\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x63\x6F\x6E\x6E\x65\x63\x74","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74\x41\x74","\x61\x6E\x73\x77\x65\x72\x65\x64\x5F\x65\x6C\x73\x65\x77\x68\x65\x72\x65","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65\x41\x74","\x64\x75\x6D\x70","\x61\x67\x65\x6E\x74\x64\x75\x6D\x70","\x61\x67\x65\x6E\x74\x64\x75\x6D\x70\x41\x74","\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72","\x72\x65\x6A\x65\x63\x74\x65\x64","\x61\x67\x65\x6E\x74\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72","\x61\x67\x65\x6E\x74\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72\x41\x74","\x72\x65\x61\x73\x6F\x6E","\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x61\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x61\x67\x65\x6E\x74\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x61\x67\x65\x6E\x74\x20\x62\x65\x67\x69\x6E\x20\x63\x72\x65\x61\x74\x65\x64","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65","\x5B\x61\x67\x65\x6E\x74\x5D\x20\x61\x67\x65\x6E\x74\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x61\x67\x65\x6E\x74\x5D\x20\x61\x67\x65\x6E\x74","\x75\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0x91ec[0]);var ReportAgent=require(_0x91ec[2])[_0x91ec[1]];function Agent(){console[_0x91ec[4]](_0x91ec[3])}Agent[_0x91ec[6]][_0x91ec[5]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[5];_0xe39dx4[_0x91ec[8]]=moment()[_0x91ec[10]](_0x91ec[9]);return createAgent(_0xe39dx4)};Agent[_0x91ec[6]][_0x91ec[11]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[11];_0xe39dx4[_0x91ec[12]]=moment()[_0x91ec[10]](_0x91ec[9]);updateAgents(_0xe39dx4);updateAgents({agentringnoanswer:true,agentringnoanswerAt:moment()[_0x91ec[10]](_0x91ec[9]),reason:_0x91ec[13],lastevent:_0x91ec[13]},{uniqueid:_0xe39dx4[_0x91ec[14]],destuniqueid:{$ne:_0xe39dx4[_0x91ec[15]]},reason:null})};Agent[_0x91ec[6]][_0x91ec[16]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[16];_0xe39dx4[_0x91ec[17]]=true;_0xe39dx4[_0x91ec[18]]=moment()[_0x91ec[10]](_0x91ec[9]);return updateAgents(_0xe39dx4)};Agent[_0x91ec[6]][_0x91ec[19]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[19];_0xe39dx4[_0x91ec[20]]=true;_0xe39dx4[_0x91ec[21]]=moment()[_0x91ec[10]](_0x91ec[9]);return updateAgents(_0xe39dx4)};Agent[_0x91ec[6]][_0x91ec[22]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[23];_0xe39dx4[_0x91ec[24]]=true;_0xe39dx4[_0x91ec[25]]=moment()[_0x91ec[10]](_0x91ec[9]);_0xe39dx4[_0x91ec[26]]=_0x91ec[23];return updateAgents(_0xe39dx4)};Agent[_0x91ec[6]][_0x91ec[27]]=function(_0xe39dx4){_0xe39dx4[_0x91ec[7]]=_0x91ec[28];_0xe39dx4[_0x91ec[24]]=true;_0xe39dx4[_0x91ec[25]]=moment()[_0x91ec[10]](_0x91ec[9]);_0xe39dx4[_0x91ec[26]]=_0x91ec[28];return updateAgents(_0xe39dx4,{uniqueid:_0xe39dx4[_0x91ec[14]],reason:null})};function createAgent(_0xe39dx4){return ReportAgent[_0x91ec[34]](_0xe39dx4)[_0x91ec[33]](function(_0xe39dx7){console[_0x91ec[4]](_0x91ec[32])})[_0x91ec[31]](function(_0xe39dx6){console[_0x91ec[30]](_0x91ec[29]+_0xe39dx6)})}function updateAgents(_0xe39dx4,_0xe39dx9){return ReportAgent[_0x91ec[37]](_0xe39dx4,{where:(_0xe39dx9)?_0xe39dx9:{uniqueid:_0xe39dx4[_0x91ec[14]],destuniqueid:_0xe39dx4[_0x91ec[15]]},individualHooks:true})[_0x91ec[33]](function(_0xe39dx7){console[_0x91ec[4]](_0x91ec[36])})[_0x91ec[31]](function(_0xe39dx6){console[_0x91ec[30]](_0x91ec[35]+_0xe39dx6)})}module[_0x91ec[38]]=Agent \ No newline at end of file +var moment = require('moment'); +var ReportAgent = require('../../models').ReportAgent; + +function Agent() { + console.log('Agent Initialization...'); +} + +Agent.prototype.called = function(evt) { + evt.lastevent = 'called'; + evt.agentcalledAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return createAgent(evt); +} + +Agent.prototype.connect = function(evt) { + evt.lastevent = 'connect'; + evt.agentconnectAt = moment().format("YYYY-MM-DD HH:mm:ss"); + updateAgents(evt); + updateAgents({ + agentringnoanswer: true, + agentringnoanswerAt: moment().format("YYYY-MM-DD HH:mm:ss"), + reason: 'answered_elsewhere', + lastevent: 'answered_elsewhere' + }, { + uniqueid: evt.uniqueid, + destuniqueid: { + $ne: evt.destuniqueid + }, + reason: null + }) +} + +Agent.prototype.complete = function(evt) { + evt.lastevent = 'complete'; + evt.agentcomplete = true; + evt.agentcompleteAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return updateAgents(evt); +} + +Agent.prototype.dump = function(evt) { + evt.lastevent = 'dump'; + + evt.agentdump = true; + evt.agentdumpAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return updateAgents(evt); +} + +Agent.prototype.ringnoanswer = function(evt) { + evt.lastevent = 'rejected'; + evt.agentringnoanswer = true; + evt.agentringnoanswerAt = moment().format("YYYY-MM-DD HH:mm:ss"); + evt.reason = 'rejected'; + return updateAgents(evt); +} + +Agent.prototype.callerabandon = function(evt) { + evt.lastevent = 'abandoned'; + evt.agentringnoanswer = true; + evt.agentringnoanswerAt = moment().format("YYYY-MM-DD HH:mm:ss"); + evt.reason = 'abandoned'; + return updateAgents(evt, { + uniqueid: evt.uniqueid, + reason: null + }); +} + +function createAgent(evt) { + return ReportAgent + .create(evt) + .then(function(agent) { + console.log('[report] agent begin created'); + }) + .catch(function(err) { + console.error('[report] agent ' + err); + }); +} + +function updateAgents(evt, where) { + return ReportAgent + .update(evt, { + where: (where) ? where : { + uniqueid: evt.uniqueid, + destuniqueid: evt.destuniqueid + }, + individualHooks: true + }) + .then(function(agent) { + console.log('[agent] agent') + }) + .catch(function(err) { + console.error('[agent] agent error: ' + err); + }); +} + +module.exports = Agent; diff --git a/server/config/ami/call.js b/server/config/ami/call.js index e012cb2..15e34b3 100644 --- a/server/config/ami/call.js +++ b/server/config/ami/call.js @@ -1 +1,26 @@ -var _0xe07b=["\x43\x61\x6C\x6C\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x64\x64","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x63\x61\x6C\x6C\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x63\x61\x6C\x6C\x20\x63\x72\x65\x61\x74\x65\x64\x3A\x20","\x73\x70\x72\x65\x61\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];function Call(){console[_0xe07b[1]](_0xe07b[0])}Call[_0xe07b[3]][_0xe07b[2]]=function(_0x8e4fx2){create(_0x8e4fx2)};function create(_0x8e4fx2){var _0x8e4fx4=require(_0xe07b[5])[_0xe07b[4]];_0x8e4fx4[_0xe07b[12]]({where:{uniqueid:_0x8e4fx2[_0xe07b[11]]},defaults:_0x8e4fx2})[_0xe07b[10]](function(_0x8e4fx4,_0x8e4fx6){console[_0xe07b[1]](_0xe07b[9],_0x8e4fx6)})[_0xe07b[8]](function(_0x8e4fx5){console[_0xe07b[7]](_0xe07b[6]+_0x8e4fx5)})}module[_0xe07b[13]]=Call \ No newline at end of file +function Call() { + console.log('Call Initialization...'); +} + +Call.prototype.add = function(evt) { + create(evt); +} + +function create(evt) { + var call = require('../../models').ReportCall; + call + .findOrCreate({ + where: { + uniqueid: evt.uniqueid + }, + defaults: evt + }) + .spread(function(call, created) { + console.log('[report] call created: ', created); + }) + .catch(function(err) { + console.error('[report] call ' + err); + }); +} + +module.exports = Call; diff --git a/server/config/ami/index.js b/server/config/ami/index.js index 96d9888..3d7c92b 100644 --- a/server/config/ami/index.js +++ b/server/config/ami/index.js @@ -1 +1,217 @@ -var _0x6d04=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x2E\x2F\x61\x67\x65\x6E\x74","\x2E\x2F\x61\x63\x74\x69\x6F\x6E","\x2E\x2F\x63\x61\x6C\x6C","\x2E\x2F\x6D\x65\x6D\x62\x65\x72","\x2E\x2F\x71\x75\x65\x75\x65\x5F\x63\x61\x6C\x6C\x65\x72","\x2E\x2F\x71\x75\x65\x75\x65\x5F\x6D\x65\x6D\x62\x65\x72","\x2E\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2E\x2F\x74\x72\x75\x6E\x6B","\x2E\x2F\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74","\x2E\x2F\x61\x63\x77","\x2E\x2F\x75\x73\x65\x72","\x2E\x2F\x74\x72\x61\x6E\x73\x66\x65\x72","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x73","\x65\x78\x70\x6F\x72\x74\x73","\x63\x6F\x6E\x6E\x65\x63\x74","\x5B\x25\x73\x3A\x25\x73\x5D\x20\x41\x4D\x49\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x68\x6F\x73\x74","\x6F\x70\x74\x69\x6F\x6E\x73","\x70\x6F\x72\x74","\x69\x6E\x66\x6F","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x41\x74","\x6F\x6E","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74","\x5B\x25\x73\x3A\x25\x73\x5D\x20\x41\x4D\x49\x20\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x63\x6C\x6F\x73\x65","\x5B\x25\x73\x3A\x25\x73\x5D\x20\x41\x4D\x49\x20\x43\x4C\x4F\x53\x45\x3A\x20\x25\x73","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x5B\x25\x73\x3A\x25\x73\x5D\x20\x41\x4D\x49\x20\x45\x52\x52\x4F\x52\x3A\x20\x25\x73","\x6D\x61\x6E\x61\x67\x65\x72\x65\x76\x65\x6E\x74","\x64\x65\x76\x69\x63\x65\x73\x74\x61\x74\x65\x63\x68\x61\x6E\x67\x65","\x53\x49\x50\x2F","\x69\x6E\x64\x65\x78\x4F\x66","\x64\x65\x76\x69\x63\x65","\x73\x74\x61\x74\x65\x55\x70\x64\x61\x74\x65","\x61\x67\x65\x6E\x74\x63\x61\x6C\x6C\x65\x64","\x63\x61\x6C\x6C\x65\x64","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74","\x61\x67\x65\x6E\x74\x64\x75\x6D\x70","\x64\x75\x6D\x70","\x61\x67\x65\x6E\x74\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72","\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x61\x64\x64\x65\x64","\x6C\x6F\x67\x69\x6E","\x61\x64\x64\x65\x64","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x70\x61\x75\x73\x65","\x70\x61\x75\x73\x65","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x70\x65\x6E\x61\x6C\x74\x79","\x70\x65\x6E\x61\x6C\x74\x79","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x72\x65\x6D\x6F\x76\x65\x64","\x6C\x6F\x67\x6F\x75\x74","\x72\x65\x6D\x6F\x76\x65\x64","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x72\x69\x6E\x67\x69\x6E\x75\x73\x65","\x72\x69\x6E\x67\x69\x6E\x75\x73\x65","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x73\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6A\x6F\x69\x6E","\x6A\x6F\x69\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x61\x62\x61\x6E\x64\x6F\x6E","\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6C\x65\x61\x76\x65","\x6C\x65\x61\x76\x65","\x63\x64\x72","\x61\x64\x64","\x68\x61\x6E\x67\x75\x70","\x6D\x6F\x6E\x69\x74\x6F\x72\x73\x74\x61\x72\x74","\x6D\x6F\x6E\x69\x74\x6F\x72\x73\x74\x6F\x70","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6C\x69\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72","\x74\x79\x70\x65","\x62\x6C\x69\x6E\x64","\x63\x72\x65\x61\x74\x65\x42\x6C\x69\x6E\x64","\x61\x74\x74\x65\x6E\x64\x65\x64\x74\x72\x61\x6E\x73\x66\x65\x72","\x61\x74\x74\x65\x6E\x64\x65\x64","\x63\x72\x65\x61\x74\x65\x41\x74\x74\x65\x6E\x64\x65\x64","\x76\x61\x72\x73\x65\x74","\x69\x6E\x62\x6F\x75\x6E\x64","\x6D\x69\x78\x6D\x6F\x6E\x69\x74\x6F\x72\x5F\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x69\x74","\x71\x75\x65\x75\x65\x73\x74\x61\x74\x75\x73","\x72\x65\x67\x69\x73\x74\x65\x72","\x2E\x2F\x2E\x2E\x2F\x66\x61\x78","\x2E\x2E\x2F\x2E\x2E\x2F\x61\x70\x69\x2F\x61\x6D\x69\x2F\x61\x6D\x69\x2E\x61\x6D\x69"];_0x6d04[0];var Agent=require(_0x6d04[1]);var Action=require(_0x6d04[2]);var Call=require(_0x6d04[3]);var Member=require(_0x6d04[4]);var QueueCaller=require(_0x6d04[5]);var QueueMember=require(_0x6d04[6]);var Recording=require(_0x6d04[7]);var Trunk=require(_0x6d04[8]);var Context=require(_0x6d04[9]);var ACW=require(_0x6d04[10]);var User=require(_0x6d04[11]);var Transfer=require(_0x6d04[12]);function onDisconnect(_0x149bxe){}function onConnect(_0x149bxe){}function getVariable(_0x149bx11){var _0x149bx12=Object[_0x6d04[14]](_0x149bx11[_0x6d04[13]]);_0x149bx11[_0x6d04[13]]=_0x149bx12[0];return _0x149bx11}module[_0x6d04[15]]=function(_0x149bxe){var _0x149bx13= new Agent();var _0x149bx14= new Call();var _0x149bx15= new Member();var _0x149bx16= new QueueMember();var _0x149bx17= new QueueCaller();var _0x149bx18= new Recording();var _0x149bx19= new Trunk(_0x149bxe);var _0x149bx1a= new Context(_0x149bxe);var _0x149bx1b= new Action(_0x149bxe);var _0x149bx1c= new ACW(_0x149bxe);var _0x149bx1d= new User();var _0x149bx1e= new Transfer();_0x149bxe[_0x6d04[23]](_0x6d04[16],function(){console[_0x6d04[21]](_0x6d04[17],_0x149bxe[_0x6d04[19]][_0x6d04[18]],_0x149bxe[_0x6d04[19]][_0x6d04[20]]);_0x149bxe[_0x6d04[19]][_0x6d04[22]]= new Date();onConnect(_0x149bxe)});_0x149bxe[_0x6d04[23]](_0x6d04[24],function(){onDisconnect(_0x149bxe);console[_0x6d04[21]](_0x6d04[25],_0x149bxe[_0x6d04[19]][_0x6d04[18]],_0x149bxe[_0x6d04[19]][_0x6d04[20]])});_0x149bxe[_0x6d04[23]](_0x6d04[26],function(_0x149bx1f){console[_0x6d04[28]](_0x6d04[27],_0x149bxe[_0x6d04[19]][_0x6d04[18]],_0x149bxe[_0x6d04[19]][_0x6d04[20]],_0x149bx1f)});_0x149bxe[_0x6d04[23]](_0x6d04[29],function(_0x149bx20){console[_0x6d04[28]](_0x6d04[30],_0x149bxe[_0x6d04[19]][_0x6d04[18]],_0x149bxe[_0x6d04[19]][_0x6d04[20]],_0x149bx20)});_0x149bxe[_0x6d04[23]](_0x6d04[31],function(_0x149bx21){});_0x149bxe[_0x6d04[23]](_0x6d04[32],function(_0x149bx21){if(_0x149bx21[_0x6d04[35]][_0x6d04[34]](_0x6d04[33])===0){_0x149bx1d[_0x6d04[36]](_0x149bx21)}});_0x149bxe[_0x6d04[23]](_0x6d04[37],function(_0x149bx21){_0x149bx13[_0x6d04[38]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[39],function(_0x149bx21){console[_0x6d04[28]](_0x6d04[39],_0x149bx21);_0x149bx1c[_0x6d04[39]](_0x149bx21);_0x149bx13[_0x6d04[40]](_0x149bx21);_0x149bx17[_0x6d04[40]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[41],function(_0x149bx21){_0x149bx13[_0x6d04[16]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[42],function(_0x149bx21){_0x149bx13[_0x6d04[43]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[44],function(_0x149bx21){_0x149bx13[_0x6d04[45]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[46],function(_0x149bx21){_0x149bx15[_0x6d04[47]](_0x149bx21);_0x149bx16[_0x6d04[48]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[49],function(_0x149bx21){_0x149bx15[_0x6d04[50]](_0x149bx21);_0x149bx16[_0x6d04[50]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[51],function(_0x149bx21){_0x149bx16[_0x6d04[52]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[53],function(_0x149bx21){_0x149bx15[_0x6d04[54]](_0x149bx21);_0x149bx16[_0x6d04[55]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[56],function(_0x149bx21){_0x149bx16[_0x6d04[57]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[58],function(_0x149bx21){_0x149bx16[_0x6d04[59]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[60],function(_0x149bx21){_0x149bx17[_0x6d04[61]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[62],function(_0x149bx21){_0x149bx17[_0x6d04[63]](_0x149bx21);_0x149bx13[_0x6d04[64]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[65],function(_0x149bx21){_0x149bx17[_0x6d04[66]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[67],function(_0x149bx21){_0x149bx14[_0x6d04[68]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[69],function(_0x149bx21){});_0x149bxe[_0x6d04[23]](_0x6d04[70],function(_0x149bx21){});_0x149bxe[_0x6d04[23]](_0x6d04[71],function(_0x149bx21){_0x149bx18[_0x6d04[73]](_0x149bx21,_0x6d04[72])});_0x149bxe[_0x6d04[23]](_0x6d04[74],function(_0x149bx21){console[_0x6d04[28]](_0x6d04[74],_0x149bx21);_0x149bx21[_0x6d04[75]]=_0x6d04[76];_0x149bx1e[_0x6d04[77]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[78],function(_0x149bx21){console[_0x6d04[28]](_0x6d04[78],_0x149bx21);_0x149bx21[_0x6d04[75]]=_0x6d04[79];_0x149bx1e[_0x6d04[80]](_0x149bx21)});_0x149bxe[_0x6d04[23]](_0x6d04[81],function(_0x149bx21){var _0x149bx11=getVariable(_0x149bx21);switch(_0x149bx11[_0x6d04[13]]){case _0x6d04[83]:_0x149bx18[_0x6d04[73]](_0x149bx11,_0x6d04[82]);break;case _0x6d04[85]:_0x149bx17[_0x6d04[84]](_0x149bx11);break;default:break}});require(_0x6d04[87])[_0x6d04[86]](_0x149bxe);require(_0x6d04[88])[_0x6d04[86]](_0x149bxe)} \ No newline at end of file +'use strict'; + +var Agent = require('./agent'); +var Action = require('./action'); +var Call = require('./call'); +var Member = require('./member'); +var QueueCaller = require('./queue_caller'); +var QueueMember = require('./queue_member'); +var Recording = require('./recording'); +var Trunk = require('./trunk'); +var Context = require('./voice_context'); +var ACW = require('./acw'); +var User = require('./user'); +var Transfer = require('./transfer'); + +// When the ami disconnects.. perform this +function onDisconnect(ami) {} + +// When the ami connects.. perform this +function onConnect(ami) {} + +function getVariable(event) { + var keys = Object.keys(event.variable); + event.variable = keys[0]; + return event; +} + +module.exports = function(ami) { + + var agent = new Agent(); + var call = new Call(); + var member = new Member(); + var queuemember = new QueueMember(); + var queuecaller = new QueueCaller(); + var recording = new Recording(); + var trunk = new Trunk(ami); + var context = new Context(ami); + var action = new Action(ami); + var acw = new ACW(ami); + var user = new User(); + var tranfer = new Transfer(); + + // Asterisk Status Connect + + // Raised when asterisk is connected + ami.on('connect', function() { + console.info('[%s:%s] AMI CONNECTED', ami.options.host, ami.options.port); + ami.options.connectedAt = new Date(); + // Call onConnect. + onConnect(ami); + }); + + // Raised when asterisk is disconnected + ami.on('disconnect', function() { + // Call onDisconnect. + onDisconnect(ami); + console.info('[%s:%s] AMI DISCONNECTED', ami.options.host, ami.options.port); + }); + + // Raised when asterisk is closed + ami.on('close', function(flag) { + console.log('[%s:%s] AMI CLOSE: %s', ami.options.host, ami.options.port, flag); + }); + + // Raised when asterisk has an error + ami.on('error', function(err) { + console.log('[%s:%s] AMI ERROR: %s', ami.options.host, ami.options.port, err); + }); + + ami.on('managerevent', function(evt) { + // console.log(evt); + }); + + ami.on('devicestatechange', function(evt) { + // console.log(evt); + if (evt.device.indexOf('SIP/') === 0) { + user.stateUpdate(evt); + } + }); + + // Agent Status Events + + // Raised when an Agent is notified of a member in the queue. + ami.on('agentcalled', function(evt) { + agent.called(evt); + }); + + // Raised when an agent has finished servicing a member in the queue. + ami.on('agentcomplete', function(evt) { + console.log('agentcomplete', evt); + acw.agentcomplete(evt); + agent.complete(evt); + queuecaller.complete(evt); + }); + + // Raised when an agent answers and is bridged to a member in the queue. + ami.on('agentconnect', function(evt) { + agent.connect(evt); + }); + + // Raised when an agent hangs up on a member in the queue. + ami.on('agentdump', function(evt) { + agent.dump(evt); + }); + + // Raised when an agent is notified of a member in the queue and fails to answer. + ami.on('agentringnoanswer', function(evt) { + agent.ringnoanswer(evt); + }); + + // Member Status Events in Queue + + // Raised when a member is added to the queue. + ami.on('queuememberadded', function(evt) { + member.login(evt); + queuemember.added(evt); + }); + + // Raised when a member is paused/unpaused in the queue with a reason. + ami.on('queuememberpause', function(evt) { + member.pause(evt); + queuemember.pause(evt); + }); + + // Raised when a member's penalty is changed. + ami.on('queuememberpenalty', function(evt) { + queuemember.penalty(evt); + }); + + // Raised when a member is removed from the queue. + ami.on('queuememberremoved', function(evt) { + member.logout(evt); + queuemember.removed(evt); + }); + + // Raised when a member's ringinuse setting is changed. + ami.on('queuememberringinuse', function(evt) { + queuemember.ringinuse(evt); + }); + + // Raised when a Queue member's status has changed. + ami.on('queuememberstatus', function(evt) { + queuemember.status(evt); + }); + + // Queue Status Events + + // Raised when a caller joins a Queue. + ami.on('queuecallerjoin', function(evt) { + queuecaller.join(evt); + }); + + // Raised when a caller abandons the queue. + ami.on('queuecallerabandon', function(evt) { + queuecaller.abandon(evt); + //queuemember.callerabandon(evt); + agent.callerabandon(evt); + }); + + // Raised when a caller leaves a Queue. + ami.on('queuecallerleave', function(evt) { + queuecaller.leave(evt); + }); + + // Cdr Status Events + + // Raised when a CDR is generated. + ami.on('cdr', function(evt) { + call.add(evt); + }); + + // Hangup Status Events + ami.on('hangup', function(evt) { + //agent.hangup(evt); + }); + + // Recordings Events + ami.on('monitorstart', function(evt) { + // console.log('evt', evt); + }); + + ami.on('monitorstop', function(evt) { + // console.log('evt', evt); + recording.create(evt, 'outbound'); + }); + + ami.on('blindtransfer', function(evt) { + console.log('blindtransfer', evt); + evt.type = 'blind'; + tranfer.createBlind(evt); + }); + + ami.on('attendedtransfer', function(evt) { + console.log('attendedtransfer', evt); + evt.type = 'attended'; + tranfer.createAttended(evt); + }); + + // Variable Events + ami.on('varset', function(evt) { + var event = getVariable(evt); + switch (event.variable) { + case 'mixmonitor_filename': + recording.create(event, 'inbound'); + break; + case 'queuestatus': + queuecaller.exit(event); + break; + default: + // console.log('Variable not managed:', event.variable); + break; + } + }); + + require('./../fax').register(ami); + require('../../api/ami/ami.ami').register(ami); +}; diff --git a/server/config/ami/member.js b/server/config/ami/member.js index 014efd2..0c4d403 100644 --- a/server/config/ami/member.js +++ b/server/config/ami/member.js @@ -1 +1,111 @@ -var _0xfde9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6D\x6F\x6D\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x65\x6D\x62\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x6C\x6F\x67\x69\x6E","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x73\x74\x61\x74\x65","\x73\x74\x61\x74\x65\x64\x65\x73\x63","\x4C\x4F\x47\x49\x4E","\x65\x6E\x74\x65\x72\x64\x61\x74\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67\x6F\x75\x74","\x65\x78\x69\x74\x64\x61\x74\x65","\x70\x61\x75\x73\x65","\x50\x41\x55\x53\x45","\x70\x61\x75\x73\x65\x64","\x72\x65\x61\x73\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];_0xfde9[0];var moment=require(_0xfde9[1]);var member=require(_0xfde9[3])[_0xfde9[2]];function Member(){console[_0xfde9[5]](_0xfde9[4])}Member[_0xfde9[7]][_0xfde9[6]]=function(_0x7ca5x4){_0x7ca5x4[_0xfde9[8]]=0;_0x7ca5x4[_0xfde9[9]]=_0xfde9[10];_0x7ca5x4[_0xfde9[11]]=moment()[_0xfde9[13]](_0xfde9[12]);findOrCreate(_0x7ca5x4)};Member[_0xfde9[7]][_0xfde9[14]]=function(_0x7ca5x4){_0x7ca5x4[_0xfde9[8]]=0;_0x7ca5x4[_0xfde9[9]]=_0xfde9[10];_0x7ca5x4[_0xfde9[15]]=moment()[_0xfde9[13]](_0xfde9[12]);findAndUpdate(_0x7ca5x4)};Member[_0xfde9[7]][_0xfde9[16]]=function(_0x7ca5x4){_0x7ca5x4[_0xfde9[8]]=1;_0x7ca5x4[_0xfde9[9]]=_0xfde9[17];var _0x7ca5x5=parseInt(_0x7ca5x4[_0xfde9[18]],10);if(_0x7ca5x5){_0x7ca5x4[_0xfde9[11]]=moment()[_0xfde9[13]](_0xfde9[12]);findOrCreate(_0x7ca5x4)}else {if(_0x7ca5x4[_0xfde9[19]]){delete _0x7ca5x4[_0xfde9[19]]};_0x7ca5x4[_0xfde9[15]]=moment()[_0xfde9[13]](_0xfde9[12]);findAndUpdate(_0x7ca5x4)}};function findOrCreate(_0x7ca5x4){}function findAndUpdate(_0x7ca5x4){}module[_0xfde9[20]]=Member \ No newline at end of file +'use strict'; + +var moment = require('moment'); + +var member = require('../../models').ReportMember; + +function Member() { + console.log('Member Initialization...'); + + +} + +Member.prototype.login = function (evt) { + evt.state = 0; + evt.statedesc = 'LOGIN'; + + evt.enterdate = moment().format("YYYY-MM-DD HH:mm:ss"); + + findOrCreate(evt); +} + +Member.prototype.logout = function (evt) { + evt.state = 0; + evt.statedesc = 'LOGIN'; + + evt.exitdate = moment().format("YYYY-MM-DD HH:mm:ss"); + findAndUpdate(evt); +} + +Member.prototype.pause = function (evt) { + evt.state = 1; + evt.statedesc = 'PAUSE'; + + var paused = parseInt(evt.paused, 10); + if (paused) { + evt.enterdate = moment().format("YYYY-MM-DD HH:mm:ss"); + findOrCreate(evt); + } else { + if (evt.reason) { + delete evt.reason; + } + + evt.exitdate = moment().format("YYYY-MM-DD HH:mm:ss"); + findAndUpdate(evt); + } +} + +function findOrCreate(evt) { + // member. + // findOne({ + // where: { + // queue: evt.queue, + // membername: evt.membername, + // state: evt.state, + // } + // }); + + // member + // .findOrCreate({ + // where: { + // queue: evt.queue, + // membername: evt.membername, + // state: evt.state, + // enterdate: { + // $ne: null + // }, + // exitdate: null + // }, + // defaults: evt + // }) + // .spread(function(mem, created) { + // if (created) { + // console.log('[member] member created'); + // } else { + // console.log('[member] member exist'); + // mem + // .updateAttributes({ + // exitdate: moment().format("YYYY-MM-DD HH:mm:ss") + // }) + // .then(function(res) { + // console.log('[member] member updated'); + // findOrCreate(evt); + // }); + // } + // }); +} + +function findAndUpdate(evt) { + // var member = require('../../models').ReportMember; + // member + // .update(evt, { + // where: { + // queue: evt.queue, + // membername: evt.membername, + // state: evt.state, + // enterdate: { + // $ne: null + // }, + // exitdate: null, + // reason: null + // } + // }) + // .then(function(member) { + // console.log('[member] member updated'); + // }) + // .catch(function(err) { + // console.error('[member] member error: ' + err); + // }); +} + +module.exports = Member; diff --git a/server/config/ami/queue_caller.js b/server/config/ami/queue_caller.js index dc2e90d..d5ebc2a 100644 --- a/server/config/ami/queue_caller.js +++ b/server/config/ami/queue_caller.js @@ -1 +1,69 @@ -var _0x7b73=["\x6D\x6F\x6D\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x51\x75\x65\x75\x65\x43\x61\x6C\x6C\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x6A\x6F\x69\x6E","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6A\x6F\x69\x6E\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x6C\x65\x61\x76\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6C\x65\x61\x76\x65\x41\x74","\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E\x41\x74","\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x63\x6F\x6D\x70\x6C\x65\x74\x65\x41\x74","\x65\x78\x69\x74","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x65\x78\x69\x74","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x65\x78\x69\x74\x41\x74","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x65\x78\x69\x74\x72\x65\x61\x73\x6F\x6E","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x76\x61\x6C\x75\x65","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x71\x75\x65\x75\x65\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x72\x65\x70\x6F\x72\x74\x5D\x20\x71\x75\x65\x75\x65\x20\x63\x72\x65\x61\x74\x65\x64","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65","\x5B\x71\x75\x65\x75\x65\x5F\x63\x61\x6C\x6C\x65\x72\x5D\x20\x71\x75\x65\x75\x65\x5F\x63\x61\x6C\x6C\x65\x72\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x71\x75\x65\x75\x65\x5F\x63\x61\x6C\x6C\x65\x72\x5D\x20\x71\x75\x65\x75\x65\x5F\x63\x61\x6C\x6C\x65\x72\x20\x75\x70\x64\x61\x74\x65\x64","\x69\x6E\x66\x6F","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0x7b73[0]);var ReportQueue=require(_0x7b73[2])[_0x7b73[1]];function QueueCaller(){console[_0x7b73[4]](_0x7b73[3])}QueueCaller[_0x7b73[6]][_0x7b73[5]]=function(_0x8033x4){_0x8033x4[_0x7b73[7]]=moment()[_0x7b73[9]](_0x7b73[8]);return create(_0x8033x4)};QueueCaller[_0x7b73[6]][_0x7b73[10]]=function(_0x8033x4){_0x8033x4[_0x7b73[11]]=moment()[_0x7b73[9]](_0x7b73[8]);return findAndUpdate(_0x8033x4)};QueueCaller[_0x7b73[6]][_0x7b73[12]]=function(_0x8033x4){_0x8033x4[_0x7b73[13]]=true;_0x8033x4[_0x7b73[14]]=moment()[_0x7b73[9]](_0x7b73[8]);return findAndUpdate(_0x8033x4)};QueueCaller[_0x7b73[6]][_0x7b73[15]]=function(_0x8033x4){_0x8033x4[_0x7b73[16]]=true;_0x8033x4[_0x7b73[17]]=moment()[_0x7b73[9]](_0x7b73[8]);return findAndUpdate(_0x8033x4)};QueueCaller[_0x7b73[6]][_0x7b73[18]]=function(_0x8033x4){_0x8033x4[_0x7b73[13]]=false;_0x8033x4[_0x7b73[14]]=null;_0x8033x4[_0x7b73[19]]=true;_0x8033x4[_0x7b73[20]]=moment()[_0x7b73[9]](_0x7b73[8]);_0x8033x4[_0x7b73[21]]=_0x8033x4[_0x7b73[23]][_0x7b73[22]]();return findAndUpdate(_0x8033x4)};function create(_0x8033x4){return ReportQueue[_0x7b73[29]](_0x8033x4)[_0x7b73[28]](function(_0x8033x7){console[_0x7b73[4]](_0x7b73[27])})[_0x7b73[26]](function(_0x8033x6){console[_0x7b73[25]](_0x7b73[24]+_0x8033x6)})}function findAndUpdate(_0x8033x4){return ReportQueue[_0x7b73[34]](_0x8033x4,{where:{uniqueid:_0x8033x4[_0x7b73[33]]},individualHooks:true})[_0x7b73[28]](function(_0x8033x7){console[_0x7b73[32]](_0x7b73[31])})[_0x7b73[26]](function(_0x8033x6){console[_0x7b73[25]](_0x7b73[30]+_0x8033x6)})}module[_0x7b73[35]]=QueueCaller \ No newline at end of file +var moment = require('moment'); + +var ReportQueue = require('../../models').ReportQueue; + +function QueueCaller() { + console.log('QueueCaller Initialization...'); +} + +QueueCaller.prototype.join = function(evt) { + evt.queuecallerjoinAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return create(evt); +} + +QueueCaller.prototype.leave = function(evt) { + evt.queuecallerleaveAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return findAndUpdate(evt); +} + +QueueCaller.prototype.abandon = function(evt) { + evt.queuecallerabandon = true; + evt.queuecallerabandonAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return findAndUpdate(evt); +} + +QueueCaller.prototype.complete = function(evt) { + evt.queuecallercomplete = true; + evt.queuecallercompleteAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return findAndUpdate(evt); +} + +QueueCaller.prototype.exit = function(evt) { + evt.queuecallerabandon = false; + evt.queuecallerabandonAt = null; + + evt.queuecallerexit = true; + evt.queuecallerexitAt = moment().format("YYYY-MM-DD HH:mm:ss"); + evt.queuecallerexitreason = evt.value.toLowerCase(); + + return findAndUpdate(evt); +} + +function create(evt) { + return ReportQueue + .create(evt) + .then(function(queue) { + console.log('[report] queue created'); + }) + .catch(function(err) { + console.error('[report] queue ' + err); + }); +} + +function findAndUpdate(evt) { + return ReportQueue + .update(evt, { + where: { + uniqueid: evt.uniqueid + }, + individualHooks: true + }) + .then(function(queue) { + console.info('[queue_caller] queue_caller updated'); + }) + .catch(function(err) { + console.error('[queue_caller] queue_caller error: ' + err); + }); +} + +module.exports = QueueCaller; diff --git a/server/config/ami/queue_member.js b/server/config/ami/queue_member.js index f4ac262..f7417d4 100644 --- a/server/config/ami/queue_member.js +++ b/server/config/ami/queue_member.js @@ -1 +1,54 @@ -var _0x2291=["\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x51\x75\x65\x75\x65\x4D\x65\x6D\x62\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x64\x64\x65\x64","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x6C\x6F\x67\x67\x65\x64","\x6C\x6F\x67\x67\x65\x64\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x70\x61\x75\x73\x65","\x70\x61\x75\x73\x65\x64\x41\x74","\x70\x61\x75\x73\x65\x64","\x70\x65\x6E\x61\x6C\x74\x79","\x72\x65\x6D\x6F\x76\x65\x64","\x72\x69\x6E\x67\x69\x6E\x75\x73\x65","\x73\x74\x61\x74\x75\x73","\x5B\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x5D\x20\x75\x70\x64\x61\x74\x65\x20\x6D\x65\x6D\x62\x65\x72\x20\x65\x72\x72\x6F\x72\x3A\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x5D\x20\x75\x70\x64\x61\x74\x65\x20\x6D\x65\x6D\x62\x65\x72","\x74\x68\x65\x6E","\x71\x75\x65\x75\x65","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x75\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0x2291[0]);var UserHasVoiceQueue=require(_0x2291[2])[_0x2291[1]];function QueueMember(){console[_0x2291[4]](_0x2291[3])}QueueMember[_0x2291[6]][_0x2291[5]]=function(_0x3cc6x4){_0x3cc6x4[_0x2291[7]]=true;_0x3cc6x4[_0x2291[8]]=moment()[_0x2291[10]](_0x2291[9]);return findAndUpdate(_0x3cc6x4)};QueueMember[_0x2291[6]][_0x2291[11]]=function(_0x3cc6x4){_0x3cc6x4[_0x2291[12]]=(parseInt(_0x3cc6x4[_0x2291[13]],10))?moment()[_0x2291[10]](_0x2291[9]):null;return findAndUpdate(_0x3cc6x4)};QueueMember[_0x2291[6]][_0x2291[14]]=function(_0x3cc6x4){return findAndUpdate(_0x3cc6x4)};QueueMember[_0x2291[6]][_0x2291[15]]=function(_0x3cc6x4){_0x3cc6x4[_0x2291[7]]=false;_0x3cc6x4[_0x2291[8]]=null;return findAndUpdate(_0x3cc6x4)};QueueMember[_0x2291[6]][_0x2291[16]]=function(_0x3cc6x4){return findAndUpdate(_0x3cc6x4)};QueueMember[_0x2291[6]][_0x2291[17]]=function(_0x3cc6x4){return findAndUpdate(_0x3cc6x4)};function findAndUpdate(_0x3cc6x4,_0x3cc6x6){return UserHasVoiceQueue[_0x2291[25]](_0x3cc6x4,{where:{queue:_0x3cc6x4[_0x2291[23]],membername:_0x3cc6x4[_0x2291[24]]},individualHooks:true})[_0x2291[22]](function(_0x3cc6x8){console[_0x2291[4]](_0x2291[21])})[_0x2291[20]](function(_0x3cc6x7){console[_0x2291[19]](_0x2291[18]+_0x3cc6x7)})}module[_0x2291[26]]=QueueMember \ No newline at end of file +var moment = require('moment'); +var UserHasVoiceQueue = require('../../models').UserHasVoiceQueue; + +function QueueMember() { + console.log('QueueMember Initialization...'); +} + +QueueMember.prototype.added = function(evt) { + evt.logged = true; + evt.loggedAt = moment().format("YYYY-MM-DD HH:mm:ss"); + return findAndUpdate(evt); +} + +QueueMember.prototype.pause = function(evt) { + evt.pausedAt = (parseInt(evt.paused, 10)) ? moment().format("YYYY-MM-DD HH:mm:ss") : null; + return findAndUpdate(evt); +} + +QueueMember.prototype.penalty = function(evt) { + return findAndUpdate(evt); +} + +QueueMember.prototype.removed = function(evt) { + evt.logged = false; + evt.loggedAt = null; + return findAndUpdate(evt); +} + +QueueMember.prototype.ringinuse = function(evt) { + return findAndUpdate(evt); +} + +QueueMember.prototype.status = function(evt) { + return findAndUpdate(evt); +} + +function findAndUpdate(evt, options) { + return UserHasVoiceQueue + .update(evt, { + where: { + queue: evt.queue, + membername: evt.membername + }, + individualHooks: true + }) + .then(function(member) { + console.log('[queuemember] update member'); + }) + .catch(function(err) { + console.error('[queuemember] update member error: ' + err); + }); +} + +module.exports = QueueMember; diff --git a/server/config/ami/recording.js b/server/config/ami/recording.js index 98c9e87..1d22902 100644 --- a/server/config/ami/recording.js +++ b/server/config/ami/recording.js @@ -1 +1,22 @@ -var _0x99ef=["\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x63\x72\x65\x61\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x74\x79\x70\x65","\x72\x63\x6F\x72\x64\x69\x6E\x67\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x65\x78\x70\x6F\x72\x74\x73"];var VoiceRecording=require(_0x99ef[1])[_0x99ef[0]];function Recording(){console[_0x99ef[3]](_0x99ef[2])}Recording[_0x99ef[5]][_0x99ef[4]]=function(_0x2ee6x3,_0x2ee6x4){create(_0x2ee6x3,_0x2ee6x4)};function create(_0x2ee6x3,_0x2ee6x4){_0x2ee6x3[_0x99ef[6]]=_0x2ee6x4;return VoiceRecording[_0x99ef[4]](_0x2ee6x3)[_0x99ef[10]](function(){})[_0x99ef[9]](function(_0x2ee6x6){console[_0x99ef[8]](_0x99ef[7]+_0x2ee6x6)})}module[_0x99ef[11]]=Recording \ No newline at end of file +var VoiceRecording = require('../../models').VoiceRecording; + +function Recording() { + console.log('Recording Initialization...'); +} + +Recording.prototype.create = function(evt, type) { + create(evt, type); +} + +function create(evt, type) { + evt.type = type; + + return VoiceRecording + .create(evt) + .then(function() {}) + .catch(function(err) { + console.error('rcording ' + err); + }); +} + +module.exports = Recording; diff --git a/server/config/ami/socket.js b/server/config/ami/socket.js index 3d755a1..0a82a2b 100644 --- a/server/config/ami/socket.js +++ b/server/config/ami/socket.js @@ -1 +1,19 @@ -var _0x8b87=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4E\x65\x77\x20\x73\x6F\x63\x6B\x65\x74\x20\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x6C\x6F\x67","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x74\x65\x73\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x8b87[0];function Socket(_0x4e27x2,_0x4e27x3){console[_0x8b87[2]](_0x8b87[1]);var _0x4e27x4=require(_0x8b87[4])[_0x8b87[3]];return {test:function(){console[_0x8b87[2]](_0x8b87[5])}}}module[_0x8b87[6]]=Socket \ No newline at end of file +/** + * Broadcast updates to client when the model changes + */ + +'use strict'; + +function Socket(socket, ami) { + console.log('New socket connection'); + + var ReportAgent = require('../../models').ReportAgent; + + return { + test: function () { + console.log('test'); + } + } +} + +module.exports = Socket; diff --git a/server/config/ami/transfer.js b/server/config/ami/transfer.js index 6359572..9c903b6 100644 --- a/server/config/ami/transfer.js +++ b/server/config/ami/transfer.js @@ -1 +1,43 @@ -var _0xf219=["\x6D\x6F\x6D\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x54\x72\x61\x6E\x73\x66\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x72\x61\x6E\x73\x66\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x63\x72\x65\x61\x74\x65\x42\x6C\x69\x6E\x64","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x5B\x74\x72\x61\x6E\x66\x65\x72\x5D\x20\x63\x72\x65\x61\x74\x65\x64\x20\x65\x72\x72\x6F\x72\x3A\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x74\x72\x61\x6E\x66\x65\x72\x5D\x20\x63\x72\x65\x61\x74\x65\x64","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x41\x74\x74\x65\x6E\x64\x65\x64","\x61\x74\x74\x65\x6E\x64\x65\x64","\x6F\x72\x69\x67\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x6F\x72\x69\x67\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x61\x6D\x65","\x6F\x72\x69\x67\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x6F\x6E\x74\x65\x78\x74","\x6F\x72\x69\x67\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x65\x78\x74\x65\x6E","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x63\x6F\x6E\x74\x65\x78\x74","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x65\x78\x74\x65\x6E","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x75\x6E\x69\x71\x75\x65\x69\x64","\x73\x65\x63\x6F\x6E\x64\x74\x72\x61\x6E\x73\x66\x65\x72\x65\x72\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0xf219[0]);var ReportTransfer=require(_0xf219[2])[_0xf219[1]];function Transfer(){console[_0xf219[4]](_0xf219[3])}Transfer[_0xf219[6]][_0xf219[5]]=function(_0x1de6x4){return ReportTransfer[_0xf219[12]](_0x1de6x4)[_0xf219[11]](function(_0x1de6x6){console[_0xf219[4]](_0xf219[10])})[_0xf219[9]](function(_0x1de6x5){console[_0xf219[8]](_0xf219[7]+_0x1de6x5)})};Transfer[_0xf219[6]][_0xf219[13]]=function(_0x1de6x4){return ReportTransfer[_0xf219[12]]({type:_0xf219[14],transferercalleridnum:_0x1de6x4[_0xf219[15]],transferercalleridname:_0x1de6x4[_0xf219[16]],transfererconnectedlinenum:_0x1de6x4[_0xf219[17]],transfererconnectedlinename:_0x1de6x4[_0xf219[18]],transferercontext:_0x1de6x4[_0xf219[19]],transfererexten:_0x1de6x4[_0xf219[20]],transfereecontext:_0x1de6x4[_0xf219[21]],transfereeexten:_0x1de6x4[_0xf219[22]],transfereruniqueid:_0x1de6x4[_0xf219[23]],transfererlinkedid:_0x1de6x4[_0xf219[24]],extension:_0x1de6x4[_0xf219[20]]})[_0xf219[11]](function(_0x1de6x6){console[_0xf219[4]](_0xf219[10])})[_0xf219[9]](function(_0x1de6x5){console[_0xf219[8]](_0xf219[7]+_0x1de6x5)})};module[_0xf219[25]]=Transfer \ No newline at end of file +var moment = require('moment'); +var ReportTransfer = require('../../models').ReportTransfer; + +function Transfer() { + console.log('Transfer Initialization...'); +} + +Transfer.prototype.createBlind = function(evt) { + return ReportTransfer + .create(evt) + .then(function(member) { + console.log('[tranfer] created'); + }) + .catch(function(err) { + console.error('[tranfer] created error: ' + err); + }); +} + +Transfer.prototype.createAttended = function(evt) { + return ReportTransfer + .create({ + type: 'attended', + transferercalleridnum: evt.origtransferercalleridnum, + transferercalleridname: evt.origtransferercalleridname, + transfererconnectedlinenum: evt.secondtransfererconnectedlinenum, + transfererconnectedlinename: evt.secondtransfererconnectedlinename, + transferercontext: evt.origtransferercontext, + transfererexten: evt.origtransfererexten, + transfereecontext: evt.secondtransferercontext, + transfereeexten: evt.secondtransfererexten, + transfereruniqueid: evt.secondtransfereruniqueid, + transfererlinkedid: evt.secondtransfererlinkedid, + extension: evt.origtransfererexten, + }) + .then(function(member) { + console.log('[tranfer] created'); + }) + .catch(function(err) { + console.error('[tranfer] created error: ' + err); + }); +} + +module.exports = Transfer; diff --git a/server/config/ami/trunk.js b/server/config/ami/trunk.js index 053c88c..638620f 100644 --- a/server/config/ami/trunk.js +++ b/server/config/ami/trunk.js @@ -1 +1,124 @@ -var _0x6da6=["\x54\x72\x75\x6E\x6B","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x72\x75\x6E\x6B\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","","\x72\x65\x67\x69\x73\x74\x65\x72\x20\x3D\x3E\x20\x25\x73\x0A","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x63\x6C\x6F\x6E\x65","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x5B\x25\x73\x5D\x0A","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x6F\x74\x68\x65\x72\x46\x69\x65\x6C\x64\x73","\x25\x73\x0A","\x3B","\x73\x70\x6C\x69\x74","\x25\x73\x3D\x25\x73\x0A","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C\x6F\x77","\x72\x65\x67\x69\x73\x74\x72\x79","\x63\x61\x74\x63\x68","\x6D\x61\x70","\x61\x73\x74\x65\x72\x69\x73\x6B\x43\x6F\x6E\x66","\x73\x69\x70\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x74\x72\x75\x6E\x6B\x73\x2E\x63\x6F\x6E\x66","\x6A\x6F\x69\x6E","\x77","\x30\x37\x37\x37","\x54\x72\x75\x6E\x6B\x73\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x73\x69\x70\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x72\x65\x67\x69\x73\x74\x65\x72\x73\x2E\x63\x6F\x6E\x66","\x54\x72\x75\x6E\x6B\x73\x20\x72\x65\x67\x69\x73\x74\x65\x72\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x52\x65\x6C\x6F\x61\x64","\x65\x72\x72\x6F\x72","\x61\x63\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73"];var TrunkModel=require(_0x6da6[1])[_0x6da6[0]];var fs=require(_0x6da6[2]);var util=require(_0x6da6[3]);var path=require(_0x6da6[4]);var config=require(_0x6da6[5]);var _=require(_0x6da6[6]);function Trunk(_0xcd2ex8){console[_0x6da6[8]](_0x6da6[7]);TrunkModel[_0x6da6[9]](function(_0xcd2ex9){trunksRewrite(_0xcd2ex9,_0xcd2ex8,false)});TrunkModel[_0x6da6[10]](function(_0xcd2ex9){trunksRewrite(_0xcd2ex9,_0xcd2ex8,false)});TrunkModel[_0x6da6[11]](function(_0xcd2ex9){trunksRewrite(_0xcd2ex9,_0xcd2ex8,true)})}function trunksRewrite(_0xcd2ex9,_0xcd2ex8,_0xcd2exb){var _0xcd2exc=_0x6da6[12];var _0xcd2exd=_0x6da6[12];var _0xcd2exe=_0x6da6[13];if(!_0xcd2exb){var _0xcd2exf=_[_0x6da6[15]](_0xcd2ex9[_0x6da6[14]]);delete _0xcd2exf[_0x6da6[16]];delete _0xcd2exf[_0x6da6[17]];_0xcd2exc+=util[_0x6da6[20]](_0x6da6[18],_0xcd2exf[_0x6da6[19]]);if(_0xcd2exf[_0x6da6[21]]){_0xcd2exc+=util[_0x6da6[20]](_0x6da6[22],_0xcd2exf[_0x6da6[21]]);delete _0xcd2exf[_0x6da6[21]]};for(var _0xcd2ex10 in _0xcd2exf){if(_0xcd2exf[_0xcd2ex10]){switch(_0xcd2ex10){case _0x6da6[27]:var _0xcd2ex11=_0xcd2exf[_0xcd2ex10][_0x6da6[24]](_0x6da6[23]);_0xcd2ex11[_0x6da6[26]](function(_0xcd2ex12){_0xcd2exc+=util[_0x6da6[20]](_0x6da6[25],_0xcd2ex10,_0xcd2ex12)});break;default:_0xcd2exc+=util[_0x6da6[20]](_0x6da6[25],_0xcd2ex10,_0xcd2exf[_0xcd2ex10])}}};if(_0xcd2exf[_0x6da6[28]]){_0xcd2exd+=util[_0x6da6[20]](_0xcd2exe,_0xcd2exf[_0x6da6[28]])}};return TrunkModel[_0x6da6[41]]({where:{name:{$ne:_0xcd2ex9[_0x6da6[19]]}}})[_0x6da6[40]](function(_0xcd2ex14){var _0xcd2ex15=_[_0x6da6[30]](_0xcd2ex14,_0x6da6[14]);_0xcd2ex15[_0x6da6[26]](function(_0xcd2ex16){delete _0xcd2ex16[_0x6da6[16]];delete _0xcd2ex16[_0x6da6[17]];_0xcd2exc+=util[_0x6da6[20]](_0x6da6[18],_0xcd2ex16[_0x6da6[19]]);if(_0xcd2ex16[_0x6da6[21]]){_0xcd2exc+=util[_0x6da6[20]](_0x6da6[22],_0xcd2ex16[_0x6da6[21]]);delete _0xcd2ex16[_0x6da6[21]]};for(var _0xcd2ex10 in _0xcd2ex16){if(_0xcd2ex16[_0xcd2ex10]){switch(_0xcd2ex10){case _0x6da6[27]:var _0xcd2ex11=_0xcd2ex16[_0xcd2ex10][_0x6da6[24]](_0x6da6[23]);_0xcd2ex11[_0x6da6[26]](function(_0xcd2ex12){_0xcd2exc+=util[_0x6da6[20]](_0x6da6[25],_0xcd2ex10,_0xcd2ex12)});break;default:_0xcd2exc+=util[_0x6da6[20]](_0x6da6[25],_0xcd2ex10,_0xcd2ex16[_0xcd2ex10])}}};if(_0xcd2ex16[_0x6da6[28]]){_0xcd2exd+=util[_0x6da6[20]](_0xcd2exe,_0xcd2ex16[_0x6da6[28]])}});fs[_0x6da6[39]](path[_0x6da6[33]](config[_0x6da6[31]],_0x6da6[32]),_0xcd2exc,{flags:_0x6da6[34],mode:parseInt(_0x6da6[35],8)},function(_0xcd2ex13){if(_0xcd2ex13){throw _0xcd2ex13};console[_0x6da6[8]](_0x6da6[36]);fs[_0x6da6[39]](path[_0x6da6[33]](config[_0x6da6[31]],_0x6da6[37]),_0xcd2exd,{flags:_0x6da6[34],mode:parseInt(_0x6da6[35],8)},function(_0xcd2ex13){if(_0xcd2ex13){throw _0xcd2ex13};reload(_0xcd2ex8);console[_0x6da6[8]](_0x6da6[38])})})})[_0x6da6[29]](function(_0xcd2ex13){console[_0x6da6[8]](_0xcd2ex13)})}function reload(_0xcd2ex8){_0xcd2ex8[_0x6da6[44]]({Action:_0x6da6[42]},function(_0xcd2ex13,_0xcd2ex18){if(_0xcd2ex13){console[_0x6da6[43]](_0xcd2ex13)}else {console[_0x6da6[8]](_0xcd2ex18)}})}module[_0x6da6[45]]=Trunk \ No newline at end of file +var TrunkModel = require('../../models').Trunk; +var fs = require('fs'); +var util = require('util'); +var path = require('path'); +var config = require('../../config/environment'); +var _ = require('lodash'); + +function Trunk(ami) { + console.log('Trunk Initialization...'); + TrunkModel.afterCreate(function(doc) { + trunksRewrite(doc, ami, false); + }) + TrunkModel.afterUpdate(function(doc) { + trunksRewrite(doc, ami, false); + }) + TrunkModel.afterDelete(function(doc) { + trunksRewrite(doc, ami, true); + }) +} + +function trunksRewrite(doc, ami, deleteTrunk) { + var trunksFile = ''; + var trunksRegistersFile = ''; + var registryString = 'register => %s\n'; + if (!deleteTrunk) { + var newTrunk = _.clone(doc.dataValues); + delete newTrunk.createdAt; + delete newTrunk.updatedAt; + trunksFile += util.format('[%s]\n', newTrunk.name); + if (newTrunk.otherFields) { + trunksFile += util.format('%s\n', newTrunk.otherFields); + delete newTrunk.otherFields; + } + for (var key in newTrunk) { + if (newTrunk[key]) { + switch (key) { + case 'allow': + var codecs = newTrunk[key].split(';'); + codecs.forEach(function(elem) { + trunksFile += util.format('%s=%s\n', key, elem); + }) + break; + default: + trunksFile += util.format('%s=%s\n', key, newTrunk[key]); + } + } + } + if (newTrunk.registry) { + trunksRegistersFile += util.format(registryString, newTrunk.registry); + } + } + return TrunkModel + .findAll({ + where: { + name: { + $ne: doc.name + } + } + }) + .then(function(trunks) { + var oldTrunks = _.map(trunks, 'dataValues'); + oldTrunks.forEach(function(element) { + delete element.createdAt; + delete element.updatedAt; + trunksFile += util.format('[%s]\n', element.name); + if (element.otherFields) { + trunksFile += util.format('%s\n', element.otherFields); + delete element.otherFields; + } + for (var key in element) { + if (element[key]) { + switch (key) { + case 'allow': + var codecs = element[key].split(';'); + codecs.forEach(function(elem) { + trunksFile += util.format('%s=%s\n', key, elem); + }) + break; + default: + trunksFile += util.format('%s=%s\n', key, element[key]); + } + } + } + if (element.registry) { + trunksRegistersFile += util.format(registryString, element.registry); + } + }); + fs.writeFile(path.join(config.asteriskConf, 'sip_xcally_trunks.conf'), trunksFile, { + flags: 'w', + mode: parseInt('0777', 8) + }, function(err) { + if (err) throw err; + console.log("Trunks file saved!"); + fs.writeFile(path.join(config.asteriskConf, 'sip_xcally_registers.conf'), trunksRegistersFile, { + flags: 'w', + mode: parseInt('0777', 8) + }, function(err) { + if (err) throw err; + reload(ami); + console.log("Trunks register file saved!"); + }); + }); + + + }) + .catch(function(err) { + console.log(err); + }); +} + +function reload(ami) { + ami.action({ + Action: 'Reload' + }, function(err, res) { + if (err) { + console.error(err); + } else { + console.log(res); + } + }); +} + + +module.exports = Trunk; diff --git a/server/config/ami/user.js b/server/config/ami/user.js index 626958e..45d1db1 100644 --- a/server/config/ami/user.js +++ b/server/config/ami/user.js @@ -1 +1,33 @@ -var _0xd3cb=["\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x51\x75\x65\x75\x65\x4D\x65\x6D\x62\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x73\x74\x61\x74\x65\x55\x70\x64\x61\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x73\x74\x61\x74\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x53\x49\x50\x2F","","\x72\x65\x70\x6C\x61\x63\x65","\x64\x65\x76\x69\x63\x65","\x5B\x75\x73\x65\x72\x5D\x20\x73\x74\x61\x74\x75\x73\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72\x3A\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x75\x73\x65\x72\x5D\x20\x73\x74\x61\x74\x75\x73\x20\x75\x70\x64\x61\x74\x65","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0xd3cb[0]);var UserModel=require(_0xd3cb[2])[_0xd3cb[1]];function User(){console[_0xd3cb[4]](_0xd3cb[3])}User[_0xd3cb[6]][_0xd3cb[5]]=function(_0x49f0x4){var _0x49f0x5={status:_0x49f0x4[_0xd3cb[7]],statusAt:moment()[_0xd3cb[9]](_0xd3cb[8])};return findAndUpdate(_0x49f0x5,_0x49f0x4[_0xd3cb[13]][_0xd3cb[12]](_0xd3cb[10],_0xd3cb[11]))};function findAndUpdate(_0x49f0x5,_0x49f0x7){return UserModel[_0xd3cb[19]](_0x49f0x5,{where:{name:_0x49f0x7},individualHooks:true})[_0xd3cb[18]](function(_0x49f0x9){console[_0xd3cb[4]](_0xd3cb[17])})[_0xd3cb[16]](function(_0x49f0x8){console[_0xd3cb[15]](_0xd3cb[14]+_0x49f0x8)})}module[_0xd3cb[20]]=User \ No newline at end of file +var moment = require('moment'); +var UserModel = require('../../models').User; + +function User() { + console.log('QueueMember Initialization...'); +} + +User.prototype.stateUpdate = function(evt) { + var obj = { + status: evt.state, + statusAt: moment().format("YYYY-MM-DD HH:mm:ss") + } + return findAndUpdate(obj, evt.device.replace('SIP/', '')); +} + + +function findAndUpdate(obj, agentName) { + return UserModel + .update(obj, { + where: { + name: agentName + }, + individualHooks: true + }) + .then(function(member) { + console.log('[user] status update'); + }) + .catch(function(err) { + console.error('[user] status update error: ' + err); + }); +} + +module.exports = User; diff --git a/server/config/ami/voice_context.js b/server/config/ami/voice_context.js index 759307e..4b4a8ef 100644 --- a/server/config/ami/voice_context.js +++ b/server/config/ami/voice_context.js @@ -1 +1,92 @@ -var _0xd388=["\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6E\x61\x6D\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x6E\x61\x6D\x65","\x64\x65\x66\x61\x75\x6C\x74\x45\x6E\x74\x72\x79","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x64\x65\x6C\x65\x74\x65\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74","\x62\x65\x66\x6F\x72\x65\x44\x65\x6C\x65\x74\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","","\x5B\x25\x73\x5D\x0A\x73\x77\x69\x74\x63\x68\x20\x3D\x3E\x20\x52\x65\x61\x6C\x74\x69\x6D\x65\x0A","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x73\x74\x65\x72\x69\x73\x6B\x43\x6F\x6E\x66","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x63\x6F\x6E\x74\x65\x78\x74\x73\x2E\x63\x6F\x6E\x66","\x6A\x6F\x69\x6E","\x77","\x30\x37\x37\x37","\x43\x6F\x6E\x74\x65\x78\x74\x73\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x52\x65\x6C\x6F\x61\x64","\x65\x72\x72\x6F\x72","\x61\x63\x74\x69\x6F\x6E","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x68","\x6E","\x61\x6E\x79","\x48\x61\x6E\x67\x75\x70","\x68\x61\x6E\x67\x75\x70\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65\x64","\x63\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var VoiceContext=require(_0xd388[1])[_0xd388[0]];var VoiceExtension=require(_0xd388[1])[_0xd388[2]];var fs=require(_0xd388[3]);var util=require(_0xd388[4]);var path=require(_0xd388[5]);var config=require(_0xd388[6]);function Context(_0x1003x8){VoiceContext[_0xd388[12]](function(_0x1003x9){if(_0x1003x9[_0xd388[8]](_0xd388[7])){throw new Error(_0xd388[9])};if(_0x1003x9[_0xd388[10]]){throw new Error(_0xd388[11])}});VoiceContext[_0xd388[14]](function(_0x1003xa){if(_0x1003xa[_0xd388[10]]){throw new Error(_0xd388[13])}});VoiceContext[_0xd388[15]](function(_0x1003xb){rewriteContexts(_0x1003xb,_0x1003x8,false);createHangup(_0x1003xb)});VoiceContext[_0xd388[16]](function(_0x1003xb){rewriteContexts(_0x1003xb,_0x1003x8,true)})}function rewriteContexts(_0x1003xb,_0x1003x8,_0x1003xd){var _0x1003xe=_0xd388[17];if(!_0x1003xd){_0x1003xe=util[_0xd388[19]](_0xd388[18],_0x1003xb[_0xd388[7]])};VoiceContext[_0xd388[35]]({where:{id:{$ne:_0x1003xb[_0xd388[34]]}}})[_0xd388[33]](function(_0x1003x10){_0x1003x10[_0xd388[22]](function(_0x1003x11){_0x1003xe+=util[_0xd388[19]](_0xd388[18],_0x1003x11[_0xd388[7]])});fs[_0xd388[32]](path[_0xd388[25]](config[_0xd388[23]],_0xd388[24]),_0x1003xe,{flags:_0xd388[26],mode:parseInt(_0xd388[27],8)},function(_0x1003xf){if(_0x1003xf){throw _0x1003xf};console[_0xd388[20]](_0xd388[28]);_0x1003x8[_0xd388[31]]({Action:_0xd388[29]},function(_0x1003xf,_0x1003x12){if(_0x1003xf){console[_0xd388[30]](_0x1003xf)}else {console[_0xd388[20]](_0x1003x12)}})})})[_0xd388[21]](function(_0x1003xf){console[_0xd388[20]](_0x1003xf)})}function createHangup(_0x1003xb){var _0x1003x14={context:_0x1003xb[_0xd388[7]],exten:_0xd388[36],priority:_0xd388[37],VoiceContextId:_0x1003xb[_0xd388[34]],type:_0xd388[38],app:_0xd388[39]};VoiceExtension[_0xd388[41]](_0x1003x14)[_0xd388[33]](function(_0x1003x12){console[_0xd388[20]](_0xd388[40])})[_0xd388[21]](function(_0x1003xf){console[_0xd388[20]](_0x1003xf)})}module[_0xd388[42]]=Context \ No newline at end of file +var VoiceContext = require('../../models').VoiceContext; +var VoiceExtension = require('../../models').VoiceExtension; +var fs = require('fs'); +var util = require('util'); +var path = require('path'); +var config = require('../../config/environment'); + +function Context(ami) { + VoiceContext.beforeUpdate(function(updatedContext) { + if (updatedContext.changed('name')) { + throw new Error("You can't modify a context name"); + } + if (updatedContext.defaultEntry) { + throw new Error("You can't modify a default context"); + } + }); + + VoiceContext.beforeDelete(function(context) { + if (context.defaultEntry) { + throw new Error("You can't delete a default context"); + } + }); + VoiceContext.afterCreate(function(doc) { + rewriteContexts(doc, ami, false); + createHangup(doc); + }) + + VoiceContext.afterDelete(function(doc) { + rewriteContexts(doc, ami, true); + }) +} + +function rewriteContexts(doc, ami, deleteContext) { + var contextValues = ''; + if (!deleteContext) { + contextValues = util.format('[%s]\nswitch => Realtime\n', doc.name); + } + VoiceContext + .findAll({ + where: { + id: { + $ne: doc.id + } + } + }) + .then(function(contexts) { + contexts.forEach(function(element) { + contextValues += util.format('[%s]\nswitch => Realtime\n', element.name); + }); + fs.writeFile(path.join(config.asteriskConf, 'extensions_xcally_contexts.conf'), contextValues, { + flags: 'w', + mode: parseInt('0777', 8) + }, function(err) { + if (err) throw err; + console.log("Contexts file saved!"); + ami.action({ + Action: 'Reload', + }, function(err, res) { + if (err) { + console.error(err); + } else { + console.log(res); + } + }); + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function createHangup(doc) { + var data = { + context: doc.name, + exten: 'h', + priority: 'n', + VoiceContextId: doc.id, + type: 'any', + app: 'Hangup' + }; + + VoiceExtension + .create(data) + .then(function(res) { + console.log('hangup extension created'); + }) + .catch(function(err) { + console.log(err); + }); +} + +module.exports = Context; diff --git a/server/config/analytics.js b/server/config/analytics.js index 4ab5cf9..e69de29 100644 --- a/server/config/analytics.js +++ b/server/config/analytics.js @@ -1 +0,0 @@ -var _0x27ec=[] \ No newline at end of file diff --git a/server/config/autodialer/index.js b/server/config/autodialer/index.js index 6a4f7c2..a47295f 100644 --- a/server/config/autodialer/index.js +++ b/server/config/autodialer/index.js @@ -1 +1,125 @@ -var _0x14a5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x2E\x2F\x70\x72\x6F\x63\x65\x73\x73","\x65\x78\x70\x6F\x72\x74\x73","\x41\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x20\x53\x74\x61\x72\x74\x69\x6E\x67\x2E\x2E\x2E","\x6C\x6F\x67","\x67\x65\x74\x50\x72\x6F\x63\x65\x73\x73\x65\x73"];_0x14a5[0];var util=require(_0x14a5[1]);var Process=require(_0x14a5[2]);module[_0x14a5[3]]=function(_0xedcdx3){console[_0x14a5[5]](_0x14a5[4]);var _0xedcdx4= new Process();_0xedcdx4[_0x14a5[6]](function(_0xedcdx5,_0xedcdx6){if(_0xedcdx6){console[_0x14a5[5]](_0xedcdx6);return}})} \ No newline at end of file +'use strict'; +var util = require('util'); +var Process = require('./process'); + +module.exports = function(ami) { + + console.log('Autodialer Starting...'); + var proc = new Process(); + + proc.getProcesses(function(res, err) { + if(err) + { + console.log(err); + return; + } + // console.log(res.Contacts); + // if (util.isArray(res.Contacts)) + // { + // var contact = res.Contacts; + // console.log(contact); + // } + // else + // { + // var contacts = res.Contacts; + // if (contacts.length) + // { + // contacts.forEach(function(contact) { + // console.log(contact); + // }) + // } + // } + + + + }); + +} + +// var _ = require('lodash'); +// +// var agents = ['SIP/massimiliano.bungaro', 'SIP/daniele.cinti']; +// var channels = []; +// var peers = []; +// var contacts = ['600', '600', '600']; +// +// var ami; +// +// function coreshow() { +// channels = []; +// if (contacts.length > 0) { +// ami.action({ +// action: 'CoreShowChannels' +// }, function(err, res) { +// if (err) { +// console.log(err); +// } +// console.log(res); +// }); +// } +// +// } +// +// function peerstatus() { +// peers = []; +// if (contacts.length > 0) { +// ami.action({ +// action: 'SIPpeerstatus' +// }, function(err, res) { +// if (err) { +// console.log(err); +// } +// console.log(res); +// }) +// } +// } +// +// module.exports = function(asterisk_manager) { +// +// ami = asterisk_manager; +// +// peerstatus(); +// +// ami.on('peerstatus', function(evt) { +// if (evt.peerstatus == 'Reachable') { +// peers.push(evt.peer); +// } +// }); +// +// ami.on('coreshowchannel', function(evt) { +// channels.push(evt.channel.split('-')[0]); +// }); +// +// ami.on('sippeerstatuscomplete', function(evt) { +// coreshow(); +// }); +// +// ami.on('coreshowchannelscomplete', function(evt) { +// console.log('Agents registered ', peers); +// console.log('Agents in call ', channels); +// +// +// var agent = _.find(agents, function(agent) { +// return !_.includes(channels, agent); +// }); +// +// if (agent) { +// if (_.includes(peers, agent)) { +// ami.action({ +// action: 'originate', +// channel: agent, +// exten: contacts.pop(), +// context: 'demo', +// priority: 1, +// async: true +// }, function(err, res) { +// if (err) { +// console.log(err); +// } +// console.log(res); +// }); +// } +// } +// peerstatus(); +// }); +// }; diff --git a/server/config/autodialer/process.js b/server/config/autodialer/process.js index 8291f96..7974168 100644 --- a/server/config/autodialer/process.js +++ b/server/config/autodialer/process.js @@ -1 +1,26 @@ -var _0x4fea=["\x41\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x50\x72\x6F\x63\x65\x73\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74","\x50\x72\x6F\x63\x65\x73\x73\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x67\x65\x74\x50\x72\x6F\x63\x65\x73\x73\x65\x73","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x65\x78\x70\x6F\x72\x74\x73"];var AutodialerProcess=require(_0x4fea[1])[_0x4fea[0]];var Contact=require(_0x4fea[1])[_0x4fea[2]];function Process(){console[_0x4fea[4]](_0x4fea[3])}Process[_0x4fea[6]][_0x4fea[5]]=function(_0xafe0x4){AutodialerProcess[_0x4fea[9]]({where:{enable:true},include:[Contact]})[_0x4fea[8]](function(_0xafe0x6){_0xafe0x4(_0xafe0x6)})[_0x4fea[7]](function(_0xafe0x5){_0xafe0x4(null,_0xafe0x5)})};module[_0x4fea[10]]=Process \ No newline at end of file +var AutodialerProcess = require('../../models').AutodialerProcess; +var Contact = require('../../models').Contact; + +function Process() { + console.log('Process Initialization...'); +} + +Process.prototype.getProcesses = function(callback) { + + AutodialerProcess + .findAll({ + where: { + enable: true + }, + include: [Contact] + }) + .then(function(res) { + callback(res); + }) + .catch(function(err) { + callback(null, err); + }); + +} + +module.exports = Process; diff --git a/server/config/automations/fax.js b/server/config/automations/fax.js index c57ce3f..d31e0c8 100644 --- a/server/config/automations/fax.js +++ b/server/config/automations/fax.js @@ -1 +1,155 @@ -var _0xe6fa=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x65\x74\x74\x69\x6E\x67\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x66\x6F\x72\x45\x61\x63\x68","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x74\x69\x6D\x65\x6F\x75\x74","\x65\x78\x70\x6F\x72\x74\x73","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x61\x78","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x65\x72\x72\x6F\x72","\x61\x6C\x6C","\x73\x63\x6F\x70\x65"];_0xe6fa[0];var _=require(_0xe6fa[1]);var config=require(_0xe6fa[2]);var moment=require(_0xe6fa[3]);var sequelize=require(_0xe6fa[5])[_0xe6fa[4]];var Automation=require(_0xe6fa[5])[_0xe6fa[6]];var FaxRoom=require(_0xe6fa[5])[_0xe6fa[7]];var Settings=require(_0xe6fa[5])[_0xe6fa[8]];var automationTimeout;var activeAutomations={};function executeAutomation(_0x3f76xb){var _0x3f76xc={where:{$and:[],$or:[]}};var _0x3f76xd={};_0x3f76xb[_0xe6fa[14]][_0xe6fa[13]](function(_0x3f76xe){_0x3f76xc[_0xe6fa[12]][_0xe6fa[11]][_0xe6fa[10]](getCondition(_0x3f76xe[_0xe6fa[9]]))});_0x3f76xb[_0xe6fa[16]][_0xe6fa[13]](function(_0x3f76xe){_0x3f76xc[_0xe6fa[12]][_0xe6fa[15]][_0xe6fa[10]](getCondition(_0x3f76xe[_0xe6fa[9]]))});return FaxRoom[_0xe6fa[25]](_0x3f76xc)[_0xe6fa[24]](function(_0x3f76x10){_0x3f76x10[_0xe6fa[13]](function(_0x3f76x11){_0x3f76xb[_0xe6fa[23]][_0xe6fa[13]](function(_0x3f76x12){switch(_0x3f76x12[_0xe6fa[22]]){case _0xe6fa[21]:setStatus(_0x3f76x11[_0xe6fa[19]],_0x3f76x12[_0xe6fa[20]]);break;default:}})})})[_0xe6fa[18]](function(_0x3f76xf){console[_0xe6fa[17]](_0x3f76xf)})}function setStatus(_0x3f76x14,_0x3f76x15){return FaxRoom[_0xe6fa[26]]({status:_0x3f76x15},{where:{id:_0x3f76x14}})[_0xe6fa[18]](function(_0x3f76xf){console[_0xe6fa[17]](_0x3f76xf)})}function getCondition(_0x3f76xe){var _0x3f76x17={};switch(_0x3f76xe[_0xe6fa[27]]){case _0xe6fa[21]:switch(_0x3f76xe[_0xe6fa[31]]){case _0xe6fa[29]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]=_0x3f76xe[_0xe6fa[28]];break;case _0xe6fa[30]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]={$ne:_0x3f76xe[_0xe6fa[28]]};break;default:};break;case _0xe6fa[40]:var _0x3f76x18=moment()[_0xe6fa[35]](parseInt(_0x3f76xe[_0xe6fa[28]],10),_0xe6fa[34])[_0xe6fa[33]](_0xe6fa[32]);switch(_0x3f76xe[_0xe6fa[31]]){case _0xe6fa[36]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]={lt:_0x3f76x18};break;case _0xe6fa[37]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]={$lte:_0x3f76x18};break;case _0xe6fa[38]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]={$gt:_0x3f76x18};break;case _0xe6fa[39]:_0x3f76x17[_0x3f76xe[_0xe6fa[27]]]={$gte:_0x3f76x18};break;default:};break;default:};return _0x3f76x17}function createInterval(_0x3f76xb){activeAutomations[_0xe6fa[41]+_0x3f76xb[_0xe6fa[19]]]=setInterval(function(){executeAutomation(_0x3f76xb)},_0x3f76xb[_0xe6fa[42]]*1000)}module[_0xe6fa[43]]=function(){Automation[_0xe6fa[46]](function(_0x3f76x1a,_0x3f76x1b){if(_0x3f76x1a[_0xe6fa[21]]&&_0x3f76x1a[_0xe6fa[44]]===_0xe6fa[45]){createInterval(_0x3f76x1a)}});Automation[_0xe6fa[47]](function(_0x3f76x1a,_0x3f76x1b){if(activeAutomations[_0xe6fa[41]+_0x3f76x1a[_0xe6fa[19]]]){clearInterval(activeAutomations[_0xe6fa[41]+_0x3f76x1a[_0xe6fa[19]]])};if(_0x3f76x1a[_0xe6fa[21]]&&_0x3f76x1a[_0xe6fa[44]]===_0xe6fa[45]){createInterval(_0x3f76x1a)}});Automation[_0xe6fa[48]](function(_0x3f76x1a,_0x3f76x1b){if(activeAutomations[_0xe6fa[41]+_0x3f76x1a[_0xe6fa[19]]]){clearInterval(activeAutomations[_0xe6fa[41]+_0x3f76x1a[_0xe6fa[19]]])}});Automation[_0xe6fa[51]](_0xe6fa[50])[_0xe6fa[25]]({where:{status:true,channel:_0xe6fa[45]}})[_0xe6fa[24]](function(_0x3f76x1c){_0x3f76x1c[_0xe6fa[13]](function(_0x3f76xb){createInterval(_0x3f76xb)})})[_0xe6fa[18]](function(_0x3f76xf){console[_0xe6fa[49]](_0x3f76xf)})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var config = require('../environment'); +var moment = require('moment'); +// var stringifyObject = require('stringify-object'); + +var sequelize = require('../../models').sequelize; +var Automation = require('../../models').Automation; +var FaxRoom = require('../../models').FaxRoom; +var Settings = require('../../models').Settings; +var automationTimeout; +var activeAutomations = {}; + +function executeAutomation(faxAutomation) { + var query = { + where: { + $and: [], + $or: [] + } + }; + var actions = {}; + faxAutomation.All.forEach(function(condition) { + query.where.$and.push(getCondition(condition.dataValues)); + }); + faxAutomation.Any.forEach(function(condition) { + query.where.$or.push(getCondition(condition.dataValues)); + }); + + return FaxRoom + .findAll(query) + .then(function(faxes) { + faxes.forEach(function(fax) { + faxAutomation.Actions.forEach(function(action) { + switch (action.action) { + case 'status': + setStatus(fax.id, action.data1); + break; + default: + } + }); + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function setStatus(ticketId, newStatus) { + return FaxRoom.update({ + status: newStatus, + }, { + where: { + id: ticketId + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getCondition(condition) { + var result = {}; + switch (condition.field) { + case 'status': + switch (condition.operator) { + case 'equals': + result[condition.field] = condition.value; + break; + case 'not_equals': + result[condition.field] = { + $ne: condition.value + }; + break; + default: + } + break; + case 'createdAt': + var compareDate = moment().subtract(parseInt(condition.value, 10), 'hours').format("YYYY-MM-DD HH:mm:ss"); + switch (condition.operator) { + case 'greater': + result[condition.field] = { + lt: compareDate + }; + break; + case 'greater_or_equal': + result[condition.field] = { + $lte: compareDate + }; + break; + case 'less': + result[condition.field] = { + $gt: compareDate + }; + break; + case 'less_or_equal': + result[condition.field] = { + $gte: compareDate + }; + break; + default: + } + break; + default: + } + return result; +} + +function createInterval(faxAutomation) { + activeAutomations['interval' + faxAutomation.id] = setInterval(function() { + executeAutomation(faxAutomation); + }, faxAutomation.timeout * 1000); +} + +module.exports = function() { + + Automation.afterCreate(function(doc, options) { + if (doc.status && doc.channel === 'fax') { + createInterval(doc); + } + }); + + Automation.afterUpdate(function(doc, options) { + if (activeAutomations['interval' + doc.id]) { + clearInterval(activeAutomations['interval' + doc.id]); + } + if (doc.status && doc.channel === 'fax') { + createInterval(doc); + } + }); + + Automation.afterDelete(function(doc, options) { + if (activeAutomations['interval' + doc.id]) { + clearInterval(activeAutomations['interval' + doc.id]); + } + }); + + Automation + .scope('all') + .findAll({ + where: { + status: true, + channel: 'fax' + } + }) + .then(function(faxAutomations) { + + faxAutomations.forEach(function(faxAutomation) { + createInterval(faxAutomation); + }); + }) + .catch(function(err) { + console.error(err); + }); +}; diff --git a/server/config/automations/mail.js b/server/config/automations/mail.js index 8038600..dfd4a14 100644 --- a/server/config/automations/mail.js +++ b/server/config/automations/mail.js @@ -1 +1,154 @@ -var _0x3256=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x53\x65\x74\x74\x69\x6E\x67\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x66\x6F\x72\x45\x61\x63\x68","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x74\x69\x6D\x65\x6F\x75\x74","\x65\x78\x70\x6F\x72\x74\x73","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x65\x72\x72\x6F\x72","\x61\x6C\x6C","\x73\x63\x6F\x70\x65"];_0x3256[0];var _=require(_0x3256[1]);var config=require(_0x3256[2]);var moment=require(_0x3256[3]);var sequelize=require(_0x3256[5])[_0x3256[4]];var Automation=require(_0x3256[5])[_0x3256[6]];var MailRoom=require(_0x3256[5])[_0x3256[7]];var Settings=require(_0x3256[5])[_0x3256[8]];var activeAutomations={};function executeAutomation(_0x1eecxa){var _0x1eecxb={where:{$and:[],$or:[]}};var _0x1eecxc={};_0x1eecxa[_0x3256[14]][_0x3256[13]](function(_0x1eecxd){_0x1eecxb[_0x3256[12]][_0x3256[11]][_0x3256[10]](getCondition(_0x1eecxd[_0x3256[9]]))});_0x1eecxa[_0x3256[16]][_0x3256[13]](function(_0x1eecxd){_0x1eecxb[_0x3256[12]][_0x3256[15]][_0x3256[10]](getCondition(_0x1eecxd[_0x3256[9]]))});return MailRoom[_0x3256[25]](_0x1eecxb)[_0x3256[24]](function(_0x1eecxf){_0x1eecxf[_0x3256[13]](function(_0x1eecx10){_0x1eecxa[_0x3256[23]][_0x3256[13]](function(_0x1eecx11){switch(_0x1eecx11[_0x3256[22]]){case _0x3256[21]:setStatus(_0x1eecx10[_0x3256[19]],_0x1eecx11[_0x3256[20]]);break;default:}})})})[_0x3256[18]](function(_0x1eecxe){console[_0x3256[17]](_0x1eecxe)})}function setStatus(_0x1eecx13,_0x1eecx14){return MailRoom[_0x3256[26]]({status:_0x1eecx14},{where:{id:_0x1eecx13}})[_0x3256[18]](function(_0x1eecxe){console[_0x3256[17]](_0x1eecxe)})}function getCondition(_0x1eecxd){var _0x1eecx16={};switch(_0x1eecxd[_0x3256[27]]){case _0x3256[21]:switch(_0x1eecxd[_0x3256[31]]){case _0x3256[29]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]=_0x1eecxd[_0x3256[28]];break;case _0x3256[30]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]={$ne:_0x1eecxd[_0x3256[28]]};break;default:};break;case _0x3256[40]:var _0x1eecx17=moment()[_0x3256[35]](parseInt(_0x1eecxd[_0x3256[28]],10),_0x3256[34])[_0x3256[33]](_0x3256[32]);switch(_0x1eecxd[_0x3256[31]]){case _0x3256[36]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]={lt:_0x1eecx17};break;case _0x3256[37]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]={$lte:_0x1eecx17};break;case _0x3256[38]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]={$gt:_0x1eecx17};break;case _0x3256[39]:_0x1eecx16[_0x1eecxd[_0x3256[27]]]={$gte:_0x1eecx17};break;default:};break;default:};return _0x1eecx16}function createInterval(_0x1eecxa){activeAutomations[_0x3256[41]+_0x1eecxa[_0x3256[19]]]=setInterval(function(){executeAutomation(_0x1eecxa)},_0x1eecxa[_0x3256[42]]*1000)}module[_0x3256[43]]=function(){Automation[_0x3256[46]](function(_0x1eecx19,_0x1eecx1a){if(_0x1eecx19[_0x3256[21]]&&_0x1eecx19[_0x3256[44]]===_0x3256[45]){createInterval(_0x1eecx19)}});Automation[_0x3256[47]](function(_0x1eecx19,_0x1eecx1a){if(activeAutomations[_0x3256[41]+_0x1eecx19[_0x3256[19]]]){clearInterval(activeAutomations[_0x3256[41]+_0x1eecx19[_0x3256[19]]])};if(_0x1eecx19[_0x3256[21]]&&_0x1eecx19[_0x3256[44]]===_0x3256[45]){createInterval(_0x1eecx19)}});Automation[_0x3256[48]](function(_0x1eecx19,_0x1eecx1a){if(activeAutomations[_0x3256[41]+_0x1eecx19[_0x3256[19]]]){clearInterval(activeAutomations[_0x3256[41]+_0x1eecx19[_0x3256[19]]])}});Automation[_0x3256[51]](_0x3256[50])[_0x3256[25]]({where:{status:true,channel:_0x3256[45]}})[_0x3256[24]](function(_0x1eecx1b){_0x1eecx1b[_0x3256[13]](function(_0x1eecxa){createInterval(_0x1eecxa)})})[_0x3256[18]](function(_0x1eecxe){console[_0x3256[49]](_0x1eecxe)})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var config = require('../environment'); +var moment = require('moment'); +// var stringifyObject = require('stringify-object'); + +var sequelize = require('../../models').sequelize; +var Automation = require('../../models').Automation; +var MailRoom = require('../../models').MailRoom; +var Settings = require('../../models').Settings; +var activeAutomations = {}; + +function executeAutomation(mailAutomation) { + var query = { + where: { + $and: [], + $or: [] + } + }; + var actions = {}; + mailAutomation.All.forEach(function(condition) { + query.where.$and.push(getCondition(condition.dataValues)); + }); + mailAutomation.Any.forEach(function(condition) { + query.where.$or.push(getCondition(condition.dataValues)); + }); + + return MailRoom + .findAll(query) + .then(function(mails) { + mails.forEach(function(mail) { + mailAutomation.Actions.forEach(function(action) { + switch (action.action) { + case 'status': + setStatus(mail.id, action.data1); + break; + default: + } + }); + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function setStatus(ticketId, newStatus) { + return MailRoom.update({ + status: newStatus, + }, { + where: { + id: ticketId + } + }) + .catch(function(err) { + console.log(err); + }); +} + +function getCondition(condition) { + var result = {}; + switch (condition.field) { + case 'status': + switch (condition.operator) { + case 'equals': + result[condition.field] = condition.value; + break; + case 'not_equals': + result[condition.field] = { + $ne: condition.value + }; + break; + default: + } + break; + case 'createdAt': + var compareDate = moment().subtract(parseInt(condition.value, 10), 'hours').format("YYYY-MM-DD HH:mm:ss"); + switch (condition.operator) { + case 'greater': + result[condition.field] = { + lt: compareDate + }; + break; + case 'greater_or_equal': + result[condition.field] = { + $lte: compareDate + }; + break; + case 'less': + result[condition.field] = { + $gt: compareDate + }; + break; + case 'less_or_equal': + result[condition.field] = { + $gte: compareDate + }; + break; + default: + } + break; + default: + } + return result; +} + +function createInterval(mailAutomation) { + activeAutomations['interval' + mailAutomation.id] = setInterval(function() { + executeAutomation(mailAutomation); + }, mailAutomation.timeout * 1000); +} + +module.exports = function() { + + Automation.afterCreate(function(doc, options) { + if (doc.status && doc.channel === 'mail') { + createInterval(doc); + } + }); + + Automation.afterUpdate(function(doc, options) { + if (activeAutomations['interval' + doc.id]) { + clearInterval(activeAutomations['interval' + doc.id]); + } + if (doc.status && doc.channel === 'mail') { + createInterval(doc); + } + }); + + Automation.afterDelete(function(doc, options) { + if (activeAutomations['interval' + doc.id]) { + clearInterval(activeAutomations['interval' + doc.id]); + } + }); + + Automation + .scope('all') + .findAll({ + where: { + status: true, + channel: 'mail' + } + }) + .then(function(mailAutomations) { + + mailAutomations.forEach(function(mailAutomation) { + createInterval(mailAutomation); + }); + }) + .catch(function(err) { + console.error(err); + }); +}; diff --git a/server/config/express.js b/server/config/express.js index a0a463c..1b2d7a3 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -1 +1,74 @@ -var _0x429b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x73\x65\x72\x76\x65\x2D\x66\x61\x76\x69\x63\x6F\x6E","\x6D\x6F\x72\x67\x61\x6E","\x63\x6F\x6D\x70\x72\x65\x73\x73\x69\x6F\x6E","\x62\x6F\x64\x79\x2D\x70\x61\x72\x73\x65\x72","\x65\x78\x70\x72\x65\x73\x73\x2D\x71\x75\x65\x72\x79\x2D\x69\x6E\x74","\x6D\x65\x74\x68\x6F\x64\x2D\x6F\x76\x65\x72\x72\x69\x64\x65","\x63\x6F\x6F\x6B\x69\x65\x2D\x70\x61\x72\x73\x65\x72","\x65\x72\x72\x6F\x72\x68\x61\x6E\x64\x6C\x65\x72","\x70\x61\x74\x68","\x70\x61\x73\x73\x70\x6F\x72\x74","\x65\x78\x70\x72\x65\x73\x73\x2D\x73\x65\x73\x73\x69\x6F\x6E","\x63\x6F\x6E\x6E\x65\x63\x74\x2D\x66\x6C\x61\x73\x68","\x65\x78\x70\x72\x65\x73\x73\x2D\x6D\x79\x73\x71\x6C\x2D\x73\x65\x73\x73\x69\x6F\x6E","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x65\x6E\x76","\x67\x65\x74","\x76\x69\x65\x77\x73","\x72\x6F\x6F\x74","\x2F\x73\x65\x72\x76\x65\x72\x2F\x76\x69\x65\x77\x73","\x73\x65\x74","\x68\x74\x6D\x6C","\x72\x65\x6E\x64\x65\x72\x46\x69\x6C\x65","\x65\x6A\x73","\x65\x6E\x67\x69\x6E\x65","\x76\x69\x65\x77\x20\x65\x6E\x67\x69\x6E\x65","\x75\x73\x65","\x75\x72\x6C\x65\x6E\x63\x6F\x64\x65\x64","\x6A\x73\x6F\x6E","\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65","\x73\x65\x63\x72\x65\x74","\x73\x65\x73\x73\x69\x6F\x6E","\x68\x6F\x73\x74","\x64\x62","\x70\x6F\x72\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x64\x61\x74\x61\x62\x61\x73\x65","\x63\x6F\x6F\x6B\x69\x65","\x6E\x61\x6D\x65","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E","\x70\x75\x62\x6C\x69\x63","\x66\x61\x76\x69\x63\x6F\x6E\x2E\x69\x63\x6F","\x6A\x6F\x69\x6E","\x73\x74\x61\x74\x69\x63","\x61\x70\x70\x50\x61\x74\x68","\x2F\x70\x75\x62\x6C\x69\x63","\x64\x65\x76","\x64\x65\x76\x65\x6C\x6F\x70\x6D\x65\x6E\x74","\x74\x65\x73\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x2D\x6C\x69\x76\x65\x72\x65\x6C\x6F\x61\x64","\x2E\x74\x6D\x70","\x63\x6C\x69\x65\x6E\x74"];_0x429b[0];var express=require(_0x429b[1]);var favicon=require(_0x429b[2]);var morgan=require(_0x429b[3]);var compression=require(_0x429b[4]);var bodyParser=require(_0x429b[5]);var queryParser=require(_0x429b[6]);var methodOverride=require(_0x429b[7]);var cookieParser=require(_0x429b[8]);var errorHandler=require(_0x429b[9]);var path=require(_0x429b[10]);var passport=require(_0x429b[11]);var session=require(_0x429b[12]);var flash=require(_0x429b[13]);var SessionStore=require(_0x429b[14]);var session=require(_0x429b[12]);var config=require(_0x429b[15]);module[_0x429b[16]]=function(_0xd20dx10){var _0xd20dx11=_0xd20dx10[_0x429b[18]](_0x429b[17]);_0xd20dx10[_0x429b[22]](_0x429b[19],config[_0x429b[20]]+_0x429b[21]);_0xd20dx10[_0x429b[26]](_0x429b[23],require(_0x429b[25])[_0x429b[24]]);_0xd20dx10[_0x429b[22]](_0x429b[27],_0x429b[23]);_0xd20dx10[_0x429b[28]](compression());_0xd20dx10[_0x429b[28]](bodyParser[_0x429b[29]]({extended:false}));_0xd20dx10[_0x429b[28]](bodyParser[_0x429b[30]]());_0xd20dx10[_0x429b[28]](methodOverride());_0xd20dx10[_0x429b[28]](cookieParser());_0xd20dx10[_0x429b[28]](passport[_0x429b[31]]());_0xd20dx10[_0x429b[28]](session({secret:config[_0x429b[33]][_0x429b[32]],store: new SessionStore({host:config[_0x429b[35]][_0x429b[34]],port:config[_0x429b[35]][_0x429b[36]],user:config[_0x429b[35]][_0x429b[37]],password:config[_0x429b[35]][_0x429b[38]],database:config[_0x429b[35]][_0x429b[39]]}),cookie:config[_0x429b[33]][_0x429b[40]],name:config[_0x429b[33]][_0x429b[41]],resave:true,saveUninitialized:true}));if(_0x429b[42]===_0xd20dx11){_0xd20dx10[_0x429b[28]](favicon(path[_0x429b[45]](config[_0x429b[20]],_0x429b[43],_0x429b[44])));_0xd20dx10[_0x429b[28]](express[_0x429b[46]](path[_0x429b[45]](config[_0x429b[20]],_0x429b[43])));_0xd20dx10[_0x429b[22]](_0x429b[47],config[_0x429b[20]]+_0x429b[48]);_0xd20dx10[_0x429b[28]](morgan(_0x429b[49]))};if(_0x429b[50]===_0xd20dx11||_0x429b[51]===_0xd20dx11){_0xd20dx10[_0x429b[28]](require(_0x429b[52])());_0xd20dx10[_0x429b[28]](express[_0x429b[46]](path[_0x429b[45]](config[_0x429b[20]],_0x429b[53])));_0xd20dx10[_0x429b[28]](express[_0x429b[46]](path[_0x429b[45]](config[_0x429b[20]],_0x429b[54])));_0xd20dx10[_0x429b[22]](_0x429b[47],_0x429b[54]);_0xd20dx10[_0x429b[28]](morgan(_0x429b[49]));_0xd20dx10[_0x429b[28]](errorHandler())};_0xd20dx10[_0x429b[28]](flash())} \ No newline at end of file +/** + * Express configuration + */ + +'use strict'; + +var express = require('express'); +var favicon = require('serve-favicon'); +var morgan = require('morgan'); +var compression = require('compression'); +var bodyParser = require('body-parser'); +var queryParser = require('express-query-int'); +var methodOverride = require('method-override'); +var cookieParser = require('cookie-parser'); +var errorHandler = require('errorhandler'); +var path = require('path'); +var passport = require('passport'); +var session = require('express-session'); +var flash = require('connect-flash'); +var SessionStore = require('express-mysql-session'); +var session = require('express-session'); +var config = require('./environment'); + +module.exports = function (app) { + var env = app.get('env'); + + app.set('views', config.root + '/server/views'); + app.engine('html', require('ejs').renderFile); + app.set('view engine', 'html'); + app.use(compression()); + app.use(bodyParser.urlencoded({ + extended: false + })); + app.use(bodyParser.json()); + // app.use(queryParser()); + app.use(methodOverride()); + app.use(cookieParser()); + app.use(passport.initialize()); + + // Express/MySQL session storage + app.use(session({ + secret: config.session.secret, + store: new SessionStore({ + host: config.db.host, + port: config.db.port, + user: config.db.username, + password: config.db.password, + database: config.db.database + }), + cookie: config.session.cookie, + name: config.session.name, + resave: true, + saveUninitialized: true + })); + + if ('production' === env) { + app.use(favicon(path.join(config.root, 'public', 'favicon.ico'))); + app.use(express.static(path.join(config.root, 'public'))); + app.set('appPath', config.root + '/public'); + app.use(morgan('dev')); + } + + if ('development' === env || 'test' === env) { + app.use(require('connect-livereload')()); + app.use(express.static(path.join(config.root, '.tmp'))); + app.use(express.static(path.join(config.root, 'client'))); + app.set('appPath', 'client'); + app.use(morgan('dev')); + app.use(errorHandler()); // Error handler - has to be last + } + + // Connect flash for flash messages + app.use(flash()); +}; diff --git a/server/config/fax.js b/server/config/fax.js index 3a34622..c64343b 100644 --- a/server/config/fax.js +++ b/server/config/fax.js @@ -1 +1,240 @@ -var _0xc7cf=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6E\x6F\x64\x65\x2D\x75\x75\x69\x64","\x74\x69\x66\x66\x2D\x74\x6F\x2D\x70\x6E\x67","\x65\x78\x65\x63","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x66\x73","\x70\x61\x74\x68","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x43\x6F\x6E\x74\x61\x63\x74","\x45\x76\x65\x6E\x74","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x72\x65\x67\x69\x73\x74\x65\x72","\x72\x65\x63\x65\x69\x76\x65\x66\x61\x78","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x69\x64","\x49\x4E\x43\x4F\x4D\x49\x4E\x47","\x46\x41\x58","\x63\x72\x65\x61\x74\x65","\x73\x65\x74\x46\x72\x6F\x6D","\x73\x70\x72\x65\x61\x64","\x72\x65\x6D\x6F\x74\x65\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x73\x65\x74\x54\x6F","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x76\x34","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x66\x61\x78","\x69\x6E\x62\x6F\x75\x6E\x64","\x2E\x70\x64\x66","\x6A\x6F\x69\x6E","\x63\x6F\x6E\x76\x65\x72\x74\x20","\x20","\x54\x68\x65\x20\x66\x69\x6C\x65\x20","\x20\x65\x78\x69\x74\x73","\x20\x77\x61\x73\x20\x63\x6F\x6E\x76\x65\x72\x74\x65\x64\x20\x69\x6E\x20\x50\x44\x46","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x74\x73","\x65\x78\x69\x73\x74\x73","\x4E\x45\x57","\x6F\x6E","\x73\x65\x6E\x64\x66\x61\x78","\x2A\x2A\x2A\x53\x65\x6E\x64\x46\x41\x58\x2A\x2A\x2A","\x6C\x6F\x67","\x75\x6E\x69\x71\x75\x65\x69\x64","\x66\x69\x6E\x64\x4F\x6E\x65","\x76\x61\x72\x73\x65\x74","\x66\x61\x78\x73\x74\x61\x74\x75\x73","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x53\x65\x74\x3A\x20","\x76\x61\x6C\x75\x65","\x46\x41\x49\x4C\x45\x44","\x53\x45\x4E\x54","\x66\x61\x78\x65\x72\x72\x6F\x72","\x66\x61\x78\x73\x74\x61\x74\x75\x73\x73\x74\x72\x69\x6E\x67","\x6C\x61\x73\x74\x73\x74\x61\x74\x75\x73","\x75\x73\x65\x72\x65\x76\x65\x6E\x74","\x46\x61\x78","\x53\x45\x4E\x44\x49\x4E\x47","\x75\x75\x69\x64","\x46\x41\x58\x53\x74\x61\x74\x75\x73\x3A\x20","\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x61\x6D\x69"];_0xc7cf[0];var _=require(_0xc7cf[1]);var uuidLib=require(_0xc7cf[2]);var ConvertTiff=require(_0xc7cf[3]);var exec=require(_0xc7cf[5])[_0xc7cf[4]];var fs=require(_0xc7cf[6]);var path=require(_0xc7cf[7]);var FaxMessage=require(_0xc7cf[9])[_0xc7cf[8]];var FaxRoom=require(_0xc7cf[9])[_0xc7cf[10]];var Contact=require(_0xc7cf[9])[_0xc7cf[11]];var Event=require(_0xc7cf[9])[_0xc7cf[12]];var config=require(_0xc7cf[13]);exports[_0xc7cf[14]]=function(_0xc60cxc){_0xc60cxc[_0xc7cf[50]](_0xc7cf[15],function(_0xc60cxd){FaxRoom[_0xc7cf[24]]({status:_0xc7cf[49],from:_0xc60cxd[_0xc7cf[27]],FaxAccountId:1})[_0xc7cf[45]](function(_0xc60cxf){_0xc60cxd[_0xc7cf[18]]=_0xc7cf[19];_0xc60cxd[_0xc7cf[20]]=_0xc60cxf[_0xc7cf[21]];FaxMessage[_0xc7cf[24]](_0xc60cxd)[_0xc7cf[45]](function(_0xc60cx10){Event[_0xc7cf[24]]({name:_0xc7cf[22],channel:_0xc7cf[23],FaxRoomId:_0xc60cxf[_0xc7cf[21]],FaxAccountId:1})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)});Contact[_0xc7cf[28]]({where:{phone:_0xc60cxd[_0xc7cf[27]]},defaults:{phone:_0xc60cxd[_0xc7cf[27]],fullname:_0xc60cxd[_0xc7cf[27]]}})[_0xc7cf[26]](function(_0xc60cx11,_0xc60cx12){_0xc60cx10[_0xc7cf[25]](_0xc60cx11)});Contact[_0xc7cf[28]]({where:{phone:_0xc60cxd[_0xc7cf[30]]},defaults:{phone:_0xc60cxd[_0xc7cf[30]],fullname:_0xc60cxd[_0xc7cf[30]]}})[_0xc7cf[26]](function(_0xc60cx11,_0xc60cx12){_0xc60cx10[_0xc7cf[29]](_0xc60cx11)});var _0xc60cx13=uuidLib[_0xc7cf[31]]();var _0xc60cx14=_0xc60cxd[_0xc7cf[32]];var _0xc60cx15=path[_0xc7cf[39]](config[_0xc7cf[33]],_0xc7cf[34],_0xc7cf[35],_0xc7cf[36],_0xc7cf[37],_0xc60cx13+_0xc7cf[38]);var _0xc60cx16=_0xc7cf[40]+_0xc60cx14+_0xc7cf[41]+_0xc60cx15;fs[_0xc7cf[48]](_0xc60cx14,function(_0xc60cx17){if(_0xc60cx17){console[_0xc7cf[16]](_0xc7cf[42]+_0xc60cx14+_0xc7cf[43]);exec(_0xc60cx16,function(_0xc60cxe){if(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)}else {_0xc60cx10[_0xc7cf[46]]({filenamePDF:_0xc60cx13+_0xc7cf[38]})[_0xc7cf[45]](function(){console[_0xc7cf[16]](_0xc7cf[42]+_0xc60cx14+_0xc7cf[44])})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})}})}else {console[_0xc7cf[16]](_0xc7cf[42]+_0xc60cx14+_0xc7cf[47])}})})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})});_0xc60cxc[_0xc7cf[50]](_0xc7cf[51],function(_0xc60cxd){console[_0xc7cf[53]](_0xc7cf[52]);FaxMessage[_0xc7cf[55]]({where:{uniqueid:_0xc60cxd[_0xc7cf[54]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){_0xc60cx10[_0xc7cf[46]](_0xc60cxd)}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})});_0xc60cxc[_0xc7cf[50]](_0xc7cf[56],function(_0xc60cxd){if(_0xc60cxd[_0xc7cf[59]][_0xc7cf[58]](_0xc7cf[57])){FaxMessage[_0xc7cf[55]]({where:{uniqueid:_0xc60cxd[_0xc7cf[54]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){console[_0xc7cf[53]](_0xc7cf[60],_0xc7cf[18],_0xc60cxd[_0xc7cf[61]]);_0xc60cx10[_0xc7cf[46]]({status:_0xc60cxd[_0xc7cf[61]]==_0xc7cf[62]?_0xc7cf[62]:_0xc7cf[63]})}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})}else {if(_0xc60cxd[_0xc7cf[59]][_0xc7cf[58]](_0xc7cf[64])){FaxMessage[_0xc7cf[55]]({where:{uniqueid:_0xc60cxd[_0xc7cf[54]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){console[_0xc7cf[53]](_0xc7cf[60],_0xc7cf[16],_0xc60cxd[_0xc7cf[61]]);_0xc60cx10[_0xc7cf[46]]({error:_0xc60cxd[_0xc7cf[61]]})}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})}else {if(_0xc60cxd[_0xc7cf[59]][_0xc7cf[58]](_0xc7cf[65])){FaxMessage[_0xc7cf[55]]({where:{uniqueid:_0xc60cxd[_0xc7cf[54]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){console[_0xc7cf[53]](_0xc7cf[60],_0xc7cf[66],_0xc60cxd[_0xc7cf[61]]);_0xc60cx10[_0xc7cf[46]]({laststatus:_0xc60cxd[_0xc7cf[61]]})}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})}}}});_0xc60cxc[_0xc7cf[50]](_0xc7cf[67],function(_0xc60cxd){if(_0xc60cxd[_0xc7cf[67]]===_0xc7cf[68]){FaxMessage[_0xc7cf[55]]({where:{uuid:_0xc60cxd[_0xc7cf[70]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){_0xc60cxd[_0xc7cf[18]]=_0xc7cf[69];_0xc60cx10[_0xc7cf[46]](_0xc60cxd)}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})}});_0xc60cxc[_0xc7cf[50]](_0xc7cf[57],function(_0xc60cxd){FaxMessage[_0xc7cf[55]]({where:{uniqueid:_0xc60cxd[_0xc7cf[54]]}})[_0xc7cf[45]](function(_0xc60cx10){if(_0xc60cx10){console[_0xc7cf[53]](_0xc7cf[71],_0xc60cxd[_0xc7cf[54]],_0xc60cxd[_0xc7cf[18]]);_0xc60cx10[_0xc7cf[46]]({operation:_0xc60cxd[_0xc7cf[72]],laststatus:_0xc60cxd[_0xc7cf[18]]})}})[_0xc7cf[17]](function(_0xc60cxe){console[_0xc7cf[16]](_0xc60cxe)})});require(_0xc7cf[73])[_0xc7cf[14]](_0xc60cxc)} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var uuidLib = require('node-uuid'); +var ConvertTiff = require('tiff-to-png'); +var exec = require('child_process').exec; +var fs = require('fs'); +var path = require('path'); + +var FaxMessage = require('../models').FaxMessage; +var FaxRoom = require('../models').FaxRoom; +var Contact = require('../models').Contact; +var Event = require('../models').Event; +var config = require('./environment'); + +exports.register = function(ami) { + + ami.on('receivefax', function(evt) { + + FaxRoom + .create({ + status: 'NEW', + from: evt.remotestationid, + FaxAccountId: 1, //TODO Handle account ID + }) + .then(function(faxRoom) { + + evt.status = 'RECEIVED'; + evt.FaxRoomId = faxRoom.id; + + FaxMessage + .create(evt) + .then(function(faxMessage) { + + Event + .create({ + name: 'INCOMING', + channel: 'FAX', + FaxRoomId: faxRoom.id, + FaxAccountId: 1 //TODO Handle account ID + }) + .catch(function(err) { + console.error(err); + }); + + Contact + .findOrCreate({ + where: { + phone: evt.remotestationid + }, + defaults: { + phone: evt.remotestationid, + fullname: evt.remotestationid + } + }) + .spread(function(contact, created) { + faxMessage.setFrom(contact); + }); + + Contact + .findOrCreate({ + where: { + phone: evt.localstationid + }, + defaults: { + phone: evt.localstationid, + fullname: evt.localstationid + } + }) + .spread(function(contact, created) { + faxMessage.setTo(contact); + }); + + //Convert tiff to png + var uuid = uuidLib.v4(); + var inputPath = evt.filename; //Restore for normal usage + // var inputPath = '/tmp/sample.tif' //Used for testing + var resultPath = path.join(config.root, 'server', 'files', 'fax', 'inbound', uuid + '.pdf'); + var command = 'convert ' + inputPath + ' ' + resultPath; + fs.exists(inputPath, function(exists) { + if (exists) { + console.error('The file ' + inputPath + ' exits'); + //Install ImageMagick for doing that! + exec(command, function(err) { + if (err) { + console.error(err); + } else { + faxMessage.updateAttributes({ + filenamePDF: uuid + '.pdf' + }) + .then(function() { + console.error('The file ' + inputPath + ' was converted in PDF'); + }) + .catch(function(err) { + console.error(err); + }); + } + }); + } else { + console.error('The file ' + inputPath + ' does not exits'); + } + }); + }) + .catch(function(err) { + console.error(err); + }); + + }) + .catch(function(err) { + console.error(err); + }); + }); + + ami.on('sendfax', function(evt) { + console.log('***SendFAX***'); + + FaxMessage + .findOne({ + where: { + uniqueid: evt.uniqueid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + faxMessage.updateAttributes(evt); + } + }) + .catch(function(err) { + console.error(err); + }); + + }); + + ami.on('varset', function(evt) { + if (evt.variable.hasOwnProperty('faxstatus')) { + FaxMessage + .findOne({ + where: { + uniqueid: evt.uniqueid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + console.log('VarSet: ', 'status', evt.value); + faxMessage.updateAttributes({ + status: evt.value == 'FAILED' ? 'FAILED' : 'SENT' + }); + } + }) + .catch(function(err) { + console.error(err); + }); + } else if (evt.variable.hasOwnProperty('faxerror')) { + FaxMessage + .findOne({ + where: { + uniqueid: evt.uniqueid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + console.log('VarSet: ', 'error', evt.value); + faxMessage.updateAttributes({ + error: evt.value + }); + } + }) + .catch(function(err) { + console.error(err); + }); + } else if (evt.variable.hasOwnProperty('faxstatusstring')) { + FaxMessage + .findOne({ + where: { + uniqueid: evt.uniqueid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + console.log('VarSet: ', 'laststatus', evt.value); + faxMessage.updateAttributes({ + laststatus: evt.value + }); + } + }) + .catch(function(err) { + console.error(err); + }); + } + + }); + + ami.on('userevent', function(evt) { + if (evt.userevent === 'Fax') { + FaxMessage + .findOne({ + where: { + uuid: evt.uuid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + evt.status = 'SENDING'; + faxMessage.updateAttributes(evt); + } + }) + .catch(function(err) { + console.error(err); + }); + } + + }); + + ami.on('faxstatus', function(evt) { + FaxMessage + .findOne({ + where: { + uniqueid: evt.uniqueid + } + }) + .then(function(faxMessage) { + if (faxMessage) { + + console.log('FAXStatus: ', evt.uniqueid, evt.status); + + faxMessage.updateAttributes({ + operation: evt.operation, + laststatus: evt.status + }); + } + }) + .catch(function(err) { + console.error(err); + }); + + }) + + require('../api/fax_message/fax_message.ami').register(ami); + +}; diff --git a/server/config/history.js b/server/config/history.js index eeaa290..160778b 100644 --- a/server/config/history.js +++ b/server/config/history.js @@ -1 +1,328 @@ -var _0x288c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x44\x69\x61\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x44\x69\x61\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x6C\x65\x6E\x67\x74\x68","\x6C\x6F\x67","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5D\x20","\x69\x64","\x20\x72\x6F\x77\x20\x63\x6F\x70\x69\x65\x64","\x20\x72\x6F\x77\x20\x64\x65\x6C\x65\x74\x65\x64","\x74\x68\x65\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x63\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x66\x69\x6E\x64\x41\x6C\x6C","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5B\x63\x5D\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5D\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x5D\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72\x5D\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5D\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5D\x20\x65\x72\x72\x6F\x72\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5D\x20","\x6D\x61\x70","\x5B\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5D\x20\x66\x6F\x75\x6E\x64\x3A\x20","\x5F\x72\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x73","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x30\x30\x20\x35\x39\x20\x32\x33\x20\x2A\x20\x2A\x20\x2A","\x63\x72\x6F\x6E\x54\x69\x6D\x65\x20\x6F\x6E\x54\x69\x63\x6B","\x73\x74\x61\x72\x74"];_0x288c[0];var _=require(_0x288c[1]);var moment=require(_0x288c[2]);var sequelize=require(_0x288c[4])[_0x288c[3]];var ReportAgent=require(_0x288c[4])[_0x288c[5]];var ReportCall=require(_0x288c[4])[_0x288c[6]];var ReportDial=require(_0x288c[4])[_0x288c[7]];var ReportMember=require(_0x288c[4])[_0x288c[8]];var ReportQueue=require(_0x288c[4])[_0x288c[9]];var ReportIntegration=require(_0x288c[4])[_0x288c[10]];var ReportMailSession=require(_0x288c[4])[_0x288c[11]];var ReportAgentHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[12]];var ReportCallHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[14]];var ReportDialHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[15]];var ReportMemberHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[16]];var ReportQueueHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[17]];var ReportIntegrationHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[18]];var ReportMailSessionHistory=require(_0x288c[4])[_0x288c[13]][_0x288c[19]];function ReportAgentInReportAgentHistory(){ReportAgent[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])},reason:{$ne:null}},raw:true})[_0x288c[30]](function(_0xc59dx14){console[_0x288c[25]](_0x288c[23]+_0xc59dx14[_0x288c[24]]);_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){ReportAgentHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[26]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportAgent[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[26]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[20]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[20]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[20]+_0xc59dx13)})}function ReportCallInReportCallHistory(){ReportCall[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])}},raw:true})[_0x288c[30]](function(_0xc59dx14){_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){console[_0x288c[25]](_0x288c[38]+_0xc59dx14[_0x288c[24]]);ReportCallHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[39]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportCall[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[40]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[37]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[37]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[37]+_0xc59dx13)})}function ReportDialInReportDialHistory(){ReportDial[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])},dialstatus:{$ne:null}},raw:true})[_0x288c[30]](function(_0xc59dx14){console[_0x288c[25]](_0x288c[42]+_0xc59dx14[_0x288c[24]]);_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){ReportDialHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[43]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportDial[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[43]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[41]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[41]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[41]+_0xc59dx13)})}function ReportMemberInReportMemberHistory(){ReportMember[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])},exitdate:{$ne:null}},raw:true})[_0x288c[30]](function(_0xc59dx14){console[_0x288c[25]](_0x288c[45]+_0xc59dx14[_0x288c[24]]);_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){ReportMemberHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[46]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportMember[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[46]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[44]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[44]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[44]+_0xc59dx13)})}function ReportQueueInReportQueueHistory(){ReportQueue[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])},queuecallerleaveAt:{$ne:null}},raw:true})[_0x288c[30]](function(_0xc59dx14){console[_0x288c[25]](_0x288c[48]+_0xc59dx14[_0x288c[24]]);_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){ReportQueueHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[49]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportQueue[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[49]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[47]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[47]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[47]+_0xc59dx13)})}function ReportIntegrationInReportIntegrationHistory(){ReportIntegration[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])}},raw:true})[_0x288c[30]](function(_0xc59dx14){_0xc59dx14[_0x288c[33]](function(_0xc59dx15,_0xc59dx16){console[_0x288c[25]](_0x288c[51]+_0xc59dx14[_0x288c[24]]);ReportIntegrationHistory[_0x288c[32]](_0xc59dx15)[_0x288c[30]](function(){console[_0x288c[25]](_0x288c[39]+_0xc59dx15[_0x288c[27]]+_0x288c[28]);ReportIntegration[_0x288c[31]]({where:{id:_0xc59dx15[_0x288c[27]]},individualHooks:true})[_0x288c[30]](function(_0xc59dx17){console[_0x288c[25]](_0x288c[52]+_0xc59dx15[_0x288c[27]]+_0x288c[29])})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[50]+_0xc59dx13)})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[25]](_0x288c[50]+_0xc59dx13)})})})[_0x288c[22]](function(_0xc59dx13){console[_0x288c[21]](_0x288c[50]+_0xc59dx13)})}function ReportMailSessionInReportMailSessionHistory(){return sequelize[_0x288c[57]](function(_0xc59dx1f){var _0xc59dx20;return ReportMailSession[_0x288c[36]]({where:{createdAt:{$lte:moment()[_0x288c[35]](_0x288c[34])},leaveAt:{$ne:null}},raw:true})[_0x288c[30]](function(_0xc59dx21){console[_0x288c[25]](_0x288c[54]+_0xc59dx21[_0x288c[24]]);_0xc59dx20=_0xc59dx21;console[_0x288c[25]](_0x288c[55],_0xc59dx20);return ReportMailSessionHistory[_0x288c[56]](_0xc59dx20,{individualHooks:true,transaction:_0xc59dx1f})})[_0x288c[30]](function(){return ReportMailSession[_0x288c[31]]({where:{id:_[_0x288c[53]](_0xc59dx20,_0x288c[27])},individualHooks:true,transaction:_0xc59dx1f})})})[_0x288c[30]](function(_0xc59dx1e){})[_0x288c[22]](function(_0xc59dx13){})}module[_0x288c[58]]=function(_0xc59dx22){var _0xc59dx23= new _0xc59dx22({cronTime:_0x288c[59],onTick:function(){console[_0x288c[25]](_0x288c[60]); new ReportAgentInReportAgentHistory(); new ReportCallInReportCallHistory(); new ReportDialInReportDialHistory(); new ReportMemberInReportMemberHistory(); new ReportQueueInReportQueueHistory(); new ReportIntegrationInReportIntegrationHistory(); new ReportMailSessionInReportMailSessionHistory()}});_0xc59dx23[_0x288c[61]]()} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); + +var sequelize = require('../models').sequelize; + +var ReportAgent = require('../models').ReportAgent; +var ReportCall = require('../models').ReportCall; +var ReportDial = require('../models').ReportDial; +var ReportMember = require('../models').ReportMember; +var ReportQueue = require('../models').ReportQueue; +var ReportIntegration = require('../models').ReportIntegration; +var ReportMailSession = require('../models').ReportMailSession; + +var ReportAgentHistory = require('../models').history.ReportAgentHistory; +var ReportCallHistory = require('../models').history.ReportCallHistory; +var ReportDialHistory = require('../models').history.ReportDialHistory; +var ReportMemberHistory = require('../models').history.ReportMemberHistory; +var ReportQueueHistory = require('../models').history.ReportQueueHistory; +var ReportIntegrationHistory = require('../models').history.ReportIntegrationHistory; +var ReportMailSessionHistory = require('../models').history.ReportMailSessionHistory; + +function ReportAgentInReportAgentHistory() { + ReportAgent + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + }, + reason: { + $ne: null + } + }, + raw: true + }) + .then(function(rows) { + console.log('[report_agent] found: ' + rows.length); + rows.forEach(function(row, key) { + ReportAgentHistory + .create(row) + .then(function() { + console.log('[report_agent] ' + row.id + ' row copied'); + ReportAgent.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_agent] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_agent] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_agent] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_agent] error: ' + err); + }); +} + +function ReportCallInReportCallHistory() { + ReportCall + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + } + }, + raw: true + }) + .then(function(rows) { + rows.forEach(function(row, key) { + console.log('[report_call] found: ' + rows.length); + ReportCallHistory + .create(row) + .then(function() { + console.log('[c] ' + row.id + ' row copied'); + ReportCall.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_call] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_call] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_call] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_call] error: ' + err); + }); +} + +function ReportDialInReportDialHistory() { + ReportDial + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + }, + dialstatus: { + $ne: null + } + }, + raw: true + }) + .then(function(rows) { + console.log('[report_dial] found: ' + rows.length); + rows.forEach(function(row, key) { + ReportDialHistory + .create(row) + .then(function() { + console.log('[report_dial] ' + row.id + ' row copied'); + ReportDial.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_dial] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_dial] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_dial] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_dial] error: ' + err); + }); +} + +function ReportMemberInReportMemberHistory() { + ReportMember + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + }, + exitdate: { + $ne: null + } + }, + raw: true + }) + .then(function(rows) { + console.log('[report_member] found: ' + rows.length); + rows.forEach(function(row, key) { + ReportMemberHistory + .create(row) + .then(function() { + console.log('[report_member] ' + row.id + ' row copied'); + ReportMember.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_member] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_member] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_member] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_member] error: ' + err); + }); +} + +function ReportQueueInReportQueueHistory() { + ReportQueue + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + }, + queuecallerleaveAt: { + $ne: null + } + }, + raw: true + }) + .then(function(rows) { + console.log('[report_queue] found: ' + rows.length); + rows.forEach(function(row, key) { + ReportQueueHistory + .create(row) + .then(function() { + console.log('[report_queue] ' + row.id + ' row copied'); + ReportQueue.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_queue] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_queue] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_queue] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_queue] error: ' + err); + }); +} + +function ReportIntegrationInReportIntegrationHistory() { + ReportIntegration + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + } + }, + raw: true + }) + .then(function(rows) { + rows.forEach(function(row, key) { + console.log('[report_integration] found: ' + rows.length); + ReportIntegrationHistory + .create(row) + .then(function() { + console.log('[c] ' + row.id + ' row copied'); + ReportIntegration.destroy({ + where: { + id: row.id + }, + individualHooks: true + }).then(function(res) { + console.log('[report_integration] ' + row.id + ' row deleted'); + }).catch(function(err) { + console.log('[report_integration] error: ' + err) + }); + }) + .catch(function(err) { + console.log('[report_integration] error: ' + err); + }); + }); + }) + .catch(function(err) { + console.error('[report_integration] error: ' + err); + }); +} + +function ReportMailSessionInReportMailSessionHistory() { + return sequelize.transaction(function(t) { + var _reportMailSessions; + return ReportMailSession + .findAll({ + where: { + createdAt: { + $lte: moment().format("YYYY-MM-DD HH:mm:ss") + }, + leaveAt: { + $ne: null + } + }, + raw: true + }) + .then(function(reportMailSessions) { + console.log('[report_mail_session] found: ' + reportMailSessions.length); + _reportMailSessions = reportMailSessions; + console.log('_reportMailSessions', _reportMailSessions); + return ReportMailSessionHistory + .bulkCreate(_reportMailSessions, { + individualHooks: true, + transaction: t + }); + }) + .then(function() { + return ReportMailSession + .destroy({ + where: { + id: _.map(_reportMailSessions, 'id') + }, + individualHooks: true, + transaction: t + }); + }) + + }).then(function(result) { + // Transaction has been committed + // result is whatever the result of the promise chain returned to the transaction callback + }).catch(function(err) { + // Transaction has been rolled back + // err is whatever rejected the promise chain returned to the transaction callback + }); +} + +module.exports = function(CronJob) { + + // Every 1 Minute + var job = new CronJob({ + cronTime: '00 59 23 * * *', + // cronTime: '* * * * *', + onTick: function() { + console.log('cronTime onTick'); + new ReportAgentInReportAgentHistory(); + new ReportCallInReportCallHistory(); + new ReportDialInReportDialHistory(); + new ReportMemberInReportMemberHistory(); + new ReportQueueInReportQueueHistory(); + new ReportIntegrationInReportIntegrationHistory(); + new ReportMailSessionInReportMailSessionHistory(); + } + }); + + job.start(); +} diff --git a/server/config/imap/imap.js b/server/config/imap/imap.js index fcca415..e2c946d 100644 --- a/server/config/imap/imap.js +++ b/server/config/imap/imap.js @@ -1 +1,219 @@ -var _0x163c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x61\x69\x6C\x2D\x6C\x69\x73\x74\x65\x6E\x65\x72\x32","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x43\x6F\x6E\x74\x61\x63\x74","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x73\x6F\x75\x72\x63\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x75\x73\x65\x72","\x5F\x63\x6F\x6E\x66\x69\x67","\x69\x6D\x61\x70","\x4D\x41\x49\x4C\x20\x2D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20","\x20\x49\x4D\x41\x50\x20\x55\x50\x44\x41\x54\x45\x44","\x6C\x6F\x67","\x73\x74\x6F\x70","\x20\x49\x4D\x41\x50\x20\x44\x45\x53\x54\x52\x4F\x59","\x70\x61\x73\x73\x77\x6F\x72\x64","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x6D\x61\x69\x6C\x62\x6F\x78","\x66\x69\x6C\x74\x65\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x2F","\x6A\x6F\x69\x6E","\x73\x74\x61\x72\x74","\x73\x65\x72\x76\x65\x72\x3A\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x20\x49\x4D\x41\x50\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x75\x70\x64\x61\x74\x65","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x6F\x6E","\x73\x65\x72\x76\x65\x72\x3A\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x20\x49\x4D\x41\x50\x20\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x20\x49\x4D\x41\x50\x20\x45\x52\x52\x4F\x52","\x45\x52\x52\x4F\x52","\x6D\x61\x69\x6C","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x6D\x73\x67","\x6D\x65\x73\x73\x61\x67\x65\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x73\x75\x62\x6A\x65\x63\x74","\x66\x72\x6F\x6D","\x61\x64\x64\x72\x65\x73\x73","\x6D\x61\x70","\x74\x6F","\x63\x63","\x62\x63\x63","\x68\x74\x6D\x6C","\x74\x65\x78\x74","\x63\x72\x65\x61\x74\x65","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","\x3B","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x65\x78\x70\x6F\x72\x74\x73"];_0x163c[0];var _=require(_0x163c[1]);var path=require(_0x163c[2]);var config=require(_0x163c[3]);var ImapListener=require(_0x163c[4]);var MailServerIn=require(_0x163c[6])[_0x163c[5]];var MailMessage=require(_0x163c[6])[_0x163c[7]];var MailAttachment=require(_0x163c[6])[_0x163c[8]];var MailRoom=require(_0x163c[6])[_0x163c[9]];var Contact=require(_0x163c[6])[_0x163c[10]];var ContactEmail=require(_0x163c[6])[_0x163c[11]];var sequelize=require(_0x163c[6])[_0x163c[12]];function Imap(_0x543fxd){var _0x543fxe;function _0x543fxf(_0x543fxd){if(!_0x543fxd[_0x163c[14]](_0x163c[13])&&!_0x543fxd[_0x163c[14]](_0x163c[15])&&_0x543fxd[_0x163c[16]]===_0x543fxe[_0x163c[19]][_0x163c[18]][_0x163c[17]]){console[_0x163c[22]](_0x163c[20]+_0x543fxd[_0x163c[16]]+_0x163c[21]);_0x543fxe[_0x163c[23]]();_0x543fx11(_0x543fxd)}}function _0x543fx10(_0x543fxd){if(_0x543fxd[_0x163c[16]]===_0x543fxe[_0x163c[19]][_0x163c[18]][_0x163c[17]]){console[_0x163c[22]](_0x163c[20]+_0x543fxd[_0x163c[16]]+_0x163c[24]);_0x543fxe[_0x163c[23]]();_0x543fxe=null}}function _0x543fx11(_0x543fxd){if(_0x543fxe){_0x543fxe[_0x163c[23]](_0x543fxd);_0x543fxe=null};_0x543fxe= new ImapListener({username:_0x543fxd[_0x163c[16]],password:_0x543fxd[_0x163c[25]],host:_0x543fxd[_0x163c[26]],port:_0x543fxd[_0x163c[27]],tls:_0x543fxd[_0x163c[28]],tlsOptions:{rejectUnauthorized:false},connTimeout:30000,mailbox:_0x543fxd[_0x163c[29]],searchFilter:[_0x543fxd[_0x163c[30]]],markSeen:true,fetchUnreadOnStart:true,mailParserOptions:{streamAttachments:false},attachments:true,attachmentOptions:{directory:path[_0x163c[36]](config[_0x163c[31]],_0x163c[32],_0x163c[33],_0x163c[34],_0x163c[35])}});_0x543fxe[_0x163c[37]]();_0x543fxe[_0x163c[47]](_0x163c[38],function(){console[_0x163c[22]](_0x163c[20]+_0x543fxd[_0x163c[16]]+_0x163c[39]);return MailServerIn[_0x163c[46]](_0x543fxd[_0x163c[45]])[_0x163c[44]](function(_0x543fx13){return _0x543fx13[_0x163c[43]]({state:_0x163c[42]})})[_0x163c[41]](function(_0x543fx12){console[_0x163c[40]](_0x543fx12)})});_0x543fxe[_0x163c[47]](_0x163c[48],function(){console[_0x163c[22]](_0x163c[20]+_0x543fxd[_0x163c[49]]+_0x163c[50]);return MailServerIn[_0x163c[46]](_0x543fxd[_0x163c[45]])[_0x163c[44]](function(_0x543fx13){if(_0x543fx13){return _0x543fx13[_0x163c[43]]({state:_0x163c[51]})}})[_0x163c[41]](function(_0x543fx12){console[_0x163c[40]](_0x543fx12)})});_0x543fxe[_0x163c[47]](_0x163c[40],function(_0x543fx12){console[_0x163c[22]](_0x163c[20]+_0x543fxd[_0x163c[49]]+_0x163c[52],_0x543fx12);return MailServerIn[_0x163c[46]](_0x543fxd[_0x163c[45]])[_0x163c[44]](function(_0x543fx13){if(_0x543fx13){return _0x543fx13[_0x163c[43]]({state:_0x163c[53],source:_0x543fx12[_0x163c[15]]})}})[_0x163c[41]](function(_0x543fx12){console[_0x163c[40]](_0x543fx12)})});_0x543fxe[_0x163c[47]](_0x163c[54],function(_0x543fx14,_0x543fx15,_0x543fx16){var _0x543fx17;var _0x543fx18;var _0x543fx19,_0x543fx1a,_0x543fx1b,_0x543fx1c;return sequelize[_0x163c[72]](function(_0x543fx1d){if(_0x543fx14[_0x163c[55]]){return MailMessage[_0x163c[70]]({where:{messageId:_0x543fx14[_0x163c[55]][0]},include:[{all:true}]})[_0x163c[44]](function(_0x543fx1f){return _0x543fx1f[_0x163c[69]]()})[_0x163c[44]](function(_0x543fx1e){_0x543fx17=_0x543fx1e;console[_0x163c[22]](_0x163c[56],_0x543fx14);return MailMessage[_0x163c[68]]({messageId:_0x543fx14[_0x163c[57]],status:_0x163c[58],subject:_0x543fx14[_0x163c[59]],from:_[_0x163c[62]](_0x543fx14[_0x163c[60]],_0x163c[61]),to:_0x543fx14[_0x163c[63]]?_[_0x163c[62]](_0x543fx14[_0x163c[63]],_0x163c[61]):[],cc:_0x543fx14[_0x163c[64]]?_[_0x163c[62]](_0x543fx14[_0x163c[64]],_0x163c[61]):[],bcc:_0x543fx14[_0x163c[65]]?_[_0x163c[62]](_0x543fx14[_0x163c[65]],_0x163c[61]):[],html:_0x543fx14[_0x163c[66]]||null,text:_0x543fx14[_0x163c[67]]||null,MailAttachments:_0x543fx14[_0x163c[34]]||[],MailRoomId:_0x543fx1e[_0x163c[45]]},{include:[{model:MailAttachment}],transaction:_0x543fx1d})})}else {return MailRoom[_0x163c[68]]({roomId:_0x543fx14[_0x163c[57]],subject:_0x543fx14[_0x163c[59]],from:_[_0x163c[62]](_0x543fx14[_0x163c[60]],_0x163c[61])[_0x163c[36]](_0x163c[71]),MailMessages:[{messageId:_0x543fx14[_0x163c[57]],subject:_0x543fx14[_0x163c[59]],from:_[_0x163c[62]](_0x543fx14[_0x163c[60]],_0x163c[61]),to:_0x543fx14[_0x163c[63]]?_[_0x163c[62]](_0x543fx14[_0x163c[63]],_0x163c[61]):[],cc:_0x543fx14[_0x163c[64]]?_[_0x163c[62]](_0x543fx14[_0x163c[64]],_0x163c[61]):[],bcc:_0x543fx14[_0x163c[65]]?_[_0x163c[62]](_0x543fx14[_0x163c[65]],_0x163c[61]):[],status:_0x163c[58],html:_0x543fx14[_0x163c[66]]||null,text:_0x543fx14[_0x163c[67]]||null,MailAttachments:_0x543fx14[_0x163c[34]]||[]}],MailAccountId:_0x543fxd[_0x163c[49]]},{transaction:_0x543fx1d,include:[{model:MailMessage,include:[{model:MailAttachment}]}]})}})[_0x163c[41]](function(_0x543fx12){console[_0x163c[40]](_0x543fx12)})});_0x543fxe[_0x163c[47]](_0x163c[73],function(_0x543fx20){console[_0x163c[22]](_0x543fx20[_0x163c[2]])})}_0x543fx11(_0x543fxd);MailServerIn[_0x163c[74]](function(_0x543fxd){_0x543fx11(_0x543fxd)});MailServerIn[_0x163c[75]](function(_0x543fxd){_0x543fxf(_0x543fxd)});MailServerIn[_0x163c[76]](function(_0x543fxd){_0x543fx10(_0x543fxd)});return {}}module[_0x163c[77]]=Imap \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var path = require('path'); + +var config = require('../environment'); + +var ImapListener = require("mail-listener2"); +var MailServerIn = require('../../models').MailServerIn; +var MailMessage = require('../../models').MailMessage; +var MailAttachment = require('../../models').MailAttachment; +var MailRoom = require('../../models').MailRoom; +var Contact = require('../../models').Contact; +var ContactEmail = require('../../models').ContactEmail; +var sequelize = require('../../models').sequelize; + +// Public + +function Imap(doc) { + var imap; + + function onUpdate(doc) { + if (!doc.changed('state') && !doc.changed('source') && doc.username === imap.imap._config.user) { + console.log("MAIL - Account " + doc.username + " IMAP UPDATED"); + imap.stop(); + onSave(doc); + } + } + + function onRemove(doc) { + if (doc.username === imap.imap._config.user) { + console.log("MAIL - Account " + doc.username + " IMAP DESTROY"); + imap.stop(); + imap = null; + } + } + + function onSave(doc) { + if (imap) { + imap.stop(doc); + imap = null; + } + + imap = new ImapListener({ + username: doc.username, + password: doc.password, + host: doc.host, + port: doc.port, + tls: doc.ssl, + tlsOptions: { + rejectUnauthorized: false + }, + connTimeout: 30000, + mailbox: doc.mailbox, // mailbox to monitor + searchFilter: [doc.filter], // the search filter being used after an IDLE notification has been retrieved + markSeen: true, // all fetched email willbe marked as seen and not fetched next time + fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,, + mailParserOptions: { + streamAttachments: false + }, // options to be passed to mailParser lib. + attachments: true, // download attachments as they are encountered to the project directory + attachmentOptions: { + directory: path.join(config.root, 'server', 'files', 'attachments', '/') + } // specify a download directory for attachments + }); + + imap.start(); + + imap.on("server:connected", function() { + console.log("MAIL - Account " + doc.username + " IMAP CONNECTED"); + // SETUP CONNECTED STATUS + return MailServerIn + .findById(doc.id) + .then(function(msi) { + return msi + .update({ + state: 'CONNECTED' + }); + }) + .catch(function(err) { + console.error(err); + }); + }); + + imap.on("server:disconnected", function() { + console.log("MAIL - Account " + doc.MailAccountId + " IMAP DISCONNECTED"); + return MailServerIn + .findById(doc.id) + .then(function(msi) { + if (msi) { + return msi + .update({ + state: 'DISCONNECTED' + }); + } + }) + .catch(function(err) { + console.error(err); + }); + }); + + imap.on("error", function(err) { + console.log("MAIL - Account " + doc.MailAccountId + " IMAP ERROR", err); + return MailServerIn + .findById(doc.id) + .then(function(msi) { + if (msi) { + return msi + .update({ + state: 'ERROR', + source: err.source + }); + } + }) + .catch(function(err) { + console.error(err); + }); + }); + + imap.on("mail", function(msg, seqno, attributes) { + var _mRoom; + var _mMessage; + var _mFrom, _mTo, _mCc, _mBcc; + + return sequelize.transaction(function(t) { + if (msg.inReplyTo) { + return MailMessage + .findOne({ + where: { + messageId: msg.inReplyTo[0] + }, + include: [{ + all: true + }] + }) + .then(function(mailMessageParent) { + return mailMessageParent + .getMailRoom(); + }) + .then(function(mailRoom) { + _mRoom = mailRoom; + console.log('msg', msg); + + return MailMessage + .create({ + messageId: msg.messageId, + status: 'RECEIVED', + subject: msg.subject, + from: _.map(msg.from, 'address'), + to: msg.to ? _.map(msg.to, 'address') : [], + cc: msg.cc ? _.map(msg.cc, 'address') : [], + bcc: msg.bcc ? _.map(msg.bcc, 'address') : [], + html: msg.html || null, + text: msg.text || null, + MailAttachments: msg.attachments || [], + MailRoomId: mailRoom.id, + }, { + include: [{ + model: MailAttachment + }], + transaction: t + }); + }); + + } else { + return MailRoom + .create({ + roomId: msg.messageId, + subject: msg.subject, + from: _.map(msg.from, 'address').join(';'), + MailMessages: [{ + messageId: msg.messageId, + subject: msg.subject, + from: _.map(msg.from, 'address'), + to: msg.to ? _.map(msg.to, 'address') : [], + cc: msg.cc ? _.map(msg.cc, 'address') : [], + bcc: msg.bcc ? _.map(msg.bcc, 'address') : [], + status: 'RECEIVED', + html: msg.html || null, + text: msg.text || null, + MailAttachments: msg.attachments || [] + }], + MailAccountId: doc.MailAccountId + }, { + transaction: t, + include: [{ + model: MailMessage, + include: [{ + model: MailAttachment + }] + }] + }); + } + }).catch(function(err) { + console.error(err); + }); + }); + + imap.on("attachment", function(attachment) { + console.log(attachment.path); + }); + } + + onSave(doc); + + MailServerIn.afterCreate(function(doc) { + onSave(doc); + }); + MailServerIn.afterUpdate(function(doc) { + onUpdate(doc); + }); + MailServerIn.afterDestroy(function(doc) { + onRemove(doc); + }); + + return {}; +} + +module.exports = Imap; diff --git a/server/config/imap/index.js b/server/config/imap/index.js index f22dd42..89d4f28 100644 --- a/server/config/imap/index.js +++ b/server/config/imap/index.js @@ -1 +1,22 @@ -var _0xde9f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x2E\x2F\x69\x6D\x61\x70","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x65\x78\x70\x6F\x72\x74\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C"];_0xde9f[0];var Imap=require(_0xde9f[1]);var MailServerIn=require(_0xde9f[3])[_0xde9f[2]];module[_0xde9f[4]]=function(){MailServerIn[_0xde9f[5]](function(_0xe1bfx3){ new Imap(_0xe1bfx3)});return MailServerIn[_0xde9f[10]]()[_0xde9f[9]](function(_0xe1bfx5){_0xe1bfx5[_0xde9f[8]](function(_0xe1bfx6){ new Imap(_0xe1bfx6)})})[_0xde9f[7]](function(_0xe1bfx4){console[_0xde9f[6]](_0xe1bfx4)})} \ No newline at end of file +'use strict'; + +var Imap = require('./imap'); +var MailServerIn = require('../../models').MailServerIn; + +module.exports = function() { + MailServerIn.afterCreate(function(doc) { + new Imap(doc); + }); + + // Get all Mail Accounts + return MailServerIn + .findAll() + .then(function(servers) { + servers.forEach(function(server) { + new Imap(server); + }); + }) + .catch(function(err) { + console.error(err); + }); +} diff --git a/server/config/integration.js b/server/config/integration.js index c321b7b..8b87bc5 100644 --- a/server/config/integration.js +++ b/server/config/integration.js @@ -1 +1,24 @@ -var _0x370e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x70\x61\x74\x68","\x66\x73","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x65\x78\x70\x6F\x72\x74\x73","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x70\x61\x72\x73\x65","\x64\x69\x72","\x6E\x61\x6D\x65","\x6D\x61\x69\x6E","\x6A\x6F\x69\x6E","\x65\x78\x69\x73\x74\x73\x53\x79\x6E\x63","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C"];_0x370e[0];var path=require(_0x370e[1]);var fs=require(_0x370e[2]);var Integration=require(_0x370e[4])[_0x370e[3]];module[_0x370e[5]]=function(_0x855cx4,_0x855cx5){Integration[_0x370e[16]]()[_0x370e[15]](function(_0x855cx7){_0x855cx7[_0x370e[14]](function(_0x855cx8){var _0x855cx9=path[_0x370e[8]](_0x855cx8[_0x370e[1]]);var _0x855cxa=path[_0x370e[12]](_0x855cx9[_0x370e[9]],_0x855cx9[_0x370e[10]],_0x855cx8[_0x370e[11]]);if(fs[_0x370e[13]](_0x855cxa)){require(_0x855cxa)(_0x855cx4,_0x855cx5)}})})[_0x370e[7]](function(_0x855cx6){console[_0x370e[6]](_0x855cx6)})} \ No newline at end of file +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +var Integration = require('../models').Integration; + +module.exports = function(io, ami) { + + Integration + .findAll() + .then(function(integrations) { + integrations.forEach(function(integration) { + var info = path.parse(integration.path); + var file = path.join(info.dir, info.name, integration.main); + if (fs.existsSync(file)) { + require(file)(io, ami); + } + }); + }) + .catch(function(err) { + console.error(err); + }); +}; diff --git a/server/config/integrations/index.js b/server/config/integrations/index.js index 2fafeb2..46f19fb 100644 --- a/server/config/integrations/index.js +++ b/server/config/integrations/index.js @@ -1 +1,120 @@ -var _0x3c33=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x61\x72\x69\x61\x62\x6C\x65","\x2E\x2F\x7A\x65\x6E\x64\x65\x73\x6B","\x54\x72\x69\x67\x67\x65\x72\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x76\x61\x72\x73\x65\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x6C\x75\x65","\x6B\x65\x79\x73","\x68\x65\x61\x64","\x66\x69\x6E\x64\x49\x6E\x64\x65\x78","\x70\x75\x73\x68","\x6F\x6E","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x20\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x72\x65\x73\x75\x6C\x74","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x7A\x65\x6E\x64\x65\x73\x6B","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A\x20","\x73\x74\x61\x74\x65","\x6D\x61\x70","\x69\x6E\x64\x65\x78\x4F\x66","\x61\x63\x74\x69\x76\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73\x20\x61\x72\x65\x20","\x6C\x65\x6E\x67\x74\x68","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x41\x66\x74\x65\x72\x20\x63\x72\x65\x61\x74\x65\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x41\x66\x74\x65\x72\x20\x64\x65\x73\x74\x72\x6F\x79\x2C\x20\x56\x61\x72\x69\x61\x62\x6C\x65\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0x3c33[0];var _=require(_0x3c33[1]);var IntegrationModel=require(_0x3c33[3])[_0x3c33[2]];var Variable=require(_0x3c33[3])[_0x3c33[4]];var Zendesk=require(_0x3c33[5]);function Integration(_0xffc1x6){console[_0x3c33[7]](_0x3c33[6]);var _0xffc1x7= new Zendesk();var _0xffc1x8=[];var _0xffc1x9=[];var _0xffc1xa={};_0xffc1x6[_0x3c33[17]](_0x3c33[8],function(_0xffc1xb){if(!_0xffc1xa[_0x3c33[10]](_0xffc1xb[_0x3c33[9]])){_0xffc1xa[_0xffc1xb[_0x3c33[9]]]=[]};if(_0xffc1xb[_0x3c33[10]](_0x3c33[11])&&_0xffc1xb[_0x3c33[10]](_0x3c33[12])){var _0xffc1xc=_[_0x3c33[15]](_0xffc1x9,{"\x6E\x61\x6D\x65":_[_0x3c33[14]](_[_0x3c33[13]](_0xffc1xb[_0x3c33[11]]))});if(_0xffc1xc>=0){var _0xffc1xd={name:_[_0x3c33[14]](_[_0x3c33[13]](_0xffc1xb[_0x3c33[11]])),value:_0xffc1xb[_0x3c33[12]]};_0xffc1xa[_0xffc1xb[_0x3c33[9]]][_0x3c33[16]](_0xffc1xd)}}});Variable[_0x3c33[19]]()[_0x3c33[18]](function(_0xffc1xe){_0xffc1x9=_0xffc1xe;synchVariables(_0xffc1x9)});IntegrationModel[_0x3c33[19]]({where:{active:1}})[_0x3c33[18]](function(_0xffc1xf){_0xffc1x8=_0xffc1xf;synchIntegrations(_0xffc1x8)});this[_0x3c33[20]]=function(_0xffc1x10,_0xffc1x11,_0xffc1x12){console[_0x3c33[7]](_0x3c33[21]);if(integrationIsActive(_0xffc1x10[_0x3c33[22]],_0xffc1x8)){switch(_0xffc1x10[_0x3c33[22]]){case _0x3c33[27]:_0xffc1x7[_0x3c33[26]](_0xffc1x10[_0x3c33[23]],_0xffc1x10[_0x3c33[24]],_0xffc1x12,_0xffc1x11,_[_0x3c33[25]](_0xffc1xa,_0xffc1x11[_0x3c33[9]]));break;default:console[_0x3c33[7]](_0x3c33[28],_0xffc1x10[_0x3c33[22]])}}}}function integrationIsActive(_0xffc1x14,_0xffc1x15){var _0xffc1x16=_[_0x3c33[30]](_0xffc1x15,_0x3c33[29]);if(_[_0x3c33[31]](_0xffc1x16,_0xffc1x14)>=0){return true};return false}function synchIntegrations(_0xffc1x15){IntegrationModel[_0x3c33[37]](function(_0xffc1x11){if(_0xffc1x11[_0x3c33[32]]){updateCollection(_0xffc1x15,_0xffc1x11)}else {_[_0x3c33[34]](_0xffc1x15,{id:_0xffc1x11[_0x3c33[33]]})};console[_0x3c33[7]](_0x3c33[35],_0xffc1x15[_0x3c33[36]])})}function synchVariables(_0xffc1x15){Variable[_0x3c33[39]](function(_0xffc1x11){updateCollection(_0xffc1x15,_0xffc1x11);console[_0x3c33[7]](_0x3c33[38],_0xffc1x15[_0x3c33[36]])});Variable[_0x3c33[37]](function(_0xffc1x11){updateCollection(_0xffc1x15,_0xffc1x11);console[_0x3c33[7]](_0x3c33[40],_0xffc1x15[_0x3c33[36]])});Variable[_0x3c33[42]](function(_0xffc1x11){_[_0x3c33[34]](_0xffc1x15,{id:_0xffc1x11[_0x3c33[33]]});console[_0x3c33[7]](_0x3c33[41],_0xffc1x15[_0x3c33[36]])})}function updateCollection(_0xffc1x1a,_0xffc1x11){var _0xffc1x1b=_[_0x3c33[43]](_0xffc1x1a,{id:_0xffc1x11[_0x3c33[33]]});var _0xffc1xc=_0xffc1x1a[_0x3c33[31]](_0xffc1x1b);if(_0xffc1x1b){_[_0x3c33[44]](_0xffc1x1a[_0xffc1xc],_0xffc1x11)}else {_0xffc1x1a[_0x3c33[45]](_0xffc1x11)}}module[_0x3c33[46]]=Integration \ No newline at end of file +'use strict'; + +// Library +var _ = require('lodash'); +// Models +var IntegrationModel = require('../../models').Integration; +var Variable = require('../../models').Variable; +// Integration service +var Zendesk = require('./zendesk'); + +function Integration(ami) { + console.log('Trigger Integration Initialization...'); + + var zendesk = new Zendesk(); + + var activeIntegrations = []; + var activeVariables = []; + var channelVariables = {}; + + ami.on('varset', function(evt) { + if (!channelVariables.hasOwnProperty(evt.uniqueid)) { + channelVariables[evt.uniqueid] = []; + } + if (evt.hasOwnProperty('variable') && evt.hasOwnProperty('value')) { + var index = _.findIndex(activeVariables, { + 'name': _.head(_.keys(evt.variable)) + }); + if (index >= 0) { + var variable = { + name: _.head(_.keys(evt.variable)), + value: evt.value + }; + channelVariables[evt.uniqueid].push(variable); + } + } + }); + + Variable + .findAll() + .then(function(variables) { + activeVariables = variables; + synchVariables(activeVariables); + }) + + IntegrationModel + .findAll({ + where: { + active: 1 + } + }) + .then(function(integrations) { + activeIntegrations = integrations; + synchIntegrations(activeIntegrations); + }); + + this.manageEvent = function(rule, doc, channel) { + console.log('Integration: manageEvent'); + if (integrationIsActive(rule.data1, activeIntegrations)) { + switch (rule.data1) { + case 'zendesk': + zendesk.handleEvent(rule.data2, rule.data3, channel, doc, _.result(channelVariables, doc.uniqueid)); + break; + default: + console.log('Integration not recognized: ', rule.data1); + } + } + } +} + +function integrationIsActive(integration, active) { + var integratioNames = _.map(active, 'state'); + if (_.indexOf(integratioNames, integration) >= 0) { + return true; + } + return false; +} + +function synchIntegrations(active) { + IntegrationModel.afterUpdate(function(doc) { + if (doc.active) { + updateCollection(active, doc); + } else { + _.remove(active, { + id: doc.id + }); + } + console.log('After update, integrations are ', active.length); + }); +} + +function synchVariables(active) { + Variable.afterCreate(function(doc) { + updateCollection(active, doc); + console.log('After create, Variables are ', active.length); + }); + Variable.afterUpdate(function(doc) { + updateCollection(active, doc); + console.log('After update, Variables are ', active.length); + }); + Variable.afterDestroy(function(doc) { + _.remove(active, { + id: doc.id + }); + console.log('After destroy, Variables are ', active.length); + }); +} + +function updateCollection(collection, doc) { + var oldItem = _.find(collection, { + id: doc.id + }); + var index = collection.indexOf(oldItem); + if (oldItem) { + _.merge(collection[index], doc); + } else { + collection.unshift(doc); + } +} + +module.exports = Integration; diff --git a/server/config/integrations/zendesk.js b/server/config/integrations/zendesk.js index ccbbc41..5abebe0 100644 --- a/server/config/integrations/zendesk.js +++ b/server/config/integrations/zendesk.js @@ -1 +1,530 @@ -var _0xd9ba=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x5A\x65\x6E\x64\x65\x73\x6B\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x5A\x65\x6E\x64\x65\x73\x6B\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x50\x61\x73\x73\x65\x64\x20\x70\x61\x72\x61\x6D\x65\x74\x65\x72\x73\x20\x61\x72\x65\x20\x6E\x6F\x74\x20\x65\x6E\x6F\x75\x67\x68\x20\x74\x6F\x20\x63\x72\x65\x61\x74\x65\x20\x61\x20\x6E\x65\x77\x20\x74\x69\x63\x6B\x65\x74\x3A\x20\x6D\x69\x73\x73\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64\x20\x6F\x72\x20\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x49\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x75\x72\x69","\x68\x65\x61\x64\x65\x72\x73","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6A\x73\x6F\x6E","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x61\x75\x74\x68\x54\x79\x70\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x3A","\x74\x6F\x6B\x65\x6E","\x2F\x74\x6F\x6B\x65\x6E\x3A","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x61\x73\x69\x63\x20","\x62\x61\x73\x65\x36\x34","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x2F\x73\x65\x61\x72\x63\x68\x2E\x6A\x73\x6F\x6E","\x74\x79\x70\x65\x3A\x75\x73\x65\x72\x20\x72\x6F\x6C\x65\x3A\x61\x67\x65\x6E\x74\x20\x6E\x61\x6D\x65\x3A\x25\x73","\x66\x6F\x72\x6D\x61\x74","","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x76\x6F\x69\x63\x65","\x43\x68\x61\x6E\x6E\x65\x6C\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A","\x72\x65\x73\x75\x6C\x74","\x6C\x65\x6E\x67\x74\x68","\x72\x65\x73\x75\x6C\x74\x73","\x63\x6F\x75\x6E\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x61\x67\x65\x6E\x74","\x6E\x61\x6D\x65","\x66\x69\x72\x73\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2E\x20\x55\x73\x65\x20\x74\x68\x65\x20\x61\x64\x6D\x69\x6E\x20\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x75\x73\x65\x72\x73\x2F\x6D\x65\x2E\x6A\x73\x6F\x6E","\x75\x73\x65\x72","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x64\x6D\x69\x6E\x20\x73\x65\x6C\x65\x63\x74\x65\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x74\x79\x70\x65\x3A\x75\x73\x65\x72\x20\x72\x6F\x6C\x65\x3A\x65\x6E\x64\x2D\x75\x73\x65\x72\x20\x25\x73\x3A\x25\x73","\x70\x68\x6F\x6E\x65","\x64\x65\x73\x74\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x64\x65\x73\x74\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x61\x6D\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x66\x6F\x75\x6E\x64\x3A","\x65\x6E\x64\x75\x73\x65\x72","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x2F\x75\x73\x65\x72\x73\x2E\x6A\x73\x6F\x6E","\x50\x4F\x53\x54","\x65\x6E\x64\x2D\x75\x73\x65\x72","\x43\x61\x6C\x6C\x65\x72\x20\x2D\x20\x25\x73","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x63\x72\x65\x61\x74\x65\x64\x3A\x20","\x69\x64","\x76\x61\x6C\x75\x65","\x66\x6F\x72\x45\x61\x63\x68","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x62\x6F\x64\x79\x3A","\x2F\x74\x69\x63\x6B\x65\x74\x73\x2E\x6A\x73\x6F\x6E","\x54\x61\x67\x73","\x6D\x61\x70","\x53\x75\x62\x6A\x65\x63\x74","\x73\x6F\x72\x74\x42\x79","\x74\x79\x70\x65","\x73\x74\x72\x69\x6E\x67","\x63\x6F\x6E\x74\x65\x6E\x74","\x70\x75\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x4E\x61\x6D\x65","\x63\x75\x73\x74\x6F\x6D\x56\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x69\x61\x62\x6C\x65","\x20","\x6A\x6F\x69\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6B\x65\x79\x56\x61\x6C\x75\x65","\x6B\x65\x79\x54\x79\x70\x65","\x25\x73\x3A\x20\x25\x73","\x6B\x65\x79","\x6B\x65\x79\x43\x6F\x6E\x74\x65\x6E\x74","\x0A","\x46\x69\x65\x6C\x64","\x66\x69\x6C\x74\x65\x72","\x69\x64\x46\x69\x65\x6C\x64","\x6E\x61\x6D\x65\x46\x69\x65\x6C\x64","\x74\x69\x63\x6B\x65\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x2F\x63\x68\x61\x6E\x6E\x65\x6C\x73\x2F\x76\x6F\x69\x63\x65\x2F\x61\x67\x65\x6E\x74\x73\x2F\x25\x64\x2F\x74\x69\x63\x6B\x65\x74\x73\x2F\x25\x64\x2F\x64\x69\x73\x70\x6C\x61\x79\x2E\x6A\x73\x6F\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x7A\x65\x6E\x64\x65\x73\x6B","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x65\x78\x69\x74\x53\x74\x61\x74\x75\x73","\x73\x75\x63\x63\x65\x73\x73","\x74\x69\x63\x6B\x65\x74\x49\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64","\x63\x72\x65\x61\x74\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x25\x64\x20\x64\x69\x73\x70\x6C\x61\x79\x65\x64\x20\x74\x6F\x20\x61\x67\x65\x6E\x74\x20\x25\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x74\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\x66\x61\x69\x6C\x65\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x52\x65\x70\x6F\x72\x74\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65","\x73\x75\x62\x73\x74\x72","\x2F","\x65\x78\x70\x6F\x72\x74\x73"];_0xd9ba[0];var _=require(_0xd9ba[1]);var util=require(_0xd9ba[2]);var rp=require(_0xd9ba[3]);var ZendeskIntegration=require(_0xd9ba[5])[_0xd9ba[4]];var ZendeskConfiguration=require(_0xd9ba[5])[_0xd9ba[6]];var ReportIntegration=require(_0xd9ba[5])[_0xd9ba[7]];function Zendesk(){console[_0xd9ba[9]](_0xd9ba[8])}Zendesk[_0xd9ba[11]][_0xd9ba[10]]=function(_0x3276x8,_0x3276x9,_0x3276xa,_0x3276xb,_0x3276xc){var _0x3276xd={uri:undefined,headers:undefined,agent:undefined,enduser:undefined,ticket:undefined,configuration:undefined};if(!_0x3276x8|| !_0x3276x9){console[_0xd9ba[13]](_0xd9ba[12]);return};ZendeskConfiguration[_0xd9ba[16]]({where:{id:_0x3276x9,AccountId:_0x3276x8},include:[{all:true,include:[{all:true}]}]})[_0xd9ba[15]](handleEntityNotFound())[_0xd9ba[15]](handleConnection(_0x3276xd))[_0xd9ba[15]](searchAgent(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](handleAgent(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](searchAdmin(_0x3276xd))[_0xd9ba[15]](handleAdmin(_0x3276xd))[_0xd9ba[15]](searchEndUser(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](handleEndUser(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](endUserCreation(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](handleEndUserCreation(_0x3276xd,_0x3276xa,_0x3276xb))[_0xd9ba[15]](ticketCreation(_0x3276xd,_0x3276xb,_0x3276xc))[_0xd9ba[15]](handleTicketDisplay(_0x3276xd))[_0xd9ba[15]](handleReportIntegration(_0x3276xd,_0x3276xa,_0x3276xb,_0x3276x8))[_0xd9ba[15]](handleEnd(_0x3276xd))[_0xd9ba[14]](handleError(_0x3276xd,_0x3276xa,_0x3276xb,_0x3276x8))};function handleEntityNotFound(){return function(_0x3276xf){if(!_0x3276xf){return null};return _0x3276xf}}function handleConnection(_0x3276xd){return function(_0x3276x11){var _0x3276x12=getAccountConfiguration(_0x3276x11.ZendeskAccount);_0x3276xd[_0xd9ba[17]]=_0x3276x11;_0x3276xd[_0xd9ba[18]]=_0x3276x12[_0xd9ba[18]];_0x3276xd[_0xd9ba[19]]=_0x3276x12[_0xd9ba[19]]}}function getAccountConfiguration(_0x3276x14){var _0x3276x15={uri:stripTrailingSlash(_0x3276x14[_0xd9ba[20]]),headers:{"\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E":undefined,"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0xd9ba[21],"\x41\x63\x63\x65\x70\x74":_0xd9ba[21]}};var _0x3276x16=_0x3276x14[_0xd9ba[22]];if(_0x3276x14[_0xd9ba[23]]===_0xd9ba[24]){_0x3276x16=_0x3276x16+_0xd9ba[25]+_0x3276x14[_0xd9ba[24]]}else {if(_0x3276x14[_0xd9ba[23]]===_0xd9ba[26]){_0x3276x16=_0x3276x16+_0xd9ba[27]+_0x3276x14[_0xd9ba[26]]}};_0x3276x15[_0xd9ba[19]][_0xd9ba[28]]=_0xd9ba[29]+ new Buffer(_0x3276x16).toString(_0xd9ba[30]);return _0x3276x15}function searchAgent(_0x3276xd,_0x3276xa,_0x3276xb){return function(){console[_0xd9ba[9]](_0xd9ba[31],getValueFromPropertyName(_0x3276xb,getAgentSearchPropertyFromChannel(_0x3276xa)));return rp({uri:_0x3276xd[_0xd9ba[18]]+_0xd9ba[32],qs:{"\x71\x75\x65\x72\x79":util[_0xd9ba[34]](_0xd9ba[33],getValueFromPropertyName(_0x3276xb,getAgentSearchPropertyFromChannel(_0x3276xa)))},headers:_0x3276xd[_0xd9ba[19]],json:true})}}function getAgentSearchPropertyFromChannel(_0x3276xa){var _0x3276x19=_0xd9ba[35];if(_0x3276xa){switch(_0x3276xa){case _0xd9ba[37]:_0x3276x19=_0xd9ba[36];break;default:_0x3276x19=_0xd9ba[36];console[_0xd9ba[13]](_0xd9ba[38],_0x3276xa)}};return _0x3276x19}function getValueFromPropertyName(_0x3276xb,_0x3276x19){return _[_0xd9ba[39]](_0x3276xb,_0x3276x19)}function handleAgent(_0x3276xd,_0x3276xa,_0x3276x1c){return function(_0x3276xb){if(_0x3276xb[_0xd9ba[41]][_0xd9ba[40]]>0&&_0x3276xb[_0xd9ba[42]]>0){console[_0xd9ba[9]](_0xd9ba[43],getValueFromPropertyName(_0x3276x1c,getAgentSearchPropertyFromChannel(_0x3276xa)));_0x3276xd[_0xd9ba[44]]=getMatchObject(_0x3276xb[_0xd9ba[41]],_0xd9ba[45],getValueFromPropertyName(_0x3276x1c,getAgentSearchPropertyFromChannel(_0x3276xa)));return _0x3276xd[_0xd9ba[44]]};return}}function getMatchObject(_0x3276x1e,_0x3276x19,_0x3276x1f){var _0x3276x20=_[_0xd9ba[16]](_0x3276x1e,{property:_0x3276x1f});if(_0x3276x20){return _0x3276x20};return _[_0xd9ba[46]](_0x3276x1e)}function searchAdmin(_0x3276xd){return function(_0x3276xb){if(_0x3276xb){return};console[_0xd9ba[9]](_0xd9ba[47]);return rp({uri:_0x3276xd[_0xd9ba[18]]+_0xd9ba[48],headers:_0x3276xd[_0xd9ba[19]],json:true})}}function handleAdmin(_0x3276xd){return function(_0x3276xb){if(!_0x3276xb){return};if(_0x3276xb[_0xd9ba[49]]){console[_0xd9ba[9]](_0xd9ba[50]);_0x3276xd[_0xd9ba[44]]=_0x3276xb[_0xd9ba[49]]};return}}function searchEndUser(_0x3276xd,_0x3276xa,_0x3276xb){return function(){console[_0xd9ba[9]](_0xd9ba[51],getValueFromPropertyName(_0x3276xb,getEndUserSearchPropertyFromChannel(_0x3276xa)));return rp({uri:_0x3276xd[_0xd9ba[18]]+_0xd9ba[32],qs:{"\x71\x75\x65\x72\x79":util[_0xd9ba[34]](_0xd9ba[52],getEndUserSearchQueryFromChannel(_0x3276xa),getValueFromPropertyName(_0x3276xb,getEndUserSearchPropertyFromChannel(_0x3276xa)))},headers:_0x3276xd[_0xd9ba[19]],json:true})}}function getEndUserSearchQueryFromChannel(_0x3276xa){var _0x3276x19=_0xd9ba[35];if(_0x3276xa){switch(_0x3276xa){case _0xd9ba[37]:_0x3276x19=_0xd9ba[53];break;default:_0x3276x19=_0xd9ba[53];console[_0xd9ba[13]](_0xd9ba[38],_0x3276xa)}};return _0x3276x19}function getEndUserSearchPropertyFromChannel(_0x3276xa){var _0x3276x19=_0xd9ba[35];if(_0x3276xa){switch(_0x3276xa){case _0xd9ba[37]:_0x3276x19=_0xd9ba[54];break;default:_0x3276x19=_0xd9ba[54];console[_0xd9ba[13]](_0xd9ba[38],_0x3276xa)}};return _0x3276x19}function getEndUserNamePropertyFromChannel(_0x3276xa){var _0x3276x19=_0xd9ba[35];if(_0x3276xa){switch(_0x3276xa){case _0xd9ba[37]:_0x3276x19=_0xd9ba[55];break;default:_0x3276x19=_0xd9ba[55];console[_0xd9ba[13]](_0xd9ba[38],_0x3276xa)}};return _0x3276x19}function handleEndUser(_0x3276xd,_0x3276xa,_0x3276x1c){return function(_0x3276xb){if(_0x3276xb[_0xd9ba[41]][_0xd9ba[40]]>0&&_0x3276xb[_0xd9ba[42]]>0){console[_0xd9ba[9]](_0xd9ba[56],getValueFromPropertyName(_0x3276x1c,getEndUserSearchPropertyFromChannel(_0x3276xa)));_0x3276xd[_0xd9ba[57]]=_0x3276xb[_0xd9ba[41]][0];return _0x3276xd[_0xd9ba[57]]};return}}function endUserCreation(_0x3276xd,_0x3276xa,_0x3276x1c){return function(_0x3276xb){if(_0x3276xb){return};console[_0xd9ba[9]](_0xd9ba[58],getValueFromPropertyName(_0x3276x1c,getEndUserSearchPropertyFromChannel(_0x3276xa)));console[_0xd9ba[9]](getJsonForEndUserCreation(_0x3276xa,_0x3276x1c));return rp({uri:_0x3276xd[_0xd9ba[18]]+_0xd9ba[59],method:_0xd9ba[60],body:{user:getJsonForEndUserCreation(_0x3276xa,_0x3276x1c)},headers:_0x3276xd[_0xd9ba[19]],json:true})}}function getJsonForEndUserCreation(_0x3276xa,_0x3276xb){var _0x3276x2a={role:_0xd9ba[61]};switch(_0x3276xa){case _0xd9ba[37]:if(_0x3276xb[_0xd9ba[55]]){_0x3276x2a[_0xd9ba[45]]=getValueFromPropertyName(_0x3276xb,getEndUserNamePropertyFromChannel(_0x3276xa))}else {_0x3276x2a[_0xd9ba[45]]=util[_0xd9ba[34]](_0xd9ba[62],getValueFromPropertyName(_0x3276xb,getAgentSearchPropertyFromChannel(_0x3276xa)))};_0x3276x2a[_0xd9ba[53]]=getValueFromPropertyName(_0x3276xb,getEndUserSearchPropertyFromChannel(_0x3276xa));break;default:console[_0xd9ba[13]](_0xd9ba[38],_0x3276xa)};return _0x3276x2a}function handleEndUserCreation(_0x3276xd,_0x3276xa,_0x3276x1c){return function(_0x3276xb){if(!_0x3276xb){return};if(_0x3276xb[_0xd9ba[49]]){console[_0xd9ba[9]](_0xd9ba[63],getValueFromPropertyName(_0x3276x1c,getEndUserSearchPropertyFromChannel(_0x3276xa)));_0x3276xd[_0xd9ba[57]]=_0x3276xb[_0xd9ba[49]]};return}}function ticketCreation(_0x3276xd,_0x3276x1c,_0x3276xc){return function(){var _0x3276x2d={requester_id:_0x3276xd[_0xd9ba[44]][_0xd9ba[64]],submitter_id:_0x3276xd[_0xd9ba[57]][_0xd9ba[64]],assignee_id:_0x3276xd[_0xd9ba[57]][_0xd9ba[64]],tags:createTagsFromConfiguration(_0x3276xd),subject:createSubjectFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc),description:createDescriptionFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc),custom_fields:createCustomFieldsFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc)};var _0x3276x2e=createFieldsFromConfiguration(_0x3276xd);if(_0x3276x2e[_0xd9ba[40]]>0){_[_0xd9ba[66]](_0x3276x2e,function(_0x3276x2f){_0x3276x2d[_0x3276x2f[_0xd9ba[64]]]=_0x3276x2f[_0xd9ba[65]]})};console[_0xd9ba[9]](_0xd9ba[67],_0x3276x2d);return rp({uri:_0x3276xd[_0xd9ba[18]]+_0xd9ba[68],method:_0xd9ba[60],body:{ticket:_0x3276x2d},headers:_0x3276xd[_0xd9ba[19]],json:true})}}function createTagsFromConfiguration(_0x3276xd){var _0x3276x31=[];if(_0x3276xd[_0xd9ba[17]][_0xd9ba[69]][_0xd9ba[40]]>0){_0x3276x31=_[_0xd9ba[70]](_0x3276xd[_0xd9ba[17]].Tags,_0xd9ba[45])};return _0x3276x31}function createSubjectFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc){var _0x3276x33=_0xd9ba[35];var _0x3276x34=[];if(_0x3276xd[_0xd9ba[17]][_0xd9ba[71]][_0xd9ba[40]]>0){var _0x3276x35=_[_0xd9ba[72]](_0x3276xd[_0xd9ba[17]].Subject,[_0xd9ba[64]]);_[_0xd9ba[66]](_0x3276x35,function(_0x3276x36){if(_0x3276x36[_0xd9ba[73]]===_0xd9ba[74]){_0x3276x34[_0xd9ba[76]](_0x3276x36[_0xd9ba[75]])}else {if(_0x3276x36[_0xd9ba[73]]===_0xd9ba[77]&&_0x3276x36[_0xd9ba[78]]){var _0x3276x37=getValueFromPropertyName(_0x3276x1c,_0x3276x36[_0xd9ba[78]]);if(_0x3276x37){_0x3276x34[_0xd9ba[76]](_0x3276x37.toString())}}else {if(_0x3276x36[_0xd9ba[73]]===_0xd9ba[79]){var _0x3276x38=_[_0xd9ba[16]](_0x3276xc,{"\x6E\x61\x6D\x65":_0x3276x36[_0xd9ba[80]][_0xd9ba[45]]});if(_0x3276x38){_0x3276x34[_0xd9ba[76]](_0x3276x38[_0xd9ba[65]].toString())}}}}});_0x3276x33=_0x3276x34[_0xd9ba[82]](_0xd9ba[81])};return _0x3276x33}function createDescriptionFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc){var _0x3276x3a=_0xd9ba[35];var _0x3276x34=[];if(_0x3276xd[_0xd9ba[17]][_0xd9ba[83]][_0xd9ba[40]]>0){var _0x3276x3b=_[_0xd9ba[72]](_0x3276xd[_0xd9ba[17]].Description,[_0xd9ba[64]]);_[_0xd9ba[66]](_0x3276x3b,function(_0x3276x36){if(_0x3276x36[_0xd9ba[73]]===_0xd9ba[74]){_0x3276x34[_0xd9ba[76]](_0x3276x36[_0xd9ba[75]])}else {if(_0x3276x36[_0xd9ba[73]]===_0xd9ba[84]){if(_0x3276x36[_0xd9ba[85]]===_0xd9ba[74]){_0x3276x34[_0xd9ba[76]](util[_0xd9ba[34]](_0xd9ba[86],_0x3276x36[_0xd9ba[87]],_0x3276x36[_0xd9ba[88]]))}else {if(_0x3276x36[_0xd9ba[85]]===_0xd9ba[77]&&_0x3276x36[_0xd9ba[78]]){var _0x3276x37=getValueFromPropertyName(_0x3276x1c,_0x3276x36[_0xd9ba[78]]);if(_0x3276x37){_0x3276x34[_0xd9ba[76]](util[_0xd9ba[34]](_0xd9ba[86],_0x3276x36[_0xd9ba[87]],_0x3276x37.toString()))}}else {if(_0x3276x36[_0xd9ba[85]]===_0xd9ba[79]){var _0x3276x38=_[_0xd9ba[16]](_0x3276xc,{"\x6E\x61\x6D\x65":_0x3276x36[_0xd9ba[80]][_0xd9ba[45]]});if(_0x3276x38){_0x3276x34[_0xd9ba[76]](util[_0xd9ba[34]](_0xd9ba[86],_0x3276x36[_0xd9ba[87]],_0x3276x38[_0xd9ba[65]].toString()))}}}}}}});_0x3276x3a=_0x3276x34[_0xd9ba[82]](_0xd9ba[89])};return _0x3276x3a}function createCustomFieldsFromConfiguration(_0x3276xd,_0x3276x1c,_0x3276xc){var _0x3276x3d=[];var _0x3276x3e=[];if(_0x3276xd[_0xd9ba[17]][_0xd9ba[90]][_0xd9ba[40]]>0){_0x3276x3d=_[_0xd9ba[91]](_0x3276xd[_0xd9ba[17]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":true});_[_0xd9ba[66]](_0x3276x3d,function(_0x3276x2f){if(_0x3276x2f[_0xd9ba[73]]===_0xd9ba[74]){_0x3276x3e[_0xd9ba[76]]({id:_0x3276x2f[_0xd9ba[92]],value:_0x3276x2f[_0xd9ba[75]]})}else {if(_0x3276x2f[_0xd9ba[73]]===_0xd9ba[77]){var _0x3276x37=getValueFromPropertyName(_0x3276x1c,_0x3276x2f[_0xd9ba[78]]);if(_0x3276x37){_0x3276x3e[_0xd9ba[76]]({id:_0x3276x2f[_0xd9ba[92]],value:_0x3276x37.toString()})}}else {if(_0x3276x2f[_0xd9ba[73]]===_0xd9ba[79]){var _0x3276x38=_[_0xd9ba[16]](_0x3276xc,{"\x6E\x61\x6D\x65":_0x3276x2f[_0xd9ba[80]][_0xd9ba[45]]});if(_0x3276x38){_0x3276x3e[_0xd9ba[76]]({id:_0x3276x2f[_0xd9ba[92]],value:_0x3276x38[_0xd9ba[65]].toString()})}}}}})};return _0x3276x3e}function createFieldsFromConfiguration(_0x3276xd){var _0x3276x2e=[];var _0x3276x3e=[];if(_0x3276xd[_0xd9ba[17]][_0xd9ba[90]][_0xd9ba[40]]>0){_0x3276x2e=_[_0xd9ba[91]](_0x3276xd[_0xd9ba[17]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":false});_[_0xd9ba[66]](_0x3276x2e,function(_0x3276x2f){if(_0x3276x2f[_0xd9ba[73]]===_0xd9ba[74]){_0x3276x3e[_0xd9ba[76]]({id:_0x3276x2f[_0xd9ba[93]],value:_0x3276x2f[_0xd9ba[75]]})}})};return _0x3276x3e}function handleTicketDisplay(_0x3276xd){return function(_0x3276xb){if(_0x3276xb[_0xd9ba[94]]){console[_0xd9ba[9]](_0xd9ba[95]);_0x3276xd[_0xd9ba[94]]=_0x3276xb[_0xd9ba[94]];var _0x3276x41=util[_0xd9ba[34]](_0xd9ba[96],_0x3276xd[_0xd9ba[44]][_0xd9ba[64]],_0x3276xd[_0xd9ba[94]][_0xd9ba[64]]);return rp({uri:_0x3276xd[_0xd9ba[18]]+_0x3276x41,method:_0xd9ba[60],headers:_0x3276xd[_0xd9ba[19]],json:true})};return}}function handleReportIntegration(_0x3276xd,_0x3276xa,_0x3276xb,_0x3276x8){return function(){_0x3276xb=_0x3276xb[_0xd9ba[97]];delete _0x3276xb[_0xd9ba[64]];_0x3276xb[_0xd9ba[98]]=_0xd9ba[99];_0x3276xb[_0xd9ba[100]]=_0x3276xa;_0x3276xb[_0xd9ba[101]]=_0xd9ba[102];_0x3276xb[_0xd9ba[103]]=_0x3276xd[_0xd9ba[94]][_0xd9ba[64]];_0x3276xb[_0xd9ba[104]]=_0x3276x8;return ReportIntegration[_0xd9ba[105]](_0x3276xb)}}function handleEnd(_0x3276xd,_0x3276xb,_0x3276xa){return function(){console[_0xd9ba[9]](util[_0xd9ba[34]](_0xd9ba[106],_0x3276xd[_0xd9ba[94]][_0xd9ba[64]],_0x3276xd[_0xd9ba[44]][_0xd9ba[64]]));_0x3276xd=undefined;return}}function handleError(_0x3276xd,_0x3276xa,_0x3276xb,_0x3276x8){return function(_0x3276x45){console[_0xd9ba[13]](_0xd9ba[107]);console[_0xd9ba[13]](_0xd9ba[108],_0x3276x45[_0xd9ba[109]]);console[_0xd9ba[13]](_0xd9ba[110],_0x3276x45[_0xd9ba[111]]);_0x3276xd=undefined;delete _0x3276xb[_0xd9ba[64]];_0x3276xb=_0x3276xb[_0xd9ba[97]];_0x3276xb[_0xd9ba[98]]=_0xd9ba[99];_0x3276xb[_0xd9ba[100]]=_0x3276xa;_0x3276xb[_0xd9ba[101]]=_0xd9ba[112];_0x3276xb[_0xd9ba[104]]=_0x3276x8;ReportIntegration[_0xd9ba[105]](_0x3276xb)[_0xd9ba[15]](function(){return})[_0xd9ba[14]](function(_0x3276x45){console[_0xd9ba[13]](_0xd9ba[113]);return})}}function stripTrailingSlash(_0x3276x47){if(_0x3276x47[_0xd9ba[114]](-1)===_0xd9ba[115]){return _0x3276x47[_0xd9ba[114]](0,_0x3276x47[_0xd9ba[40]]-1)};return _0x3276x47}module[_0xd9ba[116]]=Zendesk \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var rp = require('request-promise'); + +var ZendeskIntegration = require('../../models').ZendeskIntegration; +var ZendeskConfiguration = require('../../models').ZendeskConfiguration; +var ReportIntegration = require('../../models').ReportIntegration; + +function Zendesk() { + console.log('Zendesk integration initialization...'); +} + +Zendesk.prototype.handleEvent = function(integrationId, configurationId, channel, data, variables) { + + var zendeskData = { + uri: undefined, + headers: undefined, + agent: undefined, + enduser: undefined, + ticket: undefined, + configuration: undefined + }; + + if (!integrationId || !configurationId) { + console.error('Passed parameters are not enough to create a new ticket: miss IntegrationId or ConfigurationId'); + return; + } + + ZendeskConfiguration + .find({ + where: { + id: configurationId, + AccountId: integrationId + }, + include: [{ + all: true, + include: [{ + all: true + }] + }] + }) + .then(handleEntityNotFound()) + .then(handleConnection(zendeskData)) + .then(searchAgent(zendeskData, channel, data)) + .then(handleAgent(zendeskData, channel, data)) + .then(searchAdmin(zendeskData)) + .then(handleAdmin(zendeskData)) + .then(searchEndUser(zendeskData, channel, data)) + .then(handleEndUser(zendeskData, channel, data)) + .then(endUserCreation(zendeskData, channel, data)) + .then(handleEndUserCreation(zendeskData, channel, data)) + .then(ticketCreation(zendeskData, data, variables)) + .then(handleTicketDisplay(zendeskData)) + .then(handleReportIntegration(zendeskData, channel, data, integrationId)) + .then(handleEnd(zendeskData)) + .catch(handleError(zendeskData, channel, data, integrationId)); + +}; + +function handleEntityNotFound() { + return function(entity) { + if (!entity) { + return null; + } + return entity; + }; +} + +function handleConnection(zendeskData) { + return function(configuration) { + var accConfiguration = getAccountConfiguration(configuration.ZendeskAccount); + zendeskData.configuration = configuration; + zendeskData.uri = accConfiguration.uri; + zendeskData.headers = accConfiguration.headers; + } +} + +function getAccountConfiguration(account) { + var authJson = { + uri: stripTrailingSlash(account.remoteUri), + headers: { + 'Authorization': undefined, + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + }; + var auth = account.username; + if (account.authType === 'password') { + auth = auth + ':' + account.password; + } else if (account.authType === 'token') { + auth = auth + '/token:' + account.token; + } + authJson.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); + return authJson; +} + +function searchAgent(zendeskData, channel, data) { + return function() { + console.log('[Zendesk] Agent to search:', getValueFromPropertyName(data, getAgentSearchPropertyFromChannel(channel))); + return rp({ + uri: zendeskData.uri + '/search.json', + qs: { + // 'query': "type:user role:agent name:Andrea Bianco" + 'query': util.format("type:user role:agent name:%s", getValueFromPropertyName(data, getAgentSearchPropertyFromChannel(channel))) + }, + headers: zendeskData.headers, + json: true + }); + } +} + +function getAgentSearchPropertyFromChannel(channel) { + var property = ''; + if (channel) { + switch (channel) { + case 'voice': + property = 'destcalleridname'; + break; + default: + property = 'destcalleridname'; + console.error('Channel not recognized:', channel); + } + } + return property; +} + +function getValueFromPropertyName(data, property) { + return _.result(data, property); +} + +function handleAgent(zendeskData, channel, event) { + return function(data) { + if (data.results.length > 0 && data.count > 0) { + console.log('[Zendesk] Agent found:', getValueFromPropertyName(event, getAgentSearchPropertyFromChannel(channel))); + zendeskData.agent = getMatchObject(data.results, 'name', getValueFromPropertyName(event, getAgentSearchPropertyFromChannel(channel))); + return zendeskData.agent; + } + return; + } +} + +function getMatchObject(collection, property, valueToSearch) { + var valueFound = _.find(collection, { + property: valueToSearch + }); + if (valueFound) { + return valueFound; + } + return _.first(collection); +} + +function searchAdmin(zendeskData) { + return function(data) { + if (data) { + return; + } + console.log('[Zendesk] Agent not found. Use the admin account'); + return rp({ + uri: zendeskData.uri + '/users/me.json', + headers: zendeskData.headers, + json: true + }); + } +} + +function handleAdmin(zendeskData) { + return function(data) { + if (!data) { + return; + } + if (data.user) { + console.log('[Zendesk] Admin selected'); + zendeskData.agent = data.user; + } + return; + } +} + +function searchEndUser(zendeskData, channel, data) { + return function() { + console.log('[Zendesk] End User to search:', getValueFromPropertyName(data, getEndUserSearchPropertyFromChannel(channel))); + return rp({ + uri: zendeskData.uri + '/search.json', + qs: { + 'query': util.format("type:user role:end-user %s:%s", getEndUserSearchQueryFromChannel(channel), getValueFromPropertyName(data, getEndUserSearchPropertyFromChannel(channel))) + }, + headers: zendeskData.headers, + json: true + }); + } +} + +function getEndUserSearchQueryFromChannel(channel) { + var property = ''; + if (channel) { + switch (channel) { + case 'voice': + property = 'phone'; + break; + default: + property = 'phone'; + console.error('Channel not recognized:', channel); + } + } + return property; +} + +function getEndUserSearchPropertyFromChannel(channel) { + var property = ''; + if (channel) { + switch (channel) { + case 'voice': + // TODO: Change with rigth field name: destconnectedlinenum + property = 'destconnectedlinenum'; + break; + default: + property = 'destconnectedlinenum'; + console.error('Channel not recognized:', channel); + } + } + return property; +} + +function getEndUserNamePropertyFromChannel(channel) { + var property = ''; + if (channel) { + switch (channel) { + case 'voice': + property = 'destconnectedlinename'; + break; + default: + property = 'destconnectedlinename'; + console.error('Channel not recognized:', channel); + } + } + return property; +} + +function handleEndUser(zendeskData, channel, event) { + return function(data) { + if (data.results.length > 0 && data.count > 0) { + console.log('[Zendesk] End User found:', getValueFromPropertyName(event, getEndUserSearchPropertyFromChannel(channel))); + zendeskData.enduser = data.results[0]; + return zendeskData.enduser; + } + return; + } +} + +function endUserCreation(zendeskData, channel, event) { + return function(data) { + if (data) { + return; + } + console.log('[Zendesk] End User not found:', getValueFromPropertyName(event, getEndUserSearchPropertyFromChannel(channel))); + console.log(getJsonForEndUserCreation(channel, event)); + return rp({ + uri: zendeskData.uri + '/users.json', + method: 'POST', + body: { + user: getJsonForEndUserCreation(channel, event) + }, + headers: zendeskData.headers, + json: true + }); + } +} + +function getJsonForEndUserCreation(channel, data) { + var user = { + role: 'end-user' + }; + + switch (channel) { + case 'voice': + if (data.destconnectedlinename) { + user.name = getValueFromPropertyName(data, getEndUserNamePropertyFromChannel(channel)); + } else { + user.name = util.format('Caller - %s', getValueFromPropertyName(data, getAgentSearchPropertyFromChannel(channel))) + } + user.phone = getValueFromPropertyName(data, getEndUserSearchPropertyFromChannel(channel)); + break; + default: + console.error('Channel not recognized:', channel); + } + + return user; +} + +function handleEndUserCreation(zendeskData, channel, event) { + return function(data) { + if (!data) { + return; + } + if (data.user) { + console.log('[Zendesk] End User created: ', getValueFromPropertyName(event, getEndUserSearchPropertyFromChannel(channel))); + zendeskData.enduser = data.user; + } + return; + } +} + +function ticketCreation(zendeskData, event, variables) { + return function() { + var ticketBody = { + //Standard Field + requester_id: zendeskData.agent.id, + submitter_id: zendeskData.enduser.id, + assignee_id: zendeskData.enduser.id, + //Tag + tags: createTagsFromConfiguration(zendeskData), + //Configurated Field + subject: createSubjectFromConfiguration(zendeskData, event, variables), + description: createDescriptionFromConfiguration(zendeskData, event, variables), + custom_fields: createCustomFieldsFromConfiguration(zendeskData, event, variables) + }; + var fields = createFieldsFromConfiguration(zendeskData); + if (fields.length > 0) { + _.forEach(fields, function(item) { + ticketBody[item.id] = item.value; + }); + } + console.log('[Zendesk] Ticket body:', ticketBody); + return rp({ + uri: zendeskData.uri + '/tickets.json', + method: 'POST', + body: { + ticket: ticketBody + }, + headers: zendeskData.headers, + json: true + }); + } +} + +function createTagsFromConfiguration(zendeskData) { + var tags = []; + if (zendeskData.configuration.Tags.length > 0) { + tags = _.map(zendeskData.configuration.Tags, 'name'); + } + return tags; +} + +function createSubjectFromConfiguration(zendeskData, event, variables) { + var subject = ''; + var stringsArray = []; + if (zendeskData.configuration.Subject.length > 0) { + var subjectConfiguration = _.sortBy(zendeskData.configuration.Subject, ['id']); + _.forEach(subjectConfiguration, function(value) { + if (value.type === 'string') { + stringsArray.push(value.content); + } else if (value.type === 'variable' && value.variableName) { + var prop = getValueFromPropertyName(event, value.variableName); + if (prop) { + stringsArray.push(prop.toString()); + } + } else if (value.type === 'customVariable') { + var varFound = _.find(variables, { + 'name': value.Variable.name + }); + if (varFound) { + stringsArray.push(varFound.value.toString()); + } + } + }); + subject = stringsArray.join(' '); + } + return subject; +} + +function createDescriptionFromConfiguration(zendeskData, event, variables) { + var description = ''; + var stringsArray = []; + if (zendeskData.configuration.Description.length > 0) { + var descriptionConfiguration = _.sortBy(zendeskData.configuration.Description, ['id']); + _.forEach(descriptionConfiguration, function(value) { + if (value.type === 'string') { + stringsArray.push(value.content); + } else if (value.type === 'keyValue') { + if (value.keyType === 'string') { + stringsArray.push(util.format('%s: %s', value.key, value.keyContent)); + } else if (value.keyType === 'variable' && value.variableName) { + var prop = getValueFromPropertyName(event, value.variableName); + if (prop) { + stringsArray.push(util.format('%s: %s', value.key, prop.toString())); + } + } else if (value.keyType === 'customVariable') { + var varFound = _.find(variables, { + 'name': value.Variable.name + }); + if (varFound) { + stringsArray.push(util.format('%s: %s', value.key, varFound.value.toString())); + } + } + } + }); + description = stringsArray.join('\n'); + } + return description; +} + +function createCustomFieldsFromConfiguration(zendeskData, event, variables) { + var customFields = []; + var fieldArray = []; + if (zendeskData.configuration.Field.length > 0) { + customFields = _.filter(zendeskData.configuration.Field, { + 'customField': true + }); + _.forEach(customFields, function(item) { + if (item.type === 'string') { + fieldArray.push({ + id: item.idField, + value: item.content + }); + } else if (item.type === 'variable') { + var prop = getValueFromPropertyName(event, item.variableName); + if (prop) { + fieldArray.push({ + id: item.idField, + value: prop.toString() + }); + } + } else if (item.type === 'customVariable') { + var varFound = _.find(variables, { + 'name': item.Variable.name + }); + if (varFound) { + fieldArray.push({ + id: item.idField, + value: varFound.value.toString() + }); + } + } + }); + } + return fieldArray; +} + +function createFieldsFromConfiguration(zendeskData) { + var fields = []; + var fieldArray = []; + if (zendeskData.configuration.Field.length > 0) { + fields = _.filter(zendeskData.configuration.Field, { + 'customField': false + }); + _.forEach(fields, function(item) { + if (item.type === 'string') { + fieldArray.push({ + id: item.nameField, + value: item.content + }); + } + }); + } + return fieldArray; +} + +function handleTicketDisplay(zendeskData) { + return function(data) { + if (data.ticket) { + console.log('[Zendesk] Ticket created'); + zendeskData.ticket = data.ticket; + var urlDisplay = util.format('/channels/voice/agents/%d/tickets/%d/display.json', zendeskData.agent.id, zendeskData.ticket.id); + return rp({ + uri: zendeskData.uri + urlDisplay, + method: 'POST', + headers: zendeskData.headers, + json: true + }); + } + return; + } +} + +function handleReportIntegration(zendeskData, channel, data, integrationId) { + return function() { + data = data.dataValues; + delete data.id; + data.integration = 'zendesk'; + data.eventChannel = channel; + data.exitStatus = 'success'; + data.ticketId = zendeskData.ticket.id; + data.integrationId = integrationId; + return ReportIntegration.create(data); + } +} + +function handleEnd(zendeskData, data, channel) { + return function() { + console.log(util.format('[Zendesk] Ticket %d displayed to agent %d', zendeskData.ticket.id, zendeskData.agent.id)); + zendeskData = undefined; + return; + } +} + +function handleError(zendeskData, channel, data, integrationId) { + return function(err) { + console.error('[Zendesk] Error in ticket creation'); + console.error('[Zendesk] Message:', err.message); + console.error('[Zendesk] Stack:', err.stack); + zendeskData = undefined; + + delete data.id; + data = data.dataValues; + data.integration = 'zendesk'; + data.eventChannel = channel; + data.exitStatus = 'failed'; + data.integrationId = integrationId; + ReportIntegration + .create(data) + .then(function() { + return; + }) + .catch(function(err) { + console.error('[Zendesk] Error in Report integration create'); + return; + }); + } +} + +function stripTrailingSlash(str) { + if (str.substr(-1) === '/') { + return str.substr(0, str.length - 1); + } + return str; +} + +module.exports = Zendesk; diff --git a/server/config/license/index.js b/server/config/license/index.js index c708e99..fb29ba1 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -1 +1,61 @@ -var _0xc076=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x75\x74\x69\x6C","\x75\x72\x6C","\x43\x72\x6F\x6E\x4A\x6F\x62","\x63\x72\x6F\x6E","\x53\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x70\x72\x6F\x76\x69\x73\x69\x6F\x6E\x69\x6E\x67","\x2F\x73\x65\x72\x76\x65\x72\x73\x2F","\x67\x65\x74\x55\x75\x69\x64","\x2F\x63\x68\x65\x63\x6B","\x6C\x6F\x67","\x2A\x20\x2A\x20\x2A\x20\x2A\x20\x2A","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x69\x63\x65\x6E\x73\x65","\x75\x70\x64\x61\x74\x65","\x73\x70\x72\x65\x61\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x73\x74\x61\x72\x74","\x65\x78\x70\x6F\x72\x74\x73"];_0xc076[0];var config=require(_0xc076[1]);var rp=require(_0xc076[2]);var util=require(_0xc076[3]);var url=require(_0xc076[4]);var CronJob=require(_0xc076[6])[_0xc076[5]];var Settings=require(_0xc076[8])[_0xc076[7]];var license=require(_0xc076[9]);var provisioning=config[_0xc076[10]]+_0xc076[11]+license[_0xc076[12]]()+_0xc076[13];console[_0xc076[14]](provisioning);function licenseManager(){var _0x8ff2xa= new CronJob({cronTime:_0xc076[15],onTick:function(){var _0x8ff2xb;return rp({uri:provisioning,json:true})[_0xc076[22]](function(_0x8ff2xe){_0x8ff2xb=_0x8ff2xe;return Settings[_0xc076[21]]({where:{id:1}})})[_0xc076[20]](function(_0x8ff2xd){return _0x8ff2xd[_0xc076[19]]({license:_0x8ff2xb[_0xc076[18]]})})[_0xc076[17]](function(_0x8ff2xc){console[_0xc076[16]](_0x8ff2xc)})},start:false});_0x8ff2xa[_0xc076[23]]();return {}}module[_0xc076[24]]=licenseManager \ No newline at end of file +'use strict'; + +var config = require('../environment'); +var rp = require('request-promise'); +var util = require('util'); +var url = require('url'); +var CronJob = require('cron').CronJob; +var Settings = require('../../models').Settings; +var license = require('./license.service'); + +var provisioning = config.provisioning + '/servers/' + license.getUuid() + '/check'; +console.log(provisioning); + + +// Define the factory +function licenseManager() { + // Store the settings in a closure + var job = new CronJob({ + cronTime: '* * * * *', + onTick: function() { + // console.log('Check License Start'); + var _data; + + return rp({ + uri: provisioning, + json: true // Automatically stringifies the body to JSON + }) + .then(function(data) { + _data = data; + + return Settings + .findOrCreate({ + where: { + id: 1 + } + }); + }) + .spread(function(settings) { + return settings + .update({ + license: _data.license + }); + }) + .catch(function(err) { + console.error(err); + }); + }, + start: false + }); + + job.start(); + return { + + // Define a sync function + // getLicence: function getLicence() { + // return settings; + // }, + }; +} + +module.exports = licenseManager; diff --git a/server/config/license/license.service.js b/server/config/license/license.service.js index a75bece..05c372a 100644 --- a/server/config/license/license.service.js +++ b/server/config/license/license.service.js @@ -1 +1,361 @@ -var _0x89f3=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x6F\x6D\x70\x6F\x73\x61\x62\x6C\x65\x2D\x6D\x69\x64\x64\x6C\x65\x77\x61\x72\x65","\x6D\x6F\x6D\x65\x6E\x74","\x63\x72\x79\x70\x74\x6F","\x75\x74\x69\x6C","\x6F\x73","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x53\x65\x74\x74\x69\x6E\x67\x73","\x44\x45\x4D\x4F\x20\x4C\x49\x43\x45\x4E\x53\x45","\x70\x6C\x61\x74\x66\x6F\x72\x6D","\x6C\x69\x6E\x75\x78","\x6F\x75\x74\x70\x75\x74","\x64\x6D\x69\x64\x65\x63\x6F\x64\x65\x20\x2D\x2D\x73\x74\x72\x69\x6E\x67\x20\x73\x79\x73\x74\x65\x6D\x2D\x75\x75\x69\x64","\x73\x6C\x69\x63\x65","\x0A","\x73\x70\x6C\x69\x74","\x62\x6C\x6B\x69\x64\x20\x2D\x67\x20\x26\x26\x20\x62\x6C\x6B\x69\x64","\x6D\x61\x74\x63\x68","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x65\x78\x65\x63","\x6D\x61\x70","\x75\x75\x69\x64","\x63\x61\x74\x63\x68","\x6C\x69\x63\x65\x6E\x73\x65","\x70\x61\x72\x73\x65","\x63\x68\x61\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x73\x70\x72\x65\x61\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x75\x73\x65","\x6D\x61\x69\x6C","\x66\x61\x78","\x65\x78\x70\x69\x72\x61\x74\x69\x6F\x6E","\x69\x73\x53\x61\x6D\x65\x4F\x72\x42\x65\x66\x6F\x72\x65","\x75\x73\x65\x72\x73","\x4D\x61\x78\x69\x6D\x75\x6D\x20\x75\x73\x65\x72\x73\x20\x6C\x69\x6D\x69\x74\x20\x68\x61\x76\x65\x20\x62\x65\x65\x6E\x20\x72\x65\x61\x63\x68\x65\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x61\x64\x6D\x69\x6E","\x75\x73\x65\x72","\x63\x6F\x75\x6E\x74","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73","\x4D\x61\x78\x69\x6D\x75\x6D\x20\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73\x20\x6C\x69\x6D\x69\x74\x20\x68\x61\x76\x65\x20\x62\x65\x65\x6E\x20\x72\x65\x61\x63\x68\x65\x64","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74","\x6F\x6E\x6C\x69\x6E\x65","\x61\x67\x65\x6E\x74\x73","\x2D","\x61\x65\x73\x2D\x32\x35\x36\x2D\x63\x74\x72","\x25\x73\x3A\x25\x73\x3A\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x63\x72\x65\x61\x74\x65\x44\x65\x63\x69\x70\x68\x65\x72","\x62\x61\x73\x65\x36\x34","\x75\x74\x66\x38","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x61\x6C","\x67\x65\x74\x55\x75\x69\x64","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x69\x73\x55\x73\x65\x72\x73\x4C\x69\x6D\x69\x74","\x69\x73\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73\x4C\x69\x6D\x69\x74","\x68\x61\x73\x43\x68\x61\x74","\x68\x61\x73\x4D\x61\x69\x6C","\x68\x61\x73\x46\x61\x78","\x69\x73\x56\x61\x6C\x69\x64\x41\x67\x65\x6E\x74","\x64\x65\x6D\x6F\x4C\x69\x63\x65\x6E\x73\x65","\x64\x65\x63\x72\x79\x70\x74"];_0x89f3[0];var compose=require(_0x89f3[1]);var moment=require(_0x89f3[2]);var crypto=require(_0x89f3[3]);var util=require(_0x89f3[4]);var os=require(_0x89f3[5]);var config=require(_0x89f3[6]);var User=require(_0x89f3[8])[_0x89f3[7]];var Telephone=require(_0x89f3[8])[_0x89f3[9]];var Settings=require(_0x89f3[8])[_0x89f3[10]];var demoLicense={users:1,agents:1,telephones:0,chat:false,mail:false,fax:false,description:_0x89f3[11]};function getUuid(){if(os[_0x89f3[12]]()!==_0x89f3[13]){var _0x887cxc=exec(_0x89f3[15],{silent:true})[_0x89f3[14]];var _0x887cxd=_0x887cxc[_0x89f3[18]](_0x89f3[17])[_0x89f3[16]](0,-1);return _0x887cxd[0]}else {var _0x887cxc=exec(_0x89f3[19],{silent:true})[_0x89f3[14]];var _0x887cxd=_0x887cxc[_0x89f3[18]](_0x89f3[17])[_0x89f3[16]](0,-1)[_0x89f3[23]](function(_0x887cxe){var _0x887cxf,_0x887cx10,_0x887cxd;_0x887cx10= new RegExp(/(\w+)\=\"([^\"]+)/g);_0x887cxf={partition:_0x887cxe[_0x89f3[20]](/^(\S+)\:\ /)[1]};while(_0x887cxd=_0x887cx10[_0x89f3[22]](_0x887cxe)){_0x887cxf[_0x887cxd[1][_0x89f3[21]]()]=_0x887cxd[2]};return _0x887cxf});return _0x887cxd[0][_0x89f3[24]]}}function hasChat(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){var _0x887cx17=null,_0x887cx18=false;if(_0x887cx16[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx16[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};_0x887cx18=_0x887cx17[_0x89f3[28]];if(!_0x887cx18){return _0x887cx13[_0x89f3[29]](403)};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function hasMail(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){var _0x887cx17=null,_0x887cx1a=false;if(_0x887cx16[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx16[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};_0x887cx1a=_0x887cx17[_0x89f3[33]];if(!_0x887cx1a){return _0x887cx13[_0x89f3[29]](403)};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function hasFax(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){var _0x887cx17=null,_0x887cx1c=false;if(_0x887cx16[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx16[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};_0x887cx1c=_0x887cx17[_0x89f3[34]];if(!_0x887cx1c){return _0x887cx13[_0x89f3[29]](403)};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function isValidDate(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){var _0x887cx17=null,_0x887cx1e=false;if(_0x887cx16[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx16[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17);if(moment()[_0x89f3[36]](_0x887cx17[_0x89f3[35]])){_0x887cx1e=true}};if(!_0x887cx1e){return _0x887cx13[_0x89f3[29]](403)};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function isUsersLimit(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){var _0x887cx20;return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){_0x887cx20=_0x887cx16;return User[_0x89f3[44]]({where:{$or:[{role:_0x89f3[42]},{role:_0x89f3[43]}]}})})[_0x89f3[41]](function(_0x887cx21){var _0x887cx17=null,_0x887cx22=false;if(_0x887cx20[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx20[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};if(_0x887cx17[_0x89f3[37]]>_0x887cx21){_0x887cx22=true};if(!_0x887cx22){return _0x887cx13[_0x89f3[40]](403)[_0x89f3[39]]({message:_0x89f3[38]})};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function isTelephonesLimit(){return compose()[_0x89f3[32]](function(_0x887cx12,_0x887cx13,_0x887cx14){var _0x887cx20;return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){_0x887cx20=_0x887cx16;return User[_0x89f3[44]]({where:{role:_0x89f3[47]}})})[_0x89f3[41]](function(_0x887cx24){var _0x887cx17=null,_0x887cx22=false;if(_0x887cx20[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx20[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};if(_0x887cx17[_0x89f3[45]]>_0x887cx24){_0x887cx22=true};if(!_0x887cx22){return _0x887cx13[_0x89f3[40]](403)[_0x89f3[39]]({message:_0x89f3[46]})};return _0x887cx14()})[_0x89f3[25]](function(_0x887cx15){return _0x887cx14(_0x887cx15)})})}function isValidAgent(){return function(_0x887cx26){var _0x887cx20;var _0x887cx27=false;if(_0x887cx26[_0x89f3[48]]===_0x89f3[42]||_0x887cx26[_0x89f3[48]]===_0x89f3[43]||(_0x887cx26[_0x89f3[48]]===_0x89f3[49]&&_0x887cx26[_0x89f3[50]])){_0x887cx27=true};return Settings[_0x89f3[31]]({where:{id:1}})[_0x89f3[30]](function(_0x887cx16){_0x887cx20=_0x887cx16;return User[_0x89f3[44]]({where:{role:_0x89f3[49],online:true}})})[_0x89f3[41]](function(_0x887cx28){var _0x887cx17=null;if(_0x887cx20[_0x89f3[26]]){_0x887cx17=decrypt(_0x887cx20[_0x89f3[26]]);_0x887cx17=JSON[_0x89f3[27]](_0x887cx17)}else {_0x887cx17=demoLicense};if(_0x887cx17[_0x89f3[51]]>_0x887cx28){_0x887cx27=true};return _0x887cx27})}}function decrypt(_0x887cx2a){var _0x887cx2b=getUuid();var _0x887cx2c=_0x887cx2b[_0x89f3[18]](_0x89f3[52])[4];var _0x887cx2d=_0x887cx2b[_0x89f3[18]](_0x89f3[52])[0];var _0x887cx2e=crypto[_0x89f3[56]](_0x89f3[53],util[_0x89f3[55]](_0x89f3[54],_0x887cx2c,_0x887cx2b,_0x887cx2d));var _0x887cx17=_0x887cx2e[_0x89f3[59]](_0x887cx2a,_0x89f3[57],_0x89f3[58]);_0x887cx17+=_0x887cx2e[_0x89f3[60]](_0x89f3[58]);return _0x887cx17}exports[_0x89f3[61]]=getUuid;exports[_0x89f3[62]]=isValidDate;exports[_0x89f3[63]]=isUsersLimit;exports[_0x89f3[64]]=isTelephonesLimit;exports[_0x89f3[65]]=hasChat;exports[_0x89f3[66]]=hasMail;exports[_0x89f3[67]]=hasFax;exports[_0x89f3[68]]=isValidAgent;exports[_0x89f3[69]]=demoLicense;exports[_0x89f3[70]]=decrypt \ No newline at end of file +'use strict'; + +var compose = require('composable-middleware'); +var moment = require('moment'); +var crypto = require('crypto'); +var util = require('util'); +var os = require('os'); + +var config = require('../environment'); + + +var User = require('../../models').User; +var Telephone = require('../../models').Telephone; +var Settings = require('../../models').Settings; + +var demoLicense = { + users: 1, + agents: 1, + telephones: 0, + chat: false, + mail: false, + fax: false, + description: 'DEMO LICENSE' +}; + +function getUuid() { + if (os.platform() !== 'linux') { + var out = exec('dmidecode --string system-uuid', { + silent: true + }).output; + var result = out.split('\n').slice(0, -1); + return result[0]; + } else { + var out = exec('blkid -g && blkid', { + silent: true + }).output; + var result = out.split('\n').slice(0, -1).map(function(line) { + var part, regex, result; + regex = new RegExp(/(\w+)\=\"([^\"]+)/g); + part = { + partition: line.match(/^(\S+)\:\ /)[1] + }; + while (result = regex.exec(line)) { + part[result[1].toLowerCase()] = result[2]; + } + return part; + }); + return result[0].uuid; + } +} + +/** + * Checks if the chat meets the requirements + */ +function hasChat() { + + return compose() + .use(function(req, res, next) { + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + var license = null, + chat = false; + + if (settings.license) { + license = decrypt(settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + chat = license.chat; + + if (!chat) return res.sendStatus(403); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the mail meets the requirements + */ +function hasMail() { + + return compose() + .use(function(req, res, next) { + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + var license = null, + mail = false; + + if (settings.license) { + license = decrypt(settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + mail = license.mail; + + if (!mail) return res.sendStatus(403); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the fax meets the requirements + */ +function hasFax() { + + return compose() + .use(function(req, res, next) { + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + var license = null, + fax = false; + + if (settings.license) { + license = decrypt(settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + fax = license.fax; + + if (!fax) return res.sendStatus(403); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the date meets the requirements + */ +function isValidDate() { + + return compose() + .use(function(req, res, next) { + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + var license = null, + date = false; + + if (settings.license) { + license = decrypt(settings.license); + license = JSON.parse(license); + + if (moment().isSameOrBefore(license.expiration)) { + date = true; + } + } + + if (!date) return res.sendStatus(403); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the users meets the requirements + */ +function isUsersLimit() { + + return compose() + .use(function(req, res, next) { + var _settings; + + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + _settings = settings; + + return User + .count({ + where: { + $or: [{ + role: 'admin' + }, { + role: 'user' + }] + } + }); + }) + .then(function(users) { + var license = null, + valid = false; + + if (_settings.license) { + license = decrypt(_settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + if (license.users > users) valid = true; + + if (!valid) return res.status(403).send({ + message: 'Maximum users limit have been reached' + }); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the telephone meets the requirements + */ +function isTelephonesLimit() { + + return compose() + .use(function(req, res, next) { + var _settings; + + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + _settings = settings; + + return User + .count({ + where: { + role: 'telephone' + } + }); + }) + .then(function(telephones) { + var license = null, + valid = false; + + if (_settings.license) { + license = decrypt(_settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + if (license.telephones > telephones) valid = true; + + if (!valid) return res.status(403).send({ + message: 'Maximum telephones limit have been reached' + }); + return next(); + }) + .catch(function(err) { + return next(err); + }); + }); +} + +/** + * Checks if the telephone meets the requirements + */ +function isValidAgent() { + return function(user) { + var _settings; + var _valid = false; + + if (user.role === 'admin' || user.role === 'user' || (user.role === 'agent' && user.online)) { + _valid = true; + } + + return Settings + .findOrCreate({ + where: { + id: 1 + } + }) + .spread(function(settings) { + _settings = settings; + + return User + .count({ + where: { + role: 'agent', + online: true + } + }); + }) + .then(function(agents) { + var license = null; + + if (_settings.license) { + license = decrypt(_settings.license); + license = JSON.parse(license); + } else { + license = demoLicense; + } + + if (license.agents > agents) _valid = true; + + return _valid; + }); + } +} + +function decrypt(cypher) { + var uuid = getUuid(); + var prefix = uuid.split('-')[4]; + var suffix = uuid.split('-')[0]; + + var decipher = crypto.createDecipher('aes-256-ctr', util.format('%s:%s:%s', prefix, uuid, suffix)); + var license = decipher.update(cypher, 'base64', 'utf8') + license += decipher.final('utf8'); + + return license; +} + +exports.getUuid = getUuid; +exports.isValidDate = isValidDate; +exports.isUsersLimit = isUsersLimit; +exports.isTelephonesLimit = isTelephonesLimit; +exports.hasChat = hasChat; +exports.hasMail = hasMail; +exports.hasFax = hasFax; +exports.isValidAgent = isValidAgent; +exports.demoLicense = demoLicense; +exports.decrypt = decrypt; diff --git a/server/config/local.env.sample.js b/server/config/local.env.sample.js index 7f8f5f8..58ae668 100644 --- a/server/config/local.env.sample.js +++ b/server/config/local.env.sample.js @@ -1 +1,23 @@ -var _0x6152=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x68\x74\x74\x70\x3A\x2F\x2F\x6C\x6F\x63\x61\x6C\x68\x6F\x73\x74\x3A\x39\x30\x30\x30","\x78\x63\x61\x6C\x6C\x79\x73\x68\x75\x74\x74\x6C\x65\x2D\x73\x65\x63\x72\x65\x74","\x61\x70\x70\x2D\x69\x64","\x73\x65\x63\x72\x65\x74",""];_0x6152[0];module[_0x6152[1]]={DOMAIN:_0x6152[2],SESSION_SECRET:_0x6152[3],FACEBOOK_ID:_0x6152[4],FACEBOOK_SECRET:_0x6152[5],TWITTER_ID:_0x6152[4],TWITTER_SECRET:_0x6152[5],GOOGLE_ID:_0x6152[4],GOOGLE_SECRET:_0x6152[5],DEBUG:_0x6152[6]} \ No newline at end of file +'use strict'; + +// Use local.env.js for environment variables that grunt will set when the server starts locally. +// Use for your api keys, secrets, etc. This file should not be tracked by git. +// +// You will need to set these on the server you deploy to. + +module.exports = { + DOMAIN: 'http://localhost:9000', + SESSION_SECRET: 'xcallyshuttle-secret', + + FACEBOOK_ID: 'app-id', + FACEBOOK_SECRET: 'secret', + + TWITTER_ID: 'app-id', + TWITTER_SECRET: 'secret', + + GOOGLE_ID: 'app-id', + GOOGLE_SECRET: 'secret', + + // Control debug level for modules using visionmedia/debug + DEBUG: '' +}; diff --git a/server/config/logger.js b/server/config/logger.js index 844c4ea..1542f7e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -1 +1,120 @@ -var _0x7f85=["\x77\x69\x6E\x73\x74\x6F\x6E","\x70\x61\x74\x68","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x65\x6D\x69\x74\x45\x72\x72\x73","\x64\x65\x62\x75\x67","\x74\x72\x61\x6E\x73\x70\x6F\x72\x74\x73","\x64\x65\x62\x75\x67\x54\x6F\x46\x69\x6C\x65","\x6C\x6F\x67\x67\x69\x6E\x67","\x64\x65\x62\x75\x67\x2D\x66\x69\x6C\x65","\x61\x64\x64","\x69\x6E\x66\x6F\x2D\x66\x69\x6C\x65","\x69\x6E\x66\x6F","\x77\x61\x72\x6E\x2D\x66\x69\x6C\x65","\x77\x61\x72\x6E","\x65\x72\x72\x6F\x72\x2D\x66\x69\x6C\x65","\x65\x72\x72\x6F\x72","\x65\x78\x70\x6F\x72\x74\x73","\x73\x74\x72\x65\x61\x6D"];var winston=require(_0x7f85[0]);var path=require(_0x7f85[1]);var config=require(_0x7f85[2]);winston[_0x7f85[3]]=true;var debug= new winston.Logger({transports:[ new winston[_0x7f85[5]].Console({level:_0x7f85[4],handleExceptions:true,json:false,colorize:true})]});if(config[_0x7f85[7]][_0x7f85[6]]){debug[_0x7f85[9]](winston[_0x7f85[5]].File,{name:_0x7f85[8],level:_0x7f85[4],filename:config[_0x7f85[7]][_0x7f85[4]],handleExceptions:true,json:true,maxsize:5242880,maxFiles:5,colorize:false})};var info= new winston.Logger({transports:[ new winston[_0x7f85[5]].File({name:_0x7f85[10],level:_0x7f85[11],filename:config[_0x7f85[7]][_0x7f85[11]],handleExceptions:true,json:true,maxsize:5242880,maxFiles:5,colorize:false}), new winston[_0x7f85[5]].Console({level:_0x7f85[11],handleExceptions:true,json:false,colorize:true})]});var warn= new winston.Logger({transports:[ new winston[_0x7f85[5]].File({name:_0x7f85[12],level:_0x7f85[13],filename:config[_0x7f85[7]][_0x7f85[13]],handleExceptions:true,json:true,maxsize:5242880,maxFiles:5,colorize:false}), new winston[_0x7f85[5]].Console({level:_0x7f85[13],handleExceptions:true,json:false,colorize:true})]});var error= new winston.Logger({transports:[ new winston[_0x7f85[5]].File({name:_0x7f85[14],level:_0x7f85[15],filename:config[_0x7f85[7]][_0x7f85[15]],handleExceptions:true,json:true,maxsize:5242880,maxFiles:5,colorize:false}), new winston[_0x7f85[5]].Console({level:_0x7f85[15],handleExceptions:true,json:false,colorize:true})]});var loggers={debug:function(_0xb6d9x9,_0xb6d9xa){debug[_0x7f85[4]](_0xb6d9x9,_0xb6d9xa)},info:function(_0xb6d9x9,_0xb6d9xa){info[_0x7f85[11]](_0xb6d9x9,_0xb6d9xa)},warn:function(_0xb6d9x9,_0xb6d9xa){warn[_0x7f85[13]](_0xb6d9x9,_0xb6d9xa)},error:function(_0xb6d9x9,_0xb6d9xa){error[_0x7f85[15]](_0xb6d9x9,_0xb6d9xa)},log:function(_0xb6d9xb,_0xb6d9x9,_0xb6d9xa){var _0xb6d9xc=exports[_0xb6d9xb];_0xb6d9xc(_0xb6d9x9,_0xb6d9xa)}};module[_0x7f85[16]]=loggers;module[_0x7f85[16]][_0x7f85[17]]={write:function(_0xb6d9xd,_0xb6d9xe){loggers[_0x7f85[11]](_0xb6d9xd)}} \ No newline at end of file +var winston = require('winston'); +var path = require('path'); +var config = require('./environment'); + +winston.emitErrs = true; + +var debug = new winston.Logger({ + transports: [ + new winston.transports.Console({ + level: 'debug', + handleExceptions: true, + json: false, + colorize: true + }) + ] +}); + +if (config.logging.debugToFile) { + debug.add( + winston.transports.File, { + name: 'debug-file', + level: 'debug', + filename: config.logging.debug, + handleExceptions: true, + json: true, + maxsize: 5242880, //5MB + maxFiles: 5, + colorize: false + } + ); +} + +var info = new winston.Logger({ + transports: [ + new winston.transports.File({ + name: 'info-file', + level: 'info', + filename: config.logging.info, + handleExceptions: true, + json: true, + maxsize: 5242880, //5MB + maxFiles: 5, + colorize: false + }), + new winston.transports.Console({ + level: 'info', + handleExceptions: true, + json: false, + colorize: true + }) + ] +}); + +var warn = new winston.Logger({ + transports: [ + new winston.transports.File({ + name: 'warn-file', + level: 'warn', + filename: config.logging.warn, + handleExceptions: true, + json: true, + maxsize: 5242880, //5MB + maxFiles: 5, + colorize: false + }), + new winston.transports.Console({ + level: 'warn', + handleExceptions: true, + json: false, + colorize: true + }) + ] +}); + +var error = new winston.Logger({ + transports: [ + new winston.transports.File({ + name: 'error-file', + level: 'error', + filename: config.logging.error, + handleExceptions: true, + json: true, + maxsize: 5242880, //5MB + maxFiles: 5, + colorize: false + }), + new winston.transports.Console({ + level: 'error', + handleExceptions: true, + json: false, + colorize: true + }) + ] +}); + +var loggers = { + debug: function(msg, callback) { + debug.debug(msg, callback); + }, + info: function(msg, callback) { + info.info(msg, callback); + }, + warn: function(msg, callback) { + warn.warn(msg, callback); + }, + error: function(msg, callback) { + error.error(msg, callback); + }, + log: function(level, msg, callback) { + var lvl = exports[level]; + lvl(msg, callback); + } +}; + +module.exports = loggers; +module.exports.stream = { + write: function(message, encoding) { + loggers.info(message); + } +}; diff --git a/server/config/routing/chat/index.js b/server/config/routing/chat/index.js index 5091214..dc9a8ad 100644 --- a/server/config/routing/chat/index.js +++ b/server/config/routing/chat/index.js @@ -1 +1,235 @@ -var _0x661b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x55\x73\x65\x72","\x2E\x2F\x73\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x20\x52\x6F\x75\x74\x69\x6E\x67\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E","\x6C\x6F\x67","\x6F\x72\x69\x67\x69\x6E","\x77\x65\x62\x63\x68\x61\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x69\x64","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x61\x64\x64\x72\x65\x73\x73","\x70\x72\x69\x6F\x72\x69\x74\x79\x20\x41\x53\x43","\x74\x69\x6D\x65\x6F\x75\x74","\x73\x74\x72\x61\x74\x65\x67\x79","\x6F\x6E\x6C\x69\x6E\x65","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x67\x65\x74\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x65\x78\x74\x65\x72\x6E\x61\x6C","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6F\x6D\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x63\x6C\x6F\x6E\x65\x44\x65\x65\x70","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x61\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x71\x75\x65\x75\x65","\x62\x65\x65\x70\x61\x6C\x6C","\x61\x67\x65\x6E\x74","\x6C\x65\x6E\x67\x74\x68","\x45\x6E\x64\x20\x63\x68\x61\x74\x20\x72\x6F\x75\x74\x69\x6E\x67\x2E\x2E","\x74\x68\x65\x6E","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x75\x70\x64\x61\x74\x65","\x77\x61\x74\x65\x72\x66\x61\x6C\x6C","\x61\x62\x61\x6E\x64\x6F\x6E","\x75\x6E\x73\x65\x72\x76\x65\x64","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x65\x72\x72","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x52\x6F\x6F\x6D\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x20\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x2E\x2E","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0x661b[0];var _=require(_0x661b[1]);var moment=require(_0x661b[2]);var util=require(_0x661b[3]);var async=require(_0x661b[4]);var Util=require(_0x661b[5]);var ChatApplication=require(_0x661b[7])[_0x661b[6]];var ChatVisitor=require(_0x661b[7])[_0x661b[8]];var ChatWebsite=require(_0x661b[7])[_0x661b[9]];var ChatQueue=require(_0x661b[7])[_0x661b[10]];var ChatRoom=require(_0x661b[7])[_0x661b[11]];var ReportChat=require(_0x661b[7])[_0x661b[12]];var ReportChatSession=require(_0x661b[7])[_0x661b[13]];var Interval=require(_0x661b[7])[_0x661b[14]];var User=require(_0x661b[7])[_0x661b[15]];var Session=require(_0x661b[16]);module[_0x661b[17]]=function(){console[_0x661b[19]](_0x661b[18]);ChatVisitor[_0x661b[22]](function(_0x7977x10){if(_0x7977x10[_0x661b[20]]===_0x661b[21]){handleVisitor(_0x7977x10)}})};function handleEntityNotFound(_0x7977x12){return function(_0x7977x13){if(!_0x7977x13){throw {message:_0x7977x12}};return _0x7977x13}}function handleChatWebsite(_0x7977x15){return function(_0x7977x16){_0x7977x15[_0x661b[23]]=_0x7977x16[_0x661b[24]];_0x7977x15[_0x661b[25]]=_0x7977x16[_0x661b[26]];_0x7977x15[_0x661b[27]]=_0x7977x16[_0x661b[28]];return _0x7977x16[_0x661b[34]]({order:_0x661b[29],include:[{model:ChatQueue,attributes:[_0x661b[24],_0x661b[26],_0x661b[30],_0x661b[31]],include:[{model:User,attributes:[_0x661b[24],_0x661b[26],_0x661b[32],_0x661b[33]]}]},{model:User,attributes:[_0x661b[24],_0x661b[26],_0x661b[32],_0x661b[33]]},{model:Interval,include:[{all:true}]}]})}}function handleChatRoom(_0x7977x15,_0x7977x18){return function(_0x7977x19){_0x7977x19[_0x661b[36]](function(_0x7977x1a){_0x7977x18[_0x661b[35]](_0x7977x1a)});_0x7977x18=_0x7977x19;return ChatRoom[_0x661b[39]]({type:_0x661b[37],ChatVisitorId:_0x7977x15[_0x661b[38]],ChatWebsiteId:_0x7977x15[_0x661b[23]]},{include:[{all:true}]})}}function handleApps(_0x7977x15,_0x7977x18){return function(_0x7977x1c){var _0x7977x1d=[];_0x7977x15[_0x661b[40]]=_0x7977x1c[_0x661b[24]];_0x7977x15[_0x661b[41]]=util[_0x661b[44]](_0x661b[42],moment()[_0x661b[43]](),_0x7977x1c[_0x661b[24]]);ReportChatSession[_0x661b[39]](_[_0x661b[47]](_0x7977x15))[_0x661b[46]](function(_0x7977x1e){console[_0x661b[45]](_0x7977x1e)});_0x7977x18[_0x661b[36]](function(_0x7977x1a,_0x7977x1f){var _0x7977x20=_[_0x661b[47]](_0x7977x15);_0x7977x20[_0x661b[48]]=_0x7977x1a[_0x661b[30]];_0x7977x20[_0x661b[49]]=_0x7977x1a[_0x661b[50]];switch(_0x7977x1a[_0x661b[50]]){case _0x661b[56]:_0x7977x20[_0x661b[51]]=_0x7977x1a[_0x661b[10]][_0x661b[24]];_0x7977x20[_0x661b[52]]=_0x7977x1a[_0x661b[10]][_0x661b[26]];_0x7977x20[_0x661b[31]]=_0x7977x1a[_0x661b[10]][_0x661b[31]];_0x7977x20[_0x661b[53]]=_0x7977x1a[_0x661b[10]][_0x661b[30]];_0x7977x20[_0x661b[54]]=_[_0x661b[55]](_0x7977x1a[_0x661b[10]].Users,function(_0x7977x21){return {id:_0x7977x21[_0x661b[24]],name:_0x7977x21[_0x661b[26]]}});break;case _0x661b[58]:_0x7977x20[_0x661b[53]]=_0x7977x1a[_0x661b[30]];_0x7977x20[_0x661b[31]]=_0x661b[57];_0x7977x20[_0x661b[54]]=[{id:_0x7977x1a[_0x661b[15]][_0x661b[24]],name:_0x7977x1a[_0x661b[15]][_0x661b[26]]}];break;default:};if(_0x7977x1d[_0x661b[59]]){_0x7977x1d[_0x661b[35]](function(_0x7977x22,_0x7977x23){if(_0x7977x22){return _0x7977x23(null,_0x7977x22)}else { new Session(_0x7977x20,_0x7977x23)}})}else {_0x7977x1d[_0x661b[35]](function(_0x7977x23){ new Session(_0x7977x20,_0x7977x23)})}});async[_0x661b[64]](_0x7977x1d,function(_0x7977x1e,_0x7977x24,_0x7977x25){if(_0x7977x1e){console[_0x661b[45]](_0x7977x1e)};console[_0x661b[19]](_0x661b[60]);if(!_0x7977x24){return ReportChatSession[_0x661b[63]]({unmanagedAt:moment()[_0x661b[44]](_0x661b[62])},{where:{uniqueid:_0x7977x15[_0x661b[41]]},individualHooks:true})[_0x661b[61]](handleUnmanaged(_0x7977x15))};if(_0x7977x25){return handleAbandon(_0x7977x15)};return})}}function handleAbandon(_0x7977x15){return ChatVisitor[_0x661b[63]]({status:_0x661b[65]},{where:{id:_0x7977x15[_0x661b[38]]}})}function handleUnmanaged(_0x7977x15){return function(_0x7977x28){return ChatVisitor[_0x661b[63]]({status:_0x661b[66]},{where:{id:_0x7977x15[_0x661b[38]]}})}}function handleVisitor(_0x7977x10){var _0x7977x18=[];var _0x7977x15={visitorid:_0x7977x10[_0x661b[24]],visitorname:_0x7977x10[_0x661b[67]],visitoremail:_0x7977x10[_0x661b[68]],websiteid:_0x7977x10[_0x661b[69]],joinAt:moment()[_0x661b[44]](_0x661b[62])};return ChatWebsite[_0x661b[74]](_0x7977x10.ChatWebsiteId)[_0x661b[61]](handleEntityNotFound(_0x661b[73]))[_0x661b[61]](handleChatWebsite(_0x7977x15))[_0x661b[61]](handleEntityNotFound(_0x661b[72]))[_0x661b[61]](handleChatRoom(_0x7977x15,_0x7977x18))[_0x661b[61]](handleEntityNotFound(_0x661b[71]))[_0x661b[61]](handleApps(_0x7977x15,_0x7977x18))[_0x661b[46]](function(_0x7977x1e){console[_0x661b[45]](_0x661b[70],_0x7977x1e)})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); +var util = require('util'); +var async = require('async'); + +var Util = require('../../util'); + +var ChatApplication = require('../../../models').ChatApplication; +var ChatVisitor = require('../../../models').ChatVisitor; +var ChatWebsite = require('../../../models').ChatWebsite; +var ChatQueue = require('../../../models').ChatQueue; +var ChatRoom = require('../../../models').ChatRoom; + +var ReportChat = require('../../../models').ReportChat; +var ReportChatSession = require('../../../models').ReportChatSession; +var Interval = require('../../../models').Interval; +var User = require('../../../models').User; + +var Session = require('./session'); + +module.exports = function() { + console.log('Chat Routing Initialization..'); + + ChatVisitor.afterCreate(function(visitor) { + if (visitor.origin === 'webchat') { + handleVisitor(visitor); + } + }); +} + +function handleEntityNotFound(message) { + return function(entity) { + if (!entity) { + throw { + message: message + }; + } + return entity; + }; +} + +function handleChatWebsite(_report) { + return function(website) { + _report.websiteid = website.id; + _report.websitename = website.name; + _report.websiteaddress = website.address; + + return website + .getChatApplications({ + order: 'priority ASC', + include: [{ + model: ChatQueue, + attributes: ['id', 'name', 'timeout', 'strategy'], + include: [{ + model: User, + attributes: ['id', 'name', 'online', 'chatPause'] + }] + }, { + model: User, + attributes: ['id', 'name', 'online', 'chatPause'] + }, { + model: Interval, + include: [{ + all: true + }] + }] + }); + } +} + +function handleChatRoom(_report, _apps) { + return function(apps) { + apps.forEach(function(app) { + _apps.push(app); + }); + + _apps = apps; + // START CREATE/ASSIGN CHAT ROOM + return ChatRoom + .create({ + type: 'external', + ChatVisitorId: _report.visitorid, + ChatWebsiteId: _report.websiteid + }, { + include: [{ + all: true + }] + }); + } +} + +function handleApps(_report, _apps) { + return function(room) { + var waterfall = []; + + _report.roomid = room.id; + _report.uniqueid = util.format('%s.%s', moment().unix(), room.id); + + ReportChatSession + .create(_.cloneDeep(_report)) + .catch(function(err) { + console.error(err); + }); + + _apps.forEach(function(app, index) { + var data = _.cloneDeep(_report); + + data.apptimeout = app.timeout; + data.application = app.app; + + switch (app.app) { + case 'queue': + data.queueid = app.ChatQueue.id; + data.queuename = app.ChatQueue.name; + data.strategy = app.ChatQueue.strategy; + + data.queuetimeout = app.ChatQueue.timeout; + data.agents = _.map(app.ChatQueue.Users, function(agent) { + return { + id: agent.id, + name: agent.name + } + }); + + break; + + case 'agent': + data.queuetimeout = app.timeout; + data.strategy = 'beepall'; + + data.agents = [{ + id: app.User.id, + name: app.User.name + }]; + + break; + + default: + } + + if (waterfall.length) { + waterfall.push(function(exit, callback) { + if (exit) { + return callback(null, exit); + } else { + new Session(data, callback); + } + }); + } else { + // PRIMA CALLBACK NESSUN DATO + waterfall.push(function(callback) { + new Session(data, callback); + }); + } + }); + + async.waterfall(waterfall, function(err, managed, abandon) { + if (err) { + console.error(err); + } + + console.log('End chat routing..'); + + if (!managed) { + return ReportChatSession + .update({ + unmanagedAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + uniqueid: _report.uniqueid + }, + individualHooks: true + }) + .then(handleUnmanaged(_report)); + } + + if (abandon) { + return handleAbandon(_report); + } + + return; + }); + } +} + +function handleAbandon(_report) { + //Chat session abandon + return ChatVisitor + .update({ + status: 'abandon' + }, { + where: { + id: _report.visitorid + } + }); +} + +function handleUnmanaged(_report) { + return function(reportChatSession) { + //Chat session not managed + return ChatVisitor + .update({ + status: 'unserved' + }, { + where: { + id: _report.visitorid + } + }); + } +} + +function handleVisitor(visitor) { + var _apps = []; + var _report = { + visitorid: visitor.id, + visitorname: visitor.fullname, + visitoremail: visitor.email, + websiteid: visitor.ChatWebsiteId, + joinAt: moment().format("YYYY-MM-DD HH:mm:ss") + }; + + return ChatWebsite + .findById(visitor.ChatWebsiteId) + .then(handleEntityNotFound('Unknown ChatWebsite..')) + .then(handleChatWebsite(_report)) + .then(handleEntityNotFound('Unknown ChatWebsite Applications..')) + .then(handleChatRoom(_report, _apps)) + .then(handleEntityNotFound('Unknown ChatRoom..')) + .then(handleApps(_report, _apps)) + .catch(function(err) { + console.error('err', err); + }); +} diff --git a/server/config/routing/chat/session.js b/server/config/routing/chat/session.js index 630a367..17560eb 100644 --- a/server/config/routing/chat/session.js +++ b/server/config/routing/chat/session.js @@ -1 +1,280 @@ -var _0x70af=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x4E\x65\x77\x20\x43\x68\x61\x74\x20\x73\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x72\x65\x70\x6F\x72\x74","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x63\x68\x61\x74\x43\x61\x70\x61\x63\x69\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x69\x64","\x72\x6F\x6F\x6D\x69\x64","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x66\x69\x6C\x74\x65\x72","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x6E\x61\x6D\x65","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x73\x68\x69\x66\x74","\x61\x76\x61\x69\x6C\x61\x62\x6C\x65","\x70\x75\x73\x68","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x73\x74\x72\x61\x74\x65\x67\x79","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x67\x65\x6E\x74\x69\x64","\x61\x67\x65\x6E\x74\x6E\x61\x6D\x65","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x62\x61\x6E\x64\x6F\x6E\x41\x74","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x76\x69\x73\x69\x74\x6F\x72\x6E\x61\x6D\x65","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x70af[0];var _=require(_0x70af[1]);var moment=require(_0x70af[2]);var Agent=require(_0x70af[4])[_0x70af[3]];var ChatRoom=require(_0x70af[4])[_0x70af[5]];var ChatApplication=require(_0x70af[4])[_0x70af[6]];var ReportChat=require(_0x70af[4])[_0x70af[7]];var ReportChatSession=require(_0x70af[4])[_0x70af[8]];function Session(_0xf36fx9,_0xf36fxa){console[_0x70af[10]](_0x70af[9]);console[_0x70af[10]](_0x70af[11],_0xf36fx9);var _0xf36fxb=0;var _0xf36fxc,_0xf36fxd;Agent[_0x70af[35]]({where:{id:{$in:_[_0x70af[34]](_0xf36fx9[_0x70af[33]],_0x70af[16])},online:true,mailPause:false},include:[{model:ChatRoom,attributes:[_0x70af[16],_0x70af[18]]}],attributes:[_0x70af[16],_0x70af[24],_0x70af[14]]})[_0x70af[32]](function(_0xf36fxf){var _0xf36fx10=_[_0x70af[20]](_0xf36fxf,function(_0xf36fx11){if(_0xf36fx11[_0x70af[14]]===0){return true}else {return _0xf36fx11[_0x70af[14]]>_[_0x70af[20]](_0xf36fx11.ChatRooms,function(_0xf36fx12){return _0xf36fx12[_0x70af[16]]!==_0xf36fx9[_0x70af[17]]&&_0xf36fx12[_0x70af[18]]!==_0x70af[19]})[_0x70af[15]]}});var _0xf36fx13=[];var _0xf36fx14;var _0xf36fx11;_0xf36fx9[_0x70af[21]]=((_0xf36fx9[_0x70af[22]]-_0xf36fxb)>_0xf36fx9[_0x70af[23]])?_0xf36fx9[_0x70af[23]]:(_0xf36fx9[_0x70af[22]]-_0xf36fxb);switch(_0xf36fx9[_0x70af[31]]){case _0x70af[29]:_0xf36fx14=_[_0x70af[25]](_0xf36fx10,_0xf36fx13,_0x70af[24]);_0xf36fx11=_0xf36fx14[_0x70af[26]]();if(_0xf36fx11){_0xf36fx9[_0x70af[27]]=[{id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]}];_0xf36fx13[_0x70af[28]]({id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]});saveReport(_0xf36fx9)}else {_0xf36fx13=[];_0xf36fx11=_0xf36fx10[_0x70af[26]]();if(_0xf36fx11){_0xf36fx13[_0x70af[28]]({id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]});saveReport(_0xf36fx9)}};break;case _0x70af[30]:_0xf36fx9[_0x70af[27]]=_0xf36fx10;saveReport(_0xf36fx9);break;default:};_0xf36fxd=setTimeout(function(){clearInterval(_0xf36fxc);return _0xf36fxa(null,false)},_0xf36fx9[_0x70af[22]]*1000);_0xf36fxc=setInterval(function(){_0xf36fxb+=_0xf36fx9[_0x70af[23]];return Agent[_0x70af[35]]({where:{id:{$in:_[_0x70af[34]](_0xf36fx9[_0x70af[33]],_0x70af[16])},online:true,mailPause:false},include:[{model:ChatRoom,attributes:[_0x70af[16],_0x70af[18]]}],attributes:[_0x70af[16],_0x70af[24],_0x70af[14]]})[_0x70af[32]](function(_0xf36fxf){_0xf36fx10=_[_0x70af[20]](_0xf36fxf,function(_0xf36fx11){if(_0xf36fx11[_0x70af[14]]===0){return true}else {return _0xf36fx11[_0x70af[14]]>_[_0x70af[20]](_0xf36fx11.ChatRooms,function(_0xf36fx12){return _0xf36fx12[_0x70af[16]]!==_0xf36fx9[_0x70af[17]]&&_0xf36fx12[_0x70af[18]]!==_0x70af[19]})[_0x70af[15]]}});_0xf36fx9[_0x70af[21]]=((_0xf36fx9[_0x70af[22]]-_0xf36fxb)>_0xf36fx9[_0x70af[23]])?_0xf36fx9[_0x70af[23]]:(_0xf36fx9[_0x70af[22]]-_0xf36fxb);switch(_0xf36fx9[_0x70af[31]]){case _0x70af[29]:_0xf36fx14=_[_0x70af[25]](_0xf36fx10,_0xf36fx13,_0x70af[24]);_0xf36fx11=_0xf36fx14[_0x70af[26]]();if(_0xf36fx11){_0xf36fx9[_0x70af[27]]=[{id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]}];_0xf36fx13[_0x70af[28]]({id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]});saveReport(_0xf36fx9)}else {_0xf36fx13=[];_0xf36fx11=_0xf36fx10[_0x70af[26]]();if(_0xf36fx11){_0xf36fx9[_0x70af[27]]=[{id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]}];_0xf36fx13[_0x70af[28]]({id:_0xf36fx11[_0x70af[16]],name:_0xf36fx11[_0x70af[24]]});saveReport(_0xf36fx9)}};break;case _0x70af[30]:_0xf36fx9[_0x70af[27]]=_0xf36fx10;saveReport(_0xf36fx9);break;default:}})[_0x70af[13]](function(_0xf36fxe){console[_0x70af[12]](_0xf36fxe)})},_0xf36fx9[_0x70af[23]]*1000)})[_0x70af[13]](function(_0xf36fxe){console[_0x70af[12]](_0xf36fxe)});ReportChat[_0x70af[49]](function(_0xf36fx15){if(_0xf36fx15[_0x70af[37]](_0x70af[36])){return ChatRoom[_0x70af[48]](_0xf36fx15[_0x70af[17]])[_0x70af[32]](function(ChatRoom){return ChatRoom[_0x70af[47]](_0xf36fx15[_0x70af[39]],{individualHooks:true})})[_0x70af[32]](function(){return ReportChatSession[_0x70af[46]]({application:_0xf36fx15[_0x70af[38]],agentid:_0xf36fx15[_0x70af[39]],agentname:_0xf36fx15[_0x70af[40]],queueid:_0xf36fx15[_0x70af[41]]||null,queuename:_0xf36fx15[_0x70af[42]]||null,leaveAt:moment()[_0x70af[44]](_0x70af[43])},{where:{uniqueid:_0xf36fx15[_0x70af[45]]},individualHooks:true})})[_0x70af[32]](function(){clearInterval(_0xf36fxc);clearTimeout(_0xf36fxd);return _0xf36fxa(null,true)})[_0x70af[13]](function(_0xf36fxe){console[_0x70af[12]](_0xf36fxe)})}});ReportChatSession[_0x70af[49]](function(_0xf36fx15){if(_0xf36fx15[_0x70af[37]](_0x70af[50])){return ChatRoom[_0x70af[48]](_0xf36fx15[_0x70af[17]])[_0x70af[32]](function(ChatRoom){return ChatRoom[_0x70af[46]]({status:_0x70af[19]})})[_0x70af[32]](function(){clearInterval(_0xf36fxc);clearTimeout(_0xf36fxd);return _0xf36fxa(null,true,true)})[_0x70af[13]](function(_0xf36fxe){console[_0x70af[12]](_0xf36fxe)})}});return {}}function saveReport(_0xf36fx9){var _0xf36fx17=[];_0xf36fx9[_0x70af[27]][_0x70af[57]](function(_0xf36fx11,_0xf36fx18){_0xf36fx17[_0x70af[28]]({uniqueid:_0xf36fx9[_0x70af[45]],visitorid:_0xf36fx9[_0x70af[51]],visitorname:_0xf36fx9[_0x70af[52]],visitoremail:_0xf36fx9[_0x70af[53]],timeslot:_0xf36fx9[_0x70af[21]],websiteid:_0xf36fx9[_0x70af[54]],websitename:_0xf36fx9[_0x70af[55]],websiteaddress:_0xf36fx9[_0x70af[56]],application:_0xf36fx9[_0x70af[38]],agentname:_0xf36fx11[_0x70af[24]],agentid:_0xf36fx11[_0x70af[16]],queueid:_0xf36fx9[_0x70af[41]]||null,queuename:_0xf36fx9[_0x70af[42]]||null,roomid:_0xf36fx9[_0x70af[17]]||null,calledAt:moment()[_0x70af[44]](_0x70af[43])})});if(_0xf36fx17[_0x70af[15]]){return ReportChat[_0x70af[58]](_0xf36fx17,{individualHooks:true})[_0x70af[13]](function(_0xf36fxe){console[_0x70af[12]](_0xf36fxe)})}}module[_0x70af[59]]=Session \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); + +var Agent = require('../../../models').User; +var ChatRoom = require('../../../models').ChatRoom; +var ChatApplication = require('../../../models').ChatApplication; +var ReportChat = require('../../../models').ReportChat; +var ReportChatSession = require('../../../models').ReportChatSession; + +// Define the factory +function Session(report, callback) { + console.log('New Chat session...'); + console.log('report', report); + var elapsed = 0; + var interval, timeout; + + Agent + .findAll({ + where: { + id: { + $in: _.map(report.agents, 'id'), + }, + online: true, + mailPause: false + }, + include: [{ + model: ChatRoom, + attributes: ['id', 'status'] + }], + attributes: ['id', 'name', 'chatCapacity'] + }) + .then(function(agents) { + var set1 = _.filter(agents, function(agent) { + if (agent.chatCapacity === 0) { + return true; + } else { + return agent.chatCapacity > _.filter(agent.ChatRooms, function(room) { + return room.id !== report.roomid && room.status !== 'CLOSED' + }).length; + } + }); + var set2 = []; + + var diff; + var agent; + + report.timeslot = ((report.apptimeout - elapsed) > report.queuetimeout) ? report.queuetimeout : (report.apptimeout - elapsed); + + switch (report.strategy) { + case 'rrmemory': + diff = _.differenceBy(set1, set2, 'name'); + agent = diff.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + + } else { + set2 = []; + agent = set1.shift(); + + if (agent) { + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + } + } + + break; + case 'beepall': + report.available = set1; + saveReport(report); + + break; + default: + } + + // APPLICATION TIMEOUT + timeout = setTimeout(function() { + clearInterval(interval); + return callback(null, false); + }, report.apptimeout * 1000); + + interval = setInterval(function() { + elapsed += report.queuetimeout; + + return Agent + .findAll({ + where: { + id: { + $in: _.map(report.agents, 'id'), + }, + online: true, + mailPause: false + }, + include: [{ + model: ChatRoom, + attributes: ['id', 'status'] + }], + attributes: ['id', 'name', 'chatCapacity'] + }) + .then(function(agents) { + set1 = _.filter(agents, function(agent) { + if (agent.chatCapacity === 0) { + return true; + } else { + return agent.chatCapacity > _.filter(agent.ChatRooms, function(room) { + return room.id !== report.roomid && room.status !== 'CLOSED' + }).length; + } + }); + + report.timeslot = ((report.apptimeout - elapsed) > report.queuetimeout) ? report.queuetimeout : (report.apptimeout - elapsed); + + switch (report.strategy) { + case 'rrmemory': + diff = _.differenceBy(set1, set2, 'name'); + agent = diff.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + + saveReport(report); + + } else { + set2 = []; + agent = set1.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + } + } + + break; + case 'beepall': + report.available = set1; + saveReport(report); + + break; + default: + } + }) + .catch(function(err) { + console.error(err); + }); + + }, report.queuetimeout * 1000); + + }) + .catch(function(err) { + console.error(err); + }); + + // INTERROMPO IL ROUTING + ReportChat.afterUpdate(function(doc) { + if (doc.changed('connectid')) { + return ChatRoom + .findById(doc.roomid) + .then(function(ChatRoom) { + return ChatRoom + .addUser(doc.agentid, { + individualHooks: true + }); + }) + .then(function() { + return ReportChatSession + .update({ + application: doc.application, + agentid: doc.agentid, + agentname: doc.agentname, + queueid: doc.queueid || null, + queuename: doc.queuename || null, + leaveAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + uniqueid: doc.uniqueid + }, + individualHooks: true + }); + }) + .then(function() { + clearInterval(interval); + clearTimeout(timeout); + return callback(null, true); + }) + .catch(function(err) { + console.error(err); + }); + } + }); + + ReportChatSession.afterUpdate(function(doc) { + if (doc.changed('abandonAt')) { + return ChatRoom + .findById(doc.roomid) + .then(function(ChatRoom) { + return ChatRoom + .update({ + status: 'CLOSED' + }) + }) + .then(function() { + clearInterval(interval); + clearTimeout(timeout); + return callback(null, true, true); + }) + .catch(function(err) { + console.error(err); + }); + } + }); + + return {}; +} + +function saveReport(report) { + var reports = []; + + report.available.forEach(function(agent, index) { + reports.push({ + uniqueid: report.uniqueid, + visitorid: report.visitorid, + visitorname: report.visitorname, + visitoremail: report.visitoremail, + timeslot: report.timeslot, + websiteid: report.websiteid, + websitename: report.websitename, + websiteaddress: report.websiteaddress, + application: report.application, + agentname: agent.name, + agentid: agent.id, + queueid: report.queueid || null, + queuename: report.queuename || null, + roomid: report.roomid || null, + calledAt: moment().format("YYYY-MM-DD HH:mm:ss") + }); + }); + + if (reports.length) { + return ReportChat + .bulkCreate(reports, { + individualHooks: true + }) + .catch(function(err) { + console.error(err); + }); + } +} + +// Export this file as a module +module.exports = Session; diff --git a/server/config/routing/mail/index.js b/server/config/routing/mail/index.js index ba34076..9268b24 100644 --- a/server/config/routing/mail/index.js +++ b/server/config/routing/mail/index.js @@ -1 +1,216 @@ -var _0xa27d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x55\x73\x65\x72","\x2E\x2F\x73\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x20\x52\x6F\x75\x74\x69\x6E\x67\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E","\x6C\x6F\x67","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x72\x6F\x6F\x6D\x69\x64","\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x73\x75\x62\x6A\x65\x63\x74","\x61\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x6D\x61\x70","\x67\x65\x74\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x61\x64\x64\x72\x65\x73\x73","\x66\x69\x64\x65\x6C\x69\x74\x79","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x73\x74\x72\x61\x74\x65\x67\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x70\x72\x69\x6F\x72\x69\x74\x79\x20\x41\x53\x43","\x6F\x6E\x6C\x69\x6E\x65","\x6D\x61\x69\x6C\x50\x61\x75\x73\x65","\x67\x65\x74\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x63\x6C\x6F\x6E\x65\x44\x65\x65\x70","\x63\x72\x65\x61\x74\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x6C\x65\x6E\x67\x74\x68","\x70\x75\x73\x68","\x61\x70\x70","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x61\x67\x65\x6E\x74","\x66\x6F\x72\x45\x61\x63\x68","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x75\x70\x64\x61\x74\x65","\x45\x6E\x64\x20\x6D\x61\x69\x6C\x20\x72\x6F\x75\x74\x69\x6E\x67\x2E\x2E","\x77\x61\x74\x65\x72\x66\x61\x6C\x6C","\x65\x72\x72","\x74\x68\x65\x6E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x2E\x2E","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D"];_0xa27d[0];var _=require(_0xa27d[1]);var moment=require(_0xa27d[2]);var util=require(_0xa27d[3]);var async=require(_0xa27d[4]);var Util=require(_0xa27d[5]);var ReportMail=require(_0xa27d[7])[_0xa27d[6]];var ReportMailSession=require(_0xa27d[7])[_0xa27d[8]];var MailMessage=require(_0xa27d[7])[_0xa27d[9]];var MailQueue=require(_0xa27d[7])[_0xa27d[10]];var Interval=require(_0xa27d[7])[_0xa27d[11]];var User=require(_0xa27d[7])[_0xa27d[12]];var Session=require(_0xa27d[13]);module[_0xa27d[14]]=function(){console[_0xa27d[16]](_0xa27d[15]);MailMessage[_0xa27d[19]](function(_0x18acxd){if(_0x18acxd[_0xa27d[17]]===_0xa27d[18]){handleMessage(_0x18acxd)}})};function handleEntityNotFound(_0x18acxd){return function(_0x18acxf){if(!_0x18acxf){throw {message:_0x18acxd}};return _0x18acxf}}function handleMailRoom(_0x18acx11,_0x18acx12){return function(_0x18acx13){_0x18acx11[_0xa27d[20]]=_0x18acx13[_0xa27d[21]];_0x18acx11[_0xa27d[22]]=util[_0xa27d[25]](_0xa27d[23],moment()[_0xa27d[24]](),_0x18acx13[_0xa27d[21]]);_0x18acx11[_0xa27d[26]]=_0x18acx13[_0xa27d[26]];_0x18acx12[_0xa27d[27]]=_[_0xa27d[29]](_0x18acx13.Users,function(_0x18acx14){return {id:_0x18acx14[_0xa27d[21]],name:_0x18acx14[_0xa27d[28]]}});return _0x18acx13[_0xa27d[30]]()}}function handleMailAccount(_0x18acx11,_0x18acx12){return function(_0x18acx16){_0x18acx11[_0xa27d[31]]=_0x18acx16[_0xa27d[21]];_0x18acx11[_0xa27d[32]]=_0x18acx16[_0xa27d[28]];_0x18acx11[_0xa27d[33]]=_0x18acx16[_0xa27d[34]];_0x18acx12[_0xa27d[35]]=_0x18acx16[_0xa27d[35]];if(_0x18acx16[_0xa27d[35]]){_0x18acx12[_0xa27d[36]]=_0x18acx12[_0xa27d[37]]=_0x18acx16[_0xa27d[38]];_0x18acx12[_0xa27d[35]]=_0x18acx16[_0xa27d[38]];_0x18acx12[_0xa27d[39]]=_0xa27d[40]};return _0x18acx16[_0xa27d[44]]({order:_0xa27d[41],include:[{model:MailQueue,attributes:[_0xa27d[21],_0xa27d[28],_0xa27d[38],_0xa27d[39]],include:[{model:User,attributes:[_0xa27d[21],_0xa27d[28],_0xa27d[42],_0xa27d[43]]}]},{model:User,attributes:[_0xa27d[21],_0xa27d[28],_0xa27d[42],_0xa27d[43]]},{model:Interval,include:[{all:true}]}]})}}function handleApps(_0x18acx11,_0x18acx12){return function(_0x18acx18){var _0x18acx19=[];ReportMailSession[_0xa27d[48]](_[_0xa27d[47]](_0x18acx11))[_0xa27d[46]](function(_0x18acx1a){console[_0xa27d[45]](_0x18acx1a)});if(_0x18acx12[_0xa27d[35]]){_0x18acx11[_0xa27d[37]]=_0x18acx12[_0xa27d[35]];_0x18acx11[_0xa27d[36]]=_0x18acx12[_0xa27d[35]];_0x18acx11[_0xa27d[27]]=_0x18acx12[_0xa27d[27]];_0x18acx11[_0xa27d[49]]=_0xa27d[35];_0x18acx11[_0xa27d[39]]=_0xa27d[40];var _0x18acx1b=_[_0xa27d[47]](_0x18acx11);if(_0x18acx1b[_0xa27d[27]][_0xa27d[50]]){_0x18acx19[_0xa27d[51]](function(_0x18acx1c){ new Session(_0x18acx1b,_0x18acx1c)})}};_0x18acx18[_0xa27d[57]](function(_0x18acx1d,_0x18acx1e){var _0x18acx1b=_[_0xa27d[47]](_0x18acx11);_0x18acx1b[_0xa27d[36]]=_0x18acx1d[_0xa27d[38]];_0x18acx1b[_0xa27d[49]]=_0x18acx1d[_0xa27d[52]];switch(_0x18acx1d[_0xa27d[52]]){case _0xa27d[55]:_0x18acx1b[_0xa27d[53]]=_0x18acx1d[_0xa27d[10]][_0xa27d[21]];_0x18acx1b[_0xa27d[54]]=_0x18acx1d[_0xa27d[10]][_0xa27d[28]];_0x18acx1b[_0xa27d[39]]=_0x18acx1d[_0xa27d[10]][_0xa27d[39]];_0x18acx1b[_0xa27d[37]]=_0x18acx1d[_0xa27d[10]][_0xa27d[38]];_0x18acx1b[_0xa27d[27]]=_[_0xa27d[29]](_0x18acx1d[_0xa27d[10]].Users,function(_0x18acx1f){return {id:_0x18acx1f[_0xa27d[21]],name:_0x18acx1f[_0xa27d[28]]}});break;case _0xa27d[56]:_0x18acx1b[_0xa27d[37]]=_0x18acx1d[_0xa27d[38]];_0x18acx1b[_0xa27d[39]]=_0xa27d[40];_0x18acx1b[_0xa27d[27]]=[{id:_0x18acx1d[_0xa27d[12]][_0xa27d[21]],name:_0x18acx1d[_0xa27d[12]][_0xa27d[28]]}];break;default:};if(_0x18acx19[_0xa27d[50]]){_0x18acx19[_0xa27d[51]](function(_0x18acx20,_0x18acx1c){if(_0x18acx20){_0x18acx1c(null,_0x18acx20)}else { new Session(_0x18acx1b,_0x18acx1c)}})}else {_0x18acx19[_0xa27d[51]](function(_0x18acx1c){ new Session(_0x18acx1b,_0x18acx1c)})}});async[_0xa27d[61]](_0x18acx19,function(_0x18acx1a,_0x18acx21){if(_0x18acx1a){console[_0xa27d[45]](_0x18acx1a)};if(!_0x18acx21){return ReportMailSession[_0xa27d[59]]({queuecallerleaveAt:moment()[_0xa27d[25]](_0xa27d[58]),queuecallerunmanagedAt:moment()[_0xa27d[25]](_0xa27d[58])},{where:{uniqueid:_0x18acx11[_0xa27d[22]]},individualHooks:true})};console[_0xa27d[16]](_0xa27d[60])})}}function handleMessage(_0x18acxd){var _0x18acx12={agents:[]};var _0x18acx11={messageid:_0x18acxd[_0xa27d[21]],queuecallerjoinAt:moment()[_0xa27d[25]](_0xa27d[58])};return _0x18acxd[_0xa27d[66]]({include:[{model:User,attributes:[_0xa27d[21],_0xa27d[28],_0xa27d[42],_0xa27d[43]]}]})[_0xa27d[63]](handleEntityNotFound(_0xa27d[65]))[_0xa27d[63]](handleMailRoom(_0x18acx11,_0x18acx12))[_0xa27d[63]](handleEntityNotFound(_0xa27d[64]))[_0xa27d[63]](handleMailAccount(_0x18acx11,_0x18acx12))[_0xa27d[63]](handleApps(_0x18acx11,_0x18acx12))[_0xa27d[46]](function(_0x18acx1a){console[_0xa27d[45]](_0xa27d[62],_0x18acx1a)})} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); +var util = require('util'); +var async = require('async'); + +var Util = require('../../util'); + +var ReportMail = require('../../../models').ReportMail; +var ReportMailSession = require('../../../models').ReportMailSession; +var MailMessage = require('../../../models').MailMessage; +var MailQueue = require('../../../models').MailQueue; +var Interval = require('../../../models').Interval; +var User = require('../../../models').User; + +var Session = require('./session'); + +module.exports = function() { + console.log('Mail Routing Initialization..'); + + MailMessage.afterCreate(function(message) { + if (message.status === 'RECEIVED') { + handleMessage(message); + } + }); +} + +function handleEntityNotFound(message) { + return function(entity) { + if (!entity) { + throw { + message: message + }; + } + return entity; + }; +} + +function handleMailRoom(_report, _fidelity) { + return function(room) { + _report.roomid = room.id; + _report.uniqueid = util.format('%s.%s', moment().unix(), room.id); + _report.subject = room.subject; + _fidelity.agents = _.map(room.Users, function(user) { + return { + id: user.id, + name: user.name + }; + }); + + return room + .getMailAccount(); + } +} + +function handleMailAccount(_report, _fidelity) { + return function(account) { + _report.accountid = account.id; + _report.accountname = account.name; + _report.accountaddress = account.address; + + _fidelity.fidelity = account.fidelity; + + if (account.fidelity) { + _fidelity.apptimeout = _fidelity.queuetimeout = account.timeout; + _fidelity.fidelity = account.timeout; + _fidelity.strategy = 'beepall'; + } + + return account + .getMailApplications({ + order: 'priority ASC', + include: [{ + model: MailQueue, + attributes: ['id', 'name', 'timeout', 'strategy'], + include: [{ + model: User, + attributes: ['id', 'name', 'online', 'mailPause'] + }] + }, { + model: User, + attributes: ['id', 'name', 'online', 'mailPause'] + }, { + model: Interval, + include: [{ + all: true + }] + }] + }); + } +} + +function handleApps(_report, _fidelity) { + return function(apps) { + var waterfall = []; + + ReportMailSession + .create(_.cloneDeep(_report)) + .catch(function(err) { + console.error(err); + }); + + if (_fidelity.fidelity) { + _report.queuetimeout = _fidelity.fidelity; + _report.apptimeout = _fidelity.fidelity; + _report.agents = _fidelity.agents; + _report.application = 'fidelity'; + _report.strategy = 'beepall'; + + var data = _.cloneDeep(_report); + if (data.agents.length) { + waterfall.push(function(callback) { + new Session(data, callback); + }); + } + } + + apps.forEach(function(app, index) { + + var data = _.cloneDeep(_report); + + data.apptimeout = app.timeout; + data.application = app.app; + + switch (app.app) { + case 'queue': + data.queueid = app.MailQueue.id; + data.queuename = app.MailQueue.name; + data.strategy = app.MailQueue.strategy; + + data.queuetimeout = app.MailQueue.timeout; + data.agents = _.map(app.MailQueue.Users, function(agent) { + return { + id: agent.id, + name: agent.name + } + }); + + break; + case 'agent': + data.queuetimeout = app.timeout; + data.strategy = 'beepall'; + + data.agents = [{ + id: app.User.id, + name: app.User.name + }]; + + break; + default: + } + + if (waterfall.length) { + waterfall.push(function(exit, callback) { + if (exit) { + callback(null, exit); + } else { + new Session(data, callback); + } + }); + } else { + // PRIMA CALLBACK NESSUN DATO + waterfall.push(function(callback) { + new Session(data, callback); + }); + } + }); + + async.waterfall(waterfall, function(err, managed) { + if (err) { + console.error(err); + } + if (!managed) { + return ReportMailSession + .update({ + queuecallerleaveAt: moment().format("YYYY-MM-DD HH:mm:ss"), + queuecallerunmanagedAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + uniqueid: _report.uniqueid + }, + individualHooks: true + }); + } + + console.log('End mail routing..'); + }); + } +} + +function handleMessage(message) { + var _fidelity = { + agents: [] + }; + var _report = { + messageid: message.id, + queuecallerjoinAt: moment().format("YYYY-MM-DD HH:mm:ss") + }; + + return message + .getMailRoom({ + include: [{ + model: User, + attributes: ['id', 'name', 'online', 'mailPause'] + }] + }) + .then(handleEntityNotFound('Unknown MailRoom..')) + .then(handleMailRoom(_report, _fidelity)) + .then(handleEntityNotFound('Unknown MailAccount..')) + .then(handleMailAccount(_report, _fidelity)) + .then(handleApps(_report, _fidelity)) + .catch(function(err) { + console.error('err', err); + }); +} diff --git a/server/config/routing/mail/session.js b/server/config/routing/mail/session.js index 0d64147..171d4af 100644 --- a/server/config/routing/mail/session.js +++ b/server/config/routing/mail/session.js @@ -1 +1,258 @@ -var _0xb1df=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4E\x65\x77\x20\x4D\x61\x69\x6C\x20\x73\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x61\x69\x6C\x43\x61\x70\x61\x63\x69\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x69\x64","\x72\x6F\x6F\x6D\x69\x64","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x66\x69\x6C\x74\x65\x72","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x6E\x61\x6D\x65","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x73\x68\x69\x66\x74","\x61\x76\x61\x69\x6C\x61\x62\x6C\x65","\x70\x75\x73\x68","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x73\x74\x72\x61\x74\x65\x67\x79","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x66\x69\x64\x65\x6C\x69\x74\x79","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x75\x62\x6A\x65\x63\x74","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xb1df[0];var _=require(_0xb1df[1]);var moment=require(_0xb1df[2]);var Agent=require(_0xb1df[4])[_0xb1df[3]];var MailRoom=require(_0xb1df[4])[_0xb1df[5]];var MailApplication=require(_0xb1df[4])[_0xb1df[6]];var ReportMail=require(_0xb1df[4])[_0xb1df[7]];var ReportMailSession=require(_0xb1df[4])[_0xb1df[8]];function Session(_0xfd9fx9,_0xfd9fxa){console[_0xb1df[10]](_0xb1df[9]);var _0xfd9fxb=0;var _0xfd9fxc,_0xfd9fxd;Agent[_0xb1df[34]]({where:{id:{$in:_[_0xb1df[33]](_0xfd9fx9[_0xb1df[32]],_0xb1df[15])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xb1df[15],_0xb1df[17]]}],attributes:[_0xb1df[15],_0xb1df[23],_0xb1df[13]]})[_0xb1df[31]](function(_0xfd9fxf){var _0xfd9fx10=_[_0xb1df[19]](_0xfd9fxf,function(_0xfd9fx11){if(_0xfd9fx11[_0xb1df[13]]===0){return true}else {return _0xfd9fx11[_0xb1df[13]]>_[_0xb1df[19]](_0xfd9fx11.MailRooms,function(_0xfd9fx12){return _0xfd9fx12[_0xb1df[15]]!==_0xfd9fx9[_0xb1df[16]]&&_0xfd9fx12[_0xb1df[17]]!==_0xb1df[18]})[_0xb1df[14]]}});var _0xfd9fx13=[];var _0xfd9fx14;var _0xfd9fx11;_0xfd9fx9[_0xb1df[20]]=((_0xfd9fx9[_0xb1df[21]]-_0xfd9fxb)>_0xfd9fx9[_0xb1df[22]])?_0xfd9fx9[_0xb1df[22]]:(_0xfd9fx9[_0xb1df[21]]-_0xfd9fxb);switch(_0xfd9fx9[_0xb1df[30]]){case _0xb1df[28]:_0xfd9fx14=_[_0xb1df[24]](_0xfd9fx10,_0xfd9fx13,_0xb1df[23]);_0xfd9fx11=_0xfd9fx14[_0xb1df[25]]();if(_0xfd9fx11){_0xfd9fx9[_0xb1df[26]]=[{id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]}];_0xfd9fx13[_0xb1df[27]]({id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]});saveReport(_0xfd9fx9)}else {_0xfd9fx13=[];_0xfd9fx11=_0xfd9fx10[_0xb1df[25]]();if(_0xfd9fx11){_0xfd9fx13[_0xb1df[27]]({id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]});saveReport(_0xfd9fx9)}};break;case _0xb1df[29]:_0xfd9fx9[_0xb1df[26]]=_0xfd9fx10;saveReport(_0xfd9fx9);break;default:};_0xfd9fxd=setTimeout(function(){clearInterval(_0xfd9fxc);return _0xfd9fxa(null,false)},_0xfd9fx9[_0xb1df[21]]*1000);_0xfd9fxc=setInterval(function(){_0xfd9fxb+=_0xfd9fx9[_0xb1df[22]];return Agent[_0xb1df[34]]({where:{id:{$in:_[_0xb1df[33]](_0xfd9fx9[_0xb1df[32]],_0xb1df[15])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xb1df[15],_0xb1df[17]]}],attributes:[_0xb1df[15],_0xb1df[23],_0xb1df[13]]})[_0xb1df[31]](function(_0xfd9fxf){_0xfd9fx10=_[_0xb1df[19]](_0xfd9fxf,function(_0xfd9fx11){if(_0xfd9fx11[_0xb1df[13]]===0){return true}else {return _0xfd9fx11[_0xb1df[13]]>_[_0xb1df[19]](_0xfd9fx11.MailRooms,function(_0xfd9fx12){return _0xfd9fx12[_0xb1df[15]]!==_0xfd9fx9[_0xb1df[16]]&&_0xfd9fx12[_0xb1df[17]]!==_0xb1df[18]})[_0xb1df[14]]}});_0xfd9fx9[_0xb1df[20]]=((_0xfd9fx9[_0xb1df[21]]-_0xfd9fxb)>_0xfd9fx9[_0xb1df[22]])?_0xfd9fx9[_0xb1df[22]]:(_0xfd9fx9[_0xb1df[21]]-_0xfd9fxb);switch(_0xfd9fx9[_0xb1df[30]]){case _0xb1df[28]:_0xfd9fx14=_[_0xb1df[24]](_0xfd9fx10,_0xfd9fx13,_0xb1df[23]);_0xfd9fx11=_0xfd9fx14[_0xb1df[25]]();if(_0xfd9fx11){_0xfd9fx9[_0xb1df[26]]=[{id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]}];_0xfd9fx13[_0xb1df[27]]({id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]});saveReport(_0xfd9fx9)}else {_0xfd9fx13=[];_0xfd9fx11=_0xfd9fx10[_0xb1df[25]]();if(_0xfd9fx11){_0xfd9fx9[_0xb1df[26]]=[{id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]}];_0xfd9fx13[_0xb1df[27]]({id:_0xfd9fx11[_0xb1df[15]],name:_0xfd9fx11[_0xb1df[23]]});saveReport(_0xfd9fx9)}};break;case _0xb1df[29]:_0xfd9fx9[_0xb1df[26]]=_0xfd9fx10;saveReport(_0xfd9fx9);break;default:}})[_0xb1df[12]](function(_0xfd9fxe){console[_0xb1df[11]](_0xfd9fxe)})},_0xfd9fx9[_0xb1df[22]]*1000)})[_0xb1df[12]](function(_0xfd9fxe){console[_0xb1df[11]](_0xfd9fxe)});ReportMail[_0xb1df[49]](function(_0xfd9fx15){if(_0xfd9fx15[_0xb1df[36]](_0xb1df[35])){return MailRoom[_0xb1df[48]](_0xfd9fx15[_0xb1df[16]])[_0xb1df[31]](function(_0xfd9fx16){return _0xfd9fx16[_0xb1df[47]](_0xfd9fx15[_0xb1df[38]],{individualHooks:true})})[_0xb1df[31]](function(){return ReportMailSession[_0xb1df[46]]({application:_0xfd9fx15[_0xb1df[37]],memberid:_0xfd9fx15[_0xb1df[38]],membername:_0xfd9fx15[_0xb1df[39]],queue:_0xfd9fx15[_0xb1df[40]]||null,queuename:_0xfd9fx15[_0xb1df[41]]||null,fidelity:_0xfd9fx15[_0xb1df[37]]===_0xb1df[42]?_0xfd9fx15[_0xb1df[20]]:null,queuecallerleaveAt:moment()[_0xb1df[44]](_0xb1df[43])},{where:{uniqueid:_0xfd9fx15[_0xb1df[45]]},individualHooks:true})})[_0xb1df[31]](function(){clearInterval(_0xfd9fxc);clearTimeout(_0xfd9fxd);return _0xfd9fxa(null,true)})[_0xb1df[12]](function(_0xfd9fxe){console[_0xb1df[11]](_0xfd9fxe)})}});return {}}function saveReport(_0xfd9fx9){var _0xfd9fx18=[];_0xfd9fx9[_0xb1df[26]][_0xb1df[55]](function(_0xfd9fx11,_0xfd9fx19){_0xfd9fx18[_0xb1df[27]]({uniqueid:_0xfd9fx9[_0xb1df[45]],timeslot:_0xfd9fx9[_0xb1df[20]],subject:_0xfd9fx9[_0xb1df[50]],accountid:_0xfd9fx9[_0xb1df[51]],accountname:_0xfd9fx9[_0xb1df[52]],accountaddress:_0xfd9fx9[_0xb1df[53]],application:_0xfd9fx9[_0xb1df[37]],membername:_0xfd9fx11[_0xb1df[23]],memberid:_0xfd9fx11[_0xb1df[15]],queue:_0xfd9fx9[_0xb1df[40]]||null,queuename:_0xfd9fx9[_0xb1df[41]]||null,roomid:_0xfd9fx9[_0xb1df[16]]||null,messageid:_0xfd9fx9[_0xb1df[54]]||null,calledAt:moment()[_0xb1df[44]](_0xb1df[43])})});if(_0xfd9fx18[_0xb1df[14]]){return ReportMail[_0xb1df[56]](_0xfd9fx18,{individualHooks:true})[_0xb1df[12]](function(_0xfd9fxe){console[_0xb1df[11]](_0xfd9fxe)})}}module[_0xb1df[57]]=Session \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); + +var Agent = require('../../../models').User; +var MailRoom = require('../../../models').MailRoom; +var MailApplication = require('../../../models').MailApplication; +var ReportMail = require('../../../models').ReportMail; +var ReportMailSession = require('../../../models').ReportMailSession; + +// Define the factory +function Session(report, callback) { + console.log('New Mail session...'); + var elapsed = 0; + var interval, timeout; + + Agent + .findAll({ + where: { + id: { + $in: _.map(report.agents, 'id'), + }, + online: true, + mailPause: false + }, + include: [{ + model: MailRoom, + attributes: ['id', 'status'] + }], + attributes: ['id', 'name', 'mailCapacity'] + }) + .then(function(agents) { + var set1 = _.filter(agents, function(agent) { + if (agent.mailCapacity === 0) { + return true; + } else { + return agent.mailCapacity > _.filter(agent.MailRooms, function(room) { + return room.id !== report.roomid && room.status !== 'CLOSED' + }).length; + } + }); + var set2 = []; + + var diff; + var agent; + + report.timeslot = ((report.apptimeout - elapsed) > report.queuetimeout) ? report.queuetimeout : (report.apptimeout - elapsed); + + switch (report.strategy) { + case 'rrmemory': + diff = _.differenceBy(set1, set2, 'name'); + agent = diff.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + + } else { + set2 = []; + agent = set1.shift(); + + if (agent) { + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + } + } + + break; + case 'beepall': + report.available = set1; + saveReport(report); + + break; + default: + } + + // APPLICATION TIMEOUT + timeout = setTimeout(function() { + clearInterval(interval); + return callback(null, false); + }, report.apptimeout * 1000); + + interval = setInterval(function() { + elapsed += report.queuetimeout; + + return Agent + .findAll({ + where: { + id: { + $in: _.map(report.agents, 'id'), + }, + online: true, + mailPause: false + }, + include: [{ + model: MailRoom, + attributes: ['id', 'status'] + }], + attributes: ['id', 'name', 'mailCapacity'] + }) + .then(function(agents) { + set1 = _.filter(agents, function(agent) { + if (agent.mailCapacity === 0) { + return true; + } else { + return agent.mailCapacity > _.filter(agent.MailRooms, function(room) { + return room.id !== report.roomid && room.status !== 'CLOSED' + }).length; + } + }); + + report.timeslot = ((report.apptimeout - elapsed) > report.queuetimeout) ? report.queuetimeout : (report.apptimeout - elapsed); + + switch (report.strategy) { + case 'rrmemory': + diff = _.differenceBy(set1, set2, 'name'); + agent = diff.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + + saveReport(report); + + } else { + set2 = []; + agent = set1.shift(); + + if (agent) { + report.available = [{ + id: agent.id, + name: agent.name + }]; + + set2.push({ + id: agent.id, + name: agent.name + }); + saveReport(report); + } + } + + break; + case 'beepall': + report.available = set1; + saveReport(report); + + break; + default: + } + }) + .catch(function(err) { + console.error(err); + }); + + }, report.queuetimeout * 1000); + + }) + .catch(function(err) { + console.error(err); + }); + + // INTERROMPO IL ROUTING + ReportMail.afterUpdate(function(doc) { + if (doc.changed('connectid')) { + return MailRoom + .findById(doc.roomid) + .then(function(mailRoom) { + return mailRoom + .addUser(doc.memberid, { + individualHooks: true + }); + }) + .then(function() { + return ReportMailSession + .update({ + application: doc.application, + memberid: doc.memberid, + membername: doc.membername, + queue: doc.queue || null, + queuename: doc.queuename || null, + fidelity: doc.application === 'fidelity' ? doc.timeslot : null, + queuecallerleaveAt: moment().format("YYYY-MM-DD HH:mm:ss") + }, { + where: { + uniqueid: doc.uniqueid + }, + individualHooks: true + }); + }) + .then(function() { + clearInterval(interval); + clearTimeout(timeout); + return callback(null, true); + }) + .catch(function(err) { + console.error(err); + }); + } + }); + + return {}; +} + +function saveReport(report) { + var reports = []; + + report.available.forEach(function(agent, index) { + reports.push({ + uniqueid: report.uniqueid, + timeslot: report.timeslot, + subject: report.subject, + accountid: report.accountid, + accountname: report.accountname, + accountaddress: report.accountaddress, + application: report.application, + membername: agent.name, + memberid: agent.id, + queue: report.queue || null, + queuename: report.queuename || null, + roomid: report.roomid || null, + messageid: report.messageid || null, + calledAt: moment().format("YYYY-MM-DD HH:mm:ss") + }); + }); + + if (reports.length) { + return ReportMail + .bulkCreate(reports, { + individualHooks: true + }) + .catch(function(err) { + console.error(err); + }); + } +} + +// Export this file as a module +module.exports = Session; diff --git a/server/config/seed.js b/server/config/seed.js index 85a381f..f15b870 100644 --- a/server/config/seed.js +++ b/server/config/seed.js @@ -1 +1,1236 @@ -var _0x9ae8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x73","\x6C\x6F\x67","\x74\x68\x65\x6E","\x6C\x6F\x63\x61\x6C","\x61\x67\x65\x6E\x74","\x47\x69\x75\x73\x65\x70\x70\x65\x20\x43\x61\x72\x65\x72\x69","\x67\x69\x75\x73\x65\x70\x70\x65\x2E\x63\x61\x72\x65\x72\x69\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x67\x69\x75\x73\x65\x70\x70\x65\x2E\x63\x61\x72\x65\x72\x69","\x37\x35\x78\x63\x61\x6C\x6C\x79\x37\x35","\x64\x79\x6E\x61\x6D\x69\x63","\x46\x52\x49\x45\x4E\x44","\x75\x64\x70","\x61\x6C\x61\x77\x3B\x75\x6C\x61\x77\x3B\x67\x73\x6D","\x79\x65\x73","\x66\x6F\x72\x63\x65\x5F\x72\x70\x6F\x72\x74\x2C\x63\x6F\x6D\x65\x64\x69\x61","\x61\x6C\x6C","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x44\x61\x6E\x69\x65\x6C\x65\x20\x43\x69\x6E\x74\x69","\x64\x61\x6E\x69\x65\x6C\x65\x2E\x63\x69\x6E\x74\x69\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x64\x61\x6E\x69\x65\x6C\x65\x2E\x63\x69\x6E\x74\x69","\x41\x6E\x64\x72\x65\x61\x20\x42\x69\x61\x6E\x63\x6F","\x61\x6E\x64\x72\x65\x61\x2E\x62\x69\x61\x6E\x63\x6F\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x61\x6E\x64\x72\x65\x61\x2E\x62\x69\x61\x6E\x63\x6F","\x4D\x61\x73\x73\x69\x6D\x69\x6C\x69\x61\x6E\x6F\x20\x42\x75\x6E\x67\x61\x72\x6F","\x6D\x61\x73\x73\x69\x6D\x69\x6C\x69\x61\x6E\x6F\x2E\x62\x75\x6E\x67\x61\x72\x6F\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x6D\x61\x73\x73\x69\x6D\x69\x6C\x69\x61\x6E\x6F\x2E\x62\x75\x6E\x67\x61\x72\x6F","\x56\x61\x6C\x65\x72\x69\x6F\x20\x43\x69\x6F\x74\x74\x61","\x76\x61\x6C\x65\x72\x69\x6F\x2E\x63\x69\x6F\x74\x74\x61\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x76\x61\x6C\x65\x72\x69\x6F\x2E\x63\x69\x6F\x74\x74\x61","\x61\x64\x6D\x69\x6E","\x43\x6C\x61\x72\x6F\x74\x65\x63\x68","\x63\x6C\x61\x72\x6F\x74\x65\x63\x68\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x63\x6C\x61\x72\x6F\x74\x65\x63\x68","\x41\x62\x69\x67\x61\x65\x6C","\x61\x62\x69\x67\x61\x65\x6C\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x61\x62\x69\x67\x61\x65\x6C","\x54\x6F\x6E\x79\x20\x52\x75\x73\x73\x65\x6C\x6C","\x74\x6F\x6E\x79\x72\x40\x78\x63\x6C\x61\x72\x6F\x74\x65\x63\x68\x2E\x63\x6F\x2E\x7A\x61","\x74\x6F\x6E\x79\x2E\x72\x75\x73\x73\x65\x6C\x6C","\x43\x6F\x6C\x69\x6E\x20\x46\x61\x69\x72","\x63\x6F\x6C\x69\x6E\x66\x40\x78\x63\x6C\x61\x72\x6F\x74\x65\x63\x68\x2E\x63\x6F\x2E\x7A\x61","\x63\x6F\x6C\x69\x6E\x2E\x66\x61\x69\x72","\x44\x69\x65\x67\x6F\x20\x47\x6F\x73\x6D\x61\x72","\x64\x69\x65\x67\x6F\x2E\x67\x6F\x73\x6D\x61\x72\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x64\x69\x65\x67\x6F\x2E\x67\x6F\x73\x6D\x61\x72","\x47\x69\x75\x73\x65\x70\x70\x65\x20\x49\x6E\x6E\x61\x6D\x6F\x72\x61\x74\x6F","\x67\x69\x75\x73\x65\x70\x70\x65\x2E\x69\x6E\x6E\x61\x6D\x6F\x72\x61\x74\x6F\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x67\x69\x75\x73\x65\x70\x70\x65\x2E\x69\x6E\x6E\x61\x6D\x6F\x72\x61\x74\x6F","\x75\x70\x64","\x41\x6C\x65\x73\x73\x61\x6E\x64\x72\x61\x20\x42\x65\x73\x73\x6F\x6E\x65","\x61\x6C\x65\x73\x73\x61\x6E\x64\x72\x61\x2E\x62\x65\x73\x73\x6F\x6E\x65\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x61\x6C\x65\x73\x73\x61\x6E\x64\x72\x61\x2E\x62\x65\x73\x73\x6F\x6E\x65","\x46\x65\x6C\x69\x63\x65\x20\x42\x72\x69\x73\x63\x65\x73\x65","\x66\x65\x6C\x69\x63\x65\x2E\x62\x72\x69\x73\x63\x65\x73\x65\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x66\x65\x6C\x69\x63\x65\x2E\x62\x72\x69\x73\x63\x65\x73\x65","\x78\x43\x61\x6C\x6C\x79","\x69\x6E\x66\x6F\x2E\x78\x63\x61\x6C\x6C\x79\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x78\x63\x61\x6C\x6C\x79","\x33\x38\x38\x78\x73\x68\x75\x74\x74\x6C\x65\x33\x38\x38","\x4A\x6F\x68\x6E\x20\x44\x6F\x65","\x6A\x6F\x68\x6E\x2E\x64\x6F\x65\x40\x67\x6D\x61\x69\x6C\x2E\x63\x6F\x6D","\x6A\x6F\x68\x6E\x2E\x64\x6F\x65","\x4A\x61\x6E\x65\x20\x4D\x69\x6C\x6C\x65\x72","\x6A\x61\x6E\x65\x2E\x6D\x69\x6C\x6C\x65\x72\x40\x67\x6D\x61\x69\x6C\x2E\x63\x6F\x6D","\x6A\x61\x6E\x65\x2E\x6D\x69\x6C\x6C\x65\x72","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x55\x73\x65\x72","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x74\x72\x75\x6E\x6B\x73","\x63\x69\x74\x61\x6C\x69\x61","\x66\x72\x69\x65\x6E\x64","\x70\x6F\x72\x74\x2C\x69\x6E\x76\x69\x74\x65","\x30\x31\x31\x31\x39\x38\x32\x37\x37\x37\x30","\x54\x21\x4E\x50\x6E\x76\x2D\x71\x6A\x43\x4D\x65\x39\x76","\x66\x72\x6F\x6D\x2D\x76\x6F\x69\x70\x2D\x70\x72\x6F\x76\x69\x64\x65\x72","\x69\x74","\x76\x6F\x69\x70\x2E\x65\x75\x74\x65\x6C\x69\x61\x2E\x69\x74","\x72\x66\x63\x32\x38\x33\x33","\x20\x22\x22\x20\x3C\x3E","\x75\x6C\x61\x77\x3B\x61\x6C\x61\x77\x3B\x67\x73\x6D","\x6E\x6F","\x54\x72\x75\x6E\x6B","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x6F\x64\x75\x6C\x65\x73","\x64\x61\x73\x68\x62\x6F\x61\x72\x64","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x44\x41\x53\x48\x42\x4F\x41\x52\x44","\x75\x73\x65\x72\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x55\x53\x45\x52\x53","\x61\x67\x65\x6E\x74\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x47\x45\x4E\x54\x53","\x74\x65\x61\x6D\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x54\x45\x41\x4D\x53","\x63\x68\x61\x74","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x43\x48\x41\x54","\x76\x6F\x69\x63\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x56\x4F\x49\x43\x45","\x6D\x61\x69\x6C","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x4D\x41\x49\x4C","\x66\x61\x78","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x46\x41\x58","\x61\x75\x64\x69\x6F","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x55\x44\x49\x4F","\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x43\x41\x4C\x4C\x59\x53\x51\x55\x41\x52\x45","\x61\x6E\x61\x6C\x79\x74\x69\x63\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x4E\x41\x4C\x59\x54\x49\x43\x53","\x72\x65\x61\x6C\x74\x69\x6D\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x52\x45\x41\x4C\x54\x49\x4D\x45","\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x56\x4F\x49\x43\x45\x4D\x41\x49\x4C\x53","\x73\x65\x74\x74\x69\x6E\x67\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x53\x45\x54\x54\x49\x4E\x47\x53","\x4D\x6F\x64\x75\x6C\x65","\x63\x61\x74\x63\x68","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x74\x20\x71\x75\x65\x75\x65\x20\x31","\x69\x64","\x6D\x61\x70","\x61\x64\x64\x55\x73\x65\x72\x73","\x54\x31","\x66\x69\x6E\x64\x4F\x6E\x65","\x54\x65\x61\x6D","\x43\x51\x31","\x43\x51\x31\x20\x44\x65\x73\x63","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x63\x72\x65\x61\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x61\x69\x6C\x20\x71\x75\x65\x75\x65\x20\x31","\x74\x65\x61\x6D\x20\x66\x6F\x75\x6E\x64","\x74\x65\x73\x74","\x4D\x51\x31","\x4D\x51\x31\x20\x44\x65\x73\x63","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x66\x61\x78\x20\x71\x75\x65\x75\x65\x20\x31","\x46\x51\x31","\x46\x51\x31\x20\x44\x65\x73\x63","\x46\x61\x78\x51\x75\x65\x75\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x44\x65\x66\x61\x75\x6C\x74\x20\x54\x65\x61\x6D","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x61\x69\x6C\x20\x61\x63\x63\x6F\x75\x6E\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x61\x69\x6C\x20\x73\x65\x72\x76\x65\x72\x20\x69\x6E","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x61\x69\x6C\x20\x73\x65\x72\x76\x65\x72\x20\x6F\x75\x74","\x73\x6D\x74\x70\x2E\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x64\x65\x76\x65\x6C\x6F\x70\x6D\x65\x6E\x74\x40\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x70\x68\x6F\x6B\x75\x63\x6C\x6F\x6B\x61","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x69\x6D\x61\x70\x2E\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D","\x49\x4E\x42\x4F\x58","\x55\x4E\x53\x45\x45\x4E","\x49\x4D\x41\x50","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x78\x43\x61\x6C\x6C\x79\x20\x44\x65\x76\x65\x6C\x6F\x70\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x66\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74","\x73\x65\x74\x54\x72\x75\x6E\x6B","\x47\x6F\x74\x6F","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78\x2C\x73\x2C\x31","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x20\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x20\x31","\x71\x75\x65\x75\x65","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x20\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x20\x32","\x46\x41\x31\x20\x44\x65\x73\x63","\x46\x41\x31","\x78\x43\x41\x4C\x4C\x59","\x39\x36\x30\x30","\x31\x34\x34\x30\x30","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x66\x61\x78\x20\x6F\x75\x74\x62\x6F\x75\x6E\x64\x20\x76\x6F\x69\x63\x65\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x73","\x4E\x6F\x4F\x70","\x46\x61\x78\x20\x55\x55\x49\x44\x3A\x20\x24\x7B\x46\x41\x58\x55\x55\x49\x44\x7D","\x55\x73\x65\x72\x45\x76\x65\x6E\x74","\x46\x61\x78\x2C\x75\x75\x69\x64\x3A\x20\x24\x7B\x46\x41\x58\x55\x55\x49\x44\x7D","\x53\x65\x74","\x46\x41\x58\x4F\x50\x54\x28\x66\x69\x6C\x65\x6E\x61\x6D\x65\x29\x3A\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x3A\x24\x7B\x45\x43\x4D\x7D","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x3A\x24\x7B\x46\x41\x58\x48\x45\x41\x44\x45\x52\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x3A\x24\x7B\x4C\x4F\x43\x41\x4C\x49\x44\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x3A\x24\x7B\x4D\x41\x58\x52\x41\x54\x45\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x3A\x24\x7B\x4D\x49\x4E\x52\x41\x54\x45\x7D","\x53\x65\x6E\x64\x46\x41\x58","\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D\x2C\x64","\x45\x52\x52\x4F\x52\x20\x22\x24\x7B\x54\x49\x4D\x45\x53\x54\x41\x4D\x50\x7D\x22\x20\x22\x4E\x4F\x5F\x53\x54\x41\x54\x55\x53\x22\x20\x22\x4E\x4F\x5F\x50\x41\x47\x45\x53\x22","\x68","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x7D","\x46\x61\x78\x53\x74\x61\x74\x75\x73\x20\x3A\x20\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x7D","\x46\x61\x78\x53\x74\x61\x74\x75\x73\x53\x74\x72\x69\x6E\x67\x20\x3A\x20\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x53\x54\x52\x49\x4E\x47\x7D","\x46\x61\x78\x45\x72\x72\x6F\x72\x20\x3A\x20\x24\x7B\x46\x41\x58\x45\x52\x52\x4F\x52\x7D","\x52\x65\x6D\x6F\x74\x65\x53\x74\x61\x74\x69\x6F\x6E\x49\x44\x20\x3A\x20\x24\x7B\x52\x45\x4D\x4F\x54\x45\x53\x54\x41\x54\x49\x4F\x4E\x49\x44\x7D","\x46\x61\x78\x50\x61\x67\x65\x73\x20\x3A\x20\x24\x7B\x46\x41\x58\x50\x41\x47\x45\x53\x7D","\x46\x61\x78\x42\x69\x74\x52\x61\x74\x65\x20\x3A\x20\x24\x7B\x46\x41\x58\x42\x49\x54\x52\x41\x54\x45\x7D","\x46\x61\x78\x52\x65\x73\x6F\x6C\x75\x74\x69\x6F\x6E\x20\x3A\x20\x24\x7B\x46\x41\x58\x52\x45\x53\x4F\x4C\x55\x54\x49\x4F\x4E\x7D","\x4F\x4B\x20\x22\x24\x7B\x54\x49\x4D\x45\x53\x54\x41\x4D\x50\x7D\x22\x20\x22\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x53\x54\x52\x49\x4E\x47\x7D\x22\x20\x22\x24\x7B\x46\x41\x58\x50\x41\x47\x45\x53\x7D\x22","\x2A\x2A\x2A\x2A\x20\x46\x41\x58\x20\x52\x45\x43\x45\x49\x56\x45\x44\x20\x66\x72\x6F\x6D\x20\x24\x7B\x43\x41\x4C\x4C\x45\x52\x49\x44\x28\x6E\x75\x6D\x29\x7D\x20\x24\x7B\x53\x54\x52\x46\x54\x49\x4D\x45\x28\x24\x7B\x45\x50\x4F\x43\x48\x7D\x2C\x2C\x25\x63\x29\x7D\x20\x2A\x2A\x2A\x2A","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x3A\x79\x65\x73","\x46\x49\x4C\x45\x4E\x41\x4D\x45\x3A\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D","\x46\x41\x58\x46\x49\x4C\x45\x3A\x24\x7B\x46\x49\x4C\x45\x4E\x41\x4D\x45\x7D\x2E\x74\x69\x66","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x3A\x52\x65\x63\x65\x69\x76\x65\x64\x20\x62\x79\x20\x58\x65\x6E\x69\x61\x4C\x41\x42\x20\x24\x7B\x53\x54\x52\x46\x54\x49\x4D\x45\x28\x24\x7B\x45\x50\x4F\x43\x48\x7D\x2C\x2C\x25\x59\x2D\x25\x6D\x2D\x25\x64\x20\x25\x48\x3A\x25\x4D\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x7D","\x2A\x2A\x2A\x2A\x20\x52\x45\x43\x45\x49\x56\x49\x4E\x47\x20\x46\x41\x58\x20\x3A\x20\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D\x20\x2A\x2A\x2A\x2A","\x52\x65\x63\x65\x69\x76\x65\x46\x61\x78","\x2F\x74\x6D\x70\x2F\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D","\x48\x61\x6E\x67\x75\x70","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x73\x71\x75\x61\x72\x65\x20\x70\x72\x6F\x6A\x65\x63\x74\x73","\x70\x72\x6F\x6A\x65\x63\x74\x31","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x70\x72\x6F\x6A\x65\x63\x74","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x78\x43\x61\x6C\x6C\x79\x20\x53\x68\x6F\x70","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D\x2F\x73\x68\x6F\x70\x2F","\x23\x66\x35\x31\x31\x31\x31","\x68\x74\x74\x70\x3A\x2F\x2F\x6C\x6F\x63\x61\x6C\x68\x6F\x73\x74\x3A\x39\x30\x30\x30","\x73\x71\x75\x61\x72\x65\x64","\x57\x65\x20\x61\x72\x65\x20\x68\x65\x72\x65\x21","\x51\x75\x65\x73\x74\x69\x6F\x6E\x73\x3F\x20\x49\x6E\x73\x65\x72\x74\x20\x79\x6F\x75\x72\x20\x6E\x61\x6D\x65\x20\x61\x6E\x64\x20\x65\x6D\x61\x69\x6C\x20\x61\x64\x64\x72\x65\x73\x73\x20\x74\x6F\x20\x73\x74\x61\x72\x74\x20\x61\x20\x6C\x69\x76\x65\x2D\x63\x68\x61\x74\x20\x77\x69\x74\x68\x20\x6F\x75\x72\x20\x73\x75\x70\x70\x6F\x72\x74\x20\x74\x65\x61\x6D\x2E","\x59\x6F\x75\x72\x20\x6E\x61\x6D\x65","\x59\x6F\x75\x72\x20\x65\x6D\x61\x69\x6C\x20\x61\x64\x64\x72\x65\x73\x73","\x43\x68\x61\x74","\x43\x6F\x6E\x74\x61\x63\x74\x20\x75\x73","\x3C\x73\x74\x72\x6F\x6E\x67\x3E\x57\x65\x27\x72\x65\x20\x6E\x6F\x74\x20\x6F\x6E\x6C\x69\x6E\x65\x2E\x3C\x2F\x73\x74\x72\x6F\x6E\x67\x3E\x3C\x62\x72\x20\x2F\x3E\x49\x74\x20\x64\x6F\x65\x73\x6E\x27\x74\x20\x6D\x65\x61\x6E\x20\x77\x65\x27\x72\x65\x20\x6E\x6F\x74\x20\x74\x68\x65\x72\x65\x20\x74\x6F\x20\x68\x65\x6C\x70\x20\x2D\x20\x6C\x65\x61\x76\x65\x20\x79\x6F\x75\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x62\x65\x6C\x6F\x77\x20\x61\x6E\x64\x20\x77\x65\x27\x6C\x6C\x20\x62\x65\x20\x69\x6E\x20\x74\x6F\x75\x63\x68\x20\x61\x73\x20\x73\x6F\x6F\x6E\x20\x61\x73\x20\x70\x6F\x73\x73\x69\x62\x6C\x65\x2E\x27","\x59\x6F\x75\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x2E\x2E\x2E","\x4C\x65\x61\x76\x65\x20\x6D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x76\x61\x72\x69\x61\x62\x6C\x65\x31","\x56\x61\x72\x69\x61\x62\x6C\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x44\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x28\x44\x4F\x20\x4E\x4F\x54\x20\x44\x45\x4C\x45\x54\x45\x29","\x66\x72\x6F\x6D\x2D\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x6F\x68\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x64\x65\x66\x61\x75\x6C\x74","\x66\x69\x6C\x65\x73","\x76\x61\x72\x2F\x6C\x69\x62\x2F\x61\x73\x74\x65\x72\x69\x73\x6B\x2F\x6D\x6F\x68","\x61\x6C\x70\x68\x61","\x77\x61\x76","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x2F\x76\x61\x72\x2F\x6F\x70\x74\x2F\x6D\x6F\x74\x69\x6F\x6E\x2F\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x73\x6F\x75\x6E\x64\x73\x2F\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x53\x65\x74\x74\x69\x6E\x67\x73","\x4D\x6F\x74\x69\x6F\x6E\x20\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x63\x6F\x6C\x2D\x6D\x64\x2D\x34","\x63\x6C\x6F\x63\x6B","\x43\x6C\x6F\x63\x6B","\x68\x68\x3A\x6D\x6D\x3A\x73\x73\x20\x61","\x64\x64\x64\x64\x2C\x20\x4D\x4D\x4D\x4D\x20\x44\x6F\x20\x59\x59\x59\x59","\x63\x6F\x6C\x2D\x6D\x64\x2D\x38","\x69\x66\x72\x61\x6D\x65","\x49\x66\x72\x61\x6D\x65","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x64\x65\x6D\x6F\x2E\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D\x2F\x73\x68\x6F\x70\x2F","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x5A\x65\x6E\x64\x65\x73\x6B","\x31\x2E\x30\x2E\x30","\x58\x65\x6E\x69\x61\x4C\x41\x42\x20\x73\x2E\x72\x2E\x6C\x2E","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x32\x2E\x70\x6E\x67","\x7A\x65\x6E\x64\x65\x73\x6B","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x5A\x65\x6E\x64\x65\x73\x6B","\x44\x65\x73\x6B\x2E\x63\x6F\x6D","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x64\x65\x73\x6B\x32\x2E\x70\x6E\x67","\x64\x65\x73\x6B","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x44\x65\x73\x6B\x2E\x63\x6F\x6D","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x32\x2E\x70\x6E\x67","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65","\x46\x72\x65\x73\x68\x64\x65\x73\x6B","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2E\x70\x6E\x67","\x66\x72\x65\x73\x68\x64\x65\x73\x6B","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x46\x72\x65\x73\x68\x64\x65\x73\x6B","\x53\x75\x67\x61\x72\x43\x52\x4D","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x32\x2E\x70\x6E\x67","\x73\x75\x67\x61\x72\x63\x72\x6D","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x53\x75\x67\x61\x72\x43\x52\x4D","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x5B\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x23\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x4D\x6F\x74\x69\x6F\x6E\x20\x52\x65\x70\x6F\x72\x74\x73\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x22\x69\x63\x6F\x6E\x2D\x72\x6F\x63\x6B\x65\x74\x22\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x7D\x7D\x2C\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x31\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x42\x61\x73\x69\x63\x20\x4E\x6F\x64\x65\x22\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x7D\x5D","\x5B\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x43\x75\x73\x74\x6F\x6D\x20\x52\x65\x70\x6F\x72\x74\x73\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x22\x69\x63\x6F\x6E\x2D\x62\x6F\x6F\x6B\x2D\x6F\x70\x65\x6E\x22\x2C\x22\x6C\x69\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x7D\x2C\x22\x61\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x68\x72\x65\x66\x22\x3A\x22\x23\x22\x2C\x22\x69\x64\x22\x3A\x22\x31\x5F\x61\x6E\x63\x68\x6F\x72\x22\x7D\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x6C\x6F\x61\x64\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x64\x69\x73\x61\x62\x6C\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x2C\x22\x64\x61\x74\x61\x22\x3A\x7B\x7D\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x23\x22\x7D\x2C\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x42\x61\x73\x69\x63\x20\x4E\x6F\x64\x65\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x74\x72\x75\x65\x2C\x22\x6C\x69\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x7D\x2C\x22\x61\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x68\x72\x65\x66\x22\x3A\x22\x23\x22\x2C\x22\x69\x64\x22\x3A\x22\x32\x5F\x61\x6E\x63\x68\x6F\x72\x22\x7D\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x6C\x6F\x61\x64\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x64\x69\x73\x61\x62\x6C\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x2C\x22\x64\x61\x74\x61\x22\x3A\x7B\x7D\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x31\x22\x7D\x5D","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x4D\x6F\x74\x69\x6F\x6E\x20\x53\x65\x72\x76\x69\x63\x65","\x53\x65\x72\x76\x69\x63\x65"];_0x9ae8[0];var _=require(_0x9ae8[1]);var models=require(_0x9ae8[2]);models[_0x9ae8[69]][_0x9ae8[68]]([{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[8],email:_0x9ae8[9],name:_0x9ae8[10],password:_0x9ae8[11],defaultuser:_0x9ae8[10],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1000},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[20],email:_0x9ae8[21],name:_0x9ae8[22],password:_0x9ae8[11],defaultuser:_0x9ae8[22],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1001},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[23],email:_0x9ae8[24],name:_0x9ae8[25],password:_0x9ae8[11],defaultuser:_0x9ae8[25],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1002},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[26],email:_0x9ae8[27],name:_0x9ae8[28],password:_0x9ae8[11],defaultuser:_0x9ae8[28],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1003},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[29],email:_0x9ae8[30],name:_0x9ae8[31],password:_0x9ae8[11],defaultuser:_0x9ae8[31],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1004},{provider:_0x9ae8[6],role:_0x9ae8[32],fullname:_0x9ae8[33],email:_0x9ae8[34],name:_0x9ae8[35],password:_0x9ae8[35],defaultuser:_0x9ae8[35],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1005},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[36],email:_0x9ae8[37],name:_0x9ae8[38],password:_0x9ae8[11],defaultuser:_0x9ae8[38],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1006},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[39],email:_0x9ae8[40],name:_0x9ae8[41],password:_0x9ae8[35],defaultuser:_0x9ae8[41],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1007},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[42],email:_0x9ae8[43],name:_0x9ae8[44],password:_0x9ae8[35],defaultuser:_0x9ae8[44],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1008},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[45],email:_0x9ae8[46],name:_0x9ae8[47],password:_0x9ae8[11],defaultuser:_0x9ae8[47],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1009},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[48],email:_0x9ae8[49],name:_0x9ae8[50],password:_0x9ae8[11],defaultuser:_0x9ae8[50],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[51],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1010},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[52],email:_0x9ae8[53],name:_0x9ae8[54],password:_0x9ae8[11],defaultuser:_0x9ae8[54],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[51],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1011},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[55],email:_0x9ae8[56],name:_0x9ae8[57],password:_0x9ae8[11],defaultuser:_0x9ae8[57],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[51],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1012},{provider:_0x9ae8[6],role:_0x9ae8[32],fullname:_0x9ae8[58],email:_0x9ae8[59],name:_0x9ae8[60],password:_0x9ae8[61],defaultuser:_0x9ae8[60],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1013},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[62],email:_0x9ae8[63],name:_0x9ae8[64],password:_0x9ae8[11],defaultuser:_0x9ae8[64],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1014},{provider:_0x9ae8[6],role:_0x9ae8[7],fullname:_0x9ae8[65],email:_0x9ae8[66],name:_0x9ae8[67],password:_0x9ae8[11],defaultuser:_0x9ae8[67],host:_0x9ae8[12],type:_0x9ae8[13],transport:_0x9ae8[14],allow:_0x9ae8[15],qualify:_0x9ae8[16],nat:_0x9ae8[17],disallow:_0x9ae8[18],context:_0x9ae8[19],internal:1015}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[3])});models[_0x9ae8[83]][_0x9ae8[68]]([{name:_0x9ae8[71],type:_0x9ae8[72],insecure:_0x9ae8[73],defaultuser:_0x9ae8[74],secret:_0x9ae8[75],password:_0x9ae8[75],context:_0x9ae8[76],language:_0x9ae8[77],host:_0x9ae8[78],fromdomain:_0x9ae8[78],dtmfmode:_0x9ae8[79],qualify:_0x9ae8[16],nat:_0x9ae8[17],callerid:_0x9ae8[80],limitonpeers:_0x9ae8[16],callcounter:_0x9ae8[16],disallow:_0x9ae8[18],allow:_0x9ae8[81],canreinvite:_0x9ae8[82],directmedia:_0x9ae8[82]}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[70])});models[_0x9ae8[113]][_0x9ae8[68]]([{name:_0x9ae8[85],title:_0x9ae8[86]},{name:_0x9ae8[87],title:_0x9ae8[88]},{name:_0x9ae8[89],title:_0x9ae8[90]},{name:_0x9ae8[91],title:_0x9ae8[92]},{name:_0x9ae8[93],title:_0x9ae8[94]},{name:_0x9ae8[95],title:_0x9ae8[96]},{name:_0x9ae8[97],title:_0x9ae8[98]},{name:_0x9ae8[99],title:_0x9ae8[100]},{name:_0x9ae8[101],title:_0x9ae8[102]},{name:_0x9ae8[103],title:_0x9ae8[104]},{name:_0x9ae8[105],title:_0x9ae8[106]},{name:_0x9ae8[107],title:_0x9ae8[108]},{name:_0x9ae8[109],title:_0x9ae8[110]},{name:_0x9ae8[111],title:_0x9ae8[112]}],{ignoreDuplicates:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[84])});models[_0x9ae8[121]][_0x9ae8[125]]({name:_0x9ae8[119],description:_0x9ae8[138],defaultEntry:true})[_0x9ae8[5]](function(_0x48bax4){models[_0x9ae8[69]][_0x9ae8[137]]({where:{role:_0x9ae8[7]}})[_0x9ae8[5]](function(_0x48bax5){_0x48bax4[_0x9ae8[118]](_[_0x9ae8[117]](_0x48bax5,_0x9ae8[116]))[_0x9ae8[5]](function(){models[_0x9ae8[126]][_0x9ae8[125]]({name:_0x9ae8[122],description:_0x9ae8[123],timeout:5,strategy:_0x9ae8[124]})[_0x9ae8[5]](function(_0x48bax6){console[_0x9ae8[4]](_0x9ae8[115]);models[_0x9ae8[121]][_0x9ae8[120]]({where:{name:_0x9ae8[119]},include:[{all:true}]})[_0x9ae8[5]](function(_0x48bax4){_0x48bax6[_0x9ae8[118]](_[_0x9ae8[117]](_0x48bax4.Users,_0x9ae8[116]))[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})});models[_0x9ae8[132]][_0x9ae8[125]]({name:_0x9ae8[130],description:_0x9ae8[131],timeout:5,strategy:_0x9ae8[124]})[_0x9ae8[5]](function(_0x48bax7){console[_0x9ae8[4]](_0x9ae8[127]);models[_0x9ae8[121]][_0x9ae8[120]]({where:{name:_0x9ae8[119]},include:[{all:true}]})[_0x9ae8[5]](function(_0x48bax4){if(_0x48bax4){console[_0x9ae8[4]](_0x9ae8[128])}else {console[_0x9ae8[4]](_0x9ae8[129])};_0x48bax7[_0x9ae8[118]](_[_0x9ae8[117]](_0x48bax4.Users,_0x9ae8[116]))[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})});models[_0x9ae8[136]][_0x9ae8[125]]({name:_0x9ae8[134],description:_0x9ae8[135],timeout:5,strategy:_0x9ae8[124]})[_0x9ae8[5]](function(_0x48bax8){console[_0x9ae8[4]](_0x9ae8[133]);models[_0x9ae8[121]][_0x9ae8[120]]({where:{name:_0x9ae8[119]},include:[{all:true}]})[_0x9ae8[5]](function(_0x48bax4){_0x48bax8[_0x9ae8[118]](_[_0x9ae8[117]](_0x48bax4.Users,_0x9ae8[116]))[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})})})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[152]][_0x9ae8[125]]({name:_0x9ae8[151],description:_0x9ae8[151],address:_0x9ae8[143]})[_0x9ae8[5]](function(_0x48bax9){console[_0x9ae8[4]](_0x9ae8[139]);models[_0x9ae8[150]][_0x9ae8[125]]({description:_0x9ae8[60],host:_0x9ae8[146],username:_0x9ae8[143],password:_0x9ae8[144],port:143,mailbox:_0x9ae8[147],ssl:false,delete:false,filter:_0x9ae8[148],protocol:_0x9ae8[149],MailAccountId:_0x48bax9[_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[140]);models[_0x9ae8[145]][_0x9ae8[125]]({description:_0x9ae8[60],host:_0x9ae8[142],username:_0x9ae8[143],password:_0x9ae8[144],port:587,ssl:false,MailAccountId:_0x48bax9[_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[141])})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})});models[_0x9ae8[168]][_0x9ae8[125]]({description:_0x9ae8[163],name:_0x9ae8[164],phone:_0x9ae8[74],ecm:true,faxheader:_0x9ae8[165],localid:_0x9ae8[74],maxrate:_0x9ae8[166],minrate:_0x9ae8[167]})[_0x9ae8[5]](function(_0x48baxa){console[_0x9ae8[4]](_0x9ae8[153]);models[_0x9ae8[83]][_0x9ae8[120]]({where:{name:_0x9ae8[71]}})[_0x9ae8[5]](function(_0x48baxb){_0x48baxa[_0x9ae8[154]](_0x48baxb)[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[158]][_0x9ae8[125]]({context:_0x9ae8[76],exten:_0x9ae8[74],priority:1,app:_0x9ae8[155],appdata:_0x9ae8[156],type:_0x9ae8[157]})})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[136]][_0x9ae8[137]]()[_0x9ae8[5]](function(_0x48baxc){models[_0x9ae8[161]][_0x9ae8[125]]({app:_0x9ae8[160],appdata:_0x48baxc[0][_0x9ae8[116]],priority:1,timeout:30,FaxAccountId:_0x48baxa[_0x9ae8[116]],FaxQueueId:_0x48baxc[0][_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[159])})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[161]][_0x9ae8[125]]({app:_0x9ae8[160],appdata:_0x48baxc[1][_0x9ae8[116]],priority:2,timeout:30,FaxAccountId:_0x48baxa[_0x9ae8[116]],FaxQueueId:_0x48baxc[1][_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[162])})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[158]][_0x9ae8[68]]([{context:_0x9ae8[170],exten:_0x9ae8[171],priority:1,app:_0x9ae8[172],appdata:_0x9ae8[173],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:2,app:_0x9ae8[174],appdata:_0x9ae8[175],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:3,app:_0x9ae8[176],appdata:_0x9ae8[177],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:4,app:_0x9ae8[176],appdata:_0x9ae8[178],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:5,app:_0x9ae8[176],appdata:_0x9ae8[179],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:6,app:_0x9ae8[176],appdata:_0x9ae8[180],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:7,app:_0x9ae8[176],appdata:_0x9ae8[181],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:8,app:_0x9ae8[176],appdata:_0x9ae8[182],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:9,app:_0x9ae8[183],appdata:_0x9ae8[184],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[171],priority:10,app:_0x9ae8[172],appdata:_0x9ae8[185],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:1,app:_0x9ae8[172],appdata:_0x9ae8[187],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:2,app:_0x9ae8[172],appdata:_0x9ae8[188],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:3,app:_0x9ae8[172],appdata:_0x9ae8[189],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:4,app:_0x9ae8[172],appdata:_0x9ae8[190],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:5,app:_0x9ae8[172],appdata:_0x9ae8[191],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:6,app:_0x9ae8[172],appdata:_0x9ae8[192],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:7,app:_0x9ae8[172],appdata:_0x9ae8[193],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:8,app:_0x9ae8[172],appdata:_0x9ae8[194],type:_0x9ae8[170]},{context:_0x9ae8[170],exten:_0x9ae8[186],priority:9,app:_0x9ae8[172],appdata:_0x9ae8[195],type:_0x9ae8[170]}],{ignoreDuplicates:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[169])});models[_0x9ae8[158]][_0x9ae8[68]]([{context:_0x9ae8[157],exten:_0x9ae8[171],priority:1,app:_0x9ae8[172],appdata:_0x9ae8[196],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:2,app:_0x9ae8[176],appdata:_0x9ae8[197],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:3,app:_0x9ae8[176],appdata:_0x9ae8[198],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:4,app:_0x9ae8[176],appdata:_0x9ae8[199],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:5,app:_0x9ae8[176],appdata:_0x9ae8[200],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:6,app:_0x9ae8[176],appdata:_0x9ae8[180],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:7,app:_0x9ae8[176],appdata:_0x9ae8[181],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:8,app:_0x9ae8[176],appdata:_0x9ae8[182],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:9,app:_0x9ae8[172],appdata:_0x9ae8[187],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:10,app:_0x9ae8[172],appdata:_0x9ae8[201],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:11,app:_0x9ae8[172],appdata:_0x9ae8[202],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:12,app:_0x9ae8[172],appdata:_0x9ae8[203],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:13,app:_0x9ae8[172],appdata:_0x9ae8[204],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:14,app:_0x9ae8[172],appdata:_0x9ae8[205],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:15,app:_0x9ae8[206],appdata:_0x9ae8[207],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[171],priority:16,app:_0x9ae8[208],type:_0x9ae8[157]},{context:_0x9ae8[157],exten:_0x9ae8[186],priority:1,app:_0x9ae8[172],appdata:_0x9ae8[187],type:_0x9ae8[157]}],{ignoreDuplicates:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[169])});models[_0x9ae8[212]][_0x9ae8[68]]([{name:_0x9ae8[210],description:_0x9ae8[211]}],{ignoreDuplicates:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[209])});models[_0x9ae8[229]][_0x9ae8[125]]({name:_0x9ae8[215],description:_0x9ae8[215],address:_0x9ae8[216],color:_0x9ae8[217],color_focus:_0x9ae8[217],color_button:_0x9ae8[217],remote:_0x9ae8[218],animation:true,header_shape:_0x9ae8[219],header_online:_0x9ae8[220],online_message:_0x9ae8[221],username_placeholder:_0x9ae8[222],email_placeholder:_0x9ae8[223],start_chat_button:_0x9ae8[224],header_offline:_0x9ae8[225],offline_message:_0x9ae8[226],enquiry_message_placeholder:_0x9ae8[227],enquiry_button:_0x9ae8[228],download_transcript:true})[_0x9ae8[5]](function(_0x48baxd){console[_0x9ae8[4]](_0x9ae8[213]);models[_0x9ae8[126]][_0x9ae8[137]]()[_0x9ae8[5]](function(_0x48baxe){models[_0x9ae8[214]][_0x9ae8[125]]({app:_0x9ae8[160],appdata:_0x48baxe[0][_0x9ae8[116]],priority:1,timeout:30,ChatWebsiteId:_0x48baxd[_0x9ae8[116]],ChatQueueId:_0x48baxe[0][_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[159])})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[214]][_0x9ae8[125]]({app:_0x9ae8[160],appdata:_0x48baxe[1][_0x9ae8[116]],priority:2,timeout:30,ChatWebsiteId:_0x48baxd[_0x9ae8[116]],ChatQueueId:_0x48baxe[1][_0x9ae8[116]]})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[162])})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){})})[_0x9ae8[114]](function(_0x48bax3){});models[_0x9ae8[232]][_0x9ae8[68]]([{name:_0x9ae8[231],description:_0x9ae8[211]}],{ignoreDuplicates:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[230])});models[_0x9ae8[236]][_0x9ae8[68]]([{name:_0x9ae8[19],description:_0x9ae8[234],defaultEntry:true},{name:_0x9ae8[76],description:_0x9ae8[234],defaultEntry:true},{name:_0x9ae8[157],description:_0x9ae8[234],defaultEntry:true},{name:_0x9ae8[170],description:_0x9ae8[234],defaultEntry:true},{name:_0x9ae8[235],description:_0x9ae8[234],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[233])});models[_0x9ae8[243]][_0x9ae8[68]]([{name:_0x9ae8[238],mode:_0x9ae8[239],directory:_0x9ae8[240],sort:_0x9ae8[241],format:_0x9ae8[242],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[237])});models[_0x9ae8[245]][_0x9ae8[68]]([{id:1,min_internal:1000,soundPath:_0x9ae8[244]}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[237])});models[_0x9ae8[257]][_0x9ae8[68]]([{id:1,name:_0x9ae8[246],model:JSON[_0x9ae8[256]]({title:_0x9ae8[246],rows:[{columns:[{styleClass:_0x9ae8[247],widgets:[{type:_0x9ae8[248],title:_0x9ae8[249],config:{timePattern:_0x9ae8[250],datePattern:_0x9ae8[251]}}]},{styleClass:_0x9ae8[252],widgets:[{type:_0x9ae8[253],title:_0x9ae8[254],config:{url:_0x9ae8[255]}}]}]}]}),defaultEntry:true,editable:false}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[237])});models[_0x9ae8[281]][_0x9ae8[68]]([{name:_0x9ae8[259],version:_0x9ae8[260],active:false,author:_0x9ae8[261],logo:_0x9ae8[262],state:_0x9ae8[263],description:_0x9ae8[264]},{name:_0x9ae8[265],version:_0x9ae8[260],active:false,author:_0x9ae8[261],logo:_0x9ae8[266],state:_0x9ae8[267],description:_0x9ae8[268]},{name:_0x9ae8[269],version:_0x9ae8[260],active:false,author:_0x9ae8[261],logo:_0x9ae8[270],state:_0x9ae8[271],description:_0x9ae8[272]},{name:_0x9ae8[273],version:_0x9ae8[260],active:false,author:_0x9ae8[261],logo:_0x9ae8[274],state:_0x9ae8[275],description:_0x9ae8[276]},{name:_0x9ae8[277],version:_0x9ae8[260],active:false,author:_0x9ae8[261],logo:_0x9ae8[278],state:_0x9ae8[279],description:_0x9ae8[280]}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[258])});models[_0x9ae8[284]][_0x9ae8[68]]([{id:1,tree:_0x9ae8[282]},{id:2,tree:_0x9ae8[283]}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[258])});models[_0x9ae8[286]][_0x9ae8[68]]([{id:1,name:_0x9ae8[285],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0x9ae8[5]](function(){console[_0x9ae8[4]](_0x9ae8[258])}) \ No newline at end of file +/** + * Populate DB with sample data on server start + * to disable, edit config/environment/index.js, and set `seedDB: false` + */ + +'use strict'; + +var _ = require('lodash'); +var models = require('../models'); + +models.User + .bulkCreate([{ + provider: 'local', + role: 'agent', + fullname: 'Giuseppe Careri', + email: 'giuseppe.careri@xcally.com', + name: 'giuseppe.careri', + password: '75xcally75', + defaultuser: 'giuseppe.careri', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1000 + }, { + provider: 'local', + role: 'agent', + fullname: 'Daniele Cinti', + email: 'daniele.cinti@xcally.com', + name: 'daniele.cinti', + password: '75xcally75', + defaultuser: 'daniele.cinti', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1001 + }, { + provider: 'local', + role: 'agent', + fullname: 'Andrea Bianco', + email: 'andrea.bianco@xcally.com', + name: 'andrea.bianco', + password: '75xcally75', + defaultuser: 'andrea.bianco', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1002 + }, { + provider: 'local', + role: 'agent', + fullname: 'Massimiliano Bungaro', + email: 'massimiliano.bungaro@xcally.com', + name: 'massimiliano.bungaro', + password: '75xcally75', + defaultuser: 'massimiliano.bungaro', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1003 + }, { + provider: 'local', + role: 'agent', + fullname: 'Valerio Ciotta', + email: 'valerio.ciotta@xcally.com', + name: 'valerio.ciotta', + password: '75xcally75', + defaultuser: 'valerio.ciotta', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1004 + }, { + provider: 'local', + role: 'admin', + fullname: 'Clarotech', + email: 'clarotech@xcally.com', + name: 'clarotech', + password: 'clarotech', + defaultuser: 'clarotech', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1005 + }, { + provider: 'local', + role: 'agent', + fullname: 'Abigael', + email: 'abigael@xcally.com', + name: 'abigael', + password: '75xcally75', + defaultuser: 'abigael', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1006 + }, { + provider: 'local', + role: 'agent', + fullname: 'Tony Russell', + email: 'tonyr@xclarotech.co.za', + name: 'tony.russell', + password: 'clarotech', + defaultuser: 'tony.russell', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1007 + }, { + provider: 'local', + role: 'agent', + fullname: 'Colin Fair', + email: 'colinf@xclarotech.co.za', + name: 'colin.fair', + password: 'clarotech', + defaultuser: 'colin.fair', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1008 + }, { + provider: 'local', + role: 'agent', + fullname: 'Diego Gosmar', + email: 'diego.gosmar@xcally.com', + name: 'diego.gosmar', + password: '75xcally75', + defaultuser: 'diego.gosmar', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1009 + }, { + provider: 'local', + role: 'agent', + fullname: 'Giuseppe Innamorato', + email: 'giuseppe.innamorato@xcally.com', + name: 'giuseppe.innamorato', + password: '75xcally75', + defaultuser: 'giuseppe.innamorato', + host: 'dynamic', + type: 'FRIEND', + transport: 'upd', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1010 + }, { + provider: 'local', + role: 'agent', + fullname: 'Alessandra Bessone', + email: 'alessandra.bessone@xcally.com', + name: 'alessandra.bessone', + password: '75xcally75', + defaultuser: 'alessandra.bessone', + host: 'dynamic', + type: 'FRIEND', + transport: 'upd', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1011 + }, { + provider: 'local', + role: 'agent', + fullname: 'Felice Briscese', + email: 'felice.briscese@xcally.com', + name: 'felice.briscese', + password: '75xcally75', + defaultuser: 'felice.briscese', + host: 'dynamic', + type: 'FRIEND', + transport: 'upd', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1012 + }, { + provider: 'local', + role: 'admin', + fullname: 'xCally', + email: 'info.xcally@xcally.com', + name: 'xcally', + password: '388xshuttle388', + defaultuser: 'xcally', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1013 + }, { + provider: 'local', + role: 'agent', + fullname: 'John Doe', + email: 'john.doe@gmail.com', + name: 'john.doe', + password: '75xcally75', + defaultuser: 'john.doe', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1014 + }, { + provider: 'local', + role: 'agent', + fullname: 'Jane Miller', + email: 'jane.miller@gmail.com', + name: 'jane.miller', + password: '75xcally75', + defaultuser: 'jane.miller', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1015 + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating users'); + }); + +models.Trunk + .bulkCreate([{ + name: 'citalia', + type: 'friend', + insecure: 'port,invite', + defaultuser: '01119827770', + secret: 'T!NPnv-qjCMe9v', + password: 'T!NPnv-qjCMe9v', + context: 'from-voip-provider', + language: 'it', + host: 'voip.eutelia.it', + fromdomain: 'voip.eutelia.it', + dtmfmode: 'rfc2833', + qualify: 'yes', + nat: 'force_rport,comedia', + callerid: ' "" <>', + limitonpeers: 'yes', + callcounter: 'yes', + disallow: 'all', + allow: 'ulaw;alaw;gsm', + canreinvite: 'no', + directmedia: 'no' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating trunks'); + }); + + +// Init modules table +models.Module + .bulkCreate([{ + name: "dashboard", + title: "APPLICATION_DASHBOARD" + }, { + name: "users", + title: "APPLICATION_USERS" + }, { + name: "agents", + title: "APPLICATION_AGENTS" + }, { + name: "teams", + title: "APPLICATION_TEAMS" + }, { + name: "chat", + title: "APPLICATION_CHAT" + }, { + name: "voice", + title: "APPLICATION_VOICE" + }, { + name: "mail", + title: "APPLICATION_MAIL" + }, { + name: "fax", + title: "APPLICATION_FAX" + }, { + name: "audio", + title: "APPLICATION_AUDIO" + }, { + name: "callysquare", + title: "APPLICATION_CALLYSQUARE" + }, { + name: "analytics", + title: "APPLICATION_ANALYTICS" + }, { + name: "realtime", + title: "APPLICATION_REALTIME" + }, { + name: "voicemails", + title: "APPLICATION_VOICEMAILS" + }, { + name: "settings", + title: "APPLICATION_SETTINGS" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating modules'); + }); + +models.Team + .create({ + name: "T1", + description: "Default Team", + defaultEntry: true + }) + .then(function(team) { + + models.User + .findAll({ + where: { + role: 'agent' + } + }) + .then(function(users) { + team + .addUsers(_.map(users, 'id')) + .then(function() { + models.ChatQueue + .create({ + name: "CQ1", + description: "CQ1 Desc", + timeout: 5, + strategy: "rrmemory" + }) + .then(function(chatQueue) { + console.log('Finished populating chat queue 1'); + + models.Team + .findOne({ + where: { + name: 'T1' + }, + include: [{ + all: true + }] + }) + .then(function(team) { + chatQueue + .addUsers(_.map(team.Users, 'id')) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }); + + models.MailQueue + .create({ + name: "MQ1", + description: "MQ1 Desc", + timeout: 5, + strategy: "rrmemory" + }) + .then(function(mailQueue) { + console.log('Finished populating mail queue 1'); + + models.Team + .findOne({ + where: { + name: 'T1' + }, + include: [{ + all: true + }] + }) + .then(function(team) { + if (team) { + console.log('team found'); + } else { + console.log('test'); + } + mailQueue + .addUsers(_.map(team.Users, 'id')) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }); + + models.FaxQueue + .create({ + name: "FQ1", + description: "FQ1 Desc", + timeout: 5, + strategy: "rrmemory" + }) + .then(function(faxQueue) { + console.log('Finished populating fax queue 1'); + + models.Team + .findOne({ + where: { + name: 'T1' + }, + include: [{ + all: true + }] + }) + .then(function(team) { + faxQueue + .addUsers(_.map(team.Users, 'id')) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + +models.MailAccount + .create({ + name: "xCally Development", + description: "xCally Development", + address: "development@xcally.com" + }) + .then(function(mailAccount) { + console.log('Finished populating mail account'); + models.MailServerIn + .create({ + description: 'xcally', + host: 'imap.xcally.com', + username: 'development@xcally.com', + password: 'phokucloka', + port: 143, + mailbox: 'INBOX', + ssl: false, + delete: false, + filter: 'UNSEEN', + protocol: 'IMAP', + MailAccountId: mailAccount.id + }) + .then(function() { + console.log('Finished populating mail server in'); + models.MailServerOut + .create({ + description: 'xcally', + host: 'smtp.xcally.com', + username: 'development@xcally.com', + password: 'phokucloka', + port: 587, + ssl: false, + MailAccountId: mailAccount.id + }) + .then(function() { + console.log('Finished populating mail server out'); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }); + +models.FaxAccount + .create({ + description: 'FA1 Desc', + name: 'FA1', + phone: '01119827770', + ecm: true, + faxheader: 'xCALLY', + localid: '01119827770', + maxrate: '9600', + minrate: '14400', + }) + .then(function(faxAccount) { + console.log('Finished populating fax account'); + + models.Trunk + .findOne({ + where: { + name: 'citalia' + } + }) + .then(function(trunk) { + faxAccount + .setTrunk(trunk) + .catch(function(err) { + // console.error(err); + }); + + + models.VoiceExtension + .create({ + context: 'from-voip-provider', + exten: '01119827770', + priority: 1, + app: 'Goto', + appdata: 'inbound-fax,s,1', + type: 'inbound-fax' + }) + + }) + .catch(function(err) { + // console.error(err); + }); + + models.FaxQueue + .findAll() + .then(function(faxQueues) { + models.FaxApplication + .create({ + app: 'queue', + appdata: faxQueues[0].id, + priority: 1, + timeout: 30, + FaxAccountId: faxAccount.id, + FaxQueueId: faxQueues[0].id + }) + .then(function() { + console.log('Finished populating chat website application 1'); + }) + .catch(function(err) { + // console.error(err); + }); + + models.FaxApplication + .create({ + app: 'queue', + appdata: faxQueues[1].id, + priority: 2, + timeout: 30, + FaxAccountId: faxAccount.id, + FaxQueueId: faxQueues[1].id + }) + .then(function() { + console.log('Finished populating chat website application 2'); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); +// models.FaxAccount +// .create({ +// description: 'FA1 Desc', +// name: 'FA1', +// phone: '01119827770', +// ecm: true, +// faxheader: 'xCALLY', +// localid: '01119827770', +// maxrate: '9600', +// minrate: '14400', +// }) +// .then(function (faxAccount) { +// console.log('Finished populating fax account'); +// +// models.Trunk +// .findOne({ +// where: { +// name: 'citalia' +// } +// }) +// .then(function (trunk) { +// faxAccount +// .setTrunk(trunk) +// .catch(function (err) { +// // console.error(err); +// }); +// +// +// models.VoiceExtension +// .create({ +// context: 'from-voip-provider', +// exten: '01119827770', +// priority: 1, +// app: 'Goto', +// appdata: 'inbound-fax,s,1', +// type: 'inbound-fax', +// TrunkId: trunk.name +// }) +// +// }) +// .catch(function (err) { +// // console.error(err); +// }); +// +// models.FaxQueue +// .findAll() +// .then(function (faxQueues) { +// models.FaxApplication +// .create({ +// app: 'queue', +// appdata: faxQueues[0].id, +// priority: 1, +// timeout: 30, +// FaxAccountId: faxAccount.id, +// FaxQueueId: faxQueues[0].id +// }) +// .then(function () { +// console.log('Finished populating chat website application 1'); +// }) +// .catch(function (err) { +// // console.error(err); +// }); +// +// models.FaxApplication +// .create({ +// app: 'queue', +// appdata: faxQueues[1].id, +// priority: 2, +// timeout: 30, +// FaxAccountId: faxAccount.id, +// FaxQueueId: faxQueues[1].id +// }) +// .then(function () { +// console.log('Finished populating chat website application 2'); +// }) +// .catch(function (err) { +// // console.error(err); +// }); +// }) +// .catch(function (err) { +// // console.error(err); +// }); +// }) +// .catch(function (err) { +// // console.error(err); +// }); + +models.VoiceExtension + .bulkCreate([{ + context: 'outbound-fax', + exten: 's', + priority: 1, + app: 'NoOp', + appdata: 'Fax UUID: ${FAXUUID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 2, + app: 'UserEvent', + appdata: 'Fax,uuid: ${FAXUUID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 3, + app: 'Set', + appdata: 'FAXOPT(filename):${FAXFILE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 4, + app: 'Set', + appdata: 'FAXOPT(ecm):${ECM}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 5, + app: 'Set', + appdata: 'FAXOPT(headerinfo):${FAXHEADER}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 6, + app: 'Set', + appdata: 'FAXOPT(localstationid):${LOCALID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 7, + app: 'Set', + appdata: 'FAXOPT(maxrate):${MAXRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 8, + app: 'Set', + appdata: 'FAXOPT(minrate):${MINRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 9, + app: 'SendFAX', + appdata: '${FAXFILE},d', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 10, + app: 'NoOp', + appdata: 'ERROR "${TIMESTAMP}" "NO_STATUS" "NO_PAGES"', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 1, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 2, + app: 'NoOp', + appdata: 'FaxStatus : ${FAXSTATUS}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 3, + app: 'NoOp', + appdata: 'FaxStatusString : ${FAXSTATUSSTRING}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 4, + app: 'NoOp', + appdata: 'FaxError : ${FAXERROR}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 5, + app: 'NoOp', + appdata: 'RemoteStationID : ${REMOTESTATIONID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 6, + app: 'NoOp', + appdata: 'FaxPages : ${FAXPAGES}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 7, + app: 'NoOp', + appdata: 'FaxBitRate : ${FAXBITRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 8, + app: 'NoOp', + appdata: 'FaxResolution : ${FAXRESOLUTION}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 9, + app: 'NoOp', + appdata: 'OK "${TIMESTAMP}" "${FAXSTATUSSTRING}" "${FAXPAGES}"', + type: 'outbound-fax' + }], { + ignoreDuplicates: true + }) + .then(function() { + console.log('Finished populating fax outbound voice extension'); + }); + +models.VoiceExtension + .bulkCreate([{ + context: 'inbound-fax', + exten: 's', + priority: 1, + app: 'NoOp', + appdata: '**** FAX RECEIVED from ${CALLERID(num)} ${STRFTIME(${EPOCH},,%c)} ****', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 2, + app: 'Set', + appdata: 'FAXOPT(ecm):yes', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 3, + app: 'Set', + appdata: 'FILENAME:${UNIQUEID}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 4, + app: 'Set', + appdata: 'FAXFILE:${FILENAME}.tif', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 5, + app: 'Set', + appdata: 'FAXOPT(headerinfo):Received by XeniaLAB ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 6, + app: 'Set', + appdata: 'FAXOPT(localstationid):${LOCALID}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 7, + app: 'Set', + appdata: 'FAXOPT(maxrate):${MAXRATE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 8, + app: 'Set', + appdata: 'FAXOPT(minrate):${MINRATE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 9, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 10, + app: 'NoOp', + appdata: 'FAXOPT(headerinfo) : ${FAXOPT(headerinfo)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 11, + app: 'NoOp', + appdata: 'FAXOPT(localstationid) : ${FAXOPT(localstationid)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 12, + app: 'NoOp', + appdata: 'FAXOPT(maxrate) : ${FAXOPT(maxrate)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 13, + app: 'NoOp', + appdata: 'FAXOPT(minrate) : ${FAXOPT(minrate)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 14, + app: 'NoOp', + appdata: '**** RECEIVING FAX : ${FAXFILE} ****', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 15, + app: 'ReceiveFax', + appdata: '/tmp/${FAXFILE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 16, + app: 'Hangup', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 'h', + priority: 1, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'inbound-fax' + }], { + ignoreDuplicates: true + }) + .then(function() { + console.log('Finished populating fax outbound voice extension'); + }); + +models.SquareProject + .bulkCreate([{ + name: "project1", + description: "description project" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating square projects'); + }); + +models.ChatWebsite + .create({ + name: 'xCally Shop', + description: 'xCally Shop', + address: 'http://www.xcally.com/shop/', + color: '#f51111', + color_focus: '#f51111', + color_button: '#f51111', + remote: 'http://localhost:9000', + animation: true, + header_shape: 'squared', + header_online: 'We are here!', + online_message: 'Questions? Insert your name and email address to start a live-chat with our support team.', + username_placeholder: 'Your name', + email_placeholder: 'Your email address', + start_chat_button: 'Chat', + header_offline: 'Contact us', + offline_message: "We're not online.
It doesn't mean we're not there to help - leave your message below and we'll be in touch as soon as possible.'", + enquiry_message_placeholder: 'Your message...', + enquiry_button: 'Leave message', + download_transcript: true + }) + .then(function(chatWebsite) { + console.log('Finished populating chat website'); + models.ChatQueue + .findAll() + .then(function(chatQueues) { + models.ChatApplication + .create({ + app: 'queue', + appdata: chatQueues[0].id, + priority: 1, + timeout: 30, + ChatWebsiteId: chatWebsite.id, + ChatQueueId: chatQueues[0].id + }) + .then(function() { + console.log('Finished populating chat website application 1'); + }) + .catch(function(err) { + // console.error(err); + }); + + models.ChatApplication + .create({ + app: 'queue', + appdata: chatQueues[1].id, + priority: 2, + timeout: 30, + ChatWebsiteId: chatWebsite.id, + ChatQueueId: chatQueues[1].id + }) + .then(function() { + console.log('Finished populating chat website application 2'); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + }) + .catch(function(err) { + // console.error(err); + }); + +models.Variable + .bulkCreate([{ + name: "variable1", + description: "description project" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating variables'); + }); + +models.VoiceContext + .bulkCreate([{ + name: "from-sip", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "from-voip-provider", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "inbound-fax", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "outbound-fax", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "from-voicemail", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating context variables'); + }); + +models.VoiceMusicOnHold + .bulkCreate([{ + name: "default", + mode: "files", + directory: 'var/lib/asterisk/moh', + sort: 'alpha', + format: 'wav', + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating moh variables'); + }); + +models.Settings + .bulkCreate([{ + id: 1, + min_internal: 1000, + soundPath: '/var/opt/motion/server/files/sounds/converted' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating moh variables'); + }); + +models.Dashboard + .bulkCreate([{ + id: 1, + name: 'Motion Dashboard', + model: JSON.stringify({ + title: 'Motion Dashboard', + rows: [{ + columns: [{ + styleClass: 'col-md-4', + widgets: [{ + type: 'clock', + title: 'Clock', + config: { + timePattern: 'hh:mm:ss a', + datePattern: 'dddd, MMMM Do YYYY' + } + }] + }, { + styleClass: 'col-md-8', + widgets: [{ + type: 'iframe', + title: 'Iframe', + config: { + url: 'https://demo.xcally.com/shop/' + } + }] + }] + }] + }), + defaultEntry: true, + editable: false + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating moh variables'); + }); + +models.Integration + .bulkCreate([{ + name: 'Zendesk', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/zendesk2.png', + state: 'zendesk', + description: 'Description for Zendesk' + }, { + name: 'Desk.com', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/desk2.png', + state: 'desk', + description: 'Description for Desk.com' + }, { + name: 'Salesforce', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/salesforce2.png', + state: 'salesforce', + description: 'Description for Salesforce' + }, { + name: 'Freshdesk', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/freshdesk.png', + state: 'freshdesk', + description: 'Description for Freshdesk' + }, { + name: 'SugarCRM', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/sugarcrm2.png', + state: 'sugarcrm', + description: 'Description for SugarCRM' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); + +models.ReportTree + .bulkCreate([{ + id: 1, + tree: '[{"id":"1","parent":"#","text":"Motion Reports","icon":"icon-rocket","state":{"selected":true,"opened":true}},{"id":"2","parent":"1","text":"Basic Node","state":{"selected":false,"opened":false}}]', + }, { + id: 2, + tree: '[{"id":"1","text":"Custom Reports","icon":"icon-book-open","li_attr":{"id":"1"},"a_attr":{"href":"#","id":"1_anchor"},"state":{"loaded":true,"opened":true,"selected":false,"disabled":false},"data":{},"parent":"#"},{"id":"2","text":"Basic Node","icon":true,"li_attr":{"id":"2"},"a_attr":{"href":"#","id":"2_anchor"},"state":{"loaded":true,"opened":true,"selected":false,"disabled":false},"data":{},"parent":"1"}]' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); + +models.Service + .bulkCreate([{ + id: 1, + name: 'Motion Service', + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); diff --git a/server/config/seedp.js b/server/config/seedp.js index 81ff4a6..4b844ca 100644 --- a/server/config/seedp.js +++ b/server/config/seedp.js @@ -1 +1,550 @@ -var _0xce3f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x74\x68\x65\x6E","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x73","\x6C\x6F\x67","\x61\x67\x65\x6E\x74","\x66\x69\x6C\x74\x65\x72","\x44\x65\x66\x61\x75\x6C\x74\x20\x54\x65\x61\x6D","\x63\x72\x65\x61\x74\x65","\x54\x65\x61\x6D","\x6C\x6F\x63\x61\x6C","\x61\x64\x6D\x69\x6E","\x41\x64\x6D\x69\x6E\x69\x73\x74\x72\x61\x74\x6F\x72","\x61\x64\x6D\x69\x6E\x40\x61\x64\x6D\x69\x6E\x2E\x63\x6F\x6D","\x70\x61\x73\x73\x77\x6F\x72\x64","\x78\x63\x61\x6C\x6C\x79","\x64\x79\x6E\x61\x6D\x69\x63","\x46\x52\x49\x45\x4E\x44","\x75\x64\x70","\x61\x6C\x61\x77\x3B\x75\x6C\x61\x77\x3B\x67\x73\x6D","\x79\x65\x73","\x66\x6F\x72\x63\x65\x5F\x72\x70\x6F\x72\x74\x2C\x63\x6F\x6D\x65\x64\x69\x61","\x61\x6C\x6C","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x4A\x6F\x68\x6E\x20\x44\x6F\x65","\x6A\x6F\x68\x6E\x2E\x64\x6F\x65\x40\x67\x6D\x61\x69\x6C\x2E\x63\x6F\x6D","\x6A\x6F\x68\x6E\x2E\x64\x6F\x65","\x73\x68\x75\x74\x74\x6C\x65\x35\x35","\x4A\x61\x6E\x65\x20\x4D\x69\x6C\x6C\x65\x72","\x6A\x61\x6E\x65\x2E\x6D\x69\x6C\x6C\x65\x72\x40\x67\x6D\x61\x69\x6C\x2E\x63\x6F\x6D","\x6A\x61\x6E\x65\x2E\x6D\x69\x6C\x6C\x65\x72","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x55\x73\x65\x72","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x6F\x64\x75\x6C\x65\x73","\x64\x61\x73\x68\x62\x6F\x61\x72\x64","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x44\x41\x53\x48\x42\x4F\x41\x52\x44","\x75\x73\x65\x72\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x55\x53\x45\x52\x53","\x61\x67\x65\x6E\x74\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x47\x45\x4E\x54\x53","\x74\x65\x61\x6D\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x54\x45\x41\x4D\x53","\x63\x68\x61\x74","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x43\x48\x41\x54","\x76\x6F\x69\x63\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x56\x4F\x49\x43\x45","\x6D\x61\x69\x6C","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x4D\x41\x49\x4C","\x66\x61\x78","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x46\x41\x58","\x61\x75\x64\x69\x6F","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x55\x44\x49\x4F","\x63\x61\x6C\x6C\x79\x73\x71\x75\x61\x72\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x43\x41\x4C\x4C\x59\x53\x51\x55\x41\x52\x45","\x61\x6E\x61\x6C\x79\x74\x69\x63\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x41\x4E\x41\x4C\x59\x54\x49\x43\x53","\x72\x65\x61\x6C\x74\x69\x6D\x65","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x52\x45\x41\x4C\x54\x49\x4D\x45","\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x56\x4F\x49\x43\x45\x4D\x41\x49\x4C\x53","\x73\x65\x74\x74\x69\x6E\x67\x73","\x41\x50\x50\x4C\x49\x43\x41\x54\x49\x4F\x4E\x5F\x53\x45\x54\x54\x49\x4E\x47\x53","\x4D\x6F\x64\x75\x6C\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x66\x61\x78\x20\x6F\x75\x74\x62\x6F\x75\x6E\x64\x20\x76\x6F\x69\x63\x65\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x73","\x4E\x6F\x4F\x70","\x46\x61\x78\x20\x55\x55\x49\x44\x3A\x20\x24\x7B\x46\x41\x58\x55\x55\x49\x44\x7D","\x55\x73\x65\x72\x45\x76\x65\x6E\x74","\x46\x61\x78\x2C\x75\x75\x69\x64\x3A\x20\x24\x7B\x46\x41\x58\x55\x55\x49\x44\x7D","\x53\x65\x74","\x46\x41\x58\x4F\x50\x54\x28\x66\x69\x6C\x65\x6E\x61\x6D\x65\x29\x3A\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x3A\x24\x7B\x45\x43\x4D\x7D","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x3A\x24\x7B\x46\x41\x58\x48\x45\x41\x44\x45\x52\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x3A\x24\x7B\x4C\x4F\x43\x41\x4C\x49\x44\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x3A\x24\x7B\x4D\x41\x58\x52\x41\x54\x45\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x3A\x24\x7B\x4D\x49\x4E\x52\x41\x54\x45\x7D","\x53\x65\x6E\x64\x46\x41\x58","\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D\x2C\x64","\x45\x52\x52\x4F\x52\x20\x22\x24\x7B\x54\x49\x4D\x45\x53\x54\x41\x4D\x50\x7D\x22\x20\x22\x4E\x4F\x5F\x53\x54\x41\x54\x55\x53\x22\x20\x22\x4E\x4F\x5F\x50\x41\x47\x45\x53\x22","\x68","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x7D","\x46\x61\x78\x53\x74\x61\x74\x75\x73\x20\x3A\x20\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x7D","\x46\x61\x78\x53\x74\x61\x74\x75\x73\x53\x74\x72\x69\x6E\x67\x20\x3A\x20\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x53\x54\x52\x49\x4E\x47\x7D","\x46\x61\x78\x45\x72\x72\x6F\x72\x20\x3A\x20\x24\x7B\x46\x41\x58\x45\x52\x52\x4F\x52\x7D","\x52\x65\x6D\x6F\x74\x65\x53\x74\x61\x74\x69\x6F\x6E\x49\x44\x20\x3A\x20\x24\x7B\x52\x45\x4D\x4F\x54\x45\x53\x54\x41\x54\x49\x4F\x4E\x49\x44\x7D","\x46\x61\x78\x50\x61\x67\x65\x73\x20\x3A\x20\x24\x7B\x46\x41\x58\x50\x41\x47\x45\x53\x7D","\x46\x61\x78\x42\x69\x74\x52\x61\x74\x65\x20\x3A\x20\x24\x7B\x46\x41\x58\x42\x49\x54\x52\x41\x54\x45\x7D","\x46\x61\x78\x52\x65\x73\x6F\x6C\x75\x74\x69\x6F\x6E\x20\x3A\x20\x24\x7B\x46\x41\x58\x52\x45\x53\x4F\x4C\x55\x54\x49\x4F\x4E\x7D","\x4F\x4B\x20\x22\x24\x7B\x54\x49\x4D\x45\x53\x54\x41\x4D\x50\x7D\x22\x20\x22\x24\x7B\x46\x41\x58\x53\x54\x41\x54\x55\x53\x53\x54\x52\x49\x4E\x47\x7D\x22\x20\x22\x24\x7B\x46\x41\x58\x50\x41\x47\x45\x53\x7D\x22","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x2A\x2A\x2A\x2A\x20\x46\x41\x58\x20\x52\x45\x43\x45\x49\x56\x45\x44\x20\x66\x72\x6F\x6D\x20\x24\x7B\x43\x41\x4C\x4C\x45\x52\x49\x44\x28\x6E\x75\x6D\x29\x7D\x20\x24\x7B\x53\x54\x52\x46\x54\x49\x4D\x45\x28\x24\x7B\x45\x50\x4F\x43\x48\x7D\x2C\x2C\x25\x63\x29\x7D\x20\x2A\x2A\x2A\x2A","\x46\x41\x58\x4F\x50\x54\x28\x65\x63\x6D\x29\x3A\x79\x65\x73","\x46\x49\x4C\x45\x4E\x41\x4D\x45\x3A\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D","\x46\x41\x58\x46\x49\x4C\x45\x3A\x24\x7B\x46\x49\x4C\x45\x4E\x41\x4D\x45\x7D\x2E\x74\x69\x66","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x3A\x52\x65\x63\x65\x69\x76\x65\x64\x20\x62\x79\x20\x58\x65\x6E\x69\x61\x4C\x41\x42\x20\x24\x7B\x53\x54\x52\x46\x54\x49\x4D\x45\x28\x24\x7B\x45\x50\x4F\x43\x48\x7D\x2C\x2C\x25\x59\x2D\x25\x6D\x2D\x25\x64\x20\x25\x48\x3A\x25\x4D\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6D\x61\x78\x72\x61\x74\x65\x29\x7D","\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x20\x3A\x20\x24\x7B\x46\x41\x58\x4F\x50\x54\x28\x6D\x69\x6E\x72\x61\x74\x65\x29\x7D","\x2A\x2A\x2A\x2A\x20\x52\x45\x43\x45\x49\x56\x49\x4E\x47\x20\x46\x41\x58\x20\x3A\x20\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D\x20\x2A\x2A\x2A\x2A","\x52\x65\x63\x65\x69\x76\x65\x46\x61\x78","\x2F\x74\x6D\x70\x2F\x24\x7B\x46\x41\x58\x46\x49\x4C\x45\x7D","\x48\x61\x6E\x67\x75\x70","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x73\x71\x75\x61\x72\x65\x20\x70\x72\x6F\x6A\x65\x63\x74\x73","\x70\x72\x6F\x6A\x65\x63\x74\x31","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x70\x72\x6F\x6A\x65\x63\x74","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x76\x61\x72\x69\x61\x62\x6C\x65\x31","\x56\x61\x72\x69\x61\x62\x6C\x65","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x44\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x28\x44\x4F\x20\x4E\x4F\x54\x20\x44\x45\x4C\x45\x54\x45\x29","\x66\x72\x6F\x6D\x2D\x76\x6F\x69\x70\x2D\x70\x72\x6F\x76\x69\x64\x65\x72","\x66\x72\x6F\x6D\x2D\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x6D\x6F\x68\x20\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x64\x65\x66\x61\x75\x6C\x74","\x66\x69\x6C\x65\x73","\x76\x61\x72\x2F\x6C\x69\x62\x2F\x61\x73\x74\x65\x72\x69\x73\x6B\x2F\x6D\x6F\x68","\x61\x6C\x70\x68\x61","\x77\x61\x76","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x73\x65\x74\x74\x69\x6E\x67\x73","\x2F\x76\x61\x72\x2F\x6F\x70\x74\x2F\x6D\x6F\x74\x69\x6F\x6E\x2F\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x73\x6F\x75\x6E\x64\x73\x2F\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x53\x65\x74\x74\x69\x6E\x67\x73","\x4D\x6F\x74\x69\x6F\x6E\x20\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x63\x6F\x6C\x2D\x6D\x64\x2D\x34","\x63\x6C\x6F\x63\x6B","\x43\x6C\x6F\x63\x6B","\x68\x68\x3A\x6D\x6D\x3A\x73\x73\x20\x61","\x64\x64\x64\x64\x2C\x20\x4D\x4D\x4D\x4D\x20\x44\x6F\x20\x59\x59\x59\x59","\x63\x6F\x6C\x2D\x6D\x64\x2D\x38","\x69\x66\x72\x61\x6D\x65","\x49\x66\x72\x61\x6D\x65","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x64\x65\x6D\x6F\x2E\x78\x63\x61\x6C\x6C\x79\x2E\x63\x6F\x6D\x2F\x73\x68\x6F\x70\x2F","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x70\x6F\x70\x75\x6C\x61\x74\x69\x6E\x67\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x5A\x65\x6E\x64\x65\x73\x6B","\x31\x2E\x30\x2E\x30","\x58\x65\x6E\x69\x61\x4C\x41\x42\x20\x73\x2E\x72\x2E\x6C\x2E","\x61\x73\x73\x65\x74\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x6D\x65\x64\x69\x61\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x32\x2E\x70\x6E\x67","\x7A\x65\x6E\x64\x65\x73\x6B","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x20\x66\x6F\x72\x20\x5A\x65\x6E\x64\x65\x73\x6B","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x5B\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x23\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x4D\x6F\x74\x69\x6F\x6E\x20\x52\x65\x70\x6F\x72\x74\x73\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x22\x69\x63\x6F\x6E\x2D\x72\x6F\x63\x6B\x65\x74\x22\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x7D\x7D\x2C\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x31\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x42\x61\x73\x69\x63\x20\x4E\x6F\x64\x65\x22\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x7D\x5D","\x5B\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x43\x75\x73\x74\x6F\x6D\x20\x52\x65\x70\x6F\x72\x74\x73\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x22\x69\x63\x6F\x6E\x2D\x62\x6F\x6F\x6B\x2D\x6F\x70\x65\x6E\x22\x2C\x22\x6C\x69\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x69\x64\x22\x3A\x22\x31\x22\x7D\x2C\x22\x61\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x68\x72\x65\x66\x22\x3A\x22\x23\x22\x2C\x22\x69\x64\x22\x3A\x22\x31\x5F\x61\x6E\x63\x68\x6F\x72\x22\x7D\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x6C\x6F\x61\x64\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x64\x69\x73\x61\x62\x6C\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x2C\x22\x64\x61\x74\x61\x22\x3A\x7B\x7D\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x23\x22\x7D\x2C\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x2C\x22\x74\x65\x78\x74\x22\x3A\x22\x42\x61\x73\x69\x63\x20\x4E\x6F\x64\x65\x22\x2C\x22\x69\x63\x6F\x6E\x22\x3A\x74\x72\x75\x65\x2C\x22\x6C\x69\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x69\x64\x22\x3A\x22\x32\x22\x7D\x2C\x22\x61\x5F\x61\x74\x74\x72\x22\x3A\x7B\x22\x68\x72\x65\x66\x22\x3A\x22\x23\x22\x2C\x22\x69\x64\x22\x3A\x22\x32\x5F\x61\x6E\x63\x68\x6F\x72\x22\x7D\x2C\x22\x73\x74\x61\x74\x65\x22\x3A\x7B\x22\x6C\x6F\x61\x64\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x6F\x70\x65\x6E\x65\x64\x22\x3A\x74\x72\x75\x65\x2C\x22\x73\x65\x6C\x65\x63\x74\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x2C\x22\x64\x69\x73\x61\x62\x6C\x65\x64\x22\x3A\x66\x61\x6C\x73\x65\x7D\x2C\x22\x64\x61\x74\x61\x22\x3A\x7B\x7D\x2C\x22\x70\x61\x72\x65\x6E\x74\x22\x3A\x22\x31\x22\x7D\x5D","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x4D\x6F\x74\x69\x6F\x6E\x20\x53\x65\x72\x76\x69\x63\x65","\x53\x65\x72\x76\x69\x63\x65"];_0xce3f[0];var _=require(_0xce3f[1]);var models=require(_0xce3f[2]);var _users;var _team;models[_0xce3f[34]][_0xce3f[33]]([{provider:_0xce3f[12],role:_0xce3f[13],fullname:_0xce3f[14],email:_0xce3f[15],name:_0xce3f[13],password:_0xce3f[16],defaultuser:_0xce3f[17],host:_0xce3f[18],type:_0xce3f[19],transport:_0xce3f[20],allow:_0xce3f[21],qualify:_0xce3f[22],nat:_0xce3f[23],disallow:_0xce3f[24],context:_0xce3f[25],internal:1000},{provider:_0xce3f[12],role:_0xce3f[7],fullname:_0xce3f[26],email:_0xce3f[27],name:_0xce3f[28],password:_0xce3f[29],defaultuser:_0xce3f[28],host:_0xce3f[18],type:_0xce3f[19],transport:_0xce3f[20],allow:_0xce3f[21],qualify:_0xce3f[22],nat:_0xce3f[23],disallow:_0xce3f[24],context:_0xce3f[25],internal:1001},{provider:_0xce3f[12],role:_0xce3f[7],fullname:_0xce3f[30],email:_0xce3f[31],name:_0xce3f[32],password:_0xce3f[29],defaultuser:_0xce3f[32],host:_0xce3f[18],type:_0xce3f[19],transport:_0xce3f[20],allow:_0xce3f[21],qualify:_0xce3f[22],nat:_0xce3f[23],disallow:_0xce3f[24],context:_0xce3f[25],internal:1002}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(_0xc9ccx6){console[_0xce3f[6]](_0xce3f[5]);_users=_[_0xce3f[8]](_0xc9ccx6,{role:_0xce3f[7]});return models[_0xce3f[11]][_0xce3f[10]]({name:_0xce3f[9],description:_0xce3f[9],defaultEntry:true})})[_0xce3f[4]](function(_0xc9ccx5){_team=_0xc9ccx5;return _team[_0xce3f[3]](_users)});models[_0xce3f[64]][_0xce3f[33]]([{name:_0xce3f[36],title:_0xce3f[37]},{name:_0xce3f[38],title:_0xce3f[39]},{name:_0xce3f[40],title:_0xce3f[41]},{name:_0xce3f[42],title:_0xce3f[43]},{name:_0xce3f[44],title:_0xce3f[45]},{name:_0xce3f[46],title:_0xce3f[47]},{name:_0xce3f[48],title:_0xce3f[49]},{name:_0xce3f[50],title:_0xce3f[51]},{name:_0xce3f[52],title:_0xce3f[53]},{name:_0xce3f[54],title:_0xce3f[55]},{name:_0xce3f[56],title:_0xce3f[57]},{name:_0xce3f[58],title:_0xce3f[59]},{name:_0xce3f[60],title:_0xce3f[61]},{name:_0xce3f[62],title:_0xce3f[63]}],{ignoreDuplicates:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[35])});models[_0xce3f[92]][_0xce3f[33]]([{context:_0xce3f[66],exten:_0xce3f[67],priority:1,app:_0xce3f[68],appdata:_0xce3f[69],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:2,app:_0xce3f[70],appdata:_0xce3f[71],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:3,app:_0xce3f[72],appdata:_0xce3f[73],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:4,app:_0xce3f[72],appdata:_0xce3f[74],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:5,app:_0xce3f[72],appdata:_0xce3f[75],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:6,app:_0xce3f[72],appdata:_0xce3f[76],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:7,app:_0xce3f[72],appdata:_0xce3f[77],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:8,app:_0xce3f[72],appdata:_0xce3f[78],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:9,app:_0xce3f[79],appdata:_0xce3f[80],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[67],priority:10,app:_0xce3f[68],appdata:_0xce3f[81],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:1,app:_0xce3f[68],appdata:_0xce3f[83],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:2,app:_0xce3f[68],appdata:_0xce3f[84],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:3,app:_0xce3f[68],appdata:_0xce3f[85],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:4,app:_0xce3f[68],appdata:_0xce3f[86],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:5,app:_0xce3f[68],appdata:_0xce3f[87],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:6,app:_0xce3f[68],appdata:_0xce3f[88],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:7,app:_0xce3f[68],appdata:_0xce3f[89],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:8,app:_0xce3f[68],appdata:_0xce3f[90],type:_0xce3f[66]},{context:_0xce3f[66],exten:_0xce3f[82],priority:9,app:_0xce3f[68],appdata:_0xce3f[91],type:_0xce3f[66]}],{ignoreDuplicates:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[65])});models[_0xce3f[92]][_0xce3f[33]]([{context:_0xce3f[93],exten:_0xce3f[67],priority:1,app:_0xce3f[68],appdata:_0xce3f[94],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:2,app:_0xce3f[72],appdata:_0xce3f[95],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:3,app:_0xce3f[72],appdata:_0xce3f[96],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:4,app:_0xce3f[72],appdata:_0xce3f[97],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:5,app:_0xce3f[72],appdata:_0xce3f[98],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:6,app:_0xce3f[72],appdata:_0xce3f[76],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:7,app:_0xce3f[72],appdata:_0xce3f[77],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:8,app:_0xce3f[72],appdata:_0xce3f[78],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:9,app:_0xce3f[68],appdata:_0xce3f[83],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:10,app:_0xce3f[68],appdata:_0xce3f[99],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:11,app:_0xce3f[68],appdata:_0xce3f[100],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:12,app:_0xce3f[68],appdata:_0xce3f[101],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:13,app:_0xce3f[68],appdata:_0xce3f[102],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:14,app:_0xce3f[68],appdata:_0xce3f[103],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:15,app:_0xce3f[104],appdata:_0xce3f[105],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[67],priority:16,app:_0xce3f[106],type:_0xce3f[93]},{context:_0xce3f[93],exten:_0xce3f[82],priority:1,app:_0xce3f[68],appdata:_0xce3f[83],type:_0xce3f[93]}],{ignoreDuplicates:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[65])});models[_0xce3f[110]][_0xce3f[33]]([{name:_0xce3f[108],description:_0xce3f[109]}],{ignoreDuplicates:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[107])});models[_0xce3f[113]][_0xce3f[33]]([{name:_0xce3f[112],description:_0xce3f[109]}],{ignoreDuplicates:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[111])});models[_0xce3f[118]][_0xce3f[33]]([{name:_0xce3f[25],description:_0xce3f[115],defaultEntry:true},{name:_0xce3f[116],description:_0xce3f[115],defaultEntry:true},{name:_0xce3f[93],description:_0xce3f[115],defaultEntry:true},{name:_0xce3f[66],description:_0xce3f[115],defaultEntry:true},{name:_0xce3f[117],description:_0xce3f[115],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[114])});models[_0xce3f[125]][_0xce3f[33]]([{name:_0xce3f[120],mode:_0xce3f[121],directory:_0xce3f[122],sort:_0xce3f[123],format:_0xce3f[124],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[119])});models[_0xce3f[128]][_0xce3f[10]]({min_internal:1003,soundPath:_0xce3f[127]})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[126])});models[_0xce3f[140]][_0xce3f[33]]([{id:1,name:_0xce3f[129],model:JSON[_0xce3f[139]]({title:_0xce3f[129],rows:[{columns:[{styleClass:_0xce3f[130],widgets:[{type:_0xce3f[131],title:_0xce3f[132],config:{timePattern:_0xce3f[133],datePattern:_0xce3f[134]}}]},{styleClass:_0xce3f[135],widgets:[{type:_0xce3f[136],title:_0xce3f[137],config:{url:_0xce3f[138]}}]}]}]}),defaultEntry:true,editable:false}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[119])});models[_0xce3f[148]][_0xce3f[33]]([{name:_0xce3f[142],version:_0xce3f[143],active:false,author:_0xce3f[144],logo:_0xce3f[145],state:_0xce3f[146],description:_0xce3f[147]}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[141])});models[_0xce3f[151]][_0xce3f[33]]([{id:1,tree:_0xce3f[149]},{id:2,tree:_0xce3f[150]}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[141])});models[_0xce3f[153]][_0xce3f[33]]([{id:1,name:_0xce3f[152],defaultEntry:true}],{ignoreDuplicates:true,individualHooks:true})[_0xce3f[4]](function(){console[_0xce3f[6]](_0xce3f[141])}) \ No newline at end of file +/** + * Populate DB with sample data on server start + * to disable, edit config/environment/index.js, and set `seedDB: false` + */ + +'use strict'; + +var _ = require('lodash'); +var models = require('../models'); +var _users; +var _team; + +models.User + .bulkCreate([{ + provider: 'local', + role: 'admin', + fullname: 'Administrator', + email: 'admin@admin.com', + name: 'admin', + password: 'password', + defaultuser: 'xcally', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1000 + }, { + provider: 'local', + role: 'agent', + fullname: 'John Doe', + email: 'john.doe@gmail.com', + name: 'john.doe', + password: 'shuttle55', + defaultuser: 'john.doe', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1001 + }, { + provider: 'local', + role: 'agent', + fullname: 'Jane Miller', + email: 'jane.miller@gmail.com', + name: 'jane.miller', + password: 'shuttle55', + defaultuser: 'jane.miller', + host: 'dynamic', + type: 'FRIEND', + transport: 'udp', + allow: 'alaw;ulaw;gsm', + qualify: 'yes', + nat: 'force_rport,comedia', + disallow: 'all', + context: 'from-sip', + internal: 1002 + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function(users) { + console.log('Finished populating users'); + _users = _.filter(users, { + role: 'agent' + }); + return models.Team + .create({ + name: "Default Team", + description: "Default Team", + defaultEntry: true + }); + }).then(function(team) { + _team = team; + return _team.setUsers(_users); + }); + +// Init modules table +models.Module + .bulkCreate([{ + name: "dashboard", + title: "APPLICATION_DASHBOARD" + }, { + name: "users", + title: "APPLICATION_USERS" + }, { + name: "agents", + title: "APPLICATION_AGENTS" + }, { + name: "teams", + title: "APPLICATION_TEAMS" + }, { + name: "chat", + title: "APPLICATION_CHAT" + }, { + name: "voice", + title: "APPLICATION_VOICE" + }, { + name: "mail", + title: "APPLICATION_MAIL" + }, { + name: "fax", + title: "APPLICATION_FAX" + }, { + name: "audio", + title: "APPLICATION_AUDIO" + }, { + name: "callysquare", + title: "APPLICATION_CALLYSQUARE" + }, { + name: "analytics", + title: "APPLICATION_ANALYTICS" + }, { + name: "realtime", + title: "APPLICATION_REALTIME" + }, { + name: "voicemails", + title: "APPLICATION_VOICEMAILS" + }, { + name: "settings", + title: "APPLICATION_SETTINGS" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating modules'); + }); + +models.VoiceExtension + .bulkCreate([{ + context: 'outbound-fax', + exten: 's', + priority: 1, + app: 'NoOp', + appdata: 'Fax UUID: ${FAXUUID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 2, + app: 'UserEvent', + appdata: 'Fax,uuid: ${FAXUUID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 3, + app: 'Set', + appdata: 'FAXOPT(filename):${FAXFILE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 4, + app: 'Set', + appdata: 'FAXOPT(ecm):${ECM}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 5, + app: 'Set', + appdata: 'FAXOPT(headerinfo):${FAXHEADER}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 6, + app: 'Set', + appdata: 'FAXOPT(localstationid):${LOCALID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 7, + app: 'Set', + appdata: 'FAXOPT(maxrate):${MAXRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 8, + app: 'Set', + appdata: 'FAXOPT(minrate):${MINRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 9, + app: 'SendFAX', + appdata: '${FAXFILE},d', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 's', + priority: 10, + app: 'NoOp', + appdata: 'ERROR "${TIMESTAMP}" "NO_STATUS" "NO_PAGES"', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 1, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 2, + app: 'NoOp', + appdata: 'FaxStatus : ${FAXSTATUS}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 3, + app: 'NoOp', + appdata: 'FaxStatusString : ${FAXSTATUSSTRING}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 4, + app: 'NoOp', + appdata: 'FaxError : ${FAXERROR}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 5, + app: 'NoOp', + appdata: 'RemoteStationID : ${REMOTESTATIONID}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 6, + app: 'NoOp', + appdata: 'FaxPages : ${FAXPAGES}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 7, + app: 'NoOp', + appdata: 'FaxBitRate : ${FAXBITRATE}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 8, + app: 'NoOp', + appdata: 'FaxResolution : ${FAXRESOLUTION}', + type: 'outbound-fax' + }, { + context: 'outbound-fax', + exten: 'h', + priority: 9, + app: 'NoOp', + appdata: 'OK "${TIMESTAMP}" "${FAXSTATUSSTRING}" "${FAXPAGES}"', + type: 'outbound-fax' + }], { + ignoreDuplicates: true + }) + .then(function() { + console.log('Finished populating fax outbound voice extension'); + }); + +models.VoiceExtension + .bulkCreate([{ + context: 'inbound-fax', + exten: 's', + priority: 1, + app: 'NoOp', + appdata: '**** FAX RECEIVED from ${CALLERID(num)} ${STRFTIME(${EPOCH},,%c)} ****', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 2, + app: 'Set', + appdata: 'FAXOPT(ecm):yes', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 3, + app: 'Set', + appdata: 'FILENAME:${UNIQUEID}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 4, + app: 'Set', + appdata: 'FAXFILE:${FILENAME}.tif', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 5, + app: 'Set', + appdata: 'FAXOPT(headerinfo):Received by XeniaLAB ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 6, + app: 'Set', + appdata: 'FAXOPT(localstationid):${LOCALID}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 7, + app: 'Set', + appdata: 'FAXOPT(maxrate):${MAXRATE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 8, + app: 'Set', + appdata: 'FAXOPT(minrate):${MINRATE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 9, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 10, + app: 'NoOp', + appdata: 'FAXOPT(headerinfo) : ${FAXOPT(headerinfo)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 11, + app: 'NoOp', + appdata: 'FAXOPT(localstationid) : ${FAXOPT(localstationid)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 12, + app: 'NoOp', + appdata: 'FAXOPT(maxrate) : ${FAXOPT(maxrate)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 13, + app: 'NoOp', + appdata: 'FAXOPT(minrate) : ${FAXOPT(minrate)}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 14, + app: 'NoOp', + appdata: '**** RECEIVING FAX : ${FAXFILE} ****', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 15, + app: 'ReceiveFax', + appdata: '/tmp/${FAXFILE}', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 's', + priority: 16, + app: 'Hangup', + type: 'inbound-fax' + }, { + context: 'inbound-fax', + exten: 'h', + priority: 1, + app: 'NoOp', + appdata: 'FAXOPT(ecm) : ${FAXOPT(ecm)}', + type: 'inbound-fax' + }], { + ignoreDuplicates: true + }) + .then(function() { + console.log('Finished populating fax outbound voice extension'); + }); + +models.SquareProject + .bulkCreate([{ + name: "project1", + description: "description project" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating square projects'); + }); + +models.Variable + .bulkCreate([{ + name: "variable1", + description: "description project" + }], { + ignoreDuplicates: true + }).then(function() { + console.log('Finished populating variables'); + }); + +models.VoiceContext + .bulkCreate([{ + name: "from-sip", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "from-voip-provider", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "inbound-fax", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "outbound-fax", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }, { + name: "from-voicemail", + description: "Default context (DO NOT DELETE)", + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating context variables'); + }); + +models.VoiceMusicOnHold + .bulkCreate([{ + name: "default", + mode: "files", + directory: 'var/lib/asterisk/moh', + sort: 'alpha', + format: 'wav', + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating moh variables'); + }); + +models.Settings + .create({ + min_internal: 1003, + soundPath: '/var/opt/motion/server/files/sounds/converted' + }).then(function() { + console.log('Finished populating settings'); + }); + +models.Dashboard + .bulkCreate([{ + id: 1, + name: 'Motion Dashboard', + model: JSON.stringify({ + title: 'Motion Dashboard', + rows: [{ + columns: [{ + styleClass: 'col-md-4', + widgets: [{ + type: 'clock', + title: 'Clock', + config: { + timePattern: 'hh:mm:ss a', + datePattern: 'dddd, MMMM Do YYYY' + } + }] + }, { + styleClass: 'col-md-8', + widgets: [{ + type: 'iframe', + title: 'Iframe', + config: { + url: 'https://demo.xcally.com/shop/' + } + }] + }] + }] + }), + defaultEntry: true, + editable: false + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating moh variables'); + }); + +models.Integration + .bulkCreate([{ + name: 'Zendesk', + version: '1.0.0', + active: false, + author: 'XeniaLAB s.r.l.', + logo: 'assets/images/media/zendesk2.png', + state: 'zendesk', + description: 'Description for Zendesk' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); + +models.ReportTree + .bulkCreate([{ + id: 1, + tree: '[{"id":"1","parent":"#","text":"Motion Reports","icon":"icon-rocket","state":{"selected":true,"opened":true}},{"id":"2","parent":"1","text":"Basic Node","state":{"selected":false,"opened":false}}]', + }, { + id: 2, + tree: '[{"id":"1","text":"Custom Reports","icon":"icon-book-open","li_attr":{"id":"1"},"a_attr":{"href":"#","id":"1_anchor"},"state":{"loaded":true,"opened":true,"selected":false,"disabled":false},"data":{},"parent":"#"},{"id":"2","text":"Basic Node","icon":true,"li_attr":{"id":"2"},"a_attr":{"href":"#","id":"2_anchor"},"state":{"loaded":true,"opened":true,"selected":false,"disabled":false},"data":{},"parent":"1"}]' + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); + +models.Service + .bulkCreate([{ + id: 1, + name: 'Motion Service', + defaultEntry: true + }], { + ignoreDuplicates: true, + individualHooks: true + }).then(function() { + console.log('Finished populating integrations'); + }); diff --git a/server/config/smtp/index.js b/server/config/smtp/index.js index a284400..25f595d 100644 --- a/server/config/smtp/index.js +++ b/server/config/smtp/index.js @@ -1 +1,21 @@ -var _0xf985=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2F\x73\x6D\x74\x70","\x65\x78\x70\x6F\x72\x74\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C"];_0xf985[0];var MailServerOut=require(_0xf985[2])[_0xf985[1]];var Smtp=require(_0xf985[3]);module[_0xf985[4]]=function(){MailServerOut[_0xf985[5]](function(_0x8798x3){ new Smtp(_0x8798x3)});return MailServerOut[_0xf985[10]]()[_0xf985[9]](function(_0x8798x5){_0x8798x5[_0xf985[8]](function(_0x8798x6){ new Smtp(_0x8798x6)})})[_0xf985[7]](function(_0x8798x4){console[_0xf985[6]](_0x8798x4)})} \ No newline at end of file +'use strict'; + +var MailServerOut = require('../../models').MailServerOut; +var Smtp = require('./smtp'); + +module.exports = function () { + MailServerOut.afterCreate(function (doc) { + new Smtp(doc); + }); + + return MailServerOut + .findAll() + .then(function (data) { + data.forEach(function (elm) { + new Smtp(elm); + }); + }) + .catch(function (err) { + console.error(err); + }); +} diff --git a/server/config/smtp/smtp.js b/server/config/smtp/smtp.js index 32ff8c0..365afdd 100644 --- a/server/config/smtp/smtp.js +++ b/server/config/smtp/smtp.js @@ -1 +1,240 @@ -var _0x6464=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72\x2D\x73\x6D\x74\x70\x2D\x74\x72\x61\x6E\x73\x70\x6F\x72\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x41\x49\x4C\x20\x2D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x20\x53\x4D\x54\x50\x20\x43\x52\x45\x41\x54\x45","\x6C\x6F\x67","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x72\x65\x61\x74\x65\x54\x72\x61\x6E\x73\x70\x6F\x72\x74","\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x75\x73\x65\x72","\x61\x75\x74\x68","\x6F\x70\x74\x69\x6F\x6E\x73","\x74\x72\x61\x6E\x73\x70\x6F\x72\x74\x65\x72","\x20\x53\x4D\x54\x50\x20\x55\x50\x44\x41\x54\x45","\x5B\x4D\x41\x49\x4C\x20\x2D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20","\x20\x53\x4D\x54\x50\x20\x44\x45\x53\x54\x52\x4F\x59","\x73\x74\x61\x74\x75\x73","\x53\x45\x4E\x44\x49\x4E\x47","\x66\x72\x6F\x6D","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x65\x72\x72","\x65\x72\x72\x6F\x72","\x6D\x65\x73\x73\x61\x67\x65","\x72\x65\x73\x70\x6F\x6E\x73\x65","\x49\x6E\x74\x65\x72\x6E\x61\x6C\x20\x53\x65\x72\x76\x65\x72\x20\x45\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x65\x73\x73\x61\x67\x65\x49\x64","\x53\x45\x4E\x54","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x74\x68\x65\x6E","\x74\x6F","\x63\x63","\x73\x75\x62\x6A\x65\x63\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x70\x61\x74\x68","\x6E\x61\x6D\x65","\x6D\x61\x70","\x73\x65\x6E\x64\x4D\x61\x69\x6C","\x61\x64\x64\x55\x73\x65\x72","\x61\x64\x64\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","\x69\x6E\x66\x6F","\x73\x70\x72\x65\x61\x64","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x3B","\x6A\x6F\x69\x6E","\x4F\x50\x45\x4E","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x6464[0];var _=require(_0x6464[1]);var Promise=require(_0x6464[2]);var nodemailer=require(_0x6464[3]);var htmlToText=require(_0x6464[4]);var smtpTransport=require(_0x6464[5]);var Agent=require(_0x6464[7])[_0x6464[6]];var Contact=require(_0x6464[7])[_0x6464[8]];var MailRoom=require(_0x6464[7])[_0x6464[9]];var MailMessage=require(_0x6464[7])[_0x6464[10]];var ContactEmail=require(_0x6464[7])[_0x6464[11]];var MailServerOut=require(_0x6464[7])[_0x6464[12]];function Smtp(_0x6ea0xd){var _0x6ea0xe;var _0x6ea0xf;function _0x6ea0x10(_0x6ea0xd){console[_0x6464[16]](_0x6464[13]+_0x6ea0xd[_0x6464[14]]+_0x6464[15]);_0x6ea0xf=_0x6ea0xd;_0x6ea0xe=nodemailer[_0x6464[21]](smtpTransport({host:_0x6ea0xd[_0x6464[17]],port:_0x6ea0xd[_0x6464[18]],secure:_0x6ea0xd[_0x6464[19]],debug:true,auth:{user:_0x6ea0xd[_0x6464[14]],pass:_0x6ea0xd[_0x6464[20]]}}))}function _0x6ea0x11(_0x6ea0xd){if(!_0x6ea0xd[_0x6464[23]](_0x6464[22])&&_0x6ea0xe[_0x6464[27]][_0x6464[26]][_0x6464[25]][_0x6464[24]]===_0x6ea0xd[_0x6464[14]]){console[_0x6464[16]](_0x6464[13]+_0x6ea0xd[_0x6464[14]]+_0x6464[28]);_0x6ea0xe=null;_0x6ea0xe=nodemailer[_0x6464[21]](smtpTransport({host:_0x6ea0xd[_0x6464[17]],port:_0x6ea0xd[_0x6464[18]],secure:_0x6ea0xd[_0x6464[19]],debug:true,auth:{user:_0x6ea0xd[_0x6464[14]],pass:_0x6ea0xd[_0x6464[20]]}}))}}function _0x6ea0x12(_0x6ea0xd){if(_0x6ea0xe[_0x6464[27]][_0x6464[26]][_0x6464[25]][_0x6464[24]]===_0x6ea0xd[_0x6464[14]]){console[_0x6464[16]](_0x6464[29]+_0x6ea0xd[_0x6464[14]]+_0x6464[30]);_0x6ea0xe=null}}function _0x6ea0x13(_0x6ea0x14,_0x6ea0x15){if(_0x6ea0x14[_0x6464[31]]===_0x6464[32]&&_0x6ea0xe[_0x6464[27]][_0x6464[26]][_0x6464[25]][_0x6464[24]]===_0x6ea0x14[_0x6464[34]][_0x6464[33]]){var _0x6ea0x16;var _0x6ea0x17=_0x6ea0x14;var _0x6ea0x18,_0x6ea0x19,_0x6ea0x1a,_0x6ea0x1b;if(_0x6ea0x17[_0x6464[35]]){return MailMessage[_0x6464[61]]({where:{messageId:_0x6ea0x17[_0x6464[35]]}})[_0x6464[46]](function(_0x6ea0x22){return _0x6ea0x22[_0x6464[60]]()})[_0x6464[46]](function(_0x6ea0x21){_0x6ea0x16=_0x6ea0x21;return _0x6ea0x16[_0x6464[59]](_0x6ea0x17,{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[46]](function(){return _0x6ea0x16[_0x6464[58]](_0x6ea0x17.UserId,{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[46]](function(_0x6ea0x20){_0x6ea0x1b=_[_0x6464[56]](_0x6ea0x20,function(_0x6ea0x1f){return _0x6ea0x1f[0]});return})[_0x6464[46]](function(){var _0x6ea0x1e={status:_0x6ea0x17[_0x6464[31]],from:_0x6ea0x17[_0x6464[33]],to:_0x6ea0x17[_0x6464[47]],cc:_0x6ea0x17[_0x6464[48]],subject:_0x6ea0x17[_0x6464[49]],html:_0x6ea0x17[_0x6464[50]],text:htmlToText[_0x6464[51]](_0x6ea0x17[_0x6464[50]],{wordwrap:false}),headers:{"\x58\x2D\x4C\x61\x7A\x69\x6E\x65\x73\x73\x2D\x6C\x65\x76\x65\x6C":1000}};if(_0x6ea0x17[_0x6464[52]]){_0x6ea0x1e[_0x6464[53]]=_[_0x6464[56]](_0x6ea0x17.MailAttachments,function(_0x6ea0x1f){return {path:_0x6ea0x1f[_0x6464[54]],filename:_0x6ea0x1f[_0x6464[55]]}})};return _0x6ea0xe[_0x6464[57]](_0x6ea0x1e)})[_0x6464[46]](function(_0x6ea0x1d){return _0x6ea0x17[_0x6464[45]]({messageId:_0x6ea0x1d[_0x6464[42]],status:_0x6464[43]},{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[41]](function(_0x6ea0x1c){console[_0x6464[37]](_0x6464[36],_0x6ea0x1c);throw {message:_0x6ea0x1c[_0x6464[38]]||_0x6ea0x1c[_0x6464[39]]||_0x6464[40]}})}else {console[_0x6464[16]](1);return MailRoom[_0x6464[69]]({where:{id:_0x6ea0x17[_0x6464[64]]},defaults:{subject:_0x6ea0x17[_0x6464[49]],from:_0x6ea0x17[_0x6464[33]][_0x6464[66]](_0x6464[65]),status:_0x6464[67],MailAccountId:_0x6ea0xf[_0x6464[68]]},transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})[_0x6464[63]](function(_0x6ea0x21){console[_0x6464[16]](2);_0x6ea0x16=_0x6ea0x21;return _0x6ea0x16[_0x6464[59]](_0x6ea0x17,{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[46]](function(){console[_0x6464[16]](3);return _0x6ea0x16[_0x6464[58]](_0x6ea0x17.UserId,{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[46]](function(){console[_0x6464[16]](4);var _0x6ea0x1e={status:_0x6ea0x17[_0x6464[31]],from:_0x6ea0x17[_0x6464[33]],to:_0x6ea0x17[_0x6464[47]],cc:_0x6ea0x17[_0x6464[48]],subject:_0x6ea0x17[_0x6464[49]],html:_0x6ea0x17[_0x6464[50]],text:htmlToText[_0x6464[51]](_0x6ea0x17[_0x6464[50]],{wordwrap:false}),headers:{"\x58\x2D\x4C\x61\x7A\x69\x6E\x65\x73\x73\x2D\x6C\x65\x76\x65\x6C":1000}};if(_0x6ea0x17[_0x6464[52]]){_0x6ea0x1e[_0x6464[53]]=_[_0x6464[56]](_0x6ea0x17.MailAttachments,function(_0x6ea0x1f){return {path:_0x6ea0x1f[_0x6464[54]],filename:_0x6ea0x1f[_0x6464[55]]}})};return _0x6ea0xe[_0x6464[57]](_0x6ea0x1e)})[_0x6464[46]](function(_0x6ea0x1d){console[_0x6464[16]](_0x6464[62],_0x6ea0x1d);return _0x6ea0x17[_0x6464[45]]({messageId:_0x6ea0x1d[_0x6464[42]],status:_0x6464[43]},{transaction:_0x6ea0x15?_0x6ea0x15[_0x6464[44]]:null})})[_0x6464[41]](function(_0x6ea0x1c){console[_0x6464[37]](_0x6464[36],_0x6ea0x1c);throw {message:_0x6ea0x1c[_0x6464[38]]||_0x6ea0x1c[_0x6464[39]]||_0x6464[40]}})}}}_0x6ea0x10(_0x6ea0xd);MailServerOut[_0x6464[70]](function(_0x6ea0xd){return _0x6ea0x11(_0x6ea0xd)});MailServerOut[_0x6464[71]](function(_0x6ea0xd){return _0x6ea0x12(_0x6ea0xd)});MailMessage[_0x6464[72]](function(_0x6ea0xd,_0x6ea0x15){return _0x6ea0x13(_0x6ea0xd,_0x6ea0x15)});return {}}module[_0x6464[73]]=Smtp \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Promise = require('bluebird'); +var nodemailer = require('nodemailer'); +var htmlToText = require('html-to-text'); +var smtpTransport = require('nodemailer-smtp-transport'); + +var Agent = require('../../models').User; +var Contact = require('../../models').Contact; +var MailRoom = require('../../models').MailRoom; +var MailMessage = require('../../models').MailMessage; +var ContactEmail = require('../../models').ContactEmail; +var MailServerOut = require('../../models').MailServerOut; + +function Smtp(doc) { + + var _smtp; + var _doc; + + function onSave(doc) { + console.log("MAIL - Account " + doc.username + " SMTP CREATE"); + _doc = doc; + _smtp = nodemailer.createTransport(smtpTransport({ + host: doc.host, + port: doc.port, + secure: doc.ssl, + debug: true, + auth: { + user: doc.username, + pass: doc.password + } + })); + } + + function onUpdate(doc) { + if (!doc.changed('state') && _smtp.transporter.options.auth.user === doc.username) { + console.log("MAIL - Account " + doc.username + " SMTP UPDATE"); + _smtp = null; + _smtp = nodemailer.createTransport(smtpTransport({ + host: doc.host, + port: doc.port, + secure: doc.ssl, + debug: true, + auth: { + user: doc.username, + pass: doc.password + } + })); + } + } + + function onRemove(doc) { + if (_smtp.transporter.options.auth.user === doc.username) { + console.log("[MAIL - Account " + doc.username + " SMTP DESTROY"); + _smtp = null; + } + } + + function onSend(mailMessage, options) { + if (mailMessage.status === 'SENDING' && _smtp.transporter.options.auth.user === mailMessage.dataValues.from) { + var _mRoom; + var _mMessage = mailMessage; + var _mFrom, _mTo, _mCc, _mBcc; + + if (_mMessage.inReplyTo) { + return MailMessage + .findOne({ + where: { + messageId: _mMessage.inReplyTo + } + }) + .then(function(mailMessageParent) { + return mailMessageParent + .getMailRoom(); + }) + .then(function(mailRoom) { + _mRoom = mailRoom; + return _mRoom + .addMailMessage(_mMessage, { + transaction: options ? options.transaction : null + }); + }) + .then(function() { + return _mRoom + .addUser(_mMessage.UserId, { + transaction: options ? options.transaction : null + }); + }) + .then(function(mBcc) { + _mBcc = _.map(mBcc, function(elm) { + return elm[0]; + }); + + return; + }) + .then(function() { + var mail = { + status: _mMessage.status, + from: _mMessage.from, + to: _mMessage.to, + cc: _mMessage.cc, + subject: _mMessage.subject, + html: _mMessage.html, + text: htmlToText.fromString(_mMessage.html, { + wordwrap: false + }), + headers: { + 'X-Laziness-level': 1000 + } + }; + + if (_mMessage.MailAttachments) { + mail.attachments = _.map(_mMessage.MailAttachments, function(elm) { + return { + path: elm.path, + filename: elm.name + } + }); + } + + return _smtp.sendMail(mail); + }) + .then(function(info) { + return _mMessage + .update({ + messageId: info.messageId, + status: 'SENT' + }, { + transaction: options ? options.transaction : null + }); + }) + .catch(function(err) { + console.error('err', err); + throw { + message: err.message || err.response || 'Internal Server Error' + }; + }); + } else { + console.log(1); + + return MailRoom + .findOrCreate({ + where: { + id: _mMessage.MailRoomId + }, + defaults: { + subject: _mMessage.subject, + from: _mMessage.from.join(';'), + status: 'OPEN', + MailAccountId: _doc.MailAccountId + }, + transaction: options ? options.transaction : null + }) + .spread(function(mailRoom) { + console.log(2); + + _mRoom = mailRoom; + return _mRoom + .addMailMessage(_mMessage, { + transaction: options ? options.transaction : null + }); + }) + .then(function() { + console.log(3); + + return _mRoom + .addUser(_mMessage.UserId, { + transaction: options ? options.transaction : null + }); + }) + .then(function() { + console.log(4); + + var mail = { + status: _mMessage.status, + from: _mMessage.from, + to: _mMessage.to, + cc: _mMessage.cc, + subject: _mMessage.subject, + html: _mMessage.html, + text: htmlToText.fromString(_mMessage.html, { + wordwrap: false + }), + headers: { + 'X-Laziness-level': 1000 + } + }; + + if (_mMessage.MailAttachments) { + mail.attachments = _.map(_mMessage.MailAttachments, function(elm) { + return { + path: elm.path, + filename: elm.name + } + }); + } + + return _smtp + .sendMail(mail); + }) + .then(function(info) { + + console.log('info', info); + return _mMessage + .update({ + messageId: info.messageId, + status: 'SENT' + }, { + transaction: options ? options.transaction : null + }); + }) + .catch(function(err) { + console.error('err', err); + throw { + message: err.message || err.response || 'Internal Server Error' + }; + }); + } + } + } + + onSave(doc); + + // HANDLE ACCOUNT UPDATE/DELETE + MailServerOut.afterUpdate(function(doc) { + return onUpdate(doc); + }); + MailServerOut.afterDestroy(function(doc) { + return onRemove(doc); + }); + // HANDLE SEND MAIL + MailMessage.afterCreate(function(doc, options) { + return onSend(doc, options); + }); + + return {}; +} + +module.exports = Smtp; diff --git a/server/config/socketio.js b/server/config/socketio.js index 1312ad6..bffebfa 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -1 +1,201 @@ -var _0xad33=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6D\x6F\x6D\x65\x6E\x74","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x73\x65\x72\x49\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x73\x6F\x63\x6B\x65\x74\x3A\x20\x75\x73\x65\x72\x20\x6F\x66\x66\x6C\x69\x6E\x65","\x6E\x61\x6D\x65","\x6C\x6F\x67","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x73\x6F\x63\x6B\x65\x74\x3A\x20\x61\x6E\x79\x6F\x6E\x65\x20\x75\x73\x65\x72\x73\x20\x66\x6F\x75\x6E\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x6F\x63\x6B\x65\x74\x3A\x20\x75\x73\x65\x72\x20\x6F\x6E\x6C\x69\x6E\x65","\x72\x65\x67\x69\x73\x74\x65\x72","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x2F\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x2F\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2F\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x61\x67\x65\x6E\x74\x2F\x61\x67\x65\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x61\x6D\x69\x2F\x61\x6D\x69\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x65\x6E\x71\x75\x69\x72\x79\x2F\x65\x6E\x71\x75\x69\x72\x79\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x2F\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x2F\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x6F\x6D\x70\x61\x6E\x79\x2F\x63\x6F\x6D\x70\x61\x6E\x79\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2F\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2F\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x2F\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x2F\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x2F\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x2F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x2F\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x6F\x64\x75\x6C\x65\x2F\x6D\x6F\x64\x75\x6C\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x2F\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x2F\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x2F\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x2F\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x2F\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x65\x74\x74\x69\x6E\x67\x2F\x73\x65\x74\x74\x69\x6E\x67\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63\x2F\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2F\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x74\x61\x67\x2F\x74\x61\x67\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x74\x65\x61\x6D\x2F\x74\x65\x61\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x74\x72\x69\x67\x67\x65\x72\x2F\x74\x72\x69\x67\x67\x65\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x74\x72\x75\x6E\x6B\x2F\x74\x72\x75\x6E\x6B\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x2F\x75\x73\x65\x72\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64\x2F\x73\x6F\x75\x6E\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x6E\x73\x70\x79\x2F\x63\x68\x61\x6E\x73\x70\x79\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x6D\x65\x74\x72\x69\x63\x2F\x6D\x65\x74\x72\x69\x63\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x2F\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x2F\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x73\x65\x72\x76\x69\x63\x65\x2F\x73\x65\x72\x76\x69\x63\x65\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79\x2F\x78\x63\x68\x61\x74\x74\x79\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x2E\x73\x6F\x63\x6B\x65\x74","\x2E\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x2E\x73\x6F\x63\x6B\x65\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x69\x6E\x66\x6F","\x5B\x25\x73\x5D\x20\x25\x73","\x61\x64\x64\x72\x65\x73\x73","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x73\x65\x63\x72\x65\x74","\x73\x65\x73\x73\x69\x6F\x6E","\x61\x75\x74\x68\x6F\x72\x69\x7A\x65","\x73\x6F\x63\x6B\x65\x74\x69\x6F\x2D\x6A\x77\x74","\x75\x73\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E","\x68\x61\x6E\x64\x73\x68\x61\x6B\x65","\x3A","\x70\x6F\x72\x74","\x44\x4F\x4D\x41\x49\x4E","\x65\x6E\x76","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x41\x74","\x71\x75\x65\x72\x79","\x72\x6F\x6C\x65","\x73\x6F\x75\x72\x63\x65","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74","\x5B\x25\x73\x5D\x20\x53\x4F\x43\x4B\x45\x54\x20\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x5B\x25\x73\x5D\x20\x53\x4F\x43\x4B\x45\x54\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44"];_0xad33[0];var moment=require(_0xad33[1]);var config=require(_0xad33[2]);var User=require(_0xad33[4])[_0xad33[3]];function onDisconnect(_0x19c1x5){if(_0x19c1x5[_0xad33[5]]){return User[_0xad33[14]](_0x19c1x5[_0xad33[5]])[_0xad33[11]](function(_0x19c1x7){if(_0x19c1x7){return _0x19c1x7[_0xad33[12]]({online:false})}else {throw new Error(_0xad33[13])}})[_0xad33[11]](function(_0x19c1x7){console[_0xad33[10]](_0xad33[8],_0x19c1x7[_0xad33[9]])})[_0xad33[7]](function(_0x19c1x6){console[_0xad33[6]](_0x19c1x6)})}else {console[_0xad33[10]](_0xad33[13])}}function onConnect(_0x19c1x5){if(_0x19c1x5[_0xad33[5]]){return User[_0xad33[14]](_0x19c1x5[_0xad33[5]])[_0xad33[11]](function(_0x19c1x7){if(_0x19c1x7){return _0x19c1x7[_0xad33[12]]({online:true,lastLoginAt:moment()[_0xad33[107]](_0xad33[106])})}else {throw new Error(_0xad33[13])}})[_0xad33[11]](function(_0x19c1x7){console[_0xad33[10]](_0xad33[15],_0x19c1x7[_0xad33[9]]);require(_0xad33[17])[_0xad33[16]](_0x19c1x5);require(_0xad33[18])[_0xad33[16]](_0x19c1x5);require(_0xad33[19])[_0xad33[16]](_0x19c1x5);require(_0xad33[20])[_0xad33[16]](_0x19c1x5);require(_0xad33[21])[_0xad33[16]](_0x19c1x5);require(_0xad33[22])[_0xad33[16]](_0x19c1x5);require(_0xad33[23])[_0xad33[16]](_0x19c1x5);require(_0xad33[24])[_0xad33[16]](_0x19c1x5);require(_0xad33[25])[_0xad33[16]](_0x19c1x5);require(_0xad33[26])[_0xad33[16]](_0x19c1x5);require(_0xad33[27])[_0xad33[16]](_0x19c1x5);require(_0xad33[28])[_0xad33[16]](_0x19c1x5);require(_0xad33[29])[_0xad33[16]](_0x19c1x5);require(_0xad33[30])[_0xad33[16]](_0x19c1x5);require(_0xad33[31])[_0xad33[16]](_0x19c1x5);require(_0xad33[32])[_0xad33[16]](_0x19c1x5);require(_0xad33[33])[_0xad33[16]](_0x19c1x5);require(_0xad33[34])[_0xad33[16]](_0x19c1x5);require(_0xad33[35])[_0xad33[16]](_0x19c1x5);require(_0xad33[36])[_0xad33[16]](_0x19c1x5);require(_0xad33[37])[_0xad33[16]](_0x19c1x5);require(_0xad33[38])[_0xad33[16]](_0x19c1x5);require(_0xad33[39])[_0xad33[16]](_0x19c1x5);require(_0xad33[40])[_0xad33[16]](_0x19c1x5);require(_0xad33[41])[_0xad33[16]](_0x19c1x5);require(_0xad33[42])[_0xad33[16]](_0x19c1x5);require(_0xad33[43])[_0xad33[16]](_0x19c1x5);require(_0xad33[44])[_0xad33[16]](_0x19c1x5);require(_0xad33[45])[_0xad33[16]](_0x19c1x5);require(_0xad33[46])[_0xad33[16]](_0x19c1x5);require(_0xad33[47])[_0xad33[16]](_0x19c1x5);require(_0xad33[48])[_0xad33[16]](_0x19c1x5);require(_0xad33[49])[_0xad33[16]](_0x19c1x5);require(_0xad33[50])[_0xad33[16]](_0x19c1x5);require(_0xad33[51])[_0xad33[16]](_0x19c1x5);require(_0xad33[52])[_0xad33[16]](_0x19c1x5);require(_0xad33[53])[_0xad33[16]](_0x19c1x5);require(_0xad33[54])[_0xad33[16]](_0x19c1x5);require(_0xad33[55])[_0xad33[16]](_0x19c1x5);require(_0xad33[56])[_0xad33[16]](_0x19c1x5);require(_0xad33[57])[_0xad33[16]](_0x19c1x5);require(_0xad33[58])[_0xad33[16]](_0x19c1x5);require(_0xad33[59])[_0xad33[16]](_0x19c1x5);require(_0xad33[60])[_0xad33[16]](_0x19c1x5);require(_0xad33[61])[_0xad33[16]](_0x19c1x5);require(_0xad33[62])[_0xad33[16]](_0x19c1x5);require(_0xad33[63])[_0xad33[16]](_0x19c1x5);require(_0xad33[64])[_0xad33[16]](_0x19c1x5);require(_0xad33[65])[_0xad33[16]](_0x19c1x5);require(_0xad33[66])[_0xad33[16]](_0x19c1x5);require(_0xad33[67])[_0xad33[16]](_0x19c1x5);require(_0xad33[68])[_0xad33[16]](_0x19c1x5);require(_0xad33[69])[_0xad33[16]](_0x19c1x5);require(_0xad33[70])[_0xad33[16]](_0x19c1x5);require(_0xad33[71])[_0xad33[16]](_0x19c1x5);require(_0xad33[72])[_0xad33[16]](_0x19c1x5);require(_0xad33[73])[_0xad33[16]](_0x19c1x5);require(_0xad33[74])[_0xad33[16]](_0x19c1x5);require(_0xad33[75])[_0xad33[16]](_0x19c1x5);require(_0xad33[76])[_0xad33[16]](_0x19c1x5);require(_0xad33[77])[_0xad33[16]](_0x19c1x5);require(_0xad33[78])[_0xad33[16]](_0x19c1x5);require(_0xad33[79])[_0xad33[16]](_0x19c1x5);require(_0xad33[80])[_0xad33[16]](_0x19c1x5);require(_0xad33[81])[_0xad33[16]](_0x19c1x5);require(_0xad33[82])[_0xad33[16]](_0x19c1x5);require(_0xad33[83])[_0xad33[16]](_0x19c1x5);require(_0xad33[84])[_0xad33[16]](_0x19c1x5);require(_0xad33[85])[_0xad33[16]](_0x19c1x5);require(_0xad33[86])[_0xad33[16]](_0x19c1x5);require(_0xad33[87])[_0xad33[16]](_0x19c1x5);require(_0xad33[88])[_0xad33[16]](_0x19c1x5);require(_0xad33[89])[_0xad33[16]](_0x19c1x5);require(_0xad33[90])[_0xad33[16]](_0x19c1x5);require(_0xad33[91])[_0xad33[16]](_0x19c1x5);require(_0xad33[92])[_0xad33[16]](_0x19c1x5);require(_0xad33[93])[_0xad33[16]](_0x19c1x5);require(_0xad33[94])[_0xad33[16]](_0x19c1x5);require(_0xad33[95])[_0xad33[16]](_0x19c1x5);require(_0xad33[96])[_0xad33[16]](_0x19c1x5);require(_0xad33[97])[_0xad33[16]](_0x19c1x5);require(_0xad33[98])[_0xad33[16]](_0x19c1x5);require(_0xad33[99])[_0xad33[16]](_0x19c1x5);require(_0xad33[100])[_0xad33[16]](_0x19c1x5);require(_0xad33[101])[_0xad33[16]](_0x19c1x5);require(_0xad33[102])[_0xad33[16]](_0x19c1x5);require(_0xad33[103])[_0xad33[16]](_0x19c1x5);require(_0xad33[104])[_0xad33[16]](_0x19c1x5);require(_0xad33[105])[_0xad33[16]](_0x19c1x5)})[_0xad33[7]](function(_0x19c1x6){console[_0xad33[6]](_0x19c1x6)})}else {console[_0xad33[10]](_0xad33[13])};_0x19c1x5[_0xad33[112]](_0xad33[108],function(_0x19c1x9){console[_0xad33[108]](_0xad33[109],_0x19c1x5[_0xad33[110]],JSON[_0xad33[111]](_0x19c1x9,null,2))})}module[_0xad33[113]]=function(_0x19c1xa){_0x19c1xa[_0xad33[118]](require(_0xad33[117])[_0xad33[116]]({secret:config[_0xad33[115]][_0xad33[114]],handshake:true}));_0x19c1xa[_0xad33[112]](_0xad33[119],function(_0x19c1x5){_0x19c1x5[_0xad33[110]]=_0x19c1x5[_0xad33[120]][_0xad33[110]]!==null?_0x19c1x5[_0xad33[120]][_0xad33[110]][_0xad33[110]]+_0xad33[121]+_0x19c1x5[_0xad33[120]][_0xad33[110]][_0xad33[122]]:process[_0xad33[124]][_0xad33[123]];_0x19c1x5[_0xad33[125]]= new Date();_0x19c1x5[_0xad33[5]]=_0x19c1x5[_0xad33[120]][_0xad33[126]][_0xad33[5]];_0x19c1x5[_0xad33[127]]=_0x19c1x5[_0xad33[120]][_0xad33[126]][_0xad33[127]];_0x19c1x5[_0xad33[9]]=_0x19c1x5[_0xad33[120]][_0xad33[126]][_0xad33[9]];_0x19c1x5[_0xad33[128]]=_0x19c1x5[_0xad33[120]][_0xad33[126]][_0xad33[128]];_0x19c1x5[_0xad33[112]](_0xad33[129],function(){onDisconnect(_0x19c1x5);console[_0xad33[108]](_0xad33[130],_0x19c1x5[_0xad33[120]][_0xad33[110]])});onConnect(_0x19c1x5);console[_0xad33[108]](_0xad33[131],_0x19c1x5[_0xad33[120]][_0xad33[110]])})} \ No newline at end of file +/** + * Socket.io configuration + */ + +'use strict'; + +var moment = require('moment'); +var config = require('./environment'); +var User = require('../models').User; + +function onDisconnect(socket) { + if (socket.userId) { + return User + .findById(socket.userId) + .then(function(user) { + if (user) { + return user + .updateAttributes({ + online: false + }); + } else { + throw new Error('socket: anyone users found'); + } + }) + .then(function(user) { + console.log('socket: user offline', user.name); + }) + .catch(function(err) { + console.error(err); + }); + } else { + console.log('socket: anyone users found'); + } +} + +function onConnect(socket) { + if (socket.userId) { + return User + .findById(socket.userId) + .then(function(user) { + if (user) { + return user + .updateAttributes({ + online: true, + lastLoginAt: moment().format("YYYY-MM-DD HH:mm:ss") + }) + } else { + throw new Error('socket: anyone users found'); + } + }) + .then(function(user) { + console.log('socket: user online', user.name); + + // Insert sockets below + require('../api/chat_proactive_action/chat_proactive_action.socket').register(socket); + // require('../api/report_jscripty_input/report_jscripty_input.socket').register(socket); + // require('../api/report_jscripty_question/report_jscripty_question.socket').register(socket); + // require('../api/report_jscripty_session/report_jscripty_session.socket').register(socket); + require('../api/canned_answer/canned_answer.socket').register(socket); + require('../api/chat_websites_field/chat_websites_field.socket').register(socket); + require('../api/voice_recording/voice_recording.socket').register(socket); + require('../api/license/license.socket').register(socket); + require('../api/jscripty_project/jscripty_project.socket').register(socket); + + //Ordered alphabetically + require('../api/agent/agent.socket').register(socket); + require('../api/ami/ami.socket').register(socket); + require('../api/automation/automation.socket').register(socket); + require('../api/chat_application/chat_application.socket').register(socket); + require('../api/chat_enquiry/enquiry.socket').register(socket); + require('../api/chat_message/chat_message.socket').register(socket); + require('../api/chat_queue/chat_queue.socket').register(socket); + require('../api/chat_room/chat_room.socket').register(socket); + require('../api/chat_visitor/chat_visitor.socket').register(socket); + require('../api/chat_website/chat_website.socket').register(socket); + require('../api/company/company.socket').register(socket); + require('../api/contact_manager/contact_manager.socket').register(socket); + require('../api/dashboard/dashboard.socket').register(socket); + require('../api/desk_account/desk_account.socket').register(socket); + require('../api/desk_configuration/desk_configuration.socket').register(socket); + require('../api/desk_field/desk_field.socket').register(socket); + require('../api/fax_account/fax_account.socket').register(socket); + require('../api/fax_application/fax_application.socket').register(socket); + require('../api/fax_message/fax_message.socket').register(socket); + require('../api/fax_queue/fax_queue.socket').register(socket); + require('../api/fax_room/fax_room.socket').register(socket); + require('../api/freshdesk_account/freshdesk_account.socket').register(socket); + require('../api/freshdesk_configuration/freshdesk_configuration.socket').register(socket); + require('../api/freshdesk_field/freshdesk_field.socket').register(socket); + require('../api/integration/integration.socket').register(socket); + require('../api/interval/interval.socket').register(socket); + require('../api/mail_account/mail_account.socket').register(socket); + require('../api/mail_application/mail_application.socket').register(socket); + require('../api/mail_attachment/mail_attachment.socket').register(socket); + require('../api/mail_message/mail_message.socket').register(socket); + require('../api/mail_queue/mail_queue.socket').register(socket); + require('../api/mail_room/mail_room.socket').register(socket); + require('../api/mail_server_in/mail_server_in.socket').register(socket); + require('../api/mail_template/mail_template.socket').register(socket); + require('../api/module/module.socket').register(socket); + require('../api/motionbar/motionbar.socket').register(socket); + require('../api/default_report/default_report.socket').register(socket); + require('../api/custom_report/custom_report.socket').register(socket); + require('../api/report_tree/report_tree.socket').register(socket); + require('../api/report_agent/report_agent.socket').register(socket); + require('../api/report_chat/report_chat.socket').register(socket); + require('../api/report_chat_session/report_chat_session.socket').register(socket); + require('../api/report_integration/report_integration.socket').register(socket); + require('../api/report_mail/report_mail.socket').register(socket); + require('../api/report_mail_session/report_mail_session.socket').register(socket); + require('../api/report_queue/report_queue.socket').register(socket); + require('../api/salesforce_account/salesforce_account.socket').register(socket); + require('../api/salesforce_configuration/salesforce_configuration.socket').register(socket); + require('../api/salesforce_field/salesforce_field.socket').register(socket); + require('../api/setting/setting.socket').register(socket); + require('../api/square_odbc/square_odbc.socket').register(socket); + require('../api/square_project/square_project.socket').register(socket); + require('../api/sugarcrm_account/sugarcrm_account.socket').register(socket); + require('../api/sugarcrm_configuration/sugarcrm_configuration.socket').register(socket); + require('../api/sugarcrm_field/sugarcrm_field.socket').register(socket); + require('../api/tag/tag.socket').register(socket); + require('../api/team/team.socket').register(socket); + require('../api/trigger/trigger.socket').register(socket); + require('../api/trunk/trunk.socket').register(socket); + require('../api/user/user.socket').register(socket); + require('../api/sound/sound.socket').register(socket); + require('../api/user_has_chat_queue/user_has_chat_queue.socket').register(socket); + require('../api/user_has_chat_room/user_has_chat_room.socket').register(socket); + require('../api/user_has_fax_queue/user_has_fax_queue.socket').register(socket); + require('../api/user_has_mail_queue/user_has_mail_queue.socket').register(socket); + require('../api/user_has_team/user_has_team.socket').register(socket); + require('../api/user_has_voice_queue/user_has_voice_queue.socket').register(socket); + require('../api/user_has_service/user_has_service.socket').register(socket); + require('../api/variable/variable.socket').register(socket); + require('../api/chanspy/chanspy.socket').register(socket); + require('../api/metric/metric.socket').register(socket); + require('../api/extracted_report/extracted_report.socket').register(socket); + require('../api/voice_context/voice_context.socket').register(socket); + require('../api/voice_extension/voice_extension.socket').register(socket); + require('../api/voice_musiconhold/voice_musiconhold.socket').register(socket); + require('../api/voice_queue/voice_queue.socket').register(socket); + require('../api/service/service.socket').register(socket); + require('../api/voice_voicemail/voice_voicemail.socket').register(socket); + require('../api/voice_voicemail_messages/voice_voicemail_messages.socket').register(socket); + require('../api/xchatty/xchatty.socket').register(socket); + require('../api/zendesk_account/zendesk_account.socket').register(socket); + require('../api/zendesk_configuration/zendesk_configuration.socket').register(socket); + require('../api/zendesk_field/zendesk_field.socket').register(socket); + + }) + .catch(function(err) { + console.error(err); + }); + } else { + console.log('socket: anyone users found'); + } + + socket.on('info', function(data) { + console.info('[%s] %s', socket.address, JSON.stringify(data, null, 2)); + }); + +} + +module.exports = function(socketio) { + // socket.io (v1.x.x) is powered by debug. + // In order to see all the debug output, set DEBUG (in server/config/local.env.js) to including the desired scope. + // + // ex: DEBUG: "http*,socket.io:socket" + + // We can authenticate socket.io users and access their token through socket.handshake.decoded_token + // + // 1. You will need to send the token in `client/components/socket/socket.service.js` + // + // 2. Require authentication here: + socketio.use(require('socketio-jwt').authorize({ + secret: config.session.secret, + handshake: true + })); + + socketio.on('connection', function(socket) { + socket.address = socket.handshake.address !== null ? socket.handshake + .address.address + ':' + socket.handshake.address.port : process.env + .DOMAIN; + + socket.connectedAt = new Date(); + socket.userId = socket.handshake.query.userId; + socket.role = socket.handshake.query.role; + socket.name = socket.handshake.query.name; + socket.source = socket.handshake.query.source; + + // Call onDisconnect. + socket.on('disconnect', function() { + onDisconnect(socket); + console.info('[%s] SOCKET DISCONNECTED', socket.handshake.address); + }); + + // Call onConnect. + onConnect(socket); + console.info('[%s] SOCKET CONNECTED', socket.handshake.address); + }); +}; diff --git a/server/config/tools/chanspy.js b/server/config/tools/chanspy.js index e1584c2..468c7e4 100644 --- a/server/config/tools/chanspy.js +++ b/server/config/tools/chanspy.js @@ -1 +1,114 @@ -var _0xd587=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x43\x68\x61\x6E\x53\x70\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x61\x6C\x6C","\x61\x75\x74\x68","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd587[0];var fs=require(_0xd587[1]);var util=require(_0xd587[2]);var path=require(_0xd587[3]);var config=require(_0xd587[4]);var ChanSpyModel=require(_0xd587[6])[_0xd587[5]];var User=require(_0xd587[6])[_0xd587[7]];var VoiceExtension=require(_0xd587[6])[_0xd587[8]];var sequelize=require(_0xd587[6])[_0xd587[9]];function ChanSpy(){ChanSpyModel[_0xd587[10]](function(_0x4f99xa){createSpyExtensions(_0x4f99xa)});ChanSpyModel[_0xd587[11]](function(_0x4f99xa){deleteSpyExtensions(_0x4f99xa);createSpyExtensions(_0x4f99xa)});ChanSpyModel[_0xd587[12]](function(_0x4f99xa){deleteSpyExtensions(_0x4f99xa)})}function deleteSpyExtensions(_0x4f99xa){return sequelize[_0xd587[17]](function(_0x4f99xd){return VoiceExtension[_0xd587[16]]({where:{ChanSpyId:_0x4f99xa[_0xd587[15]]},transaction:_0x4f99xd})})[_0xd587[14]](function(_0x4f99xc){console[_0xd587[13]](_0x4f99xc)})}function createSpyExtensions(_0x4f99xa){return sequelize[_0xd587[17]](function(_0x4f99xd){return User[_0xd587[37]](_0xd587[36])[_0xd587[35]]({where:{chanspy:true}})[_0xd587[34]](function(_0x4f99xf){var _0x4f99x10=[];_0x4f99xf[_0xd587[33]](function(_0x4f99x11){var _0x4f99x12=[];var _0x4f99x13=1;if(_0x4f99xa[_0xd587[19]]){_0x4f99x12[_0xd587[28]]({context:_0xd587[20],exten:util[_0xd587[24]](_0xd587[21],_0x4f99xa[_0xd587[22]],_0x4f99x11[_0xd587[23]]),priority:_0x4f99x13,app:_0xd587[25],appdata:_0x4f99xa[_0xd587[26]],UserId:_0x4f99x11[_0xd587[15]],ChanSpyId:_0x4f99xa[_0xd587[15]],type:_0xd587[27]});_0x4f99x13++};_0x4f99x12[_0xd587[28]]({context:_0xd587[20],exten:util[_0xd587[24]](_0xd587[21],_0x4f99xa[_0xd587[22]],_0x4f99x11[_0xd587[23]]),priority:_0x4f99x13,app:_0xd587[5],appdata:util[_0xd587[24]](_0xd587[29],_0x4f99x11[_0xd587[23]],_0x4f99xa[_0xd587[30]]),UserId:_0x4f99x11[_0xd587[15]],ChanSpyId:_0x4f99xa[_0xd587[15]],type:_0xd587[27]});_0x4f99x13=1;if(_0x4f99xa[_0xd587[19]]){_0x4f99x12[_0xd587[28]]({context:_0xd587[20],exten:util[_0xd587[24]](_0xd587[21],_0x4f99xa[_0xd587[22]],_0x4f99x11[_0xd587[31]]),priority:_0x4f99x13,app:_0xd587[25],appdata:_0x4f99xa[_0xd587[26]],UserId:_0x4f99x11[_0xd587[15]],ChanSpyId:_0x4f99xa[_0xd587[15]],type:_0xd587[27]});_0x4f99x13++};_0x4f99x12[_0xd587[28]]({context:_0xd587[20],exten:util[_0xd587[24]](_0xd587[21],_0x4f99xa[_0xd587[22]],_0x4f99x11[_0xd587[31]]),priority:_0x4f99x13,app:_0xd587[5],appdata:util[_0xd587[24]](_0xd587[29],_0x4f99x11[_0xd587[23]],_0x4f99xa[_0xd587[30]]),UserId:_0x4f99x11[_0xd587[15]],ChanSpyId:_0x4f99xa[_0xd587[15]],type:_0xd587[27]});_0x4f99x10[_0xd587[28]](VoiceExtension[_0xd587[32]](_0x4f99x12,{transaction:_0x4f99xd}))});return _0x4f99x10})[_0xd587[18]]()})[_0xd587[14]](function(_0x4f99xc){console[_0xd587[13]](_0x4f99xc)})}module[_0xd587[38]]=ChanSpy \ No newline at end of file +'use strict'; + +var fs = require('fs'); +var util = require('util'); +var path = require('path'); +var config = require('../../config/environment'); +var ChanSpyModel = require('../../models').ChanSpy; +var User = require('../../models').User; +var VoiceExtension = require('../../models').VoiceExtension; +var sequelize = require('../../models').sequelize; + +function ChanSpy() { + ChanSpyModel.afterCreate(function(doc) { + createSpyExtensions(doc); + }) + ChanSpyModel.afterUpdate(function(doc) { + deleteSpyExtensions(doc); + createSpyExtensions(doc); + }) + ChanSpyModel.afterDelete(function(doc) { + deleteSpyExtensions(doc); + }) +} + +function deleteSpyExtensions(doc) { + return sequelize.transaction(function(t) { + return VoiceExtension + .destroy({ + where: { + ChanSpyId: doc.id + }, + transaction: t + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function createSpyExtensions(doc) { + return sequelize.transaction(function(t) { + return User + .scope('agent') + .findAll({ + where: { + chanspy: true + } + }) + .then(function(agents) { + var bulkSpies = []; + agents.forEach(function(elem) { + var spies = []; + var priority = 1; + if (doc.auth) { + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', doc.prefix, elem.name), + priority: priority, + app: 'Authenticate', + appdata: doc.password, + UserId: elem.id, + ChanSpyId: doc.id, + type: 'system' + }); + priority++; + } + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', doc.prefix, elem.name), + priority: priority, + app: 'ChanSpy', + appdata: util.format('SIP/%s,%s', elem.name, doc.options), + UserId: elem.id, + ChanSpyId: doc.id, + type: 'system' + }); + priority = 1; + if (doc.auth) { + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', doc.prefix, elem.internal), + priority: priority, + app: 'Authenticate', + appdata: doc.password, + UserId: elem.id, + ChanSpyId: doc.id, + type: 'system' + }); + priority++; + } + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', doc.prefix, elem.internal), + priority: priority, + app: 'ChanSpy', + appdata: util.format('SIP/%s,%s', elem.name, doc.options), + UserId: elem.id, + ChanSpyId: doc.id, + type: 'system' + }); + bulkSpies.push(VoiceExtension.bulkCreate(spies, { + transaction: t + })); + }); + return bulkSpies; + }) + .all(); + }) + .catch(function(err) { + console.log(err); + }); +} + +module.exports = ChanSpy; diff --git a/server/config/tools/chatRoom.js b/server/config/tools/chatRoom.js index da98f30..a36f4e6 100644 --- a/server/config/tools/chatRoom.js +++ b/server/config/tools/chatRoom.js @@ -1 +1,27 @@ -var _0xee40=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x73\x74\x61\x74\x75\x73","\x63\x68\x61\x6E\x67\x65\x64","\x43\x4C\x4F\x53\x45\x44","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72\x49\x64","\x73\x65\x72\x76\x65\x64","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xee40[0];var _=require(_0xee40[1]);var ChatRoomModel=require(_0xee40[3])[_0xee40[2]];var ChatVisitorModel=require(_0xee40[3])[_0xee40[4]];function ChatRoom(){ChatRoomModel[_0xee40[14]](function(_0xb5b7x5){if(_0xb5b7x5[_0xee40[6]](_0xee40[5])&&_0xb5b7x5[_0xee40[5]]===_0xee40[7]){if(_0xb5b7x5[_0xee40[8]]){return ChatVisitorModel[_0xee40[13]](_0xb5b7x5.ChatVisitorId)[_0xee40[12]](function(_0xb5b7x6){if(_0xb5b7x6){var _0xb5b7x7=_[_0xee40[10]](_0xb5b7x6,{status:_0xee40[9]});return _0xb5b7x7[_0xee40[11]]()}})}}})}module[_0xee40[15]]=ChatRoom \ No newline at end of file +'use strict'; + +var _ = require('lodash'); + +var ChatRoomModel = require('../../models').ChatRoom; +var ChatVisitorModel = require('../../models').ChatVisitor; + +function ChatRoom() { + ChatRoomModel.afterUpdate(function(doc) { + if (doc.changed('status') && doc.status === 'CLOSED') { + if (doc.ChatVisitorId) { + return ChatVisitorModel + .findById(doc.ChatVisitorId) + .then(function(chatVisitor) { + if (chatVisitor) { + var updated = _.merge(chatVisitor, { + status: 'served' + }); + return updated.save(); + } + }); + } + } + }) +} + +module.exports = ChatRoom; diff --git a/server/config/tools/index.js b/server/config/tools/index.js index 9cbc5ab..8e605bb 100644 --- a/server/config/tools/index.js +++ b/server/config/tools/index.js @@ -1 +1,14 @@ -var _0xcb2c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x2E\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2F\x75\x73\x65\x72","\x2E\x2F\x63\x68\x61\x6E\x73\x70\x79","\x2E\x2F\x63\x68\x61\x74\x52\x6F\x6F\x6D","\x65\x78\x70\x6F\x72\x74\x73"];_0xcb2c[0];var Interval=require(_0xcb2c[1]);var User=require(_0xcb2c[2]);var ChanSpy=require(_0xcb2c[3]);var ChatRoom=require(_0xcb2c[4]);module[_0xcb2c[5]]=function(){ new Interval(); new User(); new ChanSpy(); new ChatRoom()} \ No newline at end of file +'use strict'; + +var Interval = require('./interval'); +var User = require('./user'); +var ChanSpy = require('./chanspy'); +var ChatRoom = require('./chatRoom'); + +module.exports = function() { + // Tools Mangament + new Interval(); + new User(); + new ChanSpy(); + new ChatRoom(); +} diff --git a/server/config/tools/interval.js b/server/config/tools/interval.js index 882640c..223b7bf 100644 --- a/server/config/tools/interval.js +++ b/server/config/tools/interval.js @@ -1 +1,74 @@ -var _0xcd8b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x49\x6E\x74\x65\x72\x76\x61\x6C\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x62\x65\x66\x6F\x72\x65\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x69\x64","\x63\x61\x74\x63\x68","\x50\x52\x49\x4D\x41\x52\x59","\x66\x69\x65\x6C\x64\x73","\x6D\x65\x73\x73\x61\x67\x65","\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2F\x63\x6F\x6E\x74\x65\x78\x74\x20\x63\x6F\x6D\x62\x69\x6E\x61\x74\x69\x6F\x6E\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x52\x4F\x55\x54\x45","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x72\x6F\x75\x74\x65\x55\x70\x64\x61\x74\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x61\x70\x70","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x63\x61\x6C\x6C\x65\x72\x49\x44","\x61\x70\x70\x64\x61\x74\x61","\x74\x79\x70\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x65\x78\x70\x6F\x72\x74\x73"];_0xcd8b[0];var _=require(_0xcd8b[1]);var util=require(_0xcd8b[2]);var IntervalModel=require(_0xcd8b[4])[_0xcd8b[3]];var VoiceExtension=require(_0xcd8b[4])[_0xcd8b[5]];var veUtil=require(_0xcd8b[6]);var sequelize=require(_0xcd8b[4])[_0xcd8b[7]];var Applications=veUtil[_0xcd8b[8]];function Interval(){console[_0xcd8b[10]](_0xcd8b[9]);IntervalModel[_0xcd8b[11]](function(_0x4831x9){updatevoiceExtension(_0x4831x9)});IntervalModel[_0xcd8b[13]](function(_0x4831x9){if(_0x4831x9[_0xcd8b[12]]!==null){updatevoiceExtension(_0x4831x9)}});IntervalModel[_0xcd8b[14]](function(_0x4831x9){if(_0x4831x9[_0xcd8b[12]]!==null){updatevoiceExtension(_0x4831x9)}})}function updatevoiceExtension(_0x4831x9){var _0x4831xb=_0x4831x9[_0xcd8b[12]]===null?_0x4831x9[_0xcd8b[15]]:_0x4831x9[_0xcd8b[12]];return VoiceExtension[_0xcd8b[33]]({where:{VoiceExtensionId:null},include:[{model:VoiceExtension,as:_0xcd8b[8],where:{IntervalId:_0x4831xb},attributes:[_0xcd8b[28],_0xcd8b[29],_0xcd8b[12],_0xcd8b[30],_0xcd8b[31],_0xcd8b[32]]}]})[_0xcd8b[27]](function(_0x4831xd){_0x4831xd[_0xcd8b[26]](function(_0x4831xe){return sequelize[_0xcd8b[25]](function(_0x4831xf){return veUtil[_0xcd8b[24]]({body:_0x4831xe[_0xcd8b[23]],params:{id:_0x4831xe[_0xcd8b[15]]}},_0x4831xf)})[_0xcd8b[16]](sequelize.UniqueConstraintError,function(_0x4831xc){if(_0x4831xc[_0xcd8b[18]][_0xcd8b[17]]){_0x4831xc[_0xcd8b[19]]=_0xcd8b[20];_0x4831xc[_0xcd8b[21]]=_0xcd8b[22]};console[_0xcd8b[10]](_0x4831xc)})[_0xcd8b[16]](function(_0x4831xc){console[_0xcd8b[10]](_0x4831xc)})})})[_0xcd8b[16]](function(_0x4831xc){console[_0xcd8b[10]](_0x4831xc)})}module[_0xcd8b[34]]=Interval \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var util = require('util'); +var IntervalModel = require('../../models').Interval; +var VoiceExtension = require('../../models').VoiceExtension; +var veUtil = require('../../utils/voice_extension'); +var sequelize = require('../../models').sequelize; +var Applications = veUtil.Applications; + +function Interval() { + console.log('Interval Initialization..'); + IntervalModel.afterUpdate(function(interval) { + updatevoiceExtension(interval); + }) + + IntervalModel.beforeDestroy(function(interval) { + if (interval.IntervalId !== null) { + updatevoiceExtension(interval); + } + }) + + IntervalModel.afterCreate(function(interval) { + if (interval.IntervalId !== null) { + updatevoiceExtension(interval); + } + }) +} + +function updatevoiceExtension(interval) { + var IntervalId = interval.IntervalId === null ? interval.id : interval.IntervalId; + return VoiceExtension + .findAll({ + where: { + VoiceExtensionId: null + }, + include: [{ + model: VoiceExtension, + as: 'Applications', + where: { + IntervalId: IntervalId + }, + attributes: ['app', 'interval', 'IntervalId', 'callerID', 'appdata', 'type'] + }] + }) + .then(function(voiceExtensions) { + voiceExtensions.forEach(function(elem) { + return sequelize.transaction(function(t) { + return veUtil.routeUpdate({ + body: elem.dataValues, + params: { + id: elem.id + } + }, t); + }) + .catch(sequelize.UniqueConstraintError, function(err) { + if (err.fields.PRIMARY) { + err.message = 'Extension/context combination already exist'; + err.translatedMessage = 'MESSAGE_EXIST_ROUTE' + } + console.log(err); + }) + .catch(function(err) { + console.log(err); + }); + }); + }) + .catch(function(err) { + console.log(err); + }); +} + + +module.exports = Interval; diff --git a/server/config/tools/user.js b/server/config/tools/user.js index c45e647..a55d7c8 100644 --- a/server/config/tools/user.js +++ b/server/config/tools/user.js @@ -1 +1,193 @@ -var _0xd284=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x43\x68\x61\x6E\x53\x70\x79","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x63\x68\x61\x6E\x73\x70\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x6E\x61\x6D\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x61\x6C\x6C","\x61\x75\x74\x68","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x69\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x65\x78\x74\x65\x6E","\x5F\x70\x72\x65\x76\x69\x6F\x75\x73\x44\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x61\x70\x70\x64\x61\x74\x61","\x53\x49\x50\x2F","\x67\x65\x74\x55\x73\x65\x72\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x44\x69\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73"];_0xd284[0];var fs=require(_0xd284[1]);var util=require(_0xd284[2]);var path=require(_0xd284[3]);var config=require(_0xd284[4]);var UserModel=require(_0xd284[6])[_0xd284[5]];var VoiceExtension=require(_0xd284[6])[_0xd284[7]];var ChanSpy=require(_0xd284[6])[_0xd284[8]];var sequelize=require(_0xd284[6])[_0xd284[9]];function User(){UserModel[_0xd284[11]](function(_0xb564xa){createCallerID(_0xb564xa);createExtension(_0xb564xa);if(_0xb564xa[_0xd284[10]]){createChanspy(_0xb564xa)}});UserModel[_0xd284[14]](function(_0xb564xa){updateExtension(_0xb564xa);createCallerID(_0xb564xa);if((_0xb564xa[_0xd284[10]]&&_0xb564xa[_0xd284[12]](_0xd284[10]))){createChanspy(_0xb564xa)}else {if(_0xb564xa[_0xd284[10]]&&!_0xb564xa[_0xd284[12]](_0xd284[10])&&_0xb564xa[_0xd284[12]](_0xd284[13])){deleteChanSpy(_0xb564xa);createChanspy(_0xb564xa)}else {if(!_0xb564xa[_0xd284[10]]&&_0xb564xa[_0xd284[12]](_0xd284[10])){deleteChanSpy(_0xb564xa)}}}})}function createChanspy(_0xb564xa){return sequelize[_0xd284[35]](function(_0xb564xd){return ChanSpy[_0xd284[34]]()[_0xd284[33]](function(_0xb564xe){var _0xb564xf=[];_0xb564xe[_0xd284[32]](function(_0xb564x10){var _0xb564x11=[];var _0xb564x12=1;if(_0xb564x10[_0xd284[18]]){_0xb564x11[_0xd284[27]]({context:_0xd284[19],exten:util[_0xd284[22]](_0xd284[20],_0xb564x10[_0xd284[21]],_0xb564xa[_0xd284[13]]),priority:_0xb564x12,app:_0xd284[23],appdata:_0xb564x10[_0xd284[24]],UserId:_0xb564xa[_0xd284[25]],ChanSpyId:_0xb564x10[_0xd284[25]],type:_0xd284[26]});_0xb564x12++};_0xb564x11[_0xd284[27]]({context:_0xd284[19],exten:util[_0xd284[22]](_0xd284[20],_0xb564x10[_0xd284[21]],_0xb564xa[_0xd284[13]]),priority:_0xb564x12,app:_0xd284[8],appdata:util[_0xd284[22]](_0xd284[28],_0xb564xa[_0xd284[13]],_0xb564x10[_0xd284[29]]),UserId:_0xb564xa[_0xd284[25]],ChanSpyId:_0xb564x10[_0xd284[25]],type:_0xd284[26]});_0xb564x12=1;if(_0xb564x10[_0xd284[18]]){_0xb564x11[_0xd284[27]]({context:_0xd284[19],exten:util[_0xd284[22]](_0xd284[20],_0xb564x10[_0xd284[21]],_0xb564xa[_0xd284[30]]),priority:_0xb564x12,app:_0xd284[23],appdata:_0xb564x10[_0xd284[24]],UserId:_0xb564xa[_0xd284[25]],ChanSpyId:_0xb564x10[_0xd284[25]],type:_0xd284[26]});_0xb564x12++};_0xb564x11[_0xd284[27]]({context:_0xd284[19],exten:util[_0xd284[22]](_0xd284[20],_0xb564x10[_0xd284[21]],_0xb564xa[_0xd284[30]]),priority:_0xb564x12,app:_0xd284[8],appdata:util[_0xd284[22]](_0xd284[28],_0xb564xa[_0xd284[13]],_0xb564x10[_0xd284[29]]),UserId:_0xb564xa[_0xd284[25]],ChanSpyId:_0xb564x10[_0xd284[25]],type:_0xd284[26]});_0xb564xf[_0xd284[27]](VoiceExtension[_0xd284[31]](_0xb564x11,{transaction:_0xb564xd}))});return _0xb564xf})[_0xd284[17]]()})[_0xd284[16]](function(_0xb564xc){console[_0xd284[15]](_0xb564xc)})}function deleteChanSpy(_0xb564xa){return sequelize[_0xd284[35]](function(_0xb564xd){return VoiceExtension[_0xd284[36]]({where:{UserId:_0xb564xa[_0xd284[25]],ChanSpyId:{$ne:null}},transaction:_0xb564xd})})[_0xd284[16]](function(_0xb564xc){console[_0xd284[15]](_0xb564xc)})}function createCallerID(_0xb564xa){if(_0xb564xa[_0xd284[37]]&&_0xb564xa[_0xd284[30]]){_0xb564xa[_0xd284[38]]=util[_0xd284[22]](_0xd284[39],_0xb564xa[_0xd284[37]],_0xb564xa[_0xd284[30]]);_0xb564xa[_0xd284[40]]()};return}function updateExtension(_0xb564xa){if(_0xb564xa[_0xd284[12]](_0xd284[13])){_0xb564xa[_0xd284[45]]()[_0xd284[33]](function(_0xb564x16){_0xb564x16[_0xd284[32]](function(_0xb564x10){_0xb564x10[_0xd284[41]]=(_0xb564x10[_0xd284[41]]===_0xb564xa[_0xd284[42]][_0xd284[30]])?_0xb564xa[_0xd284[30]]:_0xb564xa[_0xd284[13]];_0xb564x10[_0xd284[43]]=_0xd284[44]+_0xb564xa[_0xd284[13]];_0xb564x10[_0xd284[40]]()})})[_0xd284[16]](function(_0xb564xc){console[_0xd284[15]](_0xb564xc)})}}function createExtension(_0xb564xa){if(_0xb564xa[_0xd284[30]]){var _0xb564x18=[{context:_0xd284[19],exten:_0xb564xa[_0xd284[30]],priority:1,app:_0xd284[46],appdata:_0xd284[47],UserId:_0xb564xa[_0xd284[25]],type:_0xd284[26]},{context:_0xd284[19],exten:_0xb564xa[_0xd284[30]],priority:2,app:_0xd284[48],appdata:_0xd284[44]+_0xb564xa[_0xd284[13]],UserId:_0xb564xa[_0xd284[25]],type:_0xd284[26]},{context:_0xd284[19],exten:_0xb564xa[_0xd284[30]],priority:1,app:_0xd284[46],appdata:_0xd284[47],UserId:_0xb564xa[_0xd284[25]],type:_0xd284[26]},{context:_0xd284[19],exten:_0xb564xa[_0xd284[13]],priority:2,app:_0xd284[48],appdata:_0xd284[44]+_0xb564xa[_0xd284[13]],UserId:_0xb564xa[_0xd284[25]],type:_0xd284[26]}];return VoiceExtension[_0xd284[31]](_0xb564x18)[_0xd284[16]](function(_0xb564xc){console[_0xd284[15]](_0xb564xc)})}}module[_0xd284[49]]=User \ No newline at end of file +'use strict'; + +var fs = require('fs'); +var util = require('util'); +var path = require('path'); +var config = require('../../config/environment'); +var UserModel = require('../../models').User; +var VoiceExtension = require('../../models').VoiceExtension; +var ChanSpy = require('../../models').ChanSpy; +var sequelize = require('../../models').sequelize; + +function User() { + UserModel.afterCreate(function(doc) { + createCallerID(doc); + createExtension(doc); + if (doc.chanspy) { + createChanspy(doc); + } + }) + UserModel.afterUpdate(function(doc) { + updateExtension(doc); + createCallerID(doc); + if ((doc.chanspy && doc.changed('chanspy'))) { + createChanspy(doc); + } else if (doc.chanspy && !doc.changed('chanspy') && doc.changed('name')) { + deleteChanSpy(doc); + createChanspy(doc); + } else if (!doc.chanspy && doc.changed('chanspy')) { + deleteChanSpy(doc); + } + }) +} + +function createChanspy(doc) { + return sequelize.transaction(function(t) { + return ChanSpy + .findAll() + .then(function(chanspy) { + var bulkSpies = []; + chanspy.forEach(function(elem) { + var spies = []; + var priority = 1; + if (elem.auth) { + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', elem.prefix, doc.name), + priority: priority, + app: 'Authenticate', + appdata: elem.password, + UserId: doc.id, + ChanSpyId: elem.id, + type: 'system' + }); + priority++; + } + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', elem.prefix, doc.name), + priority: priority, + app: 'ChanSpy', + appdata: util.format('SIP/%s,%s', doc.name, elem.options), + UserId: doc.id, + ChanSpyId: elem.id, + type: 'system' + }); + priority = 1; + if (elem.auth) { + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', elem.prefix, doc.internal), + priority: priority, + app: 'Authenticate', + appdata: elem.password, + UserId: doc.id, + ChanSpyId: elem.id, + type: 'system' + }); + priority++; + } + spies.push({ + context: 'from-sip', + exten: util.format('%s%s', elem.prefix, doc.internal), + priority: priority, + app: 'ChanSpy', + appdata: util.format('SIP/%s,%s', doc.name, elem.options), + UserId: doc.id, + ChanSpyId: elem.id, + type: 'system' + }); + bulkSpies.push(VoiceExtension.bulkCreate(spies, { + transaction: t + })); + }); + return bulkSpies; + }) + .all(); + }) + .catch(function(err) { + console.log(err); + }); +} + +function deleteChanSpy(doc) { + return sequelize.transaction(function(t) { + return VoiceExtension + .destroy({ + where: { + UserId: doc.id, + ChanSpyId: { + $ne: null + } + }, + transaction: t + }); + }) + .catch(function(err) { + console.log(err); + }); +} + +function createCallerID(doc) { + // devo aspettare che ci siano entrambi i campi + if (doc.fullname && doc.internal) { + doc.callerid = util.format('"%s" <%s>', doc.fullname, doc.internal); + doc.save(); + } + + return; +} + +function updateExtension(doc) { + if (doc.changed('name')) { + doc + .getUserExtensions() + .then(function(userExtensions) { + userExtensions.forEach(function(elem) { + elem.exten = (elem.exten === doc._previousDataValues.internal) ? doc.internal : doc.name; + elem.appdata = 'SIP/' + doc.name; + elem.save(); + }) + }) + .catch(function(err) { + console.log(err); + }); + } +} + + +function createExtension(doc) { + if (doc.internal) { + var userDials = [{ + context: 'from-sip', + exten: doc.internal, + priority: 1, + app: 'Set', + appdata: 'CDR(type)=internal', + UserId: doc.id, + type: 'system' + }, { + context: 'from-sip', + exten: doc.internal, + priority: 2, + app: 'Dial', + appdata: 'SIP/' + doc.name, + UserId: doc.id, + type: 'system' + }, { + context: 'from-sip', + exten: doc.internal, + priority: 1, + app: 'Set', + appdata: 'CDR(type)=internal', + UserId: doc.id, + type: 'system' + }, { + context: 'from-sip', + exten: doc.name, + priority: 2, + app: 'Dial', + appdata: 'SIP/' + doc.name, + UserId: doc.id, + type: 'system' + }]; + + return VoiceExtension + .bulkCreate(userDials) + .catch(function(err) { + console.log(err); + }); + } +} + +module.exports = User; diff --git a/server/config/triggers/chat.js b/server/config/triggers/chat.js index 35d27da..72fc1e9 100644 --- a/server/config/triggers/chat.js +++ b/server/config/triggers/chat.js @@ -1 +1,76 @@ -var _0xe38a=["\x6C\x6F\x64\x61\x73\x68","\x6D\x75\x73\x74\x61\x63\x68\x65","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x54\x72\x69\x67\x67\x65\x72\x20\x43\x68\x61\x74\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x65\x6E\x71\x75\x69\x72\x79\x5F\x66\x6F\x72\x77\x61\x72\x64\x69\x6E\x67\x5F\x61\x64\x64\x72\x65\x73\x73","\x73\x75\x62\x6A\x65\x63\x74","\x68\x74\x6D\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x72\x65\x6E\x64\x65\x72","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x6E\x61\x6D\x65","\x65\x6E\x71\x75\x69\x72\x79\x5F\x66\x6F\x72\x77\x61\x72\x64\x69\x6E\x67","\x67\x65\x74\x4F\x66\x66\x6C\x69\x6E\x65\x54\x65\x6D\x70\x6C\x61\x74\x65","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var _=require(_0xe38a[0]);var Mustache=require(_0xe38a[1]);var sequelize=require(_0xe38a[3])[_0xe38a[2]];var ChatEnquiry=require(_0xe38a[3])[_0xe38a[4]];var ChatWebsite=require(_0xe38a[3])[_0xe38a[5]];var MailMessage=require(_0xe38a[3])[_0xe38a[6]];var MailServerOut=require(_0xe38a[3])[_0xe38a[7]];function Chat(){console[_0xe38a[9]](_0xe38a[8]);ChatEnquiry[_0xe38a[24]](function(_0xe5eax9,_0xe5eaxa){var _0xe5eaxb=_0xe5eax9;var _0xe5eaxc;var _0xe5eaxd;var _0xe5eaxe;return ChatWebsite[_0xe38a[23]](_0xe5eax9.ChatWebsiteId)[_0xe38a[16]](function(_0xe5eax11){_0xe5eaxc=_0xe5eax11;_0xe5eaxb[_0xe38a[19]]=_0xe5eaxc[_0xe38a[20]];if(_0xe5eaxc[_0xe38a[21]]&&_0xe5eaxc[_0xe38a[11]]){return _0xe5eaxc[_0xe38a[22]]()}else {return null}})[_0xe38a[16]](function(_0xe5eax10){_0xe5eaxe=_0xe5eax10;if(_0xe5eaxe){_0xe5eaxe[_0xe38a[13]]=Mustache[_0xe38a[17]](_0xe5eaxe[_0xe38a[13]],_0xe5eaxb);_0xe5eaxe[_0xe38a[12]]=Mustache[_0xe38a[17]](_0xe5eaxe[_0xe38a[12]],_0xe5eaxb);return MailServerOut[_0xe38a[18]]({where:{service:true}})}else {return null}})[_0xe38a[16]](function(_0xe5eaxf){_0xe5eaxd=_0xe5eaxf;if(_0xe5eaxd){return MailMessage[_0xe38a[15]]({from:[_0xe5eaxd[_0xe38a[10]]],to:[_0xe5eaxc[_0xe38a[11]]],subject:_0xe5eaxe[_0xe38a[12]],html:_0xe5eaxe[_0xe38a[13]]},{transaction:_0xe5eaxa?_0xe5eaxa[_0xe38a[14]]:null})}})})}module[_0xe38a[25]]=Chat \ No newline at end of file +var _ = require('lodash'); +var Mustache = require('mustache'); + +var sequelize = require('../../models').sequelize; +var ChatEnquiry = require('../../models').ChatEnquiry; +var ChatWebsite = require('../../models').ChatWebsite; +var MailMessage = require('../../models').MailMessage; +var MailServerOut = require('../../models').MailServerOut; + +function Chat() { + console.log('Trigger Chat Initialization...'); + + ChatEnquiry.afterCreate(function(chatEnquiry, options) { + var _chatEnquiry = chatEnquiry; + var _chatWebsite; + var _mailServerOut; + var _offlineTemplate; + + return ChatWebsite + .findById(chatEnquiry.ChatWebsiteId) + .then(function(chatWebsite) { + _chatWebsite = chatWebsite; + _chatEnquiry.chatWebsite = _chatWebsite.name; + + if (_chatWebsite.enquiry_forwarding && _chatWebsite.enquiry_forwarding_address) { + return _chatWebsite + .getOfflineTemplate(); + } else { + // throw new Error({ + // message: 'chatWebsite can\'t send offline messages via mail' + // }); + return null; + } + }) + .then(function(offlineTemplate) { + _offlineTemplate = offlineTemplate; + if (_offlineTemplate) { + _offlineTemplate.html = Mustache.render(_offlineTemplate.html, _chatEnquiry); + _offlineTemplate.subject = Mustache.render(_offlineTemplate.subject, _chatEnquiry); + + return MailServerOut + .findOne({ + where: { + service: true + } + }); + + } else { + // throw new Error({ + // message: 'offlineTemplate not found. ChatWebsite: ' + _chatWebsite.name + // }); + return null; + } + + + }) + .then(function(mailServerOut) { + _mailServerOut = mailServerOut; + + if (_mailServerOut) { + // throw new Error('Motion Service SMTP not configured!'); + return MailMessage + .create({ + from: [_mailServerOut.username], + to: [_chatWebsite.enquiry_forwarding_address], + subject: _offlineTemplate.subject, + html: _offlineTemplate.html + }, { + transaction: options ? options.transaction : null + }); + } + }); + }); +} + +module.exports = Chat; diff --git a/server/config/triggers/cm.js b/server/config/triggers/cm.js index 5b914e0..ae02e6e 100644 --- a/server/config/triggers/cm.js +++ b/server/config/triggers/cm.js @@ -1 +1,25 @@ -var _0x3b82=["\x6C\x6F\x64\x61\x73\x68","\x54\x72\x69\x67\x67\x65\x72\x20\x43\x6D\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x6D\x61\x6E\x61\x67\x65\x43\x6F\x6E\x74\x61\x63\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x63\x61\x74\x63\x68","\x63\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var _=require(_0x3b82[0]);function Cm(){console[_0x3b82[2]](_0x3b82[1])}Cm[_0x3b82[4]][_0x3b82[3]]=function(_0x6e6ax3,_0x6e6ax4){manageContact(_0x6e6ax3,_0x6e6ax4)};function manageContact(_0x6e6ax3,_0x6e6ax4){var _0x6e6ax6=require(_0x3b82[6])[_0x3b82[5]];var _0x6e6ax7=require(_0x3b82[6])[_0x3b82[7]];var _0x6e6ax8=require(_0x3b82[6])[_0x3b82[8]];var _0x6e6ax9=require(_0x3b82[6])[_0x3b82[9]];delete _0x6e6ax3[_0x3b82[10]];_0x6e6ax3[_0x3b82[11]]=_0x3b82[12];_0x6e6ax3[_0x3b82[13]]=_0x6e6ax4;_0x6e6ax9[_0x3b82[15]](_0x6e6ax3)[_0x3b82[14]](function(_0x6e6axa){console[_0x3b82[2]](_0x6e6axa)})}module[_0x3b82[16]]=Cm \ No newline at end of file +var _ = require('lodash'); + +function Cm() { + console.log('Trigger Cm Initialization...'); +} + +Cm.prototype.manageContact = function(doc, channel) { + manageContact(doc, channel); +} + +function manageContact(doc, channel) { + var Contact = require('../../models').Contact; + var ContactPhone = require('../../models').ContactPhone; + var ContactEmail = require('../../models').ContactEmail; + var ReportIntegration = require('../../models').ReportIntegration; + delete doc.id + doc.integration = 'contactmanager'; + doc.eventChannel = channel; + ReportIntegration.create(doc) + .catch(function(err) { + console.log(err); + }); +} + +module.exports = Cm; diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ad62857..947b5f0 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -1 +1,103 @@ -var _0x2526=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2F\x75\x74\x69\x6C","\x2E\x2F\x76\x6F\x69\x63\x65","\x2E\x2F\x6D\x61\x69\x6C","\x2E\x2F\x63\x68\x61\x74","\x2E\x2F\x63\x6D","\x2E\x2E\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x54\x72\x69\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x65\x78\x70\x6F\x72\x74\x73","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x54\x72\x69\x67\x67\x65\x72\x73\x20\x61\x72\x65\x20","\x6C\x65\x6E\x67\x74\x68","\x6C\x6F\x67","\x76\x6F\x69\x63\x65","\x66\x69\x6C\x74\x65\x72","\x67\x65\x74\x41\x63\x74\x69\x6F\x6E\x73\x42\x79\x54\x72\x69\x67\x67\x65\x72\x73","\x41\x66\x74\x65\x72\x20\x61\x67\x65\x6E\x74\x20\x63\x72\x65\x61\x74\x65\x2C\x20\x41\x63\x74\x69\x6F\x6E\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x41\x66\x74\x65\x72\x20\x61\x67\x65\x6E\x74\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x41\x63\x74\x69\x6F\x6E\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x6D\x61\x69\x6C","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x61\x63\x74\x69\x6F\x6E\x20\x22","\x61\x63\x74\x69\x6F\x6E","\x22","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x61\x6E\x61\x67\x65\x43\x6F\x6E\x74\x61\x63\x74","\x63\x6F\x6E\x74\x61\x63\x74\x4D\x61\x6E\x61\x67\x65\x72","\x73\x65\x6E\x64\x54\x65\x6D\x70\x6C\x61\x74\x65","\x74\x65\x6D\x70\x6C\x61\x74\x65","\x6D\x61\x6E\x61\x67\x65\x45\x76\x65\x6E\x74","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x66\x74\x65\x72\x20\x63\x72\x65\x61\x74\x65\x2C\x20\x54\x72\x69\x67\x67\x65\x72\x73\x20\x61\x72\x65\x20","\x41\x66\x74\x65\x72\x20\x75\x70\x64\x61\x74\x65\x2C\x20\x54\x72\x69\x67\x67\x65\x72\x73\x20\x61\x72\x65\x20","\x69\x64","\x72\x65\x6D\x6F\x76\x65","\x41\x66\x74\x65\x72\x20\x64\x65\x73\x74\x72\x6F\x79\x2C\x20\x54\x72\x69\x67\x67\x65\x72\x73\x20\x61\x72\x65\x20","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x69\x6E\x64\x65\x78\x4F\x66","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74"];_0x2526[0];var _=require(_0x2526[1]);var Util=require(_0x2526[2]);var Voice=require(_0x2526[3]);var Mail=require(_0x2526[4]);var Chat=require(_0x2526[5]);var Cm=require(_0x2526[6]);var Integration=require(_0x2526[7]);var Trigger=require(_0x2526[9])[_0x2526[8]];var ReportAgent=require(_0x2526[9])[_0x2526[10]];var MailMessage=require(_0x2526[9])[_0x2526[11]];module[_0x2526[12]]=function(_0xc5a2xb){var _0xc5a2xc= new Util();var _0xc5a2xd= new Voice();var _0xc5a2xe= new Chat();var _0xc5a2xf= new Mail();var _0xc5a2x10= new Cm();var _0xc5a2x11= new Integration(_0xc5a2xb);Trigger[_0x2526[31]](_0x2526[30])[_0x2526[29]]()[_0x2526[28]](function(_0xc5a2x13){synchTriggers(_0xc5a2x13);console[_0x2526[17]](_0x2526[15],_0xc5a2x13[_0x2526[16]]);ReportAgent[_0x2526[22]](function(_0xc5a2x14){var _0xc5a2x15=_0xc5a2xc[_0x2526[20]](_0xc5a2x14,_[_0x2526[19]](_0xc5a2x13,{channel:_0x2526[18]}));console[_0x2526[17]](_0x2526[21],_0xc5a2x15[_0x2526[16]]);execActions(_0xc5a2x15,_0xc5a2x14,_0x2526[18],_0xc5a2xc,_0xc5a2xd,_0xc5a2xf,_0xc5a2x10,_0xc5a2x11)});ReportAgent[_0x2526[24]](function(_0xc5a2x14){var _0xc5a2x15=_0xc5a2xc[_0x2526[20]](_0xc5a2x14,_[_0x2526[19]](_0xc5a2x13,{channel:_0x2526[18]}));console[_0x2526[17]](_0x2526[23],_0xc5a2x15[_0x2526[16]]);execActions(_0xc5a2x15,_0xc5a2x14,_0x2526[18],_0xc5a2xc,_0xc5a2xd,_0xc5a2xf,_0xc5a2x10,_0xc5a2x11)});MailMessage[_0x2526[22]](function(_0xc5a2x14){if(_0xc5a2x14[_0x2526[25]]===_0x2526[26]){var _0xc5a2x15=_0xc5a2xc[_0x2526[20]](_0xc5a2x14,_[_0x2526[19]](_0xc5a2x13,{channel:_0x2526[27]}));execActions(_0xc5a2x15,_0xc5a2x14,_0x2526[27],_0xc5a2xc,_0xc5a2xd,_0xc5a2xf,_0xc5a2x10,_0xc5a2x11)}})})[_0x2526[14]](function(_0xc5a2x12){console[_0x2526[13]](_0xc5a2x12)})};function execActions(_0xc5a2x15,_0xc5a2x14,_0xc5a2x17,_0xc5a2xc,_0xc5a2xd,_0xc5a2xf,_0xc5a2x10,_0xc5a2x11){_0xc5a2x15[_0x2526[42]](function(_0xc5a2x18){console[_0x2526[17]](_0x2526[32]+_0xc5a2x18[_0x2526[33]]+_0x2526[34]);switch(_0xc5a2x18[_0x2526[33]]){case _0x2526[37]:_0xc5a2x10[_0x2526[36]](_0xc5a2x14[_0x2526[35]],_0xc5a2x17);break;case _0x2526[39]:_0xc5a2xf[_0x2526[38]](_0xc5a2x18);break;case _0x2526[41]:_0xc5a2x11[_0x2526[40]](_0xc5a2x18,_0xc5a2x14,_0xc5a2x17);break;default:}})}function synchTriggers(_0xc5a2x13){Trigger[_0x2526[22]](function(_0xc5a2x14){updateCollection(_0xc5a2x13,_0xc5a2x14);console[_0x2526[17]](_0x2526[43],_0xc5a2x13[_0x2526[16]])});Trigger[_0x2526[24]](function(_0xc5a2x14){updateCollection(_0xc5a2x13,_0xc5a2x14);console[_0x2526[17]](_0x2526[44],_0xc5a2x13[_0x2526[16]])});Trigger[_0x2526[48]](function(_0xc5a2x14){_[_0x2526[46]](_0xc5a2x13,{id:_0xc5a2x14[_0x2526[45]]});console[_0x2526[17]](_0x2526[47],_0xc5a2x13[_0x2526[16]])})}function updateCollection(_0xc5a2x1b,_0xc5a2x14){var _0xc5a2x1c=_[_0x2526[49]](_0xc5a2x1b,{id:_0xc5a2x14[_0x2526[45]]});var _0xc5a2x1d=_0xc5a2x1b[_0x2526[50]](_0xc5a2x1c);if(_0xc5a2x1c){_[_0x2526[51]](_0xc5a2x1b[_0xc5a2x1d],_0xc5a2x14)}else {_0xc5a2x1b[_0x2526[52]](_0xc5a2x14)}} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var Util = require('./util'); +var Voice = require('./voice'); +var Mail = require('./mail'); +var Chat = require('./chat'); +var Cm = require('./cm'); +var Integration = require('../integrations'); +var Trigger = require('../../models').Trigger; +var ReportAgent = require('../../models').ReportAgent; +var MailMessage = require('../../models').MailMessage; + +module.exports = function(ami) { + + var util = new Util(); + var voice = new Voice(); + var chat = new Chat(); + var mail = new Mail(); + var cm = new Cm(); + var integration = new Integration(ami); + + Trigger + .scope('all') + .findAll() + .then(function(triggers) { + synchTriggers(triggers); + console.log('Triggers are ', triggers.length); + ReportAgent.afterCreate(function(doc) { + var actions = util.getActionsByTriggers(doc, _.filter(triggers, { + channel: 'voice' + })); + console.log('After agent create, Actions are ', actions.length); + execActions(actions, doc, 'voice', util, voice, mail, cm, integration); + }) + ReportAgent.afterUpdate(function(doc) { + var actions = util.getActionsByTriggers(doc, _.filter(triggers, { + channel: 'voice' + })); + console.log('After agent update, Actions are ', actions.length); + execActions(actions, doc, 'voice', util, voice, mail, cm, integration); + }) + MailMessage.afterCreate(function(doc) { + if (doc.status === 'RECEIVED') { + var actions = util.getActionsByTriggers(doc, _.filter(triggers, { + channel: 'mail' + })); + execActions(actions, doc, 'mail', util, voice, mail, cm, integration); + } + }) + }) + .catch(function(err) { + console.error(err); + }); +} + + +function execActions(actions, doc, channel, util, voice, mail, cm, integration) { + actions.forEach(function(action) { + console.log('Executing action "' + action.action + '"'); + switch (action.action) { + case 'contactManager': + cm.manageContact(doc.dataValues, channel); + break; + case 'template': + mail.sendTemplate(action); + break; + case 'integration': + integration.manageEvent(action, doc, channel); + break; + default: + } + }); +} + +function synchTriggers(triggers) { + Trigger.afterCreate(function(doc) { + updateCollection(triggers, doc); + console.log('After create, Triggers are ', triggers.length); + }); + Trigger.afterUpdate(function(doc) { + updateCollection(triggers, doc); + console.log('After update, Triggers are ', triggers.length); + }); + Trigger.afterDestroy(function(doc) { + _.remove(triggers, { + id: doc.id + }); + console.log('After destroy, Triggers are ', triggers.length); + }); +} + +function updateCollection(collection, doc) { + var oldItem = _.find(collection, { + id: doc.id + }); + var index = collection.indexOf(oldItem); + if (oldItem) { + _.merge(collection[index], doc); + } else { + collection.unshift(doc); + } +} diff --git a/server/config/triggers/mail.js b/server/config/triggers/mail.js index 518003b..21afef4 100644 --- a/server/config/triggers/mail.js +++ b/server/config/triggers/mail.js @@ -1 +1,49 @@ -var _0x5182=["\x6C\x6F\x64\x61\x73\x68","\x54\x72\x69\x67\x67\x65\x72\x20\x4D\x61\x69\x6C\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x73\x65\x6E\x64\x54\x65\x6D\x70\x6C\x61\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x4D\x61\x69\x6C\x54\x65\x6D\x70\x6C\x61\x74\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x63\x61\x74\x63\x68","\x53\x45\x4E\x44\x49\x4E\x47","\x73\x75\x62\x6A\x65\x63\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x3B","\x73\x70\x6C\x69\x74","\x64\x61\x74\x61\x33","\x64\x61\x74\x61\x34","\x68\x74\x6D\x6C","\x74\x65\x78\x74","\x63\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x64\x61\x74\x61\x31","\x66\x69\x6E\x64\x42\x79\x49\x64","\x66\x69\x6E\x64\x4F\x6E\x65","\x65\x78\x70\x6F\x72\x74\x73"];var _=require(_0x5182[0]);function Mail(){console[_0x5182[2]](_0x5182[1])}Mail[_0x5182[4]][_0x5182[3]]=function(_0x8d39x3){sendTemplate(_0x8d39x3)};function sendTemplate(_0x8d39x5){var _0x8d39x6=require(_0x5182[6])[_0x5182[5]];var _0x8d39x7=require(_0x5182[6])[_0x5182[7]];var _0x8d39x8=require(_0x5182[6])[_0x5182[8]];var _0x8d39x9;return _0x8d39x8[_0x5182[23]]({where:{service:true}})[_0x5182[20]](function(_0x8d39xc){_0x8d39x9=_0x8d39xc;return _0x8d39x6[_0x5182[22]](Number(_0x8d39x5[_0x5182[21]]),{include:[{all:true}]})})[_0x5182[20]](function(_0x8d39xa){return _0x8d39x7[_0x5182[19]]({status:_0x5182[10],subject:_0x8d39xa[_0x5182[11]],from:[_0x8d39x9[_0x5182[12]]],to:_0x8d39x5[_0x5182[15]][_0x5182[14]](_0x5182[13]),cc:_0x8d39x5[_0x5182[16]]?_0x8d39x5[_0x5182[16]][_0x5182[14]](_0x5182[13]):[],html:_0x8d39xa[_0x5182[17]]||null,text:_0x8d39xa[_0x5182[18]]||null})[_0x5182[9]](function(_0x8d39xb){console[_0x5182[2]](_0x8d39xb)})})}module[_0x5182[24]]=Mail \ No newline at end of file +var _ = require('lodash'); + +function Mail() { + console.log('Trigger Mail Initialization...'); +} + +Mail.prototype.sendTemplate = function(templateId) { + sendTemplate(templateId); +} + +function sendTemplate(action) { + var MailTemplate = require('../../models').MailTemplate; + var MailMessage = require('../../models').MailMessage; + var MailServerOut = require('../../models').MailServerOut; + var _smtp; + return MailServerOut + .findOne({ + where: { + service: true + } + }) + .then(function(smtp) { + _smtp = smtp; + return MailTemplate + .findById(Number(action.data1), { + include: [{ + all: true + }] + }); + }) + .then(function(mailTemplate) { + // console.log('found template'); + return MailMessage + .create({ + status: 'SENDING', + subject: mailTemplate.subject, + from: [_smtp.username], + to: action.data3.split(';'), + cc: action.data4 ? action.data4.split(';') : [], + html: mailTemplate.html || null, + text: mailTemplate.text || null + }) + .catch(function(err) { + console.log(err); + }); + }); +} + +module.exports = Mail; diff --git a/server/config/triggers/util.js b/server/config/triggers/util.js index d3fea13..1ad1569 100644 --- a/server/config/triggers/util.js +++ b/server/config/triggers/util.js @@ -1 +1,80 @@ -var _0xe0d8=["\x6C\x6F\x64\x61\x73\x68","\x54\x72\x69\x67\x67\x65\x72\x20\x55\x74\x69\x6C\x73\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x67\x65\x74\x41\x63\x74\x69\x6F\x6E\x73\x42\x79\x54\x72\x69\x67\x67\x65\x72\x73","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x66\x72\x6F\x6D","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x3B","\x73\x70\x6C\x69\x74","\x63\x63","\x74\x6F","\x73\x74\x61\x74\x75\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x41\x6C\x6C","\x41\x6E\x79","\x6C\x65\x6E\x67\x74\x68","\x72\x65\x64\x75\x63\x65","\x63\x6F\x6E\x63\x61\x74","\x6A\x6F\x69\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x67\x72\x65\x61\x74\x65\x72","\x6C\x65\x73\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x65\x78\x70\x6F\x72\x74\x73"];var _=require(_0xe0d8[0]);function Util(){console[_0xe0d8[2]](_0xe0d8[1])}Util[_0xe0d8[4]][_0xe0d8[3]]=function(_0x35b3x3,_0x35b3x4){var _0x35b3x5=[];_0x35b3x3[_0xe0d8[6]][_0xe0d8[5]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[5]]?_0x35b3x3[_0xe0d8[6]][_0xe0d8[5]][_0xe0d8[8]](_0xe0d8[7]):[];_0x35b3x3[_0xe0d8[6]][_0xe0d8[9]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[9]]?_0x35b3x3[_0xe0d8[6]][_0xe0d8[9]][_0xe0d8[8]](_0xe0d8[7]):[];_0x35b3x3[_0xe0d8[6]][_0xe0d8[10]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[10]]?_0x35b3x3[_0xe0d8[6]][_0xe0d8[10]][_0xe0d8[8]](_0xe0d8[7]):[];_0x35b3x4[_0xe0d8[13]](function(_0x35b3x6){if(_0x35b3x6[_0xe0d8[11]]){var _0x35b3x7=[];var _0x35b3x8=[];_0x35b3x6[_0xe0d8[14]][_0xe0d8[13]](function(_0x35b3x9){_0x35b3x7[_0xe0d8[12]](checkCondition(_0x35b3x9[_0xe0d8[6]],_0x35b3x3[_0xe0d8[6]]))});_0x35b3x6[_0xe0d8[15]][_0xe0d8[13]](function(_0x35b3x9){_0x35b3x8[_0xe0d8[12]](checkCondition(_0x35b3x9[_0xe0d8[6]],_0x35b3x3[_0xe0d8[6]]))});var _0x35b3xa=[],_0x35b3xb=[];_0x35b3xa[_0xe0d8[12]](_[_0xe0d8[17]](_0x35b3x7[_0xe0d8[16]]?_0x35b3x7:[true],function(_0x35b3xc,_0x35b3xd){return _0x35b3xc&&_0x35b3xd}));_0x35b3xb[_0xe0d8[12]](_[_0xe0d8[17]](_0x35b3x8[_0xe0d8[16]]?_0x35b3x8:[true],function(_0x35b3xc,_0x35b3xd){return _0x35b3xc||_0x35b3xd}));var _0x35b3xe=_0x35b3xa[_0xe0d8[18]](_0x35b3xb);var _0x35b3xf=_[_0xe0d8[17]](_0x35b3xe[_0xe0d8[16]]?_0x35b3xe:[true],function(_0x35b3xc,_0x35b3xd){return _0x35b3xc&&_0x35b3xd});if(_0x35b3xf){_0x35b3x5=_0x35b3x5[_0xe0d8[18]](_0x35b3x6.Actions)}}});_0x35b3x3[_0xe0d8[6]][_0xe0d8[5]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[5]][_0xe0d8[19]](_0xe0d8[7]);_0x35b3x3[_0xe0d8[6]][_0xe0d8[9]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[9]][_0xe0d8[19]](_0xe0d8[7]);_0x35b3x3[_0xe0d8[6]][_0xe0d8[10]]=_0x35b3x3[_0xe0d8[6]][_0xe0d8[10]][_0xe0d8[19]](_0xe0d8[7]);return _0x35b3x5};function checkCondition(_0x35b3x9,_0x35b3x3){var _0x35b3x11;switch(_0x35b3x9[_0xe0d8[28]]){case _0xe0d8[22]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]===_0x35b3x9[_0xe0d8[21]]);break;case _0xe0d8[23]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]!==_0x35b3x9[_0xe0d8[21]]);break;case _0xe0d8[24]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]>=Number(_0x35b3x9[_0xe0d8[21]]));break;case _0xe0d8[25]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]<=Number(_0x35b3x9[_0xe0d8[21]]));break;case _0xe0d8[26]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]>Number(_0x35b3x9[_0xe0d8[21]]));break;case _0xe0d8[27]:_0x35b3x11=(_0x35b3x3[_0x35b3x9[_0xe0d8[20]]]= Number(condition.value)); + break; + case 'less_or_equal': + result = (doc[condition.field] <= Number(condition.value)); + break; + case 'greater': + result = (doc[condition.field] > Number(condition.value)); + break; + case 'less': + result = (doc[condition.field] < Number(condition.value)); + break; + default: + } + return result; +} + +module.exports = Util; diff --git a/server/config/triggers/voice.js b/server/config/triggers/voice.js index 1238936..2465c50 100644 --- a/server/config/triggers/voice.js +++ b/server/config/triggers/voice.js @@ -1 +1,7 @@ -var _0x249e=["\x6C\x6F\x64\x61\x73\x68","\x54\x72\x69\x67\x67\x65\x72\x20\x56\x6F\x69\x63\x65\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x78\x70\x6F\x72\x74\x73"];var _=require(_0x249e[0]);function Voice(){console[_0x249e[2]](_0x249e[1])}module[_0x249e[3]]=Voice \ No newline at end of file +var _ = require('lodash'); + +function Voice() { + console.log('Trigger Voice Initialization...'); +} + +module.exports = Voice; diff --git a/server/config/util/error.js b/server/config/util/error.js index 21dcdcf..e265f76 100644 --- a/server/config/util/error.js +++ b/server/config/util/error.js @@ -1 +1,24 @@ -var _0xa031=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x70\x61\x74\x68","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x65\x72\x72\x6F\x72\x73","\x20\x6D\x75\x73\x74\x20\x62\x65\x20\x75\x6E\x69\x71\x75\x65","\x6D\x65\x73\x73\x61\x67\x65","\x6A\x6F\x69\x6E","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x49\x6D\x70\x6F\x73\x73\x69\x62\x6C\x65\x20\x74\x6F\x20\x72\x65\x6D\x6F\x76\x65\x20\x25\x73\x20\x25\x73\x20\x62\x65\x63\x61\x75\x73\x65\x20\x6F\x66\x20\x61\x6E\x20\x65\x78\x69\x73\x74\x69\x6E\x67\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x69\x6F\x6E","\x66\x6F\x72\x6D\x61\x74"];_0xa031[0];var util=require(_0xa031[1]);module[_0xa031[2]]={handleUniqueConstraintError:function(_0x734bx2,_0x734bx3){var _0x734bx4=[];_0x734bx3[_0xa031[6]][_0xa031[5]](function(_0x734bx5){switch(_0x734bx5[_0xa031[3]]){default:_0x734bx4[_0xa031[4]](_0x734bx5[_0xa031[3]])}});_0x734bx4[_0xa031[4]](_0xa031[7]);_0x734bx3[_0xa031[8]]=_0x734bx4[_0xa031[9]]();return _0x734bx2[_0xa031[11]](500)[_0xa031[10]](_0x734bx3)},handleForeignKeyConstraintError:function(_0x734bx2,_0x734bx6,_0x734bx7,_0x734bx3){_0x734bx3[_0xa031[8]]=util[_0xa031[13]](_0xa031[12],_0x734bx6,_0x734bx7);return _0x734bx2[_0xa031[11]](500)[_0xa031[10]](_0x734bx3)}} \ No newline at end of file +'use strict'; + +var util = require('util'); + +module.exports = { + handleUniqueConstraintError: function(res, err) { + var paths = []; + + err.errors.forEach(function(error) { + switch (error.path) { + default: paths.push(error.path); + } + }); + + paths.push(' must be unique'); + err.message = paths.join(); + + return res.status(500).send(err); + }, + handleForeignKeyConstraintError: function(res, app, name, err) { + err.message = util.format('Impossible to remove %s %s because of an existing association', app, name); + return res.status(500).send(err); + } +}; diff --git a/server/config/util/index.js b/server/config/util/index.js index 53542fc..fe69138 100644 --- a/server/config/util/index.js +++ b/server/config/util/index.js @@ -1 +1,151 @@ -var _0x663e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x73\x75\x6E","\x6D\x6F\x6E","\x74\x75\x65","\x77\x65\x64","\x74\x68\x75","\x66\x72\x69","\x73\x61\x74","\x6A\x61\x6E","\x66\x65\x62","\x6D\x61\x72","\x61\x70\x72","\x6D\x61\x79","\x6A\x75\x6E","\x6A\x75\x6C","\x61\x75\x67","\x73\x65\x70","\x6F\x63\x74","\x6E\x6F\x76","\x64\x65\x63","\x2C","\x73\x70\x6C\x69\x74","\x2A","\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x2D","\x54\x52\x41\x4E\x47\x45\x20\x4B\x4F","\x6C\x6F\x67","\x64\x61\x79","\x69\x6E\x64\x65\x78\x4F\x66","\x73\x68\x69\x66\x74","\x70\x75\x73\x68","\x73\x6C\x69\x63\x65","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x44\x57\x52\x41\x4E\x47\x45\x20\x4B\x4F","\x64\x61\x74\x65","\x44\x4D\x52\x41\x4E\x47\x45\x20\x4B\x4F","\x6D\x6F\x6E\x74\x68","\x4D\x52\x41\x4E\x47\x45\x20\x4B\x4F","\x49\x4E\x54\x45\x52\x56\x41\x4C\x20\x4F\x4B","\x69\x73\x4F\x62\x6A\x65\x63\x74","\x6C\x65\x6E\x67\x74\x68","\x53\x75\x62\x49\x6E\x74\x65\x72\x76\x61\x6C\x73","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x6F\x72\x64\x65\x72","\x74\x79\x70\x65","\x77\x68\x65\x72\x65","\x70\x61\x72\x65\x6E\x74","\x25","\x66\x6F\x72\x45\x61\x63\x68","\x73\x75\x62\x73\x74\x72","\x2F","\x65\x78\x70\x6F\x72\x74\x73","\x2E\x2F\x65\x72\x72\x6F\x72"];_0x663e[0];var _=require(_0x663e[1]);var moment=require(_0x663e[2]);var checkInterval=function(_0x9001x4){var _0x9001x5=[_0x663e[3],_0x663e[4],_0x663e[5],_0x663e[6],_0x663e[7],_0x663e[8],_0x663e[9]];var _0x9001x6=[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];var _0x9001x7=[_0x663e[10],_0x663e[11],_0x663e[12],_0x663e[13],_0x663e[14],_0x663e[15],_0x663e[16],_0x663e[17],_0x663e[18],_0x663e[19],_0x663e[20],_0x663e[21]];var _0x9001x8,_0x9001x9;var _0x9001xa=_0x9001x4[_0x663e[23]](_0x663e[22])[0];var _0x9001xb=_0x9001x4[_0x663e[23]](_0x663e[22])[1];var _0x9001xc=_0x9001x4[_0x663e[23]](_0x663e[22])[2];var _0x9001xd=_0x9001x4[_0x663e[23]](_0x663e[22])[3];if(_0x9001xa!==_0x663e[24]){var _0x9001xe=moment()[_0x663e[26]](_0x663e[25]);var _0x9001xf=_0x9001xa[_0x663e[23]](_0x663e[27])[0];var _0x9001x10=_0x9001xa[_0x663e[23]](_0x663e[27])[1];if((_0x9001xe<_0x9001xf)||(_0x9001xe>_0x9001x10)){console[_0x663e[29]](_0x663e[28]);return false}};if(_0x9001xb!==_0x663e[24]){var _0x9001x11=_0x9001x5[moment()[_0x663e[30]]()];var _0x9001x12=_[_0x663e[31]](_0x9001x5,_0x9001xb[_0x663e[23]](_0x663e[27])[0]);var _0x9001x13=_[_0x663e[31]](_0x9001x5,_0x9001xb[_0x663e[23]](_0x663e[27])[1]);for(_0x9001x8=0;_0x9001x8<_0x9001x12;_0x9001x8++){_0x9001x9=_0x9001x5[_0x663e[32]]();_0x9001x5[_0x663e[33]](_0x9001x9)};_0x9001x12=_[_0x663e[31]](_0x9001x5,_0x9001xb[_0x663e[23]](_0x663e[27])[0]);_0x9001x13=_[_0x663e[31]](_0x9001x5,_0x9001xb[_0x663e[23]](_0x663e[27])[1])+1;_0x9001x5=_0x9001x5[_0x663e[34]](_0x9001x12,_0x9001x13);if(!_[_0x663e[35]](_0x9001x5,_0x9001x11)){console[_0x663e[29]](_0x663e[36]);return false}};if(_0x9001xc!==_0x663e[24]){var _0x9001x14=moment()[_0x663e[37]]();var _0x9001x15=_[_0x663e[31]](_0x9001x6,parseInt(_0x9001xc[_0x663e[23]](_0x663e[27])[0],10));var _0x9001x16=_[_0x663e[31]](_0x9001x6,parseInt(_0x9001xc[_0x663e[23]](_0x663e[27])[1]));for(_0x9001x8=0;_0x9001x8<_0x9001x15;_0x9001x8++){_0x9001x9=_0x9001x6[_0x663e[32]]();_0x9001x6[_0x663e[33]](_0x9001x9)};_0x9001x15=_[_0x663e[31]](_0x9001x6,parseInt(_0x9001xc[_0x663e[23]](_0x663e[27])[0],10));_0x9001x16=_[_0x663e[31]](_0x9001x6,parseInt(_0x9001xc[_0x663e[23]](_0x663e[27])[1]),10)+1;_0x9001x6=_0x9001x6[_0x663e[34]](_0x9001x15,_0x9001x16);if(!_[_0x663e[35]](_0x9001x6,_0x9001x14)){console[_0x663e[29]](_0x663e[38]);return false}};if(_0x9001xd!==_0x663e[24]){var _0x9001x17=_0x9001x7[moment()[_0x663e[39]]()];var _0x9001x18=_[_0x663e[31]](_0x9001x7,_0x9001xd[_0x663e[23]](_0x663e[27])[0]);var _0x9001x19=_[_0x663e[31]](_0x9001x7,_0x9001xd[_0x663e[23]](_0x663e[27])[1]);for(_0x9001x8=0;_0x9001x8<_0x9001x18;_0x9001x8++){_0x9001x9=_0x9001x7[_0x663e[32]]();_0x9001x7[_0x663e[33]](_0x9001x9)};_0x9001x18=_[_0x663e[31]](_0x9001x7,_0x9001xd[_0x663e[23]](_0x663e[27])[0]);_0x9001x19=_[_0x663e[31]](_0x9001x7,_0x9001xd[_0x663e[23]](_0x663e[27])[1])+1;_0x9001x7=_0x9001x7[_0x663e[34]](_0x9001x18,_0x9001x19);if(!_[_0x663e[35]](_0x9001x7,_0x9001x17)){console[_0x663e[29]](_0x663e[40]);return false}};console[_0x663e[29]](_0x663e[41]);return true};var isValidInterval=function(_0x9001x4){if(_[_0x663e[42]](_0x9001x4)){for(var _0x9001x8=0;_0x9001x8<_0x9001x4[_0x663e[44]][_0x663e[43]];_0x9001x8++){if(!checkInterval(_0x9001x4[_0x663e[44]][_0x9001x8][_0x663e[45]])){return false}};return true}else {return checkInterval(_0x9001x4)}};var getQuery=function(_0x9001x1c){var _0x9001x1d={where:{}};if(_0x9001x1c){_[_0x663e[53]](_0x9001x1c,function(_0x9001x1e,_0x9001x1f){switch(_0x9001x1f){case _0x663e[46]:;case _0x663e[47]:_0x9001x1d[_0x9001x1f]=Number(_0x9001x1e);break;case _0x663e[48]:_0x9001x1d[_0x9001x1f]=_0x9001x1e;break;case _0x663e[49]:;case _0x663e[51]:_0x9001x1d[_0x663e[50]][_0x9001x1f]=_0x9001x1e;break;default:_0x9001x1d[_0x663e[50]][_0x9001x1f]={$like:_0x663e[52]+_0x9001x1e+_0x663e[52]}}})};return _0x9001x1d};var stripTrailingSlash=function(_0x9001x21){if(_0x9001x21[_0x663e[54]](-1)===_0x663e[55]){return _0x9001x21[_0x663e[54]](0,_0x9001x21[_0x663e[43]]-1)};return _0x9001x21};module[_0x663e[56]]={getQuery:getQuery,stripTrailingSlash:stripTrailingSlash,isValidInterval:isValidInterval,errorManager:require(_0x663e[57])} \ No newline at end of file +'use strict'; + +var _ = require('lodash'); +var moment = require('moment'); + +var checkInterval = function(interval) { + + var daysOfWeek = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; + var daysOfMonth = [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]; + var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; + var i, shift; + + var tRange = interval.split(',')[0]; + var dwRange = interval.split(',')[1]; + var dmRange = interval.split(',')[2]; + var mRange = interval.split(',')[3]; + // TIME RANGE CHECKING + if (tRange !== '*') { + var time = moment().format("HH:mm"); + var tFrom = tRange.split('-')[0]; + var tTo = tRange.split('-')[1]; + + if ((time < tFrom) || (time > tTo)) { + console.log('TRANGE KO'); + return false; + } + } + // DAYS OF WEEK RANGE CHECKING + if (dwRange !== '*') { + var cWeekDay = daysOfWeek[moment().day()]; + var dwFrom = _.indexOf(daysOfWeek, dwRange.split('-')[0]); + var dwTo = _.indexOf(daysOfWeek, dwRange.split('-')[1]); + + for (i = 0; i < dwFrom; i++) { + shift = daysOfWeek.shift(); + daysOfWeek.push(shift); + } + + dwFrom = _.indexOf(daysOfWeek, dwRange.split('-')[0]); + dwTo = _.indexOf(daysOfWeek, dwRange.split('-')[1]) + 1; + + daysOfWeek = daysOfWeek.slice(dwFrom, dwTo); + + if (!_.includes(daysOfWeek, cWeekDay)) { + console.log('DWRANGE KO'); + return false; + } + } + // DAYS OF MONTH RANGE CHECKING + if (dmRange !== '*') { + var cMonthDay = moment().date(); + var dmFrom = _.indexOf(daysOfMonth, parseInt(dmRange.split('-')[0], 10)); + var dmTo = _.indexOf(daysOfMonth, parseInt(dmRange.split('-')[1])); + + for (i = 0; i < dmFrom; i++) { + shift = daysOfMonth.shift(); + daysOfMonth.push(shift); + } + + dmFrom = _.indexOf(daysOfMonth, parseInt(dmRange.split('-')[0], 10)); + dmTo = _.indexOf(daysOfMonth, parseInt(dmRange.split('-')[1]), 10) + 1; + + daysOfMonth = daysOfMonth.slice(dmFrom, dmTo); + + if (!_.includes(daysOfMonth, cMonthDay)) { + console.log('DMRANGE KO'); + return false; + } + } + // MONTHS RANGE CHECKING + if (mRange !== '*') { + var cMonth = months[moment().month()]; + var mFrom = _.indexOf(months, mRange.split('-')[0]); + var mTo = _.indexOf(months, mRange.split('-')[1]); + + for (i = 0; i < mFrom; i++) { + shift = months.shift(); + months.push(shift); + } + + mFrom = _.indexOf(months, mRange.split('-')[0]); + mTo = _.indexOf(months, mRange.split('-')[1]) + 1; + + months = months.slice(mFrom, mTo); + + if (!_.includes(months, cMonth)) { + console.log('MRANGE KO'); + return false; + } + } + + console.log('INTERVAL OK'); + + return true; +} + +var isValidInterval = function(interval) { + if (_.isObject(interval)) { + for (var i = 0; i < interval.SubIntervals.length; i++) { + if (!checkInterval(interval.SubIntervals[i].interval)) { + return false; + } + } + return true; + } else { + return checkInterval(interval); + } +} + +var getQuery = function(query) { + var _query = { + where: {} + }; + if (query) { + _.forEach(query, function(value, key) { + switch (key) { + case 'offset': + case 'limit': + _query[key] = Number(value); + break; + case 'order': + _query[key] = value; + break; + case 'type': + case 'parent': + _query.where[key] = value; + break; + default: + _query.where[key] = { + $like: '%' + value + '%' + }; + } + }); + } + + return _query; +} + +var stripTrailingSlash = function(str) { + if (str.substr(-1) === '/') { + return str.substr(0, str.length - 1); + } + return str; +} + +module.exports = { + getQuery: getQuery, + stripTrailingSlash: stripTrailingSlash, + isValidInterval: isValidInterval, + errorManager: require('./error') +}; diff --git a/server/migrations/20160315183016-motion.js b/server/migrations/20160315183016-motion.js index eef35c4..4410805 100644 --- a/server/migrations/20160315183016-motion.js +++ b/server/migrations/20160315183016-motion.js @@ -1 +1,33 @@ -var _0x5575=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x75\x73\x65\x72\x73","\x74\x65\x73\x74\x41\x74\x74\x72","\x53\x54\x52\x49\x4E\x47","\x61\x64\x64\x43\x6F\x6C\x75\x6D\x6E","\x72\x65\x6D\x6F\x76\x65\x43\x6F\x6C\x75\x6D\x6E"];_0x5575[0];module[_0x5575[1]]={up:function(_0xe993x1,_0xe993x2){return _0xe993x1[_0x5575[5]](_0x5575[2],_0x5575[3],{type:_0xe993x2[_0x5575[4]]})},down:function(_0xe993x1,_0xe993x2){return _0xe993x1[_0x5575[6]](_0x5575[2],_0x5575[3])}} \ No newline at end of file +'use strict'; + +module.exports = { + up: function(queryInterface, Sequelize) { + /* + Add altering commands here. + Return a promise to correctly handle asynchronicity. + + Example: + return queryInterface.createTable('users', { id: Sequelize.INTEGER }); + */ + return queryInterface + .addColumn( + 'users', + 'testAttr', { + type: Sequelize.STRING + } + ); + }, + + down: function(queryInterface, Sequelize) { + /* + Add reverting commands here. + Return a promise to correctly handle asynchronicity. + + Example: + return queryInterface.dropTable('users'); + */ + + return queryInterface + .removeColumn('users', 'testAttr'); + } +}; diff --git a/server/models/action.js b/server/models/action.js index 04e4886..3e22553 100644 --- a/server/models/action.js +++ b/server/models/action.js @@ -1 +1,32 @@ -var _0xb0c1=["\x65\x78\x70\x6F\x72\x74\x73","\x41\x63\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x61\x63\x74\x69\x6F\x6E\x73","\x64\x65\x66\x69\x6E\x65"];module[_0xb0c1[0]]=function(_0x2310x1,_0x2310x2){var _0x2310x3=_0x2310x1[_0xb0c1[4]](_0xb0c1[1],{name:{type:_0x2310x2[_0xb0c1[2]]},data1:{type:_0x2310x2[_0xb0c1[2]]},data2:{type:_0x2310x2[_0xb0c1[2]]},data3:{type:_0x2310x2[_0xb0c1[2]]},data4:{type:_0x2310x2[_0xb0c1[2]]},data5:{type:_0x2310x2[_0xb0c1[2]]}},{tableName:_0xb0c1[3],associate:function(_0x2310x4){}});return _0x2310x3} \ No newline at end of file +/** + * Action Model + */ + +module.exports = function (sequelize, DataTypes) { + + var Action = sequelize.define('Action', { + name: { + type: DataTypes.STRING + }, + data1: { + type: DataTypes.STRING + }, + data2: { + type: DataTypes.STRING + }, + data3: { + type: DataTypes.STRING + }, + data4: { + type: DataTypes.STRING + }, + data5: { + type: DataTypes.STRING + } + }, { + tableName: 'actions', + associate: function (models) {} + }); + + return Action; +}; diff --git a/server/models/asterisk_manager.js b/server/models/asterisk_manager.js index 2b405bc..8cc071d 100644 --- a/server/models/asterisk_manager.js +++ b/server/models/asterisk_manager.js @@ -1 +1,19 @@ -var _0x56cb=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x41\x73\x74\x65\x72\x69\x73\x6B\x4D\x61\x6E\x61\x67\x65\x72","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x61\x73\x74\x65\x72\x69\x73\x6B\x5F\x6D\x61\x6E\x61\x67\x65\x72","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x56cb[0]);module[_0x56cb[1]]=function(_0x3a22x2,_0x3a22x3){var _0x3a22x4=_0x3a22x2[_0x56cb[6]](_0x56cb[2],{address:_0x3a22x3[_0x56cb[3]],port:_0x3a22x3[_0x56cb[4]],username:_0x3a22x3[_0x56cb[3]],password:_0x3a22x3[_0x56cb[3]]},{tableName:_0x56cb[5]});return _0x3a22x4} \ No newline at end of file +/** + * Asterisk Manager Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var AsteriskManager = sequelize.define('AsteriskManager', { + address: DataTypes.STRING, + port: DataTypes.INTEGER, + username: DataTypes.STRING, + password: DataTypes.STRING + }, { + tableName: 'asterisk_manager' + }); + + return AsteriskManager; +}; diff --git a/server/models/asterisk_manager_interface.js b/server/models/asterisk_manager_interface.js index 024b12c..539add1 100644 --- a/server/models/asterisk_manager_interface.js +++ b/server/models/asterisk_manager_interface.js @@ -1 +1,24 @@ -var _0x4e93=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x41\x6D\x69","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x61\x73\x74\x65\x72\x69\x73\x6B\x5F\x6D\x61\x6E\x61\x67\x65\x72\x5F\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x4e93[0];module[_0x4e93[1]]=function(_0x646fx1,_0x646fx2){var _0x646fx3=_0x646fx1[_0x4e93[7]](_0x4e93[2],{actionid:_0x646fx2[_0x4e93[3]],action:_0x646fx2[_0x4e93[3]],response:_0x646fx2[_0x4e93[3]],message:_0x646fx2[_0x4e93[3]],data:_0x646fx2[_0x4e93[4]]},{tableName:_0x4e93[5],associate:function(_0x646fx4){_0x646fx3[_0x4e93[6]](_0x646fx4.User)}});return _0x646fx3} \ No newline at end of file +'use strict'; + +/** + * Asterisk Manager Interface Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Ami = sequelize.define('Ami', { + actionid: DataTypes.STRING, + action: DataTypes.STRING, + response: DataTypes.STRING, + message: DataTypes.STRING, + data: DataTypes.TEXT + }, { + tableName: 'asterisk_manager_interface', + associate: function(models) { + // USER RELATIONS + Ami.belongsTo(models.User); + } + }); + + return Ami; +}; diff --git a/server/models/autodialer_contact.js b/server/models/autodialer_contact.js index bf14a25..0719b90 100644 --- a/server/models/autodialer_contact.js +++ b/server/models/autodialer_contact.js @@ -1 +1,15 @@ -var _0x413e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x41\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x43\x6F\x6E\x74\x61\x63\x74","\x53\x54\x52\x49\x4E\x47","\x61\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73","\x64\x65\x66\x69\x6E\x65"];_0x413e[0];module[_0x413e[1]]=function(_0xe496x1,_0xe496x2){var _0xe496x3=_0xe496x1[_0x413e[5]](_0x413e[2],{status:{type:_0xe496x2[_0x413e[3]]}},{tableName:_0x413e[4]});return _0xe496x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var AutodialerContact = sequelize.define('AutodialerContact', { + status: { + type: DataTypes.STRING + } + }, { + tableName: 'autodialer_contacts' + }); + + return AutodialerContact; + +}; diff --git a/server/models/autodialer_process.js b/server/models/autodialer_process.js index f914548..7ddc225 100644 --- a/server/models/autodialer_process.js +++ b/server/models/autodialer_process.js @@ -1 +1,53 @@ -var _0xe21c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x41\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x50\x72\x6F\x63\x65\x73\x73","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x61\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x5F\x70\x72\x6F\x63\x65\x73\x73\x65\x73","\x41\x75\x74\x6F\x64\x69\x61\x6C\x65\x72\x43\x6F\x6E\x74\x61\x63\x74","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];_0xe21c[0];module[_0xe21c[1]]=function(_0x3a7cx1,_0x3a7cx2){var _0x3a7cx3=_0x3a7cx1[_0xe21c[9]](_0xe21c[2],{name:{type:_0x3a7cx2[_0xe21c[3]],unique:true},description:{type:_0x3a7cx2[_0xe21c[3]]},context:{type:_0x3a7cx2[_0xe21c[3]]},extension:{type:_0x3a7cx2[_0xe21c[3]]},priority:{type:_0x3a7cx2[_0xe21c[4]]},callerid:{type:_0x3a7cx2[_0xe21c[3]]},waittime:{type:_0x3a7cx2[_0xe21c[4]]},maxretry:{type:_0x3a7cx2[_0xe21c[4]]},retrytime:{type:_0x3a7cx2[_0xe21c[4]]},prefix:{type:_0x3a7cx2[_0xe21c[3]]},maxcall:{type:_0x3a7cx2[_0xe21c[4]]},enable:{type:_0x3a7cx2[_0xe21c[5]],defaultValue:true}},{tableName:_0xe21c[6],associate:function(_0x3a7cx4){_0x3a7cx3[_0xe21c[8]](_0x3a7cx4.Contact,{through:_0x3a7cx4[_0xe21c[7]]})}});return _0x3a7cx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var AutodialerProcess = sequelize.define('AutodialerProcess', { + name: { + type: DataTypes.STRING, + unique: true + }, + description: { + type: DataTypes.STRING, + }, + context: { + type: DataTypes.STRING, + }, + extension: { + type: DataTypes.STRING, + }, + priority: { + type: DataTypes.INTEGER, + }, + callerid: { + type: DataTypes.STRING, + }, + waittime: { + type: DataTypes.INTEGER, + }, + maxretry: { + type: DataTypes.INTEGER, + }, + retrytime: { + type: DataTypes.INTEGER, + }, + prefix: { + type: DataTypes.STRING, + }, + maxcall: { + type: DataTypes.INTEGER, + }, + enable: { + type: DataTypes.BOOLEAN, + defaultValue: true + } + }, { + tableName: 'autodialer_processes', + associate: function(models) { + AutodialerProcess.belongsToMany(models.Contact, { through: models.AutodialerContact }) + } + }); + + return AutodialerProcess; + +}; diff --git a/server/models/automation.js b/server/models/automation.js index 24f6b12..7ee4308 100644 --- a/server/models/automation.js +++ b/server/models/automation.js @@ -1 +1,64 @@ -var _0x83cb=["\x65\x78\x70\x6F\x72\x74\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x49\x4E\x54\x45\x47\x45\x52","\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73","\x41\x6C\x6C","\x4F\x6E\x65\x41\x6C\x6C","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x41\x6C\x6C\x49\x64","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x41\x6E\x79","\x4F\x6E\x65\x41\x6E\x79","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x41\x6E\x79\x49\x64","\x41\x63\x74\x69\x6F\x6E\x73","\x61\x6C\x6C","\x54\x6F\x6F\x6C\x73\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x76\x61\x6C\x75\x65","\x54\x6F\x6F\x6C\x73\x41\x63\x74\x69\x6F\x6E","\x61\x63\x74\x69\x6F\x6E","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x64\x61\x74\x61\x34","\x64\x61\x74\x61\x35","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0x83cb[0]]=function(_0x7a33x1,_0x7a33x2){var _0x7a33x3=_0x7a33x1[_0x83cb[28]](_0x83cb[1],{name:_0x7a33x2[_0x83cb[2]],channel:_0x7a33x2[_0x83cb[2]],description:_0x7a33x2[_0x83cb[2]],status:{type:_0x7a33x2[_0x83cb[3]],defaultValue:false},timeout:{type:_0x7a33x2[_0x83cb[4]],defaultValue:10}},{tableName:_0x83cb[5],associate:function(_0x7a33x4){_0x7a33x3[_0x83cb[10]](_0x7a33x4.ToolsCondition,{as:{plural:_0x83cb[6],singular:_0x83cb[7]},foreignKey:_0x83cb[8],onDelete:_0x83cb[9],hooks:true});_0x7a33x3[_0x83cb[10]](_0x7a33x4.ToolsCondition,{as:{plural:_0x83cb[11],singular:_0x83cb[12]},foreignKey:_0x83cb[13],onDelete:_0x83cb[9],hooks:true});_0x7a33x3[_0x83cb[10]](_0x7a33x4.ToolsAction,{as:_0x83cb[14],onDelete:_0x83cb[9],hooks:true});_0x7a33x3[_0x83cb[27]](_0x83cb[15],{include:[{model:_0x7a33x4[_0x83cb[16]],as:_0x83cb[6],attributes:[_0x83cb[17],_0x83cb[18],_0x83cb[19]]},{model:_0x7a33x4[_0x83cb[16]],as:_0x83cb[11],attributes:[_0x83cb[17],_0x83cb[18],_0x83cb[19]]},{model:_0x7a33x4[_0x83cb[20]],as:_0x83cb[14],attributes:[_0x83cb[21],_0x83cb[22],_0x83cb[23],_0x83cb[24],_0x83cb[25],_0x83cb[26]]}]})}});return _0x7a33x3} \ No newline at end of file +/** + * Automation Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Automation = sequelize.define('Automation', { + name: DataTypes.STRING, + channel: DataTypes.STRING, + description: DataTypes.STRING, + status: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + timeout: { + type: DataTypes.INTEGER, + defaultValue: 10 + } + }, { + tableName: 'automations', + associate: function(models) { + Automation.hasMany(models.ToolsCondition, { + as: { + plural: 'All', + singular: 'OneAll' + }, + foreignKey: 'AutomationAllId', + onDelete: 'cascade', + hooks: true + }); + Automation.hasMany(models.ToolsCondition, { + as: { + plural: 'Any', + singular: 'OneAny' + }, + foreignKey: 'AutomationAnyId', + onDelete: 'cascade', + hooks: true + }); + Automation.hasMany(models.ToolsAction, { + as: 'Actions', + onDelete: 'cascade', + hooks: true + }); + Automation.addScope('all', { + include: [{ + model: models.ToolsCondition, + as: 'All', + attributes: ['field', 'operator', 'value'] + }, { + model: models.ToolsCondition, + as: 'Any', + attributes: ['field', 'operator', 'value'] + }, { + model: models.ToolsAction, + as: 'Actions', + attributes: ['action', 'data1', 'data2', 'data3', 'data4', 'data5'] + }] + }); + } + }); + + return Automation; +}; diff --git a/server/models/canned_answer.js b/server/models/canned_answer.js index 7c7ba1e..e4dd86f 100644 --- a/server/models/canned_answer.js +++ b/server/models/canned_answer.js @@ -1 +1,11 @@ -var _0xda8b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x61\x6E\x6E\x65\x64\x41\x6E\x73\x77\x65\x72","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72\x73","\x64\x65\x66\x69\x6E\x65"];_0xda8b[0];module[_0xda8b[1]]=function(_0x789dx1,_0x789dx2){return _0x789dx1[_0xda8b[6]](_0xda8b[2],{key:_0x789dx2[_0xda8b[3]],value:_0x789dx2[_0xda8b[4]],description:_0x789dx2[_0xda8b[3]]},{tableName:_0xda8b[5]})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('CannedAnswer', { + key: DataTypes.STRING, + value: DataTypes.TEXT, + description: DataTypes.STRING + }, { + tableName: 'canned_answers' + }); +}; diff --git a/server/models/channel.js b/server/models/channel.js index dc21aaa..e1c6d79 100644 --- a/server/models/channel.js +++ b/server/models/channel.js @@ -1 +1,46 @@ -var _0x5f01=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x6E\x6E\x65\x6C","\x53\x54\x52\x49\x4E\x47","\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x75\x73\x65\x64","\x64\x6F\x6E\x65","\x66\x69\x6E\x64","\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0x5f01[0]]=function(_0x6607x1,_0x6607x2){var _0x6607x3=_0x6607x1[_0x5f01[9]](_0x5f01[1],{name:{type:_0x6607x2[_0x5f01[2]],validate:{isUnique:function(_0x6607x4,_0x6607x5){_0x6607x3[_0x5f01[5]]({where:{name:_0x6607x4}})[_0x5f01[4]](function(_0x6607x6,_0x6607x7){if(_0x6607x6){_0x6607x5(_0x6607x6)};if(_0x6607x7){_0x6607x5({message:_0x5f01[3]})};_0x6607x5()})}}},title:_0x6607x2[_0x5f01[2]],link:_0x6607x2[_0x5f01[2]],icon:_0x6607x2[_0x5f01[2]],position:_0x6607x2[_0x5f01[2]]},{tableName:_0x5f01[6],associate:function(_0x6607x8){_0x6607x3[_0x5f01[8]](_0x6607x8.User,{through:_0x5f01[7]})}});return _0x6607x3} \ No newline at end of file +/** + * Channel Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Channel = sequelize.define('Channel', { + name: { + type: DataTypes.STRING, + validate: { + isUnique: function(name, next) { + Channel + .find({ + where: { + name: name + } + }) + .done(function(error, channel) { + if (error) + next(error); + + if (channel) + next({ + message: 'name already used' + }); + + next(); + }); + } + } + }, + title: DataTypes.STRING, + link: DataTypes.STRING, + icon: DataTypes.STRING, + position: DataTypes.STRING + }, { + tableName: 'channels', + associate: function(models) { + Channel.belongsToMany(models.User, { + through: 'user_has_channels' + }); + } + }); + + return Channel; +}; diff --git a/server/models/chanspy.js b/server/models/chanspy.js index e5f1084..39b47de 100644 --- a/server/models/chanspy.js +++ b/server/models/chanspy.js @@ -1 +1,35 @@ -var _0xb1eb=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x6E\x53\x70\x79","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x63\x68\x61\x6E\x73\x70\x79","\x53\x70\x69\x65\x64\x41\x67\x65\x6E\x74\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];_0xb1eb[0];module[_0xb1eb[1]]=function(_0x222fx1,_0x222fx2){var _0x222fx3=_0x222fx1[_0xb1eb[9]](_0xb1eb[2],{name:_0x222fx2[_0xb1eb[3]],prefix:{type:_0x222fx2[_0xb1eb[3]],unique:true,allowNull:false,validate:{notEmpty:true}},options:_0x222fx2[_0xb1eb[3]],auth:{type:_0x222fx2[_0xb1eb[4]],defaultValue:false},password:_0x222fx2[_0xb1eb[3]],description:_0x222fx2[_0xb1eb[3]]},{tableName:_0xb1eb[5],associate:function(_0x222fx4){_0x222fx3[_0xb1eb[8]](_0x222fx4.VoiceExtension,{as:_0xb1eb[6],onDelete:_0xb1eb[7],hooks:true})}});return _0x222fx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ChanSpy = sequelize.define('ChanSpy', { + name: DataTypes.STRING, + prefix: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + }, + }, + options: DataTypes.STRING, + auth: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + password: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'chanspy', + associate: function(models) { + ChanSpy.hasMany(models.VoiceExtension, { + as: 'SpiedAgents', + onDelete: 'cascade', + hooks: true + }); + } + }); + + return ChanSpy; + +}; diff --git a/server/models/chat_application.js b/server/models/chat_application.js index ccfa29e..e0789ff 100644 --- a/server/models/chat_application.js +++ b/server/models/chat_application.js @@ -1 +1,30 @@ -var _0x15ac=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65","\x61\x67\x65\x6E\x74","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x15ac[0];module[_0x15ac[1]]=function(_0x1f72x1,_0x1f72x2){var _0x1f72x3=_0x1f72x1[_0x15ac[9]](_0x15ac[2],{app:{type:_0x1f72x2.ENUM(_0x15ac[3],_0x15ac[4])},priority:{type:_0x1f72x2[_0x15ac[5]]},timeout:{type:_0x1f72x2[_0x15ac[5]]},interval:{type:_0x1f72x2[_0x15ac[6]]}},{tableName:_0x15ac[7],associate:function(_0x1f72x4){_0x1f72x3[_0x15ac[8]](_0x1f72x4.ChatWebsite);_0x1f72x3[_0x15ac[8]](_0x1f72x4.Interval);_0x1f72x3[_0x15ac[8]](_0x1f72x4.ChatQueue);_0x1f72x3[_0x15ac[8]](_0x1f72x4.User)}});return _0x1f72x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ChatApplication = sequelize.define('ChatApplication', { + app: { + type: DataTypes.ENUM('queue', 'agent') + }, + priority: { + type: DataTypes.INTEGER + }, + timeout: { + type: DataTypes.INTEGER + }, + interval: { + type: DataTypes.STRING + } + }, { + tableName: 'chat_applications', + associate: function(models) { + // hasMany relations + ChatApplication.belongsTo(models.ChatWebsite); + ChatApplication.belongsTo(models.Interval); + ChatApplication.belongsTo(models.ChatQueue); + ChatApplication.belongsTo(models.User); + } + }); + + return ChatApplication; +}; diff --git a/server/models/chat_enquiry.js b/server/models/chat_enquiry.js index 2fb56b5..74dcc2c 100644 --- a/server/models/chat_enquiry.js +++ b/server/models/chat_enquiry.js @@ -1 +1,22 @@ -var _0x6117=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x45\x6E\x71\x75\x69\x72\x79","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x42\x4F\x4F\x4C\x45\x41\x4E","\x63\x68\x61\x74\x5F\x65\x6E\x71\x75\x69\x72\x69\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x6117[0];module[_0x6117[1]]=function(_0x2c6cx1,_0x2c6cx2){var _0x2c6cx3=_0x2c6cx1[_0x6117[8]](_0x6117[2],{username:_0x2c6cx2[_0x6117[3]],email:_0x2c6cx2[_0x6117[3]],text:_0x2c6cx2[_0x6117[4]],read:{type:_0x2c6cx2[_0x6117[5]],defaultValue:false}},{tableName:_0x6117[6],associate:function(_0x2c6cx4){_0x2c6cx3[_0x6117[7]](_0x2c6cx4.ChatWebsite);_0x2c6cx3[_0x6117[7]](_0x2c6cx4.ChatVisitor)}});return _0x2c6cx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ChatEnquiry = sequelize.define('ChatEnquiry', { + username: DataTypes.STRING, + email: DataTypes.STRING, + text: DataTypes.TEXT, + read: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'chat_enquiries', + associate: function(models) { + ChatEnquiry.belongsTo(models.ChatWebsite); + ChatEnquiry.belongsTo(models.ChatVisitor); + } + }); + + return ChatEnquiry; +}; diff --git a/server/models/chat_message.js b/server/models/chat_message.js index ddec5bd..4b6dff4 100644 --- a/server/models/chat_message.js +++ b/server/models/chat_message.js @@ -1 +1,25 @@ -var _0x2417=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x54\x45\x58\x54","\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x2417[0]);module[_0x2417[1]]=function(_0x3eb0x2,_0x3eb0x3){var _0x3eb0x4=_0x3eb0x2[_0x2417[6]](_0x2417[2],{body:{type:_0x3eb0x3[_0x2417[3]],notNull:true,notEmpty:true}},{tableName:_0x2417[4],associate:function(_0x3eb0x5){_0x3eb0x4[_0x2417[5]](_0x3eb0x5.ChatRoom);_0x3eb0x4[_0x2417[5]](_0x3eb0x5.ChatVisitor);_0x3eb0x4[_0x2417[5]](_0x3eb0x5.User)}});return _0x3eb0x4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function (sequelize, DataTypes) { + + var ChatMessage = sequelize.define('ChatMessage', { + body: { + type: DataTypes.TEXT, + notNull: true, + notEmpty: true, + } + }, { + tableName: 'chat_messages', + associate: function (models) { + ChatMessage.belongsTo(models.ChatRoom); + ChatMessage.belongsTo(models.ChatVisitor); + ChatMessage.belongsTo(models.User); + } + }); + + return ChatMessage; +}; diff --git a/server/models/chat_proactive_action.js b/server/models/chat_proactive_action.js index 6951291..9ec80af 100644 --- a/server/models/chat_proactive_action.js +++ b/server/models/chat_proactive_action.js @@ -1 +1,18 @@ -var _0x4f2a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x6D\x6F\x75\x73\x65\x4F\x76\x65\x72","\x74\x69\x6D\x65\x6F\x75\x74","\x49\x4E\x54\x45\x47\x45\x52","\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x4f2a[0];module[_0x4f2a[1]]=function(_0x3dc2x1,_0x3dc2x2){return _0x3dc2x1[_0x4f2a[9]](_0x4f2a[2],{name:_0x3dc2x2[_0x4f2a[3]],type:{type:_0x3dc2x2.ENUM(_0x4f2a[4],_0x4f2a[5]),defaultValue:_0x4f2a[4]},selector:_0x3dc2x2[_0x4f2a[3]],timeout:_0x3dc2x2[_0x4f2a[6]]},{tableName:_0x4f2a[7],associate:function(_0x3dc2x3){_0x3dc2x3[_0x4f2a[2]][_0x4f2a[8]](_0x3dc2x3.ChatWebsite)}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('ChatProactiveAction', { + name: DataTypes.STRING, + type: { + type: DataTypes.ENUM('mouseOver', 'timeout'), + defaultValue: 'mouseOver' + }, + selector: DataTypes.STRING, + timeout: DataTypes.INTEGER + }, { + tableName: 'chat_proactive_actions', + associate: function(models) { + models.ChatProactiveAction.belongsTo(models.ChatWebsite); + } + }); +}; diff --git a/server/models/chat_queue.js b/server/models/chat_queue.js index 9f83013..cac04e9 100644 --- a/server/models/chat_queue.js +++ b/server/models/chat_queue.js @@ -1 +1,42 @@ -var _0xc1e6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x73","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x61\x75\x6C\x74","\x55\x73\x65\x72","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x6F\x6E\x6C\x69\x6E\x65","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x70\x61\x75\x73\x65\x54\x79\x70\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0xc1e6[0];module[_0xc1e6[1]]=function(_0x777bx1,_0x777bx2){var _0x777bx3=_0x777bx1[_0xc1e6[21]](_0xc1e6[2],{name:{type:_0x777bx2[_0xc1e6[3]],unique:true,allowNull:false,validate:{notEmpty:true}},description:{type:_0x777bx2[_0xc1e6[3]]},timeout:{type:_0x777bx2[_0xc1e6[4]]},strategy:{type:_0x777bx2.ENUM(_0xc1e6[5],_0xc1e6[6])}},{tableName:_0xc1e6[7],associate:function(_0x777bx4){_0x777bx3[_0xc1e6[9]](_0x777bx4.User,{through:_0x777bx4[_0xc1e6[8]]});_0x777bx3[_0xc1e6[20]](_0xc1e6[10],{include:[{model:_0x777bx4[_0xc1e6[11]],attributes:[_0xc1e6[12],_0xc1e6[13],_0xc1e6[14],_0xc1e6[15],_0xc1e6[16],_0xc1e6[17],_0xc1e6[18],_0xc1e6[19]]}]})}});return _0x777bx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ChatQueue = sequelize.define('ChatQueue', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + } + }, + description: { + type: DataTypes.STRING, + }, + timeout: { + type: DataTypes.INTEGER, + }, + strategy: { + type: DataTypes.ENUM('rrmemory', 'beepall') + } + }, { + tableName: 'chat_queues', + associate: function(models) { + // hasMany relations + ChatQueue.belongsToMany(models.User, { + through: models.UserHasChatQueue + }); + + //SCOPES + ChatQueue.addScope('default', { + include: [{ + model: models.User, + attributes: ['id', 'name', 'fullname', 'email', 'online', 'lastLoginAt', 'chatPause', 'pauseType'] + }] + }); + } + }); + + return ChatQueue; +}; diff --git a/server/models/chat_room.js b/server/models/chat_room.js index ad5820d..6487c71 100644 --- a/server/models/chat_room.js +++ b/server/models/chat_room.js @@ -1 +1,38 @@ -var _0x4fe9=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x65\x78\x74\x65\x72\x6E\x61\x6C","\x53\x54\x52\x49\x4E\x47","\x74\x6F\x6B\x65\x6E","\x4F\x50\x45\x4E","\x43\x4C\x4F\x53\x45\x44","\x67\x6F\x6F\x64","\x62\x61\x64","\x54\x45\x58\x54","\x49\x4E\x54\x45\x47\x45\x52","\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x4fe9[0]);module[_0x4fe9[1]]=function(_0xebbex2,_0xebbex3){var _0xebbex4=_0xebbex2[_0x4fe9[18]](_0x4fe9[2],{type:_0xebbex3.ENUM(_0x4fe9[3],_0x4fe9[4]),token:{type:_0xebbex3[_0x4fe9[5]],unique:_0x4fe9[6]},status:{type:_0xebbex3.ENUM(_0x4fe9[7],_0x4fe9[8]),defaultValue:_0x4fe9[7]},rating:_0xebbex3.ENUM(_0x4fe9[9],_0x4fe9[10]),ratingMessage:_0xebbex3[_0x4fe9[11]],ChatVisitorId:{type:_0xebbex3[_0x4fe9[12]],unique:_0x4fe9[6]}},{tableName:_0x4fe9[13],associate:function(_0xebbex5){_0xebbex4[_0x4fe9[14]](_0xebbex5.ChatMessage);_0xebbex4[_0x4fe9[15]](_0xebbex5.ChatVisitor);_0xebbex4[_0x4fe9[15]](_0xebbex5.ChatWebsite);_0xebbex4[_0x4fe9[17]](_0xebbex5.User,{through:_0xebbex5[_0x4fe9[16]]})}});return _0xebbex4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var ChatRoom = sequelize.define('ChatRoom', { + type: DataTypes.ENUM('internal', 'external'), + token: { + type: DataTypes.STRING, + unique: 'token' + }, + status: { + type: DataTypes.ENUM('OPEN', 'CLOSED'), + defaultValue: 'OPEN' + }, + rating: DataTypes.ENUM('good', 'bad'), + ratingMessage: DataTypes.TEXT, + ChatVisitorId: { + type: DataTypes.INTEGER, + unique: 'token' + } + }, { + tableName: 'chat_rooms', + associate: function(models) { + ChatRoom.hasMany(models.ChatMessage); + ChatRoom.belongsTo(models.ChatVisitor); + ChatRoom.belongsTo(models.ChatWebsite); + ChatRoom.belongsToMany(models.User, { + through: models.UserHasChatRoom + }); + } + }); + + return ChatRoom; +}; diff --git a/server/models/chat_visitor.js b/server/models/chat_visitor.js index e0250a5..9874a13 100644 --- a/server/models/chat_visitor.js +++ b/server/models/chat_visitor.js @@ -1 +1,55 @@ -var _0xe616=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x53\x54\x52\x49\x4E\x47","\x77\x65\x62\x63\x68\x61\x74","\x65\x6E\x71\x75\x69\x72\x79","\x70\x65\x6E\x64\x69\x6E\x67","\x61\x63\x63\x65\x70\x74\x65\x64","\x75\x6E\x73\x65\x72\x76\x65\x64","\x73\x65\x72\x76\x65\x64","\x62\x6C\x61\x63\x6B\x6C\x69\x73\x74","\x61\x62\x61\x6E\x64\x6F\x6E","\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72\x73","\x68\x61\x73\x4F\x6E\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xe616[0]);module[_0xe616[1]]=function(_0x32bax2,_0x32bax3){var _0x32bax4=_0x32bax2[_0xe616[16]](_0xe616[2],{fullname:_0x32bax3[_0xe616[3]],email:_0x32bax3[_0xe616[3]],remote_address:{type:_0x32bax3[_0xe616[3]]},user_agent:_0x32bax3[_0xe616[3]],visitor_language:_0x32bax3[_0xe616[3]],referer:_0x32bax3[_0xe616[3]],browser:_0x32bax3[_0xe616[3]],engine:_0x32bax3[_0xe616[3]],os:_0x32bax3[_0xe616[3]],device:_0x32bax3[_0xe616[3]],country:_0x32bax3[_0xe616[3]],region:_0x32bax3[_0xe616[3]],city:_0x32bax3[_0xe616[3]],latitude:_0x32bax3[_0xe616[3]],longitude:_0x32bax3[_0xe616[3]],origin:_0x32bax3.ENUM(_0xe616[4],_0xe616[5]),status:{type:_0x32bax3.ENUM(_0xe616[6],_0xe616[7],_0xe616[8],_0xe616[9],_0xe616[10],_0xe616[11]),defaultValue:_0xe616[6]},data1:_0x32bax3[_0xe616[3]],data2:_0x32bax3[_0xe616[3]],data3:_0x32bax3[_0xe616[3]],offlineData1:_0x32bax3[_0xe616[3]],offlineData2:_0x32bax3[_0xe616[3]],offlineData3:_0x32bax3[_0xe616[3]],labelData1:_0x32bax3[_0xe616[3]],labelData2:_0x32bax3[_0xe616[3]],labelData3:_0x32bax3[_0xe616[3]],labelOfflineData1:_0x32bax3[_0xe616[3]],labelOfflineData2:_0x32bax3[_0xe616[3]],labelOfflineData3:_0x32bax3[_0xe616[3]]},{tableName:_0xe616[12],associate:function(_0x32bax5){_0x32bax4[_0xe616[13]](_0x32bax5.ChatEnquiry);_0x32bax4[_0xe616[14]](_0x32bax5.ChatMessage);_0x32bax4[_0xe616[14]](_0x32bax5.ChatRoom);_0x32bax4[_0xe616[15]](_0x32bax5.ChatWebsite)}});return _0x32bax4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var ChatVisitor = sequelize.define('ChatVisitor', { + fullname: DataTypes.STRING, + email: DataTypes.STRING, + remote_address: { + type: DataTypes.STRING + }, + user_agent: DataTypes.STRING, + visitor_language: DataTypes.STRING, + referer: DataTypes.STRING, + browser: DataTypes.STRING, + engine: DataTypes.STRING, + os: DataTypes.STRING, + device: DataTypes.STRING, + country: DataTypes.STRING, + region: DataTypes.STRING, + city: DataTypes.STRING, + latitude: DataTypes.STRING, + longitude: DataTypes.STRING, + origin: DataTypes.ENUM('webchat', 'enquiry'), + status: { + type: DataTypes.ENUM('pending', 'accepted', 'unserved', 'served', 'blacklist', 'abandon'), + defaultValue: 'pending' + }, + data1: DataTypes.STRING, + data2: DataTypes.STRING, + data3: DataTypes.STRING, + offlineData1: DataTypes.STRING, + offlineData2: DataTypes.STRING, + offlineData3: DataTypes.STRING, + labelData1: DataTypes.STRING, + labelData2: DataTypes.STRING, + labelData3: DataTypes.STRING, + labelOfflineData1: DataTypes.STRING, + labelOfflineData2: DataTypes.STRING, + labelOfflineData3: DataTypes.STRING + }, { + tableName: 'chat_visitors', + associate: function(models) { + ChatVisitor.hasOne(models.ChatEnquiry); + ChatVisitor.hasMany(models.ChatMessage); + ChatVisitor.hasMany(models.ChatRoom); + ChatVisitor.belongsTo(models.ChatWebsite); + } + }); + + return ChatVisitor; +}; diff --git a/server/models/chat_website.js b/server/models/chat_website.js index 65535c1..27d5757 100644 --- a/server/models/chat_website.js +++ b/server/models/chat_website.js @@ -1 +1,126 @@ -var _0xff9b=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x53\x54\x52\x49\x4E\x47","\x23\x30\x30\x30\x30\x38\x30","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x6F\x75\x6E\x64\x65\x64","\x73\x71\x75\x61\x72\x65\x64","\x57\x65\x20\x61\x72\x65\x20\x68\x65\x72\x65\x21","\x3C\x73\x74\x72\x6F\x6E\x67\x3E\x51\x75\x65\x73\x74\x69\x6F\x6E\x73\x3F\x3C\x2F\x73\x74\x72\x6F\x6E\x67\x3E\x3C\x62\x72\x20\x2F\x3E\x49\x6E\x73\x65\x72\x74\x20\x79\x6F\x75\x72\x20\x6E\x61\x6D\x65\x20\x61\x6E\x64\x20\x65\x6D\x61\x69\x6C\x20\x61\x64\x64\x72\x65\x73\x73\x20\x74\x6F\x20\x73\x74\x61\x72\x74\x20\x61\x20\x6C\x69\x76\x65\x2D\x63\x68\x61\x74\x20\x77\x69\x74\x68\x20\x6F\x75\x72\x20\x73\x75\x70\x70\x6F\x72\x74\x20\x74\x65\x61\x6D\x2E","\x59\x6F\x75\x72\x20\x6E\x61\x6D\x65","\x59\x6F\x75\x72\x20\x65\x2D\x6D\x61\x69\x6C\x20\x61\x64\x64\x72\x65\x73\x73","\x43\x68\x61\x74","\x43\x6F\x6E\x74\x61\x63\x74\x20\x75\x73","\x3C\x73\x74\x72\x6F\x6E\x67\x3E\x57\x65\x27\x72\x65\x20\x6E\x6F\x74\x20\x6F\x6E\x6C\x69\x6E\x65\x2E\x3C\x2F\x73\x74\x72\x6F\x6E\x67\x3E\x3C\x62\x72\x20\x2F\x3E\x49\x74\x20\x64\x6F\x65\x73\x6E\x27\x74\x20\x6D\x65\x61\x6E\x20\x77\x65\x27\x72\x65\x20\x6E\x6F\x74\x20\x74\x68\x65\x72\x65\x20\x74\x6F\x20\x68\x65\x6C\x70\x20\x2D\x20\x6C\x65\x61\x76\x65\x20\x79\x6F\x75\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x62\x65\x6C\x6F\x77\x20\x61\x6E\x64\x20\x77\x65\x27\x6C\x6C\x20\x62\x65\x20\x69\x6E\x20\x74\x6F\x75\x63\x68\x20\x61\x73\x20\x73\x6F\x6F\x6E\x20\x61\x73\x20\x70\x6F\x73\x73\x69\x62\x6C\x65\x2E","\x59\x6F\x75\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x2E\x2E\x2E","\x4C\x65\x61\x76\x65\x20\x6D\x65\x73\x73\x61\x67\x65","\x57\x6F\x75\x6C\x64\x20\x79\x6F\x75\x20\x6C\x69\x6B\x65\x20\x72\x61\x74\x65\x20\x74\x68\x69\x73\x20\x63\x68\x61\x74\x3F","\x53\x65\x6E\x64","\x53\x6B\x69\x70","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73","\x4F\x66\x66\x6C\x69\x6E\x65\x54\x65\x6D\x70\x6C\x61\x74\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x68\x61\x73\x4D\x61\x6E\x79","\x4F\x6E\x6C\x69\x6E\x65","\x4F\x6E\x6C\x69\x6E\x65\x49\x64","\x4F\x66\x66\x6C\x69\x6E\x65","\x4F\x66\x66\x6C\x69\x6E\x65\x49\x64","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xff9b[0]);module[_0xff9b[1]]=function(_0x867fx2,_0x867fx3){var _0x867fx4=_0x867fx2[_0xff9b[28]](_0xff9b[2],{name:_0x867fx3[_0xff9b[3]],address:{type:_0x867fx3[_0xff9b[3]],unique:true},description:_0x867fx3[_0xff9b[3]],color:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[4]},color_focus:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[4]},color_button:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[4]},remote:_0x867fx3[_0xff9b[3]],animation:{type:_0x867fx3[_0xff9b[5]],defaultValue:true},header_shape:{type:_0x867fx3.ENUM(_0xff9b[6],_0xff9b[7]),defaultValue:_0xff9b[6]},header_online:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[8]},online_message:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[9]},username_placeholder:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[10]},email_placeholder:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[11]},start_chat_button:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[12]},header_offline:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[13]},offline_message:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[14]},enquiry_message_placeholder:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[15]},enquiry_button:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[16]},download_transcript:{type:_0x867fx3[_0xff9b[5]],defaultValue:true},enquiry_forwarding:{type:_0x867fx3[_0xff9b[5]],defaultValue:false},enquiry_forwarding_address:{type:_0x867fx3[_0xff9b[3]]},enquiry_enable:{type:_0x867fx3[_0xff9b[5]],defaultValue:true},rating_enable:{type:_0x867fx3[_0xff9b[5]],defaultValue:true},rating_message:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[17]},rating_send:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[18]},rating_skip:{type:_0x867fx3[_0xff9b[3]],defaultValue:_0xff9b[19]}},{tableName:_0xff9b[20],associate:function(_0x867fx5){_0x867fx4[_0xff9b[22]](_0x867fx5.MailTemplate,{as:_0xff9b[21]});_0x867fx4[_0xff9b[23]](_0x867fx5.ChatRoom);_0x867fx4[_0xff9b[23]](_0x867fx5.ChatApplication);_0x867fx4[_0xff9b[23]](_0x867fx5.ChatWebsitesField,{as:_0xff9b[24],foreignKey:_0xff9b[25]});_0x867fx4[_0xff9b[23]](_0x867fx5.ChatWebsitesField,{as:_0xff9b[26],foreignKey:_0xff9b[27]});_0x867fx4[_0xff9b[23]](_0x867fx5.ChatProactiveAction)}});return _0x867fx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var ChatWebsite = sequelize.define('ChatWebsite', { + name: DataTypes.STRING, + address: { + type: DataTypes.STRING, + unique: true + }, + description: DataTypes.STRING, + color: { + type: DataTypes.STRING, + defaultValue: '#000080' + }, + color_focus: { + type: DataTypes.STRING, + defaultValue: '#000080' + }, + color_button: { + type: DataTypes.STRING, + defaultValue: '#000080' + }, + remote: DataTypes.STRING, + animation: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + header_shape: { + type: DataTypes.ENUM('rounded', 'squared'), + defaultValue: 'rounded' + }, + header_online: { + type: DataTypes.STRING, + defaultValue: 'We are here!' + }, + online_message: { + type: DataTypes.STRING, + defaultValue: 'Questions?<\/strong>
Insert your name and email address to start a live-chat with our support team.' + }, + username_placeholder: { + type: DataTypes.STRING, + defaultValue: 'Your name' + }, + email_placeholder: { + type: DataTypes.STRING, + defaultValue: 'Your e-mail address' + }, + start_chat_button: { + type: DataTypes.STRING, + defaultValue: 'Chat' + }, + header_offline: { + type: DataTypes.STRING, + defaultValue: 'Contact us' + }, + offline_message: { + type: DataTypes.STRING, + defaultValue: 'We\'re not online.<\/strong>
It doesn\'t mean we\'re not there to help - leave your message below and we\'ll be in touch as soon as possible.' + }, + enquiry_message_placeholder: { + type: DataTypes.STRING, + defaultValue: 'Your message...' + }, + enquiry_button: { + type: DataTypes.STRING, + defaultValue: 'Leave message' + }, + download_transcript: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + enquiry_forwarding: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + enquiry_forwarding_address: { + type: DataTypes.STRING + }, + enquiry_enable: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + rating_enable: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + rating_message: { + type: DataTypes.STRING, + defaultValue: 'Would you like rate this chat?' + }, + rating_send: { + type: DataTypes.STRING, + defaultValue: 'Send' + }, + rating_skip: { + type: DataTypes.STRING, + defaultValue: 'Skip' + }, + }, { + tableName: 'chat_websites', + associate: function(models) { + // hasMany relations + ChatWebsite.belongsTo(models.MailTemplate, { + as: 'OfflineTemplate' + }); + ChatWebsite.hasMany(models.ChatRoom); + ChatWebsite.hasMany(models.ChatApplication); + ChatWebsite.hasMany(models.ChatWebsitesField, { + as: 'Online', + foreignKey: 'OnlineId' + }); + ChatWebsite.hasMany(models.ChatWebsitesField, { + as: 'Offline', + foreignKey: 'OfflineId' + }); + ChatWebsite.hasMany(models.ChatProactiveAction); + } + }); + + return ChatWebsite; +}; diff --git a/server/models/chat_websites_field.js b/server/models/chat_websites_field.js index b57be48..77383f9 100644 --- a/server/models/chat_websites_field.js +++ b/server/models/chat_websites_field.js @@ -1 +1,44 @@ -var _0xeeb8=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x2C","\x73\x70\x6C\x69\x74","\x6F\x70\x74\x69\x6F\x6E\x73","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x6A\x6F\x69\x6E","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x42\x4F\x4F\x4C\x45\x41\x4E","\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64\x73","\x6F\x6E\x6C\x69\x6E\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x6F\x66\x66\x6C\x69\x6E\x65","\x64\x65\x66\x69\x6E\x65"];_0xeeb8[0];module[_0xeeb8[1]]=function(_0x188fx1,_0x188fx2){return _0x188fx1[_0xeeb8[16]](_0xeeb8[2],{component:_0x188fx2[_0xeeb8[3]],description:_0x188fx2[_0xeeb8[3]],index:_0x188fx2[_0xeeb8[4]],label:_0x188fx2[_0xeeb8[3]],options:{type:_0x188fx2[_0xeeb8[3]],get:function(){return this[_0xeeb8[8]](_0xeeb8[7])[_0xeeb8[6]](_0xeeb8[5])},set:function(_0x188fx3){this[_0xeeb8[10]](_0xeeb8[7],_0x188fx3[_0xeeb8[9]](_0xeeb8[5]))}},placeholder:_0x188fx2[_0xeeb8[3]],required:_0x188fx2[_0xeeb8[11]],validation:_0x188fx2[_0xeeb8[3]],editable:{type:_0x188fx2[_0xeeb8[11]],defaultValue:true}},{tableName:_0xeeb8[12],associate:function(_0x188fx4){_0x188fx4[_0xeeb8[2]][_0xeeb8[14]](_0xeeb8[13],function(_0x188fx5){return {where:{OnlineId:_0x188fx5}}});_0x188fx4[_0xeeb8[2]][_0xeeb8[14]](_0xeeb8[15],function(_0x188fx5){return {where:{OfflineId:_0x188fx5}}})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('ChatWebsitesField', { + component: DataTypes.STRING, + description: DataTypes.STRING, + index: DataTypes.INTEGER, + label: DataTypes.STRING, + options: { + type: DataTypes.STRING, + get: function() { + return this.getDataValue('options').split(','); + }, + set: function(val) { + this.setDataValue('options', val.join(',')); + } + }, + placeholder: DataTypes.STRING, + required: DataTypes.BOOLEAN, + validation: DataTypes.STRING, + editable: { + type: DataTypes.BOOLEAN, + defaultValue: true + } + }, { + tableName: 'chat_websites_fields', + associate: function(models) { + models.ChatWebsitesField.addScope('online', function(WebsiteId) { + return { + where: { + OnlineId: WebsiteId + } + } + }); + models.ChatWebsitesField.addScope('offline', function(WebsiteId) { + return { + where: { + OfflineId: WebsiteId + } + } + }); + } + }); +}; diff --git a/server/models/company.js b/server/models/company.js index b47af13..12768bd 100644 --- a/server/models/company.js +++ b/server/models/company.js @@ -1 +1,30 @@ -var _0xd191=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x6F\x6D\x70\x61\x6E\x79","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6D\x70\x61\x6E\x69\x65\x73","\x43\x6F\x6E\x74\x61\x63\x74\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0xd191[0]]=function(_0x7a46x1,_0x7a46x2){var _0x7a46x3=_0x7a46x1[_0xd191[6]](_0xd191[1],{name:{type:_0x7a46x2[_0xd191[2]],unique:true},street:_0x7a46x2[_0xd191[2]],postalCode:_0x7a46x2[_0xd191[2]],city:_0x7a46x2[_0xd191[2]],country:_0x7a46x2[_0xd191[2]],sStreet:_0x7a46x2[_0xd191[2]],sPostalCode:_0x7a46x2[_0xd191[2]],sCity:_0x7a46x2[_0xd191[2]],sCountry:_0x7a46x2[_0xd191[2]]},{tableName:_0xd191[3],associate:function(_0x7a46x4){_0x7a46x3[_0xd191[5]](_0x7a46x4.Contact,{as:_0xd191[4]})}});return _0x7a46x3} \ No newline at end of file +/** + * tag Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Company = sequelize.define('Company', { + name: { + type: DataTypes.STRING, + unique: true + }, + street: DataTypes.STRING, + postalCode: DataTypes.STRING, + city: DataTypes.STRING, + country: DataTypes.STRING, + sStreet: DataTypes.STRING, + sPostalCode: DataTypes.STRING, + sCity: DataTypes.STRING, + sCountry: DataTypes.STRING, + }, { + tableName: 'companies', + associate: function(models) { + Company.hasMany(models.Contact, { + as: 'Contacts' + }); + } + }); + + return Company; +}; diff --git a/server/models/contact.js b/server/models/contact.js index e446295..9fd0abd 100644 --- a/server/models/contact.js +++ b/server/models/contact.js @@ -1 +1,47 @@ -var _0xf869=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x6F\x6E\x74\x61\x63\x74","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6E\x74\x61\x63\x74\x73","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x68\x61\x73\x5F\x70\x68\x6F\x6E\x65\x73","\x50\x68\x6F\x6E\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x68\x61\x73\x5F\x65\x6D\x61\x69\x6C\x73","\x45\x6D\x61\x69\x6C\x73","\x43\x6F\x6E\x74\x61\x63\x74\x48\x61\x73\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x73\x65\x72\x76\x69\x63\x65","\x53\x65\x72\x76\x69\x63\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0xf869[0]]=function(_0x2a25x1,_0x2a25x2){var _0x2a25x3=_0x2a25x1[_0xf869[15]](_0xf869[1],{fullname:{type:_0x2a25x2[_0xf869[2]],validate:{notEmpty:true}},tags:_0x2a25x2[_0xf869[2]],street:_0x2a25x2[_0xf869[2]],postalCode:_0x2a25x2[_0xf869[2]],city:_0x2a25x2[_0xf869[2]],country:_0x2a25x2[_0xf869[2]],dateOfBirth:_0x2a25x2[_0xf869[2]],description:_0x2a25x2[_0xf869[2]]},{tableName:_0xf869[3],associate:function(_0x2a25x4){_0x2a25x3[_0xf869[6]](_0x2a25x4.ContactPhone,{through:_0xf869[4],as:_0xf869[5]});_0x2a25x3[_0xf869[6]](_0x2a25x4.ContactEmail,{through:_0xf869[7],as:_0xf869[8]});_0x2a25x3[_0xf869[6]](_0x2a25x4.CustomField,{through:_0x2a25x4[_0xf869[9]],as:_0xf869[10]});_0x2a25x3[_0xf869[11]](_0x2a25x4.Company);_0x2a25x3[_0xf869[11]](_0x2a25x4.User);_0x2a25x3[_0xf869[11]](_0x2a25x4.Service);_0x2a25x3[_0xf869[14]](_0xf869[12],{include:[_0x2a25x4[_0xf869[13]]]})}});return _0x2a25x3} \ No newline at end of file +/** + * Contact Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Contact = sequelize.define('Contact', { + fullname: { + type: DataTypes.STRING, + validate: { + notEmpty: true + } + }, + tags: DataTypes.STRING, + // ServiceId: DataTypes.INTEGER,/Da creare con l' associazione + street: DataTypes.STRING, + postalCode: DataTypes.STRING, + city: DataTypes.STRING, + country: DataTypes.STRING, + dateOfBirth: DataTypes.STRING, + description: DataTypes.STRING, + }, { + tableName: 'contacts', + associate: function(models) { + Contact.belongsToMany(models.ContactPhone, { + through: 'contact_has_phones', + as: 'Phones' + }); + Contact.belongsToMany(models.ContactEmail, { + through: 'contact_has_emails', + as: 'Emails' + }); + Contact.belongsToMany(models.CustomField, { + through: models.ContactHasCustomField, + as: 'CustomFields' + }); + Contact.belongsTo(models.Company); + Contact.belongsTo(models.User); + Contact.belongsTo(models.Service); + Contact.addScope('service', { + include: [models.Service] + }); + } + }); + + return Contact; +}; diff --git a/server/models/contact_email.js b/server/models/contact_email.js index bccd893..597fbde 100644 --- a/server/models/contact_email.js +++ b/server/models/contact_email.js @@ -1 +1,22 @@ -var _0xce6d=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x65\x6D\x61\x69\x6C\x73","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x68\x61\x73\x5F\x65\x6D\x61\x69\x6C\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0xce6d[0]]=function(_0xadd1x1,_0xadd1x2){var _0xadd1x3=_0xadd1x1[_0xce6d[6]](_0xce6d[1],{email:{type:_0xadd1x2[_0xce6d[2]],primaryKey:true}},{tableName:_0xce6d[3],associate:function(_0xadd1x4){_0xadd1x3[_0xce6d[5]](_0xadd1x4.Contact,{through:_0xce6d[4]})}});return _0xadd1x3} \ No newline at end of file +/** + * Contact Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ContactEmail = sequelize.define('ContactEmail', { + email: { + type: DataTypes.STRING, + primaryKey: true + } + }, { + tableName: 'contact_emails', + associate: function(models) { + ContactEmail.belongsToMany(models.Contact, { + through: 'contact_has_emails' + }); + } + }); + + return ContactEmail; +}; diff --git a/server/models/contact_has_custom_field.js b/server/models/contact_has_custom_field.js index 0ec9b29..650b530 100644 --- a/server/models/contact_has_custom_field.js +++ b/server/models/contact_has_custom_field.js @@ -1 +1,16 @@ -var _0xbaaf=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x43\x6F\x6E\x74\x61\x63\x74\x48\x61\x73\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x68\x61\x73\x5F\x63\x75\x73\x74\x6F\x6D\x5F\x66\x69\x65\x6C\x64\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xbaaf[0]);module[_0xbaaf[1]]=function(_0xd415x2,_0xd415x3){var _0xd415x4=_0xd415x2[_0xbaaf[5]](_0xbaaf[2],{value:_0xd415x3[_0xbaaf[3]]},{tableName:_0xbaaf[4]});return _0xd415x4} \ No newline at end of file +/** + * contact has customfield Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var ContactHasCustomField = sequelize.define('ContactHasCustomField', { + value: DataTypes.STRING + }, { + tableName: 'contact_has_custom_fields' + }); + + return ContactHasCustomField; +}; diff --git a/server/models/contact_phone.js b/server/models/contact_phone.js index a26acef..08d704f 100644 --- a/server/models/contact_phone.js +++ b/server/models/contact_phone.js @@ -1 +1,32 @@ -var _0x525e=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x70\x68\x6F\x6E\x65\x73","\x63\x6F\x6E\x74\x61\x63\x74\x5F\x68\x61\x73\x5F\x70\x68\x6F\x6E\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x49\x6E\x62\x6F\x75\x6E\x64\x73","\x73\x6F\x75\x72\x63\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x4F\x75\x74\x62\x6F\x75\x6E\x64\x73","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x64\x65\x66\x69\x6E\x65"];module[_0x525e[0]]=function(_0x99bax1,_0x99bax2){var _0x99bax3=_0x99bax1[_0x525e[11]](_0x525e[1],{phone:{type:_0x99bax2[_0x525e[2]],primaryKey:true}},{tableName:_0x525e[3],associate:function(_0x99bax4){_0x99bax3[_0x525e[5]](_0x99bax4.Contact,{through:_0x525e[4]});_0x99bax3[_0x525e[8]](_0x99bax4.ReportCall,{as:_0x525e[6],foreignKey:_0x525e[7],constraints:false});_0x99bax3[_0x525e[8]](_0x99bax4.ReportCall,{as:_0x525e[9],foreignKey:_0x525e[10],constraints:false})}});return _0x99bax3} \ No newline at end of file +/** + * Contact Model + */ + +module.exports = function (sequelize, DataTypes) { + + var ContactPhone = sequelize.define('ContactPhone', { + phone: { + type: DataTypes.STRING, + primaryKey: true + } + }, { + tableName: 'contact_phones', + associate: function (models) { + ContactPhone.belongsToMany(models.Contact, { + through: 'contact_has_phones' + }); + ContactPhone.hasMany(models.ReportCall, { + as: 'Inbounds', + foreignKey: 'source', + constraints: false + }); + ContactPhone.hasMany(models.ReportCall, { + as: 'Outbounds', + foreignKey: 'destination', + constraints: false + }); + } + }); + + return ContactPhone; +}; diff --git a/server/models/custom_field.js b/server/models/custom_field.js index e78d9d2..54f5ec6 100644 --- a/server/models/custom_field.js +++ b/server/models/custom_field.js @@ -1 +1,28 @@ -var _0x236b=["\x65\x78\x70\x6F\x72\x74\x73","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x63\x75\x73\x74\x6F\x6D\x5F\x66\x69\x65\x6C\x64\x73","\x43\x6F\x6E\x74\x61\x63\x74\x48\x61\x73\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0x236b[0]]=function(_0x253ax1,_0x253ax2){var _0x253ax3=_0x253ax1[_0x236b[7]](_0x236b[1],{name:{type:_0x253ax2[_0x236b[2]],unique:true},type:_0x253ax2[_0x236b[2]],active:{type:_0x253ax2[_0x236b[3]],defaultValue:true},values:_0x253ax2[_0x236b[2]]},{tableName:_0x236b[4],associate:function(_0x253ax4){_0x253ax3[_0x236b[6]](_0x253ax4.Contact,{through:_0x253ax4[_0x236b[5]]})}});return _0x253ax3} \ No newline at end of file +/** + * customfield Model + */ + +module.exports = function(sequelize, DataTypes) { + + var CustomField = sequelize.define('CustomField', { + name: { + type: DataTypes.STRING, + unique: true + }, + type: DataTypes.STRING, + active: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + values: DataTypes.STRING + }, { + tableName: 'custom_fields', + associate: function(models) { + CustomField.belongsToMany(models.Contact, { + through: models.ContactHasCustomField + }); + } + }); + + return CustomField; +}; diff --git a/server/models/custom_report.js b/server/models/custom_report.js index 28c8a51..fe9d484 100644 --- a/server/models/custom_report.js +++ b/server/models/custom_report.js @@ -1 +1,32 @@ -var _0x1afe=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74\x73","\x46\x69\x65\x6C\x64\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x66\x69\x65\x6C\x64\x73","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x66\x69\x65\x6C\x64","\x61\x6C\x69\x61\x73","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x67\x72\x6F\x75\x70\x42\x79","\x6F\x72\x64\x65\x72\x42\x79","\x4D\x65\x74\x72\x69\x63\x49\x64","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x1afe[0];module[_0x1afe[1]]=function(_0xdf19x1,_0xdf19x2){var _0xdf19x3=_0xdf19x1[_0x1afe[18]](_0x1afe[2],{name:_0xdf19x2[_0x1afe[3]],description:_0xdf19x2[_0x1afe[3]],parent:_0xdf19x2[_0x1afe[3]],table:_0xdf19x2[_0x1afe[3]],conditions:_0xdf19x2[_0x1afe[4]]},{paranoid:true,tableName:_0x1afe[5],associate:function(_0xdf19x4){_0xdf19x3[_0x1afe[8]](_0xdf19x4.ReportField,{as:_0x1afe[6],onDelete:_0x1afe[7],hooks:true});_0xdf19x3[_0x1afe[17]](_0x1afe[9],{include:[{model:_0xdf19x4[_0x1afe[10]],as:_0x1afe[6],required:false,attributes:[_0x1afe[11],_0x1afe[12],_0x1afe[13],_0x1afe[14],_0x1afe[15],_0x1afe[16]]}]})}});return _0xdf19x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var CustomReport = sequelize.define('CustomReport', { + name: DataTypes.STRING, + description: DataTypes.STRING, + parent: DataTypes.STRING, + table: DataTypes.STRING, + conditions: DataTypes.TEXT + }, { + paranoid: true, + tableName: 'custom_reports', + associate: function(models) { + CustomReport.hasMany(models.ReportField, { + as: 'Fields', + onDelete: 'cascade', + hooks: true + }); + CustomReport.addScope('fields', { + include: [{ + model: models.ReportField, + as: 'Fields', + required: false, + attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'MetricId'] + }] + }); + } + }); + + return CustomReport; +}; diff --git a/server/models/dashboard.js b/server/models/dashboard.js index bd3926a..b47660b 100644 --- a/server/models/dashboard.js +++ b/server/models/dashboard.js @@ -1 +1,61 @@ -var _0x2ff6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x44\x61\x73\x68\x62\x6F\x61\x72\x64","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x42\x4F\x4F\x4C\x45\x41\x4E","\x34\x2D\x38","\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x73","\x64\x65\x66\x69\x6E\x65"];_0x2ff6[0];module[_0x2ff6[1]]=function(_0x81b0x1,_0x81b0x2){var _0x81b0x3=_0x81b0x1[_0x2ff6[8]](_0x2ff6[2],{name:{type:_0x81b0x2[_0x2ff6[3]]},description:{type:_0x81b0x2[_0x2ff6[3]]},model:{type:_0x81b0x2[_0x2ff6[4]]},collapsible:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},editable:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},maximizable:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},structure:{type:_0x81b0x2.STRING(32),defaultValue:_0x2ff6[6]},enableconfirmdelete:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},defaultEntry:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:0},admin:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},user:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},agent:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true},visible:{type:_0x81b0x2[_0x2ff6[5]],defaultValue:true}},{tableName:_0x2ff6[7]});return _0x81b0x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Dashboard = sequelize.define('Dashboard', { + name: { + type: DataTypes.STRING, + }, + description: { + type: DataTypes.STRING, + }, + model: { + type: DataTypes.TEXT, + }, + collapsible: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + editable: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + maximizable: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + structure: { + type: DataTypes.STRING(32), + defaultValue: '4-8' + }, + enableconfirmdelete: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + defaultEntry: { + type: DataTypes.BOOLEAN, + defaultValue: 0 + }, + admin: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + user: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + agent: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + visible: { + type: DataTypes.BOOLEAN, + defaultValue: true + } + }, { + tableName: 'dashboards' + }); + + return Dashboard; + +}; diff --git a/server/models/default_report.js b/server/models/default_report.js index 9feb61d..16cdd08 100644 --- a/server/models/default_report.js +++ b/server/models/default_report.js @@ -1 +1,23 @@ -var _0x5ecd=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74\x73","\x46\x69\x65\x6C\x64\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];_0x5ecd[0];module[_0x5ecd[1]]=function(_0x3fafx1,_0x3fafx2){var _0x3fafx3=_0x3fafx1[_0x5ecd[9]](_0x5ecd[2],{name:_0x3fafx2[_0x5ecd[3]],description:_0x3fafx2[_0x5ecd[3]],parent:_0x3fafx2[_0x5ecd[3]],table:_0x3fafx2[_0x5ecd[3]],conditions:_0x3fafx2[_0x5ecd[4]]},{tableName:_0x5ecd[5],associate:function(_0x3fafx4){_0x3fafx3[_0x5ecd[8]](_0x3fafx4.ReportField,{as:_0x5ecd[6],onDelete:_0x5ecd[7],hooks:true})}});return _0x3fafx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var DefaultReport = sequelize.define('DefaultReport', { + name: DataTypes.STRING, + description: DataTypes.STRING, + parent: DataTypes.STRING, + table: DataTypes.STRING, + conditions: DataTypes.TEXT + }, { + tableName: 'default_reports', + associate: function(models) { + DefaultReport.hasMany(models.ReportField, { + as: 'Fields', + onDelete: 'cascade', + hooks: true + }); + } + }); + + return DefaultReport; +}; diff --git a/server/models/desk_account.js b/server/models/desk_account.js index 731022d..12615eb 100644 --- a/server/models/desk_account.js +++ b/server/models/desk_account.js @@ -1 +1,45 @@ -var _0xc66a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x44\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x62\x61\x73\x69\x63","\x6F\x61\x75\x74\x68","\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x44\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x6E\x61\x6D\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0xc66a[0];module[_0xc66a[1]]=function(_0x2d1bx1,_0x2d1bx2){var _0x2d1bx3=_0x2d1bx1[_0xc66a[15]](_0xc66a[2],{name:_0x2d1bx2[_0xc66a[3]],description:_0x2d1bx2[_0xc66a[3]],username:{type:_0x2d1bx2[_0xc66a[3]],unique:true},remoteUri:{type:_0x2d1bx2[_0xc66a[3]],unique:true},authType:{type:_0x2d1bx2.ENUM(_0xc66a[4],_0xc66a[5]),defaultValue:_0xc66a[4]},password:_0x2d1bx2[_0xc66a[3]],consumerKey:_0x2d1bx2[_0xc66a[3]],consumerSecret:_0x2d1bx2[_0xc66a[3]],token:_0x2d1bx2[_0xc66a[3]],tokenSecret:_0x2d1bx2[_0xc66a[3]]},{tableName:_0xc66a[6],associate:function(_0x2d1bx4){_0x2d1bx3[_0xc66a[9]](_0x2d1bx4.DeskConfiguration,{as:_0xc66a[7],foreignKey:_0xc66a[8]});_0x2d1bx3[_0xc66a[14]](_0xc66a[10],{include:[{model:_0x2d1bx4[_0xc66a[11]],as:_0xc66a[7],required:false,attributes:[_0xc66a[12],_0xc66a[13]]}]})}});return _0x2d1bx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var DeskAccount = sequelize.define('DeskAccount', { + name: DataTypes.STRING, + description: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + remoteUri: { + type: DataTypes.STRING, + unique: true + }, + authType: { + type: DataTypes.ENUM('basic', 'oauth'), + defaultValue: 'basic' + }, + password: DataTypes.STRING, + consumerKey: DataTypes.STRING, + consumerSecret: DataTypes.STRING, + token: DataTypes.STRING, + tokenSecret: DataTypes.STRING + }, { + tableName: 'desk_accounts', + associate: function(models) { + DeskAccount.hasMany(models.DeskConfiguration, { + as: 'Configurations', + foreignKey: 'AccountId' + }); + DeskAccount.addScope('configurations', { + include: [{ + model: models.DeskConfiguration, + as: 'Configurations', + required: false, + attributes: ['id', 'name'] + }] + }); + } + }); + + return DeskAccount; + +}; diff --git a/server/models/desk_configuration.js b/server/models/desk_configuration.js index b96f432..fb92e7e 100644 --- a/server/models/desk_configuration.js +++ b/server/models/desk_configuration.js @@ -1 +1,27 @@ -var _0x31e2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x44\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x53\x75\x62\x6A\x65\x63\x74","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x46\x69\x65\x6C\x64","\x46\x69\x65\x6C\x64\x49\x64","\x64\x65\x66\x69\x6E\x65"];_0x31e2[0];module[_0x31e2[1]]=function(_0x40c7x1,_0x40c7x2){return _0x40c7x1[_0x31e2[14]](_0x31e2[2],{name:_0x40c7x2[_0x31e2[3]],description:_0x40c7x2[_0x31e2[3]]},{tableName:_0x31e2[4],associate:function(_0x40c7x3){_0x40c7x3[_0x31e2[2]][_0x31e2[6]](_0x40c7x3.DeskAccount,{foreignKey:_0x31e2[5]});_0x40c7x3[_0x31e2[2]][_0x31e2[9]](_0x40c7x3.DeskField,{as:_0x31e2[7],foreignKey:_0x31e2[8]});_0x40c7x3[_0x31e2[2]][_0x31e2[9]](_0x40c7x3.DeskField,{as:_0x31e2[10],foreignKey:_0x31e2[11]});_0x40c7x3[_0x31e2[2]][_0x31e2[9]](_0x40c7x3.DeskField,{as:_0x31e2[12],foreignKey:_0x31e2[13]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('DeskConfiguration', { + name: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'desk_configurations', + associate: function(models) { + models.DeskConfiguration.belongsTo(models.DeskAccount, { + foreignKey: 'AccountId' + }); + models.DeskConfiguration.hasMany(models.DeskField, { + as: 'Subject', + foreignKey: 'SubjectId' + }); + models.DeskConfiguration.hasMany(models.DeskField, { + as: 'Description', + foreignKey: 'DescriptionId' + }); + models.DeskConfiguration.hasMany(models.DeskField, { + as: 'Field', + foreignKey: 'FieldId' + }); + } + }); +}; diff --git a/server/models/desk_field.js b/server/models/desk_field.js index 842124a..befea49 100644 --- a/server/models/desk_field.js +++ b/server/models/desk_field.js @@ -1 +1,26 @@ -var _0xa288=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x44\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x74\x72\x69\x6E\x67","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x5F\x76\x61\x6C\x75\x65","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0xa288[0];module[_0xa288[1]]=function(_0xc6b6x1,_0xc6b6x2){return _0xc6b6x1[_0xa288[10]](_0xa288[2],{type:{type:_0xc6b6x2.ENUM(_0xa288[3],_0xa288[4],_0xa288[5]),defaultValue:_0xa288[3]},content:_0xc6b6x2[_0xa288[6]],key:_0xc6b6x2[_0xa288[6]],keyType:{type:_0xc6b6x2.ENUM(_0xa288[3],_0xa288[4])},keyContent:_0xc6b6x2[_0xa288[6]],idField:_0xc6b6x2[_0xa288[6]],customField:{type:_0xc6b6x2[_0xa288[7]],defaultValue:true}},{tableName:_0xa288[8],associate:function(_0xc6b6x3){_0xc6b6x3[_0xa288[2]][_0xa288[9]](_0xc6b6x3.Variable)}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('DeskField', { + type: { + type: DataTypes.ENUM('string', 'variable', 'key_value'), + defaultValue: 'string' + }, + content: DataTypes.STRING, + key: DataTypes.STRING, + keyType: { + type: DataTypes.ENUM('string', 'variable') + }, + keyContent: DataTypes.STRING, + idField: DataTypes.STRING, + customField: { + type: DataTypes.BOOLEAN, + defaultValue: true + } + }, { + tableName: 'desk_fields', + associate: function(models) { + models.DeskField.belongsTo(models.Variable); + } + }); +}; diff --git a/server/models/event.js b/server/models/event.js index 9214260..fba2c1c 100644 --- a/server/models/event.js +++ b/server/models/event.js @@ -1 +1,45 @@ -var _0xa9b3=["\x65\x78\x70\x6F\x72\x74\x73","\x45\x76\x65\x6E\x74","\x49\x4E\x43\x4F\x4D\x49\x4E\x47","\x4F\x55\x54\x47\x4F\x49\x4E\x47","\x41\x54\x54\x45\x4D\x50\x54","\x41\x53\x53\x49\x47\x4E\x45\x44","\x55\x4E\x41\x53\x53\x49\x47\x4E\x45\x44","\x4D\x41\x49\x4C","\x43\x48\x41\x54","\x46\x41\x58","\x56\x4F\x49\x43\x45","\x49\x4E\x54\x45\x47\x45\x52","\x65\x76\x65\x6E\x74\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];module[_0xa9b3[0]]=function(_0x7153x1,_0x7153x2){var _0x7153x3=_0x7153x1[_0xa9b3[14]](_0xa9b3[1],{name:{type:_0x7153x2.ENUM(_0xa9b3[2],_0xa9b3[3],_0xa9b3[4],_0xa9b3[5],_0xa9b3[6])},channel:{type:_0x7153x2.ENUM(_0xa9b3[7],_0xa9b3[8],_0xa9b3[9],_0xa9b3[10])},timeout:{type:_0x7153x2[_0xa9b3[11]]},holdtime:{type:_0x7153x2[_0xa9b3[11]]}},{tableName:_0xa9b3[12],associate:function(_0x7153x4){_0x7153x3[_0xa9b3[13]](_0x7153x4.User);_0x7153x3[_0xa9b3[13]](_0x7153x4.MailRoom);_0x7153x3[_0xa9b3[13]](_0x7153x4.MailMessage);_0x7153x3[_0xa9b3[13]](_0x7153x4.MailQueue);_0x7153x3[_0xa9b3[13]](_0x7153x4.MailAccount);_0x7153x3[_0xa9b3[13]](_0x7153x4.MailApplication);_0x7153x3[_0xa9b3[13]](_0x7153x4.FaxRoom);_0x7153x3[_0xa9b3[13]](_0x7153x4.FaxQueue);_0x7153x3[_0xa9b3[13]](_0x7153x4.FaxAccount);_0x7153x3[_0xa9b3[13]](_0x7153x4.FaxApplication);_0x7153x3[_0xa9b3[13]](_0x7153x4.ChatRoom);_0x7153x3[_0xa9b3[13]](_0x7153x4.ChatQueue);_0x7153x3[_0xa9b3[13]](_0x7153x4.ChatWebsite);_0x7153x3[_0xa9b3[13]](_0x7153x4.ChatApplication)}});return _0x7153x3} \ No newline at end of file +/** + * Event Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Event = sequelize.define('Event', { + name: { + type: DataTypes.ENUM('INCOMING', 'OUTGOING', 'ATTEMPT', 'ASSIGNED', 'UNASSIGNED') + }, + channel: { + type: DataTypes.ENUM('MAIL', 'CHAT', 'FAX', 'VOICE'), + }, + timeout: { + type: DataTypes.INTEGER + }, + holdtime: { + type: DataTypes.INTEGER + } + }, { + tableName: 'events', + associate: function(models) { + // USER RELATIONS + Event.belongsTo(models.User); + // MAIL RELATIONS + Event.belongsTo(models.MailRoom); + Event.belongsTo(models.MailMessage); + Event.belongsTo(models.MailQueue); + Event.belongsTo(models.MailAccount); + Event.belongsTo(models.MailApplication); + // FAX RELATIONS + Event.belongsTo(models.FaxRoom); + Event.belongsTo(models.FaxQueue); + Event.belongsTo(models.FaxAccount); + Event.belongsTo(models.FaxApplication); + // CHAT RELATIONS + Event.belongsTo(models.ChatRoom); + Event.belongsTo(models.ChatQueue); + Event.belongsTo(models.ChatWebsite); + Event.belongsTo(models.ChatApplication); + } + }); + + return Event; +}; diff --git a/server/models/extracted_report.js b/server/models/extracted_report.js index 62a221e..984f130 100644 --- a/server/models/extracted_report.js +++ b/server/models/extracted_report.js @@ -1 +1,27 @@ -var _0x8d6e=["\x65\x78\x70\x6F\x72\x74\x73","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x4C\x6F\x61\x64\x69\x6E\x67","\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74\x73","\x64\x65\x66\x69\x6E\x65"];module[_0x8d6e[0]]=function(_0x3936x1,_0x3936x2){var _0x3936x3=_0x3936x1[_0x8d6e[6]](_0x8d6e[1],{name:_0x3936x2[_0x8d6e[2]],output:_0x3936x2[_0x8d6e[2]],savename:_0x3936x2[_0x8d6e[2]],startDate:_0x3936x2[_0x8d6e[3]],endDate:_0x3936x2[_0x8d6e[3]],status:{type:_0x3936x2[_0x8d6e[2]],defaultValue:_0x8d6e[4]}},{tableName:_0x8d6e[5]});return _0x3936x3} \ No newline at end of file +/** + * tag Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ExtractedReport = sequelize.define('ExtractedReport', { + name: DataTypes.STRING, + output: DataTypes.STRING, //csv,pdf,.. + savename: DataTypes.STRING, + startDate: DataTypes.DATE, + endDate: DataTypes.DATE, + status: { + type: DataTypes.STRING, + defaultValue: 'Loading' + } + }, { + tableName: 'extracted_reports', + // associate: function(models) { + // Tag.belongsToMany(models.Contact, { + // through: 'contact_tags' + // }); + // } + }); + + return ExtractedReport; +}; diff --git a/server/models/fax_account.js b/server/models/fax_account.js index f8466ab..71a9227 100644 --- a/server/models/fax_account.js +++ b/server/models/fax_account.js @@ -1 +1,40 @@ -var _0x1176=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x39\x36\x30\x30","\x31\x34\x34\x30\x30","\x33\x33\x36\x30\x30","\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x1176[0]);module[_0x1176[1]]=function(_0x77edx2,_0x77edx3){var _0x77edx4=_0x77edx2[_0x1176[10]](_0x1176[2],{description:_0x77edx3[_0x1176[3]],name:_0x77edx3[_0x1176[3]],phone:{type:_0x77edx3[_0x1176[3]],unique:true},ecm:{type:_0x77edx3[_0x1176[4]],defaultValue:false},faxheader:_0x77edx3[_0x1176[3]],localid:_0x77edx3[_0x1176[3]],maxrate:{type:_0x77edx3.ENUM(_0x1176[5],_0x1176[6],_0x1176[7]),defaultValue:_0x1176[7]},minrate:{type:_0x77edx3.ENUM(_0x1176[5],_0x1176[6],_0x1176[7]),defaultValue:_0x1176[5]}},{tableName:_0x1176[8],associate:function(_0x77edx5){_0x77edx4[_0x1176[9]](_0x77edx5.FaxRoom);_0x77edx4[_0x1176[9]](_0x77edx5.FaxApplication)}});return _0x77edx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var FaxAccount = sequelize.define('FaxAccount', { + description: DataTypes.STRING, + name: DataTypes.STRING, + phone: { + type: DataTypes.STRING, + unique: true + }, + ecm: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + faxheader: DataTypes.STRING, + localid: DataTypes.STRING, + maxrate: { + type: DataTypes.ENUM('9600', '14400', '33600'), + defaultValue: '33600' + }, + minrate: { + type: DataTypes.ENUM('9600', '14400', '33600'), + defaultValue: '9600' + } + }, { + tableName: 'fax_accounts', + associate: function(models) { + // FaxAccount.belongsTo(models.Trunk); + FaxAccount.hasMany(models.FaxRoom); + FaxAccount.hasMany(models.FaxApplication); + } + }); + + return FaxAccount; +}; diff --git a/server/models/fax_application.js b/server/models/fax_application.js index c0ebdf1..b4c6d10 100644 --- a/server/models/fax_application.js +++ b/server/models/fax_application.js @@ -1 +1,33 @@ -var _0x1b91=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65","\x61\x67\x65\x6E\x74","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x2A\x7C\x2A\x7C\x2A\x7C\x2A","\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x1b91[0];module[_0x1b91[1]]=function(_0x5f07x1,_0x5f07x2){var _0x5f07x3=_0x5f07x1[_0x1b91[10]](_0x1b91[2],{app:{type:_0x5f07x2.ENUM(_0x1b91[3],_0x1b91[4])},appdata:{type:_0x5f07x2[_0x1b91[5]]},priority:{type:_0x5f07x2[_0x1b91[5]]},timeout:{type:_0x5f07x2[_0x1b91[5]]},interval:{type:_0x5f07x2[_0x1b91[6]],defaultValue:_0x1b91[7]}},{tableName:_0x1b91[8],associate:function(_0x5f07x4){_0x5f07x3[_0x1b91[9]](_0x5f07x4.FaxAccount);_0x5f07x3[_0x1b91[9]](_0x5f07x4.FaxQueue);_0x5f07x3[_0x1b91[9]](_0x5f07x4.User)}});return _0x5f07x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var FaxApplication = sequelize.define('FaxApplication', { + app: { + type: DataTypes.ENUM('queue', 'agent') + }, + appdata: { + type: DataTypes.INTEGER + }, + priority: { + type: DataTypes.INTEGER + }, + timeout: { + type: DataTypes.INTEGER + }, + interval: { + type: DataTypes.STRING, + defaultValue: '*|*|*|*' + } + }, { + tableName: 'fax_applications', + associate: function(models) { + // hasMany relations + FaxApplication.belongsTo(models.FaxAccount); + FaxApplication.belongsTo(models.FaxQueue); + FaxApplication.belongsTo(models.User); + } + }); + + return FaxApplication; +}; diff --git a/server/models/fax_message.js b/server/models/fax_message.js index 86490b3..78700ac 100644 --- a/server/models/fax_message.js +++ b/server/models/fax_message.js @@ -1 +1,63 @@ -var _0x23c5=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x52\x45\x43\x45\x49\x56\x45\x44","\x4E\x4F\x54\x20\x53\x45\x4E\x54","\x53\x45\x4E\x44\x49\x4E\x47","\x53\x45\x4E\x54","\x46\x41\x49\x4C\x45\x44","\x42\x4F\x4F\x4C\x45\x41\x4E","\x54\x45\x58\x54","\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x46\x72\x6F\x6D","\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x23c5[0]);module[_0x23c5[1]]=function(_0x9294x2,_0x9294x3){var _0x9294x4=_0x9294x2[_0x23c5[16]](_0x23c5[2],{actionid:_0x9294x3[_0x23c5[3]],channel:_0x9294x3[_0x23c5[3]],channelstate:_0x9294x3[_0x23c5[4]],channelstatedesc:_0x9294x3[_0x23c5[3]],calleridnum:_0x9294x3[_0x23c5[3]],calleridname:_0x9294x3[_0x23c5[3]],connectedlinenum:_0x9294x3[_0x23c5[3]],connectedlinename:_0x9294x3[_0x23c5[3]],status:{type:_0x9294x3.ENUM(_0x23c5[5],_0x23c5[6],_0x23c5[7],_0x23c5[8],_0x23c5[9]),allowNull:true},read:{type:_0x9294x3[_0x23c5[10]],defaultValue:false},favorite:{type:_0x9294x3[_0x23c5[10]],defaultValue:false},language:_0x9294x3[_0x23c5[3]],accountcode:_0x9294x3[_0x23c5[3]],context:_0x9294x3[_0x23c5[3]],exten:_0x9294x3[_0x23c5[3]],priority:_0x9294x3[_0x23c5[4]],uniqueid:_0x9294x3[_0x23c5[3]],localstationid:_0x9294x3[_0x23c5[3]],remotestationid:_0x9294x3[_0x23c5[3]],pagestransferred:_0x9294x3[_0x23c5[4]],resolution:_0x9294x3[_0x23c5[3]],transferrate:_0x9294x3[_0x23c5[3]],filename:_0x9294x3[_0x23c5[3]],filenamePDF:_0x9294x3[_0x23c5[3]],operation:_0x9294x3[_0x23c5[3]],uuid:_0x9294x3[_0x23c5[3]],laststatus:_0x9294x3[_0x23c5[3]],error:_0x9294x3[_0x23c5[3]],body:_0x9294x3[_0x23c5[11]]},{tableName:_0x23c5[12],associate:function(_0x9294x5){_0x9294x4[_0x23c5[13]](_0x9294x5.FaxRoom);_0x9294x4[_0x23c5[13]](_0x9294x5.Contact,{as:_0x23c5[14]});_0x9294x4[_0x23c5[13]](_0x9294x5.Contact,{as:_0x23c5[15]})}});return _0x9294x4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var FaxMessage = sequelize.define('FaxMessage', { + actionid: DataTypes.STRING, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + status: { + type: DataTypes.ENUM('RECEIVED', 'NOT SENT', 'SENDING', 'SENT', + 'FAILED'), + allowNull: true + }, + read: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + favorite: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.INTEGER, + uniqueid: DataTypes.STRING, + localstationid: DataTypes.STRING, + remotestationid: DataTypes.STRING, + pagestransferred: DataTypes.INTEGER, + resolution: DataTypes.STRING, + transferrate: DataTypes.STRING, + filename: DataTypes.STRING, + filenamePDF: DataTypes.STRING, + operation: DataTypes.STRING, + uuid: DataTypes.STRING, + laststatus: DataTypes.STRING, + error: DataTypes.STRING, + body: DataTypes.TEXT + }, { + tableName: 'fax_messages', + associate: function(models) { + FaxMessage.belongsTo(models.FaxRoom); + FaxMessage.belongsTo(models.Contact, { + as: 'From' + }); + FaxMessage.belongsTo(models.Contact, { + as: 'To' + }); + } + }); + + return FaxMessage; +}; diff --git a/server/models/fax_queue.js b/server/models/fax_queue.js index f958c8f..035bad7 100644 --- a/server/models/fax_queue.js +++ b/server/models/fax_queue.js @@ -1 +1,36 @@ -var _0xf081=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x51\x75\x65\x75\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x73","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];_0xf081[0];module[_0xf081[1]]=function(_0xb1f3x1,_0xb1f3x2){var _0xb1f3x3=_0xb1f3x1[_0xf081[10]](_0xf081[2],{name:{type:_0xb1f3x2[_0xf081[3]],unique:true,allowNull:false,validate:{notEmpty:true}},description:{type:_0xb1f3x2[_0xf081[3]]},timeout:{type:_0xb1f3x2[_0xf081[4]]},strategy:{type:_0xb1f3x2.ENUM(_0xf081[5],_0xf081[6])}},{tableName:_0xf081[7],associate:function(_0xb1f3x4){_0xb1f3x3[_0xf081[9]](_0xb1f3x4.User,{hooks:true,through:_0xb1f3x4[_0xf081[8]]})}});return _0xb1f3x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var FaxQueue = sequelize.define('FaxQueue', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + } + }, + description: { + type: DataTypes.STRING, + }, + timeout: { + type: DataTypes.INTEGER, + }, + strategy: { + type: DataTypes.ENUM('rrmemory', 'beepall') + } + }, { + tableName: 'fax_queues', + associate: function(models) { + // hasMany relations + FaxQueue.belongsToMany(models.User, { + hooks: true, + through: models.UserHasFaxQueue + }); + } + }); + + return FaxQueue; + +}; diff --git a/server/models/fax_room.js b/server/models/fax_room.js index 5d8701e..112966e 100644 --- a/server/models/fax_room.js +++ b/server/models/fax_room.js @@ -1 +1,25 @@ -var _0xbb2e=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x54\x52\x49\x4E\x47","\x4E\x45\x57","\x4F\x50\x45\x4E","\x50\x45\x4E\x44\x49\x4E\x47","\x53\x4F\x4C\x56\x45\x44","\x43\x4C\x4F\x53\x45\x44","\x66\x61\x78\x5F\x72\x6F\x6F\x6D\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xbb2e[0]);module[_0xbb2e[1]]=function(_0x4089x2,_0x4089x3){var _0x4089x4=_0x4089x2[_0xbb2e[12]](_0xbb2e[2],{roomId:_0x4089x3[_0xbb2e[3]],from:_0x4089x3[_0xbb2e[3]],status:_0x4089x3.ENUM(_0xbb2e[4],_0xbb2e[5],_0xbb2e[6],_0xbb2e[7],_0xbb2e[8])},{tableName:_0xbb2e[9],associate:function(_0x4089x5){_0x4089x4[_0xbb2e[10]](_0x4089x5.FaxMessage);_0x4089x4[_0xbb2e[11]](_0x4089x5.FaxAccount);_0x4089x4[_0xbb2e[11]](_0x4089x5.User)}});return _0x4089x4} \ No newline at end of file +/** + * Fax Room Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var FaxRoom = sequelize.define('FaxRoom', { + roomId: DataTypes.STRING, + // subject: DataTypes.STRING, + from: DataTypes.STRING, + status: DataTypes.ENUM('NEW', 'OPEN', 'PENDING', 'SOLVED', 'CLOSED') + }, { + tableName: 'fax_rooms', + associate: function(models) { + // hasMany relations + FaxRoom.hasMany(models.FaxMessage); + FaxRoom.belongsTo(models.FaxAccount); + FaxRoom.belongsTo(models.User); + } + }); + + return FaxRoom; +}; diff --git a/server/models/freshdesk_account.js b/server/models/freshdesk_account.js index dec30e3..f9f9f2b 100644 --- a/server/models/freshdesk_account.js +++ b/server/models/freshdesk_account.js @@ -1 +1,33 @@ -var _0xde5b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x6E\x61\x6D\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0xde5b[0];module[_0xde5b[1]]=function(_0x1cecx1,_0x1cecx2){return _0x1cecx1[_0xde5b[13]](_0xde5b[2],{name:_0x1cecx2[_0xde5b[3]],description:_0x1cecx2[_0xde5b[3]],username:{type:_0x1cecx2[_0xde5b[3]],unique:true},remoteUri:{type:_0x1cecx2[_0xde5b[3]],unique:true},apiKey:_0x1cecx2[_0xde5b[3]]},{tableName:_0xde5b[4],associate:function(_0x1cecx3){_0x1cecx3[_0xde5b[2]][_0xde5b[7]](_0x1cecx3.FreshdeskConfiguration,{as:_0xde5b[5],foreignKey:_0xde5b[6]});_0x1cecx3[_0xde5b[2]][_0xde5b[12]](_0xde5b[8],{include:[{model:_0x1cecx3[_0xde5b[9]],as:_0xde5b[5],required:false,attributes:[_0xde5b[10],_0xde5b[11]]}]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('FreshdeskAccount', { + name: DataTypes.STRING, + description: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + remoteUri: { + type: DataTypes.STRING, + unique: true + }, + apiKey: DataTypes.STRING + }, { + tableName: 'freshdesk_accounts', + associate: function(models) { + models.FreshdeskAccount.hasMany(models.FreshdeskConfiguration, { + as: 'Configurations', + foreignKey: 'AccountId' + }); + models.FreshdeskAccount.addScope('configurations', { + include: [{ + model: models.FreshdeskConfiguration, + as: 'Configurations', + required: false, + attributes: ['id', 'name'] + }] + }); + } + }); +}; diff --git a/server/models/freshdesk_configuration.js b/server/models/freshdesk_configuration.js index b4afc2d..4a1299a 100644 --- a/server/models/freshdesk_configuration.js +++ b/server/models/freshdesk_configuration.js @@ -1 +1,27 @@ -var _0x8863=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x53\x75\x62\x6A\x65\x63\x74","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x46\x69\x65\x6C\x64","\x46\x69\x65\x6C\x64\x49\x64","\x64\x65\x66\x69\x6E\x65"];_0x8863[0];module[_0x8863[1]]=function(_0xd4c7x1,_0xd4c7x2){return _0xd4c7x1[_0x8863[14]](_0x8863[2],{name:_0xd4c7x2[_0x8863[3]],description:_0xd4c7x2[_0x8863[3]]},{tableName:_0x8863[4],associate:function(_0xd4c7x3){_0xd4c7x3[_0x8863[2]][_0x8863[6]](_0xd4c7x3.FreshdeskAccount,{foreignKey:_0x8863[5]});_0xd4c7x3[_0x8863[2]][_0x8863[9]](_0xd4c7x3.FreshdeskField,{as:_0x8863[7],foreignKey:_0x8863[8]});_0xd4c7x3[_0x8863[2]][_0x8863[9]](_0xd4c7x3.FreshdeskField,{as:_0x8863[10],foreignKey:_0x8863[11]});_0xd4c7x3[_0x8863[2]][_0x8863[9]](_0xd4c7x3.FreshdeskField,{as:_0x8863[12],foreignKey:_0x8863[13]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('FreshdeskConfiguration', { + name: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'freshdesk_configurations', + associate: function(models) { + models.FreshdeskConfiguration.belongsTo(models.FreshdeskAccount, { + foreignKey: 'AccountId' + }); + models.FreshdeskConfiguration.hasMany(models.FreshdeskField, { + as: 'Subject', + foreignKey: 'SubjectId' + }); + models.FreshdeskConfiguration.hasMany(models.FreshdeskField, { + as: 'Description', + foreignKey: 'DescriptionId' + }); + models.FreshdeskConfiguration.hasMany(models.FreshdeskField, { + as: 'Field', + foreignKey: 'FieldId' + }); + } + }); +}; diff --git a/server/models/freshdesk_field.js b/server/models/freshdesk_field.js index 0109513..a1c54c9 100644 --- a/server/models/freshdesk_field.js +++ b/server/models/freshdesk_field.js @@ -1 +1,26 @@ -var _0x6a2c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x74\x72\x69\x6E\x67","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x5F\x76\x61\x6C\x75\x65","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x6a2c[0];module[_0x6a2c[1]]=function(_0xb925x1,_0xb925x2){return _0xb925x1[_0x6a2c[10]](_0x6a2c[2],{type:{type:_0xb925x2.ENUM(_0x6a2c[3],_0x6a2c[4],_0x6a2c[5]),defaultValue:_0x6a2c[3]},content:_0xb925x2[_0x6a2c[6]],key:_0xb925x2[_0x6a2c[6]],keyType:{type:_0xb925x2.ENUM(_0x6a2c[3],_0x6a2c[4])},keyContent:_0xb925x2[_0x6a2c[6]],idField:_0xb925x2[_0x6a2c[6]],customField:{type:_0xb925x2[_0x6a2c[7]],defaultValue:true}},{tableName:_0x6a2c[8],associate:function(_0xb925x3){_0xb925x3[_0x6a2c[2]][_0x6a2c[9]](_0xb925x3.Variable)}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('FreshdeskField', { + type: { + type: DataTypes.ENUM('string', 'variable', 'key_value'), + defaultValue: 'string' + }, + content: DataTypes.STRING, + key: DataTypes.STRING, + keyType: { + type: DataTypes.ENUM('string', 'variable') + }, + keyContent: DataTypes.STRING, + idField: DataTypes.STRING, + customField: { + type: DataTypes.BOOLEAN, + defaultValue: true + } + }, { + tableName: 'freshdesk_fields', + associate: function(models) { + models.FreshdeskField.belongsTo(models.Variable); + } + }); +}; diff --git a/server/models/history/report_agent_history.js b/server/models/history/report_agent_history.js index c4f0151..5c42540 100644 --- a/server/models/history/report_agent_history.js +++ b/server/models/history/report_agent_history.js @@ -1 +1,74 @@ -var _0x26ea=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74\x41\x74","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5F\x68\x69\x73\x74\x6F\x72\x79","\x64\x65\x66\x69\x6E\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65"];var moment=require(_0x26ea[0]);module[_0x26ea[1]]=function(_0x5e16x2,_0x5e16x3){var _0x5e16x4=_0x5e16x2[_0x26ea[12]](_0x26ea[2],{uniqueid:_0x5e16x3[_0x26ea[3]],calleridnum:_0x5e16x3[_0x26ea[3]],calleridname:_0x5e16x3[_0x26ea[3]],queue:_0x5e16x3[_0x26ea[3]],interface:_0x5e16x3[_0x26ea[3]],membername:_0x5e16x3[_0x26ea[3]],agentcalledAt:_0x5e16x3[_0x26ea[4]],agentconnectAt:{type:_0x5e16x3[_0x26ea[4]],get:function(){return moment(this[_0x26ea[8]](_0x26ea[7]))[_0x26ea[6]](_0x26ea[5])}},holdtime:_0x5e16x3[_0x26ea[9]],agentcomplete:{type:_0x5e16x3[_0x26ea[10]],defaultValue:false},agentcompleteAt:_0x5e16x3[_0x26ea[4]],talktime:_0x5e16x3[_0x26ea[9]],agentacw:{type:_0x5e16x3[_0x26ea[10]],defaultValue:false},acwtime:_0x5e16x3[_0x26ea[9]],reason:_0x5e16x3[_0x26ea[3]],agentringnoanswer:{type:_0x5e16x3[_0x26ea[10]],defaultValue:false},agentringnoanswerAt:_0x5e16x3[_0x26ea[4]],agentdump:{type:_0x5e16x3[_0x26ea[10]],defaultValue:false},agentdumpAt:_0x5e16x3[_0x26ea[4]],lastevent:_0x5e16x3[_0x26ea[3]],channel:_0x5e16x3[_0x26ea[3]],channelstate:_0x5e16x3[_0x26ea[9]],channelstatedesc:_0x5e16x3[_0x26ea[3]],connectedlinenum:_0x5e16x3[_0x26ea[3]],connectedlinename:_0x5e16x3[_0x26ea[3]],language:_0x5e16x3[_0x26ea[3]],accountcode:_0x5e16x3[_0x26ea[3]],context:_0x5e16x3[_0x26ea[3]],exten:_0x5e16x3[_0x26ea[3]],priority:_0x5e16x3[_0x26ea[3]],destchannel:_0x5e16x3[_0x26ea[3]],destchannelstate:_0x5e16x3[_0x26ea[9]],destchannelstatedesc:_0x5e16x3[_0x26ea[3]],destcalleridnum:_0x5e16x3[_0x26ea[3]],destcalleridname:_0x5e16x3[_0x26ea[3]],destconnectedlinenum:_0x5e16x3[_0x26ea[3]],destconnectedlinename:_0x5e16x3[_0x26ea[3]],destlanguage:_0x5e16x3[_0x26ea[3]],destaccountcode:_0x5e16x3[_0x26ea[3]],destcontext:_0x5e16x3[_0x26ea[3]],destexten:_0x5e16x3[_0x26ea[3]],destpriority:_0x5e16x3[_0x26ea[3]],destuniqueid:_0x5e16x3[_0x26ea[3]]},{tableName:_0x26ea[11]});_0x5e16x4[_0x26ea[14]](_0x26ea[13]);return _0x5e16x4} \ No newline at end of file +/** + * Agent Log Model + */ +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + var ReportAgentHistory = sequelize.define('ReportAgentHistory', { + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + interface: DataTypes.STRING, + membername: DataTypes.STRING, + agentcalledAt: DataTypes.DATE, + agentconnectAt: { + type: DataTypes.DATE, + get: function() { + return moment(this.getDataValue('agentconnectAt')).format("MM-DD-YYYY HH:mm"); + }, + }, + holdtime: DataTypes.INTEGER, + agentcomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentcompleteAt: DataTypes.DATE, + talktime: DataTypes.INTEGER, + agentacw: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + acwtime: DataTypes.INTEGER, + reason: DataTypes.STRING, + agentringnoanswer: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentringnoanswerAt: DataTypes.DATE, + agentdump: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentdumpAt: DataTypes.DATE, + lastevent: DataTypes.STRING, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + destchannel: DataTypes.STRING, + destchannelstate: DataTypes.INTEGER, + destchannelstatedesc: DataTypes.STRING, + destcalleridnum: DataTypes.STRING, + destcalleridname: DataTypes.STRING, + destconnectedlinenum: DataTypes.STRING, + destconnectedlinename: DataTypes.STRING, + destlanguage: DataTypes.STRING, + destaccountcode: DataTypes.STRING, + destcontext: DataTypes.STRING, + destexten: DataTypes.STRING, + destpriority: DataTypes.STRING, + destuniqueid: DataTypes.STRING + }, { + tableName: 'report_agent_history' + }); + + ReportAgentHistory.removeAttribute('id'); + return ReportAgentHistory; +}; diff --git a/server/models/history/report_call_history.js b/server/models/history/report_call_history.js index a25de95..0bda734 100644 --- a/server/models/history/report_call_history.js +++ b/server/models/history/report_call_history.js @@ -1 +1,60 @@ -var _0x7dad=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x45\x4E\x55\x4D","\x69\x6E\x62\x6F\x75\x6E\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x44\x41\x54\x45","","\x61\x6E\x73\x77\x65\x72\x74\x69\x6D\x65","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5F\x68\x69\x73\x74\x6F\x72\x79","\x48\x69\x73\x74\x6F\x72\x79\x51\x75\x65\x75\x65\x43\x61\x6C\x6C\x73","\x75\x6E\x69\x71\x75\x65\x69\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x48\x69\x73\x74\x6F\x72\x79\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x73","\x64\x65\x66\x69\x6E\x65"];module[_0x7dad[0]]=function(_0xa954x1,_0xa954x2){var _0xa954x3=_0xa954x1[_0x7dad[17]](_0x7dad[1],{uniqueid:{type:_0xa954x2[_0x7dad[2]],unique:true},type:{type:_0xa954x2[_0x7dad[3]],values:[_0x7dad[4],_0x7dad[5],_0x7dad[6]]},tag:_0xa954x2[_0x7dad[2]],accountcode:_0xa954x2[_0x7dad[2]],source:_0xa954x2[_0x7dad[2]],destination:_0xa954x2[_0x7dad[2]],destinationcontext:_0xa954x2[_0x7dad[2]],callerid:_0xa954x2[_0x7dad[2]],channel:_0xa954x2[_0x7dad[2]],destinationchannel:_0xa954x2[_0x7dad[2]],lastapplication:_0xa954x2[_0x7dad[2]],lastdata:_0xa954x2[_0x7dad[2]],starttime:_0xa954x2[_0x7dad[7]],answertime:{type:_0xa954x2[_0x7dad[7]],set:function(_0xa954x4){if(_0xa954x4!==_0x7dad[8]){this[_0x7dad[10]](_0x7dad[9],_0xa954x4)}else {this[_0x7dad[10]](_0x7dad[9],null)}}},endtime:_0xa954x2[_0x7dad[7]],duration:_0xa954x2[_0x7dad[11]],billableseconds:_0xa954x2[_0x7dad[11]],disposition:_0xa954x2[_0x7dad[2]],amaflags:_0xa954x2[_0x7dad[2]],userfield:_0xa954x2[_0x7dad[2]]},{tableName:_0x7dad[12],associate:function(_0xa954x5){_0xa954x3[_0x7dad[15]](_0xa954x5.ReportQueueHistory,{as:_0x7dad[13],foreignKey:_0x7dad[14],constraints:false});_0xa954x3[_0x7dad[15]](_0xa954x5.ReportAgentHistory,{as:_0x7dad[16],foreignKey:_0x7dad[14],constraints:false})}});return _0xa954x3} \ No newline at end of file +/** + * CDR Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportCallHistory = sequelize.define('ReportCallHistory', { + uniqueid: { + type: DataTypes.STRING, + unique: true + }, + type: { + type: DataTypes.ENUM, + values: ['inbound', 'internal', 'outbound'] + }, + tag: DataTypes.STRING, + accountcode: DataTypes.STRING, + source: DataTypes.STRING, + destination: DataTypes.STRING, + destinationcontext: DataTypes.STRING, + callerid: DataTypes.STRING, + channel: DataTypes.STRING, + destinationchannel: DataTypes.STRING, + lastapplication: DataTypes.STRING, + lastdata: DataTypes.STRING, + starttime: DataTypes.DATE, + answertime: { + type: DataTypes.DATE, + set: function(answertime) { + if (answertime !== '') { + this.setDataValue('answertime', answertime); + } else { + this.setDataValue('answertime', null); + } + } + }, + endtime: DataTypes.DATE, + duration: DataTypes.INTEGER, + billableseconds: DataTypes.INTEGER, + disposition: DataTypes.STRING, + amaflags: DataTypes.STRING, + userfield: DataTypes.STRING + }, { + tableName: 'report_call_history', + associate: function(models) { + ReportCallHistory.hasMany(models.ReportQueueHistory, { + as: 'HistoryQueueCalls', + foreignKey: 'uniqueid', + constraints: false + }); + ReportCallHistory.hasMany(models.ReportAgentHistory, { + as: 'HistoryReportAgents', + foreignKey: 'uniqueid', + constraints: false + }); + } + }); + + return ReportCallHistory; +}; diff --git a/server/models/history/report_integration_history.js b/server/models/history/report_integration_history.js index 62db635..d481e00 100644 --- a/server/models/history/report_integration_history.js +++ b/server/models/history/report_integration_history.js @@ -1 +1,86 @@ -var _0x7ab9=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x42\x4F\x4F\x4C\x45\x41\x4E","\x54\x45\x58\x54","\x53\x45\x4E\x54","\x53\x45\x4E\x44\x49\x4E\x47","\x52\x45\x43\x45\x49\x56\x45\x44","\x46\x41\x49\x4C\x45\x44","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x64\x65\x66\x69\x6E\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65"];module[_0x7ab9[0]]=function(_0x8b37x1,_0x8b37x2){var _0x8b37x3=_0x8b37x1[_0x7ab9[12]](_0x7ab9[1],{integration:_0x8b37x2[_0x7ab9[2]],eventChannel:_0x8b37x2[_0x7ab9[2]],exitStatus:_0x8b37x2[_0x7ab9[2]],ticketId:_0x8b37x2[_0x7ab9[2]],integrationId:_0x8b37x2[_0x7ab9[3]],uniqueid:_0x8b37x2[_0x7ab9[2]],calleridnum:_0x8b37x2[_0x7ab9[2]],calleridname:_0x8b37x2[_0x7ab9[2]],queue:_0x8b37x2[_0x7ab9[2]],interface:_0x8b37x2[_0x7ab9[2]],membername:_0x8b37x2[_0x7ab9[2]],agentcalledAt:_0x8b37x2[_0x7ab9[4]],agentconnectAt:_0x8b37x2[_0x7ab9[4]],holdtime:_0x8b37x2[_0x7ab9[3]],agentcomplete:{type:_0x8b37x2[_0x7ab9[5]],defaultValue:false},agentcompleteAt:_0x8b37x2[_0x7ab9[4]],talktime:_0x8b37x2[_0x7ab9[3]],agentacw:{type:_0x8b37x2[_0x7ab9[5]],defaultValue:false},acwtime:_0x8b37x2[_0x7ab9[3]],reason:_0x8b37x2[_0x7ab9[2]],agentringnoanswer:{type:_0x8b37x2[_0x7ab9[5]],defaultValue:false},agentringnoanswerAt:_0x8b37x2[_0x7ab9[4]],agentdump:{type:_0x8b37x2[_0x7ab9[5]],defaultValue:false},agentdumpAt:_0x8b37x2[_0x7ab9[4]],lastevent:_0x8b37x2[_0x7ab9[2]],channel:_0x8b37x2[_0x7ab9[2]],channelstate:_0x8b37x2[_0x7ab9[3]],channelstatedesc:_0x8b37x2[_0x7ab9[2]],connectedlinenum:_0x8b37x2[_0x7ab9[2]],connectedlinename:_0x8b37x2[_0x7ab9[2]],language:_0x8b37x2[_0x7ab9[2]],accountcode:_0x8b37x2[_0x7ab9[2]],context:_0x8b37x2[_0x7ab9[2]],exten:_0x8b37x2[_0x7ab9[2]],priority:_0x8b37x2[_0x7ab9[2]],destchannel:_0x8b37x2[_0x7ab9[2]],destchannelstate:_0x8b37x2[_0x7ab9[3]],destchannelstatedesc:_0x8b37x2[_0x7ab9[2]],destcalleridnum:_0x8b37x2[_0x7ab9[2]],destcalleridname:_0x8b37x2[_0x7ab9[2]],destconnectedlinenum:_0x8b37x2[_0x7ab9[2]],destconnectedlinename:_0x8b37x2[_0x7ab9[2]],destlanguage:_0x8b37x2[_0x7ab9[2]],destaccountcode:_0x8b37x2[_0x7ab9[2]],destcontext:_0x8b37x2[_0x7ab9[2]],destexten:_0x8b37x2[_0x7ab9[2]],destpriority:_0x8b37x2[_0x7ab9[2]],destuniqueid:_0x8b37x2[_0x7ab9[2]],messageId:_0x8b37x2[_0x7ab9[2]],inReplyTo:_0x8b37x2[_0x7ab9[2]],subject:_0x8b37x2[_0x7ab9[2]],from:_0x8b37x2[_0x7ab9[2]],to:_0x8b37x2[_0x7ab9[2]],cc:_0x8b37x2[_0x7ab9[2]],attachment:_0x8b37x2[_0x7ab9[6]],html:_0x8b37x2[_0x7ab9[6]],text:_0x8b37x2[_0x7ab9[6]],status:{type:_0x8b37x2.ENUM(_0x7ab9[7],_0x7ab9[8],_0x7ab9[9],_0x7ab9[10])}},{tableName:_0x7ab9[11]});_0x8b37x3[_0x7ab9[14]](_0x7ab9[13]);return _0x8b37x3} \ No newline at end of file +/** + * report_integrations Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportIntegrationHistory = sequelize.define('ReportIntegrationHistory', { + integration: DataTypes.STRING, + eventChannel: DataTypes.STRING, + exitStatus: DataTypes.STRING, + ticketId: DataTypes.STRING, + integrationId: DataTypes.INTEGER, + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + interface: DataTypes.STRING, + membername: DataTypes.STRING, + agentcalledAt: DataTypes.DATE, + agentconnectAt: DataTypes.DATE, + holdtime: DataTypes.INTEGER, + agentcomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentcompleteAt: DataTypes.DATE, + talktime: DataTypes.INTEGER, + agentacw: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + acwtime: DataTypes.INTEGER, + reason: DataTypes.STRING, + agentringnoanswer: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentringnoanswerAt: DataTypes.DATE, + agentdump: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentdumpAt: DataTypes.DATE, + lastevent: DataTypes.STRING, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + destchannel: DataTypes.STRING, + destchannelstate: DataTypes.INTEGER, + destchannelstatedesc: DataTypes.STRING, + destcalleridnum: DataTypes.STRING, + destcalleridname: DataTypes.STRING, + destconnectedlinenum: DataTypes.STRING, + destconnectedlinename: DataTypes.STRING, + destlanguage: DataTypes.STRING, + destaccountcode: DataTypes.STRING, + destcontext: DataTypes.STRING, + destexten: DataTypes.STRING, + destpriority: DataTypes.STRING, + destuniqueid: DataTypes.STRING, + messageId: DataTypes.STRING, + inReplyTo: DataTypes.STRING, + subject: DataTypes.STRING, + from: DataTypes.STRING, + to: DataTypes.STRING, + cc: DataTypes.STRING, + attachment: DataTypes.TEXT, + html: DataTypes.TEXT, + text: DataTypes.TEXT, + status: { + type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED') + } + }, { + tableName: 'report_integration_history' + }); + + ReportIntegrationHistory.removeAttribute('id'); + return ReportIntegrationHistory; +}; diff --git a/server/models/history/report_mail_session_history.js b/server/models/history/report_mail_session_history.js index 6ae5093..e25f7ae 100644 --- a/server/models/history/report_mail_session_history.js +++ b/server/models/history/report_mail_session_history.js @@ -1 +1,38 @@ -var _0x60e8=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0x60e8[0]);module[_0x60e8[1]]=function(_0x29f5x2,_0x29f5x3){var _0x29f5x4=_0x29f5x2[_0x60e8[7]](_0x60e8[2],{uniqueid:{type:_0x29f5x3[_0x60e8[3]],unique:true},subject:_0x29f5x3[_0x60e8[3]],accountid:_0x29f5x3[_0x60e8[3]],accountname:_0x29f5x3[_0x60e8[3]],accountaddress:_0x29f5x3[_0x60e8[3]],application:_0x29f5x3[_0x60e8[3]],memberid:_0x29f5x3[_0x60e8[3]],membername:_0x29f5x3[_0x60e8[3]],queue:_0x29f5x3[_0x60e8[4]],queuename:_0x29f5x3[_0x60e8[3]],roomid:_0x29f5x3[_0x60e8[4]],fidelity:{type:_0x29f5x3[_0x60e8[4]],defaultValue:0},holdtime:_0x29f5x3[_0x60e8[4]],queuecallerjoinAt:_0x29f5x3[_0x60e8[5]],queuecallerleaveAt:_0x29f5x3[_0x60e8[5]],queuecallerunmanagedAt:_0x29f5x3[_0x60e8[5]],queuecallerabandonedAt:_0x29f5x3[_0x60e8[5]]},{tableName:_0x60e8[6]});return _0x29f5x4} \ No newline at end of file +/** + * Agent Log Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportMailSession = sequelize.define('ReportMailSessionHistory', { + uniqueid: { + type: DataTypes.STRING, + unique: true + }, + subject: DataTypes.STRING, + accountid: DataTypes.STRING, + accountname: DataTypes.STRING, + accountaddress: DataTypes.STRING, + application: DataTypes.STRING, + memberid: DataTypes.STRING, + membername: DataTypes.STRING, + queue: DataTypes.INTEGER, + queuename: DataTypes.STRING, + roomid: DataTypes.INTEGER, + fidelity: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + holdtime: DataTypes.INTEGER, + queuecallerjoinAt: DataTypes.DATE, + queuecallerleaveAt: DataTypes.DATE, + queuecallerunmanagedAt: DataTypes.DATE, + queuecallerabandonedAt: DataTypes.DATE + }, { + tableName: 'report_mail_session_history' + }); + + return ReportMailSession; +}; diff --git a/server/models/history/report_member_history.js b/server/models/history/report_member_history.js index 8e0e5c9..b19ec9b 100644 --- a/server/models/history/report_member_history.js +++ b/server/models/history/report_member_history.js @@ -1 +1,32 @@ -var _0xc76e=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x44\x45\x46\x41\x55\x4C\x54\x20\x50\x41\x55\x53\x45","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72\x5F\x68\x69\x73\x74\x6F\x72\x79","\x64\x65\x66\x69\x6E\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65"];module[_0xc76e[0]]=function(_0x52c1x1,_0x52c1x2){var _0x52c1x3=_0x52c1x1[_0xc76e[7]](_0xc76e[1],{channel:_0x52c1x2[_0xc76e[2]],membername:_0x52c1x2[_0xc76e[2]],interface:_0x52c1x2[_0xc76e[2]],type:{type:_0x52c1x2[_0xc76e[2]],defaultValue:_0xc76e[3]},duration:_0x52c1x2[_0xc76e[4]],enterAt:_0x52c1x2[_0xc76e[5]],exitAt:_0x52c1x2[_0xc76e[5]],data1:_0x52c1x2[_0xc76e[2]],data2:_0x52c1x2[_0xc76e[2]],data3:_0x52c1x2[_0xc76e[2]],data4:_0x52c1x2[_0xc76e[2]],data5:_0x52c1x2[_0xc76e[2]]},{tableName:_0xc76e[6]});_0x52c1x3[_0xc76e[9]](_0xc76e[8]);return _0x52c1x3} \ No newline at end of file +/** + * DIAL Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportMemberHistory = sequelize.define('ReportMemberHistory', { + channel: DataTypes.STRING, + membername: DataTypes.STRING, + interface: DataTypes.STRING, + type: { + type: DataTypes.STRING, + defaultValue: 'DEFAULT PAUSE' + }, + duration: DataTypes.INTEGER, + enterAt: DataTypes.DATE, + exitAt: DataTypes.DATE, + data1: DataTypes.STRING, + data2: DataTypes.STRING, + data3: DataTypes.STRING, + data4: DataTypes.STRING, + data5: DataTypes.STRING + }, { + tableName: 'report_member_history', + // indexes: [{ + // fields: ['membername', 'enterdate', 'exitdate'] + // }] + }); + + ReportMemberHistory.removeAttribute('id'); + return ReportMemberHistory; +}; diff --git a/server/models/history/report_queue_history.js b/server/models/history/report_queue_history.js index 9bbd158..8b1c216 100644 --- a/server/models/history/report_queue_history.js +++ b/server/models/history/report_queue_history.js @@ -1 +1,49 @@ -var _0xa3c3=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x64\x65\x66\x69\x6E\x65","\x69\x64","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65"];module[_0xa3c3[0]]=function(_0xf622x1,_0xf622x2){var _0xf622x3=_0xf622x1[_0xa3c3[7]](_0xa3c3[1],{uniqueid:_0xf622x2[_0xa3c3[2]],calleridnum:_0xf622x2[_0xa3c3[2]],calleridname:_0xf622x2[_0xa3c3[2]],queue:_0xf622x2[_0xa3c3[2]],queuecallerjoinAt:_0xf622x2[_0xa3c3[3]],queuecallerleaveAt:_0xf622x2[_0xa3c3[3]],position:_0xf622x2[_0xa3c3[4]],count:_0xf622x2[_0xa3c3[4]],queuecallerabandon:{type:_0xf622x2[_0xa3c3[5]],defaultValue:false},queuecallerabandonAt:_0xf622x2[_0xa3c3[3]],queuecallercomplete:{type:_0xf622x2[_0xa3c3[5]],defaultValue:false},queuecallercompleteAt:_0xf622x2[_0xa3c3[3]],queuecallerexit:{type:_0xf622x2[_0xa3c3[5]],defaultValue:false},queuecallerexitAt:_0xf622x2[_0xa3c3[3]],queuecallerexitreason:_0xf622x2[_0xa3c3[2]],originalposition:_0xf622x2[_0xa3c3[4]],channel:_0xf622x2[_0xa3c3[2]],channelstate:_0xf622x2[_0xa3c3[4]],channelstatedesc:_0xf622x2[_0xa3c3[2]],connectedlinenum:_0xf622x2[_0xa3c3[2]],connectedlinename:_0xf622x2[_0xa3c3[2]],language:_0xf622x2[_0xa3c3[2]],accountcode:_0xf622x2[_0xa3c3[2]],context:_0xf622x2[_0xa3c3[2]],exten:_0xf622x2[_0xa3c3[2]],priority:_0xf622x2[_0xa3c3[2]]},{tableName:_0xa3c3[6]});_0xf622x3[_0xa3c3[9]](_0xa3c3[8]);return _0xf622x3} \ No newline at end of file +/** + * QueueLog Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportQueueHistory = sequelize.define('ReportQueueHistory', { + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + queuecallerjoinAt: DataTypes.DATE, + queuecallerleaveAt: DataTypes.DATE, + position: DataTypes.INTEGER, + count: DataTypes.INTEGER, + queuecallerabandon: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallerabandonAt: DataTypes.DATE, + queuecallercomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallercompleteAt: DataTypes.DATE, + queuecallerexit: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallerexitAt: DataTypes.DATE, + queuecallerexitreason: DataTypes.STRING, + originalposition: DataTypes.INTEGER, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + }, { + tableName: 'report_queue_history' + }); + + ReportQueueHistory.removeAttribute('id'); + return ReportQueueHistory; +}; diff --git a/server/models/index.js b/server/models/index.js index bc3899f..00e56f7 100644 --- a/server/models/index.js +++ b/server/models/index.js @@ -1 +1,86 @@ -var _0xc876=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x70\x61\x74\x68","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x6D\x6F\x6D\x65\x6E\x74","\x63\x6F\x6E\x66\x69\x67","\x50\x72\x6F\x6D\x69\x73\x65","\x64\x61\x74\x61\x62\x61\x73\x65","\x64\x62","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x68\x6F\x73\x74","\x6D\x79\x73\x71\x6C","\x5A","\x66\x6F\x72\x6D\x61\x74","\x6A\x6F\x69\x6E","\x69\x6D\x70\x6F\x72\x74","\x6E\x61\x6D\x65","\x66\x6F\x72\x45\x61\x63\x68","\x69\x73\x46\x69\x6C\x65","\x6C\x73\x74\x61\x74\x53\x79\x6E\x63","\x2E","\x69\x6E\x64\x65\x78\x4F\x66","\x2E\x73\x70\x65\x63\x2E","\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x66\x69\x6C\x74\x65\x72","\x72\x65\x61\x64\x64\x69\x72\x53\x79\x6E\x63","\x61\x73\x73\x6F\x63\x69\x61\x74\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6F\x70\x74\x69\x6F\x6E\x73","\x6B\x65\x79\x73","\x68\x69\x73\x74\x6F\x72\x79","\x64\x62\x5F\x68\x69\x73\x74\x6F\x72\x79","\x48\x69\x73\x74\x6F\x72\x79\x49\x6E\x62\x6F\x75\x6E\x64\x73","\x73\x6F\x75\x72\x63\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x48\x69\x73\x74\x6F\x72\x79\x4F\x75\x74\x62\x6F\x75\x6E\x64\x73","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x53\x65\x71\x75\x65\x6C\x69\x7A\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xc876[0];var fs=require(_0xc876[1]);var path=require(_0xc876[2]);var config=require(_0xc876[3]);var Sequelize=require(_0xc876[4]);var moment=require(_0xc876[5]);Sequelize[_0xc876[7]][_0xc876[6]]({warnings:{wForgottenReturn:false}});var sequelize= new Sequelize(config[_0xc876[9]][_0xc876[8]],config[_0xc876[9]][_0xc876[10]],config[_0xc876[9]][_0xc876[11]],{host:config[_0xc876[9]][_0xc876[12]],dialect:_0xc876[13],timezone:moment()[_0xc876[15]](_0xc876[14]),logging:false});var db={};fs[_0xc876[27]](__dirname)[_0xc876[26]](function(_0x1c12x8){return (fs[_0xc876[21]](path[_0xc876[16]](__dirname,_0x1c12x8))[_0xc876[20]]())&&(_0x1c12x8[_0xc876[23]](_0xc876[22])!==0)&&(_0x1c12x8[_0xc876[23]](_0xc876[24])=== -1)&&(_0x1c12x8!==_0xc876[25])})[_0xc876[19]](function(_0x1c12x8){var _0x1c12x9=sequelize[_0xc876[17]](path[_0xc876[16]](__dirname,_0x1c12x8));db[_0x1c12x9[_0xc876[18]]]=_0x1c12x9});Object[_0xc876[31]](db)[_0xc876[19]](function(_0x1c12xa){if(db[_0x1c12xa][_0xc876[30]][_0xc876[29]](_0xc876[28])){db[_0x1c12xa][_0xc876[30]][_0xc876[28]](db)}});db[_0xc876[32]]={};var sequelize_history= new Sequelize(config[_0xc876[33]][_0xc876[8]],config[_0xc876[33]][_0xc876[10]],config[_0xc876[33]][_0xc876[11]],{host:config[_0xc876[33]][_0xc876[12]],dialect:_0xc876[13],timezone:moment()[_0xc876[15]](_0xc876[14]),logging:false});fs[_0xc876[27]](path[_0xc876[16]](__dirname,_0xc876[32]))[_0xc876[26]](function(_0x1c12x8){return (fs[_0xc876[21]](path[_0xc876[16]](__dirname,_0xc876[32],_0x1c12x8))[_0xc876[20]]())&&(_0x1c12x8[_0xc876[23]](_0xc876[22])!==0)&&(_0x1c12x8[_0xc876[23]](_0xc876[24])=== -1)&&(_0x1c12x8!==_0xc876[25])})[_0xc876[19]](function(_0x1c12x8){var _0x1c12x9=sequelize_history[_0xc876[17]](path[_0xc876[16]](__dirname,_0xc876[32],_0x1c12x8));db[_0xc876[32]][_0x1c12x9[_0xc876[18]]]=_0x1c12x9});Object[_0xc876[31]](db[_0xc876[32]])[_0xc876[19]](function(_0x1c12xa){if(db[_0xc876[32]][_0x1c12xa][_0xc876[30]][_0xc876[29]](_0xc876[28])){db[_0xc876[32]][_0x1c12xa][_0xc876[30]][_0xc876[28]](db[_0xc876[32]])}});db[_0xc876[37]][_0xc876[36]](db[_0xc876[32]].ReportCallHistory,{as:_0xc876[34],foreignKey:_0xc876[35],constraints:false});db[_0xc876[37]][_0xc876[36]](db[_0xc876[32]].ReportCallHistory,{as:_0xc876[38],foreignKey:_0xc876[39],constraints:false});db[_0xc876[4]]=sequelize;db[_0xc876[40]]=sequelize_history;db[_0xc876[41]]=Sequelize;module[_0xc876[42]]=db \ No newline at end of file +"use strict"; + +var fs = require("fs"); +var path = require("path"); +var config = require('../config/environment'); +var Sequelize = require("sequelize"); +var moment = require('moment'); + +//Used to disable all warnings for Promise! +Sequelize.Promise.config({ + // Enables all warnings except forgotten return statements. + warnings: { + wForgottenReturn: false + } +}); + +var sequelize = new Sequelize(config.db.database, config.db.username, config.db.password, { + host: config.db.host, + dialect: 'mysql', + timezone: moment().format("Z"), + logging: false +}); + +var db = {}; + +fs + .readdirSync(__dirname) + .filter(function(file) { + return (fs.lstatSync(path.join(__dirname, file)).isFile()) && + (file.indexOf(".") !== 0) && (file.indexOf('.spec.') === -1) && (file !== "index.js"); + }) + .forEach(function(file) { + var model = sequelize["import"](path.join(__dirname, file)); + db[model.name] = model; + }); + +// Invoke associations on each of the models +Object.keys(db).forEach(function(modelName) { + if (db[modelName].options.hasOwnProperty('associate')) { + db[modelName].options.associate(db); + } +}); + +db.history = {}; + +var sequelize_history = new Sequelize(config.db_history.database, config.db_history.username, config.db_history.password, { + host: config.db_history.host, + dialect: 'mysql', + timezone: moment().format("Z"), + logging: false +}); + +fs + .readdirSync(path.join(__dirname, 'history')) + .filter(function(file) { + return (fs.lstatSync(path.join(__dirname, 'history', file)).isFile()) && + (file.indexOf(".") !== 0) && (file.indexOf('.spec.') === -1) && (file !== "index.js"); + }) + .forEach(function(file) { + var model = sequelize_history["import"](path.join(__dirname, 'history', file)); + db.history[model.name] = model; + }); + +// Invoke associations on each of the models +Object.keys(db.history).forEach(function(modelName) { + if (db.history[modelName].options.hasOwnProperty('associate')) { + db.history[modelName].options.associate(db.history); + } +}); + +db.ContactPhone.hasMany(db.history.ReportCallHistory, { + as: 'HistoryInbounds', + foreignKey: 'source', + constraints: false +}); +db.ContactPhone.hasMany(db.history.ReportCallHistory, { + as: 'HistoryOutbounds', + foreignKey: 'destination', + constraints: false +}); + +db.sequelize = sequelize; +db.sequelize_history = sequelize_history; +db.Sequelize = Sequelize; + +module.exports = db; diff --git a/server/models/integration.js b/server/models/integration.js index 6135aad..1cbee6f 100644 --- a/server/models/integration.js +++ b/server/models/integration.js @@ -1 +1,65 @@ -var _0xc206=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x75\x6E\x69\x71\x75\x65\x5F\x6E\x61\x6D\x65\x5F\x61\x6E\x64\x5F\x76\x65\x72\x73\x69\x6F\x6E","\x61\x70\x70\x2E\x6A\x73","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x64\x65\x66\x69\x6E\x65"];_0xc206[0];module[_0xc206[1]]=function(_0xdfaex1,_0xdfaex2){var _0xdfaex3=_0xdfaex1[_0xc206[9]](_0xc206[2],{name:{type:_0xdfaex2[_0xc206[3]],allowNull:false,unique:_0xc206[4],validate:{notEmpty:true}},version:{type:_0xdfaex2[_0xc206[3]],allowNull:false,unique:_0xc206[4],validate:{notEmpty:true}},main:{type:_0xdfaex2[_0xc206[3]],defaultValue:_0xc206[5]},filename:{type:_0xdfaex2[_0xc206[3]]},path:{type:_0xdfaex2[_0xc206[3]]},type:{type:_0xdfaex2[_0xc206[3]]},size:{type:_0xdfaex2[_0xc206[6]]},active:{type:_0xdfaex2[_0xc206[7]],defaultValue:false},author:_0xdfaex2[_0xc206[3]],logo:_0xdfaex2[_0xc206[3]],state:{type:_0xdfaex2[_0xc206[3]],unique:true},description:_0xdfaex2[_0xc206[3]]},{tableName:_0xc206[8]});return _0xdfaex3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Integration = sequelize.define('Integration', { + name: { + type: DataTypes.STRING, + allowNull: false, + unique: 'unique_name_and_version', + validate: { + notEmpty: true + } + }, + version: { + type: DataTypes.STRING, + allowNull: false, + unique: 'unique_name_and_version', + validate: { + notEmpty: true + } + }, + main: { + type: DataTypes.STRING, + defaultValue: 'app.js' + }, + filename: { + type: DataTypes.STRING, + // allowNull: false, + // validate: { + // notEmpty: true + // } + }, + path: { + type: DataTypes.STRING, + // allowNull: false, + // validate: { + // notEmpty: true + // } + }, + type: { + type: DataTypes.STRING, + // allowNull: false + }, + size: { + type: DataTypes.INTEGER, + // allowNull: false + }, + active: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + author: DataTypes.STRING, + logo: DataTypes.STRING, + state: { + type: DataTypes.STRING, + unique: true + }, + description: DataTypes.STRING + }, { + tableName: 'integrations' + }); + + return Integration; + +}; diff --git a/server/models/interval.js b/server/models/interval.js index 99d72dd..19e66f4 100644 --- a/server/models/interval.js +++ b/server/models/interval.js @@ -1 +1,53 @@ -var _0x4d2b=["\x65\x78\x70\x6F\x72\x74\x73","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x53\x54\x52\x49\x4E\x47","\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x53\x75\x62\x49\x6E\x74\x65\x72\x76\x61\x6C\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x72\x65\x73\x74\x72\x69\x63\x74","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x75\x62\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x6E\x61\x6D\x65","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0x4d2b[0]]=function(_0x4229x1,_0x4229x2){var _0x4229x3=_0x4229x1[_0x4d2b[16]](_0x4d2b[1],{name:{type:_0x4229x2[_0x4d2b[2]]},description:_0x4229x2[_0x4d2b[2]],interval:{type:_0x4229x2[_0x4d2b[2]],allowNull:true}},{tableName:_0x4d2b[3],associate:function(_0x4229x4){_0x4229x3[_0x4d2b[6]](_0x4229x4.Interval,{as:_0x4d2b[4],onDelete:_0x4d2b[5],hooks:true,required:false});_0x4229x3[_0x4d2b[6]](_0x4229x4.VoiceExtension,{as:_0x4d2b[7],foreignKey:_0x4d2b[8],onDelete:_0x4d2b[9]});_0x4229x3[_0x4d2b[6]](_0x4229x4.MailApplication,{as:_0x4d2b[10]});_0x4229x3[_0x4d2b[6]](_0x4229x4.MailApplication,{as:_0x4d2b[11]});_0x4229x3[_0x4d2b[15]](_0x4d2b[12],{include:[{model:_0x4229x4[_0x4d2b[1]],as:_0x4d2b[4],required:false,attributes:[_0x4d2b[13],_0x4d2b[14]]}]});_0x4229x3[_0x4d2b[15]](_0x4d2b[3],{where:{IntervalId:null}})}});return _0x4229x3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var Interval = sequelize.define('Interval', { + name: { + type: DataTypes.STRING + }, + description: DataTypes.STRING, + interval: { + type: DataTypes.STRING, + allowNull: true + } + }, { + tableName: 'intervals', + associate: function(models) { + Interval.hasMany(models.Interval, { + as: 'SubIntervals', + onDelete: 'cascade', + hooks: true, + required: false + }); + Interval.hasMany(models.VoiceExtension, { + as: 'VoiceExtensions', + foreignKey: 'IntervalId', + onDelete: 'restrict' + }); + Interval.hasMany(models.MailApplication, { + as: 'MailApplications' + }); + Interval.hasMany(models.MailApplication, { + as: 'ChatApplications' + }); + // SCOPES MANAGEMENT + Interval.addScope('subintervals', { + include: [{ + model: models.Interval, + as: 'SubIntervals', + required: false, + attributes: ['name', 'interval'] + }] + }); + + Interval.addScope('intervals', { + where: { + IntervalId: null + } + }); + } + }); + + + return Interval; +}; diff --git a/server/models/jscripty_project.js b/server/models/jscripty_project.js index 95a906c..c31f2e2 100644 --- a/server/models/jscripty_project.js +++ b/server/models/jscripty_project.js @@ -1 +1,30 @@ -var _0xe963=["\x65\x78\x70\x6F\x72\x74\x73","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x70\x72\x6F\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0xe963[0]]=function(_0xd7e8x1,_0xd7e8x2){var _0xd7e8x3=_0xd7e8x1[_0xe963[7]](_0xe963[1],{name:{type:_0xd7e8x2[_0xe963[2]],unique:true},description:_0xd7e8x2[_0xe963[2]],draft:_0xd7e8x2[_0xe963[3]],production:_0xd7e8x2[_0xe963[3]]},{tableName:_0xe963[4],associate:function(_0xd7e8x4){_0xd7e8x3[_0xe963[6]](_0xd7e8x4.ReportJscriptySession,{foreignKey:_0xe963[5]});_0xd7e8x3[_0xe963[6]](_0xd7e8x4.ReportJscriptyQuestion,{foreignKey:_0xe963[5]})}});return _0xd7e8x3} \ No newline at end of file +/** + * Fax Room Model + */ + +module.exports = function(sequelize, DataTypes) { + + var JscriptyProject = sequelize.define('JscriptyProject', { + name: { + type: DataTypes.STRING, + unique: true + }, + description: DataTypes.STRING, + draft: DataTypes.TEXT, + production: DataTypes.TEXT + }, { + tableName: 'jscripty_projects', + associate: function(models) { + JscriptyProject.hasMany(models.ReportJscriptySession, { + // as: 'sessions', + foreignKey: 'projectId' + }); + JscriptyProject.hasMany(models.ReportJscriptyQuestion, { + // as: 'questions', + foreignKey: 'projectId' + }); + } + }); + + return JscriptyProject; +}; diff --git a/server/models/mail_account.js b/server/models/mail_account.js index 1f3071b..84f4aa6 100644 --- a/server/models/mail_account.js +++ b/server/models/mail_account.js @@ -1 +1,66 @@ -var _0xf356=["\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x49\x4E\x54\x45\x47\x45\x52","\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4F\x6E\x65","\x64\x65\x66\x61\x75\x6C\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x69\x64","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x73\x6C","\x64\x65\x6C\x65\x74\x65","\x66\x69\x6C\x74\x65\x72","\x73\x74\x61\x74\x65","\x6D\x61\x69\x6C\x62\x6F\x78","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x73\x65\x72\x76\x69\x63\x65","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x55\x73\x65\x72","\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0xf356[0]]=function(_0x7973x1,_0x7973x2){var _0x7973x3=_0x7973x1[_0xf356[31]](_0xf356[1],{description:_0x7973x2[_0xf356[2]],name:{type:_0x7973x2[_0xf356[2]]},address:{type:_0x7973x2[_0xf356[2]],unique:true},fidelity:{type:_0x7973x2[_0xf356[3]],defaultValue:false},timeout:{type:_0x7973x2[_0xf356[4]],defaultValue:0}},{tableName:_0xf356[5],associate:function(_0x7973x4){_0x7973x3[_0xf356[6]](_0x7973x4.MailRoom);_0x7973x3[_0xf356[6]](_0x7973x4.MailApplication);_0x7973x3[_0xf356[8]](_0x7973x4.MailServerIn,{onDelete:_0xf356[7],hooks:true});_0x7973x3[_0xf356[8]](_0x7973x4.MailServerOut,{onDelete:_0xf356[7],hooks:true});_0x7973x3[_0xf356[30]](_0xf356[9],{include:[{model:_0x7973x4[_0xf356[10]],attributes:[_0xf356[11],_0xf356[12],_0xf356[13],_0xf356[14],_0xf356[15],_0xf356[16],_0xf356[17],_0xf356[18],_0xf356[19],_0xf356[20]]},{model:_0x7973x4[_0xf356[21]],attributes:[_0xf356[11],_0xf356[12],_0xf356[13],_0xf356[14],_0xf356[15],_0xf356[16],_0xf356[22],_0xf356[19]]},{model:_0x7973x4[_0xf356[23]],include:[{model:_0x7973x4[_0xf356[24]],attributes:[_0xf356[11],_0xf356[25],_0xf356[26],_0xf356[27],_0xf356[28]]},{model:_0x7973x4[_0xf356[29]]}]}]})}});return _0x7973x3} \ No newline at end of file +/** + * Chat Website Model + */ + +module.exports = function(sequelize, DataTypes) { + + var MailAccount = sequelize.define('MailAccount', { + description: DataTypes.STRING, + name: { + type: DataTypes.STRING + }, + address: { + type: DataTypes.STRING, + unique: true + }, + fidelity: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + timeout: { + type: DataTypes.INTEGER, + defaultValue: 0 + } + }, { + tableName: 'mail_accounts', + associate: function(models) { + // RELATIONS + MailAccount.hasMany(models.MailRoom); + MailAccount.hasMany(models.MailApplication); + MailAccount.hasOne(models.MailServerIn, { + onDelete: 'cascade', + hooks: true + }); + MailAccount.hasOne(models.MailServerOut, { + onDelete: 'cascade', + hooks: true + }); + + // SCOPES + MailAccount.addScope('default', { + include: [{ + model: models.MailServerIn, + attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'delete', 'filter', 'state', 'mailbox'] + }, { + model: models.MailServerOut, + attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'service', 'state'] + }, { + model: models.MailApplication, + include: [{ + model: models.User, + attributes: ['id', + 'name', + 'email', + 'internal', + 'fullname' + ] + }, { + model: models.MailQueue + }] + }] + }); + } + }); + + return MailAccount; +}; diff --git a/server/models/mail_application.js b/server/models/mail_application.js index b3fabb7..f4a7a03 100644 --- a/server/models/mail_application.js +++ b/server/models/mail_application.js @@ -1 +1,36 @@ -var _0x6516=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65","\x61\x67\x65\x6E\x74","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x72\x65\x73\x74\x72\x69\x63\x74","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x6516[0];module[_0x6516[1]]=function(_0xb106x1,_0xb106x2){var _0xb106x3=_0xb106x1[_0x6516[10]](_0x6516[2],{app:{type:_0xb106x2.ENUM(_0x6516[3],_0x6516[4])},priority:{type:_0xb106x2[_0x6516[5]]},timeout:{type:_0xb106x2[_0x6516[5]]},interval:{type:_0xb106x2[_0x6516[6]]}},{tableName:_0x6516[7],associate:function(_0xb106x4){_0xb106x3[_0x6516[9]](_0xb106x4.User,{onDelete:_0x6516[8]});_0xb106x3[_0x6516[9]](_0xb106x4.Interval);_0xb106x3[_0x6516[9]](_0xb106x4.MailQueue,{onDelete:_0x6516[8]});_0xb106x3[_0x6516[9]](_0xb106x4.MailAccount,{onDelete:_0x6516[8]})}});return _0xb106x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var MailApplication = sequelize.define('MailApplication', { + app: { + type: DataTypes.ENUM('queue', 'agent') + }, + priority: { + type: DataTypes.INTEGER + }, + timeout: { + type: DataTypes.INTEGER + }, + interval: { + type: DataTypes.STRING + } + }, { + tableName: 'mail_applications', + associate: function(models) { + // hasMany relations + MailApplication.belongsTo(models.User, { + onDelete: 'restrict' + }); + MailApplication.belongsTo(models.Interval); + MailApplication.belongsTo(models.MailQueue, { + onDelete: 'restrict' + }); + MailApplication.belongsTo(models.MailAccount, { + onDelete: 'restrict' + }); + } + }); + + return MailApplication; +}; diff --git a/server/models/mail_attachment.js b/server/models/mail_attachment.js index 37d66d6..9b2efb5 100644 --- a/server/models/mail_attachment.js +++ b/server/models/mail_attachment.js @@ -1 +1,21 @@ -var _0xdf40=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xdf40[0]);module[_0xdf40[1]]=function(_0x733cx2,_0x733cx3){var _0x733cx4=_0x733cx2[_0xdf40[6]](_0xdf40[2],{domain:_0x733cx3[_0xdf40[3]],size:_0x733cx3[_0xdf40[4]],path:_0x733cx3[_0xdf40[3]],name:_0x733cx3[_0xdf40[3]],basename:_0x733cx3[_0xdf40[3]],type:_0x733cx3[_0xdf40[3]]},{tableName:_0xdf40[5]});return _0x733cx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function (sequelize, DataTypes) { + + var MailAttachment = sequelize.define('MailAttachment', { + domain: DataTypes.STRING, + size: DataTypes.INTEGER, + path: DataTypes.STRING, + name: DataTypes.STRING, + basename: DataTypes.STRING, + type: DataTypes.STRING + }, { + tableName: 'mail_attachments' + }); + + return MailAttachment; +}; diff --git a/server/models/mail_automation.js b/server/models/mail_automation.js index 3994d1a..218cb9c 100644 --- a/server/models/mail_automation.js +++ b/server/models/mail_automation.js @@ -1 +1,23 @@ -var _0x2b4c=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x42\x4F\x4F\x4C\x45\x41\x4E","\x6D\x61\x69\x6C\x5F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x2b4c[0]);module[_0x2b4c[1]]=function(_0xcaabx2,_0xcaabx3){var _0xcaabx4=_0xcaabx2[_0x2b4c[7]](_0x2b4c[2],{name:_0xcaabx3[_0x2b4c[3]],description:_0xcaabx3[_0x2b4c[3]],conditions:_0xcaabx3[_0x2b4c[4]],actions:_0xcaabx3[_0x2b4c[4]],status:{type:_0xcaabx3[_0x2b4c[5]],defaultValue:false}},{tableName:_0x2b4c[6]});return _0xcaabx4} \ No newline at end of file +/** + * User Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var MailAutomation = sequelize.define('MailAutomation', { + name: DataTypes.STRING, + description: DataTypes.STRING, + conditions: DataTypes.TEXT, + actions: DataTypes.TEXT, + status: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'mail_automations' + }); + + return MailAutomation; +}; diff --git a/server/models/mail_message.js b/server/models/mail_message.js index ee50842..50675a7 100644 --- a/server/models/mail_message.js +++ b/server/models/mail_message.js @@ -1 +1,88 @@ -var _0x5d00=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x53\x54\x52\x49\x4E\x47","\x66\x72\x6F\x6D","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x3B","\x73\x70\x6C\x69\x74","\x6A\x6F\x69\x6E","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x74\x6F","\x63\x63","\x62\x63\x63","\x54\x45\x58\x54","\x42\x4C\x4F\x42","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x53\x45\x4E\x54","\x53\x45\x4E\x44\x49\x4E\x47","\x52\x45\x43\x45\x49\x56\x45\x44","\x46\x41\x49\x4C\x45\x44","\x4E\x4F\x54\x45","\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x63\x61\x73\x63\x61\x64\x65","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x5d00[0]);module[_0x5d00[1]]=function(_0xd0cax2,_0xd0cax3){var _0xd0cax4=_0xd0cax2[_0x5d00[26]](_0x5d00[2],{messageId:_0xd0cax3[_0x5d00[3]],inReplyTo:_0xd0cax3[_0x5d00[3]],subject:_0xd0cax3[_0x5d00[3]],from:{type:_0xd0cax3[_0x5d00[3]],get:function(){return this[_0x5d00[5]](_0x5d00[4])?this[_0x5d00[5]](_0x5d00[4])[_0x5d00[7]](_0x5d00[6]):[]},set:function(_0xd0cax5){this[_0x5d00[9]](_0x5d00[4],_0xd0cax5[_0x5d00[8]](_0x5d00[6]))}},to:{type:_0xd0cax3[_0x5d00[3]],get:function(){return this[_0x5d00[5]](_0x5d00[10])?this[_0x5d00[5]](_0x5d00[10])[_0x5d00[7]](_0x5d00[6]):[]},set:function(_0xd0cax5){this[_0x5d00[9]](_0x5d00[10],_0xd0cax5[_0x5d00[8]](_0x5d00[6]))}},cc:{type:_0xd0cax3[_0x5d00[3]],get:function(){return this[_0x5d00[5]](_0x5d00[11])?this[_0x5d00[5]](_0x5d00[11])[_0x5d00[7]](_0x5d00[6]):[]},set:function(_0xd0cax5){this[_0x5d00[9]](_0x5d00[11],_0xd0cax5[_0x5d00[8]](_0x5d00[6]))}},bcc:{type:_0xd0cax3[_0x5d00[3]],get:function(){return this[_0x5d00[5]](_0x5d00[12])?this[_0x5d00[5]](_0x5d00[12])[_0x5d00[7]](_0x5d00[6]):[]},set:function(_0xd0cax5){this[_0x5d00[9]](_0x5d00[12],_0xd0cax5[_0x5d00[8]](_0x5d00[6]))}},attachment:_0xd0cax3[_0x5d00[13]],text:{type:_0xd0cax3[_0x5d00[14]],get:function(){if(this[_0x5d00[5]](_0x5d00[15])){return this[_0x5d00[5]](_0x5d00[15]).toString()}}},html:{type:_0xd0cax3[_0x5d00[14]],get:function(){if(this[_0x5d00[5]](_0x5d00[16])){return this[_0x5d00[5]](_0x5d00[16]).toString()}}},reason:_0xd0cax3[_0x5d00[13]],status:{type:_0xd0cax3.ENUM(_0x5d00[17],_0x5d00[18],_0x5d00[19],_0x5d00[20],_0x5d00[21]),defaultValue:_0x5d00[18]}},{tableName:_0x5d00[22],paranoid:true,associate:function(_0xd0cax6){_0xd0cax4[_0x5d00[23]](_0xd0cax6.MailAttachment);_0xd0cax4[_0x5d00[24]](_0xd0cax6.User);_0xd0cax4[_0x5d00[24]](_0xd0cax6.MailRoom,{onDelete:_0x5d00[25]});_0xd0cax4[_0x5d00[24]](_0xd0cax6.ContactEmail,{foreignKey:_0x5d00[4],constraints:false})}});return _0xd0cax4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var MailMessage = sequelize.define('MailMessage', { + messageId: DataTypes.STRING, + inReplyTo: DataTypes.STRING, + subject: DataTypes.STRING, + from: { + type: DataTypes.STRING, + get: function() { + return this.getDataValue('from') ? this.getDataValue('from').split(';') : []; + }, + set: function(val) { + this.setDataValue('from', val.join(';')); + } + }, + to: { + type: DataTypes.STRING, + get: function() { + return this.getDataValue('to') ? this.getDataValue('to').split(';') : []; + }, + set: function(val) { + this.setDataValue('to', val.join(';')); + } + }, + cc: { + type: DataTypes.STRING, + get: function() { + return this.getDataValue('cc') ? this.getDataValue('cc').split(';') : []; + }, + set: function(val) { + this.setDataValue('cc', val.join(';')); + } + }, + bcc: { + type: DataTypes.STRING, + get: function() { + return this.getDataValue('bcc') ? this.getDataValue('bcc').split(';') : []; + }, + set: function(val) { + this.setDataValue('bcc', val.join(';')); + } + }, + attachment: DataTypes.TEXT, + text: { + type: DataTypes.BLOB, + get: function() { + if (this.getDataValue('text')) { + return this.getDataValue('text').toString(); + } + } + }, + html: { + type: DataTypes.BLOB, + get: function() { + if (this.getDataValue('html')) { + return this.getDataValue('html').toString(); + } + } + }, + reason: DataTypes.TEXT, + status: { + type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE'), + defaultValue: 'SENDING' + } + }, { + tableName: 'mail_messages', + paranoid: true, + associate: function(models) { + MailMessage.hasMany(models.MailAttachment); + MailMessage.belongsTo(models.User); + MailMessage.belongsTo(models.MailRoom, { + onDelete: 'cascade' + }); + MailMessage.belongsTo(models.ContactEmail, { + foreignKey: 'from', + constraints: false + }); + } + }); + + return MailMessage; +}; diff --git a/server/models/mail_queue.js b/server/models/mail_queue.js index 8bfb38f..421dc37 100644 --- a/server/models/mail_queue.js +++ b/server/models/mail_queue.js @@ -1 +1,37 @@ -var _0x4147=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x73","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x61\x75\x6C\x74","\x55\x73\x65\x72","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x6F\x6E\x6C\x69\x6E\x65","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x6D\x61\x69\x6C\x50\x61\x75\x73\x65","\x70\x61\x75\x73\x65\x54\x79\x70\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x4147[0];module[_0x4147[1]]=function(_0x4c86x1,_0x4c86x2){var _0x4c86x3=_0x4c86x1[_0x4147[21]](_0x4147[2],{name:{type:_0x4c86x2[_0x4147[3]],unique:true},description:{type:_0x4c86x2[_0x4147[3]]},timeout:{type:_0x4c86x2[_0x4147[4]]},strategy:{type:_0x4c86x2.ENUM(_0x4147[5],_0x4147[6])}},{tableName:_0x4147[7],associate:function(_0x4c86x4){_0x4c86x3[_0x4147[9]](_0x4c86x4.User,{through:_0x4c86x4[_0x4147[8]]});_0x4c86x3[_0x4147[20]](_0x4147[10],{include:[{model:_0x4c86x4[_0x4147[11]],attributes:[_0x4147[12],_0x4147[13],_0x4147[14],_0x4147[15],_0x4147[16],_0x4147[17],_0x4147[18],_0x4147[19]]}]})}});return _0x4c86x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var MailQueue = sequelize.define('MailQueue', { + name: { + type: DataTypes.STRING, + unique: true + }, + description: { + type: DataTypes.STRING, + }, + timeout: { + type: DataTypes.INTEGER, + }, + strategy: { + type: DataTypes.ENUM('rrmemory', 'beepall') + } + }, { + tableName: 'mail_queues', + associate: function(models) { + // RELATIONS + MailQueue.belongsToMany(models.User, { + through: models.UserHasMailQueue + }); + //SCOPES + MailQueue.addScope('default', { + include: [{ + model: models.User, + attributes: ['id', 'name', 'fullname', 'email', 'online', 'lastLoginAt', 'mailPause', 'pauseType'] + }] + }); + } + }); + + return MailQueue; +}; diff --git a/server/models/mail_room.js b/server/models/mail_room.js index 1e13234..13d7977 100644 --- a/server/models/mail_room.js +++ b/server/models/mail_room.js @@ -1 +1,63 @@ -var _0xea10=["\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x4E\x45\x57","\x4F\x50\x45\x4E","\x43\x4C\x4F\x53\x45\x44","\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x61\x75\x6C\x74","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x61\x64\x64\x53\x63\x6F\x70\x65","\x61\x67\x65\x6E\x74","\x64\x65\x66\x69\x6E\x65"];module[_0xea10[0]]=function(_0xeca7x1,_0xeca7x2){var _0xeca7x3=_0xeca7x1[_0xea10[25]](_0xea10[1],{subject:_0xeca7x2[_0xea10[2]],from:_0xeca7x2[_0xea10[2]],attachment:{type:_0xeca7x2[_0xea10[3]],defaultValue:false},status:{type:_0xeca7x2.ENUM(_0xea10[4],_0xea10[5],_0xea10[6]),defaultValue:_0xea10[4]}},{tableName:_0xea10[7],paranoid:true,associate:function(_0xeca7x4){_0xeca7x3[_0xea10[8]](_0xeca7x4.MailMessage);_0xeca7x3[_0xea10[9]](_0xeca7x4.MailAccount);_0xeca7x3[_0xea10[11]](_0xeca7x4.User,{through:_0xea10[10]});_0xeca7x3[_0xea10[23]](_0xea10[12],{order:[[_0xea10[13],_0xea10[14]]],include:[{model:_0xeca7x4[_0xea10[15]]},{model:_0xeca7x4[_0xea10[16]],include:[{model:_0xeca7x4[_0xea10[17]]},{model:_0xeca7x4[_0xea10[18]],attributes:[_0xea10[19],_0xea10[20],_0xea10[21],_0xea10[22]]}]},{model:_0xeca7x4[_0xea10[18]],attributes:[_0xea10[19],_0xea10[20],_0xea10[21],_0xea10[22]]}]});_0xeca7x3[_0xea10[23]](_0xea10[24],function(_0xeca7x5){return {include:[{model:_0xeca7x4[_0xea10[18]],where:{id:_0xeca7x5}}]}})}});return _0xeca7x3} \ No newline at end of file +/** + * Chat Website Model + */ + + +module.exports = function(sequelize, DataTypes) { + var MailRoom = sequelize.define('MailRoom', { + subject: DataTypes.STRING, + from: DataTypes.STRING, + attachment: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + status: { + type: DataTypes.ENUM('NEW', 'OPEN', 'CLOSED'), + defaultValue: 'NEW' + } + }, { + tableName: 'mail_rooms', + paranoid: true, + associate: function(models) { + // BINDING + MailRoom.hasMany(models.MailMessage); + MailRoom.belongsTo(models.MailAccount); + MailRoom.belongsToMany(models.User, { + through: 'user_has_mail_rooms' + }); + // SCOPES + MailRoom.addScope('default', { + order: [ + ['createdAt', 'DESC'] + ], + include: [{ + model: models.MailAccount + }, { + model: models.MailMessage, + include: [{ + model: models.MailAttachment + }, { + model: models.User, + attributes: ['id', 'name', 'fullname', 'email'] + }] + }, { + model: models.User, + attributes: ['id', 'name', 'fullname', 'email'] + }] + }); + + MailRoom.addScope('agent', function(id) { + return { + include: [{ + model: models.User, + where: { + id: id + } + }] + } + }); + } + }); + + return MailRoom; +}; diff --git a/server/models/mail_room_status.js b/server/models/mail_room_status.js index c8b73ba..20b29e9 100644 --- a/server/models/mail_room_status.js +++ b/server/models/mail_room_status.js @@ -1 +1,14 @@ -var _0x75fe=["\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x53\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x41\x53\x53\x49\x47\x4E\x45\x44","\x52\x45\x50\x4C\x49\x45\x44","\x41\x52\x43\x48\x49\x56\x45\x44","\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x5F\x73\x74\x61\x74\x65\x73","\x64\x65\x66\x69\x6E\x65"];module[_0x75fe[0]]=function(_0xacb2x1,_0xacb2x2){var _0xacb2x3=_0xacb2x1[_0x75fe[7]](_0x75fe[1],{status:_0xacb2x2.ENUM(_0x75fe[2],_0x75fe[3],_0x75fe[4],_0x75fe[5])},{tableName:_0x75fe[6]});return _0xacb2x3} \ No newline at end of file +/** + * Chat Website Model + */ + +module.exports = function(sequelize, DataTypes) { + + var MailRoomStatus = sequelize.define('MailRoomStatus', { + status: DataTypes.ENUM('RECEIVED', 'ASSIGNED', 'REPLIED', 'ARCHIVED') + }, { + tableName: 'mail_room_states' + }); + + return MailRoomStatus; +}; diff --git a/server/models/mail_server_in.js b/server/models/mail_server_in.js index 80e74c6..bb7f978 100644 --- a/server/models/mail_server_in.js +++ b/server/models/mail_server_in.js @@ -1 +1,44 @@ -var _0x13d6=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x55\x4E\x53\x45\x45\x4E","\x49\x4D\x41\x50","\x50\x4F\x50\x33","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x45\x52\x52\x4F\x52","\x55\x4E\x4B\x4E\x4F\x57\x4E","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x73\x5F\x69\x6E","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x13d6[0]);module[_0x13d6[1]]=function(_0xda3cx2,_0xda3cx3){var _0xda3cx4=_0xda3cx2[_0x13d6[14]](_0x13d6[2],{description:_0xda3cx3[_0x13d6[3]],host:_0xda3cx3[_0x13d6[3]],username:{type:_0xda3cx3[_0x13d6[3]],unique:true},password:_0xda3cx3[_0x13d6[3]],port:_0xda3cx3[_0x13d6[4]],mailbox:_0xda3cx3[_0x13d6[3]],ssl:{type:_0xda3cx3[_0x13d6[5]],defaultValue:false},delete:{type:_0xda3cx3[_0x13d6[5]],defaultValue:false},filter:{type:_0xda3cx3.ENUM(_0x13d6[6]),defaultValue:_0x13d6[6]},protocol:{type:_0xda3cx3.ENUM(_0x13d6[7],_0x13d6[8]),defaultValue:_0x13d6[7]},state:{type:_0xda3cx3.ENUM(_0x13d6[9],_0x13d6[10],_0x13d6[11],_0x13d6[12]),defaultValue:_0x13d6[12]}},{tableName:_0x13d6[13]});return _0xda3cx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var MailServerIn = sequelize.define('MailServerIn', { + description: DataTypes.STRING, + host: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + password: DataTypes.STRING, + port: DataTypes.INTEGER, + mailbox: DataTypes.STRING, + ssl: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + delete: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + filter: { + type: DataTypes.ENUM('UNSEEN'), + defaultValue: 'UNSEEN' + }, + protocol: { + type: DataTypes.ENUM('IMAP', 'POP3'), + defaultValue: 'IMAP' + }, + state: { + type: DataTypes.ENUM('CONNECTED', 'DISCONNECTED', 'ERROR', 'UNKNOWN'), + defaultValue: 'UNKNOWN' + } + }, { + tableName: 'mail_servers_in' + }); + + return MailServerIn; +}; diff --git a/server/models/mail_server_out.js b/server/models/mail_server_out.js index b74b0f8..5394b23 100644 --- a/server/models/mail_server_out.js +++ b/server/models/mail_server_out.js @@ -1 +1,32 @@ -var _0x1309=["\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x45\x52\x52\x4F\x52","\x55\x4E\x4B\x4E\x4F\x57\x4E","\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x73\x5F\x6F\x75\x74","\x64\x65\x66\x69\x6E\x65"];module[_0x1309[0]]=function(_0xa025x1,_0xa025x2){var _0xa025x3=_0xa025x1[_0x1309[10]](_0x1309[1],{description:_0xa025x2[_0x1309[2]],host:_0xa025x2[_0x1309[2]],username:{type:_0xa025x2[_0x1309[2]],unique:true},password:_0xa025x2[_0x1309[2]],port:_0xa025x2[_0x1309[3]],ssl:{type:_0xa025x2[_0x1309[4]],defaultValue:false},service:{type:_0xa025x2[_0x1309[4]],defaultValue:false},state:{type:_0xa025x2.ENUM(_0x1309[5],_0x1309[6],_0x1309[7],_0x1309[8]),defaultValue:_0x1309[8]}},{tableName:_0x1309[9]});return _0xa025x3} \ No newline at end of file +/** + * + */ +module.exports = function(sequelize, DataTypes) { + + var MailServerOut = sequelize.define('MailServerOut', { + description: DataTypes.STRING, + host: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + password: DataTypes.STRING, + port: DataTypes.INTEGER, + ssl: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + service: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + state: { + type: DataTypes.ENUM('CONNECTED', 'DISCONNECTED', 'ERROR', 'UNKNOWN'), + defaultValue: 'UNKNOWN' + }, + }, { + tableName: 'mail_servers_out' + }); + + return MailServerOut; +}; diff --git a/server/models/mail_template.js b/server/models/mail_template.js index 61d7f8e..4856564 100644 --- a/server/models/mail_template.js +++ b/server/models/mail_template.js @@ -1 +1,21 @@ -var _0x690b=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x54\x65\x6D\x70\x6C\x61\x74\x65","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x690b[0]);module[_0x690b[1]]=function(_0x1f93x2,_0x1f93x3){var _0x1f93x4=_0x1f93x2[_0x690b[6]](_0x690b[2],{name:_0x1f93x3[_0x690b[3]],description:_0x1f93x3[_0x690b[3]],subject:_0x1f93x3[_0x690b[3]],attachment:_0x1f93x3[_0x690b[4]],html:_0x1f93x3[_0x690b[4]],text:_0x1f93x3[_0x690b[4]]},{tableName:_0x690b[5]});return _0x1f93x4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var MailTemplate = sequelize.define('MailTemplate', { + name: DataTypes.STRING, + description: DataTypes.STRING, + subject: DataTypes.STRING, + attachment: DataTypes.TEXT, + html: DataTypes.TEXT, + text: DataTypes.TEXT + }, { + tableName: 'mail_templates' + }); + + return MailTemplate; +}; diff --git a/server/models/mail_trigger.js b/server/models/mail_trigger.js index f8ccd72..73be985 100644 --- a/server/models/mail_trigger.js +++ b/server/models/mail_trigger.js @@ -1 +1,23 @@ -var _0xd5a2=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x61\x69\x6C\x54\x72\x69\x67\x67\x65\x72","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x42\x4F\x4F\x4C\x45\x41\x4E","\x6D\x61\x69\x6C\x5F\x74\x72\x69\x67\x67\x65\x72\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xd5a2[0]);module[_0xd5a2[1]]=function(_0x4520x2,_0x4520x3){var _0x4520x4=_0x4520x2[_0xd5a2[7]](_0xd5a2[2],{name:_0x4520x3[_0xd5a2[3]],description:_0x4520x3[_0xd5a2[3]],conditions:_0x4520x3[_0xd5a2[4]],actions:_0x4520x3[_0xd5a2[4]],status:{type:_0x4520x3[_0xd5a2[5]],defaultValue:false}},{tableName:_0xd5a2[6]});return _0x4520x4} \ No newline at end of file +/** + * User Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var MailTrigger = sequelize.define('MailTrigger', { + name: DataTypes.STRING, + description: DataTypes.STRING, + conditions: DataTypes.TEXT, + actions: DataTypes.TEXT, + status: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'mail_triggers' + }); + + return MailTrigger; +}; diff --git a/server/models/metric.js b/server/models/metric.js index 8d3f36f..dfd57d2 100644 --- a/server/models/metric.js +++ b/server/models/metric.js @@ -1 +1,37 @@ -var _0x797b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x65\x74\x72\x69\x63","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x6D\x65\x74\x72\x69\x63\x73","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x61\x74\x74\x72","\x6E\x61\x6D\x65","\x74\x61\x62\x6C\x65","\x6D\x65\x74\x72\x69\x63","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x797b[0];module[_0x797b[1]]=function(_0x834cx1,_0x834cx2){var _0x834cx3=_0x834cx1[_0x797b[13]](_0x797b[2],{name:{type:_0x834cx2[_0x797b[3]],unique:true,validate:{notEmpty:true}},table:_0x834cx2[_0x797b[3]],metric:_0x834cx2[_0x797b[4]],description:_0x834cx2[_0x797b[3]]},{tableName:_0x797b[5],associate:function(_0x834cx4){_0x834cx3[_0x797b[7]](_0x834cx4.ReportField,{as:_0x797b[6]});_0x834cx3[_0x797b[12]](_0x797b[8],{attributes:[_0x797b[9],_0x797b[10],_0x797b[11]]})}});return _0x834cx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Metric = sequelize.define('Metric', { + name: { + type: DataTypes.STRING, + unique: true, + validate: { + notEmpty: true + }, + }, + table: DataTypes.STRING, + metric: DataTypes.TEXT, + description: DataTypes.STRING + }, { + tableName: 'metrics', + associate: function(models) { + Metric.hasMany(models.ReportField, { + as: 'ReportFields' + }); + Metric.addScope('attr', { + attributes: ['name', 'table', 'metric'] + }); + // Metric.addScope('fields', { + // include: [{ + // model: models.ReportField, + // as: 'ReportFields', + // required: false + // }] + // }); + } + }); + + return Metric; + +}; diff --git a/server/models/module.js b/server/models/module.js index ea86145..c2bef6c 100644 --- a/server/models/module.js +++ b/server/models/module.js @@ -1 +1,27 @@ -var _0x7f1a=["\x65\x78\x70\x6F\x72\x74\x73","\x4D\x6F\x64\x75\x6C\x65","\x53\x54\x52\x49\x4E\x47","\x6D\x6F\x64\x75\x6C\x65\x73","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x6F\x64\x75\x6C\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];module[_0x7f1a[0]]=function(_0x75ffx1,_0x75ffx2){var _0x75ffx3=_0x75ffx1[_0x7f1a[6]](_0x7f1a[1],{name:{type:_0x75ffx2[_0x7f1a[2]],unique:true,allowNull:false,validate:{notEmpty:true}},title:_0x75ffx2[_0x7f1a[2]]},{tableName:_0x7f1a[3],associate:function(_0x75ffx4){_0x75ffx3[_0x7f1a[5]](_0x75ffx4.User,{through:_0x7f1a[4]})}});return _0x75ffx3} \ No newline at end of file +/** + * Module Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Module = sequelize.define('Module', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true + } + }, + title: DataTypes.STRING + }, { + tableName: 'modules', + associate: function(models) { + Module.belongsToMany(models.User, { + through: 'user_has_modules' + }); + } + }); + + return Module; +}; diff --git a/server/models/motionbar.js b/server/models/motionbar.js index efbcafc..ad6cba8 100644 --- a/server/models/motionbar.js +++ b/server/models/motionbar.js @@ -1 +1,32 @@ -var _0x70b6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x4D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x45\x4E\x55\x4D","\x68\x61\x6E\x67\x75\x70","\x69\x6E\x63\x6F\x6D\x69\x6E\x67","\x61\x63\x74\x69\x76\x65","\x53\x54\x52\x49\x4E\x47","\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x41\x64\x6D\x69\x6E","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x55\x73\x65\x72","\x64\x65\x66\x69\x6E\x65"];_0x70b6[0];module[_0x70b6[1]]=function(_0xfe1ax1,_0xfe1ax2){var _0xfe1ax3=_0xfe1ax1[_0x70b6[12]](_0x70b6[2],{action:{type:_0xfe1ax2[_0x70b6[3]],values:[_0x70b6[4]],allowNull:false},state:{type:_0xfe1ax2[_0x70b6[3]],values:[_0x70b6[5],_0x70b6[6]]},phone:{type:_0xfe1ax2[_0x70b6[7]]}},{tableName:_0x70b6[8],associate:function(_0xfe1ax4){_0xfe1ax3[_0x70b6[10]](_0xfe1ax4.User,{as:_0x70b6[9]});_0xfe1ax3[_0x70b6[10]](_0xfe1ax4.User,{as:_0x70b6[11]})}});return _0xfe1ax3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Motionbar = sequelize.define('Motionbar', { + action: { + type: DataTypes.ENUM, + values: ['hangup'], + allowNull: false + }, + state: { + type: DataTypes.ENUM, + values: ['incoming', 'active'], + }, + phone: { + type: DataTypes.STRING + } + }, { + tableName: 'motionbar', + associate: function(models) { + Motionbar.belongsTo(models.User, { + as: 'Admin' + }); + Motionbar.belongsTo(models.User, { + as: 'User' + }); + } + }); + + return Motionbar; + +}; diff --git a/server/models/pause.js b/server/models/pause.js index c4db19e..ee1ef95 100644 --- a/server/models/pause.js +++ b/server/models/pause.js @@ -1 +1,25 @@ -var _0xc4d1=["\x65\x78\x70\x6F\x72\x74\x73","\x50\x61\x75\x73\x65","\x53\x54\x52\x49\x4E\x47","\x70\x61\x75\x73\x65\x73","\x64\x65\x66\x69\x6E\x65"];module[_0xc4d1[0]]=function(_0xb3b8x1,_0xb3b8x2){var _0xb3b8x3=_0xb3b8x1[_0xc4d1[4]](_0xc4d1[1],{name:{type:_0xb3b8x2[_0xc4d1[2]],unique:true,allowNull:false,validate:{notEmpty:true}},description:{type:_0xb3b8x2[_0xc4d1[2]]}},{tableName:_0xc4d1[3],associate:function(_0xb3b8x4){}});return _0xb3b8x3} \ No newline at end of file +/** + * tag Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Pause = sequelize.define('Pause', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + } + }, + description: { + type: DataTypes.STRING + } + }, { + tableName: 'pauses', + associate: function(models) {} + }); + + return Pause; +}; diff --git a/server/models/report_agent.js b/server/models/report_agent.js index ee1795f..a7628cf 100644 --- a/server/models/report_agent.js +++ b/server/models/report_agent.js @@ -1 +1,71 @@ -var _0x753e=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x66\x69\x6E\x65"];module[_0x753e[0]]=function(_0x1ab7x1,_0x1ab7x2){var _0x1ab7x3=_0x1ab7x1[_0x753e[9]](_0x753e[1],{uniqueid:_0x1ab7x2[_0x753e[2]],calleridnum:_0x1ab7x2[_0x753e[2]],calleridname:_0x1ab7x2[_0x753e[2]],queue:_0x1ab7x2[_0x753e[2]],interface:_0x1ab7x2[_0x753e[2]],membername:_0x1ab7x2[_0x753e[2]],agentcalledAt:_0x1ab7x2[_0x753e[3]],agentconnectAt:_0x1ab7x2[_0x753e[3]],agentcompleteAt:_0x1ab7x2[_0x753e[3]],agentringnoanswerAt:_0x1ab7x2[_0x753e[3]],agentdumpAt:_0x1ab7x2[_0x753e[3]],holdtime:_0x1ab7x2[_0x753e[4]],agentcomplete:{type:_0x1ab7x2[_0x753e[5]],defaultValue:false},agentringnoanswer:{type:_0x1ab7x2[_0x753e[5]],defaultValue:false},agentdump:{type:_0x1ab7x2[_0x753e[5]],defaultValue:false},talktime:_0x1ab7x2[_0x753e[4]],agentacw:{type:_0x1ab7x2[_0x753e[5]],defaultValue:false},acwtime:_0x1ab7x2[_0x753e[4]],reason:_0x1ab7x2[_0x753e[2]],lastevent:_0x1ab7x2[_0x753e[2]],channel:_0x1ab7x2[_0x753e[2]],channelstate:_0x1ab7x2[_0x753e[4]],channelstatedesc:_0x1ab7x2[_0x753e[2]],connectedlinenum:_0x1ab7x2[_0x753e[2]],connectedlinename:_0x1ab7x2[_0x753e[2]],language:_0x1ab7x2[_0x753e[2]],accountcode:_0x1ab7x2[_0x753e[2]],context:_0x1ab7x2[_0x753e[2]],exten:_0x1ab7x2[_0x753e[2]],priority:_0x1ab7x2[_0x753e[2]],destchannel:_0x1ab7x2[_0x753e[2]],destchannelstate:_0x1ab7x2[_0x753e[4]],destchannelstatedesc:_0x1ab7x2[_0x753e[2]],destcalleridnum:_0x1ab7x2[_0x753e[2]],destcalleridname:_0x1ab7x2[_0x753e[2]],destconnectedlinenum:_0x1ab7x2[_0x753e[2]],destconnectedlinename:_0x1ab7x2[_0x753e[2]],destlanguage:_0x1ab7x2[_0x753e[2]],destaccountcode:_0x1ab7x2[_0x753e[2]],destcontext:_0x1ab7x2[_0x753e[2]],destexten:_0x1ab7x2[_0x753e[2]],destpriority:_0x1ab7x2[_0x753e[2]],destuniqueid:_0x1ab7x2[_0x753e[2]]},{tableName:_0x753e[6],indexes:[{fields:[_0x753e[7],_0x753e[8]]}]});return _0x1ab7x3} \ No newline at end of file +/** + * Agent Log Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportAgent = sequelize.define('ReportAgent', { + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + interface: DataTypes.STRING, + membername: DataTypes.STRING, + agentcalledAt: DataTypes.DATE, + agentconnectAt: DataTypes.DATE, + agentcompleteAt: DataTypes.DATE, + agentringnoanswerAt: DataTypes.DATE, + agentdumpAt: DataTypes.DATE, + holdtime: DataTypes.INTEGER, + agentcomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentringnoanswer: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentdump: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + talktime: DataTypes.INTEGER, + agentacw: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + acwtime: DataTypes.INTEGER, + reason: DataTypes.STRING, + lastevent: DataTypes.STRING, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + destchannel: DataTypes.STRING, + destchannelstate: DataTypes.INTEGER, + destchannelstatedesc: DataTypes.STRING, + destcalleridnum: DataTypes.STRING, + destcalleridname: DataTypes.STRING, + destconnectedlinenum: DataTypes.STRING, + destconnectedlinename: DataTypes.STRING, + destlanguage: DataTypes.STRING, + destaccountcode: DataTypes.STRING, + destcontext: DataTypes.STRING, + destexten: DataTypes.STRING, + destpriority: DataTypes.STRING, + destuniqueid: DataTypes.STRING + }, { + tableName: 'report_agent', + indexes: [{ + fields: ['uniqueid', 'destuniqueid'] + }] + }); + + return ReportAgent; +}; diff --git a/server/models/report_call.js b/server/models/report_call.js index 692f90f..44e7515 100644 --- a/server/models/report_call.js +++ b/server/models/report_call.js @@ -1 +1,60 @@ -var _0xe4ef=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x53\x54\x52\x49\x4E\x47","\x45\x4E\x55\x4D","\x69\x6E\x62\x6F\x75\x6E\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x44\x41\x54\x45","","\x61\x6E\x73\x77\x65\x72\x74\x69\x6D\x65","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C","\x51\x75\x65\x75\x65\x43\x61\x6C\x6C\x73","\x75\x6E\x69\x71\x75\x65\x69\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x73","\x64\x65\x66\x69\x6E\x65"];module[_0xe4ef[0]]=function(_0x5d3ax1,_0x5d3ax2){var _0x5d3ax3=_0x5d3ax1[_0xe4ef[17]](_0xe4ef[1],{uniqueid:{type:_0x5d3ax2[_0xe4ef[2]],unique:true},type:{type:_0x5d3ax2[_0xe4ef[3]],values:[_0xe4ef[4],_0xe4ef[5],_0xe4ef[6]]},tag:_0x5d3ax2[_0xe4ef[2]],accountcode:_0x5d3ax2[_0xe4ef[2]],source:_0x5d3ax2[_0xe4ef[2]],destination:_0x5d3ax2[_0xe4ef[2]],destinationcontext:_0x5d3ax2[_0xe4ef[2]],callerid:_0x5d3ax2[_0xe4ef[2]],channel:_0x5d3ax2[_0xe4ef[2]],destinationchannel:_0x5d3ax2[_0xe4ef[2]],lastapplication:_0x5d3ax2[_0xe4ef[2]],lastdata:_0x5d3ax2[_0xe4ef[2]],starttime:_0x5d3ax2[_0xe4ef[7]],answertime:{type:_0x5d3ax2[_0xe4ef[7]],set:function(_0x5d3ax4){if(_0x5d3ax4!==_0xe4ef[8]){this[_0xe4ef[10]](_0xe4ef[9],_0x5d3ax4)}else {this[_0xe4ef[10]](_0xe4ef[9],null)}}},endtime:_0x5d3ax2[_0xe4ef[7]],duration:_0x5d3ax2[_0xe4ef[11]],billableseconds:_0x5d3ax2[_0xe4ef[11]],disposition:_0x5d3ax2[_0xe4ef[2]],amaflags:_0x5d3ax2[_0xe4ef[2]],userfield:_0x5d3ax2[_0xe4ef[2]]},{tableName:_0xe4ef[12],associate:function(_0x5d3ax5){_0x5d3ax3[_0xe4ef[15]](_0x5d3ax5.ReportQueue,{as:_0xe4ef[13],foreignKey:_0xe4ef[14],constraints:false});_0x5d3ax3[_0xe4ef[15]](_0x5d3ax5.ReportAgent,{as:_0xe4ef[16],foreignKey:_0xe4ef[14],constraints:false})}});return _0x5d3ax3} \ No newline at end of file +/** + * CDR Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportCall = sequelize.define('ReportCall', { + uniqueid: { + type: DataTypes.STRING, + unique: true + }, + type: { + type: DataTypes.ENUM, + values: ['inbound', 'internal', 'outbound'] + }, + tag: DataTypes.STRING, + accountcode: DataTypes.STRING, + source: DataTypes.STRING, + destination: DataTypes.STRING, + destinationcontext: DataTypes.STRING, + callerid: DataTypes.STRING, + channel: DataTypes.STRING, + destinationchannel: DataTypes.STRING, + lastapplication: DataTypes.STRING, + lastdata: DataTypes.STRING, + starttime: DataTypes.DATE, + answertime: { + type: DataTypes.DATE, + set: function(answertime) { + if (answertime !== '') { + this.setDataValue('answertime', answertime); + } else { + this.setDataValue('answertime', null); + } + } + }, + endtime: DataTypes.DATE, + duration: DataTypes.INTEGER, + billableseconds: DataTypes.INTEGER, + disposition: DataTypes.STRING, + amaflags: DataTypes.STRING, + userfield: DataTypes.STRING + }, { + tableName: 'report_call', + associate: function(models) { + ReportCall.hasMany(models.ReportQueue, { + as: 'QueueCalls', + foreignKey: 'uniqueid', + constraints: false + }) + ReportCall.hasMany(models.ReportAgent, { + as: 'ReportAgents', + foreignKey: 'uniqueid', + constraints: false + }) + } + }); + + return ReportCall; +}; diff --git a/server/models/report_chat.js b/server/models/report_chat.js index 4edada8..8f1febf 100644 --- a/server/models/report_chat.js +++ b/server/models/report_chat.js @@ -1 +1,45 @@ -var _0xe0ba=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x63\x61\x6C\x6C\x65\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x72\x65\x61\x73\x6F\x6E","\x63\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0xe0ba[0]);module[_0xe0ba[1]]=function(_0x88f8x2,_0x88f8x3){var _0x88f8x4=_0x88f8x2[_0xe0ba[16]](_0xe0ba[2],{uniqueid:_0x88f8x3[_0xe0ba[3]],timeslot:_0x88f8x3[_0xe0ba[4]],websitename:_0x88f8x3[_0xe0ba[3]],websiteaddress:_0x88f8x3[_0xe0ba[3]],websiteid:_0x88f8x3[_0xe0ba[4]],application:_0x88f8x3[_0xe0ba[3]],agentid:_0x88f8x3[_0xe0ba[4]],agentname:_0x88f8x3[_0xe0ba[3]],visitorid:_0x88f8x3[_0xe0ba[3]],visitorname:_0x88f8x3[_0xe0ba[3]],visitoremail:_0x88f8x3[_0xe0ba[3]],queueid:_0x88f8x3[_0xe0ba[4]],queuename:_0x88f8x3[_0xe0ba[3]],roomid:_0x88f8x3[_0xe0ba[4]],reason:{type:_0x88f8x3[_0xe0ba[3]],defaultValue:_0xe0ba[5]},connectid:{type:_0x88f8x3[_0xe0ba[3]],unique:true,set:function(_0x88f8x5){this[_0xe0ba[8]](_0xe0ba[6],this[_0xe0ba[7]]);this[_0xe0ba[8]](_0xe0ba[9],_0xe0ba[10]);this[_0xe0ba[8]](_0xe0ba[11],moment()[_0xe0ba[13]](_0xe0ba[12]))}},calledAt:_0x88f8x3[_0xe0ba[14]],connectedAt:_0x88f8x3[_0xe0ba[14]]},{tableName:_0xe0ba[15]});return _0x88f8x4} \ No newline at end of file +/** + * Agent Log Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportChat = sequelize.define('ReportChat', { + + uniqueid: DataTypes.STRING, + timeslot: DataTypes.INTEGER, + websitename: DataTypes.STRING, + websiteaddress: DataTypes.STRING, + websiteid: DataTypes.INTEGER, + application: DataTypes.STRING, + agentid: DataTypes.INTEGER, + agentname: DataTypes.STRING, + visitorid: DataTypes.STRING, + visitorname: DataTypes.STRING, + visitoremail: DataTypes.STRING, + queueid: DataTypes.INTEGER, + queuename: DataTypes.STRING, + roomid: DataTypes.INTEGER, + reason: { + type: DataTypes.STRING, + defaultValue: 'called' + }, + connectid: { + type: DataTypes.STRING, + unique: true, + set: function(agentconnectedAt) { + this.setDataValue('connectid', this.uniqueid); + this.setDataValue('reason', 'connect'); + this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss")); + } + }, + calledAt: DataTypes.DATE, + connectedAt: DataTypes.DATE + }, { + tableName: 'report_chat' + }); + + return ReportChat; +}; diff --git a/server/models/report_chat_session.js b/server/models/report_chat_session.js index e225792..9944aaa 100644 --- a/server/models/report_chat_session.js +++ b/server/models/report_chat_session.js @@ -1 +1,35 @@ -var _0x6c8d=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0x6c8d[0]);module[_0x6c8d[1]]=function(_0xe323x2,_0xe323x3){var _0xe323x4=_0xe323x2[_0x6c8d[7]](_0x6c8d[2],{uniqueid:{type:_0xe323x3[_0x6c8d[3]],unique:true},websitename:_0xe323x3[_0x6c8d[3]],websiteaddress:_0xe323x3[_0x6c8d[3]],websiteid:_0xe323x3[_0x6c8d[4]],application:_0xe323x3[_0x6c8d[3]],visitorid:_0xe323x3[_0x6c8d[3]],visitorname:_0xe323x3[_0x6c8d[3]],visitoremail:_0xe323x3[_0x6c8d[3]],agentid:_0xe323x3[_0x6c8d[3]],agentname:_0xe323x3[_0x6c8d[3]],queueid:_0xe323x3[_0x6c8d[4]],queuename:_0xe323x3[_0x6c8d[3]],roomid:_0xe323x3[_0x6c8d[4]],joinAt:_0xe323x3[_0x6c8d[5]],leaveAt:_0xe323x3[_0x6c8d[5]],unmanagedAt:_0xe323x3[_0x6c8d[5]],abandonAt:_0xe323x3[_0x6c8d[5]]},{tableName:_0x6c8d[6]});return _0xe323x4} \ No newline at end of file +/** + * Agent Log Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportChatSession = sequelize.define('ReportChatSession', { + uniqueid: { + type: DataTypes.STRING, + unique: true + }, + websitename: DataTypes.STRING, + websiteaddress: DataTypes.STRING, + websiteid: DataTypes.INTEGER, + application: DataTypes.STRING, + visitorid: DataTypes.STRING, + visitorname: DataTypes.STRING, + visitoremail: DataTypes.STRING, + agentid: DataTypes.STRING, + agentname: DataTypes.STRING, + queueid: DataTypes.INTEGER, + queuename: DataTypes.STRING, + roomid: DataTypes.INTEGER, + joinAt: DataTypes.DATE, + leaveAt: DataTypes.DATE, + unmanagedAt: DataTypes.DATE, + abandonAt: DataTypes.DATE + }, { + tableName: 'report_chat_session' + }); + + return ReportChatSession; +}; diff --git a/server/models/report_field.js b/server/models/report_field.js index c70df48..208b861 100644 --- a/server/models/report_field.js +++ b/server/models/report_field.js @@ -1 +1,22 @@ -var _0x611b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x65\x70\x6F\x72\x74\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x6D\x65\x74\x72\x69\x63\x73","\x4D\x65\x74\x72\x69\x63","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x611b[0];module[_0x611b[1]]=function(_0x290ex1,_0x290ex2){var _0x290ex3=_0x290ex1[_0x611b[10]](_0x611b[2],{field:_0x290ex2[_0x611b[3]],alias:_0x290ex2[_0x611b[3]],function:_0x290ex2[_0x611b[3]],groupBy:_0x290ex2[_0x611b[4]],orderBy:_0x290ex2[_0x611b[3]]},{tableName:_0x611b[5],associate:function(_0x290ex4){_0x290ex3[_0x611b[6]](_0x290ex4.Metric);_0x290ex3[_0x611b[9]](_0x611b[7],{include:[_0x290ex4[_0x611b[8]]]})}});return _0x290ex3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ReportField = sequelize.define('ReportField', { + field: DataTypes.STRING, + alias: DataTypes.STRING, + function: DataTypes.STRING, + groupBy: DataTypes.BOOLEAN, + orderBy: DataTypes.STRING + }, { + tableName: 'report_fields', + associate: function(models) { + ReportField.belongsTo(models.Metric); + ReportField.addScope('metrics', { + include: [models.Metric] + }); + } + }); + + return ReportField; +}; diff --git a/server/models/report_integration.js b/server/models/report_integration.js index 84b9ac7..a285620 100644 --- a/server/models/report_integration.js +++ b/server/models/report_integration.js @@ -1 +1,86 @@ -var _0xec74=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x42\x4F\x4F\x4C\x45\x41\x4E","\x54\x45\x58\x54","\x53\x45\x4E\x54","\x53\x45\x4E\x44\x49\x4E\x47","\x52\x45\x43\x45\x49\x56\x45\x44","\x46\x41\x49\x4C\x45\x44","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x64\x65\x66\x69\x6E\x65"];module[_0xec74[0]]=function(_0xe437x1,_0xe437x2){var _0xe437x3=_0xe437x1[_0xec74[12]](_0xec74[1],{integration:_0xe437x2[_0xec74[2]],eventChannel:_0xe437x2[_0xec74[2]],exitStatus:_0xe437x2[_0xec74[2]],ticketId:_0xe437x2[_0xec74[2]],integrationId:_0xe437x2[_0xec74[3]],contacts:_0xe437x2[_0xec74[2]],uniqueid:_0xe437x2[_0xec74[2]],calleridnum:_0xe437x2[_0xec74[2]],calleridname:_0xe437x2[_0xec74[2]],queue:_0xe437x2[_0xec74[2]],interface:_0xe437x2[_0xec74[2]],membername:_0xe437x2[_0xec74[2]],agentcalledAt:_0xe437x2[_0xec74[4]],agentconnectAt:_0xe437x2[_0xec74[4]],holdtime:_0xe437x2[_0xec74[3]],agentcomplete:{type:_0xe437x2[_0xec74[5]],defaultValue:false},agentcompleteAt:_0xe437x2[_0xec74[4]],talktime:_0xe437x2[_0xec74[3]],agentacw:{type:_0xe437x2[_0xec74[5]],defaultValue:false},acwtime:_0xe437x2[_0xec74[3]],reason:_0xe437x2[_0xec74[2]],agentringnoanswer:{type:_0xe437x2[_0xec74[5]],defaultValue:false},agentringnoanswerAt:_0xe437x2[_0xec74[4]],agentdump:{type:_0xe437x2[_0xec74[5]],defaultValue:false},agentdumpAt:_0xe437x2[_0xec74[4]],lastevent:_0xe437x2[_0xec74[2]],channel:_0xe437x2[_0xec74[2]],channelstate:_0xe437x2[_0xec74[3]],channelstatedesc:_0xe437x2[_0xec74[2]],connectedlinenum:_0xe437x2[_0xec74[2]],connectedlinename:_0xe437x2[_0xec74[2]],language:_0xe437x2[_0xec74[2]],accountcode:_0xe437x2[_0xec74[2]],context:_0xe437x2[_0xec74[2]],exten:_0xe437x2[_0xec74[2]],priority:_0xe437x2[_0xec74[2]],destchannel:_0xe437x2[_0xec74[2]],destchannelstate:_0xe437x2[_0xec74[3]],destchannelstatedesc:_0xe437x2[_0xec74[2]],destcalleridnum:_0xe437x2[_0xec74[2]],destcalleridname:_0xe437x2[_0xec74[2]],destconnectedlinenum:_0xe437x2[_0xec74[2]],destconnectedlinename:_0xe437x2[_0xec74[2]],destlanguage:_0xe437x2[_0xec74[2]],destaccountcode:_0xe437x2[_0xec74[2]],destcontext:_0xe437x2[_0xec74[2]],destexten:_0xe437x2[_0xec74[2]],destpriority:_0xe437x2[_0xec74[2]],destuniqueid:_0xe437x2[_0xec74[2]],messageId:_0xe437x2[_0xec74[2]],inReplyTo:_0xe437x2[_0xec74[2]],subject:_0xe437x2[_0xec74[2]],from:_0xe437x2[_0xec74[2]],to:_0xe437x2[_0xec74[2]],cc:_0xe437x2[_0xec74[2]],attachment:_0xe437x2[_0xec74[6]],html:_0xe437x2[_0xec74[6]],text:_0xe437x2[_0xec74[6]],status:{type:_0xe437x2.ENUM(_0xec74[7],_0xec74[8],_0xec74[9],_0xec74[10])}},{tableName:_0xec74[11]});return _0xe437x3} \ No newline at end of file +/** + * report_integrations Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportIntegration = sequelize.define('ReportIntegration', { + integration: DataTypes.STRING, + eventChannel: DataTypes.STRING, + exitStatus: DataTypes.STRING, + ticketId: DataTypes.STRING, + integrationId: DataTypes.INTEGER, + contacts: DataTypes.STRING, + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + interface: DataTypes.STRING, + membername: DataTypes.STRING, + agentcalledAt: DataTypes.DATE, + agentconnectAt: DataTypes.DATE, + holdtime: DataTypes.INTEGER, + agentcomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentcompleteAt: DataTypes.DATE, + talktime: DataTypes.INTEGER, + agentacw: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + acwtime: DataTypes.INTEGER, + reason: DataTypes.STRING, + agentringnoanswer: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentringnoanswerAt: DataTypes.DATE, + agentdump: { + type: DataTypes.BOOLEAN, + defaultValue: false, + }, + agentdumpAt: DataTypes.DATE, + lastevent: DataTypes.STRING, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + destchannel: DataTypes.STRING, + destchannelstate: DataTypes.INTEGER, + destchannelstatedesc: DataTypes.STRING, + destcalleridnum: DataTypes.STRING, + destcalleridname: DataTypes.STRING, + destconnectedlinenum: DataTypes.STRING, + destconnectedlinename: DataTypes.STRING, + destlanguage: DataTypes.STRING, + destaccountcode: DataTypes.STRING, + destcontext: DataTypes.STRING, + destexten: DataTypes.STRING, + destpriority: DataTypes.STRING, + destuniqueid: DataTypes.STRING, + messageId: DataTypes.STRING, + inReplyTo: DataTypes.STRING, + subject: DataTypes.STRING, + from: DataTypes.STRING, + to: DataTypes.STRING, + cc: DataTypes.STRING, + attachment: DataTypes.TEXT, + html: DataTypes.TEXT, + text: DataTypes.TEXT, + status: { + type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED') + } + }, { + tableName: 'report_integration' + }); + + return ReportIntegration; +}; diff --git a/server/models/report_jscripty_input.js b/server/models/report_jscripty_input.js index bcc9b77..5a3d4f5 100644 --- a/server/models/report_jscripty_input.js +++ b/server/models/report_jscripty_input.js @@ -1 +1,12 @@ -var _0x26aa=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x72\x65\x70\x6F\x72\x74\x5F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x69\x6E\x70\x75\x74\x73","\x64\x65\x66\x69\x6E\x65"];_0x26aa[0];module[_0x26aa[1]]=function(_0x4862x1,_0x4862x2){return _0x4862x1[_0x26aa[6]](_0x26aa[2],{input_id:_0x4862x2[_0x26aa[3]],input_type:_0x4862x2[_0x26aa[4]],input_label:_0x4862x2[_0x26aa[4]],input_value:_0x4862x2[_0x26aa[4]]},{tableName:_0x26aa[5]})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('ReportJscriptyInput', { + input_id: DataTypes.INTEGER, + input_type: DataTypes.STRING, + input_label: DataTypes.STRING, + input_value: DataTypes.STRING + }, { + tableName: 'report_jscripty_inputs' + }); +}; diff --git a/server/models/report_jscripty_question.js b/server/models/report_jscripty_question.js index 15f72a6..f6080f4 100644 --- a/server/models/report_jscripty_question.js +++ b/server/models/report_jscripty_question.js @@ -1 +1,34 @@ -var _0x3fb7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x51\x75\x65\x73\x74\x69\x6F\x6E","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x72\x65\x70\x6F\x72\x74\x5F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x71\x75\x65\x73\x74\x69\x6F\x6E\x73","\x63\x61\x73\x63\x61\x64\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x53\x75\x6D\x6D\x61\x72\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x79\x70\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6C\x61\x62\x65\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x65\x78\x74","\x63\x6F\x75\x6E\x74","\x63\x6F\x6C","\x66\x6E","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x3fb7[0];module[_0x3fb7[1]]=function(_0xa55fx1,_0xa55fx2){return _0xa55fx1[_0x3fb7[18]](_0x3fb7[2],{question_id:_0xa55fx2[_0x3fb7[3]],question_type:_0xa55fx2[_0x3fb7[4]],question_label:_0xa55fx2[_0x3fb7[4]],question_text:_0xa55fx2[_0x3fb7[4]],question_answer:_0xa55fx2[_0x3fb7[4]],question_other_label:_0xa55fx2[_0x3fb7[4]],question_other_answer:_0xa55fx2[_0x3fb7[4]]},{tableName:_0x3fb7[5],associate:function(_0xa55fx3){_0xa55fx3[_0x3fb7[2]][_0x3fb7[8]](_0xa55fx3.ReportJscriptyInput,{onDelete:_0x3fb7[6],foreignKey:_0x3fb7[7]});_0xa55fx3[_0x3fb7[2]][_0x3fb7[17]](_0x3fb7[9],function(_0xa55fx4){return {where:{projectId:_0xa55fx4},attributes:[_0x3fb7[10],_0x3fb7[11],_0x3fb7[12],_0x3fb7[13],[_0xa55fx1[_0x3fb7[16]](_0x3fb7[14],_0xa55fx1[_0x3fb7[15]](_0x3fb7[10])),_0x3fb7[14]]],group:[_0x3fb7[10],_0x3fb7[11],_0x3fb7[12],_0x3fb7[13]]}})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('ReportJscriptyQuestion', { + question_id: DataTypes.INTEGER, + question_type: DataTypes.STRING, + question_label: DataTypes.STRING, + question_text: DataTypes.STRING, + question_answer: DataTypes.STRING, + question_other_label: DataTypes.STRING, + question_other_answer: DataTypes.STRING + + }, { + tableName: 'report_jscripty_questions', + associate: function(models) { + models.ReportJscriptyQuestion.hasMany(models.ReportJscriptyInput, { + onDelete: 'cascade', + foreignKey: 'questionId' + + }); + models.ReportJscriptyQuestion.addScope('questionSummary', function(projectId) { + return { + where: { + projectId: projectId + + }, + attributes: ['question_id', 'question_type', 'question_label', 'question_text', [sequelize.fn('count', sequelize.col('question_id')), 'count']], + group: ['question_id', 'question_type', 'question_label', 'question_text'] + } + + }); + } + }); +}; diff --git a/server/models/report_jscripty_session.js b/server/models/report_jscripty_session.js index 4fd7ca2..12a8447 100644 --- a/server/models/report_jscripty_session.js +++ b/server/models/report_jscripty_session.js @@ -1 +1,51 @@ -var _0x66a0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x53\x65\x73\x73\x69\x6F\x6E","\x49\x4E\x54\x45\x47\x45\x52","\x73\x74\x61\x72\x74\x65\x64","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x69\x6E\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x44\x41\x54\x45","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64\x41\x74","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x72\x65\x70\x6F\x72\x74\x5F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x73\x65\x73\x73\x69\x6F\x6E\x73","\x63\x61\x73\x63\x61\x64\x65","\x73\x65\x73\x73\x69\x6F\x6E\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x41\x6E\x64\x49\x6E\x70\x75\x74","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x51\x75\x65\x73\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x66a0[0];var moment=require(_0x66a0[1]);module[_0x66a0[2]]=function(_0xadbax2,_0xadbax3){return _0xadbax2[_0x66a0[23]](_0x66a0[3],{session_id:{type:_0xadbax3[_0x66a0[4]],primaryKey:true,autoIncrement:true},status:{type:_0xadbax3.ENUM(_0x66a0[5],_0x66a0[6],_0x66a0[7])},last_question_id:_0xadbax3[_0x66a0[4]],completedAt:{type:_0xadbax3[_0x66a0[8]],get:function(){return this[_0x66a0[10]](_0x66a0[9])?moment(this[_0x66a0[10]](_0x66a0[9]))[_0x66a0[12]](_0x66a0[11]):_0x66a0[13]}},createdAt:{type:_0xadbax3[_0x66a0[8]],get:function(){return moment(this[_0x66a0[10]](_0x66a0[14]))[_0x66a0[12]](_0x66a0[11])}}},{tableName:_0x66a0[15],associate:function(_0xadbax4){_0xadbax4[_0x66a0[3]][_0x66a0[18]](_0xadbax4.ReportJscriptyQuestion,{onDelete:_0x66a0[16],foreignKey:_0x66a0[17]});_0xadbax4[_0x66a0[3]][_0x66a0[22]](_0x66a0[19],function(_0xadbax5){return {where:{ProjectId:_0xadbax5},include:[{model:_0xadbax4[_0x66a0[20]],include:[{model:_0xadbax4[_0x66a0[21]]}]}]}})}})} \ No newline at end of file +'use strict'; +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('ReportJscriptySession', { + session_id: { + type: DataTypes.INTEGER, + primaryKey: true, + autoIncrement: true + }, + status: { + type: DataTypes.ENUM('started', 'completed', 'incomplete') + }, + last_question_id: DataTypes.INTEGER, + completedAt: { + type: DataTypes.DATE, + get: function() { + // 'this' allows you to access attributes of the instance + return this.getDataValue('completedAt') ? moment(this.getDataValue('completedAt')).format("MM-DD-YYYY HH:mm") : ''; + } + }, + createdAt: { + type: DataTypes.DATE, + get: function() { + // 'this' allows you to access attributes of the instance + return moment(this.getDataValue('createdAt')).format("MM-DD-YYYY HH:mm"); + } + } + }, { + tableName: 'report_jscripty_sessions', + associate: function(models) { + models.ReportJscriptySession.hasMany(models.ReportJscriptyQuestion, { + onDelete: 'cascade', + foreignKey: 'sessionId' + }); + models.ReportJscriptySession.addScope('questionsAndInput', function(projectId) { + return { + where: { + ProjectId: projectId + }, + include: [{ + model: models.ReportJscriptyQuestion, + include: [{ + model: models.ReportJscriptyInput + }] + }] + } + }); + } + }); +}; diff --git a/server/models/report_mail.js b/server/models/report_mail.js index 377006b..d4327ea 100644 --- a/server/models/report_mail.js +++ b/server/models/report_mail.js @@ -1 +1,43 @@ -var _0xbf3e=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x63\x61\x6C\x6C\x65\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x72\x65\x61\x73\x6F\x6E","\x63\x6F\x6E\x6E\x65\x63\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x41\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0xbf3e[0]);module[_0xbf3e[1]]=function(_0x2477x2,_0x2477x3){var _0x2477x4=_0x2477x2[_0xbf3e[16]](_0xbf3e[2],{uniqueid:_0x2477x3[_0xbf3e[3]],timeslot:_0x2477x3[_0xbf3e[4]],subject:_0x2477x3[_0xbf3e[3]],accountid:_0x2477x3[_0xbf3e[3]],accountname:_0x2477x3[_0xbf3e[3]],accountaddress:_0x2477x3[_0xbf3e[3]],application:_0x2477x3[_0xbf3e[3]],memberid:_0x2477x3[_0xbf3e[4]],membername:_0x2477x3[_0xbf3e[3]],queue:_0x2477x3[_0xbf3e[4]],queuename:_0x2477x3[_0xbf3e[3]],roomid:_0x2477x3[_0xbf3e[4]],messageid:_0x2477x3[_0xbf3e[4]],reason:{type:_0x2477x3[_0xbf3e[3]],defaultValue:_0xbf3e[5]},connectid:{type:_0x2477x3[_0xbf3e[3]],unique:true,set:function(_0x2477x5){this[_0xbf3e[8]](_0xbf3e[6],this[_0xbf3e[7]]);this[_0xbf3e[8]](_0xbf3e[9],_0xbf3e[10]);this[_0xbf3e[8]](_0xbf3e[11],moment()[_0xbf3e[13]](_0xbf3e[12]))}},calledAt:_0x2477x3[_0xbf3e[14]],connectedAt:_0x2477x3[_0xbf3e[14]]},{tableName:_0xbf3e[15]});return _0x2477x4} \ No newline at end of file +/** + * Agent Log Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportMail = sequelize.define('ReportMail', { + uniqueid: DataTypes.STRING, + timeslot: DataTypes.INTEGER, + subject: DataTypes.STRING, + accountid: DataTypes.STRING, + accountname: DataTypes.STRING, + accountaddress: DataTypes.STRING, + application: DataTypes.STRING, + memberid: DataTypes.INTEGER, + membername: DataTypes.STRING, + queue: DataTypes.INTEGER, + queuename: DataTypes.STRING, + roomid: DataTypes.INTEGER, + messageid: DataTypes.INTEGER, + reason: { + type: DataTypes.STRING, + defaultValue: 'called' + }, + connectid: { + type: DataTypes.STRING, + unique: true, + set: function(agentconnectedAt) { + this.setDataValue('connectid', this.uniqueid); + this.setDataValue('reason', 'connect'); + this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss")); + } + }, + calledAt: DataTypes.DATE, + connectedAt: DataTypes.DATE + }, { + tableName: 'report_mail' + }); + + return ReportMail; +}; diff --git a/server/models/report_mail_session.js b/server/models/report_mail_session.js index 3e3904d..903631e 100644 --- a/server/models/report_mail_session.js +++ b/server/models/report_mail_session.js @@ -1 +1,37 @@ -var _0xdcde=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0xdcde[0]);module[_0xdcde[1]]=function(_0xeeb3x2,_0xeeb3x3){var _0xeeb3x4=_0xeeb3x2[_0xdcde[7]](_0xdcde[2],{uniqueid:{type:_0xeeb3x3[_0xdcde[3]],unique:true},subject:_0xeeb3x3[_0xdcde[3]],accountid:_0xeeb3x3[_0xdcde[3]],accountname:_0xeeb3x3[_0xdcde[3]],accountaddress:_0xeeb3x3[_0xdcde[3]],application:_0xeeb3x3[_0xdcde[3]],memberid:_0xeeb3x3[_0xdcde[3]],membername:_0xeeb3x3[_0xdcde[3]],queue:_0xeeb3x3[_0xdcde[4]],queuename:_0xeeb3x3[_0xdcde[3]],roomid:_0xeeb3x3[_0xdcde[4]],fidelity:{type:_0xeeb3x3[_0xdcde[4]],defaultValue:0},holdtime:_0xeeb3x3[_0xdcde[4]],queuecallerjoinAt:_0xeeb3x3[_0xdcde[5]],queuecallerleaveAt:_0xeeb3x3[_0xdcde[5]],queuecallerunmanagedAt:_0xeeb3x3[_0xdcde[5]],queuecallerabandonedAt:_0xeeb3x3[_0xdcde[5]]},{tableName:_0xdcde[6]});return _0xeeb3x4} \ No newline at end of file +/** + * Agent Log Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + var ReportMailSession = sequelize.define('ReportMailSession', { + uniqueid: { + type: DataTypes.STRING, + unique: true + }, + subject: DataTypes.STRING, + accountid: DataTypes.STRING, + accountname: DataTypes.STRING, + accountaddress: DataTypes.STRING, + application: DataTypes.STRING, + memberid: DataTypes.STRING, + membername: DataTypes.STRING, + queue: DataTypes.INTEGER, + queuename: DataTypes.STRING, + roomid: DataTypes.INTEGER, + fidelity: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + holdtime: DataTypes.INTEGER, + queuecallerjoinAt: DataTypes.DATE, + queuecallerleaveAt: DataTypes.DATE, + queuecallerunmanagedAt: DataTypes.DATE, + queuecallerabandonedAt: DataTypes.DATE + }, { + tableName: 'report_mail_session' + }); + + return ReportMailSession; +}; diff --git a/server/models/report_member.js b/server/models/report_member.js index f0ea647..e4aac4e 100644 --- a/server/models/report_member.js +++ b/server/models/report_member.js @@ -1 +1,33 @@ -var _0xc02d=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x53\x54\x52\x49\x4E\x47","\x44\x45\x46\x41\x55\x4C\x54\x20\x50\x41\x55\x53\x45","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0xc02d[0]);module[_0xc02d[1]]=function(_0x3bc0x2,_0x3bc0x3){var _0x3bc0x4=_0x3bc0x2[_0xc02d[8]](_0xc02d[2],{channel:_0x3bc0x3[_0xc02d[3]],membername:_0x3bc0x3[_0xc02d[3]],interface:_0x3bc0x3[_0xc02d[3]],type:{type:_0x3bc0x3[_0xc02d[3]],defaultValue:_0xc02d[4]},duration:_0x3bc0x3[_0xc02d[5]],enterAt:_0x3bc0x3[_0xc02d[6]],exitAt:_0x3bc0x3[_0xc02d[6]],data1:_0x3bc0x3[_0xc02d[3]],data2:_0x3bc0x3[_0xc02d[3]],data3:_0x3bc0x3[_0xc02d[3]],data4:_0x3bc0x3[_0xc02d[3]],data5:_0x3bc0x3[_0xc02d[3]]},{tableName:_0xc02d[7]});return _0x3bc0x4} \ No newline at end of file +/** + * DIAL Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportMember = sequelize.define('ReportMember', { + channel: DataTypes.STRING, + membername: DataTypes.STRING, + interface: DataTypes.STRING, + type: { + type: DataTypes.STRING, + defaultValue: 'DEFAULT PAUSE' + }, + duration: DataTypes.INTEGER, + enterAt: DataTypes.DATE, + exitAt: DataTypes.DATE, + data1: DataTypes.STRING, + data2: DataTypes.STRING, + data3: DataTypes.STRING, + data4: DataTypes.STRING, + data5: DataTypes.STRING + }, { + tableName: 'report_member', + // indexes: [{ + // fields: ['membername', 'enterdate', 'exitdate'] + // }] + }); + + return ReportMember; +}; diff --git a/server/models/report_queue.js b/server/models/report_queue.js index 7dceb84..b06b742 100644 --- a/server/models/report_queue.js +++ b/server/models/report_queue.js @@ -1 +1,63 @@ -var _0x5c07=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6A\x6F\x69\x6E\x41\x74","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6C\x65\x61\x76\x65\x41\x74","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x68\x6F\x6C\x64\x74\x69\x6D\x65","\x73\x65\x63\x6F\x6E\x64\x73","\x64\x69\x66\x66","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0x5c07[0]);module[_0x5c07[1]]=function(_0xc2fdx2,_0xc2fdx3){var _0xc2fdx4=_0xc2fdx2[_0x5c07[18]](_0x5c07[2],{uniqueid:_0xc2fdx3[_0x5c07[3]],calleridnum:_0xc2fdx3[_0x5c07[3]],calleridname:_0xc2fdx3[_0x5c07[3]],queue:_0xc2fdx3[_0x5c07[3]],queuecallerjoinAt:_0xc2fdx3[_0x5c07[4]],queuecallerleaveAt:{type:_0xc2fdx3[_0x5c07[4]],set:function(_0xc2fdx5){var _0xc2fdx6=moment(_0xc2fdx5);var _0xc2fdx7=moment(this[_0x5c07[8]](_0x5c07[7]))[_0x5c07[6]](_0x5c07[5]);this[_0x5c07[10]](_0x5c07[9],_0xc2fdx5);this[_0x5c07[10]](_0x5c07[11],_0xc2fdx6[_0x5c07[13]](_0xc2fdx7,_0x5c07[12]))}},position:_0xc2fdx3[_0x5c07[14]],count:_0xc2fdx3[_0x5c07[14]],queuecallerabandon:{type:_0xc2fdx3[_0x5c07[15]],defaultValue:false},queuecallerabandonAt:_0xc2fdx3[_0x5c07[4]],queuecallercomplete:{type:_0xc2fdx3[_0x5c07[15]],defaultValue:false},queuecallercompleteAt:_0xc2fdx3[_0x5c07[4]],queuecallerexit:{type:_0xc2fdx3[_0x5c07[15]],defaultValue:false},queuecallerexitAt:_0xc2fdx3[_0x5c07[4]],queuecallerexitreason:_0xc2fdx3[_0x5c07[3]],originalposition:_0xc2fdx3[_0x5c07[14]],channel:_0xc2fdx3[_0x5c07[3]],channelstate:_0xc2fdx3[_0x5c07[14]],channelstatedesc:_0xc2fdx3[_0x5c07[3]],connectedlinenum:_0xc2fdx3[_0x5c07[3]],connectedlinename:_0xc2fdx3[_0x5c07[3]],language:_0xc2fdx3[_0x5c07[3]],accountcode:_0xc2fdx3[_0x5c07[3]],context:_0xc2fdx3[_0x5c07[3]],exten:_0xc2fdx3[_0x5c07[3]],priority:_0xc2fdx3[_0x5c07[3]],holdtime:_0xc2fdx3[_0x5c07[14]]},{tableName:_0x5c07[16],indexes:[{fields:[_0x5c07[17]]}]});return _0xc2fdx4} \ No newline at end of file +/** + * QueueLog Model + */ + +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + + var ReportQueue = sequelize.define('ReportQueue', { + uniqueid: DataTypes.STRING, + calleridnum: DataTypes.STRING, + calleridname: DataTypes.STRING, + queue: DataTypes.STRING, + queuecallerjoinAt: DataTypes.DATE, + queuecallerleaveAt: { + type: DataTypes.DATE, + set: function(queuecallerleaveAt) { + var a = moment(queuecallerleaveAt); + var b = moment(this.getDataValue('queuecallerjoinAt')).format("YYYY-MM-DD HH:mm:ss"); + + this.setDataValue('queuecallerleaveAt', queuecallerleaveAt); + this.setDataValue('holdtime', a.diff(b, 'seconds')); + } + }, + position: DataTypes.INTEGER, + count: DataTypes.INTEGER, + queuecallerabandon: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallerabandonAt: DataTypes.DATE, + queuecallercomplete: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallercompleteAt: DataTypes.DATE, + queuecallerexit: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + queuecallerexitAt: DataTypes.DATE, + queuecallerexitreason: DataTypes.STRING, + originalposition: DataTypes.INTEGER, + channel: DataTypes.STRING, + channelstate: DataTypes.INTEGER, + channelstatedesc: DataTypes.STRING, + connectedlinenum: DataTypes.STRING, + connectedlinename: DataTypes.STRING, + language: DataTypes.STRING, + accountcode: DataTypes.STRING, + context: DataTypes.STRING, + exten: DataTypes.STRING, + priority: DataTypes.STRING, + holdtime: DataTypes.INTEGER + }, { + tableName: 'report_queue', + indexes: [{ + fields: ['uniqueid'] + }] + }); + + return ReportQueue; +}; diff --git a/server/models/report_square.js b/server/models/report_square.js index c32ad84..62a8e0c 100644 --- a/server/models/report_square.js +++ b/server/models/report_square.js @@ -1 +1,89 @@ -var _0x120c=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65","\x53\x54\x52\x49\x4E\x47","\x44\x41\x54\x45","\x72\x65\x70\x6F\x72\x74\x5F\x73\x71\x75\x61\x72\x65","\x64\x65\x66\x69\x6E\x65"];module[_0x120c[0]]=function(_0xe5f4x1,_0xe5f4x2){var _0xe5f4x3=_0xe5f4x1[_0x120c[5]](_0x120c[1],{network:{type:_0xe5f4x2[_0x120c[2]]},network_script:{type:_0xe5f4x2[_0x120c[2]]},request:{type:_0xe5f4x2[_0x120c[2]]},channel:{type:_0xe5f4x2[_0x120c[2]]},language:{type:_0xe5f4x2[_0x120c[2]]},type:{type:_0xe5f4x2[_0x120c[2]]},uniqueid:{type:_0xe5f4x2[_0x120c[2]]},version:{type:_0xe5f4x2[_0x120c[2]]},callerid:{type:_0xe5f4x2[_0x120c[2]]},calleridname:{type:_0xe5f4x2[_0x120c[2]]},callingpres:{type:_0xe5f4x2[_0x120c[2]]},callingani2:{type:_0xe5f4x2[_0x120c[2]]},callington:{type:_0xe5f4x2[_0x120c[2]]},callingtns:{type:_0xe5f4x2[_0x120c[2]]},dnid:{type:_0xe5f4x2[_0x120c[2]]},rdnis:{type:_0xe5f4x2[_0x120c[2]]},context:{type:_0xe5f4x2[_0x120c[2]]},extension:{type:_0xe5f4x2[_0x120c[2]]},priority:{type:_0xe5f4x2[_0x120c[2]]},enhanced:{type:_0xe5f4x2[_0x120c[2]]},accountcode:{type:_0xe5f4x2[_0x120c[2]]},threadid:{type:_0xe5f4x2[_0x120c[2]]},project_name:{type:_0xe5f4x2[_0x120c[2]]},joinAt:{type:_0xe5f4x2[_0x120c[3]]},leaveAt:{type:_0xe5f4x2[_0x120c[3]],unique:true}},{tableName:_0x120c[4]});return _0xe5f4x3} \ No newline at end of file +/** + * Context Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportSquare = sequelize.define('ReportSquare', { + network: { + type: DataTypes.STRING, + }, + network_script: { + type: DataTypes.STRING, + }, + request: { + type: DataTypes.STRING, + }, + channel: { + type: DataTypes.STRING, + }, + language: { + type: DataTypes.STRING, + }, + type: { + type: DataTypes.STRING, + }, + uniqueid: { + type: DataTypes.STRING, + }, + version: { + type: DataTypes.STRING, + }, + callerid: { + type: DataTypes.STRING, + }, + calleridname: { + type: DataTypes.STRING, + }, + callingpres: { + type: DataTypes.STRING, + }, + callingani2: { + type: DataTypes.STRING, + }, + callington: { + type: DataTypes.STRING, + }, + callingtns: { + type: DataTypes.STRING, + }, + dnid: { + type: DataTypes.STRING, + }, + rdnis: { + type: DataTypes.STRING, + }, + context: { + type: DataTypes.STRING, + }, + extension: { + type: DataTypes.STRING, + }, + priority: { + type: DataTypes.STRING, + }, + enhanced: { + type: DataTypes.STRING, + }, + accountcode: { + type: DataTypes.STRING, + }, + threadid: { + type: DataTypes.STRING, + }, + project_name: { + type: DataTypes.STRING, + }, + joinAt: { + type: DataTypes.DATE, + }, + leaveAt: { + type: DataTypes.DATE, + unique: true + } + }, { + tableName: 'report_square' + }); + + return ReportSquare; +}; diff --git a/server/models/report_square_detail.js b/server/models/report_square_detail.js index 1303944..b9a2f4c 100644 --- a/server/models/report_square_detail.js +++ b/server/models/report_square_detail.js @@ -1 +1,25 @@ -var _0xc2a3=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65\x44\x65\x74\x61\x69\x6C","\x53\x54\x52\x49\x4E\x47","\x72\x65\x70\x6F\x72\x74\x5F\x73\x71\x75\x61\x72\x65\x5F\x64\x65\x74\x61\x69\x6C\x73","\x64\x65\x66\x69\x6E\x65"];module[_0xc2a3[0]]=function(_0xfcf3x1,_0xfcf3x2){var _0xfcf3x3=_0xfcf3x1[_0xc2a3[4]](_0xc2a3[1],{uniqueid:{type:_0xfcf3x2[_0xc2a3[2]]},node:{type:_0xfcf3x2[_0xc2a3[2]]},application:{type:_0xfcf3x2[_0xc2a3[2]]},data:{type:_0xfcf3x2[_0xc2a3[2]]}},{tableName:_0xc2a3[3]});return _0xfcf3x3} \ No newline at end of file +/** + * Context Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportSquareDetail = sequelize.define('ReportSquareDetail', { + uniqueid: { + type: DataTypes.STRING, + }, + node: { + type: DataTypes.STRING, + }, + application: { + type: DataTypes.STRING, + }, + data: { + type: DataTypes.STRING, + } + }, { + tableName: 'report_square_details' + }); + + return ReportSquareDetail; +}; diff --git a/server/models/report_tranfer.js b/server/models/report_tranfer.js index 3c3554b..f507511 100644 --- a/server/models/report_tranfer.js +++ b/server/models/report_tranfer.js @@ -1 +1,25 @@ -var _0x957a=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x54\x72\x61\x6E\x73\x66\x65\x72","\x62\x6C\x69\x6E\x64","\x61\x74\x74\x65\x6E\x64\x65\x64","\x53\x54\x52\x49\x4E\x47","\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x61\x6E\x73\x66\x65\x72","\x64\x65\x66\x69\x6E\x65"];module[_0x957a[0]]=function(_0xaea2x1,_0xaea2x2){var _0xaea2x3=_0xaea2x1[_0x957a[6]](_0x957a[1],{type:_0xaea2x2.ENUM(_0x957a[2],_0x957a[3]),transferercalleridnum:_0xaea2x2[_0x957a[4]],transferercalleridname:_0xaea2x2[_0x957a[4]],transfererconnectedlinenum:_0xaea2x2[_0x957a[4]],transfererconnectedlinename:_0xaea2x2[_0x957a[4]],transferercontext:_0xaea2x2[_0x957a[4]],transfererexten:_0xaea2x2[_0x957a[4]],transfereecontext:_0xaea2x2[_0x957a[4]],transfereeexten:_0xaea2x2[_0x957a[4]],transfereruniqueid:_0xaea2x2[_0x957a[4]],transfererlinkedid:_0xaea2x2[_0x957a[4]],extension:_0xaea2x2[_0x957a[4]]},{tableName:_0x957a[5]});return _0xaea2x3} \ No newline at end of file +/** + * Agent Log Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ReportTransfer = sequelize.define('ReportTransfer', { + type: DataTypes.ENUM('blind', 'attended'), + transferercalleridnum: DataTypes.STRING, + transferercalleridname: DataTypes.STRING, + transfererconnectedlinenum: DataTypes.STRING, + transfererconnectedlinename: DataTypes.STRING, + transferercontext: DataTypes.STRING, + transfererexten: DataTypes.STRING, + transfereecontext: DataTypes.STRING, + transfereeexten: DataTypes.STRING, + transfereruniqueid: DataTypes.STRING, + transfererlinkedid: DataTypes.STRING, + extension: DataTypes.STRING, + }, { + tableName: 'report_transfer' + }); + + return ReportTransfer; +}; diff --git a/server/models/report_tree.js b/server/models/report_tree.js index d5cb009..2c14bfe 100644 --- a/server/models/report_tree.js +++ b/server/models/report_tree.js @@ -1 +1,12 @@ -var _0x2327=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x54\x45\x58\x54","\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65\x73","\x64\x65\x66\x69\x6E\x65"];_0x2327[0];module[_0x2327[1]]=function(_0x2b60x1,_0x2b60x2){var _0x2b60x3=_0x2b60x1[_0x2327[5]](_0x2327[2],{tree:_0x2b60x2[_0x2327[3]]},{tableName:_0x2327[4]});return _0x2b60x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ReportTree = sequelize.define('ReportTree', { + tree: DataTypes.TEXT + }, { + tableName: 'report_trees' + }); + + return ReportTree; +}; diff --git a/server/models/salesforce_account.js b/server/models/salesforce_account.js index 0c712ee..0ea5fa6 100644 --- a/server/models/salesforce_account.js +++ b/server/models/salesforce_account.js @@ -1 +1,33 @@ -var _0x5f39=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x6E\x61\x6D\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x5f39[0];module[_0x5f39[1]]=function(_0xf81cx1,_0xf81cx2){return _0xf81cx1[_0x5f39[13]](_0x5f39[2],{name:_0xf81cx2[_0x5f39[3]],description:_0xf81cx2[_0x5f39[3]],username:{type:_0xf81cx2[_0x5f39[3]],unique:true},remoteUri:_0xf81cx2[_0x5f39[3]],password:_0xf81cx2[_0x5f39[3]],clientId:_0xf81cx2[_0x5f39[3]],clientSecret:_0xf81cx2[_0x5f39[3]],securityToken:_0xf81cx2[_0x5f39[3]]},{tableName:_0x5f39[4],associate:function(_0xf81cx3){_0xf81cx3[_0x5f39[2]][_0x5f39[7]](_0xf81cx3.SalesforceConfiguration,{as:_0x5f39[5],foreignKey:_0x5f39[6]});_0xf81cx3[_0x5f39[2]][_0x5f39[12]](_0x5f39[8],{include:[{model:_0xf81cx3[_0x5f39[9]],as:_0x5f39[5],required:false,attributes:[_0x5f39[10],_0x5f39[11]]}]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SalesforceAccount', { + name: DataTypes.STRING, + description: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + remoteUri: DataTypes.STRING, + password: DataTypes.STRING, + clientId: DataTypes.STRING, + clientSecret: DataTypes.STRING, + securityToken: DataTypes.STRING + }, { + tableName: 'salesforce_accounts', + associate: function(models) { + models.SalesforceAccount.hasMany(models.SalesforceConfiguration, { + as: 'Configurations', + foreignKey: 'AccountId' + }); + models.SalesforceAccount.addScope('configurations', { + include: [{ + model: models.SalesforceConfiguration, + as: 'Configurations', + required: false, + attributes: ['id', 'name'] + }] + }); + } + }); +}; diff --git a/server/models/salesforce_configuration.js b/server/models/salesforce_configuration.js index 6eb95ac..6850116 100644 --- a/server/models/salesforce_configuration.js +++ b/server/models/salesforce_configuration.js @@ -1 +1,27 @@ -var _0xdc32=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x53\x75\x62\x6A\x65\x63\x74","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x46\x69\x65\x6C\x64","\x46\x69\x65\x6C\x64\x49\x64","\x64\x65\x66\x69\x6E\x65"];_0xdc32[0];module[_0xdc32[1]]=function(_0x7027x1,_0x7027x2){return _0x7027x1[_0xdc32[14]](_0xdc32[2],{name:_0x7027x2[_0xdc32[3]],description:_0x7027x2[_0xdc32[3]]},{tableName:_0xdc32[4],associate:function(_0x7027x3){_0x7027x3[_0xdc32[2]][_0xdc32[6]](_0x7027x3.SalesforceAccount,{foreignKey:_0xdc32[5]});_0x7027x3[_0xdc32[2]][_0xdc32[9]](_0x7027x3.SalesforceField,{as:_0xdc32[7],foreignKey:_0xdc32[8]});_0x7027x3[_0xdc32[2]][_0xdc32[9]](_0x7027x3.SalesforceField,{as:_0xdc32[10],foreignKey:_0xdc32[11]});_0x7027x3[_0xdc32[2]][_0xdc32[9]](_0x7027x3.SalesforceField,{as:_0xdc32[12],foreignKey:_0xdc32[13]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SalesforceConfiguration', { + name: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'salesforce_configurations', + associate: function(models) { + models.SalesforceConfiguration.belongsTo(models.SalesforceAccount, { + foreignKey: 'AccountId' + }); + models.SalesforceConfiguration.hasMany(models.SalesforceField, { + as: 'Subject', + foreignKey: 'SubjectId' + }); + models.SalesforceConfiguration.hasMany(models.SalesforceField, { + as: 'Description', + foreignKey: 'DescriptionId' + }); + models.SalesforceConfiguration.hasMany(models.SalesforceField, { + as: 'Field', + foreignKey: 'FieldId' + }); + } + }); +}; diff --git a/server/models/salesforce_field.js b/server/models/salesforce_field.js index 812f36f..f3a3501 100644 --- a/server/models/salesforce_field.js +++ b/server/models/salesforce_field.js @@ -1 +1,22 @@ -var _0x608e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x46\x69\x65\x6C\x64","\x73\x74\x72\x69\x6E\x67","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x5F\x76\x61\x6C\x75\x65","\x53\x54\x52\x49\x4E\x47","\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x608e[0];module[_0x608e[1]]=function(_0xaf5bx1,_0xaf5bx2){return _0xaf5bx1[_0x608e[9]](_0x608e[2],{type:{type:_0xaf5bx2.ENUM(_0x608e[3],_0x608e[4],_0x608e[5]),defaultValue:_0x608e[3]},content:_0xaf5bx2[_0x608e[6]],key:_0xaf5bx2[_0x608e[6]],keyType:{type:_0xaf5bx2.ENUM(_0x608e[3],_0x608e[4])},keyContent:_0xaf5bx2[_0x608e[6]],idField:_0xaf5bx2[_0x608e[6]]},{tableName:_0x608e[7],associate:function(_0xaf5bx3){_0xaf5bx3[_0x608e[2]][_0x608e[8]](_0xaf5bx3.Variable)}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SalesforceField', { + type: { + type: DataTypes.ENUM('string', 'variable', 'key_value'), + defaultValue: 'string' + }, + content: DataTypes.STRING, + key: DataTypes.STRING, + keyType: { + type: DataTypes.ENUM('string', 'variable') + }, + keyContent: DataTypes.STRING, + idField: DataTypes.STRING + }, { + tableName: 'salesforce_fields', + associate: function(models) { + models.SalesforceField.belongsTo(models.Variable); + } + }); +}; diff --git a/server/models/service.js b/server/models/service.js index 8e61f66..a8efea2 100644 --- a/server/models/service.js +++ b/server/models/service.js @@ -1 +1,42 @@ -var _0x9444=["\x65\x78\x70\x6F\x72\x74\x73","\x53\x65\x72\x76\x69\x63\x65","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x73\x65\x72\x76\x69\x63\x65\x73","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x73\x65\x72\x76\x69\x63\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x43\x6F\x6E\x74\x61\x63\x74\x73","\x63\x61\x73\x63\x61\x64\x65","\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64\x73","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0x9444[0]]=function(_0xa5d9x1,_0xa5d9x2){var _0xa5d9x3=_0xa5d9x1[_0x9444[15]](_0x9444[1],{name:{type:_0xa5d9x2[_0x9444[2]],unique:true},description:{type:_0xa5d9x2[_0x9444[2]],allowNull:true},defaultEntry:{type:_0xa5d9x2[_0x9444[3]],defaultValue:false}},{tableName:_0x9444[4],associate:function(_0xa5d9x4){_0xa5d9x3[_0x9444[7]](_0xa5d9x4.User,{through:_0xa5d9x4[_0x9444[5]],foreignKey:_0x9444[6]});_0xa5d9x3[_0x9444[9]](_0xa5d9x4.CustomField,{as:_0x9444[8],required:false});_0xa5d9x3[_0x9444[9]](_0xa5d9x4.Contact,{as:_0x9444[10],onDelete:_0x9444[11]});_0xa5d9x3[_0x9444[14]](_0x9444[12],{include:[{model:_0xa5d9x4[_0x9444[13]],as:_0x9444[8]}]})}});return _0xa5d9x3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var Service = sequelize.define('Service', { + name: { + type: DataTypes.STRING, + unique: true + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + defaultEntry: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'services', + associate: function(models) { + Service.belongsToMany(models.User, { + through: models.UserHasService, + foreignKey: 'service' + }); + Service.hasMany(models.CustomField, { + as: 'CustomFields', + required: false + }); + Service.hasMany(models.Contact, { + as: 'Contacts', + onDelete: 'cascade' + }); + Service.addScope('customFields', { + include: [{ + model: models.CustomField, + as: 'CustomFields' + }] + }); + } + }); + + return Service; +}; diff --git a/server/models/settings.js b/server/models/settings.js index c61ab93..a7b7931 100644 --- a/server/models/settings.js +++ b/server/models/settings.js @@ -1 +1,32 @@ -var _0x5924=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x65\x74\x74\x69\x6E\x67\x73","\x54\x45\x58\x54","\x53\x54\x52\x49\x4E\x47","\x73\x65\x74\x74\x69\x6E\x67\x73","\x64\x65\x66\x69\x6E\x65"];_0x5924[0];module[_0x5924[1]]=function(_0x52f1x1,_0x52f1x2){var _0x52f1x3=_0x52f1x1[_0x5924[6]](_0x5924[2],{license:_0x52f1x2[_0x5924[3]],min_internal:{type:_0x52f1x2.INTEGER(11),unique:true,defaultValue:1000},min_mailbox:{type:_0x52f1x2.INTEGER(11),unique:true,defaultValue:1000},agi_port:{type:_0x52f1x2.INTEGER(11),defaultValue:4573},automation_timeout:{type:_0x52f1x2.INTEGER(11),defaultValue:3600},soundPath:_0x52f1x2[_0x5924[4]]},{tableName:_0x5924[5]});return _0x52f1x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Settings = sequelize.define('Settings', { + license: DataTypes.TEXT, + min_internal: { + type: DataTypes.INTEGER(11), + unique: true, + defaultValue: 1000 + }, + min_mailbox: { + type: DataTypes.INTEGER(11), + unique: true, + defaultValue: 1000 + }, + agi_port: { + type: DataTypes.INTEGER(11), + defaultValue: 4573 + }, + automation_timeout: { + type: DataTypes.INTEGER(11), + defaultValue: 3600 + }, + soundPath: DataTypes.STRING + }, { + tableName: 'settings' + }); + + return Settings; + +}; diff --git a/server/models/sound.js b/server/models/sound.js index 49d3b0b..3b5ab98 100644 --- a/server/models/sound.js +++ b/server/models/sound.js @@ -1 +1,36 @@ -var _0x863d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x6F\x75\x6E\x64","\x53\x54\x52\x49\x4E\x47","","\x54\x68\x65\x20\x6E\x61\x6D\x65\x20\x63\x61\x6E\x6E\x6F\x74\x20\x62\x65\x20\x65\x6D\x70\x74\x79\x21","\x46\x4C\x4F\x41\x54","\x42\x49\x47\x49\x4E\x54","\x49\x4E\x54\x45\x47\x45\x52","\x73\x6F\x75\x6E\x64\x73","\x64\x65\x66\x69\x6E\x65"];_0x863d[0];module[_0x863d[1]]=function(_0xfc53x1,_0xfc53x2){var _0xfc53x3=_0xfc53x1[_0x863d[10]](_0x863d[2],{name:_0xfc53x2[_0x863d[3]],save_name:_0xfc53x2[_0x863d[3]],display_name:{type:_0xfc53x2[_0x863d[3]],allowNull:false,defaultValue:_0x863d[4],validate:{notEmpty:{msg:_0x863d[5]}}},description:_0xfc53x2[_0x863d[3]],original_format:_0xfc53x2[_0x863d[3]],original_duration:_0xfc53x2[_0x863d[6]],original_sampleCount:_0xfc53x2[_0x863d[7]],original_channelCount:_0xfc53x2[_0x863d[8]],original_bitRate:_0xfc53x2[_0x863d[7]],original_sampleRate:_0xfc53x2[_0x863d[8]],converted_format:_0xfc53x2[_0x863d[3]],converted_duration:_0xfc53x2[_0x863d[6]],converted_sampleCount:_0xfc53x2[_0x863d[7]],converted_channelCount:_0xfc53x2[_0x863d[8]],converted_bitRate:_0xfc53x2[_0x863d[7]],converted_sampleRate:_0xfc53x2[_0x863d[8]]},{tableName:_0x863d[9]});return _0xfc53x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Sound = sequelize.define('Sound', { + name: DataTypes.STRING, + save_name: DataTypes.STRING, + display_name: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: '', + validate: { + notEmpty: { + msg: "The name cannot be empty!" + } // don't allow empty strings + } + }, + description: DataTypes.STRING, + original_format: DataTypes.STRING, + original_duration: DataTypes.FLOAT, + original_sampleCount: DataTypes.BIGINT, + original_channelCount: DataTypes.INTEGER, + original_bitRate: DataTypes.BIGINT, + original_sampleRate: DataTypes.INTEGER, + converted_format: DataTypes.STRING, + converted_duration: DataTypes.FLOAT, + converted_sampleCount: DataTypes.BIGINT, + converted_channelCount: DataTypes.INTEGER, + converted_bitRate: DataTypes.BIGINT, + converted_sampleRate: DataTypes.INTEGER + }, { + tableName: 'sounds' + }); + + return Sound; +}; diff --git a/server/models/square_odbc.js b/server/models/square_odbc.js index be6e2d5..a8a9bf8 100644 --- a/server/models/square_odbc.js +++ b/server/models/square_odbc.js @@ -1 +1,24 @@ -var _0x76d0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x53\x54\x52\x49\x4E\x47","\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63","\x64\x65\x66\x69\x6E\x65"];_0x76d0[0];module[_0x76d0[1]]=function(_0x1ddfx1,_0x1ddfx2){var _0x1ddfx3=_0x1ddfx1[_0x76d0[5]](_0x76d0[2],{name:{type:_0x1ddfx2[_0x76d0[3]],unique:true,allowNull:false,validate:{notEmpty:true}},dsn:{type:_0x1ddfx2[_0x76d0[3]]},description:_0x1ddfx2[_0x76d0[3]]},{tableName:_0x76d0[4]});return _0x1ddfx3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var SquareOdbc = sequelize.define('SquareOdbc', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true + }, + }, + dsn: { + type: DataTypes.STRING, + }, + description: DataTypes.STRING + }, { + tableName: 'square_odbc' + }); + + return SquareOdbc; + +}; diff --git a/server/models/square_project.js b/server/models/square_project.js index b1d70ea..e9f9ccd 100644 --- a/server/models/square_project.js +++ b/server/models/square_project.js @@ -1 +1,29 @@ -var _0xc855=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x6C\x6F\x6E\x67","\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x64\x65\x66\x69\x6E\x65"];_0xc855[0];module[_0xc855[1]]=function(_0xcd1ax1,_0xcd1ax2){var _0xcd1ax3=_0xcd1ax1[_0xc855[7]](_0xc855[2],{name:{type:_0xcd1ax2[_0xc855[3]],unique:true,allowNull:false,validate:{notEmpty:true}},description:_0xcd1ax2[_0xc855[3]],preproduction:{type:_0xcd1ax2[_0xc855[4]],length:_0xc855[5]},production:{type:_0xcd1ax2[_0xc855[4]],length:_0xc855[5]}},{tableName:_0xc855[6]});return _0xcd1ax3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var SquareProject = sequelize.define('SquareProject', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true + } + }, + description: DataTypes.STRING, + preproduction: { + type: DataTypes.TEXT, + length: 'long' + }, + production: { + type: DataTypes.TEXT, + length: 'long' + } + }, { + tableName: 'square_projects', + }); + + return SquareProject; + +}; diff --git a/server/models/sugarcrm_account.js b/server/models/sugarcrm_account.js index c0985c7..1130f64 100644 --- a/server/models/sugarcrm_account.js +++ b/server/models/sugarcrm_account.js @@ -1 +1,29 @@ -var _0x5ad4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x6E\x61\x6D\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x5ad4[0];module[_0x5ad4[1]]=function(_0x1956x1,_0x1956x2){return _0x1956x1[_0x5ad4[13]](_0x5ad4[2],{name:_0x1956x2[_0x5ad4[3]],description:_0x1956x2[_0x5ad4[3]],username:{type:_0x1956x2[_0x5ad4[3]]},remoteUri:_0x1956x2[_0x5ad4[3]],password:_0x1956x2[_0x5ad4[3]]},{tableName:_0x5ad4[4],associate:function(_0x1956x3){_0x1956x3[_0x5ad4[2]][_0x5ad4[7]](_0x1956x3.SugarcrmConfiguration,{as:_0x5ad4[5],foreignKey:_0x5ad4[6]});_0x1956x3[_0x5ad4[2]][_0x5ad4[12]](_0x5ad4[8],{include:[{model:_0x1956x3[_0x5ad4[9]],as:_0x5ad4[5],required:false,attributes:[_0x5ad4[10],_0x5ad4[11]]}]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SugarcrmAccount', { + name: DataTypes.STRING, + description: DataTypes.STRING, + username: { + type: DataTypes.STRING + }, + remoteUri: DataTypes.STRING, + password: DataTypes.STRING + }, { + tableName: 'sugarcrm_accounts', + associate: function(models) { + models.SugarcrmAccount.hasMany(models.SugarcrmConfiguration, { + as: 'Configurations', + foreignKey: 'AccountId' + }); + models.SugarcrmAccount.addScope('configurations', { + include: [{ + model: models.SugarcrmConfiguration, + as: 'Configurations', + required: false, + attributes: ['id', 'name'] + }] + }); + } + }); +}; diff --git a/server/models/sugarcrm_configuration.js b/server/models/sugarcrm_configuration.js index ba007e2..cae512a 100644 --- a/server/models/sugarcrm_configuration.js +++ b/server/models/sugarcrm_configuration.js @@ -1 +1,27 @@ -var _0x5a8f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x53\x75\x62\x6A\x65\x63\x74","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x46\x69\x65\x6C\x64","\x46\x69\x65\x6C\x64\x49\x64","\x64\x65\x66\x69\x6E\x65"];_0x5a8f[0];module[_0x5a8f[1]]=function(_0x2d66x1,_0x2d66x2){return _0x2d66x1[_0x5a8f[14]](_0x5a8f[2],{name:_0x2d66x2[_0x5a8f[3]],description:_0x2d66x2[_0x5a8f[3]]},{tableName:_0x5a8f[4],associate:function(_0x2d66x3){_0x2d66x3[_0x5a8f[2]][_0x5a8f[6]](_0x2d66x3.SugarcrmAccount,{foreignKey:_0x5a8f[5]});_0x2d66x3[_0x5a8f[2]][_0x5a8f[9]](_0x2d66x3.SugarcrmField,{as:_0x5a8f[7],foreignKey:_0x5a8f[8]});_0x2d66x3[_0x5a8f[2]][_0x5a8f[9]](_0x2d66x3.SugarcrmField,{as:_0x5a8f[10],foreignKey:_0x5a8f[11]});_0x2d66x3[_0x5a8f[2]][_0x5a8f[9]](_0x2d66x3.SugarcrmField,{as:_0x5a8f[12],foreignKey:_0x5a8f[13]})}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SugarcrmConfiguration', { + name: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'sugarcrm_configurations', + associate: function(models) { + models.SugarcrmConfiguration.belongsTo(models.SugarcrmAccount, { + foreignKey: 'AccountId' + }); + models.SugarcrmConfiguration.hasMany(models.SugarcrmField, { + as: 'Subject', + foreignKey: 'SubjectId' + }); + models.SugarcrmConfiguration.hasMany(models.SugarcrmField, { + as: 'Description', + foreignKey: 'DescriptionId' + }); + models.SugarcrmConfiguration.hasMany(models.SugarcrmField, { + as: 'Field', + foreignKey: 'FieldId' + }); + } + }); +}; diff --git a/server/models/sugarcrm_field.js b/server/models/sugarcrm_field.js index 76e8cf4..7998058 100644 --- a/server/models/sugarcrm_field.js +++ b/server/models/sugarcrm_field.js @@ -1 +1,22 @@ -var _0x417b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x75\x67\x61\x72\x63\x72\x6D\x46\x69\x65\x6C\x64","\x73\x74\x72\x69\x6E\x67","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x5F\x76\x61\x6C\x75\x65","\x53\x54\x52\x49\x4E\x47","\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0x417b[0];module[_0x417b[1]]=function(_0x511cx1,_0x511cx2){return _0x511cx1[_0x417b[9]](_0x417b[2],{type:{type:_0x511cx2.ENUM(_0x417b[3],_0x417b[4],_0x417b[5]),defaultValue:_0x417b[3]},content:_0x511cx2[_0x417b[6]],key:_0x511cx2[_0x417b[6]],keyType:{type:_0x511cx2.ENUM(_0x417b[3],_0x417b[4])},keyContent:_0x511cx2[_0x417b[6]],idField:_0x511cx2[_0x417b[6]]},{tableName:_0x417b[7],associate:function(_0x511cx3){_0x511cx3[_0x417b[2]][_0x417b[8]](_0x511cx3.Variable)}})} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('SugarcrmField', { + type: { + type: DataTypes.ENUM('string', 'variable', 'key_value'), + defaultValue: 'string' + }, + content: DataTypes.STRING, + key: DataTypes.STRING, + keyType: { + type: DataTypes.ENUM('string', 'variable') + }, + keyContent: DataTypes.STRING, + idField: DataTypes.STRING + }, { + tableName: 'sugarcrm_fields', + associate: function(models) { + models.SugarcrmField.belongsTo(models.Variable); + } + }); +}; diff --git a/server/models/tag.js b/server/models/tag.js index 0411a94..ff7b5ca 100644 --- a/server/models/tag.js +++ b/server/models/tag.js @@ -1 +1,35 @@ -var _0x3bb2=["\x65\x78\x70\x6F\x72\x74\x73","\x54\x61\x67","\x53\x54\x52\x49\x4E\x47","\x74\x61\x67\x73","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x5F\x68\x61\x73\x5F\x74\x61\x67\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0x3bb2[0]]=function(_0x9615x1,_0x9615x2){var _0x9615x3=_0x9615x1[_0x3bb2[8]](_0x3bb2[1],{name:{type:_0x9615x2[_0x3bb2[2]],unique:true,allowNull:false,validate:{notEmpty:true}},description:_0x9615x2[_0x3bb2[2]]},{tableName:_0x3bb2[3],associate:function(_0x9615x4){_0x9615x3[_0x3bb2[5]](_0x9615x4.ZendeskConfiguration,{through:_0x3bb2[4]});_0x9615x3[_0x3bb2[7]](_0x3bb2[6],{include:[{all:true}]})}});return _0x9615x3} \ No newline at end of file +/** + * tag Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Tag = sequelize.define('Tag', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + } + }, + description: DataTypes.STRING + }, { + tableName: 'tags', + associate: function(models) { + Tag.belongsToMany(models.ZendeskConfiguration, { + through: 'zendesk_configuration_has_tags' + }); + Tag.addScope('configuration', { + include: [{ + all: true + }] + }); + // Tag.belongsToMany(models.Contact, { + // through: 'contact_tags' + // }); + } + }); + + return Tag; +}; diff --git a/server/models/team.js b/server/models/team.js index db65271..e2d6f73 100644 --- a/server/models/team.js +++ b/server/models/team.js @@ -1 +1,42 @@ -var _0xc2ca=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x54\x65\x61\x6D","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x74\x65\x61\x6D\x73","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x61\x75\x6C\x74","\x55\x73\x65\x72","\x61\x67\x65\x6E\x74","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xc2ca[0]);module[_0xc2ca[1]]=function(_0xa317x2,_0xa317x3){var _0xa317x4=_0xa317x2[_0xc2ca[17]](_0xc2ca[2],{name:{type:_0xa317x3[_0xc2ca[3]],allowNull:false,unique:true},description:{type:_0xa317x3[_0xc2ca[3]]},defaultEntry:{type:_0xa317x3[_0xc2ca[4]],defaultValue:0}},{tableName:_0xc2ca[5],associate:function(_0xa317x5){_0xa317x4[_0xc2ca[7]](_0xa317x5.User,{through:_0xa317x5[_0xc2ca[6]]});_0xa317x4[_0xc2ca[16]](_0xc2ca[8],{include:[{model:_0xa317x5[_0xc2ca[9]],where:{role:_0xc2ca[10]},required:false,attributes:[_0xc2ca[11],_0xc2ca[12],_0xc2ca[13],_0xc2ca[14],_0xc2ca[15]]}]})}});return _0xa317x4} \ No newline at end of file +/** + * User Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var Team = sequelize.define('Team', { + name: { + type: DataTypes.STRING, + allowNull: false, + unique: true + }, + description: { + type: DataTypes.STRING + }, + defaultEntry: { + type: DataTypes.BOOLEAN, + defaultValue: 0 + } + }, { + tableName: 'teams', + associate: function(models) { + Team.belongsToMany(models.User, { + through: models.UserHasTeam + }); + Team.addScope('default', { + include: [{ + model: models.User, + where: { + role: 'agent' + }, + required: false, + attributes: ['id', 'name', 'fullname', 'email', 'internal'] + }] + }); + } + }); + + return Team; +}; diff --git a/server/models/telephone.js b/server/models/telephone.js index 17f875c..105d888 100644 --- a/server/models/telephone.js +++ b/server/models/telephone.js @@ -1 +1,507 @@ -var _0xc887=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x72\x79\x70\x74\x6F","\x6D\x64\x35","\x6C\x6F\x64\x61\x73\x68","\x65\x78\x70\x6F\x72\x74\x73","\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x53\x54\x52\x49\x4E\x47","\x6E\x61\x6D\x65","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x64\x65\x66\x61\x75\x6C\x74\x75\x73\x65\x72","\x73\x61\x6C\x74","\x6D\x61\x6B\x65\x53\x61\x6C\x74","\x70\x61\x73\x73\x77\x6F\x72\x64","\x65\x6E\x63\x72\x79\x70\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x6D\x64\x35\x73\x65\x63\x72\x65\x74","\x3A\x61\x73\x74\x65\x72\x69\x73\x6B\x3A","\x6D\x64\x35\x50\x61\x73\x73\x77\x6F\x72\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x61\x63\x63\x6F\x75\x6E\x74\x63\x6F\x64\x65","\x64\x79\x6E\x61\x6D\x69\x63","\x66\x72\x69\x65\x6E\x64","\x75\x73\x65\x72","\x70\x65\x65\x72","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x75\x64\x70","\x72\x66\x63\x32\x38\x33\x33","\x69\x6E\x66\x6F","\x73\x68\x6F\x72\x74\x69\x6E\x66\x6F","\x69\x6E\x62\x61\x6E\x64","\x61\x75\x74\x6F","\x79\x65\x73","\x6E\x6F","\x6E\x6F\x6E\x61\x74","\x75\x70\x64\x61\x74\x65","\x66\x6F\x72\x63\x65\x5F\x72\x70\x6F\x72\x74\x2C\x63\x6F\x6D\x65\x64\x69\x61","\x65\x6E","\x61\x6C\x6C","\x61\x6C\x61\x77\x3B\x75\x6C\x61\x77\x3B\x67\x73\x6D","\x70\x6F\x72\x74\x2C\x69\x6E\x76\x69\x74\x65","\x6E\x65\x76\x65\x72","\x22\x22\x20\x3C\x3E","\x61\x63\x63\x65\x70\x74","\x72\x65\x66\x75\x73\x65","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x75\x61\x63","\x75\x61\x73","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42","\x75\x73\x65\x72\x73","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x62\x61\x73\x65\x36\x34","\x72\x61\x6E\x64\x6F\x6D\x42\x79\x74\x65\x73","","\x70\x62\x6B\x64\x66\x32\x53\x79\x6E\x63","\x64\x65\x66\x69\x6E\x65"];_0xc887[0];var crypto=require(_0xc887[1]);var md5=require(_0xc887[2]);var _=require(_0xc887[3]);module[_0xc887[4]]=function(_0xf458x4,_0xf458x5){var _0xf458x6=_0xf458x4[_0xc887[60]](_0xc887[5],{name:{type:_0xf458x5[_0xc887[6]],unique:true,validate:{notEmpty:true,is:/^[A-Za-z0-9\.\_]+$/i},set:function(_0xf458x7){this[_0xc887[8]](_0xc887[7],_0xf458x7);this[_0xc887[8]](_0xc887[9],_0xf458x7)}},password:{type:_0xf458x5[_0xc887[6]],allowNull:false,validate:{notEmpty:true},set:function(_0xf458x8){this[_0xc887[10]]=this[_0xc887[11]]();this[_0xc887[8]](_0xc887[12],this[_0xc887[13]](_0xf458x8));this[_0xc887[8]](_0xc887[14],this[_0xc887[16]](this[_0xc887[7]]+_0xc887[15]+_0xf458x8))}},internal:{type:_0xf458x5.INTEGER(11),unique:true,set:function(_0xf458x9){this[_0xc887[8]](_0xc887[17],_0xf458x9);this[_0xc887[8]](_0xc887[18],_0xf458x9)}},ipaddr:{type:_0xf458x5[_0xc887[6]],allowNull:true},port:{type:_0xf458x5.INTEGER(5),allowNull:true},regseconds:{type:_0xf458x5.INTEGER(11),allowNull:true},defaultuser:{type:_0xf458x5[_0xc887[6]],allowNull:true},fullcontact:{type:_0xf458x5[_0xc887[6]],allowNull:true},regserver:{type:_0xf458x5[_0xc887[6]],allowNull:true},useragent:{type:_0xf458x5[_0xc887[6]],allowNull:true},lastms:{type:_0xf458x5.INTEGER(11),allowNull:true},host:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[19]},type:{type:_0xf458x5.ENUM(_0xc887[20],_0xc887[21],_0xc887[22]),allowNull:true,defaultValue:_0xc887[20]},context:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[23]},permit:{type:_0xf458x5[_0xc887[6]],allowNull:true},deny:{type:_0xf458x5[_0xc887[6]],allowNull:true},secret:{type:_0xf458x5[_0xc887[6]],allowNull:true},md5secret:{type:_0xf458x5[_0xc887[6]],allowNull:true},remotesecret:{type:_0xf458x5[_0xc887[6]],allowNull:true},transport:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[24]},dtmfmode:{type:_0xf458x5.ENUM(_0xc887[25],_0xc887[26],_0xc887[27],_0xc887[28],_0xc887[29]),allowNull:true,defaultValue:_0xc887[25]},directmedia:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31],_0xc887[32],_0xc887[33]),allowNull:true,defaultValue:_0xc887[31]},nat:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[34]},callgroup:{type:_0xf458x5[_0xc887[6]],allowNull:true},pickupgroup:{type:_0xf458x5[_0xc887[6]],allowNull:true},language:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[35]},disallow:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[36]},allow:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[37]},insecure:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[38]},trustrpid:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[31]},progressinband:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31],_0xc887[39]),allowNull:true},promiscredir:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},useclientcode:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},accountcode:{type:_0xf458x5.INTEGER(11),allowNull:true},setvar:{type:_0xf458x5[_0xc887[6]],allowNull:true},callerid:{type:_0xf458x5[_0xc887[6]],allowNull:true,defaultValue:_0xc887[40]},amaflags:{type:_0xf458x5[_0xc887[6]],allowNull:true},callcounter:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[30]},busylevel:{type:_0xf458x5.INTEGER(11),allowNull:true},allowoverlap:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},allowsubscribe:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},videosupport:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},maxcallbitrate:{type:_0xf458x5.INTEGER(11),allowNull:true},rfc2833compensate:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},mailbox:{type:_0xf458x5[_0xc887[6]],allowNull:true},"\x73\x65\x73\x73\x69\x6F\x6E\x2D\x74\x69\x6D\x65\x72\x73":{type:_0xf458x5.ENUM(_0xc887[41],_0xc887[42],_0xc887[43]),allowNull:true},"\x73\x65\x73\x73\x69\x6F\x6E\x2D\x65\x78\x70\x69\x72\x65\x73":{type:_0xf458x5.INTEGER(11),allowNull:true},"\x73\x65\x73\x73\x69\x6F\x6E\x2D\x6D\x69\x6E\x73\x65":{type:_0xf458x5.INTEGER(11),allowNull:true},"\x73\x65\x73\x73\x69\x6F\x6E\x2D\x72\x65\x66\x72\x65\x73\x68\x65\x72":{type:_0xf458x5.ENUM(_0xc887[44],_0xc887[45]),allowNull:true},t38pt_usertpsource:{type:_0xf458x5[_0xc887[6]],allowNull:true},regexten:{type:_0xf458x5[_0xc887[6]],allowNull:true},fromdomain:{type:_0xf458x5[_0xc887[6]],allowNull:true},fromuser:{type:_0xf458x5[_0xc887[6]],allowNull:true},qualify:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[30]},defaultip:{type:_0xf458x5[_0xc887[6]],allowNull:true},rtptimeout:{type:_0xf458x5.INTEGER(11),allowNull:true},rtpholdtimeout:{type:_0xf458x5.INTEGER(11),allowNull:true},sendrpid:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[31]},outboundproxy:{type:_0xf458x5[_0xc887[6]],allowNull:true},callbackextension:{type:_0xf458x5[_0xc887[6]],allowNull:true},timert1:{type:_0xf458x5.INTEGER(11),allowNull:true},timerb:{type:_0xf458x5.INTEGER(11),allowNull:true},qualifyfreq:{type:_0xf458x5.INTEGER(11),allowNull:true},constantssrc:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},contactpermit:{type:_0xf458x5[_0xc887[6]],allowNull:true},contactdeny:{type:_0xf458x5[_0xc887[6]],allowNull:true},usereqphone:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[31]},textsupport:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},faxdetect:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},buggymwi:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},auth:{type:_0xf458x5[_0xc887[6]],allowNull:true},fullname:{type:_0xf458x5[_0xc887[6]],allowNull:true},trunkname:{type:_0xf458x5[_0xc887[6]],allowNull:true},cid_number:{type:_0xf458x5[_0xc887[6]],allowNull:true},callingpres:{type:_0xf458x5.ENUM(_0xc887[46],_0xc887[47],_0xc887[48],_0xc887[49],_0xc887[50],_0xc887[51],_0xc887[52],_0xc887[53]),allowNull:true},mohinterpret:{type:_0xf458x5[_0xc887[6]],allowNull:true},mohsuggest:{type:_0xf458x5[_0xc887[6]],allowNull:true},parkinglot:{type:_0xf458x5[_0xc887[6]],allowNull:true},hasvoicemail:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},subscribemwi:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},vmexten:{type:_0xf458x5[_0xc887[6]],allowNull:true},description:{type:_0xf458x5[_0xc887[6]],allowNull:true},autoframing:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},limitonpeers:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[30]},rtpkeepalive:{type:_0xf458x5.INTEGER(11),allowNull:true},"\x63\x61\x6C\x6C\x2D\x6C\x69\x6D\x69\x74":{type:_0xf458x5.INTEGER(11),allowNull:true,defaultValue:null},g726nonstandard:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},ignoresdpversion:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},allowtransfer:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},dynamic:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true},encryption:{type:_0xf458x5.ENUM(_0xc887[30],_0xc887[31]),allowNull:true,defaultValue:_0xc887[31]},registry:{type:_0xf458x5[_0xc887[6]],allowNull:true}},{tableName:_0xc887[54],defaultScope:{where:{role:_0xc887[55]}},instanceMethods:{authenticate:function(_0xf458xa){return this[_0xc887[13]](_0xf458xa)===this[_0xc887[12]]},makeSalt:function(){return crypto[_0xc887[57]](16).toString(_0xc887[56])},encryptPassword:function(_0xf458x8){if(!_0xf458x8||!this[_0xc887[10]]){return _0xc887[58]};var _0xf458xb= new Buffer(this[_0xc887[10]],_0xc887[56]);return crypto[_0xc887[59]](_0xf458x8,_0xf458xb,10000,64).toString(_0xc887[56])},md5Password:function(_0xf458x8){if(!_0xf458x8){return _0xc887[58]};return md5(_0xf458x8)}},associate:function(_0xf458xc){}});return _0xf458x6} \ No newline at end of file +'use strict'; + +var crypto = require('crypto'); +var md5 = require('md5'); +var _ = require('lodash'); + +module.exports = function(sequelize, DataTypes) { + var Telephone = sequelize.define('Telephone', { + name: { + type: DataTypes.STRING, + unique: true, + validate: { + notEmpty: true, + is: /^[A-Za-z0-9\.\_]+$/i + }, + set: function(name) { + this.setDataValue('name', name); + this.setDataValue('defaultuser', name); + } + }, + password: { + type: DataTypes.STRING, + allowNull: false, + validate: { + notEmpty: true + }, + set: function(password) { + this.salt = this.makeSalt(); + this.setDataValue('password', this.encryptPassword(password)); + this.setDataValue('md5secret', this.md5Password(this.name + ':asterisk:' + password)); + } + }, + internal: { + type: DataTypes.INTEGER(11), + unique: true, + set: function(internal) { + this.setDataValue('internal', internal); + this.setDataValue('accountcode', internal); + } + }, + ipaddr: { + type: DataTypes.STRING, + allowNull: true, + }, + port: { + type: DataTypes.INTEGER(5), + allowNull: true, + }, + regseconds: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + defaultuser: { + type: DataTypes.STRING, + allowNull: true, + }, + fullcontact: { + type: DataTypes.STRING, + allowNull: true, + }, + regserver: { + type: DataTypes.STRING, + allowNull: true, + }, + useragent: { + type: DataTypes.STRING, + allowNull: true, + }, + lastms: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + host: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'dynamic' + }, + type: { + type: DataTypes.ENUM('friend', 'user', 'peer'), + allowNull: true, + defaultValue: 'friend' + }, + context: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'from-sip' + }, + permit: { + type: DataTypes.STRING, + allowNull: true, + }, + deny: { + type: DataTypes.STRING, + allowNull: true, + }, + secret: { + type: DataTypes.STRING, + allowNull: true, + }, + md5secret: { + type: DataTypes.STRING, + allowNull: true + }, + remotesecret: { + type: DataTypes.STRING, + allowNull: true, + }, + transport: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'udp' + }, + dtmfmode: { + type: DataTypes.ENUM('rfc2833', 'info', 'shortinfo', 'inband', + 'auto'), + allowNull: true, + defaultValue: 'rfc2833' + }, + directmedia: { + type: DataTypes.ENUM('yes', 'no', 'nonat', 'update'), + allowNull: true, + defaultValue: 'no' + }, + nat: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'force_rport,comedia' + }, + callgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + pickupgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + language: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'en' + }, + disallow: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'all' + }, + allow: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'alaw;ulaw;gsm' + }, + insecure: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'port,invite' + }, + trustrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + progressinband: { + type: DataTypes.ENUM('yes', 'no', 'never'), + allowNull: true, + }, + promiscredir: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + useclientcode: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + accountcode: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + setvar: { + type: DataTypes.STRING, + allowNull: true, + }, + callerid: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '"" <>' + }, + amaflags: { + type: DataTypes.STRING, + allowNull: true, + }, + callcounter: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + busylevel: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + allowoverlap: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowsubscribe: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + videosupport: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + maxcallbitrate: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rfc2833compensate: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + mailbox: { + type: DataTypes.STRING, + allowNull: true, + }, + "session-timers": { + type: DataTypes.ENUM('accept', 'refuse', 'originate'), + allowNull: true, + }, + "session-expires": { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + "session-minse": { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + "session-refresher": { + type: DataTypes.ENUM('uac', 'uas'), + allowNull: true, + }, + t38pt_usertpsource: { + type: DataTypes.STRING, + allowNull: true, + }, + regexten: { + type: DataTypes.STRING, + allowNull: true, + }, + fromdomain: { + type: DataTypes.STRING, + allowNull: true, + }, + fromuser: { + type: DataTypes.STRING, + allowNull: true, + }, + qualify: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + defaultip: { + type: DataTypes.STRING, + allowNull: true, + }, + rtptimeout: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rtpholdtimeout: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + sendrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + outboundproxy: { + type: DataTypes.STRING, + allowNull: true, + }, + callbackextension: { + type: DataTypes.STRING, + allowNull: true, + }, + timert1: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + timerb: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + qualifyfreq: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + constantssrc: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + contactpermit: { + type: DataTypes.STRING, + allowNull: true, + }, + contactdeny: { + type: DataTypes.STRING, + allowNull: true, + }, + usereqphone: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + textsupport: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + faxdetect: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + buggymwi: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + auth: { + type: DataTypes.STRING, + allowNull: true, + }, + fullname: { + type: DataTypes.STRING, + allowNull: true, + }, + trunkname: { + type: DataTypes.STRING, + allowNull: true, + }, + cid_number: { + type: DataTypes.STRING, + allowNull: true, + }, + callingpres: { + type: DataTypes.ENUM('ALLOWED_NOT_SCREENED', + 'ALLOWED_PASSED_SCREEN', 'ALLOWED_FAILED_SCREEN', 'ALLOWED', + 'PROHIB_NOT_SCREENED', 'PROHIB_PASSED_SCREEN', + 'PROHIB_FAILED_SCREEN', 'PROHIB'), + allowNull: true, + }, + mohinterpret: { + type: DataTypes.STRING, + allowNull: true, + }, + mohsuggest: { + type: DataTypes.STRING, + allowNull: true, + }, + parkinglot: { + type: DataTypes.STRING, + allowNull: true, + }, + hasvoicemail: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + subscribemwi: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + vmexten: { + type: DataTypes.STRING, + allowNull: true, + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + autoframing: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + limitonpeers: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + rtpkeepalive: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + "call-limit": { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null + }, + g726nonstandard: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + ignoresdpversion: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowtransfer: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + dynamic: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + encryption: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + registry: { + type: DataTypes.STRING, + allowNull: true, + } + }, { + tableName: 'users', + defaultScope: { + where: { + role: 'telephone' + } + }, + instanceMethods: { + /** + * Authenticate - check if the passwords are the same + * + * @param {String} plainText + * {function} callBack + * @api public + */ + authenticate: function(plainText) { + return this.encryptPassword(plainText) === this.password; + }, + /** + * Make salt + * + * @return {String} + * @api public + */ + makeSalt: function() { + return crypto.randomBytes(16).toString('base64'); + }, + /** + * Encrypt password + * + * @param {String} password + * @return {String} + * @api public + */ + encryptPassword: function(password) { + if (!password || !this.salt) return ''; + var salt = new Buffer(this.salt, 'base64'); + return crypto.pbkdf2Sync(password, salt, 10000, 64).toString( + 'base64'); + }, + /** + * md5 password + * + * @param {String} password + * @return {String} + * @api public + */ + md5Password: function(password) { + if (!password) return ''; + return md5(password); + } + }, + associate: function(models) { + // BELOGNS TO MANY + // Telephone.hasMany(models.ChatMessage); + // Telephone.hasMany(models.Contact); + // Telephone.belongsToMany(models.Module, { + // through: 'user_has_modules' + // }); + // Telephone.belongsToMany(models.Channel, { + // through: 'user_has_channels' + // }); + // Telephone.belongsToMany(models.Team, { + // through: models.UserHasTeam + // }); + // Telephone.belongsToMany(models.ChatRoom, { + // through: models.UserHasChatRoom + // }); + // Telephone.belongsToMany(models.MailQueue, { + // through: models.UserHasMailQueue + // }); + // Telephone.belongsToMany(models.ChatQueue, { + // through: models.UserHasChatQueue + // }); + // Telephone.belongsToMany(models.VoiceQueue, { + // through: models.UserHasVoiceQueue + // }); + // Telephone.hasMany(models.VoiceExtension, { + // foreignKey: 'UserId', + // as: 'UserExtensions', + // onDelete: 'cascade' + // }); + } + }); + + return Telephone; +} diff --git a/server/models/tools_action.js b/server/models/tools_action.js index cc635cf..9097c07 100644 --- a/server/models/tools_action.js +++ b/server/models/tools_action.js @@ -1 +1,32 @@ -var _0x9b85=["\x65\x78\x70\x6F\x72\x74\x73","\x54\x6F\x6F\x6C\x73\x41\x63\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x74\x6F\x6F\x6C\x73\x5F\x61\x63\x74\x69\x6F\x6E\x73","\x64\x65\x66\x69\x6E\x65"];module[_0x9b85[0]]=function(_0xb917x1,_0xb917x2){var _0xb917x3=_0xb917x1[_0x9b85[4]](_0x9b85[1],{action:{type:_0xb917x2[_0x9b85[2]]},data1:{type:_0xb917x2[_0x9b85[2]]},data2:{type:_0xb917x2[_0x9b85[2]]},data3:{type:_0xb917x2[_0x9b85[2]]},data4:{type:_0xb917x2[_0x9b85[2]]},data5:{type:_0xb917x2[_0x9b85[2]]}},{tableName:_0x9b85[3],associate:function(_0xb917x4){}});return _0xb917x3} \ No newline at end of file +/** + * Tools Actions Model + */ + +module.exports = function(sequelize, DataTypes) { + + var ToolsAction = sequelize.define('ToolsAction', { + action: { + type: DataTypes.STRING + }, + data1: { + type: DataTypes.STRING + }, + data2: { + type: DataTypes.STRING + }, + data3: { + type: DataTypes.STRING + }, + data4: { + type: DataTypes.STRING + }, + data5: { + type: DataTypes.STRING + } + }, { + tableName: 'tools_actions', + associate: function(models) {} + }); + + return ToolsAction; +}; diff --git a/server/models/tools_condition.js b/server/models/tools_condition.js index 67bb878..cb0b603 100644 --- a/server/models/tools_condition.js +++ b/server/models/tools_condition.js @@ -1 +1,18 @@ -var _0x264e=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x54\x6F\x6F\x6C\x73\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x74\x6F\x6F\x6C\x73\x5F\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x264e[0]);module[_0x264e[1]]=function(_0x37d6x2,_0x37d6x3){var _0x37d6x4=_0x37d6x2[_0x264e[5]](_0x264e[2],{field:_0x37d6x3[_0x264e[3]],operator:_0x37d6x3[_0x264e[3]],value:_0x37d6x3[_0x264e[3]]},{tableName:_0x264e[4]});return _0x37d6x4} \ No newline at end of file +/** + * Tools Conditions Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var ToolsCondition = sequelize.define('ToolsCondition', { + field: DataTypes.STRING, + operator: DataTypes.STRING, + value: DataTypes.STRING + }, { + tableName: 'tools_conditions' + }); + + return ToolsCondition; +}; diff --git a/server/models/trigger.js b/server/models/trigger.js index d065bfc..2953319 100644 --- a/server/models/trigger.js +++ b/server/models/trigger.js @@ -1 +1,60 @@ -var _0xbc7c=["\x65\x78\x70\x6F\x72\x74\x73","\x54\x72\x69\x67\x67\x65\x72","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x74\x72\x69\x67\x67\x65\x72\x73","\x41\x6C\x6C","\x4F\x6E\x65\x41\x6C\x6C","\x54\x72\x69\x67\x67\x65\x72\x41\x6C\x6C\x49\x64","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x41\x6E\x79","\x4F\x6E\x65\x41\x6E\x79","\x54\x72\x69\x67\x67\x65\x72\x41\x6E\x79\x49\x64","\x41\x63\x74\x69\x6F\x6E\x73","\x61\x6C\x6C","\x54\x6F\x6F\x6C\x73\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x76\x61\x6C\x75\x65","\x54\x6F\x6F\x6C\x73\x41\x63\x74\x69\x6F\x6E","\x61\x63\x74\x69\x6F\x6E","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x64\x61\x74\x61\x34","\x64\x61\x74\x61\x35","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];module[_0xbc7c[0]]=function(_0x3746x1,_0x3746x2){var _0x3746x3=_0x3746x1[_0xbc7c[27]](_0xbc7c[1],{name:_0x3746x2[_0xbc7c[2]],channel:_0x3746x2[_0xbc7c[2]],description:_0x3746x2[_0xbc7c[2]],status:{type:_0x3746x2[_0xbc7c[3]],defaultValue:false}},{tableName:_0xbc7c[4],associate:function(_0x3746x4){_0x3746x3[_0xbc7c[9]](_0x3746x4.ToolsCondition,{as:{plural:_0xbc7c[5],singular:_0xbc7c[6]},foreignKey:_0xbc7c[7],onDelete:_0xbc7c[8],hooks:true});_0x3746x3[_0xbc7c[9]](_0x3746x4.ToolsCondition,{as:{plural:_0xbc7c[10],singular:_0xbc7c[11]},foreignKey:_0xbc7c[12],onDelete:_0xbc7c[8],hooks:true});_0x3746x3[_0xbc7c[9]](_0x3746x4.ToolsAction,{as:_0xbc7c[13],onDelete:_0xbc7c[8],hooks:true});_0x3746x3[_0xbc7c[26]](_0xbc7c[14],{include:[{model:_0x3746x4[_0xbc7c[15]],as:_0xbc7c[5],attributes:[_0xbc7c[16],_0xbc7c[17],_0xbc7c[18]]},{model:_0x3746x4[_0xbc7c[15]],as:_0xbc7c[10],attributes:[_0xbc7c[16],_0xbc7c[17],_0xbc7c[18]]},{model:_0x3746x4[_0xbc7c[19]],as:_0xbc7c[13],attributes:[_0xbc7c[20],_0xbc7c[21],_0xbc7c[22],_0xbc7c[23],_0xbc7c[24],_0xbc7c[25]]}]})}});return _0x3746x3} \ No newline at end of file +/** + * Trigger Model + */ + +module.exports = function(sequelize, DataTypes) { + + var Trigger = sequelize.define('Trigger', { + name: DataTypes.STRING, + channel: DataTypes.STRING, + description: DataTypes.STRING, + status: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'triggers', + associate: function(models) { + Trigger.hasMany(models.ToolsCondition, { + as: { + plural: 'All', + singular: 'OneAll' + }, + foreignKey: 'TriggerAllId', + onDelete: 'cascade', + hooks: true + }); + Trigger.hasMany(models.ToolsCondition, { + as: { + plural: 'Any', + singular: 'OneAny' + }, + foreignKey: 'TriggerAnyId', + onDelete: 'cascade', + hooks: true + }); + Trigger.hasMany(models.ToolsAction, { + as: 'Actions', + onDelete: 'cascade', + hooks: true + }); + Trigger.addScope('all', { + include: [{ + model: models.ToolsCondition, + as: 'All', + attributes: ['field', 'operator', 'value'] + }, { + model: models.ToolsCondition, + as: 'Any', + attributes: ['field', 'operator', 'value'] + }, { + model: models.ToolsAction, + as: 'Actions', + attributes: ['action', 'data1', 'data2', 'data3', 'data4', 'data5'] + }] + }); + } + }); + + return Trigger; +}; diff --git a/server/models/trunk.js b/server/models/trunk.js index 6a48f2c..e9ff649 100644 --- a/server/models/trunk.js +++ b/server/models/trunk.js @@ -1 +1,458 @@ -var _0x5ca0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x72\x79\x70\x74\x6F","\x6D\x64\x35","\x6C\x6F\x64\x61\x73\x68","\x65\x78\x70\x6F\x72\x74\x73","\x54\x72\x75\x6E\x6B","\x53\x54\x52\x49\x4E\x47","\x66\x72\x69\x65\x6E\x64","\x75\x73\x65\x72","\x70\x65\x65\x72","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42","\x75\x64\x70","\x72\x66\x63\x32\x38\x33\x33","\x69\x6E\x66\x6F","\x73\x68\x6F\x72\x74\x69\x6E\x66\x6F","\x69\x6E\x62\x61\x6E\x64","\x61\x75\x74\x6F","\x79\x65\x73","\x6E\x6F","\x6E\x6F\x6E\x61\x74","\x75\x70\x64\x61\x74\x65","\x6F\x75\x74\x67\x6F\x69\x6E\x67","\x66\x6F\x72\x63\x65\x5F\x72\x70\x6F\x72\x74\x2C\x63\x6F\x6D\x65\x64\x69\x61","\x65\x6E","\x61\x6C\x6C","\x61\x6C\x61\x77\x3B\x75\x6C\x61\x77\x3B\x67\x73\x6D","\x70\x6F\x72\x74\x2C\x69\x6E\x76\x69\x74\x65","\x6E\x65\x76\x65\x72","\x22\x22\x20\x3C\x3E","\x61\x6C\x77\x61\x79\x73","\x61\x63\x63\x65\x70\x74","\x72\x65\x66\x75\x73\x65","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x75\x61\x63","\x75\x61\x73","\x64\x79\x6E\x61\x6D\x69\x63","\x66\x69\x6E\x67\x65\x72\x70\x72\x69\x6E\x74","\x63\x65\x72\x74\x69\x66\x69\x63\x61\x74\x65","\x61\x63\x74\x69\x76\x65","\x70\x61\x73\x73\x69\x76\x65","\x61\x63\x74\x70\x61\x73\x73","\x75\x70\x64\x61\x74\x65\x2C\x6E\x6F\x6E\x61\x74","\x74\x72\x75\x6E\x6B\x73","\x64\x65\x66\x69\x6E\x65"];_0x5ca0[0];var crypto=require(_0x5ca0[1]);var md5=require(_0x5ca0[2]);var _=require(_0x5ca0[3]);module[_0x5ca0[4]]=function(_0x63fdx4,_0x63fdx5){var _0x63fdx6=_0x63fdx4[_0x5ca0[51]](_0x5ca0[5],{name:{type:_0x63fdx5[_0x5ca0[6]],primaryKey:true},type:{type:_0x63fdx5.ENUM(_0x5ca0[7],_0x5ca0[8],_0x5ca0[9]),allowNull:true,defaultValue:_0x5ca0[7]},context:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[10]},callingpres:{type:_0x63fdx5.ENUM(_0x5ca0[11],_0x5ca0[12],_0x5ca0[13],_0x5ca0[14],_0x5ca0[15],_0x5ca0[16],_0x5ca0[17],_0x5ca0[18]),allowNull:true},permit:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},deny:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},secret:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},md5secret:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},remotesecret:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},transport:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[19]},dtmfmode:{type:_0x63fdx5.ENUM(_0x5ca0[20],_0x5ca0[21],_0x5ca0[22],_0x5ca0[23],_0x5ca0[24]),allowNull:true,defaultValue:_0x5ca0[20]},directmedia:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26],_0x5ca0[27],_0x5ca0[28],_0x5ca0[29]),allowNull:true,defaultValue:_0x5ca0[26]},directrtpsetup:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},directmediapermit:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},directmediadeny:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},nat:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[30]},callgroup:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},namedcallgroup:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},pickupgroup:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},namedpickupgroup:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},language:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[31]},tonezone:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},disallow:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[32]},allow:{type:_0x63fdx5[_0x5ca0[6]],allowNull:false,defaultValue:_0x5ca0[33]},autoframing:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},insecure:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[34]},trustrpid:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},trust_id_outbound:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},progressinband:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26],_0x5ca0[35]),allowNull:true},promiscredir:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},useclientcode:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},accountcode:{type:_0x63fdx5.INTEGER(11),allowNull:true},setvar:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},callerid:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[36]},amaflags:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},callcounter:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[25]},busylevel:{type:_0x63fdx5.INTEGER(11),allowNull:true},allowoverlap:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},allowsubscribe:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},allowtransfer:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},ignoresdpversion:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},subscribecontext:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},template:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},videosupport:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26],_0x5ca0[37]),allowNull:true,defaultValue:_0x5ca0[26]},maxcallbitrate:{type:_0x63fdx5.INTEGER(11),allowNull:true},rfc2833compensate:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},mailbox:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},session_timers:{type:_0x63fdx5.ENUM(_0x5ca0[38],_0x5ca0[39],_0x5ca0[40]),allowNull:true},session_expires:{type:_0x63fdx5.INTEGER(11),allowNull:true},session_minse:{type:_0x63fdx5.INTEGER(11),allowNull:true},session_refresher:{type:_0x63fdx5.ENUM(_0x5ca0[41],_0x5ca0[42]),allowNull:true,defaultValue:_0x5ca0[42]},t38pt_usertpsource:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},regexten:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},fromdomain:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},fromuser:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},host:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true,defaultValue:_0x5ca0[43]},port:{type:_0x63fdx5.INTEGER(5),allowNull:true},qualify:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[25]},keepalive:{type:_0x63fdx5.INTEGER(11),allowNull:true},defaultip:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},defaultuser:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},rtptimeout:{type:_0x63fdx5.INTEGER(11),allowNull:true},rtpholdtimeout:{type:_0x63fdx5.INTEGER(11),allowNull:true},rtpkeepalive:{type:_0x63fdx5.INTEGER(11),allowNull:true},sendrpid:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},outboundproxy:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},callbackextension:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},timert1:{type:_0x63fdx5.INTEGER(11),allowNull:true},timerb:{type:_0x63fdx5.INTEGER(11),allowNull:true},qualifyfreq:{type:_0x63fdx5.INTEGER(11),allowNull:true},contactpermit:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},contactdeny:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},contactacl:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},unsolicited_mailbox:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},use_q850_reason:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},maxforwards:{type:_0x63fdx5.INTEGER(11),allowNull:true},encryption:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},avpf:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},force_avp:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},icesupport:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},dtlsenable:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},dtlsverify:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26],_0x5ca0[44],_0x5ca0[45]),allowNull:true},dtlsrekey:{type:_0x63fdx5.INTEGER(11),allowNull:true},dtlscertfile:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},dtlsprivatekey:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},dtlscipher:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},dtlscafile:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},dtlscapath:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},dtlssetup:{type:_0x63fdx5.ENUM(_0x5ca0[46],_0x5ca0[47],_0x5ca0[48]),allowNull:true},dtlsfingerprint:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},usereqphone:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true,defaultValue:_0x5ca0[26]},recordonfeature:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},recordofffeature:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},call_limit:{type:_0x63fdx5.INTEGER(11),allowNull:true,defaultValue:null},registertrying:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},subscribemwi:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26]),allowNull:true},vmexten:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},mohinterpret:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},mohsuggest:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},parkinglot:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},description:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},canreinvite:{type:_0x63fdx5.ENUM(_0x5ca0[25],_0x5ca0[26],_0x5ca0[27],_0x5ca0[28],_0x5ca0[49]),allowNull:true,defaultValue:_0x5ca0[26]},registry:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true},otherFields:{type:_0x63fdx5[_0x5ca0[6]],allowNull:true}},{tableName:_0x5ca0[50]});return _0x63fdx6} \ No newline at end of file +'use strict'; + +var crypto = require('crypto'); +var md5 = require('md5'); +var _ = require('lodash'); + +module.exports = function(sequelize, DataTypes) { + var Trunk = sequelize.define('Trunk', { + name: { + type: DataTypes.STRING, + primaryKey: true + }, + type: { + type: DataTypes.ENUM('friend', 'user', 'peer'), + allowNull: true, + defaultValue: 'friend' + }, + context: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'from-sip' + }, + callingpres: { + type: DataTypes.ENUM('ALLOWED_NOT_SCREENED', + 'ALLOWED_PASSED_SCREEN', 'ALLOWED_FAILED_SCREEN', 'ALLOWED', + 'PROHIB_NOT_SCREENED', 'PROHIB_PASSED_SCREEN', + 'PROHIB_FAILED_SCREEN', 'PROHIB'), + allowNull: true, + }, + permit: { + type: DataTypes.STRING, + allowNull: true, + }, + deny: { + type: DataTypes.STRING, + allowNull: true, + }, + secret: { + type: DataTypes.STRING, + allowNull: true, + }, + md5secret: { + type: DataTypes.STRING, + allowNull: true, + }, + remotesecret: { + type: DataTypes.STRING, + allowNull: true, + }, + transport: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'udp' + }, + dtmfmode: { + type: DataTypes.ENUM('rfc2833', 'info', 'shortinfo', 'inband', + 'auto'), + allowNull: true, + defaultValue: 'rfc2833' + }, + directmedia: { + type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'outgoing'), + allowNull: true, + defaultValue: 'no' + }, + directrtpsetup: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + directmediapermit: { + type: DataTypes.STRING, + allowNull: true, + }, + directmediadeny: { + type: DataTypes.STRING, + allowNull: true, + }, + nat: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'force_rport,comedia' + }, + callgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + namedcallgroup: { //We are in named call groups engineering,sales,netgroup,protgroup + type: DataTypes.STRING, + allowNull: true, + }, + pickupgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + namedpickupgroup: { //We can do call pick-p for named call group sales + type: DataTypes.STRING, + allowNull: true, + }, + language: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'en' + }, + tonezone: { + type: DataTypes.STRING, + allowNull: true + }, + disallow: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'all' + }, + allow: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: 'alaw;ulaw;gsm' + }, + autoframing: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + insecure: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'port,invite' + }, + trustrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + trust_id_outbound: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + progressinband: { + type: DataTypes.ENUM('yes', 'no', 'never'), + allowNull: true, + }, + promiscredir: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + useclientcode: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + accountcode: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + setvar: { + type: DataTypes.STRING, + allowNull: true, + }, + callerid: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '"" <>' + }, + amaflags: { + type: DataTypes.STRING, + allowNull: true, + }, + callcounter: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + busylevel: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + allowoverlap: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowsubscribe: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowtransfer: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + ignoresdpversion: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + subscribecontext: { + type: DataTypes.STRING, + allowNull: true, + }, + template: { + type: DataTypes.STRING, + allowNull: true, + }, + videosupport: { + type: DataTypes.ENUM('yes', 'no', 'always'), + allowNull: true, + defaultValue: 'no' + }, + maxcallbitrate: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rfc2833compensate: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + mailbox: { + type: DataTypes.STRING, + allowNull: true, + }, + session_timers: { + type: DataTypes.ENUM('accept', 'refuse', 'originate'), + allowNull: true, + }, + session_expires: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + session_minse: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + session_refresher: { + type: DataTypes.ENUM('uac', 'uas'), + allowNull: true, + defaultValue: 'uas' + }, + t38pt_usertpsource: { + type: DataTypes.STRING, + allowNull: true, + }, + regexten: { + type: DataTypes.STRING, + allowNull: true, + }, + fromdomain: { + type: DataTypes.STRING, + allowNull: true, + }, + fromuser: { + type: DataTypes.STRING, + allowNull: true, + }, + host: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'dynamic' + }, + port: { + type: DataTypes.INTEGER(5), + allowNull: true, + }, + qualify: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + keepalive: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + defaultip: { + type: DataTypes.STRING, + allowNull: true, + }, + defaultuser: { + type: DataTypes.STRING, + allowNull: true, + }, + rtptimeout: { // Terminate call if 60 seconds of no RTP or RTCP activity on the audio channel when we're not on hold. + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rtpholdtimeout: { // Terminate call if 300 seconds of no RTP or RTCP activity on the audio channel when we're on hold (must be > rtptimeout) + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rtpkeepalive: { // Send keepalives in the RTP stream to keep NAT open (default is off - zero) + type: DataTypes.INTEGER(11), + allowNull: true, + }, + sendrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + outboundproxy: { + type: DataTypes.STRING, + allowNull: true, + }, + callbackextension: { + type: DataTypes.STRING, + allowNull: true, + }, + timert1: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + timerb: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + qualifyfreq: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + contactpermit: { + type: DataTypes.STRING, + allowNull: true, + }, + contactdeny: { + type: DataTypes.STRING, + allowNull: true, + }, + contactacl: { + type: DataTypes.STRING, + allowNull: true, + }, + unsolicited_mailbox: { + type: DataTypes.STRING, + allowNull: true, + }, + use_q850_reason: { + type: DataTypes.STRING, + allowNull: true, + }, + maxforwards: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + encryption: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + avpf: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + force_avp: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + icesupport: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + dtlsenable: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + dtlsverify: { + type: DataTypes.ENUM('yes', 'no', 'fingerprint', 'certificate'), + allowNull: true + }, + dtlsrekey: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + dtlscertfile: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlsprivatekey: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscipher: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscafile: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscapath: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlssetup: { + type: DataTypes.ENUM('active', 'passive', 'actpass'), + allowNull: true + }, + dtlsfingerprint: { + type: DataTypes.STRING, + allowNull: true, + }, + usereqphone: { //This provider requires ";user=phone" on URI + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + recordonfeature: { //Feature to use when INFO with Record: on is received. + type: DataTypes.STRING, + allowNull: true, + }, + recordofffeature: { //Feature to use when INFO with Record: off is received. + type: DataTypes.STRING, + allowNull: true, + }, + call_limit: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null + }, + registertrying: { //Send a 100 Trying when the device registers. + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + subscribemwi: { //Only send notifications if this phone subscribes for mailbox notification + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + vmexten: { // dialplan extension to reach mailbox. defaults to global vmexten which defaults to "asterisk" + type: DataTypes.STRING, + allowNull: true, + }, + mohinterpret: { // This option specifies a preference for which music on hold class this channel should listen to when put on hold + type: DataTypes.STRING, + allowNull: true, + }, + mohsuggest: { // This option specifies which music on hold class to suggest to the peer channel when this channel places the peer on hold. + type: DataTypes.STRING, + allowNull: true, + }, + parkinglot: { + type: DataTypes.STRING, + allowNull: true, + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + canreinvite: { + type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'update,nonat'), + allowNull: true, + defaultValue: 'no' + }, + registry: { + type: DataTypes.STRING, + allowNull: true, + }, + otherFields: { + type: DataTypes.STRING, + allowNull: true, + } + }, { + tableName: 'trunks' + }); + + return Trunk; +} diff --git a/server/models/user.js b/server/models/user.js index bfe6046..8c46445 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -1 +1,846 @@ -var _0xfb1c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x72\x79\x70\x74\x6F","\x6D\x64\x35","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72","\x53\x54\x52\x49\x4E\x47","\x6E\x61\x6D\x65","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x64\x65\x66\x61\x75\x6C\x74\x75\x73\x65\x72","\x65\x6D\x61\x69\x6C","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x61\x64\x6D\x69\x6E","\x75\x73\x65\x72","\x61\x67\x65\x6E\x74","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x73\x61\x6C\x74","\x6D\x61\x6B\x65\x53\x61\x6C\x74","\x70\x61\x73\x73\x77\x6F\x72\x64","\x65\x6E\x63\x72\x79\x70\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x6D\x64\x35\x73\x65\x63\x72\x65\x74","\x3A\x61\x73\x74\x65\x72\x69\x73\x6B\x3A","\x6D\x64\x35\x50\x61\x73\x73\x77\x6F\x72\x64","\x6C\x6F\x63\x61\x6C","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x61\x63\x63\x6F\x75\x6E\x74\x63\x6F\x64\x65","\x42\x4F\x4F\x4C\x45\x41\x4E","\x44\x41\x54\x45","\x55\x4E\x4B\x4E\x4F\x57\x4E","\x44\x65\x66\x61\x75\x6C\x74\x20\x50\x61\x75\x73\x65","\x49\x4E\x54\x45\x47\x45\x52","\x70\x68\x6F\x6E\x65\x42\x61\x72\x55\x6E\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x70\x68\x6F\x6E\x65\x42\x61\x72\x55\x6E\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C\x4E\x75\x6D\x62\x65\x72","\x70\x68\x6F\x6E\x65\x42\x61\x72\x4E\x6F\x52\x65\x70\x6C\x79","\x70\x68\x6F\x6E\x65\x42\x61\x72\x4E\x6F\x52\x65\x70\x6C\x79\x4E\x75\x6D\x62\x65\x72","\x70\x68\x6F\x6E\x65\x42\x61\x72\x42\x75\x73\x79","\x70\x68\x6F\x6E\x65\x42\x61\x72\x42\x75\x73\x79\x4E\x75\x6D\x62\x65\x72","\x66\x72\x69\x65\x6E\x64","\x70\x65\x65\x72","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x41\x4C\x4C\x4F\x57\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x4E\x4F\x54\x5F\x53\x43\x52\x45\x45\x4E\x45\x44","\x50\x52\x4F\x48\x49\x42\x5F\x50\x41\x53\x53\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42\x5F\x46\x41\x49\x4C\x45\x44\x5F\x53\x43\x52\x45\x45\x4E","\x50\x52\x4F\x48\x49\x42","\x75\x64\x70","\x72\x66\x63\x32\x38\x33\x33","\x69\x6E\x66\x6F","\x73\x68\x6F\x72\x74\x69\x6E\x66\x6F","\x69\x6E\x62\x61\x6E\x64","\x61\x75\x74\x6F","\x79\x65\x73","\x6E\x6F","\x6E\x6F\x6E\x61\x74","\x75\x70\x64\x61\x74\x65","\x6F\x75\x74\x67\x6F\x69\x6E\x67","\x66\x6F\x72\x63\x65\x5F\x72\x70\x6F\x72\x74\x2C\x63\x6F\x6D\x65\x64\x69\x61","\x65\x6E","\x61\x6C\x61\x77\x3B\x75\x6C\x61\x77\x3B\x67\x73\x6D","\x70\x6F\x72\x74\x2C\x69\x6E\x76\x69\x74\x65","\x6E\x65\x76\x65\x72","\x22\x22\x20\x3C\x3E","\x61\x6C\x77\x61\x79\x73","\x61\x63\x63\x65\x70\x74","\x72\x65\x66\x75\x73\x65","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x75\x61\x63","\x75\x61\x73","\x64\x79\x6E\x61\x6D\x69\x63","\x66\x69\x6E\x67\x65\x72\x70\x72\x69\x6E\x74","\x63\x65\x72\x74\x69\x66\x69\x63\x61\x74\x65","\x61\x63\x74\x69\x76\x65","\x70\x61\x73\x73\x69\x76\x65","\x61\x63\x74\x70\x61\x73\x73","\x75\x70\x64\x61\x74\x65\x2C\x6E\x6F\x6E\x61\x74","\x75\x73\x65\x72\x73","\x62\x61\x73\x65\x36\x34","\x72\x61\x6E\x64\x6F\x6D\x42\x79\x74\x65\x73","","\x70\x62\x6B\x64\x66\x32\x53\x79\x6E\x63","\x68\x61\x73\x4D\x61\x6E\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x6F\x64\x75\x6C\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x73","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x55\x73\x65\x72\x49\x64","\x55\x73\x65\x72\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x63\x61\x73\x63\x61\x64\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x71\x75\x65\x75\x65\x73","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x46\x61\x78\x51\x75\x65\x75\x65","\x63\x68\x65\x63\x6B\x50\x61\x75\x73\x65\x53\x74\x61\x74\x75\x73","\x76\x6F\x69\x63\x65\x50\x61\x75\x73\x65","\x77\x68\x65\x72\x65","\x74\x72\x75\x65","\x66\x61\x78\x50\x61\x75\x73\x65","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x6D\x61\x69\x6C\x50\x61\x75\x73\x65","\x63\x68\x65\x63\x6B\x4F\x6E\x6C\x69\x6E\x65\x53\x74\x61\x74\x75\x73","\x6F\x6E\x6C\x69\x6E\x65","\x63\x68\x65\x63\x6B\x53\x69\x70\x53\x74\x61\x74\x75\x73","\x73\x74\x61\x74\x75\x73","\x69\x64","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x74\x72\x61\x6E\x73\x70\x6F\x72\x74","\x68\x6F\x73\x74","\x6E\x61\x74","\x74\x79\x70\x65","\x61\x6C\x6C\x6F\x77","\x63\x68\x61\x74\x43\x61\x70\x61\x63\x69\x74\x79","\x6D\x61\x69\x6C\x43\x61\x70\x61\x63\x69\x74\x79","\x66\x61\x78\x43\x61\x70\x61\x63\x69\x74\x79","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x70\x68\x6F\x6E\x65\x42\x61\x72\x41\x75\x74\x6F\x41\x6E\x73\x77\x65\x72","\x70\x68\x6F\x6E\x65\x42\x61\x72\x45\x6E\x61\x62\x6C\x65\x53\x65\x74\x74\x69\x6E\x67\x73","\x63\x68\x61\x6E\x73\x70\x79","\x70\x61\x75\x73\x65\x54\x79\x70\x65","\x6C\x61\x73\x74\x50\x61\x75\x73\x65\x41\x74","\x73\x74\x61\x74\x75\x73\x41\x74","\x75\x73\x65\x72\x61\x67\x65\x6E\x74","\x69\x70\x61\x64\x64\x72","\x66\x75\x6C\x6C\x63\x6F\x6E\x74\x61\x63\x74","\x70\x6F\x72\x74","\x6C\x61\x73\x74\x6D\x73","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x64\x65\x66\x69\x6E\x65"];_0xfb1c[0];var crypto=require(_0xfb1c[1]);var md5=require(_0xfb1c[2]);var _=require(_0xfb1c[3]);var moment=require(_0xfb1c[4]);var VoiceQueue=require(_0xfb1c[6])[_0xfb1c[5]];module[_0xfb1c[7]]=function(_0x9c83x6,_0x9c83x7){var _0x9c83x8=_0x9c83x6[_0xfb1c[141]](_0xfb1c[8],{name:{type:_0x9c83x7[_0xfb1c[9]],unique:true,validate:{notEmpty:true,is:/^[A-Za-z0-9\.\_]+$/i},set:function(_0x9c83x9){this[_0xfb1c[11]](_0xfb1c[10],_0x9c83x9);this[_0xfb1c[11]](_0xfb1c[12],_0x9c83x9)}},fullname:{type:_0x9c83x7[_0xfb1c[9]],allowNull:false},email:{type:_0x9c83x7[_0xfb1c[9]],unique:true,set:function(_0x9c83xa){if(_0x9c83xa){this[_0xfb1c[11]](_0xfb1c[13],_0x9c83xa[_0xfb1c[14]]())}},defaultValue:null},role:{type:_0x9c83x7.ENUM(_0xfb1c[15],_0xfb1c[16],_0xfb1c[17],_0xfb1c[18])},password:{type:_0x9c83x7[_0xfb1c[9]],allowNull:false,validate:{notEmpty:true},set:function(_0x9c83xb){this[_0xfb1c[19]]=this[_0xfb1c[20]]();this[_0xfb1c[11]](_0xfb1c[21],this[_0xfb1c[22]](_0x9c83xb));this[_0xfb1c[11]](_0xfb1c[23],this[_0xfb1c[25]](this[_0xfb1c[10]]+_0xfb1c[24]+_0x9c83xb))}},provider:{type:_0x9c83x7[_0xfb1c[9]],defaultValue:_0xfb1c[26]},internal:{type:_0x9c83x7.INTEGER(11),unique:true,set:function(_0x9c83xc){this[_0xfb1c[11]](_0xfb1c[27],_0x9c83xc);this[_0xfb1c[11]](_0xfb1c[28],_0x9c83xc)}},salt:{type:_0x9c83x7[_0xfb1c[9]]},phone:{type:_0x9c83x7[_0xfb1c[9]]},mobile:{type:_0x9c83x7[_0xfb1c[9]]},address:{type:_0x9c83x7[_0xfb1c[9]]},zipcode:{type:_0x9c83x7[_0xfb1c[9]]},userpic:{type:_0x9c83x7[_0xfb1c[9]]},city:{type:_0x9c83x7[_0xfb1c[9]]},country:{type:_0x9c83x7[_0xfb1c[9]]},online:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},lastLoginAt:{type:_0x9c83x7[_0xfb1c[30]]},status:{type:_0x9c83x7[_0xfb1c[9]],defaultValue:_0xfb1c[31]},statusAt:{type:_0x9c83x7[_0xfb1c[30]]},voicePause:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},chatPause:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},mailPause:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},faxPause:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},pauseType:{type:_0x9c83x7[_0xfb1c[9]],defaultValue:_0xfb1c[32]},lastPauseAt:{type:_0x9c83x7[_0xfb1c[30]]},chatCapacity:{type:_0x9c83x7[_0xfb1c[33]],defaultValue:0},mailCapacity:{type:_0x9c83x7[_0xfb1c[33]],defaultValue:0},faxCapacity:{type:_0x9c83x7[_0xfb1c[33]],defaultValue:0},phoneBarAutoAnswer:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},phoneBarEnableSettings:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},phoneBarUnconditionalNumber:{type:_0x9c83x7[_0xfb1c[9]],get:function(){if(this[_0xfb1c[35]](_0xfb1c[34])){return this[_0xfb1c[35]](_0xfb1c[36])};return null}},phoneBarNoReplyNumber:{type:_0x9c83x7[_0xfb1c[9]],get:function(){if(this[_0xfb1c[35]](_0xfb1c[37])){return this[_0xfb1c[35]](_0xfb1c[38])};return null}},phoneBarBusyNumber:{type:_0x9c83x7[_0xfb1c[9]],get:function(){if(this[_0xfb1c[35]](_0xfb1c[39])){return this[_0xfb1c[35]](_0xfb1c[40])};return null}},phoneBarUnconditional:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},phoneBarNoReply:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},phoneBarBusy:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},phoneBarPort:{type:_0x9c83x7.INTEGER(5),allowNull:true},chanspy:{type:_0x9c83x7[_0xfb1c[29]],defaultValue:false},description:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},ipaddr:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},port:{type:_0x9c83x7.INTEGER(5),allowNull:true},regseconds:{type:_0x9c83x7.INTEGER(11),allowNull:true},fullcontact:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},regserver:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},useragent:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},lastms:{type:_0x9c83x7.INTEGER(11),allowNull:true},type:{type:_0x9c83x7.ENUM(_0xfb1c[41],_0xfb1c[16],_0xfb1c[42]),allowNull:true,defaultValue:_0xfb1c[41]},context:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[43]},callingpres:{type:_0x9c83x7.ENUM(_0xfb1c[44],_0xfb1c[45],_0xfb1c[46],_0xfb1c[47],_0xfb1c[48],_0xfb1c[49],_0xfb1c[50],_0xfb1c[51]),allowNull:true},permit:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},deny:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},secret:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},md5secret:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},remotesecret:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},transport:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[52]},dtmfmode:{type:_0x9c83x7.ENUM(_0xfb1c[53],_0xfb1c[54],_0xfb1c[55],_0xfb1c[56],_0xfb1c[57]),allowNull:true,defaultValue:_0xfb1c[53]},directmedia:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59],_0xfb1c[60],_0xfb1c[61],_0xfb1c[62]),allowNull:true,defaultValue:_0xfb1c[59]},directrtpsetup:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},directmediapermit:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},directmediadeny:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},nat:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[63]},callgroup:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},namedcallgroup:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},pickupgroup:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},namedpickupgroup:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},language:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[64]},tonezone:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},allow:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[65]},disallow:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:null},autoframing:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},insecure:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[66]},trustrpid:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},trust_id_outbound:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},progressinband:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59],_0xfb1c[67]),allowNull:true},promiscredir:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},useclientcode:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},accountcode:{type:_0x9c83x7.INTEGER(11),allowNull:true},setvar:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},callerid:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[68]},amaflags:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},callcounter:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[58]},busylevel:{type:_0x9c83x7.INTEGER(11),allowNull:true},allowoverlap:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},allowsubscribe:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},allowtransfer:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},ignoresdpversion:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},subscribecontext:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},template:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},videosupport:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59],_0xfb1c[69]),allowNull:true,defaultValue:_0xfb1c[59]},maxcallbitrate:{type:_0x9c83x7.INTEGER(11),allowNull:true},rfc2833compensate:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},mailbox:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},session_timers:{type:_0x9c83x7.ENUM(_0xfb1c[70],_0xfb1c[71],_0xfb1c[72]),allowNull:true},session_expires:{type:_0x9c83x7.INTEGER(11),allowNull:true},session_minse:{type:_0x9c83x7.INTEGER(11),allowNull:true},session_refresher:{type:_0x9c83x7.ENUM(_0xfb1c[73],_0xfb1c[74]),allowNull:true,defaultValue:_0xfb1c[74]},t38pt_usertpsource:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},regexten:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},fromdomain:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},fromuser:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},host:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true,defaultValue:_0xfb1c[75]},qualify:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[58]},keepalive:{type:_0x9c83x7.INTEGER(11),allowNull:true},defaultip:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},defaultuser:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},rtptimeout:{type:_0x9c83x7.INTEGER(11),allowNull:true},rtpholdtimeout:{type:_0x9c83x7.INTEGER(11),allowNull:true},rtpkeepalive:{type:_0x9c83x7.INTEGER(11),allowNull:true},sendrpid:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},outboundproxy:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},callbackextension:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},timert1:{type:_0x9c83x7.INTEGER(11),allowNull:true},timerb:{type:_0x9c83x7.INTEGER(11),allowNull:true},qualifyfreq:{type:_0x9c83x7.INTEGER(11),allowNull:true},contactpermit:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},contactdeny:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},contactacl:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},unsolicited_mailbox:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},use_q850_reason:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},maxforwards:{type:_0x9c83x7.INTEGER(11),allowNull:true},encryption:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},avpf:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},force_avp:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},icesupport:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},dtlsenable:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},dtlsverify:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59],_0xfb1c[76],_0xfb1c[77]),allowNull:true},dtlsrekey:{type:_0x9c83x7.INTEGER(11),allowNull:true},dtlscertfile:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},dtlsprivatekey:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},dtlscipher:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},dtlscafile:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},dtlscapath:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},dtlssetup:{type:_0x9c83x7.ENUM(_0xfb1c[78],_0xfb1c[79],_0xfb1c[80]),allowNull:true},dtlsfingerprint:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},usereqphone:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true,defaultValue:_0xfb1c[59]},recordonfeature:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},recordofffeature:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},call_limit:{type:_0x9c83x7.INTEGER(11),allowNull:true,defaultValue:null},registertrying:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},subscribemwi:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59]),allowNull:true},vmexten:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},mohinterpret:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},mohsuggest:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},parkinglot:{type:_0x9c83x7[_0xfb1c[9]],allowNull:true},canreinvite:{type:_0x9c83x7.ENUM(_0xfb1c[58],_0xfb1c[59],_0xfb1c[60],_0xfb1c[61],_0xfb1c[81]),allowNull:true,defaultValue:_0xfb1c[59]}},{tableName:_0xfb1c[82],instanceMethods:{authenticate:function(_0x9c83xd){return this[_0xfb1c[22]](_0x9c83xd)===this[_0xfb1c[21]]},makeSalt:function(){return crypto[_0xfb1c[84]](16).toString(_0xfb1c[83])},encryptPassword:function(_0x9c83xb){if(!_0x9c83xb||!this[_0xfb1c[19]]){return _0xfb1c[85]};var _0x9c83xe= new Buffer(this[_0xfb1c[19]],_0xfb1c[83]);return crypto[_0xfb1c[86]](_0x9c83xb,_0x9c83xe,10000,64).toString(_0xfb1c[83])},md5Password:function(_0x9c83xb){if(!_0x9c83xb){return _0xfb1c[85]};return md5(_0x9c83xb)}},associate:function(_0x9c83xf){_0x9c83x8[_0xfb1c[87]](_0x9c83xf.ChatMessage);_0x9c83x8[_0xfb1c[87]](_0x9c83xf.MailMessage);_0x9c83x8[_0xfb1c[87]](_0x9c83xf.Contact);_0x9c83x8[_0xfb1c[87]](_0x9c83xf.Action);_0x9c83x8[_0xfb1c[89]](_0x9c83xf.Module,{through:_0xfb1c[88]});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.Channel,{through:_0xfb1c[90]});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.MailRoom,{through:_0xfb1c[91]});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.Team,{through:_0x9c83xf[_0xfb1c[92]]});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.ChatRoom,{through:_0x9c83xf[_0xfb1c[93]]});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.MailQueue,{through:_0x9c83xf[_0xfb1c[94]],required:false});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.FaxQueue,{through:_0x9c83xf[_0xfb1c[95]],required:false});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.ChatQueue,{through:_0x9c83xf[_0xfb1c[96]],required:false});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.VoiceQueue,{through:_0x9c83xf[_0xfb1c[97]],required:false});_0x9c83x8[_0xfb1c[89]](_0x9c83xf.Service,{through:_0x9c83xf[_0xfb1c[98]]});_0x9c83x8[_0xfb1c[87]](_0x9c83xf.VoiceExtension,{foreignKey:_0xfb1c[99],as:_0xfb1c[100],onDelete:_0xfb1c[101],hooks:true});_0x9c83x8[_0xfb1c[102]](_0xfb1c[16],{where:{role:{$in:[_0xfb1c[15],_0xfb1c[16]]}}});_0x9c83x8[_0xfb1c[102]](_0xfb1c[103],{include:[_0x9c83xf[_0xfb1c[5]],_0x9c83xf[_0xfb1c[104]],_0x9c83xf[_0xfb1c[105]],_0x9c83xf[_0xfb1c[106]]]});_0x9c83x8[_0xfb1c[102]](_0xfb1c[18],{where:{role:_0xfb1c[18]}});_0x9c83x8[_0xfb1c[102]](_0xfb1c[107],function(_0x9c83x10){var _0x9c83x11={where:{}};if(_0x9c83x10[_0xfb1c[108]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[108]]=(_0x9c83x10[_0xfb1c[108]]===_0xfb1c[110])?true:false;delete _0x9c83x10[_0xfb1c[108]]}else {if(_0x9c83x10[_0xfb1c[111]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[111]]=(_0x9c83x10[_0xfb1c[111]]===_0xfb1c[110])?true:false;delete _0x9c83x10[_0xfb1c[111]]}else {if(_0x9c83x10[_0xfb1c[112]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[112]]=(_0x9c83x10[_0xfb1c[112]]===_0xfb1c[110])?true:false;delete _0x9c83x10[_0xfb1c[112]]}else {if(_0x9c83x10[_0xfb1c[113]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[113]]=(_0x9c83x10[_0xfb1c[113]]===_0xfb1c[110])?true:false;delete _0x9c83x10[_0xfb1c[113]]}}}};return _0x9c83x11});_0x9c83x8[_0xfb1c[102]](_0xfb1c[114],function(_0x9c83x10){var _0x9c83x11={where:{}};if(_0x9c83x10[_0xfb1c[115]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[115]]=(_0x9c83x10[_0xfb1c[115]]===_0xfb1c[110])?true:false;delete _0x9c83x10[_0xfb1c[115]]};return _0x9c83x11});_0x9c83x8[_0xfb1c[102]](_0xfb1c[116],function(_0x9c83x10){var _0x9c83x11={where:{}};if(_0x9c83x10[_0xfb1c[117]]){_0x9c83x11[_0xfb1c[109]][_0xfb1c[117]]=_0x9c83x10[_0xfb1c[117]];delete _0x9c83x10[_0xfb1c[117]]};return _0x9c83x11});_0x9c83x8[_0xfb1c[102]](_0xfb1c[17],{where:{role:_0xfb1c[17]},attributes:[_0xfb1c[118],_0xfb1c[10],_0xfb1c[13],_0xfb1c[27],_0xfb1c[119],_0xfb1c[28],_0xfb1c[120],_0xfb1c[121],_0xfb1c[122],_0xfb1c[123],_0xfb1c[124],_0xfb1c[125],_0xfb1c[126],_0xfb1c[127],_0xfb1c[115],_0xfb1c[128],_0xfb1c[129],_0xfb1c[130],_0xfb1c[34],_0xfb1c[37],_0xfb1c[39],_0xfb1c[36],_0xfb1c[38],_0xfb1c[40],_0xfb1c[131],_0xfb1c[108],_0xfb1c[113],_0xfb1c[111],_0xfb1c[112],_0xfb1c[132],_0xfb1c[133],_0xfb1c[117],_0xfb1c[134],_0xfb1c[135],_0xfb1c[136],_0xfb1c[137],_0xfb1c[138],_0xfb1c[139],_0xfb1c[140]]})}});return _0x9c83x8} \ No newline at end of file +'use strict'; + +var crypto = require('crypto'); +var md5 = require('md5'); +var _ = require('lodash'); +var moment = require('moment'); +var VoiceQueue = require('.').VoiceQueue; + +module.exports = function(sequelize, DataTypes) { + var User = sequelize.define('User', { + name: { + type: DataTypes.STRING, + unique: true, + validate: { + notEmpty: true, + is: /^[A-Za-z0-9\.\_]+$/i + }, + set: function(name) { + this.setDataValue('name', name); + this.setDataValue('defaultuser', name); + } + }, + fullname: { + type: DataTypes.STRING, + allowNull: false, + }, + email: { + type: DataTypes.STRING, + unique: true, + set: function(email) { + if (email) { + this.setDataValue('email', email.toLowerCase()); + } + }, + defaultValue: null + }, + role: { + type: DataTypes.ENUM('admin', 'user', 'agent', 'telephone') + }, + password: { + type: DataTypes.STRING, + allowNull: false, + validate: { + notEmpty: true + }, + set: function(password) { + this.salt = this.makeSalt(); + this.setDataValue('password', this.encryptPassword(password)); + this.setDataValue('md5secret', this.md5Password(this.name + ':asterisk:' + password)); + } + }, + provider: { + type: DataTypes.STRING, + defaultValue: 'local' + }, + internal: { + type: DataTypes.INTEGER(11), + unique: true, + set: function(internal) { + this.setDataValue('internal', internal); + this.setDataValue('accountcode', internal); + } + }, + salt: { + type: DataTypes.STRING + }, + phone: { + type: DataTypes.STRING + }, + mobile: { + type: DataTypes.STRING + }, + address: { + type: DataTypes.STRING + }, + zipcode: { + type: DataTypes.STRING + }, + userpic: { + type: DataTypes.STRING + }, + city: { + type: DataTypes.STRING + }, + country: { + type: DataTypes.STRING + }, + online: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + lastLoginAt: { + type: DataTypes.DATE + }, + status: { + type: DataTypes.STRING, + defaultValue: 'UNKNOWN' + }, + statusAt: { + type: DataTypes.DATE + }, + voicePause: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + chatPause: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + mailPause: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + faxPause: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + pauseType: { + type: DataTypes.STRING, + defaultValue: 'Default Pause' + }, + lastPauseAt: { + type: DataTypes.DATE + }, + chatCapacity: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + mailCapacity: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + faxCapacity: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + phoneBarAutoAnswer: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + phoneBarEnableSettings: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + phoneBarUnconditionalNumber: { + type: DataTypes.STRING, + get: function() { + if (this.getDataValue('phoneBarUnconditional')) { + return this.getDataValue('phoneBarUnconditionalNumber'); + } + return null; + } + }, + phoneBarNoReplyNumber: { + type: DataTypes.STRING, + get: function() { + if (this.getDataValue('phoneBarNoReply')) { + return this.getDataValue('phoneBarNoReplyNumber'); + } + return null; + } + }, + phoneBarBusyNumber: { + type: DataTypes.STRING, + get: function() { + if (this.getDataValue('phoneBarBusy')) { + return this.getDataValue('phoneBarBusyNumber'); + } + return null; + } + }, + phoneBarUnconditional: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + phoneBarNoReply: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + phoneBarBusy: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + phoneBarPort: { + type: DataTypes.INTEGER(5), + allowNull: true, + }, + chanspy: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + ipaddr: { //REALTIME ASTERISK + type: DataTypes.STRING, + allowNull: true, + }, + port: { //REALTIME ASTERISK + type: DataTypes.INTEGER(5), + allowNull: true, + }, + regseconds: { //REALTIME ASTERISK + type: DataTypes.INTEGER(11), + allowNull: true, + }, + fullcontact: { //REALTIME ASTERISK + type: DataTypes.STRING, + allowNull: true, + }, + regserver: { //REALTIME ASTERISK + type: DataTypes.STRING, + allowNull: true, + }, + useragent: { //REALTIME ASTERISK + type: DataTypes.STRING, + allowNull: true, + }, + lastms: { //REALTIME ASTERISK + type: DataTypes.INTEGER(11), + allowNull: true, + }, + type: { + type: DataTypes.ENUM('friend', 'user', 'peer'), + allowNull: true, + defaultValue: 'friend' + }, + context: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'from-sip' + }, + callingpres: { + type: DataTypes.ENUM('ALLOWED_NOT_SCREENED', + 'ALLOWED_PASSED_SCREEN', 'ALLOWED_FAILED_SCREEN', 'ALLOWED', + 'PROHIB_NOT_SCREENED', 'PROHIB_PASSED_SCREEN', + 'PROHIB_FAILED_SCREEN', 'PROHIB'), + allowNull: true, + }, + permit: { + type: DataTypes.STRING, + allowNull: true, + }, + deny: { + type: DataTypes.STRING, + allowNull: true, + }, + secret: { + type: DataTypes.STRING, + allowNull: true, + }, + md5secret: { + type: DataTypes.STRING, + allowNull: true, + }, + remotesecret: { + type: DataTypes.STRING, + allowNull: true, + }, + transport: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'udp' + }, + dtmfmode: { + type: DataTypes.ENUM('rfc2833', 'info', 'shortinfo', 'inband', + 'auto'), + allowNull: true, + defaultValue: 'rfc2833' + }, + directmedia: { + type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'outgoing'), + allowNull: true, + defaultValue: 'no' + }, + directrtpsetup: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + directmediapermit: { + type: DataTypes.STRING, + allowNull: true, + }, + directmediadeny: { + type: DataTypes.STRING, + allowNull: true, + }, + nat: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'force_rport,comedia' + }, + callgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + namedcallgroup: { //We are in named call groups engineering,sales,netgroup,protgroup + type: DataTypes.STRING, + allowNull: true, + }, + pickupgroup: { + type: DataTypes.STRING, + allowNull: true, + }, + namedpickupgroup: { //We can do call pick-p for named call group sales + type: DataTypes.STRING, + allowNull: true, + }, + language: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'en' + }, + tonezone: { + type: DataTypes.STRING, + allowNull: true + }, + allow: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'alaw;ulaw;gsm' + }, + disallow: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + autoframing: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + insecure: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'port,invite' + }, + trustrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + trust_id_outbound: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + progressinband: { + type: DataTypes.ENUM('yes', 'no', 'never'), + allowNull: true, + }, + promiscredir: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + useclientcode: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + accountcode: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + setvar: { + type: DataTypes.STRING, + allowNull: true, + }, + callerid: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '"" <>' + }, + amaflags: { + type: DataTypes.STRING, + allowNull: true, + }, + callcounter: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + busylevel: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + allowoverlap: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowsubscribe: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + allowtransfer: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + ignoresdpversion: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + subscribecontext: { + type: DataTypes.STRING, + allowNull: true, + }, + template: { + type: DataTypes.STRING, + allowNull: true, + }, + videosupport: { + type: DataTypes.ENUM('yes', 'no', 'always'), + allowNull: true, + defaultValue: 'no' + }, + maxcallbitrate: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rfc2833compensate: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + mailbox: { + type: DataTypes.STRING, + allowNull: true, + }, + session_timers: { + type: DataTypes.ENUM('accept', 'refuse', 'originate'), + allowNull: true, + }, + session_expires: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + session_minse: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + session_refresher: { + type: DataTypes.ENUM('uac', 'uas'), + allowNull: true, + defaultValue: 'uas' + }, + t38pt_usertpsource: { + type: DataTypes.STRING, + allowNull: true, + }, + regexten: { + type: DataTypes.STRING, + allowNull: true, + }, + fromdomain: { + type: DataTypes.STRING, + allowNull: true, + }, + fromuser: { + type: DataTypes.STRING, + allowNull: true, + }, + host: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'dynamic' + }, + qualify: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + keepalive: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + defaultip: { + type: DataTypes.STRING, + allowNull: true, + }, + defaultuser: { + type: DataTypes.STRING, + allowNull: true, + }, + rtptimeout: { // Terminate call if 60 seconds of no RTP or RTCP activity on the audio channel when we're not on hold. + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rtpholdtimeout: { // Terminate call if 300 seconds of no RTP or RTCP activity on the audio channel when we're on hold (must be > rtptimeout) + type: DataTypes.INTEGER(11), + allowNull: true, + }, + rtpkeepalive: { // Send keepalives in the RTP stream to keep NAT open (default is off - zero) + type: DataTypes.INTEGER(11), + allowNull: true, + }, + sendrpid: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + outboundproxy: { + type: DataTypes.STRING, + allowNull: true, + }, + callbackextension: { + type: DataTypes.STRING, + allowNull: true, + }, + timert1: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + timerb: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + qualifyfreq: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + contactpermit: { + type: DataTypes.STRING, + allowNull: true, + }, + contactdeny: { + type: DataTypes.STRING, + allowNull: true, + }, + contactacl: { + type: DataTypes.STRING, + allowNull: true, + }, + unsolicited_mailbox: { + type: DataTypes.STRING, + allowNull: true, + }, + use_q850_reason: { + type: DataTypes.STRING, + allowNull: true, + }, + maxforwards: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + encryption: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + avpf: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + force_avp: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + icesupport: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + dtlsenable: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true + }, + dtlsverify: { + type: DataTypes.ENUM('yes', 'no', 'fingerprint', 'certificate'), + allowNull: true + }, + dtlsrekey: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + dtlscertfile: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlsprivatekey: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscipher: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscafile: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlscapath: { + type: DataTypes.STRING, + allowNull: true, + }, + dtlssetup: { + type: DataTypes.ENUM('active', 'passive', 'actpass'), + allowNull: true + }, + dtlsfingerprint: { + type: DataTypes.STRING, + allowNull: true, + }, + usereqphone: { //This provider requires ";user=phone" on URI + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + recordonfeature: { //Feature to use when INFO with Record: on is received. + type: DataTypes.STRING, + allowNull: true, + }, + recordofffeature: { //Feature to use when INFO with Record: off is received. + type: DataTypes.STRING, + allowNull: true, + }, + call_limit: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null + }, + registertrying: { //Send a 100 Trying when the device registers. + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + subscribemwi: { //Only send notifications if this phone subscribes for mailbox notification + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + vmexten: { // dialplan extension to reach mailbox. defaults to global vmexten which defaults to "asterisk" + type: DataTypes.STRING, + allowNull: true, + }, + mohinterpret: { // This option specifies a preference for which music on hold class this channel should listen to when put on hold + type: DataTypes.STRING, + allowNull: true, + }, + mohsuggest: { // This option specifies which music on hold class to suggest to the peer channel when this channel places the peer on hold. + type: DataTypes.STRING, + allowNull: true, + }, + parkinglot: { + type: DataTypes.STRING, + allowNull: true, + }, + canreinvite: { + type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'update,nonat'), + allowNull: true, + defaultValue: 'no' + }, + }, { + tableName: 'users', + instanceMethods: { + /** + * Authenticate - check if the passwords are the same + * + * @param {String} plainText + * {function} callBack + * @api public + */ + authenticate: function(plainText) { + return this.encryptPassword(plainText) === this.password; + }, + /** + * Make salt + * + * @return {String} + * @api public + */ + makeSalt: function() { + return crypto.randomBytes(16).toString('base64'); + }, + /** + * Encrypt password + * + * @param {String} password + * @return {String} + * @api public + */ + encryptPassword: function(password) { + if (!password || !this.salt) return ''; + var salt = new Buffer(this.salt, 'base64'); + return crypto.pbkdf2Sync(password, salt, 10000, 64).toString( + 'base64'); + }, + /** + * md5 password + * + * @param {String} password + * @return {String} + * @api public + */ + md5Password: function(password) { + if (!password) return ''; + return md5(password); + } + }, + associate: function(models) { + // BELOGNS TO MANY + User.hasMany(models.ChatMessage); + User.hasMany(models.MailMessage); + User.hasMany(models.Contact); + User.hasMany(models.Action); + User.belongsToMany(models.Module, { + through: 'user_has_modules' + }); + User.belongsToMany(models.Channel, { + through: 'user_has_channels' + }); + User.belongsToMany(models.MailRoom, { + through: 'user_has_mail_rooms' + }); + User.belongsToMany(models.Team, { + through: models.UserHasTeam + }); + User.belongsToMany(models.ChatRoom, { + through: models.UserHasChatRoom + }); + User.belongsToMany(models.MailQueue, { + through: models.UserHasMailQueue, + required: false + }); + User.belongsToMany(models.FaxQueue, { + through: models.UserHasFaxQueue, + required: false + }); + User.belongsToMany(models.ChatQueue, { + through: models.UserHasChatQueue, + required: false + }); + User.belongsToMany(models.VoiceQueue, { + through: models.UserHasVoiceQueue, + required: false + }); + User.belongsToMany(models.Service, { + through: models.UserHasService + }); + User.hasMany(models.VoiceExtension, { + foreignKey: 'UserId', + as: 'UserExtensions', + onDelete: 'cascade', + hooks: true + }); + + // SCOPES MANAGEMENT + User.addScope('user', { + where: { + role: { + $in: ['admin', 'user'] + }, + } + }); + User.addScope('queues', { + include: [models.VoiceQueue, models.ChatQueue, models.MailQueue, models.FaxQueue] + }); + User.addScope('telephone', { + where: { + role: 'telephone' + } + }); + User.addScope('checkPauseStatus', function(query) { + var scope = { + where: {} + }; + if (query.voicePause) { + scope.where.voicePause = (query.voicePause === 'true') ? true : false; + delete query.voicePause; + } else if (query.faxPause) { + scope.where.faxPause = (query.faxPause === 'true') ? true : false; + delete query.faxPause; + } else if (query.chatPause) { + scope.where.chatPause = (query.chatPause === 'true') ? true : false; + delete query.chatPause; + } else if (query.mailPause) { + scope.where.mailPause = (query.mailPause === 'true') ? true : false; + delete query.mailPause; + } + return scope; + }); + User.addScope('checkOnlineStatus', function(query) { + var scope = { + where: {} + }; + if (query.online) { + scope.where.online = (query.online === 'true') ? true : false; + delete query.online; + } + return scope; + }); + User.addScope('checkSipStatus', function(query) { + var scope = { + where: {} + }; + if (query.status) { + scope.where.status = query.status; + delete query.status; + } + return scope; + }); + User.addScope('agent', { + where: { + role: 'agent' + }, + attributes: ['id', + 'name', + 'email', + 'internal', + 'fullname', + 'accountcode', + 'transport', + 'host', + 'nat', + 'type', + 'allow', + 'chatCapacity', + 'mailCapacity', + 'faxCapacity', + 'online', + 'lastLoginAt', + 'phoneBarAutoAnswer', + 'phoneBarEnableSettings', + 'phoneBarUnconditional', + 'phoneBarNoReply', + 'phoneBarBusy', + 'phoneBarUnconditionalNumber', + 'phoneBarNoReplyNumber', + 'phoneBarBusyNumber', + 'chanspy', + 'voicePause', + 'mailPause', + 'faxPause', + 'chatPause', + 'pauseType', + 'lastPauseAt', + 'status', + 'statusAt', + 'useragent', + 'ipaddr', + 'fullcontact', + 'port', + 'lastms', + 'description' + ] + }); + } + }); + + return User; +} diff --git a/server/models/user_has_chat_queue.js b/server/models/user_has_chat_queue.js index 94e42d9..6479a3d 100644 --- a/server/models/user_has_chat_queue.js +++ b/server/models/user_has_chat_queue.js @@ -1 +1,22 @@ -var _0x20a5=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x20a5[0]);module[_0x20a5[1]]=function(_0xcf68x2,_0xcf68x3){var _0xcf68x4=_0xcf68x2[_0x20a5[6]](_0x20a5[2],{penalty:{type:_0xcf68x3[_0x20a5[3]],defaultValue:0},queue:{type:_0xcf68x3[_0x20a5[4]]}},{tableName:_0x20a5[5]});return _0xcf68x4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var UserHasChatQueue = sequelize.define('UserHasChatQueue', { + penalty: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + queue: { + type: DataTypes.STRING + }, + }, { + tableName: 'user_has_chat_queues' + }); + + return UserHasChatQueue; +}; diff --git a/server/models/user_has_chat_room.js b/server/models/user_has_chat_room.js index d805255..277debd 100644 --- a/server/models/user_has_chat_room.js +++ b/server/models/user_has_chat_room.js @@ -1 +1,19 @@ -var _0xb43d=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xb43d[0]);module[_0xb43d[1]]=function(_0xd5dax2,_0xd5dax3){var _0xd5dax4=_0xd5dax2[_0xb43d[6]](_0xb43d[2],{LastMessageRead:{type:_0xd5dax3[_0xb43d[3]],defaultValue:0},Hide:{type:_0xd5dax3[_0xb43d[4]],defaultValue:false}},{tableName:_0xb43d[5]});return _0xd5dax4} \ No newline at end of file + +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var UserHasChatRoom = sequelize.define('UserHasChatRoom', { + LastMessageRead: { type: DataTypes.INTEGER, defaultValue: 0 }, + Hide: { type: DataTypes.BOOLEAN, defaultValue: false } + }, { + tableName: 'user_has_chat_rooms' + } + ); + + return UserHasChatRoom; +}; diff --git a/server/models/user_has_fax_queue.js b/server/models/user_has_fax_queue.js index 35d679b..3bcb67d 100644 --- a/server/models/user_has_fax_queue.js +++ b/server/models/user_has_fax_queue.js @@ -1 +1,22 @@ -var _0xf108=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xf108[0]);module[_0xf108[1]]=function(_0xca8fx2,_0xca8fx3){var _0xca8fx4=_0xca8fx2[_0xf108[6]](_0xf108[2],{penalty:{type:_0xca8fx3[_0xf108[3]],defaultValue:0},queue:{type:_0xca8fx3[_0xf108[4]]}},{tableName:_0xf108[5]});return _0xca8fx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var UserHasFaxQueue = sequelize.define('UserHasFaxQueue', { + penalty: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + queue: { + type: DataTypes.STRING + } + }, { + tableName: 'user_has_fax_queues' + }); + + return UserHasFaxQueue; +}; diff --git a/server/models/user_has_mail_queue.js b/server/models/user_has_mail_queue.js index 690c5ad..c6358cb 100644 --- a/server/models/user_has_mail_queue.js +++ b/server/models/user_has_mail_queue.js @@ -1 +1,22 @@ -var _0x319a=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x319a[0]);module[_0x319a[1]]=function(_0x8b0bx2,_0x8b0bx3){var _0x8b0bx4=_0x8b0bx2[_0x319a[6]](_0x319a[2],{penalty:{type:_0x8b0bx3[_0x319a[3]],defaultValue:0},queue:{type:_0x8b0bx3[_0x319a[4]]}},{tableName:_0x319a[5]});return _0x8b0bx4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var UserHasMailQueue = sequelize.define('UserHasMailQueue', { + penalty: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + queue: { + type: DataTypes.STRING + } + }, { + tableName: 'user_has_mail_queues' + }); + + return UserHasMailQueue; +}; diff --git a/server/models/user_has_service.js b/server/models/user_has_service.js index af555a2..a3ff23d 100644 --- a/server/models/user_has_service.js +++ b/server/models/user_has_service.js @@ -1 +1,21 @@ -var _0x3851=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x53\x65\x72\x76\x69\x63\x65","\x53\x54\x52\x49\x4E\x47","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x73","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x3851[0]);module[_0x3851[1]]=function(_0xb30dx2,_0xb30dx3){var _0xb30dx4=_0xb30dx2[_0x3851[6]](_0x3851[2],{membername:{type:_0xb30dx3[_0x3851[3]]}},{tableName:_0x3851[4],indexes:[{name:_0x3851[5],fields:[_0x3851[5]]}]});return _0xb30dx4} \ No newline at end of file +/** + * + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + var UserHasService = sequelize.define('UserHasService', { + membername: { + type: DataTypes.STRING + } + }, { + tableName: 'user_has_services', + indexes: [{ + name: 'membername', + fields: ['membername'] + }] + }); + + return UserHasService; +}; diff --git a/server/models/user_has_team.js b/server/models/user_has_team.js index 7ae191e..a0c38b6 100644 --- a/server/models/user_has_team.js +++ b/server/models/user_has_team.js @@ -1 +1,14 @@ -var _0xc1fb=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x54\x65\x61\x6D","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x73","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xc1fb[0]);module[_0xc1fb[1]]=function(_0x5570x2,_0x5570x3){var _0x5570x4=_0x5570x2[_0xc1fb[4]](_0xc1fb[2],{},{tableName:_0xc1fb[3]});return _0x5570x4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + + var UserHasTeam = sequelize.define('UserHasTeam', {}, { + tableName: 'user_has_teams' + }); + + return UserHasTeam; +}; diff --git a/server/models/user_has_voice_queue.js b/server/models/user_has_voice_queue.js index 45caf6a..24791d4 100644 --- a/server/models/user_has_voice_queue.js +++ b/server/models/user_has_voice_queue.js @@ -1 +1,117 @@ -var _0xe286=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x42\x4F\x4F\x4C\x45\x41\x4E","\x44\x41\x54\x45","\x49\x4E\x54\x45\x47\x45\x52","\x53\x54\x52\x49\x4E\x47","\x30","\x6C\x61\x73\x74\x63\x61\x6C\x6C","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x46\x52\x4F\x4D\x5F\x55\x4E\x49\x58\x54\x49\x4D\x45","\x25\x59\x2D\x25\x6D\x2D\x25\x64\x20\x25\x48\x3A\x25\x69\x3A\x25\x73","\x66\x6E","\x73\x74\x61\x74\x75\x73","\x55\x4E\x4B\x4E\x4F\x57\x4E","\x4E\x4F\x54\x5F\x49\x4E\x55\x53\x45","\x31","\x49\x4E\x55\x53\x45","\x32","\x42\x55\x53\x59","\x33","\x49\x4E\x56\x41\x4C\x49\x44","\x34","\x55\x4E\x41\x56\x41\x49\x4C\x41\x42\x4C\x45","\x35","\x52\x49\x4E\x47\x49\x4E\x47","\x36","\x52\x49\x4E\x47\x49\x4E\x55\x53\x45","\x37","\x4F\x4E\x48\x4F\x4C\x44","\x38","\x73\x74\x61\x74\x75\x73\x64\x65\x73\x63","\x73\x74\x61\x74\x75\x73\x41\x74","\x4E\x4F\x57","\x70\x61\x75\x73\x65\x64","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x73","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xe286[0]);module[_0xe286[1]]=function(_0x80eex2,_0x80eex3){var _0x80eex4=_0x80eex2[_0xe286[37]](_0xe286[2],{logged:{type:_0x80eex3[_0xe286[3]],defaultValue:false},loggedAt:{type:_0x80eex3[_0xe286[4]]},ringinuse:{type:_0x80eex3[_0xe286[3]]},penalty:{type:_0x80eex3[_0xe286[5]],defaultValue:0},stateinterface:{type:_0x80eex3[_0xe286[6]]},queue:{type:_0x80eex3[_0xe286[6]]},membername:{type:_0x80eex3[_0xe286[6]]},interface:{type:_0x80eex3[_0xe286[6]]},membership:{type:_0x80eex3[_0xe286[6]]},callstaken:{type:_0x80eex3[_0xe286[5]]},lastcall:{type:_0x80eex3[_0xe286[4]],set:function(_0x80eex5){if(_0x80eex5===_0xe286[7]){this[_0xe286[9]](_0xe286[8],null)}else {this[_0xe286[9]](_0xe286[8],_0x80eex2[_0xe286[12]](_0xe286[10],_0x80eex5,_0xe286[11]))}}},status:{type:_0x80eex3[_0xe286[5]],set:function(_0x80eex6){this[_0xe286[9]](_0xe286[13],_0x80eex6);var _0x80eex7=_0xe286[14];switch(_0x80eex6){case _0xe286[7]:_0x80eex7=_0xe286[14];break;case _0xe286[16]:_0x80eex7=_0xe286[15];break;case _0xe286[18]:_0x80eex7=_0xe286[17];break;case _0xe286[20]:_0x80eex7=_0xe286[19];break;case _0xe286[22]:_0x80eex7=_0xe286[21];break;case _0xe286[24]:_0x80eex7=_0xe286[23];break;case _0xe286[26]:_0x80eex7=_0xe286[25];break;case _0xe286[28]:_0x80eex7=_0xe286[27];break;case _0xe286[30]:_0x80eex7=_0xe286[29];break};this[_0xe286[9]](_0xe286[31],_0x80eex7);this[_0xe286[9]](_0xe286[32],_0x80eex2[_0xe286[12]](_0xe286[33]))}},statusdesc:{type:_0x80eex3[_0xe286[6]]},statusAt:{type:_0x80eex3[_0xe286[4]]},paused:{type:_0x80eex3[_0xe286[3]],defaultValue:false,set:function(_0x80eex8){this[_0xe286[9]](_0xe286[34],parseInt(_0x80eex8,10)?true:false)}},pausedAt:{type:_0x80eex3[_0xe286[4]]},reason:{type:_0x80eex3[_0xe286[6]]}},{tableName:_0xe286[35],indexes:[{name:_0xe286[36],fields:[_0xe286[36]]}]});return _0x80eex4} \ No newline at end of file +/** + * Chat Website Model + */ + +var crypto = require('crypto'); + +module.exports = function(sequelize, DataTypes) { + var UserHasVoiceQueue = sequelize.define('UserHasVoiceQueue', { + logged: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + loggedAt: { + type: DataTypes.DATE + }, + ringinuse: { + type: DataTypes.BOOLEAN + }, + penalty: { + type: DataTypes.INTEGER, + defaultValue: 0 + }, + stateinterface: { + type: DataTypes.STRING + }, + queue: { + type: DataTypes.STRING + }, + membername: { + type: DataTypes.STRING + }, + interface: { + type: DataTypes.STRING + }, + membership: { + type: DataTypes.STRING + }, + callstaken: { + type: DataTypes.INTEGER + }, + lastcall: { + type: DataTypes.DATE, + set: function(lastcall) { + if (lastcall === '0') { + this.setDataValue('lastcall', null); + } else { + this.setDataValue('lastcall', sequelize.fn('FROM_UNIXTIME', lastcall, '%Y-%m-%d %H:%i:%s')); + } + } + }, + status: { + type: DataTypes.INTEGER, + set: function(status) { + this.setDataValue('status', status); + var detail = 'UNKNOWN'; + switch (status) { + case '0': + detail = 'UNKNOWN'; + break; + case '1': + detail = 'NOT_INUSE'; + break; + case '2': + detail = 'INUSE'; + break; + case '3': + detail = 'BUSY'; + break; + case '4': + detail = 'INVALID'; + break; + case '5': + detail = 'UNAVAILABLE'; + break; + case '6': + detail = 'RINGING'; + break; + case '7': + detail = 'RINGINUSE'; + break; + case '8': + detail = 'ONHOLD'; + break; + } + this.setDataValue('statusdesc', detail); + this.setDataValue('statusAt', sequelize.fn('NOW')) + }, + }, + statusdesc: { + type: DataTypes.STRING + }, + statusAt: { + type: DataTypes.DATE + }, + paused: { + type: DataTypes.BOOLEAN, + defaultValue: false, + set: function(paused) { + this.setDataValue('paused', parseInt(paused, 10) ? true : false); + } + }, + pausedAt: { + type: DataTypes.DATE + }, + reason: { + type: DataTypes.STRING + } + }, { + tableName: 'user_has_voice_queues', + indexes: [{ + name: 'membername', + fields: ['membername'] + }] + }); + + return UserHasVoiceQueue; +}; diff --git a/server/models/variable.js b/server/models/variable.js index cab796d..68778bc 100644 --- a/server/models/variable.js +++ b/server/models/variable.js @@ -1 +1,33 @@ -var _0x98bd=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x56\x61\x72\x69\x61\x62\x6C\x65","\x53\x54\x52\x49\x4E\x47","\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x66\x69\x65\x6C\x64\x73","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x98bd[0];module[_0x98bd[1]]=function(_0x9c36x1,_0x9c36x2){var _0x9c36x3=_0x9c36x1[_0x98bd[8]](_0x98bd[2],{name:{type:_0x9c36x2[_0x98bd[3]],unique:true,allowNull:false,validate:{notEmpty:true}},description:_0x9c36x2[_0x98bd[3]]},{tableName:_0x98bd[4],associate:function(_0x9c36x4){_0x9c36x3[_0x98bd[5]](_0x9c36x4.ZendeskField);_0x9c36x3[_0x98bd[5]](_0x9c36x4.DeskField);_0x9c36x3[_0x98bd[5]](_0x9c36x4.SalesforceField);_0x9c36x3[_0x98bd[5]](_0x9c36x4.FreshdeskField);_0x9c36x3[_0x98bd[5]](_0x9c36x4.SugarcrmField);_0x9c36x3[_0x98bd[7]](_0x98bd[6],{include:[{all:true}]})}});return _0x9c36x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var Variable = sequelize.define('Variable', { + name: { + type: DataTypes.STRING, + unique: true, + allowNull: false, + validate: { + notEmpty: true, + }, + }, + description: DataTypes.STRING + }, { + tableName: 'variables', + associate: function(models) { + Variable.hasMany(models.ZendeskField); + Variable.hasMany(models.DeskField); + Variable.hasMany(models.SalesforceField); + Variable.hasMany(models.FreshdeskField); + Variable.hasMany(models.SugarcrmField); + Variable.addScope('fields', { + include: [{ + all: true + }] + }); + } + }); + + return Variable; + +}; diff --git a/server/models/voice_context.js b/server/models/voice_context.js index 617c1f8..e81e9ab 100644 --- a/server/models/voice_context.js +++ b/server/models/voice_context.js @@ -1 +1,32 @@ -var _0xcf59=["\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4F\x6E\x65","\x64\x65\x66\x69\x6E\x65"];module[_0xcf59[0]]=function(_0x98c7x1,_0x98c7x2){var _0x98c7x3=_0x98c7x1[_0xcf59[7]](_0xcf59[1],{name:{type:_0x98c7x2[_0xcf59[2]],unique:true},description:{type:_0x98c7x2[_0xcf59[2]],allowNull:true},defaultEntry:{type:_0x98c7x2[_0xcf59[3]],defaultValue:0}},{tableName:_0xcf59[4],associate:function(_0x98c7x4){_0x98c7x3[_0xcf59[6]](_0x98c7x4.VoiceExtension,{onDelete:_0xcf59[5],hooks:true})}});return _0x98c7x3} \ No newline at end of file +/** + * Context Model + */ + +module.exports = function(sequelize, DataTypes) { + + var VoiceContext = sequelize.define('VoiceContext', { + name: { + type: DataTypes.STRING, + unique: true + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + defaultEntry: { + type: DataTypes.BOOLEAN, + defaultValue: 0 + } + }, { + tableName: 'voice_contexts', + associate: function(models) { + VoiceContext.hasOne(models.VoiceExtension, { + onDelete: 'cascade', + hooks: true + }); + } + + }); + + return VoiceContext; +}; diff --git a/server/models/voice_extension.js b/server/models/voice_extension.js index 96e154e..6d42a6e 100644 --- a/server/models/voice_extension.js +++ b/server/models/voice_extension.js @@ -1 +1,112 @@ -var _0xdc49=["\x75\x74\x69\x6C","\x72\x65\x76\x65\x72\x73\x65\x2D\x6D\x75\x73\x74\x61\x63\x68\x65","\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x63\x6F\x6D\x70\x6F\x73\x69\x74\x65\x49\x6E\x64\x65\x78","\x31","\x2D\x2D","\x4E\x6F\x4F\x70","\x69\x64","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x61\x70\x70","\x44\x69\x61\x6C","\x74\x79\x70\x65","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x53\x49\x50\x2F\x7B\x7B\x74\x72\x75\x6E\x6B\x7D\x7D\x2F\x7B\x7B\x70\x72\x65\x66\x69\x78\x7D\x7D\x24\x7B\x45\x58\x54\x45\x4E\x3A\x7B\x7B\x63\x75\x74\x64\x69\x67\x69\x74\x73\x7D\x7D\x7D","\x61\x70\x70\x64\x61\x74\x61","\x74\x72\x75\x6E\x6B","\x63\x61\x6C\x6C\x65\x72\x49\x44","","\x63\x75\x74\x64\x69\x67\x69\x74\x73","\x70\x72\x65\x66\x69\x78","\x2C","\x73\x70\x6C\x69\x74","\x69\x6E\x62\x6F\x75\x6E\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x69\x6E\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x73\x79\x73\x74\x65\x6D","\x61\x6E\x79","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x61\x73\x63\x61\x64\x65","\x68\x61\x73\x4D\x61\x6E\x79","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x61\x64\x64\x53\x63\x6F\x70\x65","\x72\x6F\x75\x74\x65\x73","\x64\x65\x66\x69\x6E\x65"];var util=require(_0xdc49[0]);var reverseMustache=require(_0xdc49[1]);module[_0xdc49[2]]=function(_0x343cx3,_0x343cx4){var _0x343cx5=_0x343cx3[_0xdc49[41]](_0xdc49[3],{context:{type:_0x343cx4[_0xdc49[4]],allowNull:false,unique:_0xdc49[5],validate:{notEmpty:true,is:/[A-Za-z0-9\.\_]+$/i}},exten:{type:_0x343cx4[_0xdc49[4]],allowNull:false,unique:_0xdc49[5]},priority:{type:_0x343cx4[_0xdc49[4]],allowNull:false,defaultValue:_0xdc49[6],unique:_0xdc49[5]},tag:{type:_0x343cx4[_0xdc49[4]],allowNull:false,defaultValue:_0xdc49[7]},app:{type:_0x343cx4[_0xdc49[4]],allowNull:false,defaultValue:_0xdc49[8]},appdata:{type:_0x343cx4[_0xdc49[4]],allowNull:true,get:function(){if(!this[_0xdc49[10]](_0xdc49[9])){if(this[_0xdc49[10]](_0xdc49[11])===_0xdc49[12]&&this[_0xdc49[10]](_0xdc49[13])===_0xdc49[14]){var _0x343cx6=reverseMustache({template:_0xdc49[15],content:this[_0xdc49[10]](_0xdc49[16])});return [_0x343cx6[_0xdc49[17]],this[_0xdc49[10]](_0xdc49[18])||_0xdc49[19],_0x343cx6[_0xdc49[20]],_0x343cx6[_0xdc49[21]]]}else {return this[_0xdc49[10]](_0xdc49[16])[_0xdc49[23]](_0xdc49[22])}}else {return this[_0xdc49[10]](_0xdc49[16])}}},type:{type:_0x343cx4.ENUM(_0xdc49[24],_0xdc49[14],_0xdc49[25],_0xdc49[26],_0xdc49[27],_0xdc49[28],_0xdc49[29]),allowNull:false},description:{type:_0x343cx4[_0xdc49[4]]},interval:{type:_0x343cx4[_0xdc49[4]]},IntervalId:{type:_0x343cx4[_0xdc49[30]]},isApp:{type:_0x343cx4[_0xdc49[31]],defaultValue:false},callerID:{type:_0x343cx4[_0xdc49[4]],allowNull:true},record:{type:_0x343cx4[_0xdc49[31]],defaultValue:false}},{tableName:_0xdc49[32],associate:function(_0x343cx7){_0x343cx5[_0xdc49[35]](_0x343cx7.VoiceExtension,{as:_0xdc49[33],onDelete:_0xdc49[34],hooks:true});_0x343cx5[_0xdc49[39]](_0xdc49[36],{include:[{model:_0x343cx7[_0xdc49[3]],as:_0xdc49[33],required:false,where:{isApp:true},attributes:[_0xdc49[11],_0xdc49[37],_0xdc49[38],_0xdc49[18],_0xdc49[16],_0xdc49[13]]}]});_0x343cx5[_0xdc49[39]](_0xdc49[40],{where:{VoiceExtensionId:null}})}});return _0x343cx5} \ No newline at end of file +/* jshint indent: 2 */ +var util = require('util'); +var reverseMustache = require('reverse-mustache'); + +module.exports = function(sequelize, DataTypes) { + var VoiceExtension = sequelize.define('VoiceExtension', { + context: { + type: DataTypes.STRING, + allowNull: false, + unique: 'compositeIndex', + validate: { + notEmpty: true, + is: /[A-Za-z0-9\.\_]+$/i + }, + }, + exten: { + type: DataTypes.STRING, + allowNull: false, + unique: 'compositeIndex' + }, + priority: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: '1', + unique: 'compositeIndex' + }, + tag: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: '--' + }, + app: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: 'NoOp' + }, + appdata: { + type: DataTypes.STRING, + allowNull: true, + get: function() { + // 'this' allows you to access attributes of the instance + if (!this.getDataValue('id')) { + if (this.getDataValue('app') === 'Dial' && this.getDataValue('type') === 'outbound') { + var appdata = reverseMustache({ + template: 'SIP/{{trunk}}/{{prefix}}${EXTEN:{{cutdigits}}}', + content: this.getDataValue('appdata') + }); + return [appdata.trunk, this.getDataValue('callerID') || '', appdata.cutdigits, appdata.prefix]; + } else { + return this.getDataValue('appdata').split(','); + } + } else { + return this.getDataValue('appdata'); + } + }, + }, + type: { + type: DataTypes.ENUM('inbound', 'outbound', 'internal', 'inbound-fax', 'outbound-fax', 'system', 'any'), + allowNull: false, + }, + description: { + type: DataTypes.STRING, + }, + interval: { + type: DataTypes.STRING, + }, + IntervalId: { + type: DataTypes.INTEGER, + }, + isApp: { + type: DataTypes.BOOLEAN, + defaultValue: false + }, + callerID: { + type: DataTypes.STRING, + allowNull: true + }, + record: { + type: DataTypes.BOOLEAN, + defaultValue: false + } + }, { + tableName: 'voice_extensions', + associate: function(models) { + VoiceExtension.hasMany(models.VoiceExtension, { + as: 'Applications', + onDelete: 'cascade', + hooks: true + }); + // SCOPES MANAGEMENT + VoiceExtension.addScope('application', { + include: [{ + model: models.VoiceExtension, + as: 'Applications', + required: false, + where: { + isApp: true + }, + attributes: ['app', 'interval', 'IntervalId', 'callerID', 'appdata', 'type'] + }] + }); + + VoiceExtension.addScope('routes', { + where: { + VoiceExtensionId: null + } + }); + } + }); + + return VoiceExtension; +}; diff --git a/server/models/voice_musiconhold.js b/server/models/voice_musiconhold.js index 35999cb..c405ca3 100644 --- a/server/models/voice_musiconhold.js +++ b/server/models/voice_musiconhold.js @@ -1 +1,71 @@ -var _0x3406=["\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x53\x54\x52\x49\x4E\x47","\x63\x75\x73\x74\x6F\x6D","\x66\x69\x6C\x65\x73","\x6D\x70\x33\x6E\x62","\x71\x75\x69\x65\x74\x6D\x70\x33\x6E\x62","\x71\x75\x69\x65\x74\x6D\x70\x33","\x6D\x70\x33","\x61\x6C\x70\x68\x61","\x77\x61\x76","\x54\x49\x4D\x45\x53\x54\x41\x4D\x50","\x42\x4F\x4F\x4C\x45\x41\x4E","\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64","\x64\x65\x66\x69\x6E\x65","\x6E\x61\x6D\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x6D\x6F\x68\x20\x63\x6C\x61\x73\x73\x20\x6E\x61\x6D\x65","\x64\x65\x66\x61\x75\x6C\x74\x45\x6E\x74\x72\x79","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x6D\x6F\x68\x20\x63\x6C\x61\x73\x73","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x64\x65\x6C\x65\x74\x65\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x6D\x6F\x68\x20\x63\x6C\x61\x73\x73","\x62\x65\x66\x6F\x72\x65\x44\x65\x6C\x65\x74\x65"];module[_0x3406[0]]=function(_0x9dc7x1,_0x9dc7x2){var _0x9dc7x3=_0x9dc7x1[_0x3406[14]](_0x3406[1],{name:{type:_0x9dc7x2[_0x3406[2]],allowNull:false,unique:true},mode:{type:_0x9dc7x2.ENUM(_0x3406[3],_0x3406[4],_0x3406[5],_0x3406[6],_0x3406[7],_0x3406[8]),allowNull:true,defaultValue:_0x3406[4]},directory:{type:_0x9dc7x2[_0x3406[2]],allowNull:true},application:{type:_0x9dc7x2[_0x3406[2]],allowNull:true},digit:{type:_0x9dc7x2[_0x3406[2]],allowNull:true},sort:{type:_0x9dc7x2[_0x3406[2]],allowNull:true,defaultValue:_0x3406[9]},format:{type:_0x9dc7x2[_0x3406[2]],allowNull:true,defaultValue:_0x3406[10]},stamp:{type:_0x3406[11]},defaultEntry:{type:_0x9dc7x2[_0x3406[12]],defaultValue:0}},{tableName:_0x3406[13]});_0x9dc7x3[_0x3406[20]](function(_0x9dc7x4){if(_0x9dc7x4[_0x3406[16]](_0x3406[15])){throw new Error({message:_0x3406[17]})};if(_0x9dc7x4[_0x3406[18]]){throw new Error({message:_0x3406[19]})}});_0x9dc7x3[_0x3406[22]](function(_0x9dc7x4){if(_0x9dc7x4[_0x3406[18]]){throw new Error({message:_0x3406[21]})}});return _0x9dc7x3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var VoiceMusicOnHold = sequelize.define('VoiceMusicOnHold', { + name: { + type: DataTypes.STRING, + allowNull: false, + unique: true + }, + mode: { + type: DataTypes.ENUM('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3', 'mp3'), + allowNull: true, + defaultValue: 'files' + }, + directory: { + type: DataTypes.STRING, + allowNull: true, + }, + application: { + type: DataTypes.STRING, + allowNull: true, + }, + digit: { + type: DataTypes.STRING, + allowNull: true, + }, + sort: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'alpha' + }, + format: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'wav' + }, + stamp: { + type: 'TIMESTAMP' + }, + defaultEntry: { + type: DataTypes.BOOLEAN, + defaultValue: 0 + } + }, { + tableName: 'voice_musiconhold' + }); + + VoiceMusicOnHold.beforeUpdate(function(moh) { + if (moh.changed('name')) { + throw new Error({ + message: "You can't modify a moh class name" + }); + } + if (moh.defaultEntry) { + throw new Error({ + message: "You can't modify a default moh class" + }); + } + }); + + + VoiceMusicOnHold.beforeDelete(function(moh) { + if (moh.defaultEntry) { + throw new Error({ + message: "You can't delete a default moh class" + }); + } + }); + + return VoiceMusicOnHold; +}; diff --git a/server/models/voice_queue.js b/server/models/voice_queue.js index 80f405b..71d35c8 100644 --- a/server/models/voice_queue.js +++ b/server/models/voice_queue.js @@ -1 +1,305 @@ -var _0xe189=["\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x53\x54\x52\x49\x4E\x47","\x64\x65\x66\x61\x75\x6C\x74","","\x72\x69\x6E\x67\x61\x6C\x6C","\x6C\x65\x61\x73\x74\x72\x65\x63\x65\x6E\x74","\x66\x65\x77\x65\x73\x74\x63\x61\x6C\x6C\x73","\x72\x61\x6E\x64\x6F\x6D","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x6C\x69\x6E\x65\x61\x72","\x77\x72\x61\x6E\x64\x6F\x6D","\x72\x72\x6F\x72\x64\x65\x72\x65\x64","\x79\x65\x73","\x6E\x6F","\x61\x6C\x6C","\x6F\x6E\x63\x65","\x30","\x35","\x31\x30","\x31\x35","\x32\x30","\x33\x30","\x42\x4F\x4F\x4C\x45\x41\x4E","\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x73","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x71\x75\x65\x75\x65","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65","\x6E\x61\x6D\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x71\x75\x65\x75\x65\x20\x6E\x61\x6D\x65","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65"];module[_0xe189[0]]=function(_0x8027x1,_0x8027x2){var _0x8027x3=_0x8027x1[_0xe189[28]](_0xe189[1],{name:{type:_0x8027x2[_0xe189[2]],primaryKey:true,unique:true,validate:{notEmpty:true,is:/^[A-Za-z0-9\.\_]+$/i}},musiconhold:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[3]},announce:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[4]},strategy:{type:_0x8027x2.ENUM(_0xe189[5],_0xe189[6],_0xe189[7],_0xe189[8],_0xe189[9],_0xe189[10],_0xe189[11],_0xe189[12]),allowNull:false,defaultValue:_0xe189[5]},servicelevel:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},context:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},penaltymemberslimit:{type:_0x8027x2.INTEGER(11),allowNull:true},timeout:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},retry:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},timeoutpriority:{type:_0x8027x2[_0xe189[2]],allowNull:true},weight:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},wrapuptime:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},autofill:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[13]},autopause:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14],_0xe189[15]),allowNull:true,defaultValue:_0xe189[14]},autopausedelay:{type:_0x8027x2.INTEGER(11),allowNull:true},autopausebusy:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},autopauseunavail:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},maxlen:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},setinterfacevar:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},setqueueentryvar:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defautValue:_0xe189[14]},setqueuevar:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},membermacro:{type:_0x8027x2[_0xe189[2]],allowNull:true},membergosub:{type:_0x8027x2[_0xe189[2]],allowNull:true},announce_frequency:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},min_announce_frequency:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},periodic_announce_frequency:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},random_periodic_announce:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},relative_periodic_announce:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[13]},announce_holdtime:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14],_0xe189[16]),allowNull:true,defaultValue:_0xe189[14]},announce_position:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[14]},announce_to_first_user:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true},announce_position_limit:{type:_0x8027x2.INTEGER(11),allowNull:true},announce_round_seconds:{type:_0x8027x2.ENUM(_0xe189[17],_0xe189[18],_0xe189[19],_0xe189[20],_0xe189[21],_0xe189[22]),allowNull:true,defaultValue:_0xe189[17]},monitor_format:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[4]},monitor_type:{type:_0x8027x2[_0xe189[2]],allowNull:true},queue_youarenext:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_thereare:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_callswaiting:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_holdtime:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_minute:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_minutes:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_seconds:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_thankyou:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:null},queue_reporthold:{type:_0x8027x2[_0xe189[2]],allowNull:true},queue_quantity1:{type:_0x8027x2[_0xe189[2]],allowNull:true},queue_quantity2:{type:_0x8027x2[_0xe189[2]],allowNull:true},queue_periodic_announce:{type:_0x8027x2[_0xe189[2]],allowNull:true},queue_less_than:{type:_0x8027x2[_0xe189[2]],allowNull:true},periodic_announce:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[4]},joinempty:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[13]},leavewhenempty:{type:_0x8027x2[_0xe189[2]],allowNull:true,defaultValue:_0xe189[14]},reportholdtime:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},ringinuse:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},memberdelay:{type:_0x8027x2.INTEGER(11),allowNull:true,defaultValue:0},timeoutrestart:{type:_0x8027x2.ENUM(_0xe189[13],_0xe189[14]),allowNull:true,defaultValue:_0xe189[14]},defaultrule:{type:_0x8027x2[_0xe189[2]],allowNull:true},description:{type:_0x8027x2[_0xe189[2]],allowNull:true},acw:{type:_0x8027x2[_0xe189[23]],defaultValue:0},acwTimeout:{type:_0x8027x2.INTEGER(11),defaultValue:10}},{tableName:_0xe189[24],associate:function(_0x8027x4){_0x8027x3[_0xe189[27]](_0x8027x4.User,{through:_0x8027x4[_0xe189[25]],foreignKey:_0xe189[26],required:false})}});_0x8027x3[_0xe189[32]](function(_0x8027x5){if(_0x8027x5[_0xe189[30]](_0xe189[29])){throw new Error(_0xe189[31])}});return _0x8027x3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var VoiceQueue = sequelize.define('VoiceQueue', { + name: { + type: DataTypes.STRING, + primaryKey: true, + unique: true, + validate: { + notEmpty: true, + is: /^[A-Za-z0-9\.\_]+$/i + }, + }, + musiconhold: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'default' + }, + announce: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '' + }, + strategy: { + type: DataTypes.ENUM('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered'), + allowNull: false, + defaultValue: 'ringall' + }, + servicelevel: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + context: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + penaltymemberslimit: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + timeout: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + retry: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + timeoutpriority: { + type: DataTypes.STRING, + allowNull: true, + }, + weight: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + wrapuptime: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + autofill: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + autopause: { + type: DataTypes.ENUM('yes', 'no', 'all'), + allowNull: true, + defaultValue: 'no' + }, + autopausedelay: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + autopausebusy: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + autopauseunavail: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + maxlen: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + setinterfacevar: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + setqueueentryvar: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defautValue: 'no' + }, + setqueuevar: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + membermacro: { + type: DataTypes.STRING, + allowNull: true, + }, + membergosub: { + type: DataTypes.STRING, + allowNull: true, + }, + announce_frequency: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + min_announce_frequency: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + periodic_announce_frequency: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + random_periodic_announce: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + relative_periodic_announce: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'yes' + }, + announce_holdtime: { + type: DataTypes.ENUM('yes', 'no', 'once'), + allowNull: true, + defaultValue: 'no' + }, + announce_position: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'no' + }, + announce_to_first_user: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + }, + announce_position_limit: { + type: DataTypes.INTEGER(11), + allowNull: true, + }, + announce_round_seconds: { + type: DataTypes.ENUM('0', '5', '10', '15', '20', '30'), + allowNull: true, + defaultValue: '0' + }, + monitor_format: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '' + }, + monitor_type: { + type: DataTypes.STRING, + allowNull: true, + }, + queue_youarenext: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_thereare: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_callswaiting: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_holdtime: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_minute: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_minutes: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_seconds: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_thankyou: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null + }, + queue_reporthold: { + type: DataTypes.STRING, + allowNull: true, + }, + queue_quantity1: { + type: DataTypes.STRING, + allowNull: true + }, + queue_quantity2: { + type: DataTypes.STRING, + allowNull: true + }, + queue_periodic_announce: { + type: DataTypes.STRING, + allowNull: true + }, + queue_less_than: { + type: DataTypes.STRING, + allowNull: true + }, + periodic_announce: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: '' + }, + joinempty: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'yes' + }, + leavewhenempty: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'no' + }, + reportholdtime: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + ringinuse: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + memberdelay: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: 0 + }, + timeoutrestart: { + type: DataTypes.ENUM('yes', 'no'), + allowNull: true, + defaultValue: 'no' + }, + defaultrule: { + type: DataTypes.STRING, + allowNull: true, + }, + description: { + type: DataTypes.STRING, + allowNull: true, + }, + acw: { + type: DataTypes.BOOLEAN, + defaultValue: 0 + }, + acwTimeout: { + type: DataTypes.INTEGER(11), + defaultValue: 10 + } + }, { + tableName: 'voice_queues', + associate: function(models) { + VoiceQueue.belongsToMany(models.User, { + through: models.UserHasVoiceQueue, + foreignKey: 'queue', + required: false + }); + } + }); + + VoiceQueue.beforeUpdate(function(updatedQueue) { + if (updatedQueue.changed('name')) { + throw new Error("You can't modify a queue name"); + } + }); + + return VoiceQueue; +}; diff --git a/server/models/voice_recording.js b/server/models/voice_recording.js index 8df02f2..736aa24 100644 --- a/server/models/voice_recording.js +++ b/server/models/voice_recording.js @@ -1 +1,75 @@ -var _0x3afb=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74\x41\x74","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0x3afb[0]);module[_0x3afb[1]]=function(_0xf64fx2,_0xf64fx3){var _0xf64fx4=_0xf64fx2[_0x3afb[11]](_0x3afb[2],{uniqueid:{type:_0xf64fx3[_0x3afb[3]],primaryKey:true},channel:{type:_0xf64fx3[_0x3afb[3]]},calleridnum:{type:_0xf64fx3[_0x3afb[3]]},calleridname:{type:_0xf64fx3[_0x3afb[3]]},connectedlinenum:{type:_0xf64fx3[_0x3afb[3]]},connectedlinename:{type:_0xf64fx3[_0x3afb[3]]},language:{type:_0xf64fx3[_0x3afb[3]]},accountcode:{type:_0xf64fx3[_0x3afb[3]]},context:{type:_0xf64fx3[_0x3afb[3]]},exten:{type:_0xf64fx3[_0x3afb[3]]},value:{type:_0xf64fx3[_0x3afb[3]]},type:{type:_0xf64fx3[_0x3afb[3]]},rating:{type:_0xf64fx3[_0x3afb[4]],defaultValue:0,validate:{max:5,min:0}},createdAt:{type:_0xf64fx3[_0x3afb[5]],get:function(){return moment(this[_0x3afb[9]](_0x3afb[8]))[_0x3afb[7]](_0x3afb[6])}},updatedAt:{type:_0xf64fx3[_0x3afb[5]],get:function(){return moment(this[_0x3afb[9]](_0x3afb[8]))[_0x3afb[7]](_0x3afb[6])}}},{tableName:_0x3afb[10],associate:function(_0xf64fx5){}});return _0xf64fx4} \ No newline at end of file +/* jshint indent: 2 */ +var moment = require('moment'); + +module.exports = function(sequelize, DataTypes) { + var VoiceRecording = sequelize.define('VoiceRecording', { + uniqueid: { + type: DataTypes.STRING, + primaryKey: true + }, + channel: { + type: DataTypes.STRING + }, + calleridnum: { + type: DataTypes.STRING + }, + calleridname: { + type: DataTypes.STRING + }, + connectedlinenum: { + type: DataTypes.STRING + }, + connectedlinename: { + type: DataTypes.STRING + }, + language: { + type: DataTypes.STRING + }, + accountcode: { + type: DataTypes.STRING + }, + context: { + type: DataTypes.STRING + }, + exten: { + type: DataTypes.STRING + }, + value: { + type: DataTypes.STRING + }, + type: { + type: DataTypes.STRING + }, + rating: { + type: DataTypes.INTEGER, + defaultValue: 0, + validate: { + max: 5, + min: 0 + } + }, + createdAt: { + type: DataTypes.DATE, + get: function() { + // 'this' allows you to access attributes of the instance + return moment(this.getDataValue('agentconnectAt')).format("MM-DD-YYYY HH:mm"); + } + }, + updatedAt: { + type: DataTypes.DATE, + get: function() { + // 'this' allows you to access attributes of the instance + return moment(this.getDataValue('agentconnectAt')).format("MM-DD-YYYY HH:mm"); + } + } + }, { + tableName: 'voice_recordings', + associate: function(models) { + // VoiceRecording.belongsTo(models.ReportCall, { + // foreignKey: 'uniqueid' + // }); + } + }); + + return VoiceRecording; +}; diff --git a/server/models/voice_voicemail.js b/server/models/voice_voicemail.js index 1de62e3..f814f4b 100644 --- a/server/models/voice_voicemail.js +++ b/server/models/voice_voicemail.js @@ -1 +1,144 @@ -var _0x8546=["\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x53\x54\x52\x49\x4E\x47","\x66\x72\x6F\x6D\x2D\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x63\x6F\x6E\x74\x65\x73\x74\x5F\x6D\x61\x69\x6C\x62\x6F\x78","","\x63\x65\x6E\x74\x72\x61\x6C","\x79\x65\x73","\x6E\x6F","\x54\x49\x4E\x59\x49\x4E\x54\x28\x34\x29","\x54\x49\x4D\x45\x53\x54\x41\x4D\x50","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x6D\x61\x69\x6C\x62\x6F\x78\x5F\x63\x6F\x6E\x74\x65\x78\x74","\x6D\x61\x69\x6C\x62\x6F\x78","\x63\x6F\x6E\x74\x65\x78\x74","\x64\x65\x66\x69\x6E\x65"];module[_0x8546[0]]=function(_0x99abx1,_0x99abx2){var _0x99abx3=_0x99abx1[_0x8546[15]](_0x8546[1],{uniqueid:{type:_0x99abx2.INTEGER(4),primaryKey:true,allowNull:false,autoIncrement:true},customer_id:{type:_0x99abx2[_0x8546[2]]},context:{type:_0x99abx2[_0x8546[2]],defaultValue:_0x8546[3],unique:_0x8546[4]},mailbox:{type:_0x99abx2[_0x8546[2]],defaultValue:_0x8546[5],allowNull:false,unique:_0x8546[4]},password:{type:_0x99abx2[_0x8546[2]]},fullname:{type:_0x99abx2[_0x8546[2]]},email:{type:_0x99abx2[_0x8546[2]]},pager:{type:_0x99abx2[_0x8546[2]]},tz:{type:_0x99abx2[_0x8546[2]],defaultValue:_0x8546[6]},attach:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[7],allowNull:false},saycid:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[7],allowNull:false},dialout:{type:_0x99abx2[_0x8546[2]]},callback:{type:_0x99abx2[_0x8546[2]]},review:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},operator:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},envelope:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},sayduration:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},saydurationm:{type:_0x8546[9],defaultValue:1,allowNull:false},sendvoicemail:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},"\x64\x65\x6C\x65\x74\x65":{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},nextaftercmd:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[7],allowNull:false},forcename:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},forcegreetings:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[8],allowNull:false},hidefromdir:{type:_0x99abx2.ENUM(_0x8546[7],_0x8546[8]),defaultValue:_0x8546[7],allowNull:false},stamp:{type:_0x8546[10]},emailsubject:{type:_0x99abx2[_0x8546[2]]},emailbody:{type:_0x99abx2[_0x8546[2]]},name:{type:_0x99abx2[_0x8546[2]]},maxsecs:{type:_0x99abx2.INTEGER(255),defaultValue:180,allowNull:false},maxmsg:{type:_0x99abx2.INTEGER(255),defaultValue:100,allowNull:false}},{tableName:_0x8546[11],indexes:[{name:_0x8546[12],fields:[_0x8546[13],_0x8546[14]]}]});return _0x99abx3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var VoiceVoicemail = sequelize.define('VoiceVoicemail', { + uniqueid: { + type: DataTypes.INTEGER(4), + primaryKey: true, + allowNull: false, + autoIncrement: true + }, + customer_id: { + type: DataTypes.STRING, + }, + context: { + type: DataTypes.STRING, + defaultValue: 'from-voicemail', + unique: 'contest_mailbox' + }, + mailbox: { + type: DataTypes.STRING, + defaultValue: '', + allowNull: false, + unique: 'contest_mailbox' + }, + password: { + type: DataTypes.STRING, + }, + fullname: { + type: DataTypes.STRING, + }, + email: { + type: DataTypes.STRING, + }, + pager: { + type: DataTypes.STRING, + }, + tz: { + type: DataTypes.STRING, + defaultValue: 'central' + }, + attach: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'yes', + allowNull: false + }, + saycid: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'yes', + allowNull: false + }, + dialout: { + type: DataTypes.STRING, + }, + callback: { + type: DataTypes.STRING, + }, + review: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + operator: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + envelope: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + sayduration: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + saydurationm: { + type: 'TINYINT(4)', + defaultValue: 1, + allowNull: false + }, + sendvoicemail: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + 'delete': { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + nextaftercmd: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'yes', + allowNull: false + }, + forcename: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + forcegreetings: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'no', + allowNull: false + }, + hidefromdir: { + type: DataTypes.ENUM('yes', 'no'), + defaultValue: 'yes', + allowNull: false + }, + stamp: { + type: 'TIMESTAMP' + }, + emailsubject: { + type: DataTypes.STRING, + }, + emailbody: { + type: DataTypes.STRING, + }, + name: { + type: DataTypes.STRING, + }, + maxsecs: { + type: DataTypes.INTEGER(255), + defaultValue: 180, + allowNull: false + }, + maxmsg: { + type: DataTypes.INTEGER(255), + defaultValue: 100, + allowNull: false + } + + }, { + tableName: 'voice_voicemail', + indexes: [{ + name: 'mailbox_context', + fields: ['mailbox', 'context'] + }] + }); + + return VoiceVoicemail; +}; diff --git a/server/models/voice_voicemail_messages.js b/server/models/voice_voicemail_messages.js index 89e0ae6..fbfc691 100644 --- a/server/models/voice_voicemail_messages.js +++ b/server/models/voice_voicemail_messages.js @@ -1 +1,83 @@ -var _0xc80b=["\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x56\x6F\x69\x63\x65\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x53\x54\x52\x49\x4E\x47","","\x6C\x6F\x6E\x67","\x54\x49\x4D\x45\x53\x54\x41\x4D\x50","\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x6D\x61\x69\x6C\x62\x6F\x78","\x63\x6F\x6E\x74\x65\x78\x74","\x6D\x61\x69\x6C\x62\x6F\x78\x63\x6F\x6E\x74\x65\x78\x74","\x77\x68\x65\x72\x65","\x6D\x61\x69\x6C\x62\x6F\x78\x75\x73\x65\x72","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x69\x72","\x64\x65\x66\x69\x6E\x65"];module[_0xc80b[0]]=function(_0xacc1x1,_0xacc1x2){var _0xacc1x3=_0xacc1x1[_0xc80b[14]](_0xc80b[1],{msgnum:{type:_0xacc1x2.INTEGER(11),defaultValue:0,allowNull:false},dir:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},context:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},macrocontext:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},callerid:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},origtime:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},duration:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},mailboxuser:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},mailboxcontext:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},recording:{type:_0xacc1x2.BLOB(_0xc80b[4]),defaultValue:null},flag:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},msg_id:{type:_0xacc1x2[_0xc80b[2]],defaultValue:_0xc80b[3]},stamp:{type:_0xc80b[5],allowNull:false}},{tableName:_0xc80b[6],associate:function(_0xacc1x4){_0xacc1x3[_0xc80b[12]](_0xc80b[7],function(_0xacc1x5){var _0xacc1x6={where:{}};if(_0xacc1x5[_0xc80b[8]]&&_0xacc1x5[_0xc80b[7]]){where:{_0xacc1x6[_0xc80b[10]][_0xc80b[9]]=_0xacc1x5[_0xc80b[8]];_0xacc1x6[_0xc80b[10]][_0xc80b[11]]=_0xacc1x5[_0xc80b[7]]}delete _0xacc1x5[_0xc80b[8]];delete _0xacc1x5[_0xc80b[7]]};return _0xacc1x6})},indexes:[{name:_0xc80b[13],fields:[_0xc80b[13]]}]});return _0xacc1x3} \ No newline at end of file +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + var VoiceVoicemailMessages = sequelize.define('VoiceVoicemailMessages', { + msgnum: { + type: DataTypes.INTEGER(11), + defaultValue: 0, + allowNull: false + }, + dir: { + type: DataTypes.STRING, + defaultValue: '' + }, + context: { + type: DataTypes.STRING, + defaultValue: '' + }, + macrocontext: { + type: DataTypes.STRING, + defaultValue: '' + }, + callerid: { + type: DataTypes.STRING, + defaultValue: '' + }, + origtime: { + type: DataTypes.STRING, + defaultValue: '' + }, + duration: { + type: DataTypes.STRING, + defaultValue: '' + }, + mailboxuser: { + type: DataTypes.STRING, + defaultValue: '' + }, + mailboxcontext: { + type: DataTypes.STRING, + defaultValue: '' + }, + recording: { + type: DataTypes.BLOB('long'), + defaultValue: null + }, + flag: { + type: DataTypes.STRING, + defaultValue: '' + }, + msg_id: { + type: DataTypes.STRING, + defaultValue: '' + }, + stamp: { + type: 'TIMESTAMP', + allowNull: false + } + }, { + tableName: 'voice_voicemail_messages', + associate: function(models) { + VoiceVoicemailMessages.addScope('mailbox', function(query) { + var scope = { + where: {} + }; + if (query.context && query.mailbox) { + where: { + scope.where.mailboxcontext = query.context; + scope.where.mailboxuser = query.mailbox; + } + delete query.context; + delete query.mailbox; + } + return scope; + }); + }, + indexes: [{ + name: 'dir', + fields: ['dir'] + }] + }); + + return VoiceVoicemailMessages; +}; diff --git a/server/models/zendesk_account.js b/server/models/zendesk_account.js index 93b5851..899cf38 100644 --- a/server/models/zendesk_account.js +++ b/server/models/zendesk_account.js @@ -1 +1,42 @@ -var _0x30cd=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x70\x61\x73\x73\x77\x6F\x72\x64","\x74\x6F\x6B\x65\x6E","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x69\x64","\x6E\x61\x6D\x65","\x61\x64\x64\x53\x63\x6F\x70\x65","\x64\x65\x66\x69\x6E\x65"];_0x30cd[0];module[_0x30cd[1]]=function(_0xdd06x1,_0xdd06x2){var _0xdd06x3=_0xdd06x1[_0x30cd[15]](_0x30cd[2],{name:_0xdd06x2[_0x30cd[3]],description:_0xdd06x2[_0x30cd[3]],username:{type:_0xdd06x2[_0x30cd[3]],unique:true},password:_0xdd06x2[_0x30cd[3]],token:_0xdd06x2[_0x30cd[3]],remoteUri:{type:_0xdd06x2[_0x30cd[3]],unique:true},authType:{type:_0xdd06x2.ENUM(_0x30cd[4],_0x30cd[5]),defaultValue:_0x30cd[4]}},{tableName:_0x30cd[6],associate:function(_0xdd06x4){_0xdd06x3[_0x30cd[9]](_0xdd06x4.ZendeskConfiguration,{as:_0x30cd[7],foreignKey:_0x30cd[8]});_0xdd06x3[_0x30cd[14]](_0x30cd[10],{include:[{model:_0xdd06x4[_0x30cd[11]],as:_0x30cd[7],required:false,attributes:[_0x30cd[12],_0x30cd[13]]}]})}});return _0xdd06x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ZendeskAccount = sequelize.define('ZendeskAccount', { + name: DataTypes.STRING, + description: DataTypes.STRING, + username: { + type: DataTypes.STRING, + unique: true + }, + password: DataTypes.STRING, + token: DataTypes.STRING, + remoteUri: { + type: DataTypes.STRING, + unique: true + }, + authType: { + type: DataTypes.ENUM('password', 'token'), + defaultValue: 'password' + } + }, { + tableName: 'zendesk_accounts', + associate: function(models) { + ZendeskAccount.hasMany(models.ZendeskConfiguration, { + as: 'Configurations', + foreignKey: 'AccountId' + }); + ZendeskAccount.addScope('configurations', { + include: [{ + model: models.ZendeskConfiguration, + as: 'Configurations', + required: false, + attributes: ['id', 'name'] + }] + }); + } + }); + + return ZendeskAccount; + +}; diff --git a/server/models/zendesk_configuration.js b/server/models/zendesk_configuration.js index 5d26e27..9363273 100644 --- a/server/models/zendesk_configuration.js +++ b/server/models/zendesk_configuration.js @@ -1 +1,44 @@ -var _0xe9a4=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x53\x54\x52\x49\x4E\x47","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x61\x63\x63\x6F\x75\x6E\x74","\x61\x64\x64\x53\x63\x6F\x70\x65","\x53\x75\x62\x6A\x65\x63\x74","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x46\x69\x65\x6C\x64","\x46\x69\x65\x6C\x64\x49\x64","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x5F\x68\x61\x73\x5F\x74\x61\x67\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];_0xe9a4[0];module[_0xe9a4[1]]=function(_0xf2cax1,_0xf2cax2){var _0xf2cax3=_0xf2cax1[_0xe9a4[18]](_0xe9a4[2],{name:_0xf2cax2[_0xe9a4[3]],description:_0xf2cax2[_0xe9a4[3]]},{tableName:_0xe9a4[4],associate:function(_0xf2cax4){_0xf2cax3[_0xe9a4[6]](_0xf2cax4.ZendeskAccount,{foreignKey:_0xe9a4[5]});_0xf2cax3[_0xe9a4[8]](_0xe9a4[7],function(_0xf2cax5){return {where:{AccountId:_0xf2cax5},include:[{all:true}]}});_0xf2cax3[_0xe9a4[11]](_0xf2cax4.ZendeskField,{as:_0xe9a4[9],foreignKey:_0xe9a4[10]});_0xf2cax3[_0xe9a4[11]](_0xf2cax4.ZendeskField,{as:_0xe9a4[12],foreignKey:_0xe9a4[13]});_0xf2cax3[_0xe9a4[11]](_0xf2cax4.ZendeskField,{as:_0xe9a4[14],foreignKey:_0xe9a4[15]});_0xf2cax3[_0xe9a4[17]](_0xf2cax4.Tag,{through:_0xe9a4[16]})}});return _0xf2cax3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ZendeskConfiguration = sequelize.define('ZendeskConfiguration', { + name: DataTypes.STRING, + description: DataTypes.STRING + }, { + tableName: 'zendesk_configurations', + associate: function(models) { + ZendeskConfiguration.belongsTo(models.ZendeskAccount, { + foreignKey: 'AccountId' + }); + ZendeskConfiguration.addScope('account', function(AccountId) { + return { + where: { + AccountId: AccountId + }, + include: [{ + all: true + }] + } + }); + ZendeskConfiguration.hasMany(models.ZendeskField, { + as: 'Subject', + foreignKey: 'SubjectId' + }); + ZendeskConfiguration.hasMany(models.ZendeskField, { + as: 'Description', + foreignKey: 'DescriptionId' + }); + ZendeskConfiguration.hasMany(models.ZendeskField, { + as: 'Field', + foreignKey: 'FieldId' + }); + ZendeskConfiguration.belongsToMany(models.Tag, { + through: 'zendesk_configuration_has_tags' + }); + } + }); + + return ZendeskConfiguration; + +}; diff --git a/server/models/zendesk_field.js b/server/models/zendesk_field.js index 2a24ea8..278c7fa 100644 --- a/server/models/zendesk_field.js +++ b/server/models/zendesk_field.js @@ -1 +1,32 @@ -var _0xce2a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x74\x72\x69\x6E\x67","\x76\x61\x72\x69\x61\x62\x6C\x65","\x63\x75\x73\x74\x6F\x6D\x56\x61\x72\x69\x61\x62\x6C\x65","\x6B\x65\x79\x56\x61\x6C\x75\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x42\x4F\x4F\x4C\x45\x41\x4E","\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];_0xce2a[0];module[_0xce2a[1]]=function(_0x9040x1,_0x9040x2){var _0x9040x3=_0x9040x1[_0xce2a[12]](_0xce2a[2],{type:{type:_0x9040x2.ENUM(_0xce2a[3],_0xce2a[4],_0xce2a[5],_0xce2a[6]),defaultValue:_0xce2a[3]},content:_0x9040x2[_0xce2a[7]],key:_0x9040x2[_0xce2a[7]],keyType:{type:_0x9040x2.ENUM(_0xce2a[3],_0xce2a[4],_0xce2a[5])},keyContent:_0x9040x2[_0xce2a[7]],idField:_0x9040x2[_0xce2a[8]],nameField:_0x9040x2[_0xce2a[7]],customField:{type:_0x9040x2[_0xce2a[9]],defaultValue:true},variableName:_0x9040x2[_0xce2a[7]]},{tableName:_0xce2a[10],associate:function(_0x9040x4){_0x9040x3[_0xce2a[11]](_0x9040x4.Variable)}});return _0x9040x3} \ No newline at end of file +'use strict'; + +module.exports = function(sequelize, DataTypes) { + + var ZendeskField = sequelize.define('ZendeskField', { + type: { + type: DataTypes.ENUM('string', 'variable', 'customVariable', 'keyValue'), + defaultValue: 'string' + }, + content: DataTypes.STRING, + key: DataTypes.STRING, + keyType: { + type: DataTypes.ENUM('string', 'variable', 'customVariable') + }, + keyContent: DataTypes.STRING, + idField: DataTypes.INTEGER, + nameField: DataTypes.STRING, + customField: { + type: DataTypes.BOOLEAN, + defaultValue: true + }, + variableName: DataTypes.STRING + }, { + tableName: 'zendesk_fields', + associate: function(models) { + ZendeskField.belongsTo(models.Variable); + } + }); + + return ZendeskField; + +}; diff --git a/server/routes.js b/server/routes.js index b2b3373..2b92984 100644 --- a/server/routes.js +++ b/server/routes.js @@ -1 +1,149 @@ -var _0xa68a=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x65\x72\x72\x6F\x72\x73","\x70\x61\x74\x68","\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x65\x6E\x76","\x67\x65\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x70\x72\x6F\x61\x63\x74\x69\x76\x65\x5F\x61\x63\x74\x69\x6F\x6E","\x75\x73\x65","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65\x73\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x61\x6E\x73\x77\x65\x72\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x61\x6E\x6E\x65\x64\x5F\x61\x6E\x73\x77\x65\x72","\x2F\x61\x70\x69\x2F\x61\x63\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x61\x63\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x70\x61\x75\x73\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x70\x61\x75\x73\x65","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x6A\x73\x63\x72\x69\x70\x74\x79\x5F\x70\x72\x6F\x6A\x65\x63\x74","\x2F\x61\x70\x69\x2F\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x2F\x61\x70\x69\x2F\x6C\x69\x63\x65\x6E\x73\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x6C\x69\x63\x65\x6E\x73\x65","\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x75\x67\x61\x72\x63\x72\x6D\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x72\x65\x73\x68\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x61\x6C\x65\x73\x66\x6F\x72\x63\x65\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x64\x65\x66\x61\x75\x6C\x74","\x2E\x2F\x61\x70\x69\x2F\x64\x65\x66\x61\x75\x6C\x74\x5F\x72\x65\x70\x6F\x72\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x63\x75\x73\x74\x6F\x6D","\x2E\x2F\x61\x70\x69\x2F\x63\x75\x73\x74\x6F\x6D\x5F\x72\x65\x70\x6F\x72\x74","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F\x74\x72\x65\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x74\x72\x65\x65","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x6D\x65\x74\x72\x69\x63\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x65\x74\x72\x69\x63","\x2F\x61\x70\x69\x2F\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64","\x2E\x2F\x61\x70\x69\x2F\x65\x78\x74\x72\x61\x63\x74\x65\x64\x5F\x72\x65\x70\x6F\x72\x74","\x2F\x61\x70\x69\x2F\x75\x70\x64\x61\x74\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x70\x64\x61\x74\x65","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x63\x68\x61\x74\x2F\x73\x65\x73\x73\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x66\x69\x65\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x66\x69\x65\x6C\x64","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x63\x68\x61\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x2E\x2F\x61\x70\x69\x2F\x6D\x6F\x74\x69\x6F\x6E\x62\x61\x72","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x6D\x61\x69\x6C\x2F\x73\x65\x73\x73\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x6D\x61\x69\x6C\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C","\x2F\x61\x70\x69\x2F\x77\x69\x64\x67\x65\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x77\x69\x64\x67\x65\x74","\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x7A\x65\x6E\x64\x65\x73\x6B\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x2F\x61\x67\x65\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74","\x2F\x61\x70\x69\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x64\x61\x73\x68\x62\x6F\x61\x72\x64","\x2F\x61\x70\x69\x2F\x73\x65\x74\x74\x69\x6E\x67\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x65\x74\x74\x69\x6E\x67","\x2F\x61\x70\x69\x2F\x74\x72\x69\x67\x67\x65\x72\x73","\x2E\x2F\x61\x70\x69\x2F\x74\x72\x69\x67\x67\x65\x72","\x2F\x61\x70\x69\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x74\x65\x6D\x70\x6C\x61\x74\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x74\x65\x6D\x70\x6C\x61\x74\x65","\x2F\x61\x70\x69\x2F\x61\x6D\x69","\x2E\x2F\x61\x70\x69\x2F\x61\x6D\x69","\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x6D\x75\x73\x69\x63\x6F\x6E\x68\x6F\x6C\x64","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x76\x6F\x69\x63\x65\x6D\x61\x69\x6C","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6D\x70\x61\x6E\x69\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x6F\x6D\x70\x61\x6E\x79","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x73\x65\x72\x76\x69\x63\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x65\x72\x76\x69\x63\x65","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x73\x65\x72\x76\x69\x63\x65","\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x6D\x61\x6E\x61\x67\x65\x72\x2F\x63\x6F\x6E\x74\x61\x63\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x6F\x6E\x74\x61\x63\x74\x5F\x6D\x61\x6E\x61\x67\x65\x72","\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x2E\x2F\x61\x70\x69\x2F\x69\x6E\x74\x65\x72\x76\x61\x6C","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x63\x6F\x6E\x74\x65\x78\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x63\x6F\x6E\x74\x65\x78\x74","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x74\x72\x75\x6E\x6B\x73","\x2E\x2F\x61\x70\x69\x2F\x74\x72\x75\x6E\x6B","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x6F\x64\x62\x63","\x2E\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x5F\x6F\x64\x62\x63","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x66\x61\x78\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x74\x65\x61\x6D","\x2F\x61\x70\x69\x2F\x76\x61\x72\x69\x61\x62\x6C\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x76\x61\x72\x69\x61\x62\x6C\x65","\x2F\x61\x70\x69\x2F\x63\x68\x61\x6E\x73\x70\x79","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x6E\x73\x70\x79","\x2F\x61\x70\x69\x2F\x74\x61\x67\x73","\x2E\x2F\x61\x70\x69\x2F\x74\x61\x67","\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x2F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x72\x6F\x6F\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x72\x6F\x6F\x6D","\x2F\x61\x70\x69\x2F\x66\x61\x78\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x61\x67\x65\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x61\x67\x65\x6E\x74","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x65\x6E\x71\x75\x69\x72\x69\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x65\x6E\x71\x75\x69\x72\x79","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x6D\x65\x73\x73\x61\x67\x65","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x72\x6F\x6F\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x76\x69\x73\x69\x74\x6F\x72\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x76\x69\x73\x69\x74\x6F\x72","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x77\x65\x62\x73\x69\x74\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x5F\x77\x65\x62\x73\x69\x74\x65","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x6D\x65\x73\x73\x61\x67\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x6D\x65\x73\x73\x61\x67\x65","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x72\x6F\x6F\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x73\x65\x72\x76\x65\x72\x73\x2F\x69\x6E","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x69\x6E","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x73\x65\x72\x76\x65\x72\x73\x2F\x6F\x75\x74","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x73\x65\x72\x76\x65\x72\x5F\x6F\x75\x74","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x71\x75\x65\x75\x65\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x6D\x61\x69\x6C\x5F\x71\x75\x65\x75\x65","\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x2F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x2E\x2F\x61\x70\x69\x2F\x6D\x61\x69\x6C\x5F\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2F\x61\x70\x69\x2F\x74\x65\x61\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x74\x65\x61\x6D","\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64\x73","\x2E\x2F\x61\x70\x69\x2F\x73\x6F\x75\x6E\x64","\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72","\x2F\x61\x70\x69\x2F\x63\x68\x61\x74\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x72\x6F\x6F\x6D\x73","\x2E\x2F\x61\x70\x69\x2F\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D","\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79","\x2E\x2F\x61\x70\x69\x2F\x78\x63\x68\x61\x74\x74\x79","\x2F\x61\x75\x74\x68","\x2E\x2F\x61\x75\x74\x68","\x2F\x3A\x75\x72\x6C\x28\x61\x70\x69\x7C\x61\x75\x74\x68\x7C\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x7C\x61\x70\x70\x7C\x62\x6F\x77\x65\x72\x5F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x7C\x61\x73\x73\x65\x74\x73\x29\x2F\x2A","\x72\x6F\x75\x74\x65","\x2F\x2A","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E","\x72\x6F\x6F\x74","\x70\x75\x62\x6C\x69\x63","\x6A\x6F\x69\x6E","\x64\x65\x76\x65\x6C\x6F\x70\x6D\x65\x6E\x74","\x74\x65\x73\x74","\x63\x6C\x69\x65\x6E\x74","\x69\x6E\x64\x65\x78\x2E\x68\x74\x6D\x6C","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x61\x6C\x6C"];_0xa68a[0];var config=require(_0xa68a[1]);var errors=require(_0xa68a[2]);var path=require(_0xa68a[3]);var moment=require(_0xa68a[4]);module[_0xa68a[5]]=function(_0x5acbx5){var _0x5acbx6=_0x5acbx5[_0xa68a[7]](_0xa68a[6]);_0x5acbx5[_0xa68a[10]](_0xa68a[8],require(_0xa68a[9]));_0x5acbx5[_0xa68a[10]](_0xa68a[11],require(_0xa68a[12]));_0x5acbx5[_0xa68a[10]](_0xa68a[13],require(_0xa68a[14]));_0x5acbx5[_0xa68a[10]](_0xa68a[15],require(_0xa68a[16]));_0x5acbx5[_0xa68a[10]](_0xa68a[17],require(_0xa68a[18]));_0x5acbx5[_0xa68a[10]](_0xa68a[19],require(_0xa68a[20]));_0x5acbx5[_0xa68a[10]](_0xa68a[21],require(_0xa68a[22]));_0x5acbx5[_0xa68a[10]](_0xa68a[23],require(_0xa68a[24]));_0x5acbx5[_0xa68a[10]](_0xa68a[25],require(_0xa68a[26]));_0x5acbx5[_0xa68a[10]](_0xa68a[27],require(_0xa68a[28]));_0x5acbx5[_0xa68a[10]](_0xa68a[29],require(_0xa68a[30]));_0x5acbx5[_0xa68a[10]](_0xa68a[31],require(_0xa68a[32]));_0x5acbx5[_0xa68a[10]](_0xa68a[33],require(_0xa68a[34]));_0x5acbx5[_0xa68a[10]](_0xa68a[35],require(_0xa68a[36]));_0x5acbx5[_0xa68a[10]](_0xa68a[37],require(_0xa68a[38]));_0x5acbx5[_0xa68a[10]](_0xa68a[39],require(_0xa68a[40]));_0x5acbx5[_0xa68a[10]](_0xa68a[41],require(_0xa68a[42]));_0x5acbx5[_0xa68a[10]](_0xa68a[43],require(_0xa68a[44]));_0x5acbx5[_0xa68a[10]](_0xa68a[45],require(_0xa68a[46]));_0x5acbx5[_0xa68a[10]](_0xa68a[47],require(_0xa68a[48]));_0x5acbx5[_0xa68a[10]](_0xa68a[49],require(_0xa68a[50]));_0x5acbx5[_0xa68a[10]](_0xa68a[51],require(_0xa68a[52]));_0x5acbx5[_0xa68a[10]](_0xa68a[53],require(_0xa68a[54]));_0x5acbx5[_0xa68a[10]](_0xa68a[55],require(_0xa68a[56]));_0x5acbx5[_0xa68a[10]](_0xa68a[57],require(_0xa68a[58]));_0x5acbx5[_0xa68a[10]](_0xa68a[59],require(_0xa68a[60]));_0x5acbx5[_0xa68a[10]](_0xa68a[61],require(_0xa68a[62]));_0x5acbx5[_0xa68a[10]](_0xa68a[63],require(_0xa68a[64]));_0x5acbx5[_0xa68a[10]](_0xa68a[65],require(_0xa68a[66]));_0x5acbx5[_0xa68a[10]](_0xa68a[67],require(_0xa68a[68]));_0x5acbx5[_0xa68a[10]](_0xa68a[69],require(_0xa68a[70]));_0x5acbx5[_0xa68a[10]](_0xa68a[71],require(_0xa68a[72]));_0x5acbx5[_0xa68a[10]](_0xa68a[73],require(_0xa68a[74]));_0x5acbx5[_0xa68a[10]](_0xa68a[75],require(_0xa68a[76]));_0x5acbx5[_0xa68a[10]](_0xa68a[77],require(_0xa68a[78]));_0x5acbx5[_0xa68a[10]](_0xa68a[79],require(_0xa68a[80]));_0x5acbx5[_0xa68a[10]](_0xa68a[81],require(_0xa68a[82]));_0x5acbx5[_0xa68a[10]](_0xa68a[83],require(_0xa68a[84]));_0x5acbx5[_0xa68a[10]](_0xa68a[85],require(_0xa68a[86]));_0x5acbx5[_0xa68a[10]](_0xa68a[87],require(_0xa68a[88]));_0x5acbx5[_0xa68a[10]](_0xa68a[89],require(_0xa68a[90]));_0x5acbx5[_0xa68a[10]](_0xa68a[91],require(_0xa68a[92]));_0x5acbx5[_0xa68a[10]](_0xa68a[93],require(_0xa68a[94]));_0x5acbx5[_0xa68a[10]](_0xa68a[95],require(_0xa68a[96]));_0x5acbx5[_0xa68a[10]](_0xa68a[97],require(_0xa68a[98]));_0x5acbx5[_0xa68a[10]](_0xa68a[99],require(_0xa68a[100]));_0x5acbx5[_0xa68a[10]](_0xa68a[101],require(_0xa68a[102]));_0x5acbx5[_0xa68a[10]](_0xa68a[103],require(_0xa68a[104]));_0x5acbx5[_0xa68a[10]](_0xa68a[105],require(_0xa68a[106]));_0x5acbx5[_0xa68a[10]](_0xa68a[107],require(_0xa68a[108]));_0x5acbx5[_0xa68a[10]](_0xa68a[109],require(_0xa68a[110]));_0x5acbx5[_0xa68a[10]](_0xa68a[111],require(_0xa68a[112]));_0x5acbx5[_0xa68a[10]](_0xa68a[113],require(_0xa68a[114]));_0x5acbx5[_0xa68a[10]](_0xa68a[115],require(_0xa68a[116]));_0x5acbx5[_0xa68a[10]](_0xa68a[117],require(_0xa68a[118]));_0x5acbx5[_0xa68a[10]](_0xa68a[119],require(_0xa68a[120]));_0x5acbx5[_0xa68a[10]](_0xa68a[121],require(_0xa68a[122]));_0x5acbx5[_0xa68a[10]](_0xa68a[123],require(_0xa68a[124]));_0x5acbx5[_0xa68a[10]](_0xa68a[125],require(_0xa68a[126]));_0x5acbx5[_0xa68a[10]](_0xa68a[127],require(_0xa68a[128]));_0x5acbx5[_0xa68a[10]](_0xa68a[129],require(_0xa68a[130]));_0x5acbx5[_0xa68a[10]](_0xa68a[131],require(_0xa68a[132]));_0x5acbx5[_0xa68a[10]](_0xa68a[133],require(_0xa68a[134]));_0x5acbx5[_0xa68a[10]](_0xa68a[135],require(_0xa68a[136]));_0x5acbx5[_0xa68a[10]](_0xa68a[137],require(_0xa68a[138]));_0x5acbx5[_0xa68a[10]](_0xa68a[139],require(_0xa68a[140]));_0x5acbx5[_0xa68a[10]](_0xa68a[141],require(_0xa68a[142]));_0x5acbx5[_0xa68a[10]](_0xa68a[143],require(_0xa68a[144]));_0x5acbx5[_0xa68a[10]](_0xa68a[145],require(_0xa68a[146]));_0x5acbx5[_0xa68a[10]](_0xa68a[147],require(_0xa68a[148]));_0x5acbx5[_0xa68a[10]](_0xa68a[149],require(_0xa68a[150]));_0x5acbx5[_0xa68a[10]](_0xa68a[151],require(_0xa68a[152]));_0x5acbx5[_0xa68a[10]](_0xa68a[153],require(_0xa68a[154]));_0x5acbx5[_0xa68a[10]](_0xa68a[155],require(_0xa68a[156]));_0x5acbx5[_0xa68a[10]](_0xa68a[157],require(_0xa68a[158]));_0x5acbx5[_0xa68a[10]](_0xa68a[159],require(_0xa68a[160]));_0x5acbx5[_0xa68a[10]](_0xa68a[161],require(_0xa68a[162]));_0x5acbx5[_0xa68a[10]](_0xa68a[163],require(_0xa68a[164]));_0x5acbx5[_0xa68a[10]](_0xa68a[165],require(_0xa68a[166]));_0x5acbx5[_0xa68a[10]](_0xa68a[167],require(_0xa68a[168]));_0x5acbx5[_0xa68a[10]](_0xa68a[169],require(_0xa68a[170]));_0x5acbx5[_0xa68a[10]](_0xa68a[151],require(_0xa68a[152]));_0x5acbx5[_0xa68a[10]](_0xa68a[171],require(_0xa68a[172]));_0x5acbx5[_0xa68a[10]](_0xa68a[173],require(_0xa68a[174]));_0x5acbx5[_0xa68a[10]](_0xa68a[175],require(_0xa68a[176]));_0x5acbx5[_0xa68a[10]](_0xa68a[177],require(_0xa68a[178]));_0x5acbx5[_0xa68a[10]](_0xa68a[179],require(_0xa68a[180]));_0x5acbx5[_0xa68a[10]](_0xa68a[181],require(_0xa68a[182]));_0x5acbx5[_0xa68a[10]](_0xa68a[183],require(_0xa68a[184]));_0x5acbx5[_0xa68a[10]](_0xa68a[185],require(_0xa68a[186]));_0x5acbx5[_0xa68a[10]](_0xa68a[187],require(_0xa68a[188]));_0x5acbx5[_0xa68a[10]](_0xa68a[189],require(_0xa68a[190]));_0x5acbx5[_0xa68a[10]](_0xa68a[191],require(_0xa68a[192]));_0x5acbx5[_0xa68a[10]](_0xa68a[193],require(_0xa68a[194]));_0x5acbx5[_0xa68a[10]](_0xa68a[195],require(_0xa68a[196]));_0x5acbx5[_0xa68a[10]](_0xa68a[197],require(_0xa68a[198]));_0x5acbx5[_0xa68a[200]](_0xa68a[199])[_0xa68a[7]](errors[404]);_0x5acbx5[_0xa68a[211]](_0xa68a[201],function(_0x5acbx7,_0x5acbx8,_0x5acbx9){var _0x5acbxa={};if(_0xa68a[202]===_0x5acbx6){_0x5acbxa[_0xa68a[203]]=path[_0xa68a[205]](config[_0xa68a[203]],_0xa68a[204])};if(_0xa68a[206]===_0x5acbx6||_0xa68a[207]===_0x5acbx6){_0x5acbxa[_0xa68a[203]]=path[_0xa68a[205]](config[_0xa68a[203]],_0xa68a[208])};_0x5acbx8[_0xa68a[210]](_0xa68a[209],_0x5acbxa)})} \ No newline at end of file +/** + * Main application routes + */ + +'use strict'; + +var config = require('./config/environment'); +var errors = require('./components/errors'); +var path = require('path'); +var moment = require('moment'); + +module.exports = function(app) { + var env = app.get('env'); + + // Insert routes below + app.use('/api/chat/proactives', require('./api/chat_proactive_action')); + + app.use('/api/chat/websites/fields', require('./api/chat_websites_field')); + app.use('/api/answers', require('./api/canned_answer')); + app.use('/api/actions', require('./api/action')); + app.use('/api/pauses', require('./api/pause')); + app.use('/api/voice/recordings', require('./api/voice_recording')); + app.use('/api/jscripty/projects', require('./api/jscripty_project')); + app.use('/api/telephones', require('./api/telephone')); + app.use('/api/licenses', require('./api/license')); + app.use('/api/sugarcrm/fields', require('./api/sugarcrm_field')); + app.use('/api/sugarcrm/configurations', require('./api/sugarcrm_configuration')); + app.use('/api/sugarcrm/accounts', require('./api/sugarcrm_account')); + app.use('/api/freshdesk/fields', require('./api/freshdesk_field')); + app.use('/api/freshdesk/configurations', require('./api/freshdesk_configuration')); + app.use('/api/freshdesk/accounts', require('./api/freshdesk_account')); + app.use('/api/salesforce/fields', require('./api/salesforce_field')); + app.use('/api/salesforce/configurations', require('./api/salesforce_configuration')); + app.use('/api/salesforce/accounts', require('./api/salesforce_account')); + app.use('/api/desk/fields', require('./api/desk_field')); + app.use('/api/desk/configurations', require('./api/desk_configuration')); + app.use('/api/desk/accounts', require('./api/desk_account')); + app.use('/api/analytics/reports/default', require('./api/default_report')); + app.use('/api/analytics/reports/custom', require('./api/custom_report')); + app.use('/api/analytics/reports/trees', require('./api/report_tree')); + app.use('/api/analytics/metrics', require('./api/metric')); + app.use('/api/analytics/extracted', require('./api/extracted_report')); + app.use('/api/updates', require('./api/update')); + app.use('/api/report/chat/sessions', require('./api/report_chat_session')); + app.use('/api/zendesk/fields', require('./api/zendesk_field')); + app.use('/api/report/chats', require('./api/report_chat')); + app.use('/api/zendesk/configurations', require('./api/zendesk_configuration')); + app.use('/api/motionbar', require('./api/motionbar')); + app.use('/api/report/mail/sessions', require('./api/report_mail_session')); + app.use('/api/report/mails', require('./api/report_mail')); + app.use('/api/widgets', require('./api/widget')); + app.use('/api/zendesk/accounts', require('./api/zendesk_account')); + app.use('/api/report/queues', require('./api/report_queue')); + app.use('/api/report/integrations', require('./api/report_integration')); + app.use('/api/report/agents', require('./api/report_agent')); + app.use('/api/dashboards', require('./api/dashboard')); + app.use('/api/settings', require('./api/setting')); + app.use('/api/triggers', require('./api/trigger')); + app.use('/api/automations', require('./api/automation')); + app.use('/api/mail/templates', require('./api/mail_template')); + app.use('/api/ami', require('./api/ami')); + app.use('/api/integrations', require('./api/integration')); + app.use('/api/voice/musiconholds', require('./api/voice_musiconhold')); + app.use('/api/voice/voicemails/messages', require('./api/voice_voicemail_messages')); + app.use('/api/voice/voicemails', require('./api/voice_voicemail')); + app.use('/api/contactmanager/companies', require('./api/company')); + app.use('/api/contactmanager/services', require('./api/service')); + app.use('/api/contactmanager/user_has_services', require('./api/user_has_service')); + app.use('/api/contactmanager/contacts', require('./api/contact_manager')); + app.use('/api/intervals', require('./api/interval')); + app.use('/api/voice/extensions', require('./api/voice_extension')); + app.use('/api/voice/contexts', require('./api/voice_context')); + app.use('/api/voice/user_has_queues', require('./api/user_has_voice_queue')); + app.use('/api/voice/queues', require('./api/voice_queue')); + app.use('/api/trunks', require('./api/trunk')); + app.use('/api/chat/applications', require('./api/chat_application')); + app.use('/api/chat/user_has_queues', require('./api/user_has_chat_queue')); + app.use('/api/square/odbc', require('./api/square_odbc')); + app.use('/api/fax/applications', require('./api/fax_application')); + app.use('/api/fax/user_has_queues', require('./api/user_has_fax_queue')); + app.use('/api/fax/queues', require('./api/fax_queue')); + app.use('/api/mail/attachments', require('./api/mail_attachment')); + app.use('/api/user_has_teams', require('./api/user_has_team')); + app.use('/api/variables', require('./api/variable')); + app.use('/api/chanspy', require('./api/chanspy')); + app.use('/api/tags', require('./api/tag')); + app.use('/api/square/projects', require('./api/square_project')); + app.use('/api/chat/queues', require('./api/chat_queue')); + app.use('/api/fax/messages', require('./api/fax_message')); + app.use('/api/fax/rooms', require('./api/fax_room')); + app.use('/api/fax/accounts', require('./api/fax_account')); + app.use('/api/agents', require('./api/agent')); + app.use('/api/chat/enquiries', require('./api/chat_enquiry')); + app.use('/api/chat/messages', require('./api/chat_message')); + app.use('/api/chat/rooms', require('./api/chat_room')); + app.use('/api/chat/visitors', require('./api/chat_visitor')); + app.use('/api/chat/websites', require('./api/chat_website')); + app.use('/api/chat/queues', require('./api/chat_queue')); + app.use('/api/mail/accounts', require('./api/mail_account')); + app.use('/api/mail/messages', require('./api/mail_message')); + app.use('/api/mail/rooms', require('./api/mail_room')); + app.use('/api/mail/servers/in', require('./api/mail_server_in')); + app.use('/api/mail/servers/out', require('./api/mail_server_out')); + app.use('/api/mail/queues', require('./api/mail_queue')); + app.use('/api/mail/user_has_queues', require('./api/user_has_mail_queue')); + app.use('/api/mail/applications', require('./api/mail_application')); + app.use('/api/teams', require('./api/team')); + app.use('/api/sounds', require('./api/sound')); + app.use('/api/users', require('./api/user')); + app.use('/api/chat/user_has_rooms', require('./api/user_has_chat_room')); + app.use('/api/xchatty', require('./api/xchatty')); + app.use('/auth', require('./auth')); + + // All undefined asset or api routes should return a 404 + app.route('/:url(api|auth|components|app|bower_components|assets)/*').get( + errors[404]); + + // All other routes should redirect to the index.html + app.all("/*", function(req, res, next) { + + var options = {}; + + if ('production' === env) { + options.root = path.join(config.root, 'public'); + } + + if ('development' === env || 'test' === env) { + options.root = path.join(config.root, 'client'); + } + + res.sendFile('index.html', options); + }); + + // app + // .route('/*') + // .get(function(req, res) { + // + // var options = { + // root: config.root, + // dotfiles: 'deny', + // headers: { + // 'x-timestamp': Date.now(), + // 'x-sent': true + // } + // }; + // + // res.sendFile('index.html', options); + // }); +}; diff --git a/server/utils/report_build.js b/server/utils/report_build.js index 52c14d8..5a75ac6 100644 --- a/server/utils/report_build.js +++ b/server/utils/report_build.js @@ -1 +1,87 @@ -var _0x955e=["\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x62\x75\x69\x6C\x64\x52\x65\x70\x6F\x72\x74","","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x43\x4F\x55\x4E\x54\x28\x44\x49\x53\x54\x49\x4E\x43\x54\x20\x25\x73\x29","\x66\x69\x65\x6C\x64","\x66\x6F\x72\x6D\x61\x74","\x43\x4F\x55\x4E\x54\x20\x44\x49\x53\x54\x49\x4E\x43\x54","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x41\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x41\x53\x43","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x44\x45\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x44\x45\x53\x43","\x25\x73\x28\x25\x73\x29","\x25\x73\x20\x41\x53\x20\x27\x25\x73\x27","\x61\x6C\x69\x61\x73","\x70\x75\x73\x68","\x67\x72\x6F\x75\x70\x42\x79","\x6F\x72\x64\x65\x72\x42\x79","\x25\x73\x20\x25\x73","\x66\x6F\x72\x45\x61\x63\x68","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x67\x72\x6F\x75\x70","\x70\x61\x72\x73\x65","\x28\x29","\x53\x45\x4C\x45\x43\x54","\x20","\x2C","\x6A\x6F\x69\x6E","\x20\x46\x52\x4F\x4D\x20","\x74\x61\x62\x6C\x65","\x20\x57\x48\x45\x52\x45\x20","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3E\x3D\x20\x27","\x27","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3C\x3D\x20\x27","\x65\x6E\x64\x44\x61\x74\x65","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x66\x69\x6E\x64","\x20\x4C\x49\x4B\x45\x20\x27\x25","\x25\x27","\x66\x6F\x72\x4F\x77\x6E","\x6C\x65\x6E\x67\x74\x68","\x20\x41\x4E\x44\x20","\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20","\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20","\x28","\x72\x75\x6C\x65\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x20\x27","\x4C\x49\x4B\x45","\x25","\x76\x61\x6C\x75\x65","\x29"];var _=require(_0x955e[0]);var util=require(_0x955e[1]);exports[_0x955e[2]]=function(_0x9ad8x3,_0x9ad8x4){var _0x9ad8x5=[],_0x9ad8x6=[],_0x9ad8x7=[];_[_0x955e[20]](_0x9ad8x3.Fields,function(_0x9ad8x8){var _0x9ad8x9=_0x955e[3];if(_0x9ad8x8[_0x955e[4]]){switch(_0x9ad8x8[_0x955e[4]]){case _0x955e[8]:_0x9ad8x9=util[_0x955e[7]](_0x955e[5],_0x9ad8x8[_0x955e[6]]);break;case _0x955e[10]:_0x9ad8x9=util[_0x955e[7]](_0x955e[9],_0x9ad8x8[_0x955e[6]],_0x9ad8x8[_0x955e[6]]);break;case _0x955e[12]:_0x9ad8x9=util[_0x955e[7]](_0x955e[11],_0x9ad8x8[_0x955e[6]],_0x9ad8x8[_0x955e[6]]);break;default:_0x9ad8x9=util[_0x955e[7]](_0x955e[13],_0x9ad8x8[_0x955e[4]],_0x9ad8x8[_0x955e[6]])}}else {_0x9ad8x9=_0x9ad8x8[_0x955e[6]]};_0x9ad8x5[_0x955e[16]](util[_0x955e[7]](_0x955e[14],_0x9ad8x9,_0x9ad8x8[_0x955e[15]]));if(_0x9ad8x8[_0x955e[17]]){_0x9ad8x6[_0x955e[16]](_0x9ad8x8[_0x955e[6]])};if(_0x9ad8x8[_0x955e[18]]){_0x9ad8x7[_0x955e[16]](util[_0x955e[7]](_0x955e[19],_0x9ad8x8[_0x955e[6]],_0x9ad8x8[_0x955e[18]]))}});var _0x9ad8xa=_0x9ad8x3[_0x955e[21]]?getConditions(JSON[_0x955e[23]](_0x9ad8x3[_0x955e[21]])[_0x955e[22]]):_0x955e[24];var _0x9ad8xb=_0x955e[25];_0x9ad8xb+=_0x955e[26]+_0x9ad8x5[_0x955e[28]](_0x955e[27]);_0x9ad8xb+=_0x955e[29]+_0x9ad8x3[_0x955e[30]];_0x9ad8xb+=_0x9ad8xa!==_0x955e[24]?_0x955e[31]+_0x9ad8xa:_0x955e[3];var _0x9ad8xc,_0x9ad8xd;var _0x9ad8xe=[];if(_0x9ad8x4){_[_0x955e[42]](_0x9ad8x4,function(_0x9ad8xf,_0x9ad8x10){switch(_0x9ad8x10){case _0x955e[34]:_0x9ad8xe[_0x955e[16]](_0x955e[32]+_0x9ad8xf+_0x955e[33]);break;case _0x955e[36]:_0x9ad8xe[_0x955e[16]](_0x955e[35]+_0x9ad8xf+_0x955e[33]);break;case _0x955e[37]:;case _0x955e[38]:break;default:var _0x9ad8x11=_[_0x955e[39]](_0x9ad8x3.Fields,{alias:_0x9ad8x10});if(_0x9ad8x11){_0x9ad8xe[_0x955e[16]](_0x9ad8x11[_0x955e[6]]+_0x955e[40]+_0x9ad8xf+_0x955e[41])}else {_0x9ad8xe[_0x955e[16]](_0x9ad8x10+_0x955e[40]+_0x9ad8xf+_0x955e[41])}}})};if(_0x9ad8xe[_0x955e[43]]){_0x9ad8xb+=((_0x9ad8xa!==_0x955e[24])?_0x955e[44]:_0x955e[31])+_0x9ad8xe[_0x955e[28]](_0x955e[44])};_0x9ad8xb+=_0x9ad8x6[_0x955e[43]]?_0x955e[45]+_0x9ad8x6[_0x955e[28]](_0x955e[27]):_0x955e[3];_0x9ad8xb+=_0x9ad8x7[_0x955e[43]]?_0x955e[46]+_0x9ad8x7[_0x955e[28]](_0x955e[27]):_0x955e[3];return _0x9ad8xb};function getConditions(_0x9ad8x13){if(!_0x9ad8x13){return _0x955e[24]};for(var _0x9ad8x14=_0x955e[47],_0x9ad8x15=0;_0x9ad8x15<_0x9ad8x13[_0x955e[48]][_0x955e[43]];_0x9ad8x15++){_0x9ad8x15>0&&(_0x9ad8x14+=_0x955e[26]+_0x9ad8x13[_0x955e[49]]+_0x955e[26]);_0x9ad8x14+=_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[22]]?getConditions(_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[22]]):_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[6]]+_0x955e[26]+_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[50]]+_0x955e[51]+(_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[50]]===_0x955e[52]?_0x955e[53]+_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[54]]+_0x955e[53]:_0x9ad8x13[_0x955e[48]][_0x9ad8x15][_0x955e[54]])+_0x955e[33]};return _0x9ad8x14+_0x955e[55]} \ No newline at end of file +var _ = require('lodash'); +var util = require('util'); + +exports.buildReport = function(report, query) { + var fields = [], + groupBy = [], + orderBy = []; + _.forEach(report.Fields, function(elem) { + var field = ''; + if (elem.function) { + switch (elem.function) { + case 'COUNT DISTINCT': + field = util.format('COUNT(DISTINCT %s)', elem.field); + break; + case 'GROUP_CONCAT ASC': + field = util.format('GROUP_CONCAT(%s ORDER BY %s ASC)', elem.field, elem.field); + break; + case 'GROUP_CONCAT DESC': + field = util.format('GROUP_CONCAT(%s ORDER BY %s DESC)', elem.field, elem.field); + break; + default: + field = util.format('%s(%s)', elem.function, elem.field); + } + } else { + field = elem.field; + } + fields.push(util.format('%s AS \'%s\'', field, elem.alias)); + if (elem.groupBy) { + groupBy.push(elem.field); + } + if (elem.orderBy) { + orderBy.push(util.format('%s %s', elem.field, elem.orderBy)); + } + }); + + var conditions = report.conditions ? getConditions(JSON.parse(report.conditions).group) : '()'; + var resultQuery = 'SELECT'; + // query += fields.length ? ' ' + fields.join(',') : ' *';//right if you want to select all fields also + resultQuery += ' ' + fields.join(','); //generate a wrong query if there isn' t any field + resultQuery += ' FROM ' + report.table; + resultQuery += conditions !== '()' ? ' WHERE ' + conditions : ''; + var startDate, endDate; + var otherConditions = []; + if (query) { + _.forOwn(query, function(value, key) { + switch (key) { + case 'startDate': + otherConditions.push('createdAt >= \'' + value + '\''); + break; + case 'endDate': + otherConditions.push('createdAt <= \'' + value + '\''); + break; + case 'offset': + case 'limit': + break; + default: + var column = _.find(report.Fields, { + alias: key + }); + if (column) { + otherConditions.push(column.field + ' LIKE \'%' + value + '%\''); + } else { + otherConditions.push(key + ' LIKE \'%' + value + '%\''); + } + } + }); + } + if (otherConditions.length) { + resultQuery += ((conditions !== '()') ? ' AND ' : ' WHERE ') + otherConditions.join(' AND '); + } + resultQuery += groupBy.length ? ' GROUP BY ' + groupBy.join(',') : ''; + resultQuery += orderBy.length ? ' ORDER BY ' + orderBy.join(',') : ''; + + return resultQuery; +} + +function getConditions(group) { + + if (!group) return "()"; + for (var str = "(", i = 0; i < group.rules.length; i++) { + i > 0 && (str += " " + group.operator + " "); + str += group.rules[i].group ? + getConditions(group.rules[i].group) : + group.rules[i].field + " " + group.rules[i].condition + " '" + (group.rules[i].condition === 'LIKE' ? "%" + group.rules[i].value + "%" : group.rules[i].value) + "'"; + } + return str + ')'; +} diff --git a/server/utils/report_extraction.js b/server/utils/report_extraction.js index ba472f7..0d973b7 100644 --- a/server/utils/report_extraction.js +++ b/server/utils/report_extraction.js @@ -1 +1,197 @@ -var _0xf0aa=["\x74\x6F\x2D\x63\x73\x76","\x70\x64\x66\x6D\x61\x6B\x65","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x73","\x6D\x6F\x6D\x65\x6E\x74","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x70\x61\x74\x68","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x66\x6F\x6E\x74\x73","\x52\x6F\x62\x6F\x74\x6F\x2D\x52\x65\x67\x75\x6C\x61\x72\x2E\x74\x74\x66","\x6A\x6F\x69\x6E","\x52\x6F\x62\x6F\x74\x6F\x2D\x4D\x65\x64\x69\x75\x6D\x2E\x74\x74\x66","\x52\x6F\x62\x6F\x74\x6F\x2D\x49\x74\x61\x6C\x69\x63\x2E\x74\x74\x66","\x65\x78\x74\x72\x61\x63\x74\x50\x44\x46","\x70\x64\x66","\x65\x78\x74\x72\x61\x63\x74\x43\x53\x56","\x63\x73\x76","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x62\x75\x69\x6C\x64\x52\x65\x70\x6F\x72\x74","\x6C\x6F\x67","\x71\x75\x65\x72\x79\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x65\x6D\x70\x74\x79","\x71\x75\x65\x72\x79\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x74\x68\x65\x6E","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x71\x75\x65\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F","\x6E\x61\x6D\x65","\x5F","\x2E\x70\x64\x66","\x61\x6C\x69\x61\x73","\x74\x61\x62\x6C\x65\x48\x65\x61\x64\x65\x72","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x66\x6F\x72\x4F\x77\x6E","\x68\x65\x61\x64\x65\x72","\x73\x74\x61\x72\x74\x44\x61\x74\x65","","\x20\x2D\x20","\x65\x6E\x64\x44\x61\x74\x65","\x74\x61\x62\x6C\x65\x45\x78\x61\x6D\x70\x6C\x65","\x62\x6C\x61\x63\x6B","\x63\x72\x65\x61\x74\x65\x50\x64\x66\x4B\x69\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x72\x65\x70\x6F\x72\x74\x73","\x63\x72\x65\x61\x74\x65\x57\x72\x69\x74\x65\x53\x74\x72\x65\x61\x6D","\x65\x72\x72\x6F\x72","\x70\x64\x66\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x66\x69\x6E\x69\x73\x68","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x70\x69\x70\x65","\x65\x6E\x64","\x70\x64\x66\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x2E\x63\x73\x76","\x63\x73\x76\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x63\x73\x76\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74\x20\x77\x69\x74\x68\x20\x65\x72\x72\x6F\x72\x20\x3A\x20","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65"];var csv=require(_0xf0aa[0]);var pdfMake=require(_0xf0aa[1]);var _=require(_0xf0aa[2]);var util=require(_0xf0aa[3]);var ExtractedReport=require(_0xf0aa[5])[_0xf0aa[4]];var sequelize=require(_0xf0aa[5])[_0xf0aa[6]];var fs=require(_0xf0aa[7]);var moment=require(_0xf0aa[8]);var sr=require(_0xf0aa[9]);var path=require(_0xf0aa[10]);var config=require(_0xf0aa[11]);var reportBuildUtils=require(_0xf0aa[12]);var fonts={Roboto:{normal:path[_0xf0aa[15]](config[_0xf0aa[13]],_0xf0aa[14]),bold:path[_0xf0aa[15]](config[_0xf0aa[13]],_0xf0aa[16]),italics:path[_0xf0aa[15]](config[_0xf0aa[13]],_0xf0aa[17]),bolditalics:path[_0xf0aa[15]](config[_0xf0aa[13]],_0xf0aa[17])}};exports[_0xf0aa[18]]=function(_0x8b30xe,_0x8b30xf,_0x8b30x10){general(_0x8b30xe,_0x8b30xf,_0x8b30x10,_0xf0aa[19])};exports[_0xf0aa[20]]=function(_0x8b30xe,_0x8b30xf,_0x8b30x10){general(_0x8b30xe,_0x8b30xf,_0x8b30x10,_0xf0aa[21])};function general(_0x8b30xe,_0x8b30xf,_0x8b30x10,_0x8b30x12){extract(_0x8b30xe,_0x8b30xf,_0x8b30x10,_0x8b30x12)}function extract(_0x8b30xe,_0x8b30x14,_0x8b30x10,_0x8b30x12){var _0x8b30xf=reportBuildUtils[_0xf0aa[23]](_0x8b30xe[_0xf0aa[22]],_0x8b30x14);sequelize[_0xf0aa[33]](_0x8b30xf,{type:sequelize[_0xf0aa[32]][_0xf0aa[31]]})[_0xf0aa[30]](function(_0x8b30x16){if(_0x8b30x16){if(_0x8b30x16[_0xf0aa[27]]){switch(_0x8b30x12){case _0xf0aa[19]:createPdf(_0x8b30x16,_0x8b30xe,_0x8b30x14,_0x8b30x10);break;case _0xf0aa[21]:createCsv(_0x8b30x16,_0x8b30xe,_0x8b30x14,_0x8b30x10);break;default:createCsv(_0x8b30x16,_0x8b30xe,_0x8b30x14,_0x8b30x10)}}else {updateExtracted(_0x8b30x10,null,_0xf0aa[28])}}else {updateExtracted(_0x8b30x10,null,_0xf0aa[29])}})[_0xf0aa[26]](function(_0x8b30x15){console[_0xf0aa[24]](_0x8b30x15);updateExtracted(_0x8b30x10,null,_0xf0aa[25])})}function createPdf(_0x8b30x16,_0x8b30xe,_0x8b30x14,_0x8b30x18){var _0x8b30x19=sr({length:20,prefix:_0xf0aa[34]+_0x8b30xe[_0xf0aa[35]]+_0xf0aa[36],suffix:_0xf0aa[37]});var _0x8b30x1a=[];_[_0xf0aa[41]](_0x8b30xe.Fields,function(_0x8b30x1b){_0x8b30x1a[_0xf0aa[40]]({text:_0x8b30x1b[_0xf0aa[38]],style:_0xf0aa[39]})});var _0x8b30x1c=[_0x8b30x1a];_[_0xf0aa[41]](_0x8b30x16,function(_0x8b30x1b){var _0x8b30x1d=[];_[_0xf0aa[44]](_0x8b30x1b,function(_0x8b30x1e,_0x8b30x1f){_0x8b30x1d[_0xf0aa[40]](_0x8b30x1e instanceof Date?moment(_0x8b30x1e)[_0xf0aa[43]](_0xf0aa[42]).toString():_0x8b30x1e)});_0x8b30x1c[_0xf0aa[40]](_0x8b30x1d)});var _0x8b30x20={content:[{text:_0x8b30xe[_0xf0aa[35]],style:_0xf0aa[45]},_0x8b30x14[_0xf0aa[46]]?moment(_0x8b30x14[_0xf0aa[46]])[_0xf0aa[43]](_0xf0aa[42]).toString():_0xf0aa[47]+_0xf0aa[48]+_0x8b30x14[_0xf0aa[49]]?moment(_0x8b30x14[_0xf0aa[49]])[_0xf0aa[43]](_0xf0aa[42]).toString():_0xf0aa[47],{style:_0xf0aa[50],table:{headerRows:1,body:_0x8b30x1c}}],styles:{header:{fontSize:18,bold:true,margin:[0,0,0,10]},subheader:{fontSize:16,bold:true,margin:[0,10,0,5]},tableExample:{margin:[0,5,0,15]},tableHeader:{bold:true,fontSize:13,color:_0xf0aa[51]}}};var _0x8b30x21= new pdfMake(fonts);var _0x8b30x22=_0x8b30x21[_0xf0aa[52]](_0x8b30x20);if(_0x8b30x22){var _0x8b30x23=fs[_0xf0aa[54]](config[_0xf0aa[53]]+_0x8b30x19);_0x8b30x23[_0xf0aa[57]](_0xf0aa[55],function(){updateExtracted(_0x8b30x18,null,_0xf0aa[56])});_0x8b30x23[_0xf0aa[57]](_0xf0aa[58],function(){updateExtracted(_0x8b30x18,_0x8b30x19,_0xf0aa[59])});_0x8b30x22[_0xf0aa[60]](_0x8b30x23);_0x8b30x22[_0xf0aa[61]]()}else {updateExtracted(_0x8b30x18,null,_0xf0aa[62])}}function createCsv(_0x8b30x16,_0x8b30xe,_0x8b30x14,_0x8b30x18){var _0x8b30x19=sr({length:20,prefix:_0xf0aa[34]+_0x8b30xe[_0xf0aa[35]]+_0xf0aa[36],suffix:_0xf0aa[63]});var _0x8b30x25=csv(_0x8b30x16);if(_0x8b30x25){fs[_0xf0aa[65]](config[_0xf0aa[53]]+_0x8b30x19,_0x8b30x25,function(_0x8b30x15){if(_0x8b30x15){console[_0xf0aa[24]](_0x8b30x15);updateExtracted(_0x8b30x18,null,_0xf0aa[64])}else {updateExtracted(_0x8b30x18,_0x8b30x19,_0xf0aa[59])}})}else {updateExtracted(_0x8b30x18,null,_0xf0aa[66])}}function updateExtracted(_0x8b30x18,_0x8b30x19,_0x8b30x27){ExtractedReport[_0xf0aa[69]]({status:_0x8b30x27,savename:_0x8b30x19},{where:{id:_0x8b30x18}})[_0xf0aa[30]](function(){console[_0xf0aa[24]](_0xf0aa[68])})[_0xf0aa[26]](function(_0x8b30x15){console[_0xf0aa[24]](_0xf0aa[67]+_0x8b30x15)})} \ No newline at end of file +var csv = require('to-csv'); +var pdfMake = require('pdfmake'); +var _ = require('lodash'); +var util = require('util'); +var ExtractedReport = require('../models').ExtractedReport; +var sequelize = require('../models').sequelize; +var fs = require('fs'); +var moment = require('moment'); +var sr = require('simple-random'); +var path = require('path'); +var config = require('../config/environment'); +var reportBuildUtils = require('./report_build'); +var fonts = { + Roboto: { + normal: path.join(config.fonts, 'Roboto-Regular.ttf'), + bold: path.join(config.fonts, 'Roboto-Medium.ttf'), + italics: path.join(config.fonts, 'Roboto-Italic.ttf'), + bolditalics: path.join(config.fonts, 'Roboto-Italic.ttf') + } +}; + +exports.extractPDF = function(report, query, extractedId) { + // console.log('--loaded external extractPDF function, calling general...'); + general(report, query, extractedId, 'pdf'); +} + +exports.extractCSV = function(report, query, extractedId) { + // console.log('--loaded external extractCSV function, calling general...'); + general(report, query, extractedId, 'csv'); +} + +function general(report, query, extractedId, type) { + // console.log('--general function, calling extract function...'); + extract(report, query, extractedId, type); +} + +function extract(report, dataQuery, extractedId, type) { + // console.log('--extract function, building query...'); + var query = reportBuildUtils.buildReport(report.dataValues, dataQuery); + // console.log('--the query is :', query); + // console.log('--extracting the report...'); + sequelize.query(query, { + type: sequelize.QueryTypes.SELECT + }) + .then(function(res) { + if (res) { + if (res.length) { + // console.log('--report extracted, creating output as: ' + type); + switch (type) { + case 'pdf': + createPdf(res, report, dataQuery, extractedId); + break; + case 'csv': + createCsv(res, report, dataQuery, extractedId); + break; + default: + createCsv(res, report, dataQuery, extractedId); + } + } else { + updateExtracted(extractedId, null, 'empty'); + } + } else { + // console.log('--error executing the report query'); + updateExtracted(extractedId, null, 'query extraction error'); + + } + }) + .catch(function(err) { + console.log(err); + updateExtracted(extractedId, null, 'query error'); + }); +} + +function createPdf(res, report, dataQuery, id) { + // console.log('--pdf function, creating pdf output...'); + var filename = sr({ + length: 20, + prefix: "report_" + report.name + '_', + suffix: ".pdf" + }); + var tableHeader = []; + _.forEach(report.Fields, function(elem) { + tableHeader.push({ + text: elem.alias, + style: 'tableHeader' + }); + }); + var tableBody = [tableHeader]; + _.forEach(res, function(elem) { + var row = []; + _.forOwn(elem, function(value, key) { + row.push(value instanceof Date ? moment(value).format("MM-DD-YYYY HH:mm").toString() : value); + }); + tableBody.push(row); + }); + var pdfContent = { + content: [{ + text: report.name, + style: 'header' + }, + dataQuery.startDate ? moment(dataQuery.startDate).format("MM-DD-YYYY HH:mm").toString() : '' + ' - ' + dataQuery.endDate ? moment(dataQuery.endDate).format("MM-DD-YYYY HH:mm").toString() : + '', { + style: 'tableExample', + table: { + headerRows: 1, + // keepWithHeaderRows: 1, + // dontBreakRows: true, + body: tableBody + } + } + ], + styles: { + header: { + fontSize: 18, + bold: true, + margin: [0, 0, 0, 10] + }, + subheader: { + fontSize: 16, + bold: true, + margin: [0, 10, 0, 5] + }, + tableExample: { + margin: [0, 5, 0, 15] + }, + tableHeader: { + bold: true, + fontSize: 13, + color: 'black' + } + } + }; + + var printer = new pdfMake(fonts); + var pdfDoc = printer.createPdfKitDocument(pdfContent); + if (pdfDoc) { + // pdfDoc is a stream so you can pipe it to the file system + var writeStream = fs.createWriteStream(config.reports + filename); + writeStream.on('error', function() { + // console.log('--pdf write error'); + updateExtracted(id, null, 'pdf write error') + }); + writeStream.on('finish', function() { + // console.log('--pdf write finished'); + updateExtracted(id, filename, 'completed') + }); + pdfDoc.pipe(writeStream); + pdfDoc.end(); + } else { + // console.log('--pdf creation error'); + updateExtracted(id, null, 'pdf creation error') + } +} + +function createCsv(res, report, dataQuery, id) { + // console.log(res); + // console.log('--csv function, creating pdf output...'); + var filename = sr({ + length: 20, + prefix: "report_" + report.name + '_', + suffix: ".csv" + }); + var csv_report = csv(res); + if (csv_report) { + fs.writeFile(config.reports + filename, csv_report, function(err) { + if (err) { + // console.log('--csv write error'); + console.log(err); + updateExtracted(id, null, 'csv write error') + } else { + // console.log('--csv write completed'); + updateExtracted(id, filename, 'completed') + } + }); + } else { + // console.log('--csv creation error'); + updateExtracted(id, null, 'csv creation error') + } +} + +function updateExtracted(id, filename, status) { + // console.log('--updating the extracted report db row..'); + ExtractedReport.update({ + status: status, + savename: filename + }, { + where: { + id: id + } + }) + .then(function() { + console.log('--Finished extracting report'); + }) + .catch(function(err) { + console.log('--Finished extracting report with error : ' + err); + }); +} diff --git a/server/utils/voice_extension.js b/server/utils/voice_extension.js index 531a9b7..210cfd3 100644 --- a/server/utils/voice_extension.js +++ b/server/utils/voice_extension.js @@ -1 +1,214 @@ -var _0xfa62=["\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x41\x70\x70\x73","\x72\x6F\x75\x74\x65\x55\x70\x64\x61\x74\x65","\x69\x64","\x62\x6F\x64\x79","\x74\x68\x65\x6E","\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x70\x61\x72\x61\x6D\x73","\x64\x65\x73\x74\x72\x6F\x79","\x75\x70\x64\x61\x74\x65","\x61\x6C\x6C","\x65\x78\x74\x65\x6E","\x74\x79\x70\x65","\x63\x6F\x6E\x74\x65\x78\x74","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x6D\x65\x72\x67\x65","\x70\x75\x73\x68","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x43\x44\x52\x28\x74\x61\x67\x29\x3D\x25\x73","\x74\x61\x67","\x2D\x2D","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x66\x69\x6C\x74\x65\x72","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x6D\x61\x70","\x2A\x2C\x2A\x2C\x2A\x2C\x2A","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","\x47\x6F\x74\x6F\x49\x66\x54\x69\x6D\x65","\x25\x73\x3F\x25\x73\x2C\x24\x7B\x45\x58\x54\x45\x4E\x7D\x2C\x25\x73\x3A\x25\x73\x2C\x24\x7B\x45\x58\x54\x45\x4E\x7D\x2C\x25\x73","\x66\x6F\x72\x45\x61\x63\x68","\x61\x70\x70","\x44\x69\x61\x6C","\x61\x70\x70\x64\x61\x74\x61","\x43\x41\x4C\x4C\x45\x52\x49\x44\x28\x61\x6C\x6C\x29\x3D\x25\x73","\x4E\x6F\x4F\x50","\x53\x6B\x69\x70\x70\x65\x64\x20\x43\x61\x6C\x6C\x65\x72\x49\x44\x20\x53\x65\x74","\x72\x65\x63\x6F\x72\x64","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x77\x61\x76\x2C\x61\x62","\x53\x6B\x69\x70\x70\x65\x64\x20\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x51\x75\x65\x75\x65","\x41\x6E\x73\x77\x65\x72","","\x53\x6B\x69\x70\x70\x65\x64\x20\x41\x6E\x73\x77\x65\x72","\x53\x49\x50\x2F\x25\x73\x2F\x25\x73\x24\x7B\x45\x58\x54\x45\x4E\x3A\x25\x64\x7D","\x2C","\x6A\x6F\x69\x6E","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x53\x6B\x69\x70\x70\x65\x64\x20\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x20\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x20\x45\x6E\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73"];var _=require(_0xfa62[0]);var util=require(_0xfa62[1]);var Interval=require(_0xfa62[3])[_0xfa62[2]];var sequelize=require(_0xfa62[3])[_0xfa62[4]];var VoiceExtension=require(_0xfa62[3])[_0xfa62[5]];exports[_0xfa62[6]]=createApplications;exports[_0xfa62[7]]=function(_0x3f90x6,_0x3f90x7){var sequelize=require(_0xfa62[3])[_0xfa62[4]];var VoiceExtension=require(_0xfa62[3])[_0xfa62[5]];if(_0x3f90x6[_0xfa62[9]][_0xfa62[8]]){delete _0x3f90x6[_0xfa62[9]][_0xfa62[8]]};return VoiceExtension[_0xfa62[16]](_0x3f90x6[_0xfa62[9]],{where:{id:_0x3f90x6[_0xfa62[14]][_0xfa62[8]]},transaction:_0x3f90x7})[_0xfa62[10]](function(_0x3f90x8){if(_0x3f90x6[_0xfa62[9]][_0xfa62[11]]){_0x3f90x6[_0xfa62[9]][_0xfa62[8]]=_0x3f90x6[_0xfa62[14]][_0xfa62[8]];return VoiceExtension[_0xfa62[15]]({where:{VoiceExtensionId:_0x3f90x6[_0xfa62[14]][_0xfa62[8]]},transaction:_0x3f90x7})}})[_0xfa62[10]](function(){if(_0x3f90x6[_0xfa62[9]][_0xfa62[11]]&&Array[_0xfa62[12]](_0x3f90x6[_0xfa62[9]].Applications)&&_0x3f90x6[_0xfa62[9]][_0xfa62[11]][_0xfa62[13]]){return _0x3f90x6[_0xfa62[9]]}})[_0xfa62[10]](createApplications(_0x3f90x6[_0xfa62[9]].Applications,_0x3f90x7))};function createApplications(_0x3f90xa,_0x3f90x7){var Interval=require(_0xfa62[3])[_0xfa62[2]];var VoiceExtension=require(_0xfa62[3])[_0xfa62[5]];return function(_0x3f90x8){if(_0x3f90x8){return Interval[_0xfa62[61]]()[_0xfa62[10]](function(_0x3f90xb){var _0x3f90xc=2;var _0x3f90xd={exten:_0x3f90x8[_0xfa62[18]],type:_0x3f90x8[_0xfa62[19]],context:_0x3f90x8[_0xfa62[20]],VoiceExtensionId:_0x3f90x8[_0xfa62[8]]};var _0x3f90xe=[];var _0x3f90xf=6;var _0x3f90x10=[];_0x3f90x10[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[21],appdata:util[_0xfa62[23]](_0xfa62[22],_0x3f90x8[_0xfa62[19]]),priority:_0x3f90xc},_0x3f90xd));_0x3f90xc++;if(_0x3f90x8[_0xfa62[19]]===_0xfa62[26]){_0x3f90x10[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[21],appdata:util[_0xfa62[23]](_0xfa62[27],_0x3f90x8[_0xfa62[28]]||_0xfa62[29]),priority:_0x3f90xc},_0x3f90xd));_0x3f90xc++};_0x3f90xe[_0xfa62[25]](VoiceExtension[_0xfa62[30]](_0x3f90x10,{transaction:_0x3f90x7}));_0x3f90xa[_0xfa62[40]](function(_0x3f90x11){var _0x3f90x12=[];var _0x3f90x13=[];if(_0x3f90x11[_0xfa62[31]]){var _0x3f90x14=_[_0xfa62[32]](_0x3f90xb,{IntervalId:_0x3f90x11[_0xfa62[31]]});_0x3f90x12=_0x3f90x14[_0xfa62[13]]?_[_0xfa62[34]](_0x3f90x14,_0xfa62[33]):[_0xfa62[35]];var _0x3f90x15=_[_0xfa62[36]](_0x3f90xb,{id:_0x3f90x11[_0xfa62[31]]});_0x3f90x11[_0xfa62[33]]=_0x3f90x15?_0x3f90x15[_0xfa62[37]]:_0xfa62[35]}else {_0x3f90x12=[_0x3f90x11[_0xfa62[33]]]};var _0x3f90x16=_0x3f90x12[_0xfa62[13]];_0x3f90x12[_0xfa62[40]](function(_0x3f90x17,_0x3f90x18){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[38],appdata:util[_0xfa62[23]](_0xfa62[39],_0x3f90x17,_0x3f90x8[_0xfa62[20]],_0x3f90xc+(_0x3f90x16-_0x3f90x18),_0x3f90x8[_0xfa62[20]],((_0x3f90x18+1)<_0x3f90x16)?_0x3f90xc+1:_0x3f90xc+_0x3f90xf),priority:_0x3f90xc},_0x3f90xd));_0x3f90xc++});if(_0x3f90x11[_0xfa62[41]]===_0xfa62[42]&&_0x3f90x11[_0xfa62[43]][1]&&_0x3f90x8[_0xfa62[19]]===_0xfa62[26]){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[21],appdata:util[_0xfa62[23]](_0xfa62[44],_0x3f90x11[_0xfa62[43]][1]),priority:_0x3f90xc},_0x3f90xd))}else {_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[45],appdata:_0xfa62[46],priority:_0x3f90xc},_0x3f90xd))};_0x3f90xc++;if(_0x3f90x11[_0xfa62[41]]===_0xfa62[42]&&_0x3f90x8[_0xfa62[47]]&&_0x3f90x8[_0xfa62[19]]===_0xfa62[26]){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[48],appdata:_0xfa62[49],priority:_0x3f90xc},_0x3f90xd))}else {_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[45],appdata:_0xfa62[50],priority:_0x3f90xc},_0x3f90xd))};_0x3f90xc++;if(_0x3f90x11[_0xfa62[41]]===_0xfa62[51]){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[52],appdata:_0xfa62[53],priority:_0x3f90xc},_0x3f90xd))}else {_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[45],appdata:_0xfa62[54],priority:_0x3f90xc},_0x3f90xd))};_0x3f90xc++;if(_0x3f90x11[_0xfa62[41]]===_0xfa62[42]&&_0x3f90x8[_0xfa62[19]]===_0xfa62[26]){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0x3f90x11[_0xfa62[41]],appdata:util[_0xfa62[23]](_0xfa62[55],_0x3f90x11[_0xfa62[43]][0],_0x3f90x11[_0xfa62[43]][3]||_0xfa62[53],_0x3f90x11[_0xfa62[43]][2]||0),priority:_0x3f90xc,IntervalId:_0x3f90x11[_0xfa62[31]]||null,interval:_0x3f90x11[_0xfa62[33]]||_0xfa62[35],isApp:true,callerID:_0x3f90x11[_0xfa62[43]][1]||null},_0x3f90xd))}else {_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0x3f90x11[_0xfa62[41]],appdata:_0x3f90x11[_0xfa62[43]][_0xfa62[57]](_0xfa62[56]),priority:_0x3f90xc,IntervalId:_0x3f90x11[_0xfa62[31]],interval:_0x3f90x11[_0xfa62[33]]||_0xfa62[35],isApp:true},_0x3f90xd))};_0x3f90xc++;if(_0x3f90x11[_0xfa62[41]]===_0xfa62[42]&&_0x3f90x8[_0xfa62[47]]&&_0x3f90x8[_0xfa62[19]]===_0xfa62[26]){_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[58],appdata:_0xfa62[53],priority:_0x3f90xc},_0x3f90xd))}else {_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[45],appdata:_0xfa62[59],priority:_0x3f90xc},_0x3f90xd))};_0x3f90xc++;_0x3f90x13[_0xfa62[25]](_[_0xfa62[24]]({app:_0xfa62[45],appdata:_0x3f90x11[_0xfa62[41]]+_0xfa62[60],priority:_0x3f90xc},_0x3f90xd));_0x3f90xc++;_0x3f90xe[_0xfa62[25]](VoiceExtension[_0xfa62[30]](_0x3f90x13,{transaction:_0x3f90x7}))});return _0x3f90xe})[_0xfa62[17]]()}}}function handleError(_0x3f90x1a,_0x3f90x1b){return _0x3f90x1a[_0xfa62[63]](500)[_0xfa62[62]](_0x3f90x1b)} \ No newline at end of file +var _ = require('lodash'); +var util = require('util'); +var Interval = require('../models').Interval; +var sequelize = require('../models').sequelize; +var VoiceExtension = require('../models').VoiceExtension; + +exports.createApps = createApplications; + +exports.routeUpdate = function(req, t) { + var sequelize = require('../models').sequelize; + var VoiceExtension = require('../models').VoiceExtension; + if (req.body.id) { + delete req.body.id; + } + return VoiceExtension + .update(req.body, { + where: { + id: req.params.id + }, + transaction: t + }) + .then(function(route) { + if (req.body.Applications) { + req.body.id = req.params.id; + return VoiceExtension + .destroy({ + where: { + VoiceExtensionId: req.params.id + }, + transaction: t + }); + } + }) + .then(function() { + if (req.body.Applications && Array.isArray(req.body.Applications) && req.body.Applications.length) { + return req.body; + } + }) + .then(createApplications(req.body.Applications, t)); +} + + +function createApplications(applications, t) { + var Interval = require('../models').Interval; + var VoiceExtension = require('../models').VoiceExtension; + return function(route) { + if (route) { + return Interval + .findAll() //find all existing intervals + .then(function(intervals) { + var priority = 2; + var routeDefault = { + exten: route.exten, + type: route.type, + context: route.context, + VoiceExtensionId: route.id + }; + var bulkApps = []; + var applicationLength = 6; //update in case of adding other rows in the extension + var firstRows = []; + firstRows.push(_.merge({ + app: 'Set', + appdata: util.format('CDR(type)=%s', route.type), + priority: priority + }, + routeDefault)); + priority++; + if (route.type === 'outbound') { + firstRows.push(_.merge({ + app: 'Set', + appdata: util.format('CDR(tag)=%s', route.tag || '--'), + priority: priority + }, + routeDefault)); + priority++; + } + bulkApps.push(VoiceExtension.bulkCreate(firstRows, { + transaction: t + })); + applications.forEach(function(application) { + var appIntervals = []; + var extension = []; + if (application.IntervalId) { //if the interval for the app is chosen by a list we search for the subintervals + var foundIntervals = _.filter(intervals, { + IntervalId: application.IntervalId + }); + appIntervals = foundIntervals.length ? _.map(foundIntervals, 'interval') : ['*,*,*,*']; //if the interval list has no subintervals the interval is always + var parentInterval = _.find(intervals, { + id: application.IntervalId + }); + application.interval = parentInterval ? parentInterval.name : '*,*,*,*'; + } else { //otherwise i will have the interval directly from the app, i still use an array to keep the creation logic the same + appIntervals = [application.interval]; + } + var intLength = appIntervals.length; + appIntervals.forEach(function(elem, index) { + extension.push(_.merge({ + app: 'GotoIfTime', + appdata: util.format('%s?%s,${EXTEN},%s:%s,${EXTEN},%s', elem, route.context, priority + (intLength - index), route.context, ((index + 1) < intLength) ? priority + + 1 : priority + + applicationLength), + priority: priority + }, + routeDefault)); + priority++; + }); + if (application.app === 'Dial' && application.appdata[1] && route.type === 'outbound') { + extension.push(_.merge({ + app: 'Set', + appdata: util.format('CALLERID(all)=%s', application.appdata[1]), + priority: priority + }, + routeDefault)); + } else { + extension.push(_.merge({ + app: 'NoOP', + appdata: 'Skipped CallerID Set', + priority: priority + }, + routeDefault)); + } + priority++; + if (application.app === 'Dial' && route.record && route.type === 'outbound') { + extension.push(_.merge({ + app: 'MixMonitor', + appdata: '${UNIQUEID}.wav,ab', + priority: priority + }, + routeDefault)); + } else { + extension.push(_.merge({ + app: 'NoOP', + appdata: 'Skipped MixMonitor', + priority: priority + }, + routeDefault)); + } + priority++; + if (application.app === 'Queue') { + extension.push(_.merge({ + app: 'Answer', + appdata: '', + priority: priority + }, + routeDefault)); + } else { + extension.push(_.merge({ + app: 'NoOP', + appdata: 'Skipped Answer', + priority: priority + }, + routeDefault)); + } + priority++; + if (application.app === 'Dial' && route.type === 'outbound') { + extension.push(_.merge({ + app: application.app, + appdata: util.format('SIP/%s/%s${EXTEN:%d}', application.appdata[0], application.appdata[3] || '', application.appdata[2] || 0), + priority: priority, + IntervalId: application.IntervalId || null, + interval: application.interval || '*,*,*,*', + isApp: true, + callerID: application.appdata[1] || null + }, + routeDefault)); + } else { + extension.push(_.merge({ + app: application.app, + appdata: application.appdata.join(','), + priority: priority, + IntervalId: application.IntervalId, + interval: application.interval || '*,*,*,*', + isApp: true + }, + routeDefault)); + } + priority++; + if (application.app === 'Dial' && route.record && route.type === 'outbound') { + extension.push(_.merge({ + app: 'StopMixMonitor', + appdata: '', + priority: priority + }, + routeDefault)); + } else { + extension.push(_.merge({ + app: 'NoOP', + appdata: 'Skipped StopMixMonitor', + priority: priority + }, + routeDefault)); + } + priority++; + extension.push(_.merge({ + app: 'NoOP', + appdata: application.app + ' Application End', + priority: priority + }, + routeDefault)); + priority++; + bulkApps.push(VoiceExtension.bulkCreate(extension, { + transaction: t + })); + }); + return bulkApps; + }) + .all(); + } + } +} + +function handleError(res, err) { + return res.status(500).send(err); +} -- 1.7.1