From: Giuseppe Careri Date: Wed, 21 Jun 2017 17:12:11 +0000 (+0200) Subject: Built motion from commit 7e022ab.|2.0.17 X-Git-Tag: 2.0.17 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=3ee6aa8355bc287e5ce5fe234c1df428905d7246;p=motion2.git Built motion from commit 7e022ab.|2.0.17 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9dc8e33..8ba40f0 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "motion", "version": "2.0.16", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-06-21T12:16:13.601Z", "url": "http://apidocjs.com", "version": "0.17.6" } }); +define({ "name": "motion", "version": "2.0.17", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-06-21T17:08:39.921Z", "url": "http://apidocjs.com", "version": "0.17.6" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b6f2dca..dca92df 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "motion", "version": "2.0.16", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-06-21T12:16:13.601Z", "url": "http://apidocjs.com", "version": "0.17.6" } } +{ "name": "motion", "version": "2.0.17", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2017-06-21T17:08:39.921Z", "url": "http://apidocjs.com", "version": "0.17.6" } } diff --git a/package.json b/package.json index 11f2072..e2da6f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.0.16", + "version": "2.0.17", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/public/favicon.ico b/public/favicon.ico index aebc0dd..43a12a5 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index b7295af..dbd73e4 100644 --- a/public/index.html +++ b/public/index.html @@ -12,7 +12,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/public/scripts/app.9a438daf.js b/public/scripts/app.9a438daf.js new file mode 100644 index 0000000..b3caab3 --- /dev/null +++ b/public/scripts/app.9a438daf.js @@ -0,0 +1 @@ +function mxDictionary(){this.clear()}function mxPoint(e,t){this.x=null!=e?e:0,this.y=null!=t?t:0}function mxRectangle(e,t,n,a){mxPoint.call(this,e,t),this.width=null!=n?n:0,this.height=null!=a?a:0}function mxEventObject(e){this.name=e,this.properties=[];for(var t=1;t"+this.encodeChanges(n.changes,n.undone)+"")}))}function mxUndoableEdit(e,t){this.source=e,this.changes=[],this.significant=null==t||t}function mxUndoManager(e){this.size=null!=e?e:100,this.clear()}function mxPanningManager(e){this.thread=null,this.active=!1,this.dy=this.dx=this.t0y=this.t0x=this.tdy=this.tdx=0,this.scrollbars=!1,this.scrollTop=this.scrollLeft=0,this.mouseListener={mouseDown:function(e,t){},mouseMove:function(e,t){},mouseUp:mxUtils.bind(this,function(e,t){this.active&&this.stop()})},e.addMouseListener(this.mouseListener),mxEvent.addListener(document,"mouseup",mxUtils.bind(this,function(){this.active&&this.stop()}));var t=mxUtils.bind(this,function(){return this.scrollbars=mxUtils.hasScrollbars(e.container),this.scrollLeft=e.container.scrollLeft,this.scrollTop=e.container.scrollTop,window.setInterval(mxUtils.bind(this,function(){if(this.tdx-=this.dx,this.tdy-=this.dy,this.scrollbars){var t=-e.container.scrollLeft-Math.ceil(this.dx),n=-e.container.scrollTop-Math.ceil(this.dy);e.panGraph(t,n),e.panDx=this.scrollLeft-e.container.scrollLeft,e.panDy=this.scrollTop-e.container.scrollTop,e.fireEvent(new mxEventObject(mxEvent.PAN))}else e.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=e.view.translate.x,this.t0y=e.view.translate.y,this.active=!0},this.panTo=function(n,a,i,o){this.active||this.start(),this.scrollLeft=e.container.scrollLeft,this.scrollTop=e.container.scrollTop,o=null!=o?o:0;var s=e.container;this.dx=n+(null!=i?i:0)-s.scrollLeft-s.clientWidth,0>this.dx&&Math.abs(this.dx)this.dy&&Math.abs(this.dy)mxUtils.indexOf(l.connectsAsTarget,s)&&l.connectsAsTarget.push(s))}}n[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,t,n,a,i,o){this.layout=e,this.intraCellSpacing=t,this.interRankCellSpacing=n,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=o}function WeightedCellSorter(e,t){this.cell=e,this.weightedValue=t}function mxHierarchicalLayout(e,t,n){mxGraphLayout.call(this,e),this.orientation=null!=t?t:mxConstants.DIRECTION_NORTH,this.deterministic=null==n||n}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,t){this.model=e,this.previous=this.root=t}function mxChildChange(e,t,n,a){this.model=e,this.previous=this.parent=t,this.child=n,this.previousIndex=this.index=a}function mxTerminalChange(e,t,n,a){this.model=e,this.cell=t,this.previous=this.terminal=n,this.source=a}function mxValueChange(e,t,n){this.model=e,this.cell=t,this.previous=this.value=n}function mxStyleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.style=n}function mxGeometryChange(e,t,n){this.model=e,this.cell=t,this.previous=this.geometry=n}function mxCollapseChange(e,t,n){this.model=e,this.cell=t,this.previous=this.collapsed=n}function mxVisibleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.visible=n}function mxCellAttributeChange(e,t,n){this.cell=e,this.attribute=t,this.previous=this.value=n}function mxCell(e,t,n){this.value=e,this.setGeometry(t),this.setStyle(n),null!=this.onInit&&this.onInit()}function mxGeometry(e,t,n,a){mxRectangle.call(this,e,t,n,a)}function mxPrintPreview(e,t,n,a,i,o,s,r,l){this.graph=e,this.scale=null!=t?t:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=n?n:e.pageFormat,this.title=null!=r?r:"Printer-friendly version",this.x0=null!=i?i:0,this.y0=null!=o?o:0,this.borderColor=s,this.pageSelector=null==l||l}function mxStylesheet(){this.styles={},this.putDefaultVertexStyle(this.createDefaultVertexStyle()),this.putDefaultEdgeStyle(this.createDefaultEdgeStyle())}function mxCellState(e,t,n){this.view=e,this.cell=t,this.style=n,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,t,n){this.selectionModel=e,this.added=null!=t?t.slice():null,this.removed=null!=n?n.slice():null}function mxCellEditor(e){this.graph=e}function mxCellRenderer(){}function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,t){if(this.view=e,this.previous=this.root=t,this.isUp=null==t,!this.isUp)for(var n=this.view.currentRoot,a=this.view.graph.getModel();null!=n;){if(n==t){this.isUp=!0;break}n=a.getParent(n)}}function mxGraph(e,t,n,a){this.mouseListeners=null,this.renderHint=n,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:n==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:n==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:n==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=t?t:new mxGraphModel,this.multiplicities=[],this.imageBundles=[],this.cellRenderer=this.createCellRenderer(),this.setSelectionModel(this.createSelectionModel()),this.setStylesheet(null!=a?a:this.createStylesheet()),this.view=this.createGraphView(),this.graphModelChangeListener=mxUtils.bind(this,function(e,t){this.graphModelChanged(t.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,t,n,a,i,o){this.image=e,this.tooltip=t,this.align=null!=n?n:this.align,this.verticalAlign=null!=a?a:this.verticalAlign,this.offset=null!=i?i:new mxPoint,this.cursor=null!=o?o:"help"}function mxOutline(e,t){this.source=e,null!=t&&this.init(t)}function mxMultiplicity(e,t,n,a,i,o,s,r,l,d){this.source=e,this.type=t,this.attr=n,this.value=a,this.min=null!=i?i:0,this.max=null!=o?o:"n",this.validNeighbors=s,this.countError=mxResources.get(r)||r,this.typeError=mxResources.get(l)||l,this.validNeighborsAllowed=null==d||d}function mxLayoutManager(e){this.undoHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.beforeUndo(t.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsMoved(t.getProperty("cells"),t.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,t,n,a){this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.shiftRightwards=null==t||t,this.shiftDownwards=null==n||n,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,t,n,a){this.horizontal=null==t||t,this.addEnabled=null==n||n,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(t.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,t,n){if(this.view=e,t=null!=t?t:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(t),null!=n){t=e.createState(new mxCell);for(i=0;i0||""!=t)&&(i.selected=t===a),n.appendChild(i)}return n.className="form-control select2",n}function createDropdownFromTigerDialList(e){var t=document.createElement("select"),n=[],a=new XMLHttpRequest;try{if(a.open("POST","/api/rest/list/list",!1),a.send(JSON.stringify({page:1,size:6e5})),200===a.status){var i=JSON.parse(a.response);if(i.status>0){var o=i.response.RMI.rows;for(var s in o)n[o[s].id]=o[s].name}}}catch(e){console.log(e)}for(var r in n){var l=document.createElement("option");l.text=n[r],l.value=r,(e>0||""!=e)&&(l.selected=e===r),t.appendChild(l)}return t.className="form-control select2",t}function Dialog(e,t,n,a,i,o,s){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),n+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-n)/2)),Math.max(0,Math.round((Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-a)/3));var l=e.createDiv("geDialog");l.className="modal fade in center",l.style.display="block",l.style.paddingRight="12px";var d=e.createDiv("geModalDialog");d.className="modal-dialog",d.appendChild(t),l.appendChild(d),null==this.bg&&(this.bg=e.createDiv("background"),this.bg.className="modal-backdrop fade in",mxClient.IS_QUIRKS&&new mxDivResizer(this.bg)),i&&document.body.appendChild(this.bg),document.body.appendChild(l),this.onDialogClose=s,this.container=l}function ImportDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("import")+" XML");var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.createDiv("row"),l=e.createDiv("col-md-12"),d=document.createElement("textarea");d.style.width="100%",d.style.height="374px";var c=document.createElement("input");c.type="file",c.setAttribute("accept","text/xml"),c.addEventListener("change",function(e){var t=e.target.files[0];if(console.log(t),t)if("text/xml"===t.type){var n=new FileReader;n.onload=function(e){var t=e.target.result;mxUtils.write(d,t)},n.readAsText(t)}else alert("Failed to load format file");else alert("Failed to load file")},!1),l.appendChild(c),l.appendChild(d),r.appendChild(l),a.appendChild(r);var m=mxUtils.button(mxResources.get("import"),mxUtils.bind(this,function(t){var n=mxUtils.parseXml(d.value);e.editor.setGraphXml(n.documentElement),e.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function AboutDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("about")+" Cally Square");var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=document.createElement("img");r.style.border="0px",r.setAttribute("width","176"),r.setAttribute("width","151"),r.setAttribute("src",IMAGE_PATH+"/logo.png"),a.appendChild(r),mxUtils.br(a),mxUtils.write(a,"Powered by Xenialab "+mxClient.VERSION),mxUtils.br(a);var l=document.createElement("a");l.setAttribute("href","http://www.callysquare.com/"),l.setAttribute("target","_blank"),mxUtils.write(l,"www.callysquare.com"),a.appendChild(l),mxUtils.br(a),mxUtils.br(a);var d=mxUtils.button(mxResources.get("close"),function(){e.hideDialog()});d.className="btn default",i.appendChild(d),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function SaveDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("saveAs"));var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_copy"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("save"),function(){e.saveAs(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function NewDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("new"));var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_new"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("new"),function(){e.new(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function DescriptionDialog(e){console.log(e.editor.data);var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("description"));var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.createDiv("form-horizontal form-row-seperated"),l=e.editor.data.description||"",d=e.createDiv("form-group"),c=document.createElement("label");c.className="col-sm-4 control-label",mxUtils.write(c,mxResources.get("description")),d.appendChild(c);var m=document.createElement("input");m.setAttribute("value",l),m.className="form-control",m.setAttribute("id","_description");var u=e.createDiv("col-sm-8");u.appendChild(m),d.appendChild(u),r.appendChild(d),a.appendChild(r);var p=mxUtils.button(mxResources.get("update"),function(){e.description(m.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function VariableDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("variable"));var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.createDiv("form-horizontal form-row-seperated"),l="name",d="_"+l,c="variable name",m=e.createDiv("form-group"),u=document.createElement("label");u.className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var p=document.createElement("input");p.setAttribute("value",c),p.className="form-control",p.setAttribute("id",d);var g=e.createDiv("col-sm-8");g.appendChild(p),m.appendChild(g),r.appendChild(m),d="_"+(l="description"),c="variable description",m=e.createDiv("form-group last"),(u=document.createElement("label")).className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var h=document.createElement("input");h.setAttribute("value",c),h.className="form-control",h.setAttribute("id",d),(g=e.createDiv("col-sm-8")).appendChild(h),m.appendChild(g),r.appendChild(m),a.appendChild(r);var v=mxUtils.button(mxResources.get("new"),function(){e.variable(p.value,h.value),e.hideDialog()});v.className="btn blue";var b=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});b.className="btn default",i.appendChild(v),i.appendChild(b),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function OpenDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("open"));var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.createDiv("row"),l=e.createDiv("col-md-4"),d=e.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=new XMLHttpRequest;m.open("GET","/api/square/projects",!1),m.setRequestHeader("Authorization","Bearer "+e.editor.data.token),m.send(null);var u=[];200===m.status&&(u=JSON.parse(m.response));for(var p=document.createElement("select"),g=0;g0){var t=e.dataTransfer.files[0],n=new FileReader;n.onload=function(e){m.value=e.target.result},n.readAsText(t)}}function n(e){e.stopPropagation(),e.preventDefault()}var a=e.createDiv("modal-content"),i=e.createDiv("modal-header"),o=e.createDiv("modal-body"),s=e.createDiv("modal-footer"),r=e.createHeader("h4");mxUtils.write(r,mxResources.get("edit"));var l=mxUtils.button("",function(){e.hideDialog()});l.className="close",i.appendChild(l),i.appendChild(r);var d=e.createDiv("row"),c=e.createDiv("col-md-12"),m=document.createElement("textarea");m.style.width="100%",m.style.height="374px",m.value=mxUtils.getPrettyXml(e.editor.getGraphXml()),fileSupport&&(m.addEventListener("dragover",n,!1),m.addEventListener("drop",t,!1)),c.appendChild(m),d.appendChild(c),o.appendChild(d);var u=mxUtils.button(mxResources.get("save"),function(){var t=mxUtils.parseXml(m.value);e.editor.setGraphXml(t.documentElement),e.hideDialog()});u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});p.className="btn default",s.appendChild(u),s.appendChild(p),a.appendChild(i),a.appendChild(o),a.appendChild(s),this.container=a}function ExportDialog(e){var t=e.createDiv("modal-content"),n=e.createDiv("modal-header"),a=e.createDiv("modal-body form"),i=e.createDiv("modal-footer"),o=e.createHeader("h4");mxUtils.write(o,mxResources.get("export")+" XML");var s=mxUtils.button("",function(){e.hideDialog()});s.className="close",n.appendChild(s),n.appendChild(o);var r=e.createDiv("form-horizontal form-row-seperated"),l=e.createDiv("form-group last"),d=document.createElement("label");d.className="col-sm-4 control-label",mxUtils.write(d,mxResources.get("filename"));var c=document.createElement("input");c.setAttribute("value",e.editor.getOrCreateFilename()),c.className="form-control";var m=e.createDiv("col-sm-8");m.appendChild(c),l.appendChild(d),l.appendChild(m),r.appendChild(l),a.appendChild(r);var u=mxUtils.button(mxResources.get("export"),mxUtils.bind(this,function(t){e.save(!1);encodeURIComponent(mxUtils.getXml(e.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+e.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),e.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function GeneralDialog(e,t){console.log("general");var n=e.editor.graph,a=e.createDiv("md-dialog"),i=e.createDiv("md-toolbar"),o=e.createDiv("md-dialog-content"),s=e.createDiv("md-dialog-actions"),r=e.createHeader("h4");mxUtils.write(r,mxResources.get("edit")+" "+mxResources.get(t.value.nodeName));var l=mxUtils.button("",function(){e.hideDialog()});l.className="close",i.appendChild(l),i.appendChild(r);for(var d=t.value.attributes.length,c=e.createDiv("form-horizontal form-row-seperated"),m=0;m=1}};return t}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";function e(){function e(e){t=angular.extend({},t,e)}var t={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=e,this.$get=function(){function e(e){return!angular.isUndefined(t[e])&&t[e]}function n(e,n){t[e]=n}return{getConfig:e,setConfig:n}}}angular.module("app.core").provider("motionConfig",e)}(),function(){"use strict";function e(e,t,n,a){t.debugEnabled(!0),e.config({tabindex:!1}),a.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0}),n.config({wheelPropagation:!0})}e.$inject=["$ariaProvider","$logProvider","msScrollConfigProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,t,n){t.generate(),n.getConfig("disableMdInkRippleOnMobile")&&e.isMobile()&&angular.element("body").attr("md-no-ink",!0),e.isMobile()&&angular.element("html").addClass("is-mobile");var a=e.detectBrowser();if(a){var i=a.browser+" "+a.version+" "+a.os;angular.element("html").addClass(i)}}e.$inject=["msUtils","motionGenerator","motionConfig"],angular.module("app.core").run(e)}(),function(){"use strict";function e(e,t,n){return{restrict:"E",compile:function(a,i){var o;return i.code||(o=a.html(),a.empty()),function(a,i,s){function r(e,t){var n=t.find("code"),a=e.split("\n"),i=(a=a.filter(function(e){return e.trim().length}))[0].match(/^\s*/)[0],o=new RegExp("^"+i);a=a.map(function(e){return e.replace(o,"").replace(/\s+$/,"")});var r=hljs.highlight(s.language||s.lang,a.join("\n"),!0);r.value=r.value.replace(/=""<\/span>/gi,"").replace("","").replace("",""),n.append(r.value).addClass("highlight")}s.code&&(o=a.$eval(s.code));var l=a.$eval(s.shouldInterpolate);t.when(o).then(function(t){if(t){l&&(t=n(t)(a));var o=angular.element('
');i.append(o),e(function(){r(t,o)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),function(){"use strict";function e(){return{restrict:"E",scope:{templatePath:"=template",card:"=ngModel",vm:"=viewModel"},template:'
',compile:function(e){return e.addClass("ms-card"),function(e,t){function n(){e.$emit("msCard::cardTemplateLoaded",t)}e.cardTemplateLoaded=n}}}}angular.module("app.core").directive("msCard",e)}(),function(){"use strict";function e(e,t,n,a){function i(){return n.dashboardItem.update(s.options).$promise.then(function(e){o(e)}).catch(function(e){console.error(e)})}function o(e){t.hide(e)}var s=this;s.options=a,s.closeDialog=o,s.updateItem=i}e.$inject=["$scope","$mdDialog","api","options"],angular.module("app.tools").controller("EditClockItemDashboardDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(a,i,o){function s(n){e.show({controller:"EditClockItemDashboardDialogController",controllerAs:"vm",templateUrl:"app/core/directives/ms-dash-clock/edit/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{options:a.options}})}function r(e){return n.trustAsResourceUrl(e)}a.options?a.options.data||(a.options.data={theme:"light",digitalFormat:"hh:mm:ss"}):a.options={},a.options.sizeX=a.options.sizeX<=1?2:a.options.sizeX,a.options.sizeY=a.options.sizeY<=1?2:a.options.sizeY,a.editItem=s,a.getTrustSrc=r}return{restrict:"E",scope:{options:"=",deleteItem:"&onDeleteItem"},link:i,templateUrl:"app/core/directives/ms-dash-clock/ms-dash-clock.html"}}e.$inject=["$mdDialog","$document","$sce","api"],angular.module("app.core").directive("msDashClock",e)}(),function(){"use strict";function e(e,t,n,a){function i(){return n.dashboardItem.update(s.options).$promise.then(function(e){o(e)}).catch(function(e){console.error(e)})}function o(e){t.hide(e)}var s=this;s.options=a,s.closeDialog=o,s.updateItem=i}e.$inject=["$scope","$mdDialog","api","options"],angular.module("app.tools").controller("EditCounterItemDashboardDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(n,i){function o(e){n.result=e}function s(a){e.show({controller:"EditCounterItemDashboardDialogController",controllerAs:"vm",templateUrl:"app/core/directives/ms-dash-counter/edit/dialog.html",parent:angular.element(t.body),targetEvent:a,clickOutsideToClose:!0,locals:{options:n.options}})}n.options&&!n.options.data&&(n.options.data={background:"#FFFFFF",foreground:"#03A9F4",foregroundTitle:"#7f7f7f",query:{fields:[],limit:1}}),a.on("widget:"+n.options.id,o),n.editItem=s,n.onWidgetUpdate=o}return{restrict:"E",scope:{options:"=",deleteItem:"&onDeleteItem"},link:o,templateUrl:"app/core/directives/ms-dash-counter/ms-dash-counter.html"}}e.$inject=["$mdDialog","$document","$interval","socket","api"],angular.module("app.core").directive("msDashCounter",e)}(),function(){"use strict";function e(e,t,n,a){function i(){return n.dashboardItem.update(s.options).$promise.then(function(e){o(e)}).catch(function(e){console.error(e)})}function o(e){t.hide(e)}var s=this;s.options=a,s.closeDialog=o,s.updateItem=i}e.$inject=["$scope","$mdDialog","api","options"],angular.module("app.tools").controller("EditIframeItemDashboardDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(a,i,o){function s(n){e.show({controller:"EditIframeItemDashboardDialogController",controllerAs:"vm",templateUrl:"app/core/directives/ms-dash-iframe/edit/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{options:a.options}})}function r(e){return n.trustAsResourceUrl(e)}a.options&&!a.options.data&&(a.options.data={url:"https://www.xcallymotion.com/"}),a.editItem=s,a.getTrustSrc=r}return{restrict:"E",scope:{options:"=",deleteItem:"&onDeleteItem"},link:i,templateUrl:"app/core/directives/ms-dash-iframe/ms-dash-iframe.html"}}e.$inject=["$mdDialog","$document","$sce","api"],angular.module("app.core").directive("msDashIframe",e)}(),function(){"use strict";function e(e,t,n,a){function i(){return n.dashboardItem.update(s.options).$promise.then(function(e){o(e)}).catch(function(e){console.error(e)})}function o(e){t.hide(e)}var s=this;s.options=a,s.closeDialog=o,s.updateItem=i}e.$inject=["$scope","$mdDialog","api","options"],angular.module("app.tools").controller("EditTableItemDashboardDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(n,a,o){function s(e){n.result=e}function r(a){e.show({controller:"EditTableItemDashboardDialogController",controllerAs:"vm",templateUrl:"app/core/directives/ms-dash-table/edit/dialog.html",parent:angular.element(t.body),targetEvent:a,clickOutsideToClose:!0,locals:{options:n.options}})}n.options&&!n.options.data&&(n.options.data={query:{}}),i.on("widget:"+n.options.id,s),n.editItem=r,n.onWidgetUpdate=s}return{restrict:"E",scope:{options:"=",deleteItem:"&onDeleteItem"},link:o,templateUrl:"app/core/directives/ms-dash-table/ms-dash-table.html"}}e.$inject=["$mdDialog","$document","$interval","api","socket"],angular.module("app.core").directive("msDashTable",e)}(),function(){"use strict";function e(){function e(e){n=angular.extend({},n,e)}var t=this,n={formatter:function(e){return e?""===e?e:new Date(e):""},parser:function(e){return e?moment(e).add(moment(e).utcOffset(),"m").toDate():""}};t.config=e,t.$get=function(){return n}}function t(e){return{require:"ngModel",priority:1,link:function(t,n,a,i){i.$formatters.push(e.formatter),i.$parsers.push(e.parser)}}}t.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",e).directive("msDatepickerFix",t)}(),function(){"use strict";function e(){return{restrict:"E",scope:{options:"="},controller:["$scope",function(e){e.transfer=function(t,n,a,i){var o=[];if(a>=0)o.push(t[a]),n.push(t[a]),t.splice(a,1);else{for(var s=0;s0&&angular.isDefined(u.forms[u.selectedIndex-1])&&u.forms[u.selectedIndex-1].$invalid}function c(){for(var e=0;ed.options.responsive.md?d.options.responsive.md:d.columnCount:n("sm")?d.columnCount=d.columnCount>d.options.responsive.sm?d.options.responsive.sm:d.columnCount:d.columnCount=d.options.responsive.xs,d.columnWidth=d.containerPos.width/d.columnCount}var d=this,c={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},m=!0;d.options=null,d.container=[],d.containerPos="",d.columnWidth="",d.items=[],d.reLayout=r,d.initialize=i,d.waitImagesLoaded=o,e.$on("msMasonry:relayout",function(){r()})}function t(e){function t(t,n){return{pre:function(e,a,i,o){o.options=angular.fromJson(n.options||"{}"),o.container=t},post:function(t,n,a,i){e(function(){i.initialize()})}}}return{restrict:"AEC",controller:"msMasonryController",compile:t}}function n(){function e(e,t,n,a){a.waitImagesLoaded(t,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return t.height()},function(e,t){e!==t&&a.reLayout()})}),t.on("$destroy",function(){a.reLayout()})}return{restrict:"AEC",require:"^msMasonry",priority:1,link:e}}e.$inject=["$scope","$window","$mdMedia","$timeout"],t.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",t).directive("msMasonryItem",n)}(),function(){"use strict";function e(e,t,n,a){function i(e,t){c.selectedPalette=e,c.selectedHues=t}function o(e,t){l(e,t),d(),n.hide()}function s(){c.selectedColor={palette:"",hue:"",class:""},i(!1,!1),d()}function r(){if(c.modelCtrl.$viewValue&&""!==c.modelCtrl.$viewValue){var e,t;if("class"===c.msModelType){var n=c.modelCtrl.$viewValue.split("-");n.length>=5?(e=n[1]+"-"+n[2],t=n[3]):(e=n[1],t=n[2])}else"obj"===c.msModelType&&(e=c.modelCtrl.$viewValue.palette,t=c.modelCtrl.$viewValue.hue||500);l(e,t)}else s()}function l(t,n){c.selectedColor={palette:t,hue:n,class:"md-"+t+"-"+n+"-bg",bgColorValue:a.rgba(c.palettes[t][n].value),fgColorValue:a.rgba(c.palettes[t][n].contrast)},"obj"!==c.msModelType||angular.equals(c.selectedColor,c.modelCtrl.$viewValue)||d(),i(t,c.palettes[t]),e.$selectedColor=c.selectedColor}function d(){"class"===c.msModelType?c.modelCtrl.$setViewValue(c.selectedColor.class):"obj"===c.msModelType&&c.modelCtrl.$setViewValue(c.selectedColor)}var c=this;c.palettes=t,c.selectedPalette=!1,c.selectedHues=!1,e.$selectedColor={},c.activateHueSelection=i,c.selectColor=o,c.removeColor=s,e.$watch("ngModel",r)}function t(){return{require:["msMaterialColorPicker","ngModel"],restrict:"E",scope:{ngModel:"=",msModelType:"@?"},controller:"msMaterialColorPickerController as vm",transclude:!0,templateUrl:"app/core/directives/ms-material-color-picker/ms-material-color-picker.html",link:function(e,t,n,a,i){var o=a[0];o.modelCtrl=a[1],o.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,t){return 1===t.nodeType})).length&&t.find("ms-color-picker-button").replaceWith(e)})}}}e.$inject=["$scope","$mdColorPalette","$mdMenu","motionGenerator"],angular.module("app.core").controller("msMaterialColorPickerController",e).directive("msMaterialColorPicker",t)}(),function(){"use strict";function e(){function e(e,t){o={scope:e,element:t}}function t(){return o.scope.isNavFoldedOpen()}function n(){o.scope.toggleFold()}function a(){o.scope.openFolded()}function i(){o.scope.closeFolded()}var o={};return{setFoldable:e,isNavFoldedOpen:t,toggleFold:n,openFolded:a,closeFolded:i}}function t(e,t,n){return{restrict:"A",link:function(a,i,o){function s(){return p}function r(){(u=!u)?l():m()}function l(){g.addClass("ms-nav-folded"),t.$broadcast("msNav::forceCollapse"),i.scrollTop(0),b.append(h),h.on("mouseenter touchstart",function(e){d(e),p=!0})}function d(e){angular.isDefined(e)&&e.preventDefault(),g.addClass("ms-nav-folded-open"),t.$broadcast("msNav::expandMatchingToggles"),b.find(h).remove(),b.parent().append(v),v.on("mouseenter touchstart",function(e){c(e),p=!1})}function c(e){angular.isDefined(e)&&e.preventDefault(),t.$broadcast("msNav::forceCollapse"),i.scrollTop(0),g.removeClass("ms-nav-folded-open"),b.parent().find(v).remove(),b.append(h),h.on("mouseenter touchstart",function(e){d(e),p=!0})}function m(){g.removeClass("ms-nav-folded ms-nav-folded-open"),t.$broadcast("msNav::expandMatchingToggles"),i.off("mouseenter mouseleave")}var u="true"===o.msNavIsFolded,p=!1,g=angular.element(e[0].body),h=angular.element('
'),v=angular.element('
'),b=i.parent();n.setFoldable(a,i,u),u?l():m(),a.toggleFold=r,a.openFolded=d,a.closeFolded=c,a.isNavFoldedOpen=s,a.$on("$destroy",function(){h.off("mouseenter touchstart"),v.off("mouseenter touchstart"),i.off("mouseenter mouseleave")})}}}function n(){function e(){return l}function t(){l=!0}function n(){l=!1}function a(e,t){d.push({element:e,scope:t})}function i(){return c}function o(e,t){c.push({element:e,scope:t})}function s(){c=[]}var r=this,l=!1,d=[],c=[];r.isDisabled=e,r.enable=n,r.disable=t,r.setToggleItem=a,r.getLockedItems=i,r.setLockedItem=o,r.clearLockedItems=s}function a(e,t,n){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(a){return a.addClass("ms-nav"),function(a){e.$broadcast("msNav::expandMatchingToggles");var i=e.$on("$stateChangeSuccess",function(){e.$broadcast("msNav::expandMatchingToggles"),t.when("navigation").then(function(e){e.close(),n.isNavFoldedOpen()&&n.closeFolded()})});a.$on("$destroy",function(){i()})}}}}function i(){return{restrict:"A",compile:function(e){return e.addClass("ms-nav-title"),function(){}}}}function o(){return{restrict:"AE",compile:function(e){return e.addClass("ms-nav-button"),function(){}}}}function s(e,t,n,a){return{restrict:"A",require:"^msNav",scope:!0,compile:function(i,o){return i.addClass("ms-nav-toggle"),angular.isUndefined(o.collapsed)&&(o.collapsed=!0),i.attr("collapsed",o.collapsed),function(i,o,s,r){function l(){r.isDisabled()||(r.disable(),d()?(r.clearLockedItems(),i.$emit("msNav::pushToLockedList"),e.$broadcast("msNav::collapse"),m().then(function(){r.enable()})):i.$broadcast("msNav::forceCollapse"))}function d(){return"true"===o.attr("collapsed")}function c(){return!d()}function m(){var e=t.defer();if(c())return e.reject({error:!0}),e.promise;o.attr("collapsed",!1);var a=angular.element(o.find("ms-nav-toggle-items")[0]);a.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var s=a[0].offsetHeight;return a.css({position:"",visibility:"",display:"",height:""}),i.$evalAsync(function(){n.animate(a,{display:"block",height:"0px"},{height:s+"px"},p.expandAnimation).then(function(){a.addClass(p.expanded),a.css({height:""}),e.resolve({success:!0})})}),e.promise}function u(){var e=t.defer();if(d())return e.reject({error:!0}),e.promise;o.attr("collapsed",!0);var a=angular.element(o.find("ms-nav-toggle-items")[0]),s=a[0].offsetHeight;return i.$evalAsync(function(){n.animate(a,{height:s+"px"},{height:"0px"},p.collapseAnimation).then(function(){a.removeClass(p.expanded),a.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}var p={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},g=o.find("a"),h=[],v=/\(.*\)/g;angular.forEach(g,function(e){var t=angular.element(e).attr("ui-sref");angular.isUndefined(t)||(t=t.replace(v,""),h.push(t))}),r.setToggleItem(o,i),o.children(".ms-nav-button").on("click",l),i.$on("$destroy",function(){o.children(".ms-nav-button").off("click")}),i.$on("msNav::collapse",function(){var e=r.getLockedItems(),t=!1;angular.forEach(e,function(e){angular.equals(e.scope,i)&&(t=!0)}),t||u().then(function(){r.enable()})}),i.$on("msNav::forceCollapse",function(){u().then(function(){r.enable()})}),i.$on("msNav::expandMatchingToggles",function(){var e=a.current.name,t=!1;angular.forEach(h,function(n){e===n&&(t=!0)}),t?m():u()}),i.$on("msNav::pushToLockedList",function(){r.setLockedItem(o,i)})}}}}t.$inject=["$document","$rootScope","msNavFoldService"],a.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],s.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",e).directive("msNavIsFolded",t).controller("MsNavController",n).directive("msNav",a).directive("msNavTitle",i).directive("msNavButton",o).directive("msNavToggle",s)}(),function(){"use strict";function e(){function e(e,t){if(angular.isString(e)){for(var n=e.split("."),i=n[n.length-1],r=a(n),l=!1,d=0;d1&&a.sort(i),a.length>0&&n(a)}}function a(e){var t=r;if(1===e.length)return t;e.pop();for(var n=0;n0&&(t=t.concat(h(e[n].children)))}return t}var v=null,b=null,f=null,E=null;return{saveItem:e,deleteItem:t,sort:n,clearNavigation:a,setActiveItem:i,getActiveItem:o,getNavigation:s,getFlatNavigation:l,setNavigationScope:d,setFolded:c,getFolded:m,setFoldedOpen:u,getFoldedOpen:p,toggleFolded:g}}}function t(e,t){function n(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")}var a=this;e.root?a.navigation=t.getNavigation(e.root):a.navigation=t.getNavigation(),a.toggleHorizontalMobileMenu=n,function(){t.sort()}()}function n(e,t,n,a){return{restrict:"E",scope:{folded:"=",root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/vertical.html",transclude:!0,compile:function(i){return i.addClass("ms-navigation"),function(i,o){function s(t){if(a.setFolded(t),t)e.$broadcast("msNavigation::collapse"),u.addClass("ms-navigation-folded"),r();else{var n=a.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),u.removeClass("ms-navigation-folded ms-navigation-folded-open"),d()}}function r(){o.parent().append(p),t(function(){p.on("mouseenter touchstart",c)})}function l(){u.find("#main").append(g),g.on("mouseenter touchstart",m)}function d(){g.remove()}function c(e){e&&e.preventDefault(),a.setFoldedOpen(!0);var t=a.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched"),u.addClass("ms-navigation-folded-open"),p.remove(),l()}function m(t){t&&t.preventDefault(),a.setFoldedOpen(!1),e.$broadcast("msNavigation::collapse"),u.removeClass("ms-navigation-folded-open"),g.remove(),r()}var u=angular.element("body"),p=angular.element('
'),g=angular.element('
'),h=n("navigation");a.setNavigationScope(i),function(){null===a.getFolded()&&a.setFolded(i.folded),a.getFolded()&&(t(function(){e.$broadcast("msNavigation::collapse")}),u.addClass("ms-navigation-folded"),r())}(),i.$watch(function(){return h.isLockedOpen()},function(t,n){if(!angular.isUndefined(t)&&!angular.equals(t,n)&&a.getFolded())if(t)e.$broadcast("msNavigation::collapse");else{var i=a.getActiveItem();i&&i.scope.$emit("msNavigation::stateMatched")}}),i.$watch("folded",function(e,t){angular.isUndefined(e)||angular.equals(e,t)||s(e)}),i.toggleFolded=function(){s(!a.getFolded())},i.$on("$stateChangeStart",function(){h.close()}),i.$on("$destroy",function(){g.off("mouseenter touchstart"),p.off("mouseenter touchstart")})}}}}function a(e,t,n,a,i,o){function s(){m.collapsed?m.expand():m.collapse()}function r(){var t=m.element.children("ul"),n=t[0].offsetHeight;e.$evalAsync(function(){m.collapsed=!0,m.element.addClass("collapsing"),a.animate(t,{display:"block",height:n+"px"},{height:"0px"},m.animateHeightClass).then(function(){t.css({display:"",height:""}),m.element.removeClass("collapsing")}),e.$broadcast("msNavigation::collapse")})}function l(){var t=m.element.children("ul");t.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var i=t[0].offsetHeight;t.css({position:"",visibility:"",display:"",height:""}),e.$evalAsync(function(){m.collapsed=!1,m.element.addClass("expanding"),a.animate(t,{display:"block",height:"0px"},{height:i+"px"},m.animateHeightClass).then(function(){t.css({height:""}),m.element.removeClass("expanding")}),n.$broadcast("msNavigation::collapse",m.node._path)})}function d(){return m.node.class}function c(){return!(!angular.isDefined(m.node.hidden)||!angular.isFunction(m.node.hidden))&&m.node.hidden()}var m=this;m.element=t,m.node=e.node,m.hasChildren=void 0,m.collapsed=void 0,m.collapsable=void 0,m.group=void 0,m.animateHeightClass="animate-height",m.toggleCollapsed=s,m.collapse=r,m.expand=l,m.getClass=d,m.isHidden=c,function(){if(m.hasChildren=m.node.children.length>0,m.group=!(!angular.isDefined(m.node.group)||!0!==m.node.group),!m.hasChildren||m.group?m.collapsable=!1:m.collapsable=!(!angular.isUndefined(m.node.collapsable)&&"boolean"==typeof m.node.collapsable&&!0!==m.node.collapsable),m.collapsable?m.collapsed=!(!angular.isUndefined(m.node.collapsed)&&"boolean"==typeof m.node.collapsed&&!0!==m.node.collapsed):m.collapsed=!1,m.node.state===i.current.name||i.includes(m.node.state)){if(angular.isDefined(m.node.stateParams)&&angular.isDefined(i.params)&&!angular.equals(m.node.stateParams,i.params))return;e.$emit("msNavigation::stateMatched"),o.setActiveItem(m.node,e)}e.$on("msNavigation::stateMatched",function(){m.collapsable&&m.collapsed&&e.$evalAsync(function(){m.collapsed=!1})}),e.$on("msNavigation::collapse",function(e,t){if(!m.collapsed&&m.collapsable)if(angular.isUndefined(t))m.collapse();else{var n=t.split("."),a=[],i=o.getActiveItem();if(i&&(a=i.node._path.split(".")),n.indexOf(m.node._id)>-1)return;if(a.indexOf(m.node._id)>-1)return;m.collapse()}}),e.$on("$stateChangeSuccess",function(){if(m.node.state===i.current.name){if(angular.isDefined(m.node.stateParams)&&angular.isDefined(i.params)&&!angular.equals(m.node.stateParams,i.params))return;o.setActiveItem(m.node,e),n.$broadcast("msNavigation::collapse",m.node._path)}if(i.includes(m.node.state)){if(angular.isDefined(m.node.stateParams)&&angular.isDefined(i.params)&&!angular.equals(m.node.stateParams,i.params))return;e.$emit("msNavigation::stateMatched")}})}()}function i(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}function o(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,t,n,a){a.collapsable&&t.on("click",a.toggleCollapsed),e.$on("$destroy",function(){t.off("click")})}}}}function s(e){return{restrict:"E",scope:{root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/horizontal.html",transclude:!0,compile:function(t){return t.addClass("ms-navigation-horizontal"),function(t){e.setNavigationScope(t)}}}}function r(e,t,n,a,i){function o(){return s.node.class}var s=this;s.element=t,s.node=e.node,s.hasChildren=void 0,s.group=void 0,s.getClass=o,function(){if(s.isActive=!1,s.hasChildren=s.node.children.length>0,s.group=!(!angular.isDefined(s.node.group)||!0!==s.node.group),s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;e.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,e)}e.$on("msNavigation::stateMatched",function(){s.hasChildren&&e.$evalAsync(function(){s.isActive=!0})}),e.$on("msNavigation::clearActive",function(){if(s.hasChildren){var t=[],n=i.getActiveItem();n&&(t=n.node._path.split(".")),t.indexOf(s.node._id)>-1?e.$evalAsync(function(){s.isActive=!0}):e.$evalAsync(function(){s.isActive=!1})}}),e.$on("$stateChangeSuccess",function(){if(s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;i.setActiveItem(s.node,e),n.$broadcast("msNavigation::clearActive")}})}()}function l(){return{restrict:"A",bindToController:{node:"=msNavigationHorizontalNode"},controller:"MsNavigationHorizontalNodeController as vm",compile:function(e){return e.addClass("ms-navigation-horizontal-node"),function(e,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}function d(e){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(t){return t.addClass("ms-navigation-horizontal-item"),function(t,n,a,i){function o(){i.hasChildren&&!e("gt-md")&&n.toggleClass("expanded")}n.on("click",o),t.$on("$destroy",function(){n.off("click")})}}}}t.$inject=["$scope","msNavigationService"],n.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],a.$inject=["$scope","$element","$rootScope","$animate","$state","msNavigationService"],s.$inject=["msNavigationService"],r.$inject=["$scope","$element","$rootScope","$state","msNavigationService"],d.$inject=["$mdMedia"],angular.module("app.core").provider("msNavigationService",e).controller("MsNavigationController",t).directive("msNavigation",n).controller("MsNavigationNodeController",a).directive("msNavigationNode",i).directive("msNavigationItem",o).directive("msNavigationHorizontal",s).controller("MsNavigationHorizontalNodeController",r).directive("msNavigationHorizontalNode",l).directive("msNavigationHorizontalItem",d)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){r.mobileBarActive=!r.mobileBarActive}var r=this;r.mobileBarActive=!1,r.toggleMobileBar=s}function t(){return{restrict:"E",scope:{},require:"msPhonebar",controller:"MsPhonebarController as MsPhonebar",bindToController:{},templateUrl:"app/core/directives/ms-phonebar/ms-phonebar.html",compile:function(e){return e.addClass("ms-phonebar"),function(e,t){}}}}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",t)}(),function(){"use strict";function e(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,t){var n=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];t.addClass(n)}}}angular.module("app.core").directive("msRandomClass",e)}(),function(){"use strict";function e(){return{restrict:"A",link:function(e,t){var n=angular.element('
');t.after(n),n.append(t)}}}angular.module("app.core").directive("msResponsiveTable",e)}(),function(){"use strict";function e(){function e(e){t=angular.extend({},t,e)}var t={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0};this.config=e,this.$get=function(){function e(){return t}return{getConfig:e}}}function t(e,t,n,a){return{restrict:"AE",compile:function(i){if(!(a.getConfig("disableCustomScrollbars")||a.getConfig("disableCustomScrollbarsOnMobile")&&n.isMobile()))return i.addClass("ms-scroll"),function(n,a,i){function o(){PerfectScrollbar.update(a[0])}var s={};i.msScroll&&(s=n.$eval(i.msScroll)),s=angular.extend({},t.getConfig(),s),e(function(){PerfectScrollbar.initialize(a[0],s)},0),a.on("mouseenter",o),n.$watch(function(){return a.prop("scrollHeight")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||o()}),n.$watch(function(){return a.prop("scrollWidth")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||o()}),n.$on("$destroy",function(){a.off("mouseenter"),PerfectScrollbar.destroy(a[0])})}}}}t.$inject=["$timeout","msScrollConfig","msUtils","motionConfig"],angular.module("app.core").provider("msScrollConfig",e).directive("msScroll",t)}(),function(){"use strict";function e(e,t,n){function a(e){if(!p.collapsed){var t=null===e;(angular.isArray(e)||t)&&(p.selectedResultIndex=0,p.results=e)}}function i(){p.collapsed=!1,e.expand(),p.onExpand&&angular.isFunction(p.onExpand)&&p.onExpand()}function o(){p.query="",p.populateResults(null),p.collapsed=!0,e.collapse(),p.onCollapse&&angular.isFunction(p.onCollapse)&&p.onCollapse()}function s(){g&&p.collapse()}function r(e){e.preventDefault()}function l(e){var t=e.keyCode;switch([27,38,40].indexOf(t)>-1&&e.preventDefault(),t){case 13:if(!p.results)return;p.handleResultClick(p.results[p.selectedResultIndex]);break;case 27:p.collapse();break;case 38:p.selectedResultIndex-1>=0&&(p.selectedResultIndex--,p.ensureSelectedResultIsVisible());break;case 40:if(!p.results)return;p.selectedResultIndex+1a&&e.scrollTop(a),i>e.height()+e.scrollTop()&&e.scrollTop(i-e.height())}}var p=this;p.collapsed=!0,p.query="",p.queryOptions={debounce:p.debounce||0};var g=!(!p.collapseOnBlur||"true"!=p.collapseOnBlur);p.resultsLoading=!1,p.results=null,p.selectedResultIndex=0,p.ignoreMouseEvents=!1,p.populateResults=a,p.expand=i,p.collapse=o,p.blurCollapse=s,p.absorbEvent=r,p.handleKeydown=l,p.handleMouseenter=d,p.temporarilyIgnoreMouseEvents=c,p.handleResultClick=m,p.ensureSelectedResultIsVisible=u,function(){e.$watch("MsSearchBar.query",function(t,n){if(!angular.isUndefined(t)&&!angular.equals(t,n)&&!p.collapsed){var a=e.$parent.$eval(p.onSearch,{query:t}),i=angular.isArray(a),o=a&&!!a.then;i&&p.populateResults(a),o&&(p.resultsLoading=!0,a.then(function(e){p.populateResults(e)},function(){p.populateResults([])}).finally(function(){p.resultsLoading=!1}))}})}()}function t(e){return{restrict:"E",scope:{},require:"msSearchBar",controller:"MsSearchBarController as MsSearchBar",bindToController:{debounce:"=?",onSearch:"@",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"@"},templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(t){return t.addClass("ms-search-bar"),function(t,n){function a(){n.addClass("expanded"),s.addClass("ms-search-bar-expanded"),o.focus()}function i(){n.removeClass("expanded"),s.removeClass("ms-search-bar-expanded")}var o,s=e.find("body");t.collapse=i,t.expand=a,function(){o=n.find("#ms-search-bar-input")}()}}}}e.$inject=["$scope","$element","$timeout"],t.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",t)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){for(var e=[],t=o.getFlatNavigation(),n=i.defer(),s=0;s-1)return!0});for(var r=0;r0&&(e=f.shortcuts);return f.selectedResultIndex=0,a(function(){n.resolve(e)},250),n.promise}function r(){var e=i.defer(),n=angular.fromJson(t.get("motion.shortcuts"));return angular.isUndefined(n)&&(n=[{title:"Agents",icon:"icon-account-multiple",state:"app.staff.agents",weight:5,children:[],uisref:"app.staff.agents",hasShortcut:!0},{title:"License",icon:"icon-cog",state:"app.settings.license",weight:10,children:[],uisref:"app.settings.license",hasShortcut:!0}],t.put("motion.shortcuts",angular.toJson(n))),e.resolve(n),e.promise}function l(){var e=i.defer();return t.put("motion.shortcuts",angular.toJson(f.shortcuts)),a(function(){e.resolve({success:!0})},250),e.promise}function d(e){e.hasShortcut=!0,f.shortcuts.push(e),f.saveShortcuts()}function c(e){e.hasShortcut=!1;for(var t=0;t=f.shortcuts.length&&(f.selectedResultIndex=f.shortcuts.length-1)));f.saveShortcuts()}function m(e){e.hasShortcut?f.removeShortcut(e):f.addShortcut(e)}function u(e){e.preventDefault()}function p(e){var t=e.keyCode;switch([38,40].indexOf(t)>-1&&e.preventDefault(),t){case 13:f.handleResultClick(f.results[f.selectedResultIndex]);break;case 38:f.selectedResultIndex-1>=0&&(f.selectedResultIndex--,f.ensureSelectedResultIsVisible());break;case 40:f.selectedResultIndex+1a&&e.scrollTop(a),i>e.height()+e.scrollTop()&&e.scrollTop(i-e.height())}}function b(){f.mobileBarActive=!f.mobileBarActive}var f=this;f.query="",f.queryOptions={debounce:300},f.resultsLoading=!1,f.selectedResultIndex=0,f.ignoreMouseEvents=!1,f.mobileBarActive=!1,f.results=null,f.shortcuts=[],f.sortableOptions={ghostClass:"ghost",forceFallback:!0,fallbackClass:"dragging",onSort:function(){f.saveShortcuts()}},f.populateResults=s,f.loadShortcuts=r,f.saveShortcuts=l,f.addShortcut=d,f.removeShortcut=c,f.handleResultClick=m,f.absorbEvent=u,f.handleKeydown=p,f.handleMouseenter=g,f.temporarilyIgnoreMouseEvents=h,f.ensureSelectedResultIsVisible=v,f.toggleMobileBar=b,function(){f.loadShortcuts().then(function(e){f.shortcuts=e,f.shortcuts.length>0&&(f.results=e)}),e.$watch("MsShortcuts.query",function(e,t){angular.isUndefined(e)||angular.equals(e,t)||(f.resultsLoading=!0,f.populateResults().then(function(e){f.results=e},function(){f.results=[]}).finally(function(){f.resultsLoading=!1}))})}()}function t(){return{restrict:"E",scope:{},require:"msShortcuts",controller:"MsShortcutsController as MsShortcuts",bindToController:{},templateUrl:"app/core/directives/ms-shortcuts/ms-shortcuts.html",compile:function(e){return e.addClass("ms-shortcuts"),function(e,t){}}}}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsShortcutsController",e).directive("msShortcuts",t)}(),function(){"use strict";function e(){return{restrict:"A",require:"^mdSidenav",link:function(e,t,n,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(t.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}}angular.module("app.core").directive("msSidenavHelper",e)}(),function(){"use strict";function e(e){return{restrict:"E",link:function(t,n){var a=t.$on("msSplashScreen::remove",function(){e.leave(n).then(function(){a(),t=n=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){function t(e){C.orientation=e||"horizontal"}function n(e){C.mainForm=e}function a(e,t,n){var a={element:e,scope:t,form:n,stepNumber:t.step||C.steps.length+1,stepTitle:t.stepTitle,stepTitleTranslate:t.stepTitleTranslate};return C.steps.push(a),C.steps.sort(function(e,t){return e.stepNumber-t.stepNumber}),a}function i(){C.setCurrentStep(C.currentStepNumber)}function o(){e(function(){for(var e=0;e=1;t--)if(!b(t)){e=t;break}C.setCurrentStep(e)}function d(){for(var e=C.currentStepNumber+1,t=e;t<=C.steps.length;t++)if(!b(t)){e=t;break}C.setCurrentStep(e)}function c(){C.setCurrentStep(1)}function m(){C.setCurrentStep(C.steps.length)}function u(){return 1===C.currentStepNumber}function p(){return C.currentStepNumber===C.steps.length}function g(e){return y(e)?C.currentStepNumber===e:null}function h(e){if(!y(e))return null;for(var t=!1,n=1;nC.steps.length)}function A(){return C.mainForm.$valid}var C=this;C.mainForm=void 0,C.orientation="horizontal",C.steps=[],C.currentStep=void 0,C.currentStepNumber=1,C.setOrientation=t,C.registerMainForm=n,C.registerStep=a,C.setupSteps=i,C.resetForm=o,C.setCurrentStep=s,C.gotoStep=r,C.gotoPreviousStep=l,C.gotoNextStep=d,C.gotoFirstStep=c,C.gotoLastStep=m,C.isFirstStep=u,C.isLastStep=p,C.isStepCurrent=g,C.isStepDisabled=h,C.isStepOptional=v,C.isStepHidden=b,C.filterHiddenStep=f,C.isStepValid=E,C.isStepNumberValid=y,C.isFormValid=A}function t(){return{restrict:"A",scope:{},require:["form","msHorizontalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/horizontal/horizontal.html",compile:function(e){return e.addClass("ms-stepper"),function(e,t,n,a){var i=a[0],o=a[1];o.setOrientation("horizontal"),o.registerMainForm(i),o.setupSteps()}}}}function n(){return{restrict:"E",require:["form","^msHorizontalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},compile:function(e){return e.addClass("ms-stepper-step"),function(e,t,n,a){var i=a[0],o=a[1];e.optionalStep=angular.isDefined(n.optionalStep),o.registerStep(t,e,i),t.hide()}}}}function a(e){return{restrict:"A",scope:{},require:["form","msVerticalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/vertical.html",compile:function(t){return t.addClass("ms-stepper"),function(t,n,a,i){var o=i[0],s=i[1];e(function(){s.setOrientation("vertical"),s.registerMainForm(o),s.setupSteps()})}}}}function i(){return{restrict:"E",require:["form","^msVerticalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",compile:function(e){return e.addClass("ms-stepper-step"),function(e,t,n,a){var i=a[0],o=a[1];e.optionalStep=angular.isDefined(n.optionalStep),e.stepInfo=o.registerStep(t,e,i),e.MsStepper=o,t.find(".ms-stepper-step-content").hide()}}}}e.$inject=["$timeout"],a.$inject=["$timeout"],angular.module("app.core").controller("MsStepperController",e).directive("msHorizontalStepper",t).directive("msHorizontalStepperStep",n).directive("msVerticalStepper",a).directive("msVerticalStepperStep",i)}(),function(){"use strict";function e(){function e(e){n.scrollEl=e}function t(){return n.scrollEl}var n=this;n.scrollEl=void 0,n.setScrollEl=e,n.getScrollEl=t}function t(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,t,n,a){function i(){d.scrollTop()+d.height()+c>r.position().top&&(r.addClass("show"),s(),e.loadMore().then(function(){r.removeClass("show"),o()},function(){r.remove()}))}function o(){d.on("scroll",i)}function s(){d.off("scroll",i)}var r=angular.element('
');t.append(r);var l={scrollEl:"#content"};l=angular.extend(l,e.msTimeline,{});var d=angular.element(l.scrollEl);a.setScrollEl(d);var c=144;o(),e.$on("$destroy",function(){s()})}}}}function n(e,t){return{scope:!0,require:"^msTimeline",compile:function(n){return n.addClass("ms-timeline-item").addClass("hidden"),function(n,a,i,o){function s(e){var n=t.defer(),a=e.find("img");return a.length>0?a.on("load",function(){n.resolve("Image is loaded")}):n.resolve("No images"),n.promise}function r(){m.scrollTop()+m.height()>a.position().top+l&&(e(function(){c=!0}),m.off("scroll",r))}var l=72,d=!1,c=!1,m=o.getScrollEl();!function(){a.find("ms-card")?n.$on("msCard::cardTemplateLoaded",function(t,n){s(angular.element(n[0])).then(function(){e(function(){d=!0})})}):s(a).then(function(){e(function(){d=!0})}),m.on("scroll",r),r()}();var u=n.$watch(function(){return d&&c},function(e,t){angular.equals(e,t)||e&&(a.removeClass("hidden").addClass("animate"),u())},!0)}}}}n.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",e).directive("msTimeline",t).directive("msTimelineItem",n)}(),function(){"use strict";function e(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope",function(e){e.timezone={"Europe/Andorra":{name:"Europe/Andorra",utcOffset:60,offsetStr:"+01:00",countries:["AD"]},"Asia/Dubai":{name:"Asia/Dubai",utcOffset:240,offsetStr:"+04:00",countries:["AE","OM"]},"Asia/Kabul":{name:"Asia/Kabul",utcOffset:270,offsetStr:"+04:30",countries:["AF"]},"Europe/Tirane":{name:"Europe/Tirane",utcOffset:60,offsetStr:"+01:00",countries:["AL"]},"Asia/Yerevan":{name:"Asia/Yerevan",utcOffset:240,offsetStr:"+04:00",countries:["AM"]},"Antarctica/Rothera":{name:"Antarctica/Rothera",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},"Antarctica/Palmer":{name:"Antarctica/Palmer",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},"Antarctica/Mawson":{name:"Antarctica/Mawson",utcOffset:300,offsetStr:"+05:00",countries:["AQ"]},"Antarctica/Davis":{name:"Antarctica/Davis",utcOffset:420,offsetStr:"+07:00",countries:["AQ"]},"Antarctica/Casey":{name:"Antarctica/Casey",utcOffset:480,offsetStr:"+08:00",countries:["AQ"]},"Antarctica/Vostok":{name:"Antarctica/Vostok",utcOffset:360,offsetStr:"+06:00",countries:["AQ"]},"Antarctica/DumontDUrville":{name:"Antarctica/DumontDUrville",utcOffset:600,offsetStr:"+10:00",countries:["AQ"]},"Antarctica/Syowa":{name:"Antarctica/Syowa",utcOffset:180,offsetStr:"+03:00",countries:["AQ"]},"Antarctica/Troll":{name:"Antarctica/Troll",utcOffset:0,offsetStr:"+00:00",countries:["AQ"]},"America/Argentina/Buenos_Aires":{name:"America/Argentina/Buenos_Aires",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Cordoba":{name:"America/Argentina/Cordoba",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Salta":{name:"America/Argentina/Salta",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Jujuy":{name:"America/Argentina/Jujuy",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Tucuman":{name:"America/Argentina/Tucuman",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Catamarca":{name:"America/Argentina/Catamarca",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/La_Rioja":{name:"America/Argentina/La_Rioja",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/San_Juan":{name:"America/Argentina/San_Juan",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Mendoza":{name:"America/Argentina/Mendoza",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/San_Luis":{name:"America/Argentina/San_Luis",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Rio_Gallegos":{name:"America/Argentina/Rio_Gallegos",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"America/Argentina/Ushuaia":{name:"America/Argentina/Ushuaia",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},"Pacific/Pago_Pago":{name:"Pacific/Pago_Pago",utcOffset:-660,offsetStr:"-11:00",countries:["AS","UM"]},"Europe/Vienna":{name:"Europe/Vienna",utcOffset:60,offsetStr:"+01:00",countries:["AT"]},"Australia/Lord_Howe":{name:"Australia/Lord_Howe",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Antarctica/Macquarie":{name:"Antarctica/Macquarie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Australia/Hobart":{name:"Australia/Hobart",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Australia/Currie":{name:"Australia/Currie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Australia/Melbourne":{name:"Australia/Melbourne",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Australia/Sydney":{name:"Australia/Sydney",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},"Australia/Broken_Hill":{name:"Australia/Broken_Hill",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},"Australia/Brisbane":{name:"Australia/Brisbane",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},"Australia/Lindeman":{name:"Australia/Lindeman",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},"Australia/Adelaide":{name:"Australia/Adelaide",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},"Australia/Darwin":{name:"Australia/Darwin",utcOffset:570,offsetStr:"+09:30",countries:["AU"]},"Australia/Perth":{name:"Australia/Perth",utcOffset:480,offsetStr:"+08:00",countries:["AU"]},"Australia/Eucla":{name:"Australia/Eucla",utcOffset:525,offsetStr:"+08:45",countries:["AU"]},"Asia/Baku":{name:"Asia/Baku",utcOffset:240,offsetStr:"+04:00",countries:["AZ"]},"America/Barbados":{name:"America/Barbados",utcOffset:-240,offsetStr:"-04:00",countries:["BB"]},"Asia/Dhaka":{name:"Asia/Dhaka",utcOffset:360,offsetStr:"+06:00",countries:["BD"]},"Europe/Brussels":{name:"Europe/Brussels",utcOffset:60,offsetStr:"+01:00",countries:["BE"]},"Europe/Sofia":{name:"Europe/Sofia",utcOffset:120,offsetStr:"+02:00",countries:["BG"]},"Atlantic/Bermuda":{name:"Atlantic/Bermuda",utcOffset:-240,offsetStr:"-04:00",countries:["BM"]},"Asia/Brunei":{name:"Asia/Brunei",utcOffset:480,offsetStr:"+08:00",countries:["BN"]},"America/La_Paz":{name:"America/La_Paz",utcOffset:-240,offsetStr:"-04:00",countries:["BO"]},"America/Noronha":{name:"America/Noronha",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},"America/Belem":{name:"America/Belem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Fortaleza":{name:"America/Fortaleza",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Recife":{name:"America/Recife",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Araguaina":{name:"America/Araguaina",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Maceio":{name:"America/Maceio",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Bahia":{name:"America/Bahia",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Sao_Paulo":{name:"America/Sao_Paulo",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},"America/Campo_Grande":{name:"America/Campo_Grande",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Cuiaba":{name:"America/Cuiaba",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Santarem":{name:"America/Santarem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},"America/Porto_Velho":{name:"America/Porto_Velho",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},"America/Boa_Vista":{name:"America/Boa_Vista",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},"America/Manaus":{name:"America/Manaus",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},"America/Eirunepe":{name:"America/Eirunepe",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},"America/Rio_Branco":{name:"America/Rio_Branco",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},"America/Nassau":{name:"America/Nassau",utcOffset:-300,offsetStr:"-05:00",countries:["BS"]},"Asia/Thimphu":{name:"Asia/Thimphu",utcOffset:360,offsetStr:"+06:00",countries:["BT"]},"Europe/Minsk":{name:"Europe/Minsk",utcOffset:180,offsetStr:"+03:00",countries:["BY"]},"America/Belize":{name:"America/Belize",utcOffset:-360,offsetStr:"-06:00",countries:["BZ"]},"America/St_Johns":{name:"America/St_Johns",utcOffset:-210,offsetStr:"-03:30",countries:["CA"]},"America/Halifax":{name:"America/Halifax",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},"America/Glace_Bay":{name:"America/Glace_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},"America/Moncton":{name:"America/Moncton",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},"America/Goose_Bay":{name:"America/Goose_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},"America/Blanc-Sablon":{name:"America/Blanc-Sablon",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},"America/Toronto":{name:"America/Toronto",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Nipigon":{name:"America/Nipigon",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Thunder_Bay":{name:"America/Thunder_Bay",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Iqaluit":{name:"America/Iqaluit",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Pangnirtung":{name:"America/Pangnirtung",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Resolute":{name:"America/Resolute",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Atikokan":{name:"America/Atikokan",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},"America/Rankin_Inlet":{name:"America/Rankin_Inlet",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Winnipeg":{name:"America/Winnipeg",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Rainy_River":{name:"America/Rainy_River",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Regina":{name:"America/Regina",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Swift_Current":{name:"America/Swift_Current",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},"America/Edmonton":{name:"America/Edmonton",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Cambridge_Bay":{name:"America/Cambridge_Bay",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Yellowknife":{name:"America/Yellowknife",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Inuvik":{name:"America/Inuvik",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Creston":{name:"America/Creston",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Dawson_Creek":{name:"America/Dawson_Creek",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Fort_Nelson":{name:"America/Fort_Nelson",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},"America/Vancouver":{name:"America/Vancouver",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},"America/Whitehorse":{name:"America/Whitehorse",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},"America/Dawson":{name:"America/Dawson",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},"Indian/Cocos":{name:"Indian/Cocos",utcOffset:390,offsetStr:"+06:30",countries:["CC"]},"Europe/Zurich":{name:"Europe/Zurich",utcOffset:60,offsetStr:"+01:00",countries:["CH","DE","LI"]},"Africa/Abidjan":{name:"Africa/Abidjan",utcOffset:0,offsetStr:"+00:00",countries:["CI","BF","GM","GN","ML","MR","SH","SL","SN","ST","TG"]},"Pacific/Rarotonga":{name:"Pacific/Rarotonga",utcOffset:-600,offsetStr:"-10:00",countries:["CK"]},"America/Santiago":{name:"America/Santiago",utcOffset:-180,offsetStr:"-03:00",countries:["CL"]},"Pacific/Easter":{name:"Pacific/Easter",utcOffset:-300,offsetStr:"-05:00",countries:["CL"]},"Asia/Shanghai":{name:"Asia/Shanghai",utcOffset:480,offsetStr:"+08:00",countries:["CN"]},"Asia/Urumqi":{name:"Asia/Urumqi",utcOffset:360,offsetStr:"+06:00",countries:["CN"]},"America/Bogota":{name:"America/Bogota",utcOffset:-300,offsetStr:"-05:00",countries:["CO"]},"America/Costa_Rica":{name:"America/Costa_Rica",utcOffset:-360,offsetStr:"-06:00",countries:["CR"]},"America/Havana":{name:"America/Havana",utcOffset:-300,offsetStr:"-05:00",countries:["CU"]},"Atlantic/Cape_Verde":{name:"Atlantic/Cape_Verde",utcOffset:-60,offsetStr:"-01:00",countries:["CV"]},"America/Curacao":{name:"America/Curacao",utcOffset:-240,offsetStr:"-04:00",countries:["CW","AW","BQ","SX"]},"Indian/Christmas":{name:"Indian/Christmas",utcOffset:420,offsetStr:"+07:00",countries:["CX"]},"Asia/Nicosia":{name:"Asia/Nicosia",utcOffset:120,offsetStr:"+02:00",countries:["CY"]},"Europe/Prague":{name:"Europe/Prague",utcOffset:60,offsetStr:"+01:00",countries:["CZ","SK"]},"Europe/Berlin":{name:"Europe/Berlin",utcOffset:60,offsetStr:"+01:00",countries:["DE"]},"Europe/Copenhagen":{name:"Europe/Copenhagen",utcOffset:60,offsetStr:"+01:00",countries:["DK"]},"America/Santo_Domingo":{name:"America/Santo_Domingo",utcOffset:-240,offsetStr:"-04:00",countries:["DO"]},"Africa/Algiers":{name:"Africa/Algiers",utcOffset:60,offsetStr:"+01:00",countries:["DZ"]},"America/Guayaquil":{name:"America/Guayaquil",utcOffset:-300,offsetStr:"-05:00",countries:["EC"]},"Pacific/Galapagos":{name:"Pacific/Galapagos",utcOffset:-360,offsetStr:"-06:00",countries:["EC"]},"Europe/Tallinn":{name:"Europe/Tallinn",utcOffset:120,offsetStr:"+02:00",countries:["EE"]},"Africa/Cairo":{name:"Africa/Cairo",utcOffset:120,offsetStr:"+02:00",countries:["EG"]},"Africa/El_Aaiun":{name:"Africa/El_Aaiun",utcOffset:0,offsetStr:"+00:00",countries:["EH"]},"Europe/Madrid":{name:"Europe/Madrid",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},"Africa/Ceuta":{name:"Africa/Ceuta",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},"Atlantic/Canary":{name:"Atlantic/Canary",utcOffset:0,offsetStr:"+00:00",countries:["ES"]},"Europe/Helsinki":{name:"Europe/Helsinki",utcOffset:120,offsetStr:"+02:00",countries:["FI","AX"]},"Pacific/Fiji":{name:"Pacific/Fiji",utcOffset:720,offsetStr:"+12:00",countries:["FJ"]},"Atlantic/Stanley":{name:"Atlantic/Stanley",utcOffset:-180,offsetStr:"-03:00",countries:["FK"]},"Pacific/Chuuk":{name:"Pacific/Chuuk",utcOffset:600,offsetStr:"+10:00",countries:["FM"]},"Pacific/Pohnpei":{name:"Pacific/Pohnpei",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},"Pacific/Kosrae":{name:"Pacific/Kosrae",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},"Atlantic/Faroe":{name:"Atlantic/Faroe",utcOffset:0,offsetStr:"+00:00",countries:["FO"]},"Europe/Paris":{name:"Europe/Paris",utcOffset:60,offsetStr:"+01:00",countries:["FR"]},"Europe/London":{name:"Europe/London",utcOffset:0,offsetStr:"+00:00",countries:["GB","GG","IM","JE"]},"Asia/Tbilisi":{name:"Asia/Tbilisi",utcOffset:240,offsetStr:"+04:00",countries:["GE"]},"America/Cayenne":{name:"America/Cayenne",utcOffset:-180,offsetStr:"-03:00",countries:["GF"]},"Africa/Accra":{name:"Africa/Accra",utcOffset:0,offsetStr:"+00:00",countries:["GH"]},"Europe/Gibraltar":{name:"Europe/Gibraltar",utcOffset:60,offsetStr:"+01:00",countries:["GI"]},"America/Godthab":{name:"America/Godthab",utcOffset:-180,offsetStr:"-03:00",countries:["GL"]},"America/Danmarkshavn":{name:"America/Danmarkshavn",utcOffset:0,offsetStr:"+00:00",countries:["GL"]},"America/Scoresbysund":{name:"America/Scoresbysund",utcOffset:-60,offsetStr:"-01:00",countries:["GL"]},"America/Thule":{name:"America/Thule",utcOffset:-240,offsetStr:"-04:00",countries:["GL"]},"Europe/Athens":{name:"Europe/Athens",utcOffset:120,offsetStr:"+02:00",countries:["GR"]},"Atlantic/South_Georgia":{name:"Atlantic/South_Georgia",utcOffset:-120,offsetStr:"-02:00",countries:["GS"]},"America/Guatemala":{name:"America/Guatemala",utcOffset:-360,offsetStr:"-06:00",countries:["GT"]},"Pacific/Guam":{name:"Pacific/Guam",utcOffset:600,offsetStr:"+10:00",countries:["GU","MP"]},"Africa/Bissau":{name:"Africa/Bissau",utcOffset:0,offsetStr:"+00:00",countries:["GW"]},"America/Guyana":{name:"America/Guyana",utcOffset:-240,offsetStr:"-04:00",countries:["GY"]},"Asia/Hong_Kong":{name:"Asia/Hong_Kong",utcOffset:480,offsetStr:"+08:00",countries:["HK"]},"America/Tegucigalpa":{name:"America/Tegucigalpa",utcOffset:-360,offsetStr:"-06:00",countries:["HN"]},"America/Port-au-Prince":{name:"America/Port-au-Prince",utcOffset:-300,offsetStr:"-05:00",countries:["HT"]},"Europe/Budapest":{name:"Europe/Budapest",utcOffset:60,offsetStr:"+01:00",countries:["HU"]},"Asia/Jakarta":{name:"Asia/Jakarta",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},"Asia/Pontianak":{name:"Asia/Pontianak",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},"Asia/Makassar":{name:"Asia/Makassar",utcOffset:480,offsetStr:"+08:00",countries:["ID"]},"Asia/Jayapura":{name:"Asia/Jayapura",utcOffset:540,offsetStr:"+09:00",countries:["ID"]},"Europe/Dublin":{name:"Europe/Dublin",utcOffset:0,offsetStr:"+00:00",countries:["IE"]},"Asia/Jerusalem":{name:"Asia/Jerusalem",utcOffset:120,offsetStr:"+02:00",countries:["IL"]},"Asia/Kolkata":{name:"Asia/Kolkata",utcOffset:330,offsetStr:"+05:30",countries:["IN"]},"Indian/Chagos":{name:"Indian/Chagos",utcOffset:360,offsetStr:"+06:00",countries:["IO"]},"Asia/Baghdad":{name:"Asia/Baghdad",utcOffset:180,offsetStr:"+03:00",countries:["IQ"]},"Asia/Tehran":{name:"Asia/Tehran",utcOffset:210,offsetStr:"+03:30",countries:["IR"]},"Atlantic/Reykjavik":{name:"Atlantic/Reykjavik",utcOffset:0,offsetStr:"+00:00",countries:["IS"]},"Europe/Rome":{name:"Europe/Rome",utcOffset:60,offsetStr:"+01:00",countries:["IT","SM","VA"]},"America/Jamaica":{name:"America/Jamaica",utcOffset:-300,offsetStr:"-05:00",countries:["JM"]},"Asia/Amman":{name:"Asia/Amman",utcOffset:120,offsetStr:"+02:00",countries:["JO"]},"Asia/Tokyo":{name:"Asia/Tokyo",utcOffset:540,offsetStr:"+09:00",countries:["JP"]},"Africa/Nairobi":{name:"Africa/Nairobi",utcOffset:180,offsetStr:"+03:00",countries:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Asia/Bishkek":{name:"Asia/Bishkek",utcOffset:360,offsetStr:"+06:00",countries:["KG"]},"Pacific/Tarawa":{name:"Pacific/Tarawa",utcOffset:720,offsetStr:"+12:00",countries:["KI"]},"Pacific/Enderbury":{name:"Pacific/Enderbury",utcOffset:780,offsetStr:"+13:00",countries:["KI"]},"Pacific/Kiritimati":{name:"Pacific/Kiritimati",utcOffset:840,offsetStr:"+14:00",countries:["KI"]},"Asia/Pyongyang":{name:"Asia/Pyongyang",utcOffset:510,offsetStr:"+08:30",countries:["KP"]},"Asia/Seoul":{name:"Asia/Seoul",utcOffset:540,offsetStr:"+09:00",countries:["KR"]},"America/Cayman":{name:"America/Cayman",utcOffset:-300,offsetStr:"-05:00",countries:["KY"]},"Asia/Almaty":{name:"Asia/Almaty",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},"Asia/Qyzylorda":{name:"Asia/Qyzylorda",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},"Asia/Aqtobe":{name:"Asia/Aqtobe",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},"Asia/Aqtau":{name:"Asia/Aqtau",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},"Asia/Oral":{name:"Asia/Oral",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},"Asia/Beirut":{name:"Asia/Beirut",utcOffset:120,offsetStr:"+02:00",countries:["LB"]},"Asia/Colombo":{name:"Asia/Colombo",utcOffset:330,offsetStr:"+05:30",countries:["LK"]},"Africa/Monrovia":{name:"Africa/Monrovia",utcOffset:0,offsetStr:"+00:00",countries:["LR"]},"Europe/Vilnius":{name:"Europe/Vilnius",utcOffset:120,offsetStr:"+02:00",countries:["LT"]},"Europe/Luxembourg":{name:"Europe/Luxembourg",utcOffset:60,offsetStr:"+01:00",countries:["LU"]},"Europe/Riga":{name:"Europe/Riga",utcOffset:120,offsetStr:"+02:00",countries:["LV"]},"Africa/Tripoli":{name:"Africa/Tripoli",utcOffset:120,offsetStr:"+02:00",countries:["LY"]},"Africa/Casablanca":{name:"Africa/Casablanca",utcOffset:0,offsetStr:"+00:00",countries:["MA"]},"Europe/Monaco":{name:"Europe/Monaco",utcOffset:60,offsetStr:"+01:00",countries:["MC"]},"Europe/Chisinau":{name:"Europe/Chisinau",utcOffset:120,offsetStr:"+02:00",countries:["MD"]},"Pacific/Majuro":{name:"Pacific/Majuro",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},"Pacific/Kwajalein":{name:"Pacific/Kwajalein",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},"Asia/Rangoon":{name:"Asia/Rangoon",utcOffset:390,offsetStr:"+06:30",countries:["MM"]},"Asia/Ulaanbaatar":{name:"Asia/Ulaanbaatar",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},"Asia/Hovd":{name:"Asia/Hovd",utcOffset:420,offsetStr:"+07:00",countries:["MN"]},"Asia/Choibalsan":{name:"Asia/Choibalsan",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},"Asia/Macau":{name:"Asia/Macau",utcOffset:480,offsetStr:"+08:00",countries:["MO"]},"America/Martinique":{name:"America/Martinique",utcOffset:-240,offsetStr:"-04:00",countries:["MQ"]},"Europe/Malta":{name:"Europe/Malta",utcOffset:60,offsetStr:"+01:00",countries:["MT"]},"Indian/Mauritius":{name:"Indian/Mauritius",utcOffset:240,offsetStr:"+04:00",countries:["MU"]},"Indian/Maldives":{name:"Indian/Maldives",utcOffset:300,offsetStr:"+05:00",countries:["MV"]},"America/Mexico_City":{name:"America/Mexico_City",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},"America/Cancun":{name:"America/Cancun",utcOffset:-300,offsetStr:"-05:00",countries:["MX"]},"America/Merida":{name:"America/Merida",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},"America/Monterrey":{name:"America/Monterrey",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},"America/Matamoros":{name:"America/Matamoros",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},"America/Mazatlan":{name:"America/Mazatlan",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},"America/Chihuahua":{name:"America/Chihuahua",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},"America/Ojinaga":{name:"America/Ojinaga",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},"America/Hermosillo":{name:"America/Hermosillo",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},"America/Tijuana":{name:"America/Tijuana",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},"America/Santa_Isabel":{name:"America/Santa_Isabel",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},"America/Bahia_Banderas":{name:"America/Bahia_Banderas",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},"Asia/Kuala_Lumpur":{name:"Asia/Kuala_Lumpur",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},"Asia/Kuching":{name:"Asia/Kuching",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},"Africa/Maputo":{name:"Africa/Maputo",utcOffset:120,offsetStr:"+02:00",countries:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Windhoek":{name:"Africa/Windhoek",utcOffset:120,offsetStr:"+02:00",countries:["NA"]},"Pacific/Noumea":{name:"Pacific/Noumea",utcOffset:660,offsetStr:"+11:00",countries:["NC"]},"Pacific/Norfolk":{name:"Pacific/Norfolk",utcOffset:660,offsetStr:"+11:00",countries:["NF"]},"Africa/Lagos":{name:"Africa/Lagos",utcOffset:60,offsetStr:"+01:00",countries:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"America/Managua":{name:"America/Managua",utcOffset:-360,offsetStr:"-06:00",countries:["NI"]},"Europe/Amsterdam":{name:"Europe/Amsterdam",utcOffset:60,offsetStr:"+01:00",countries:["NL"]},"Europe/Oslo":{name:"Europe/Oslo",utcOffset:60,offsetStr:"+01:00",countries:["NO","SJ"]},"Asia/Kathmandu":{name:"Asia/Kathmandu",utcOffset:345,offsetStr:"+05:45",countries:["NP"]},"Pacific/Nauru":{name:"Pacific/Nauru",utcOffset:720,offsetStr:"+12:00",countries:["NR"]},"Pacific/Niue":{name:"Pacific/Niue",utcOffset:-660,offsetStr:"-11:00",countries:["NU"]},"Pacific/Auckland":{name:"Pacific/Auckland",utcOffset:780,offsetStr:"+13:00",countries:["NZ","AQ"]},"Pacific/Chatham":{name:"Pacific/Chatham",utcOffset:825,offsetStr:"+13:45",countries:["NZ"]},"America/Panama":{name:"America/Panama",utcOffset:-300,offsetStr:"-05:00",countries:["PA"]},"America/Lima":{name:"America/Lima",utcOffset:-300,offsetStr:"-05:00",countries:["PE"]},"Pacific/Tahiti":{name:"Pacific/Tahiti",utcOffset:-600,offsetStr:"-10:00",countries:["PF"]},"Pacific/Marquesas":{name:"Pacific/Marquesas",utcOffset:-570,offsetStr:"-09:30",countries:["PF"]},"Pacific/Gambier":{name:"Pacific/Gambier",utcOffset:-540,offsetStr:"-09:00",countries:["PF"]},"Pacific/Port_Moresby":{name:"Pacific/Port_Moresby",utcOffset:600,offsetStr:"+10:00",countries:["PG"]},"Pacific/Bougainville":{name:"Pacific/Bougainville",utcOffset:660,offsetStr:"+11:00",countries:["PG"]},"Asia/Manila":{name:"Asia/Manila",utcOffset:480,offsetStr:"+08:00",countries:["PH"]},"Asia/Karachi":{name:"Asia/Karachi",utcOffset:300,offsetStr:"+05:00",countries:["PK"]},"Europe/Warsaw":{name:"Europe/Warsaw",utcOffset:60,offsetStr:"+01:00",countries:["PL"]},"America/Miquelon":{name:"America/Miquelon",utcOffset:-180,offsetStr:"-03:00",countries:["PM"]},"Pacific/Pitcairn":{name:"Pacific/Pitcairn",utcOffset:-480,offsetStr:"-08:00",countries:["PN"]},"America/Puerto_Rico":{name:"America/Puerto_Rico",utcOffset:-240,offsetStr:"-04:00",countries:["PR"]},"Asia/Gaza":{name:"Asia/Gaza",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},"Asia/Hebron":{name:"Asia/Hebron",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},"Europe/Lisbon":{name:"Europe/Lisbon",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},"Atlantic/Madeira":{name:"Atlantic/Madeira",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},"Atlantic/Azores":{name:"Atlantic/Azores",utcOffset:-60,offsetStr:"-01:00",countries:["PT"]},"Pacific/Palau":{name:"Pacific/Palau",utcOffset:540,offsetStr:"+09:00",countries:["PW"]},"America/Asuncion":{name:"America/Asuncion",utcOffset:-180,offsetStr:"-03:00",countries:["PY"]},"Asia/Qatar":{name:"Asia/Qatar",utcOffset:180,offsetStr:"+03:00",countries:["QA","BH"]},"Indian/Reunion":{name:"Indian/Reunion",utcOffset:240,offsetStr:"+04:00",countries:["RE","TF"]},"Europe/Bucharest":{name:"Europe/Bucharest",utcOffset:120,offsetStr:"+02:00",countries:["RO"]},"Europe/Belgrade":{name:"Europe/Belgrade",utcOffset:60,offsetStr:"+01:00",countries:["RS","BA","HR","ME","MK","SI"]},"Europe/Kaliningrad":{name:"Europe/Kaliningrad",utcOffset:120,offsetStr:"+02:00",countries:["RU"]},"Europe/Moscow":{name:"Europe/Moscow",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},"Europe/Simferopol":{name:"Europe/Simferopol",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},"Europe/Volgograd":{name:"Europe/Volgograd",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},"Europe/Samara":{name:"Europe/Samara",utcOffset:240,offsetStr:"+04:00",countries:["RU"]},"Asia/Yekaterinburg":{name:"Asia/Yekaterinburg",utcOffset:300,offsetStr:"+05:00",countries:["RU"]},"Asia/Omsk":{name:"Asia/Omsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},"Asia/Novosibirsk":{name:"Asia/Novosibirsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},"Asia/Novokuznetsk":{name:"Asia/Novokuznetsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},"Asia/Krasnoyarsk":{name:"Asia/Krasnoyarsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},"Asia/Irkutsk":{name:"Asia/Irkutsk",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},"Asia/Chita":{name:"Asia/Chita",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},"Asia/Yakutsk":{name:"Asia/Yakutsk",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},"Asia/Khandyga":{name:"Asia/Khandyga",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},"Asia/Vladivostok":{name:"Asia/Vladivostok",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},"Asia/Sakhalin":{name:"Asia/Sakhalin",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},"Asia/Ust-Nera":{name:"Asia/Ust-Nera",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},"Asia/Magadan":{name:"Asia/Magadan",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},"Asia/Srednekolymsk":{name:"Asia/Srednekolymsk",utcOffset:660,offsetStr:"+11:00",countries:["RU"]},"Asia/Kamchatka":{name:"Asia/Kamchatka",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},"Asia/Anadyr":{name:"Asia/Anadyr",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},"Asia/Riyadh":{name:"Asia/Riyadh",utcOffset:180,offsetStr:"+03:00",countries:["SA","KW","YE"]},"Pacific/Guadalcanal":{name:"Pacific/Guadalcanal",utcOffset:660,offsetStr:"+11:00",countries:["SB"]},"Indian/Mahe":{name:"Indian/Mahe",utcOffset:240,offsetStr:"+04:00",countries:["SC"]},"Africa/Khartoum":{name:"Africa/Khartoum",utcOffset:180,offsetStr:"+03:00",countries:["SD","SS"]},"Europe/Stockholm":{name:"Europe/Stockholm",utcOffset:60,offsetStr:"+01:00",countries:["SE"]},"Asia/Singapore":{name:"Asia/Singapore",utcOffset:480,offsetStr:"+08:00",countries:["SG"]},"America/Paramaribo":{name:"America/Paramaribo",utcOffset:-180,offsetStr:"-03:00",countries:["SR"]},"America/El_Salvador":{name:"America/El_Salvador",utcOffset:-360,offsetStr:"-06:00",countries:["SV"]},"Asia/Damascus":{name:"Asia/Damascus",utcOffset:120,offsetStr:"+02:00",countries:["SY"]},"America/Grand_Turk":{name:"America/Grand_Turk",utcOffset:-240,offsetStr:"-04:00",countries:["TC"]},"Africa/Ndjamena":{name:"Africa/Ndjamena",utcOffset:60,offsetStr:"+01:00",countries:["TD"]},"Indian/Kerguelen":{name:"Indian/Kerguelen",utcOffset:300,offsetStr:"+05:00",countries:["TF"]},"Asia/Bangkok":{name:"Asia/Bangkok",utcOffset:420,offsetStr:"+07:00",countries:["TH","KH","LA","VN"]},"Asia/Dushanbe":{name:"Asia/Dushanbe",utcOffset:300,offsetStr:"+05:00",countries:["TJ"]},"Pacific/Fakaofo":{name:"Pacific/Fakaofo",utcOffset:780,offsetStr:"+13:00",countries:["TK"]},"Asia/Dili":{name:"Asia/Dili",utcOffset:540,offsetStr:"+09:00",countries:["TL"]},"Asia/Ashgabat":{name:"Asia/Ashgabat",utcOffset:300,offsetStr:"+05:00",countries:["TM"]},"Africa/Tunis":{name:"Africa/Tunis",utcOffset:60,offsetStr:"+01:00",countries:["TN"]},"Pacific/Tongatapu":{name:"Pacific/Tongatapu",utcOffset:780,offsetStr:"+13:00",countries:["TO"]},"Europe/Istanbul":{name:"Europe/Istanbul",utcOffset:120,offsetStr:"+02:00",countries:["TR"]},"America/Port_of_Spain":{name:"America/Port_of_Spain",utcOffset:-240,offsetStr:"-04:00",countries:["TT","AG","AI","BL","DM","GD","GP","KN","LC","MF","MS","VC","VG","VI"]},"Pacific/Funafuti":{name:"Pacific/Funafuti",utcOffset:720,offsetStr:"+12:00",countries:["TV"]},"Asia/Taipei":{name:"Asia/Taipei",utcOffset:480,offsetStr:"+08:00",countries:["TW"]},"Europe/Kiev":{name:"Europe/Kiev",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},"Europe/Uzhgorod":{name:"Europe/Uzhgorod",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},"Europe/Zaporozhye":{name:"Europe/Zaporozhye",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},"Pacific/Wake":{name:"Pacific/Wake",utcOffset:720,offsetStr:"+12:00",countries:["UM"]},"America/New_York":{name:"America/New_York",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Detroit":{name:"America/Detroit",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Kentucky/Louisville":{name:"America/Kentucky/Louisville",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Kentucky/Monticello":{name:"America/Kentucky/Monticello",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Indianapolis":{name:"America/Indiana/Indianapolis",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Vincennes":{name:"America/Indiana/Vincennes",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Winamac":{name:"America/Indiana/Winamac",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Marengo":{name:"America/Indiana/Marengo",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Petersburg":{name:"America/Indiana/Petersburg",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Indiana/Vevay":{name:"America/Indiana/Vevay",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},"America/Chicago":{name:"America/Chicago",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/Indiana/Tell_City":{name:"America/Indiana/Tell_City",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/Indiana/Knox":{name:"America/Indiana/Knox",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/Menominee":{name:"America/Menominee",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/North_Dakota/Center":{name:"America/North_Dakota/Center",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/North_Dakota/New_Salem":{name:"America/North_Dakota/New_Salem",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/North_Dakota/Beulah":{name:"America/North_Dakota/Beulah",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},"America/Denver":{name:"America/Denver",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},"America/Boise":{name:"America/Boise",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},"America/Phoenix":{name:"America/Phoenix",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},"America/Los_Angeles":{name:"America/Los_Angeles",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},"America/Metlakatla":{name:"America/Metlakatla",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},"America/Anchorage":{name:"America/Anchorage",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},"America/Juneau":{name:"America/Juneau",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},"America/Sitka":{name:"America/Sitka",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},"America/Yakutat":{name:"America/Yakutat",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},"America/Nome":{name:"America/Nome",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},"America/Adak":{name:"America/Adak",utcOffset:-600,offsetStr:"-10:00",countries:["US"]},"Pacific/Honolulu":{name:"Pacific/Honolulu",utcOffset:-600,offsetStr:"-10:00",countries:["US","UM"]},"America/Montevideo":{name:"America/Montevideo",utcOffset:-180,offsetStr:"-03:00",countries:["UY"]},"Asia/Samarkand":{name:"Asia/Samarkand",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},"Asia/Tashkent":{name:"Asia/Tashkent",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},"America/Caracas":{name:"America/Caracas",utcOffset:-270,offsetStr:"-04:30",countries:["VE"]},"Asia/Ho_Chi_Minh":{name:"Asia/Ho_Chi_Minh",utcOffset:420,offsetStr:"+07:00",countries:["VN"]},"Pacific/Efate":{name:"Pacific/Efate",utcOffset:660,offsetStr:"+11:00",countries:["VU"]},"Pacific/Wallis":{name:"Pacific/Wallis",utcOffset:720,offsetStr:"+12:00",countries:["WF"]},"Pacific/Apia":{name:"Pacific/Apia",utcOffset:840,offsetStr:"+14:00",countries:["WS"]},"Africa/Johannesburg":{name:"Africa/Johannesburg",utcOffset:120,offsetStr:"+02:00",countries:["ZA","LS","SZ"]}}}],templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}}angular.module("app.core").directive("msTimezone",e)}(),function(){"use strict";function e(e,t){function n(){a()&&(i.flipped=!i.flipped,t.toggleClass("flipped",i.flipped))}function a(){return angular.isDefined(e.flippable)&&!0===e.flippable}var i=this;i.flipped=!1,i.flip=n}function t(){return{restrict:"E",scope:{flippable:"=?"},controller:"MsWidgetController",transclude:!0,compile:function(e){return e.addClass("ms-widget"),function(e,t,n,a,i){i(function(e){t.empty(),t.append(e)})}}}}function n(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,t,n,a,i){i(function(e){t.empty(),t.append(e)}),e.flipWidget=a.flip}}}}function a(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-back"),function(e,t,n,a,i){i(function(e){t.empty(),t.append(e)}),e.flipWidget=a.flip}}}}e.$inject=["$scope","$element"],angular.module("app.core").controller("MsWidgetController",e).directive("msWidget",t).directive("msWidgetFront",n).directive("msWidgetBack",a)}(),function(){"use strict";function e(){return function(e){var t=Date.now()-new Date(e);return t<36e5?moment(e).fromNow():t<864e5?moment(e).format("HH:mm"):t<6048e5?moment(e).format("dddd"):moment(e).calendar()}}angular.module("app.core").filter("altDate",e)}(),function(){"use strict";function e(e){return function(t){return e.trustAsHtml(t)}}function t(){return function(e){return String(e).replace(/<[^>]+>/gm,"")}}function n(){return function(e){return e?e.replace(/ /g,""):""}}function a(){return function(e){if(e)return"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name}}e.$inject=["$sce"],angular.module("app.core").filter("toTrusted",e).filter("htmlToPlaintext",t).filter("nospace",n).filter("humanizeDoc",a)}(),function(){"use strict";function e(){return function(e,t){if(0===e.length||!t)return e;if(0===t.length)return[];for(var n=[],a=0;a-1){s=!0;break}}s&&a.push(o)}return a}}angular.module("app.core").filter("filterByPropIds",e)}(),function(){"use strict";function e(){return function(e,t){if(0===e.length||0===t.length)return e;var n=[];return e.forEach(function(e){t.every(function(t){var n=!1;return e.tags.forEach(function(e){e.name!==t.name||(n=!0)}),n})&&n.push(e)}),n}}function t(){return function(e,t){if(0!==e.length&&0!==t.length){if(e.length-1}function n(){function t(e){for(var t=0;t');i.html(n),a.append(i)}function s(e,n){var a=n||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),a&&(e=r(e,a)),3===e.length?"rgb("+e.join(",")+")":4===e.length?"rgba("+e.join(",")+")":void t.error("Invalid number of arguments supplied in the color array: "+e.length+"\nThe array must have 3 or 4 colors.")}function r(e,t){var n={white:{1:"1",2:"0.7",3:"0.3",4:"0.12"},black:{1:"0.87",2:"0.54",3:"0.26",4:"0.12"}};return 255===e[0]&&255===e[1]&&255===e[2]?e[3]=n.white[t]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=n.black[t]),e}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}var d={};return{generate:a,rgba:s}}e.$inject=["$cookies","$log","motionTheming"],angular.module("app.core").factory("motionGenerator",e)}(),function(){"use strict";var e=[{name:"motion-blue",options:{50:"#ebf1fa",100:"#c2d4ef",200:"#9ab8e5",300:"#78a0dc",400:"#5688d3",500:"#3470ca",600:"#2e62b1",700:"#275498",800:"#21467e",900:"#1a3865",A100:"#c2d4ef",A200:"#9ab8e5",A400:"#5688d3",A700:"#275498",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}},{name:"motion-paleblue",options:{50:"#ececee",100:"#c5c6cb",200:"#9ea1a9",300:"#7d818c",400:"#5c616f",500:"#3c4252",600:"#353a48",700:"#2d323e",800:"#262933",900:"#1e2129",A100:"#c5c6cb",A200:"#9ea1a9",A400:"#5c616f",A700:"#2d323e",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}}];angular.module("app.core").constant("motionPalettes",e)}(),function(){"use strict";var e={default:{primary:{name:"motion-paleblue",hues:{default:"700","hue-1":"500","hue-2":"600","hue-3":"400"}},accent:{name:"light-blue",hues:{default:"600","hue-1":"400","hue-2":"700","hue-3":"A100"}},warn:{name:"red"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},pinkTheme:{primary:{name:"blue-grey",hues:{default:"800","hue-1":"600","hue-2":"400","hue-3":"A100"}},accent:{name:"pink",hues:{default:"400","hue-1":"300","hue-2":"600","hue-3":"A100"}},warn:{name:"blue"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},tealTheme:{primary:{name:"motion-blue",hues:{default:"900","hue-1":"600","hue-2":"500","hue-3":"A100"}},accent:{name:"teal",hues:{default:"500","hue-1":"400","hue-2":"600","hue-3":"A100"}},warn:{name:"deep-orange"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}}};angular.module("app.core").constant("motionThemes",e)}(),function(){"use strict";function e(e,t,n){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(n.custom=i),e.alwaysWatchTheme(!0),angular.forEach(t,function(t){e.definePalette(t.name,t.options)}),angular.forEach(n,function(t,n){e.theme(n).primaryPalette(t.primary.name,t.primary.hues).accentPalette(t.accent.name,t.accent.hues).warnPalette(t.warn.name,t.warn.hues).backgroundPalette(t.background.name,t.background.hues)})}e.$inject=["$mdThemingProvider","motionPalettes","motionThemes"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,t,n){function a(){return n.PALETTES}function i(){return n.THEMES}function o(n){if(angular.isUndefined(r.themes.list[n]))return angular.isUndefined(r.themes.list.default)?void t.error('You must have at least one theme named "default"'):(t.warn('The theme "'+n+'" does not exist! Falling back to the "default" theme.'),r.themes.active.name="default",r.themes.active.theme=r.themes.list.default,void e.put("motion.selectedTheme",r.themes.active.name));r.themes.active.name=n,r.themes.active.theme=r.themes.list[n],e.put("motion.selectedTheme",n)}function s(e){r.themes.list=e}var r={getRegisteredPalettes:a,getRegisteredThemes:i,setActiveTheme:o,setThemesList:s,themes:{list:{},active:{name:"",theme:{}}}};return r}e.$inject=["$cookies","$log","$mdTheming"],angular.module("app.core").service("motionTheming",e)}(),function(){"use strict";function e(e,t,n,a){function i(e){for(var i=[],o=a.getFlatNavigation(),s=n.defer(),r=0;r-1)return!0})),t(function(){s.resolve(i)},1e3),s.promise}function o(t){t.uisref&&(t.stateParams?e.go(t.state,t.stateParams):e.go(t.state))}var s=this;s.search=i,s.searchResultClick=o}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,t){function n(){t.post("/api/jira",a.error).then(function(e){a.send=!0,e.data&&(a.code=e.data.id)},function(e){a.send=!1})}var a=this;a.code="",a.send=!1,a.error=e.params,a.sendReport=n}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e){var t={};return t.baseUrl="api/",t.auth=e(t.baseUrl+"auth/local",{},{local:{method:"post",url:t.baseUrl+"auth/local"},google:{method:"post",url:t.baseUrl+"auth/google"}}),t.jira=e(t.baseUrl+"jira"),t.rpc=e(t.baseUrl+"rpc",{},{getVoiceQueues:{method:"get",url:t.baseUrl+"rpc/voice/queues"},getVoiceQueuesChannels:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:t.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:t.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:t.baseUrl+"rpc/agents"},getTelephones:{method:"get",url:t.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:t.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:t.baseUrl+"rpc/campaigns"}}),t.version=e(t.baseUrl+"version",{},{fetch:{method:"get",url:t.baseUrl+"version/fetch"},reset:{method:"get",url:t.baseUrl+"version/reset"},pull:{method:"get",url:t.baseUrl+"version/pull"},restart:{method:"get",url:t.baseUrl+"version/restart"},migrations:{method:"get",url:t.baseUrl+"version/migrations"}}),t.system=e(t.baseUrl+"system"),t.pm2=e(t.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),t.user=e(t.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"users/describe"},bulkCreate:{method:"post",url:t.baseUrl+"users/create_many",isArray:!0},bulkDestroy:{method:"delete",url:t.baseUrl+"users/destroy_many",isArray:!0},addContacts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/contacts"},changePassword:{isArray:!1,method:"put",url:t.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/avatar"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues_rt"},getRecordings:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/recordings"},login:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/unpause"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/lists"}}),t.voiceChanSpy=e(t.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/chanspy/describe"}}),t.voiceContext=e(t.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/contexts/describe"}}),t.voiceDisposition=e(t.baseUrl+"voice/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/dispositions/describe"}}),t.voiceExtension=e(t.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/extensions/describe"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"voice/extensions/:id/applications"}}),t.voiceMusicOnHold=e(t.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mohs/describe"},addSound:{isArray:!1,method:"post",url:t.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:t.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:t.baseUrl+"voice/mohs/:id/sounds"}}),t.voiceQueue=e(t.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/describe"},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/lists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/black_lists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/black_lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/blacklists"}}),t.voiceRecording=e(t.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/recordings/describe"},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/recordings/:id/download"}}),t.voiceMail=e(t.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/describe"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/:id/messages"}}),t.voiceMailMessage=e(t.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/messages/describe"},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/messages/:id/download"}}),t.voiceCallReport=e(t.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/calls/reports/describe"}}),t.voiceDialReport=e(t.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/dials/reports/describe"}}),t.voiceAgentReport=e(t.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/agents/reports/describe"}}),t.voiceQueueReport=e(t.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/reports/describe"}}),t.memberReport=e(t.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"members/reports/describe"}}),t.trunk=e(t.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"trunks/describe"}}),t.voiceTransferReport=e(t.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/transfers/reports/describe"}}),t.mailServerOut=e(t.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/out_servers/describe"}}),t.mailAccount=e(t.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/accounts/describe"},getImap:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/applications"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/dispositions"},addDispositions:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/dispositions"},sendMail:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/verify"}}),t.mailQueue=e(t.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/queues/describe"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/users"}}),t.mailInteraction=e(t.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/interactions/describe"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"mail/interactions/:id/messages"}}),t.mailMessage=e(t.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/messages/describe"}}),t.mailApplication=e(t.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/applications/describe"}}),t.mailDisposition=e(t.baseUrl+"mail/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/dispositions/describe"}}),t.mailAttachment=e(t.baseUrl+"mail/attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/attachments/describe"}}),t.mailSessionReport=e(t.baseUrl+"mail/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/sessions/reports/describe"}}),t.mailReport=e(t.baseUrl+"mail/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/reports/describe"}}),t.openchannelSessionReport=e(t.baseUrl+"openchannel/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/sessions/reports/describe"}}),t.dashboard=e(t.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/describe"},run:{isArray:!1,method:"get",url:t.baseUrl+"dashboards/:id/run"},addItem:{isArray:!1,method:"post",url:t.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:t.baseUrl+"dashboards/:id/items"}}),t.dashboardItem=e(t.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/items/describe"}}),t.faxAccount=e(t.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/accounts/describe"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/applications"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/dispositions"},addDispositions:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/dispositions"}}),t.faxApplication=e(t.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/applications/describe"}}),t.faxDisposition=e(t.baseUrl+"fax/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/dispositions/describe"}}),t.faxAttachment=e(t.baseUrl+"fax/attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/attachments/describe"}}),t.faxInteraction=e(t.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/interactions/describe"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"fax/interactions/:id/messages"}}),t.faxMessage=e(t.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/messages/describe"}}),t.faxQueue=e(t.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/queues/describe"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/users"}}),t.faxSessionReport=e(t.baseUrl+"fax/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/sessions/reports/describe"}}),t.smsAccount=e(t.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/accounts/describe"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/applications"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/dispositions"},addDispositions:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/dispositions"}}),t.smsApplication=e(t.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/applications/describe"}}),t.smsDisposition=e(t.baseUrl+"sms/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/dispositions/describe"}}),t.smsInteraction=e(t.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/interactions/describe"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"sms/interactions/:id/messages"}}),t.smsMessage=e(t.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/messages/describe"}}),t.smsQueue=e(t.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/queues/describe"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/users"}}),t.openchannelAccount=e(t.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/accounts/describe"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/applications"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},addDispositions:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/dispositions"}}),t.openchannelApplication=e(t.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/applications/describe"}}),t.openchannelDisposition=e(t.baseUrl+"openchannel/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/dispositions/describe"}}),t.openchannelInteraction=e(t.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/interactions/describe"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/interactions/:id/messages"}}),t.openchannelMessage=e(t.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/messages/describe"}}),t.openchannelQueue=e(t.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/queues/describe"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/users"}}),t.chatWebsite=e(t.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/websites/describe"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/applications"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/dispositions"},addDispositions:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/dispositions"},addProactiveActions:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/proactive_actions"},addWebsiteFields:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/fields"},getWebsiteFields:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/fields"}}),t.openchannelReport=e(t.baseUrl+"openchannel/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/reports/describe"}}),t.chatApplication=e(t.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/applications/describe"}}),t.chatDisposition=e(t.baseUrl+"chat/dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/dispositions/describe"}}),t.chatInteraction=e(t.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/interactions/describe"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/messages"}}),t.chatMessage=e(t.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/messages/describe"}}),t.chatQueue=e(t.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/queues/describe"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/users"}}),t.chatEnquiry=e(t.baseUrl+"chat/enquiries/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/enquiries/describe"}}),t.chatProactiveAction=e(t.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/proactive_actions/describe"}}),t.chatVisitor=e(t.baseUrl+"chat/visitors/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/visitors/describe"}}),t.chatWebsiteField=e(t.baseUrl+"chat/website_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/website_fields/describe"}}),t.cmCompany=e(t.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/companies/describe"},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/companies/:id/contacts"}}),t.cmContact=e(t.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/contacts/describe"},bulkCreate:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/create_many"}}),t.cmHopper=e(t.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper/describe"},getDialerContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/hopper/preview"},callDialerContact:{isArray:!1,method:"get",url:t.baseUrl+"cm/hopper/preview/:id"}}),t.cmHopperBlack=e(t.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_black/describe"}}),t.cmHopperFinal=e(t.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_final/describe"}}),t.cmHopperHistory=e(t.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_history/describe"}}),t.cmCustomField=e(t.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/custom_fields/describe"}}),t.cmList=e(t.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/lists/describe"},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:t.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/contacts/csv"},addCustomField:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/fields"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/users"}}),t.action=e(t.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"actions/describe"}}),t.automation=e(t.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"automations/describe"},addConditions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/actions"}}),t.cannedAnswer=e(t.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"canned_answers/describe"}}),t.condition=e(t.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"conditions/describe"}}),t.interval=e(t.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"intervals/describe"},addInterval:{isArray:!1,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:t.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals/create_many"}}),t.pause=e(t.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"pauses/describe"}}),t.cdr=e(t.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cdr/describe"}}),t.voiceQueuesLog=e(t.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voiceQueuesLog/describe"}}),t.schedule=e(t.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"schedules/describe"}}),t.sound=e(t.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sounds/describe"},download:{isArray:!1,method:"get",url:t.baseUrl+"sounds/:id/download"},delete:{isArray:!1,method:"delete",url:t.baseUrl+"sounds/:id"}}),t.tag=e(t.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"tags/describe"}}),t.template=e(t.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"templates/describe"}}),t.trigger=e(t.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"triggers/describe"},addAllCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/actions"}}),t.variable=e(t.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"variables/describe"}}),t.integration=e(t.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/describe"}}),t.integrationReport=e(t.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/reports/describe"}}),t.analyticCustomReport=e(t.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/custom_reports/describe"},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/query"}}),t.analyticDefaultReport=e(t.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/default_reports/describe"},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/query"}}),t.analyticExtractedReport=e(t.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/extracted_reports/describe"},download:{isArray:!1,method:"get",url:t.baseUrl+"analytics/extracted_reports/:id/download"}}),t.analyticMetric=e(t.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/metrics/describe"}}),t.analyticFieldReport=e(t.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/field_reports/describe"},bulkCreate:{method:"post",url:t.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:t.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:t.baseUrl+"analytics/field_reports/:id/create_many"}}),t.analyticTreeReport=e(t.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/tree_reports/describe"}}),t.intSalesforceAccount=e(t.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/accounts/describe"},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),t.intSalesforceConfiguration=e(t.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/configurations/describe"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),t.intSalesforceField=e(t.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/fields/describe"}}),t.intSugarcrmAccount=e(t.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/describe"},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),t.intSugarcrmConfiguration=e(t.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/describe"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),t.intSugarcrmField=e(t.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/fields/describe"}}),t.intZendeskAccount=e(t.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/accounts/describe"},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),t.intZendeskConfiguration=e(t.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/configurations/describe"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),t.intZendeskField=e(t.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/fields/describe"}}),t.intFreshdeskAccount=e(t.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/describe"},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),t.intFreshdeskConfiguration=e(t.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/describe"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),t.intFreshdeskField=e(t.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/fields/describe"}}),t.network=e(t.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"networks/describe"}}),t.chatReport=e(t.baseUrl+"chat/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/reports/describe"}}),t.chatSessionReport=e(t.baseUrl+"chat/session/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/session/reports/describe"}}),t.faxReport=e(t.baseUrl+"fax/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/reports/describe"}}),t.jscriptyInputReport=e(t.baseUrl+"jscripty/inputs/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/inputs/reports/describe"}}),t.jscriptyQuestionReport=e(t.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/questions/reports/describe"}}),t.jscriptySessionReport=e(t.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/sessions/reports/describe"}}),t.smsReport=e(t.baseUrl+"sms/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/reports/describe"}}),t.smsSessionReport=e(t.baseUrl+"sms/session/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/session/reports/describe"}}),t.squareReport=e(t.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/reports/describe"}}),t.squareReportDetail=e(t.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/details/reports/describe"}}),t.jscriptyProject=e(t.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/projects/describe"}}),t.setting=e(t.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"settings/describe"},addLogo:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo_login"}}),t.squareOdbc=e(t.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/odbc/describe"},test:{isArray:!1,method:"get",url:t.baseUrl+"square/odbc/:id/test"}}),t.squareProject=e(t.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/projects/describe"}}),t.squareRecording=e(t.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/recordings/describe"},download:{isArray:!1,method:"get",url:t.baseUrl+"square/recordings/:id/download"}}),t.team=e(t.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"teams/describe"},getQueues:{isArray:!0,method:"get",url:t.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"teams/:id/users"}}),t.license=e(t.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"license/describe"}}),t.campaign=e(t.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"campaigns/describe"},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/blacklists"}}),t}e.$inject=["$resource"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,t,n){n.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("en"),e.useSanitizeValueStrategy("sanitize"),t.decorator("taOptions",["$delegate",function(e){return e.toolbar=[["bold","italics","underline","ul","ol","quote","justifyLeft","justifyCenter","justifyRight","html","insertImage","insertLink"]],e.classes={focussed:"focussed",toolbar:"ta-toolbar",toolbarGroup:"ta-group",toolbarButton:"md-button",toolbarButtonActive:"active",disabled:"",textEditor:"form-control",htmlEditor:"form-control"},e}]),t.decorator("taTools",["$delegate",function(e){return e.quote.iconclass="icon-format-quote",e.bold.iconclass="icon-format-bold",e.italics.iconclass="icon-format-italic",e.underline.iconclass="icon-format-underline",e.strikeThrough.iconclass="icon-format-strikethrough",e.ul.iconclass="icon-format-list-bulleted",e.ol.iconclass="icon-format-list-numbers",e.redo.iconclass="icon-redo",e.undo.iconclass="icon-undo",e.clear.iconclass="icon-close-circle-outline",e.justifyLeft.iconclass="icon-format-align-left",e.justifyCenter.iconclass="icon-format-align-center",e.justifyRight.iconclass="icon-format-align-right",e.justifyFull.iconclass="icon-format-align-justify",e.indent.iconclass="icon-format-indent-increase",e.outdent.iconclass="icon-format-indent-decrease",e.html.iconclass="icon-code-tags",e.insertImage.iconclass="icon-file-image-box",e.insertLink.iconclass="icon-link",e.insertVideo.iconclass="icon-filmstrip",e}])}e.$inject=["$translateProvider","$provide","toastyConfigProvider"],angular.module("motion").config(e)}(),function(){"use strict";angular.module("motion")}(),function(){"use strict";function e(e){this.themes=e.themes}e.$inject=["motionTheming"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(){return function(e,t,n){var a,i={},o=0;for(a in e)if(o>=n&&(i[a]=e[a]),++o===n+t)break;return i}}function t(){var e=[{value:"jan"},{value:"feb"},{value:"mar"},{value:"apr"},{value:"may"},{value:"jun"},{value:"jul"},{value:"aug"},{value:"sep"},{value:"oct"},{value:"nov"},{value:"dec"}],t=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],n=[{value:"mon"},{value:"tue"},{value:"wed"},{value:"thu"},{value:"fri"},{value:"sat"},{value:"sun"}],a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];return{getMonthName:function(){return e},getMonthNumber:function(){return t},getDaysOfWeek:function(){return n},getDaysOfMonth:function(){return a}}}angular.module("motion").filter("limitObjectFromTo",e).factory("IndexFactory",t)}(),function(){"use strict";function e(e,t,n){n.html5Mode(!0),t.otherwise("/dashboards/general");var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.get("motion.layoutStyle")||"verticalNavigation",o={verticalNavigation:{main:"app/core/layouts/vertical-navigation.html",toolbar:"app/toolbar/layouts/vertical-navigation/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar2:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar-2/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html"},horizontalNavigation:{main:"app/core/layouts/horizontal-navigation.html",toolbar:"app/toolbar/layouts/horizontal-navigation/toolbar.html",navigation:"app/navigation/layouts/horizontal-navigation/navigation.html"},contentOnly:{main:"app/core/layouts/content-only.html",toolbar:"",navigation:""},contentWithToolbar:{main:"app/core/layouts/content-with-toolbar.html",toolbar:"app/toolbar/layouts/content-with-toolbar/toolbar.html",navigation:""}};e.state("app",{abstract:!0,views:{"main@":{templateUrl:o[i].main,controller:"MainController as vm"},"toolbar@app":{templateUrl:o[i].toolbar,controller:"ToolbarController as vm"},"navigation@app":{templateUrl:o[i].navigation,controller:"NavigationController as vm"},"quickPanel@app":{templateUrl:"app/quick-panel/quick-panel.html",controller:"QuickPanelController as vm"}},resolve:{license:["apiResolver",function(e){return e.resolve("license@get")}],setting:["apiResolver",function(e){return e.resolve("setting@get",{id:1})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,t,n){var a=e.$on("$stateChangeStart",function(){e.loadingProgress=!0}),i=e.$on("$stateChangeSuccess",function(){t(function(){e.loadingProgress=!1})});e.state=n,e.$on("$destroy",function(){a(),i()})}e.$inject=["$rootScope","$timeout","$state"],angular.module("motion").run(e)}(),function(){"use strict";function e(e,t){function n(){a=io({query:"id="+t.getCurrentUser().id,transports:["websocket","polling"]})}var a;return{connect:n,on:function(t,i){i=i||angular.noop,a||n(),a.on(t,function(){var t=arguments;e.$apply(function(){i.apply(a,t)})})},emit:function(t,i,o){o=o||angular.noop,a||n(),a.emit(t,i,function(){var t=arguments;e.$apply(function(){o.apply(a,t)})})},removeAllListeners:function(e){a||n(),a.removeAllListeners(e)},disconnect:function(){a||n(),a.disconnect()}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(){i.isLoggedIn()&&e.go("app.dashboards.general")}function s(){return i.login(l.form).then(function(){return e.go("app.dashboards.general")}).catch(function(e){l.message=e.message})}function r(e){t.location.href="/api/auth/"+e}var l=this;l.login=s,l.loginOauth=r,l.$onInit=o}e.$inject=["$state","$window","$cookies","api","Auth"],angular.module("app.login").controller("LoginController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.analyticExtractedReport.save(p.extractedReport).$promise.then(function(e){p.extractedReports.unshift(e),i.success({title:"ExtractedReport properly created",msg:p.extractedReport.name?p.extractedReport.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.save"}];for(var t=0;t"+(e.name||"extractedReport")+" will be deleted.").ariaLabel("delete extractedReport").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})}function g(e){C.extractedReports=e||{count:0,rows:[]}}function h(){C.query.offset=(C.query.page-1)*C.query.limit,C.promise=l.analyticExtractedReport.get(C.query,g).$promise}function v(e,t){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{extractedReport:t,extractedReports:C.extractedReports.rows}})}function b(e){l.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(C.extractedReports.rows,{id:e.id}),C.extractedReports.count-=1,C.extractedReports.rows.length||C.getExtractedReports(),c.success({title:"ExtractedReport deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticExtractedReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(){var e=_.clone(C.selectedExtractedReports);return C.selectedExtractedReports=[],e}function E(e){var t=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent(""+C.selectedExtractedReports.length+" selected will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){C.selectedExtractedReports.forEach(function(e){b(e)}),C.selectedExtractedReports=[]})}function y(){C.selectedExtractedReports=[]}function A(){C.selectedExtractedReports=C.extractedReports.rows}var C=this;C.extractedReports=r||{count:0,rows:[]},C.table="extractedReports",C.listOrder="",C.listOrderAsc=null,C.selectedExtractedReports=[],C.query={fields:"createdAt,updatedAt,id,name,type,startDate,endDate,createdAt,status,output",sort:"-updatedAt",limit:10,page:1},C.editdialog=m,C.downloadfile=u,C.deleteconfirm=p,C.success=g,C.getExtractedReports=h,C.createOrEditExtractedReport=v,C.deleteExtractedReport=b,C.exportSelectedExtractedReports=f,C.deleteSelectedExtractedReports=E,C.deselectExtractedReports=y,C.selectAllExtractedReports=A;var x=!0,T=1;e.$watch("vm.query.filter",function(e,t){x?s(function(){x=!1}):(t||(T=C.query.page),e!==t&&(C.query.page=1),e||(C.query.page=T),C.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","extractedReports","api","msUtils","toasty"],angular.module("app.analytics").controller("ExtractedReportsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.analyticMetric.save(p.metric).$promise.then(function(e){p.metrics.unshift(e),i.success({title:"Metric properly created",msg:p.metric.name?p.metric.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.save"}];for(var t=0;t"+(e.name||"metric")+" will be deleted.").ariaLabel("delete metric").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.metrics=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.analyticMetric.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{metric:t,metrics:A.metrics.rows}})}function v(e){l.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(A.metrics.rows,{id:e.id}),A.metrics.count-=1,A.metrics.rows.length||A.getMetrics(),c.success({title:"Metric deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticMetric",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedMetrics);return A.selectedMetrics=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent(""+A.selectedMetrics.length+" selected will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedMetrics.forEach(function(e){v(e)}),A.selectedMetrics=[]})}function E(){A.selectedMetrics=[]}function y(){A.selectedMetrics=A.metrics.rows}var A=this;A.metrics=r||{count:0,rows:[]},A.table="metrics",A.listOrder="",A.listOrderAsc=null,A.selectedMetrics=[],A.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},A.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"Chat Messages",value:"'chat_messages'"},{option:"Chat Rooms",value:"'chat_rooms'"},{option:"Chat Session Report",value:"'report_chat_session'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Fax Messages",value:"'fax_messages'"},{option:"Fax Rooms",value:"'fax_rooms'"},{option:"Fax Session Report",value:"'report_fax_session'"},{option:"Integration Report",value:"'report_integration'"},{option:"Mail Messages",value:"'mail_messages'"},{option:"Mail Rooms",value:"'mail_rooms'"},{option:"Mail Session Report",value:"'report_mail_session'"},{option:"Member Report",value:"'report_member'"},{option:"Open Channel Messages",value:"'openchannel_messages'"},{option:"Open Channel Rooms",value:"'openchannel_rooms'"},{option:"Open Channel Session Report",value:"'report_openchannel_session'"},{option:"Queue Report",value:"'report_queue'"},{option:"Sms Messages",value:"'sms_messages'"},{option:"Sms Rooms",value:"'sms_rooms'"},{option:"Sms Session Report",value:"'report_sms_session'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getMetrics=g,A.createOrEditMetric=h,A.deleteMetric=v,A.exportSelectedMetrics=b,A.deleteSelectedMetrics=f,A.deselectMetrics=E,A.selectAllMetrics=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","metrics","api","msUtils","toasty"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s){function r(){c.errors=[];var e;i.analyticCustomReport.save({name:c.report.name,description:c.report.description,table:c.report.table,conditions:c.report.conditions,parent:c.currentNode.id}).$promise.then(function(t){e=t,n.success({title:"Report properly copied!",msg:c.report.name?c.report.name+" has been copied!":""});var a={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return a["analyticCustomReport"===o?"CustomReportId":"DefaultReportId"]=c.report.id,i.analyticFieldReport.get(a).$promise}).then(function(t){var t=_.map(t.rows,function(t){return _.extend({},t,{CustomReportId:e.id})});return i.analyticFieldReport.bulkCreate(t).$promise}).then(function(){n.success({title:"Fields copied!",msg:"Fields has been copied!"}),d()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:COPYREPORT",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function l(e,t){c.currentNode=t.node}function d(){t.hide()}var c=this;c.errors=[],c.report=angular.copy(a),c.report.name+="-copy",c.treeCustomData=s,c.treeCustomConfig={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},c.treeCustomEvents={select_node:l},c.copyReport=r,c.closeDialog=d}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","treeCustomData"],angular.module("app.analytics").controller("CopyReportDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){u.errors=[],o[s].save(u.report).$promise.then(function(e){u.reports.unshift(e),n.success({title:"Report properly created",msg:u.report.name?u.report.name+" has been created!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.save"}];for(var t=0;t"+e.field+" will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");a.show(n).then(function(){h(e)},function(){console.log("CANCEL")})}function u(e){E.reportFields=e||{count:0,rows:[]}}function p(){E.promise=s.analyticFieldReport.get(E.query,u).$promise}function g(e,t){a.show({controller:"CreateOrEditReportFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/edit/field/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:E.report,reportField:t,reportFields:E.reportFields.rows,metrics:E.metrics,columns:E.columns}})}function h(e){s.analyticFieldReport.delete({id:e.id}).$promise.then(function(){E.selectedReportFields=[],_.remove(E.reportFields.rows,{id:e.id}),E.reportFields.count-=1,E.reportFields.rows.length||E.getReportFields(),o.success({title:"Field deleted!",msg:e.field?e.field+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(e){var t=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent(""+E.selectedReportFields.length+" selected will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){E.selectedReportFields.forEach(function(e){h(e)}),E.selectedReportFields=[]})}function b(e){var t=_.find(E.metrics,{id:e});return t?t.name:d.instant("ANALYTICS.NO_METRIC_FOUND")}function f(e){var t=_.find(E.metrics,{id:e});return t?t.metric:d.instant("ANALYTICS.NO_METRIC_FOUND")}var E=this;E.report={},E.reportFields={count:0,rows:[]},E.functions=_.keyBy(l.getFunctions,"value"),E.formats=_.keyBy(l.getFormats,"value"),E.groupBy=_.keyBy(l.getGroupBy,"value"),E.orderBy=_.keyBy(l.getOrderBy,"value"),E.selectedReportFields=[],E.query={fields:"createdAt,updatedAt,id,field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0},E.sortableTable={animation:100,onSort:function(e){s.analyticFieldReport.addFields({id:E.report.id},e.models).$promise.then(function(e){E.reportFields.rows=e}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDFIELDS"})})}},E.init=c,E.deleteConfirm=m,E.success=u,E.getReportFields=p,E.createOrEditReportField=g,E.deleteReportField=h,E.deleteSelectedReportFields=v,E.getMetricName=b,E.getMetricValue=f;var y=!0;t.$watch("vm_rf.query.filter",function(e,t){y?n(function(){y=!1}):E.getReportFields()})}e.$inject=["$cookies","$scope","$timeout","$mdDialog","$document","toasty","api","describeTable","sqlUtil","$translate"],angular.module("app.analytics").controller("ReportFieldsController",e)}(),function(){"use strict";function e(){return{getFunctions:[{value:"SUM",option:function(e){return"SUM ("+e+")"}},{value:"COUNT",option:function(e){return"COUNT ("+e+")"}},{value:"COUNT DISTINCT",option:function(e){return"COUNT (DISTINCT "+e+")"}},{value:"MAX",option:function(e){return"MAX ("+e+")"}},{value:"MIN",option:function(e){return"MIN ("+e+")"}},{value:"AVG",option:function(e){return"AVG ("+e+")"}},{value:"GROUP_CONCAT",option:function(e){return"GROUP_CONCAT ("+e+")"}},{value:"GROUP_CONCAT ASC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" ASC)"}},{value:"GROUP_CONCAT DESC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" DESC)"}}],getFormats:[{value:"SEC_TO_TIME",option:function(e){return"SEC_TO_TIME ("+e+")"}},{value:"DATE",option:function(e){return"DATE ("+e+")"}},{value:"HOUR",option:function(e){return"HOUR ("+e+")"}},{value:"ROUND",option:function(e){return"ROUND ("+e+")"}},{value:"UNIX_TIMESTAMP",option:function(e){return"UNIX_TIMESTAMP ("+e+")"}}],getGroupBy:[{value:!1,option:function(){return"No"}},{value:!0,option:function(e){return"GROUP BY "+e}}],getOrderBy:[{value:"ASC",option:function(e){return"ORDER BY "+e+" ASC"}},{value:"DESC",option:function(e){return"ORDER BY "+e+" DESC"}}],getConditions:["=","!=","<","<=",">",">=","LIKE","NOT LIKE","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"]}}angular.module("app.analytics").factory("sqlUtil",e)}(),function(){"use strict";function e(e,t,n,a){function i(){e.go("app.analytics.reports")}function o(){l.report.conditions=angular.toJson(l.report.condition),n.analyticCustomReport.update({id:l.report.id},l.report).$promise.then(function(){t.success({title:"Report updated!",msg:l.report.name?l.report.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETreport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function s(){l.columns=[],l.rows=[],l.error=!1,n.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:l.report.id}).$promise.then(function(e){return l.columns=e?e.rows:[],n.analyticCustomReport.preview({id:l.report.id}).$promise}).then(function(e){l.rows=e}).catch(function(e){console.log(e),l.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(l.error)})}function r(){return l.queryResult="Loading...",n.analyticCustomReport.query({id:l.report.id}).$promise.then(function(e){l.queryResult=e.sql}).catch(function(e){l.queryResult="",console.log(e),l.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(l.error)})}var l=this;l.report=a||{},l.selectedTab=e.params.tab||0,l.gotoReports=i,l.saveReport=o,l.previewReport=s,l.queryReport=r}e.$inject=["$state","toasty","api","report"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){t.hide()}var r=this;r.errors=[],r.report=angular.copy(a),r.closeDialog=s,function(){r.columns=[],r.rows=[],r.error=!1;var e={fields:"field,alias",nolimit:!0};e["analyticCustomReport"===o?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(e).$promise.then(function(e){return r.columns=e?e.rows:[],i[o].preview({id:r.report.id}).$promise}).then(function(e){r.rows=e}).catch(function(e){console.log(e),r.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(r.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d){function c(e,t){i.go("app.analytics.reports.edit",{id:e.id})}function m(e,t){a.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(n.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:N.apiName,treeCustomData:N.treeCustomInstance.jstree(!0).get_json("#",{flat:!0})}}).finally(function(){N.treeCustomInstance.jstree(!0).refresh()})}function u(e,t){a.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(n.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:N.apiName}})}function p(e,t){a.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(n.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:N.apiName}})}function g(e,t){var n;r.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise.then(function(t){n=_.keyBy(t.rows,"id");var a={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return a["analyticCustomReport"===N.apiName?"CustomReportId":"DefaultReportId"]=e.id,r.analyticFieldReport.get(a).$promise}).then(function(t){for(var a=0;a"+e.name+" will be deleted.").ariaLabel("delete report").targetEvent(t).ok("OK").cancel("CANCEL");a.show(n).then(function(){y(e)},function(){console.log("CANCEL")})}function v(e){N.reports=e||{count:0,rows:[]}}function b(){N.query.offset=(N.query.page-1)*N.query.limit,N.apiName&&(N.promise=r[N.apiName].get(N.query,v).$promise)}function f(e,t){a.show({controller:"CreateOrEditReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/create/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:t,reports:N.reports.rows,apiName:N.apiName,currentNode:N.currentNode}})}function E(e,t,n){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var t=atob(e.target.result.split(",")[1]);t=angular.fromJson(t),r.analyticCustomReport.save({name:t.name,description:t.description,table:t.table,conditions:t.conditions,parent:N.currentNode.id}).$promise.then(function(e){N.reports.rows.unshift(e),d.success({title:"Report saved!",msg:e.name?e.name+" has been saved!":""});var n=_.map(t.fields,function(t){return _.extend({},t,{CustomReportId:e.id})});return r.analyticFieldReport.bulkCreate(n).$promise}).then(function(e){d.success({title:"Fields saved!",msg:"Fields has been saved!"})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}catch(e){console.error(e),d.error({title:"Decode File Error",msg:e.toString()})}},a.readAsDataURL(e.file)}else d.error({title:"Format Error",msg:"Please use only json files"})}function y(e){N.apiName&&r[N.apiName].delete({id:e.id}).$promise.then(function(){_.remove(N.reports.rows,{id:e.id}),N.reports.count-=1,N.reports.rows.length||N.getReports(),d.success({title:"Report deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=_.clone(N.selectedReports);return N.selectedReports=[],e}function C(e){var t=a.confirm().title("Are you sure want to delete the selected reports?").htmlContent(""+N.selectedReports.length+" selected will be deleted.").ariaLabel("delete Reports").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){N.selectedReports.forEach(function(e){y(e)}),N.selectedReports=[]})}function x(){N.selectedReports=[]}function T(){N.selectedReports=N.reports.rows}function S(e,t){N.treeDefaultInstance.jstree(!0).deselect_all(),N.treeDefaultInstance.jstree(!0).close_all(),N.currentNode=t.node,N.currentNode.custom=!0,N.apiName="analyticCustomReport",N.query.parent=t.node.id,b()}function O(e,t){N.treeCustomInstance.jstree(!0).deselect_all(),N.treeCustomInstance.jstree(!0).close_all(),N.currentNode=t.node,N.currentNode.custom=!1,N.apiName="analyticDefaultReport",N.query.parent=t.node.id,b()}function w(e,t){r.analyticTreeReport.update({id:2,tree:angular.toJson(N.treeCustomInstance.jstree(!0).get_json("#",{flat:!0}))}).$promise.then(function(){d.success({title:"Node Updated",msg:t.node.text?t.node.text+" has been updated!":"Node has been updated!"})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEanalyticTreeReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function R(e){return{core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:e?["contextmenu","dnd","search","state","wholerow"]:["search","state","wholerow"],contextmenu:{items:function(e){return{create:{label:s.instant("ANALYTICS.CREATE"),action:function(){e=N.treeCustomInstance.jstree(!0).create_node(e),N.treeCustomInstance.jstree(!0).edit(e)}},rename:{_disabled:"#"===e.parent,label:s.instant("ANALYTICS.RENAME"),action:function(){N.treeCustomInstance.jstree(!0).edit(e)}},remove:{_disabled:"#"===e.parent,label:s.instant("ANALYTICS.REMOVE"),action:function(){var t=a.confirm().title("Are you sure want to delete the node?").htmlContent(""+(e.text?e.text:"Node")+" and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");a.show(t).then(function(){N.treeCustomInstance.jstree(!0).delete_node(e)})}}}}}}}function I(e){return e?{create_node:w,rename_node:w,move_node:w,delete_node:w,select_node:S}:{select_node:O}}var N=this;N.reports={count:0,rows:[]},N.selectedReports=[],N.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions",limit:10,page:1,sort:"-updatedAt"},N.apiName=null,N.currentPath="",N.customTree=!0,N.editstate=c,N.copydialog=m,N.previewdialog=u,N.rundialog=p,N.downloadfile=g,N.deleteconfirm=h,N.success=v,N.getReports=b,N.createOrEditReport=f,N.importReport=E,N.deleteReport=y,N.exportSelectedReports=A,N.deleteSelectedReports=C,N.deselectReports=x,N.selectAllReports=T,N.treeDefaultData=l.rows[0]?angular.fromJson(l.rows[0].tree):[],N.treeCustomData=l.rows[1]?angular.fromJson(l.rows[1].tree):[],N.treeDefaultConfig=R(!1),N.treeCustomConfig=R(!0),N.treeDefaultEvents=I(!1),N.treeCustomEvents=I(!0);var D=!0,L=1;e.$watch("vm.query.filter",function(e,n){D?t(function(){D=!1}):(n||(L=N.query.page),e!==n&&(N.query.page=1),e||(N.query.page=L),N.getReports())}),e.$watch("vm.search",function(e,t){N.treeDefaultInstance&&N.treeDefaultInstance.jstree(!0).search(e),N.treeCustomInstance&&N.treeCustomInstance.jstree(!0).search(e)})}e.$inject=["$scope","$timeout","$document","$mdDialog","$state","$window","$translate","api","treeReports","toasty"],angular.module("app.analytics").controller("ReportsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){d.export={id:d.report.id,name:d.report.name,startDate:new Date(moment().startOf("day")),endDate:new Date(moment().endOf("day")),output:"csv"}}function r(){d.errors=[],i[o].run(_.merge(d.export,{startDate:moment(d.export.startDate).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(d.export.endDate).format("YYYY-MM-DD HH:mm:ss")})).$promise.then(function(e){n.success({title:"Report properly run!",msg:d.report.name?d.report.name+" has been run!":""}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function l(){t.hide()}var d=this;d.errors=[],d.report=angular.copy(a),d.export={},d.runReport=r,d.closeDialog=l,d.refreshDate=s,s()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("RunReportDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.squareOdbc.save(p.odbc).$promise.then(function(e){p.odbcs.unshift(e),i.success({title:"Odbc properly created",msg:p.odbc.name?p.odbc.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.save"}];for(var t=0;t"+(e.name||"odbc")+" will be deleted.").ariaLabel("delete odbc").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})}function p(e,t){return l.squareOdbc.test({id:e.id}).$promise.then(function(){c.success({title:"Square ODBC properly tested",msg:"Connection succeded!"})}).catch(function(e){c.error({title:"Square ODBC properly tested",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){C.odbcs=e||{count:0,rows:[]}}function h(){C.query.offset=(C.query.page-1)*C.query.limit,C.promise=l.squareOdbc.get(C.query,g).$promise}function v(e,t){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{odbc:t,odbcs:C.odbcs.rows}})}function b(e){l.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(C.odbcs.rows,{id:e.id}),C.odbcs.count-=1,C.odbcs.rows.length||C.getODBC(),c.success({title:"Odbc deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareOdbc",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(){var e=_.clone(C.selectedODBC);return C.selectedODBC=[],e}function E(e){var t=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent(""+C.selectedODBC.length+" selected will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){C.selectedODBC.forEach(function(e){b(e)}),C.selectedODBC=[]})}function y(){C.selectedODBC=[]}function A(){C.selectedODBC=C.odbcs.rows}var C=this;C.odbcs=r||{count:0,rows:[]},C.table="odbcs",C.listOrder="",C.listOrderAsc=null,C.selectedODBC=[],C.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},C.editdialog=m,C.deleteconfirm=u,C.testtestOdbc=p,C.success=g,C.getODBC=h,C.createOrEditOdbc=v,C.deleteOdbc=b,C.exportSelectedODBC=f,C.deleteSelectedODBC=E,C.deselectODBC=y,C.selectAllODBC=A;var x=!0,T=1;e.$watch("vm.query.filter",function(e,t){x?s(function(){x=!1}):(t||(T=C.query.page),e!==t&&(C.query.page=1),e||(C.query.page=T),C.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","odbcs","api","msUtils","toasty"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){u.errors=[],i.squareProject.save(u.project).$promise.then(function(e){u.projects.unshift(e),t.success({title:"Project properly created",msg:u.project.name?u.project.name+" has been created!":""}),m(e),u.openFromEditor&&(u.newWindow?s.open("/callysquare/projects/"+e.id,"_blank"):r.go("app.callysquare.projects.edit",{id:e.id}))}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}];for(var n=0;n5242880&&i.errors.push({message:"The file is too big. Max 5MB files are supported!"}),!i.errors.length){var t=new FileReader;t.onload=function(e){a(e.target.result)},t.readAsText(e.file)}}function a(n){n?(t(n),e.hide(n)):e.hide()}var i=this;i.errors=[],i.ngFlowOptions={chunkSize:5242880,maxChunkRetries:1,singleFile:!0,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3},i.ngFlow={flow:{}},i.dropping=!1,i.closeDialog=a,i.fileAdded=n}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[],a.squareProject.update({id:s.project.id},{notes:s.project.notes,description:s.project.description}).$promise.then(function(n){t.success({title:"Project updated!",msg:s.project.name?s.project.name+" has been updated!":""}),e.hide(n)}).catch(function(e){console.error(e),s.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}]})}function o(){e.hide()}var s=this;s.project=_.clone(n),s.closeDialog=o,s.save=i}e.$inject=["$mdDialog","toasty","project","api"],angular.module("app.callysquare").controller("MxGraphUpdateInfoController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(t){s.errors=[],t?(e.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):e.hide()}var s=this;s.projects=n,s.id="",s.newWindow=!0,s.closeDialog=o}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s){function r(){delete d.project.id,i.squareProject.save(d.project).$promise.then(function(n){t.success({title:"Project properly created",msg:d.project.name?d.project.name+" has been created!":""}),e.hide(n),d.newWindow?o.open("/callysquare/projects/"+n.id,"_blank"):s.go("app.callysquare.projects.edit",{id:n.id})}).catch(function(e){console.error(e),d.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}]})}function l(){e.hide()}var d=this;d.project=angular.copy(n),d.project.name+="_new",d.project.preproduction=a,d.newWindow=!0,d.closeDialog=l,d.save=r}e.$inject=["$mdDialog","toasty","project","currentXML","api","$window","$state"],angular.module("app.callysquare").controller("MxGraphSaveProjectAsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c,m,u,p,g,h,v,b,f){function E(){new EditorUi(N,new Editor,document.getElementById("geEditor")).openString(N.project.preproduction,N.project.name,N.project)}function y(e,a){n.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{users:s.rows||[],trunks:r.rows||[],queues:l.rows||[],sounds:d.rows||[],variables:c.rows||[],databases:m.rows||[],contexts:u.rows||[],projects:p.rows||[],intervals:g.rows||[],mailAccounts:h.rows||[],templates:v.rows||[],lists:b.rows||[],cell:e,saveCallback:a}})}function A(e){n.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:e,projects:p.rows,openFromEditor:!0}})}function C(){n.show({controller:"MxGraphOpenProjectController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/open/open.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{projects:p.rows||[]}})}function x(e){n.show({controller:"MxGraphSaveProjectAsController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:N.project,currentXML:e}}).then(function(e){e&&p.rows.push(e)})}function T(e){n.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{variable:e,variables:c.rows}})}function S(e){n.show({controller:"MxGraphUpdateInfoController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/info/info.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:N.project}}).then(function(e){e&&_.merge(N.project,e)})}function O(e,a){n.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:a}}).then(function(e){e&&(N.project.preproduction=e)})}function w(e){n.show({controller:"MxGraphImportXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/import/import.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(N.project.preproduction=e)})}function R(e,t){var n={preproduction:e};t&&(n.production=e),i.squareProject.update({id:N.project.id},n).$promise.then(function(e){a.success({title:"Project "+(t?"published":"saved")+"!",msg:N.project.name?N.project.name+" has been "+(t?"published":"saved")+"!":""}),N.project.preproduction=e.preproduction}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}function I(){e.go("app.callysquare.projects")}var N=this;N.project=o||{},N.saveOrPublishProject=R,N.$onInit=E,N.openDialog=y,N.newProject=A,N.openProject=C,N.saveProjectAs=x,N.newVariable=T,N.updateInfo=S,N.editXML=O,N.importXML=w,N.gotoProjects=I}e.$inject=["$state","$document","$mdDialog","toasty","api","project","users","trunks","queues","sounds","variables","databases","contexts","projects","intervals","mailAccounts","templates","lists","$window"],angular.module("app.callysquare").controller("ProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d){function c(e,n){t.go("app.callysquare.projects.edit",{id:e.id})}function m(e,t){var n=s.confirm().title("Are you sure want to delete the project?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete project").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){h(e)},function(){console.log("CANCEL")})}function u(e){y.projects=e||{count:0,rows:[]}}function p(){y.query.offset=y.query.page-1,y.promise=i.squareProject.get(y.query,u).$promise}function g(e,t){s.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:t,projects:y.projects.rows,openFromEditor:null}})}function h(e){i.squareProject.delete({id:e.id}).$promise.then(function(){_.remove(y.projects.rows,{id:e.id}),y.projects.count-=1,y.projects.rows.length||y.getProjects(),d.success({title:"Project deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){var e=_.clone(y.selectedProjects);return y.selectedProjects=[],e}function b(e){var t=s.confirm().title("Are you sure want to delete the selected projects?").htmlContent(""+y.selectedProjects.length+" selected will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){y.selectedProjects.forEach(function(e){h(e)}),y.selectedProjects=[]})}function f(){y.selectedProjects=[]}function E(){y.selectedProjects=y.projects.rows}var y=this;y.projects=a||{count:0,rows:[]},y.table="projects",y.listOrder="",y.listOrderAsc=null,y.selectedProjects=[],y.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},y.editstate=c,y.deleteconfirm=m,y.success=u,y.getProjects=p,y.createOrEditProject=g,y.deleteProject=h,y.exportSelectedProjects=v,y.deleteSelectedProjects=b,y.deselectProjects=f,y.selectAllProjects=E;var A=!0,C=1;e.$watch("vm.query.filter",function(e,t){A?l(function(){A=!1}):(t||(C=y.query.page),e!==t&&(y.query.page=1),e||(y.query.page=C),y.getProjects())})}e.$inject=["$scope","$state","$mdSidenav","projects","api","msUtils","$mdDialog","$document","$timeout","toasty"],angular.module("app.callysquare").controller("ProjectsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.squareRecording.save(p.squareRecording).$promise.then(function(e){p.squareRecordings.unshift(e),i.success({title:"SquareRecording properly created",msg:p.squareRecording.name?p.squareRecording.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.save"}];for(var t=0;t"+(e.name||"squareRecording")+" will be deleted.").ariaLabel("delete squareRecording").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.squareRecordings=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.squareRecording.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditSquareRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/squareRecordings/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{squareRecording:t,squareRecordings:A.squareRecordings.rows}})}function v(e){l.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(A.squareRecordings.rows,{id:e.id}),A.squareRecordings.count-=1,A.squareRecordings.rows.length||A.getSquareRecordings(),c.success({title:"SquareRecording deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedSquareRecordings);return A.selectedSquareRecordings=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent(""+A.selectedSquareRecordings.length+" selected will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedSquareRecordings.forEach(function(e){v(e)}),A.selectedSquareRecordings=[]})}function E(){A.selectedSquareRecordings=[]}function y(){A.selectedSquareRecordings=A.squareRecordings.rows}var A=this;A.squareRecordings=r||{count:0,rows:[]},A.table="squareRecordings",A.listOrder="",A.listOrderAsc=null,A.selectedSquareRecordings=[],A.query={fields:"createdAt,updatedAt,id,projectName,uniqueid,callerid,extension,audio,createdAt",sort:"-updatedAt",limit:10,page:1},A.downloadfile=m,A.deleteconfirm=u,A.success=p,A.getSquareRecordings=g,A.createOrEditSquareRecording=h,A.deleteSquareRecording=v,A.exportSelectedSquareRecordings=b,A.deleteSelectedSquareRecordings=f,A.deselectSquareRecordings=E,A.selectAllSquareRecordings=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","squareRecordings","api","msUtils","toasty"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the chatQueue?").htmlContent(""+(e.name||"chatQueue")+" will be deleted.").ariaLabel("delete chatQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.chatQueues=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.chatQueue.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:t,chatQueues:A.chatQueues.rows}})}function v(e){l.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(A.chatQueues.rows,{id:e.id}),A.chatQueues.count-=1,A.chatQueues.rows.length||A.getChatQueues(),c.success({title:"ChatQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedChatQueues);return A.selectedChatQueues=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent(""+A.selectedChatQueues.length+" selected will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedChatQueues.forEach(function(e){v(e)}),A.selectedChatQueues=[]})}function E(){A.selectedChatQueues=[]}function y(){A.selectedChatQueues=A.chatQueues.rows}var A=this;A.chatQueues=r||{count:0,rows:[]},A.table="chatQueues",A.listOrder="",A.listOrderAsc=null,A.selectedChatQueues=[],A.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",limit:10,page:1},A.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"Round Robin Memory",value:"'roundrobun'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getChatQueues=g,A.createOrEditChatQueue=h,A.deleteChatQueue=v,A.exportSelectedChatQueues=b,A.deleteSelectedChatQueues=f,A.deselectChatQueues=E,A.selectAllChatQueues=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","chatQueues","api","msUtils","toasty"],angular.module("app.chat").controller("ChatQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.chatQueue.save(p.chatQueue).$promise.then(function(e){p.chatQueues.unshift(e),i.success({title:"ChatQueue properly created",msg:p.chatQueue.name?p.chatQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.save"}];for(var t=0;t"+(e.name||"chatWebsite")+" will be deleted.").ariaLabel("delete chatWebsite").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.chatWebsites=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.chatWebsite.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditChatWebsiteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:t,chatWebsites:A.chatWebsites.rows}})}function v(e){l.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(A.chatWebsites.rows,{id:e.id}),A.chatWebsites.count-=1,A.chatWebsites.rows.length||A.getChatWebsites(),c.success({title:"ChatWebsite deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedChatWebsites);return A.selectedChatWebsites=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent(""+A.selectedChatWebsites.length+" selected will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedChatWebsites.forEach(function(e){v(e)}),A.selectedChatWebsites=[]})}function E(){A.selectedChatWebsites=[]}function y(){A.selectedChatWebsites=A.chatWebsites.rows}var A=this;A.chatWebsites=r||{count:0,rows:[]},A.table="chatWebsites",A.listOrder="",A.listOrderAsc=null,A.selectedChatWebsites=[],A.query={fields:"createdAt,updatedAt,id,name,address,remote,ListId,fidelity,timeout,description,color,color_focus,color_button,header_shape,animation,defaultWhiteLabel,whiteLabel,defaultLogo,download_transcript,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,OfflineTemplateId,name_title,username_placeholder,email_title,email_placeholder,header_online,online_message,start_chat_button,agents_busy,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl",sort:"-updatedAt",limit:10,page:1},A.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayacceptMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrejectMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycloseMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getChatWebsites=g,A.createOrEditChatWebsite=h,A.deleteChatWebsite=v,A.exportSelectedChatWebsites=b,A.deleteSelectedChatWebsites=f,A.deselectChatWebsites=E,A.selectAllChatWebsites=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","chatWebsites","api","msUtils","toasty"],angular.module("app.chat").controller("ChatWebsitesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.chatWebsite.save(p.chatWebsite).$promise.then(function(e){p.chatWebsites.unshift(e),i.success({title:"ChatWebsite properly created",msg:p.chatWebsite.name?p.chatWebsite.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete chatDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.chatWebsiteChatDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.chatWebsite.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditChatDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatDisposition:t,chatDispositions:h.chatWebsiteChatDispositions.rows}})}function p(e){r.chatDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.chatWebsiteChatDispositions.rows,{id:e.id}),h.chatWebsiteChatDispositions.count-=1,h.chatWebsiteChatDispositions.rows.length||h.getChatWebsiteChatDispositions(),s.success({title:"ChatDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected chatDispositions?").htmlContent(""+h.selectedChatWebsiteChatDispositions.length+" selected will be deleted.").ariaLabel("delete chatDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedChatWebsiteChatDispositions.forEach(function(e){p(e)}),h.selectedChatWebsiteChatDispositions=[]})}var h=this;h.chatWebsite={},h.chatWebsiteChatDispositions={count:0,rows:[]},h.selectedChatWebsiteChatDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getChatWebsiteChatDispositions=m,h.createOrEditChatWebsiteChatDisposition=u,h.deleteChatWebsiteChatDisposition=p,h.deleteSelectedChatWebsiteChatDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getChatWebsiteChatDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.chat").controller("ChatWebsiteChatDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.chatDisposition.save(p.chatDisposition).$promise.then(function(e){p.chatDispositions.unshift(e),i.success({title:"ChatDisposition properly created",msg:p.chatDisposition.name?p.chatDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.chatDisposition.save"}];for(var t=0;t"+(e.name||"company")+" will be deleted.").ariaLabel("delete company").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})}function g(e){C.companies=e||{count:0,rows:[]}}function h(){C.query.offset=(C.query.page-1)*C.query.limit,C.promise=l.cmCompany.get(C.query,g).$promise}function v(e,t){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{company:t,companies:C.companies.rows}})}function b(e){l.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(C.companies.rows,{id:e.id}),C.companies.count-=1,C.companies.rows.length||C.getCompanies(),c.success({title:"Company deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCompany",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(){var e=_.clone(C.selectedCompanies);return C.selectedCompanies=[],e}function E(e){var t=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent(""+C.selectedCompanies.length+" selected will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){C.selectedCompanies.forEach(function(e){b(e)}),C.selectedCompanies=[]})}function y(){C.selectedCompanies=[]}function A(){C.selectedCompanies=C.companies.rows}var C=this;C.companies=r||{count:0,rows:[]},C.table="companies",C.listOrder="",C.listOrderAsc=null,C.selectedCompanies=[],C.query={fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,page:1},C.editstate=m,C.gotocontactsgoto=u,C.deleteconfirm=p,C.success=g,C.getCompanies=h,C.createOrEditCompany=v,C.deleteCompany=b,C.exportSelectedCompanies=f,C.deleteSelectedCompanies=E,C.deselectCompanies=y,C.selectAllCompanies=A;var x=!0,T=1;e.$watch("vm.query.filter",function(e,t){x?s(function(){x=!1}):(t||(T=C.query.page),e!==t&&(C.query.page=1),e||(C.query.page=T),C.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","companies","api","msUtils","toasty"],angular.module("app.contactmanager").controller("CompaniesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cmCompany.save(p.company).$promise.then(function(e){p.companies.unshift(e),i.success({title:"Company properly created",msg:p.company.name?p.company.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.save"}];for(var t=0;t"+(e.firstName||e.email||e.phone||"Contact")+" will be deleted.").ariaLabel("delete contact").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)})}function y(e){N.contacts=e||{count:0,rows:[]}}function A(){N.query.offset=(N.query.page-1)*N.query.limit,N.promise=o.cmContact.get(N.query,y).$promise}function C(e,n){n&&n.dateOfBirth&&(n.dateOfBirth=new Date(n.dateOfBirth)),i.show({controller:"CreateOrEditContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{ListId:N.query.ListId||a.params.ListId,CompanyId:N.query.CompanyId||a.params.CompanyId,contact:n,contacts:N.contacts.rows},resolve:{lists:["apiResolver",function(e){return e.resolve("cmList@get",{fields:"id,name"})}],companies:["apiResolver",function(e){return e.resolve("cmCompany@get",{fields:"id,name"})}]}})}function x(e,n){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("cmList@get",{fields:"id,name"})}]},locals:{contacts:N.contacts.rows}})}function T(e,n){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("cmList@get",{fields:"id,name"})}]},locals:{contacts:N.contacts.rows}})}function S(e){o.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(N.contacts.rows,{id:e.id}),N.contacts.count-=1,N.contacts.rows.length||N.getContacts(),m.success({title:"Contact deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){m.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})}function O(){var e=_.clone(N.selectedContacts);return N.selectedContacts=[],e}function w(e){var t=i.confirm().title("Are you sure want to delete the selected contacts?").htmlContent(""+N.selectedContacts.length+" selected will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){N.selectedContacts.forEach(function(e){S(e)}),N.selectedContacts=[]})}function R(){N.selectedContacts=[]}function I(){N.selectedContacts=N.contacts.rows}var N=this;u.getCurrentUser();N.contacts=s||{count:0,rows:[]},N.options={hidden:!1,hover:!1,isOpen:!1},N.table="cm_contacts",N.listOrder="",N.listOrderAsc=null,N.disableDialog=!0,N.selectedContacts=[],N.lists=r||{rows:[],count:0},N.companies=d||{rows:[],count:0},N.tags=c||{rows:[],count:0},N.listsMap=l,N.selectedTags=[],N.selectedList=null,N.selectedCompany=null,N.query={fields:"id,firstName,lastName,phone,email,updatedAt",sort:"-updatedAt",limit:10,page:1},N.editdialog=f,N.deleteconfirm=E,N.success=y,N.getContacts=A,N.mergeContact=T,N.duplicateContact=x,N.createOrEditContact=C,N.deleteContact=S,N.exportSelectedContacts=O,N.deleteSelectedContacts=w,N.deselectContacts=R,N.selectAllContacts=I,N.createTag=v,N.createList=p,N.createCompany=h,N.uploadContacts=b,N.hasPermission=g,a.params.ListId&&(N.selectedList=a.params.ListId),a.params.CompanyId&&(N.selectedCompany=a.params.CompanyId),e.$watch("vm.options.isOpen",function(t){t?n(function(){e.tooltipVisible=N.options.isOpen},600):e.tooltipVisible=N.options.isOpen});var D=!0,L=1;e.$watch("vm.query.filter",function(e,t){D?n(function(){D=!1}):(t||(L=N.query.page),e!==t&&(N.query.page=1),e||(N.query.page=L),N.getContacts())},!0),e.$watch("vm.selectedList",function(e,t){e!==t&&(N.query.ListId=N.selectedList||void 0,N.getContacts())}),e.$watch("vm.selectedCompany",function(e,t){e!==t&&(N.query.CompanyId=N.selectedCompany||void 0,N.getContacts())}),e.$watch("vm.selectedTags",function(e,t){(e.length||t.length)&&(N.query.tags=N.selectedTags.length?N.selectedTags.join():void 0,N.getContacts())})}e.$inject=["$scope","$document","$timeout","$state","$mdDialog","api","contacts","lists","listsMap","companies","tags","toasty","Auth"],angular.module("app.contactmanager").controller("ContactsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l){function d(){h.errors=[],l.cmContact.save(h.contact).$promise.then(function(e){h.contacts.unshift(e),t.success({title:"Contact properly created",msg:h.contact.name?h.contact.name+" has been created!":""}),g()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){h.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n"+(e.phone||"hopper")+" will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){E(e)},function(){console.log("CANCEL")})}function E(e){return s.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(N.hoppers.rows,{id:e.id}),N.hoppers.count--,N.hoppers.rows.length||N.getHoppers(),o.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})}function y(){console.log("getHoppers"),N.queryHopper.offset=(N.queryHopper.page-1)*N.queryHopper.limit,N.promise=s.cmHopper.get(N.queryHopper,v("hoppers")).$promise}function A(){N.queryFinal.offset=(N.queryFinal.page-1)*N.queryFinal.limit,N.promise=s.cmHopperFinal.get(N.queryFinal,v("finals")).$promise}function C(){N.queryHistory.offset=(N.queryHistory.page-1)*N.queryHistory.limit,N.promise=s.cmHopperHistory.get(N.queryHistory,v("histories")).$promise}function x(e){if(N.contact.ListId){var t=i.confirm().title("You are selecting the list number: "+N.contact.ListId).textContent("Warning! You won't select a different list for the contact "+N.contact.firstName||N.contact.lastName||N.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return i.show(t).then(N.onSelectListSuccess).catch(function(){N.contact.ListId=null})}}function T(){return s.cmList.getCustomFields({id:N.contact.ListId}).$promise.then(function(e){N.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})}function S(e,t){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[]},resolve:{company:["apiResolver",function(e){return e.resolve("cmCompany@get",{id:t})}]}})}function O(e){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver",function(e){return e.resolve("cmList@get",{fields:"id,name"})}]},locals:{contacts:m.rows,contact:r}})}function w(){s.cmContact.update({id:N.contact.id},N.contact).$promise.then(function(){o.success({title:"Contact updated!",msg:N.contact.name?N.contact.name+" has been updated!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})}function R(e){return new Date(e)}function I(){n.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})}var N=this;N.contact=r||{},N.hoppers=l||{rows:[],count:0},N.finals=d||{rows:[],count:0},N.histories=c||{rows:[],count:0},N.companies=u||{rows:[],count:0},N.lists=p||{rows:[],count:0},N.customFields=g||{rows:[],count:0},N.tags=h||{rows:[],count:0},N.queryHopper={ContactId:N.contact.id,fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},N.queryFinal={ContactId:N.contact.id,fields:"uniqueid,phone,status,starttime,disposition",sort:"-updatedAt",limit:10,page:1},N.queryHistory={ContactId:N.contact.id,fields:"id,ContactId,phone,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},N.selectedTab=n.params.tab||0,N.gotoContacts=I,N.duplicateContact=O,N.saveContact=w,N.editCompany=S,N.onSelectList=x,N.onSelectListSuccess=T,N.getDateFromString=R,N.getHoppers=y,N.getFinals=A,N.getHistories=C,N.deleteconfirm=f,N.editHopper=b;var D=!0,L=1;e.$watch("vm.queryHopper.filter",function(e,n){D?t(function(){D=!1}):(n||(L=N.queryHopper.page),e!==n&&(N.queryHopper.page=1),e||(N.queryHopper.page=L),N.getHoppers())}),e.$watch("vm.queryFinal.filter",function(e,n){D?t(function(){D=!1}):(n||(L=N.queryFinal.page),e!==n&&(N.queryFinal.page=1),e||(N.queryFinal.page=L),N.getFinals())}),e.$watch("vm.queryHistory.filter",function(e,n){D?t(function(){D=!1}):(n||(L=N.queryHistory.page),e!==n&&(N.queryHistory.page=1),e||(N.queryHistory.page=L),N.getHistories())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags"],angular.module("app.contactmanager.contacts").controller("ContactController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s){function r(t,a,o){_.remove(c.contacts,{id:a.id});var r=e.confirm().title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+o.id+" will be overwritten by the fields of the contact #"+a.id+".").targetEvent(t).ok("Ok").cancel("Cancel");e.show(r).then(function(){var e=a.id,t=o.id,r=_.mergeWith(a,o,function(e,t){return Array.isArray(t)&&!t.length?e:t||e});s.cmContact.update({id:r.id},r).$promise.then(function(){return s.cmContact.delete({id:e})}).then(function(){_.remove(i,{id:e}),_.merge(_.find(i,{id:t}),r),n.success({title:"Contact properly merged!"})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:MERGE_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})})})}function l(){c.errors=[],delete c.contact.id,s.cmContact.save(c.contact).$promise.then(function(e){i.unshift(e),n.success({title:"Contact properly created",msg:c.contact.name?c.contact.name+" has been created!":""}),d()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}]})}function d(){e.hide()}var c=this;c.errors=[],c.title="CONTACTMANAGER.MERGE_CONTACT",c.contact=angular.copy(a),c.lists=o||[],c.change=function(){c.searchTerm?s.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:c.searchTerm,ListId:a.ListId}).$promise.then(function(e){c.contacts=e.rows}).catch(function(e){console.error(e)}):c.contacts=[]},c.addNewContact=l,c.showConfirm=r,c.closeDialog=d}e.$inject=["$mdDialog","$scope","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("MergeContactDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d){function c(){return d.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})}function m(){g.uploading=!0,u(g.contacts.length-1)}function u(e){if(e<0)return g.stop=!0,void(g.uploading=!1);for(var t=[];e>=0&&t.length"+(e.name||"globalCustomField")+" will be deleted.").ariaLabel("delete globalCustomField").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.globalCustomFields=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.cmCustomField.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{globalCustomField:t,globalCustomFields:A.globalCustomFields.rows}})}function v(e){l.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(A.globalCustomFields.rows,{id:e.id}),A.globalCustomFields.count-=1,A.globalCustomFields.rows.length||A.getGlobalCustomFields(),c.success({title:"GlobalCustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCustomField",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedGlobalCustomFields);return A.selectedGlobalCustomFields=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent(""+A.selectedGlobalCustomFields.length+" selected will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedGlobalCustomFields.forEach(function(e){v(e)}),A.selectedGlobalCustomFields=[]})}function E(){A.selectedGlobalCustomFields=[]}function y(){A.selectedGlobalCustomFields=A.globalCustomFields.rows}var A=this;A.globalCustomFields=r||{count:0,rows:[]},A.table="globalCustomFields",A.listOrder="",A.listOrderAsc=null,A.selectedGlobalCustomFields=[],A.query={fields:"createdAt,updatedAt,id,alias,type,values,required",sort:"-updatedAt",ListId:"null",limit:10,page:1},A.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getGlobalCustomFields=g,A.createOrEditGlobalCustomField=h,A.deleteGlobalCustomField=v,A.exportSelectedGlobalCustomFields=b,A.deleteSelectedGlobalCustomFields=f,A.deselectGlobalCustomFields=E,A.selectAllGlobalCustomFields=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","globalCustomFields","api","msUtils","toasty"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cmList.save(p.list).$promise.then(function(e){p.lists.unshift(e),i.success({title:"List properly created",msg:p.list.name?p.list.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete customField").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.listCustomFields=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.cmList.getCustomFields(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{customField:t,customFields:h.listCustomFields.rows}})}function p(e){r.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(h.listCustomFields.rows,{id:e.id}),h.listCustomFields.count-=1,h.listCustomFields.rows.length||h.getListCustomFields(),s.success({title:"CustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected customFields?").htmlContent(""+h.selectedListCustomFields.length+" selected will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedListCustomFields.forEach(function(e){p(e)}),h.selectedListCustomFields=[]})}var h=this;h.list={},h.listCustomFields={count:0,rows:[]},h.selectedListCustomFields=[],h.query={fields:"createdAt,updatedAt,id,alias,type,values,required",limit:10,page:1},h.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.init=l,h.deleteConfirm=d,h.success=c,h.getListCustomFields=m,h.createOrEditListCustomField=u,h.deleteListCustomField=p,h.deleteSelectedListCustomFields=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getListCustomFields())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cmList.addCustomField({id:t.params.id},p.customField).$promise.then(function(e){p.customFields.unshift(e),i.success({title:"CustomField properly created",msg:p.customField.name?p.customField.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete voiceDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.listVoiceDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.cmList.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditVoiceDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/voiceDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceDisposition:t,voiceDispositions:h.listVoiceDispositions.rows}})}function p(e){r.voiceDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.listVoiceDispositions.rows,{id:e.id}),h.listVoiceDispositions.count-=1,h.listVoiceDispositions.rows.length||h.getListVoiceDispositions(),s.success({title:"VoiceDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected voiceDispositions?").htmlContent(""+h.selectedListVoiceDispositions.length+" selected will be deleted.").ariaLabel("delete voiceDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedListVoiceDispositions.forEach(function(e){p(e)}),h.selectedListVoiceDispositions=[]})}var h=this;h.list={},h.listVoiceDispositions={count:0,rows:[]},h.selectedListVoiceDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getListVoiceDispositions=m,h.createOrEditListVoiceDisposition=u,h.deleteListVoiceDisposition=p,h.deleteSelectedListVoiceDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getListVoiceDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.contactmanager").controller("ListVoiceDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceDisposition.save(p.voiceDisposition).$promise.then(function(e){p.voiceDispositions.unshift(e),i.success({title:"VoiceDisposition properly created",msg:p.voiceDisposition.name?p.voiceDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceDisposition.save"}];for(var t=0;t"+(e.name||"list")+" will be deleted.").ariaLabel("delete list").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){E(e)},function(){console.log("CANCEL")})}function v(e){T.lists=e||{count:0,rows:[]}}function b(){T.query.offset=(T.query.page-1)*T.query.limit,T.promise=l.cmList.get(T.query,v).$promise}function f(e,t){i.show({controller:"CreateOrEditListDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:t,lists:T.lists.rows}})}function E(e){l.cmList.delete({id:e.id}).$promise.then(function(){_.remove(T.lists.rows,{id:e.id}),T.lists.count-=1,T.lists.rows.length||T.getLists(),c.success({title:"List deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}function y(){var e=_.clone(T.selectedLists);return T.selectedLists=[],e}function A(e){var t=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent(""+T.selectedLists.length+" selected will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){T.selectedLists.forEach(function(e){E(e)}),T.selectedLists=[]})}function C(){T.selectedLists=[]}function x(){T.selectedLists=T.lists.rows}var T=this;T.lists=r||{count:0,rows:[]},T.table="lists",T.listOrder="",T.listOrderAsc=null,T.selectedLists=[],T.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},T.editstate=m,T.gotocontactsgoto=u,T.exportcsvcontactsexport=p,T.agentadddialog=g,T.deleteconfirm=h,T.success=v,T.getLists=b,T.createOrEditList=f,T.deleteList=E,T.exportSelectedLists=y,T.deleteSelectedLists=A,T.deselectLists=C,T.selectAllLists=x;var S=!0,O=1;e.$watch("vm.query.filter",function(e,t){S?s(function(){S=!1}):(t||(O=T.query.page),e!==t&&(T.query.page=1),e||(T.query.page=O),T.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","lists","api","msUtils","toasty"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c,m,u,p){function g(e){e.id=_.random(1e10),e.openedAt=new Date,e.saved=!1;var t=A.tabs.length;A.tabs.push(e),A.currentTab=C+t}function h(e,t){var n={type:"contact",title:e?e.firstName||e.phone:i.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",contact:e,userLists:c,lists:m,companies:u,tags:p,calls:t?[t]:[]};if(e){var a=_.findLastIndex(A.tabs,function(t){return"contact"===t.type&&t.contact&&t.contact.id===e.id});if(a<0){if(e.ListId)return r.cmList.getDispositions({id:e.ListId}).$promise.then(function(t){return n.dispositions=t,r.cmList.getCustomFields({id:e.ListId}).$promise}).then(function(e){n.customFields=e}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){g(n)});g(n)}else t&&A.tabs[a].calls.push(t),A.currentTab=C+a}else g(n)}function v(e){e&&e.uri&&a.open(e.uri)}function b(e){e&&e.html&&n.show({template:e.html,clickOutsideToClose:!0})}function f(e){return r.cmContact.get({ListId:e.ListId,phone:e.calleridnum,nolimit:!0}).$promise.then(function(t){if(t.count)for(var n=0;n=0&&(C.tab.calls[t].disposedAt=new Date)}function E(n,a){C.newContact?o.error({title:"ATTENTION",msg:"Before to dispose, please save the contact!"}):e.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/directives/contact/dispose/dialog.html",parent:angular.element(t.body),targetEvent:a,clickOutsideToClose:!1,locals:{dispositions:C.tab.dispositions,contact:C.contact,call:a}}).then(function(e){o.success({title:"Call properly disposed",msg:"Call has been disposed "+e})}).finally(function(){_.remove(C.tab.calls,function(e){return e.uniqueid==a.uniqueid})})}function y(e){return i.cmList.getCustomFields({id:e}).$promise.then(function(e){C.tab.customFields=e}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(e){return new Date(e)}var C=n;if(C.contact=C.tab.contact,C.newContact=!1,C.currentTab=0,C.contact&&C.contact.id||(C.newContact=!0),C.contact&&C.contact.id)return i.user.addContacts({id:s.getCurrentUser().id,ids:[C.contact.id]});C.queryHopper={ContactId:C.contact.id,fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},C.queryFinal={ContactId:C.contact.id,fields:"uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,page:1},C.queryHistory={ContactId:C.contact.id,fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},C.hoppers={rows:[],count:0},C.finals={rows:[],count:0},C.histories={rows:[],count:0},C.addNewContact=c,C.saveContact=m,C.getCustomFields=y,C.disposeCall=E,C.duplicateContact=v,C.mergeContact=b,C.getDateFromString=A,C.getHoppers=p,C.getFinals=g,C.getHistories=h,r.on("voice_queue_channel:remove",f),function(){C.getHoppers(),C.getFinals(),C.getHistories()}(),C.$watch("currentTab",function(e,t){console.log("current tab",e),1===C.currentTab&&(console.log("test"),C.getHoppers(),C.getFinals(),C.getHistories())});var x=!0,T=1;C.$watch("queryHopper.filter",function(e,t){x?a(function(){x=!1}):(t||(T=C.queryHopper.page),e!==t&&(C.queryHopper.page=1),e||(C.queryHopper.page=T),C.getHoppers())}),C.$watch("queryFinal.filter",function(e,t){x?a(function(){x=!1}):(t||(T=C.queryFinal.page),e!==t&&(C.queryFinal.page=1),e||(C.queryFinal.page=T),C.getFinals())}),C.$watch("queryHistory.filter",function(e,t){x?a(function(){x=!1}):(t||(T=C.queryHistory.page),e!==t&&(C.queryHistory.page=1),e||(C.queryHistory.page=T),C.getHistories())})}return{restrict:"E",transclude:!0,scope:{localStorageSet:"&onLocalStorageSet",tab:"="},link:l,templateUrl:"app/main/apps/dashboards/views/general/agent/directives/contact/contact.html"}}e.$inject=["$mdDialog","$document","$window","$timeout","api","toasty","Auth","socket"],angular.module("app.dashboards").directive("contact",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c,m,u){function p(){var e=y.choice.toLowerCase();return{id:y.call.uniqueid,disposition:y.choice,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e}}function g(){return l.voiceCallReport.update({id:y.call.uniqueid,userDisposition:y.choice,UserId:u.getCurrentUser().id,ContactId:y.contact.id}).$promise.catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICECALLREPORT",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(){return l.cmHopperFinal.update(p()).$promise.catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERFINAL",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){return l.cmHopperHistory.update(p()).$promise.catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERHISTORY",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(e){if(e)return l.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){for(var t=[],n=0;n0?i:0}}),a.avgHoldTime=Math.round(a.total>0?a.sumHoldTime/a.total:0),a.avgHoldTime=new Date(1e3*a.avgHoldTime).toISOString().substr(11,8),a.avgTalkTime=Math.round(a.answered>0?a.sumBillable/a.answered:0),a.avgTalkTime=new Date(1e3*a.avgTalkTime).toISOString().substr(11,8),a.answerRate=Math.round((a.total>0?a.answered/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.abandonRate=Math.round((a.total>0?a.abandoned/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),t.shift(),e.defer.resolve(a),t.length>0&&n()};return function(a){var i=e.defer();return t.push({queues:a.queues,rpcQueues:a.rpcQueues,defer:i}),1===t.length&&n(),i.promise}}function t(e){var t=[],n=function(){var e=t[0],a={originated:0,limitCalls:0};_.forIn(e.rpcCampaigns,function(t,n){e.rpcCampaigns[n]&&(a.originated+=e.rpcCampaigns[n].originated||0,a.limitCalls+=e.rpcCampaigns[n].limitCalls||0)}),t.shift(),e.defer.resolve(a),t.length>0&&n()};return function(a){var i=e.defer();return t.push({rpcCampaigns:a.rpcCampaigns,defer:i}),1===t.length&&n(),i.promise}}function n(){return function(e){return new Date(1e3*e).toISOString().substr(11,8)}}function a(e,t,n){function a(){return n.hasPermission(101)||n.hasRole("admin")}var i=this;i.hasPermission=a,e.$on("$stateChangeSuccess",function(e,n,a,o,s){if(n.data)switch(i.currentTab=n.data.selectedTab,i.currentTab){case 1:t.go("app.dashboards.general.dialer");break;default:t.go("app.dashboards.general.voice")}})}e.$inject=["$q"],t.$inject=["$q"],a.$inject=["$scope","$state","Auth"],angular.module("app.dashboards").filter("secToTime",n).factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",t).controller("UserDashboardGeneralController",a)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d){function c(){d({queues:p.inboundQueues,rpcQueues:p.rpcQueues}).then(function(e){p.inbound=e})}function m(e){p.inboundQueues[e.id]&&p.rpcQueues[e.id]&&(p.rpcQueues[e.id]=e,c())}function u(e){p.outbound=e}var p=this;p.inboundQueues=s?_.keyBy(s.rows?s.rows:[],"id"):{},p.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},p.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},p.outbound=l||{answered:0,sumBillable:0,sumDuration:0,sumHoldTime:0,total:0},p.onSaveQueue=m,p.onSaveOutbound=u,i.on("voice_queue:save",p.onSaveQueue),i.on("voice_outbound:save",p.onSaveOutbound),c(),e.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),i.removeAllListeners("voice_outbound:save")})}e.$inject=["$scope","$interval","$mdSidenav","Auth","socket","api","inboundQueues","rpcQueues","outbound","initializeRealtimeQueue"],angular.module("app.dashboards").controller("UserVoiceDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.faxAccount.save(p.faxAccount).$promise.then(function(e){p.faxAccounts.unshift(e),i.success({title:"FaxAccount properly created",msg:p.faxAccount.name?p.faxAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete faxDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.faxAccountFaxDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.faxAccount.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditFaxDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/faxDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxDisposition:t,faxDispositions:h.faxAccountFaxDispositions.rows}})}function p(e){r.faxDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.faxAccountFaxDispositions.rows,{id:e.id}),h.faxAccountFaxDispositions.count-=1,h.faxAccountFaxDispositions.rows.length||h.getFaxAccountFaxDispositions(),s.success({title:"FaxDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected faxDispositions?").htmlContent(""+h.selectedFaxAccountFaxDispositions.length+" selected will be deleted.").ariaLabel("delete faxDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedFaxAccountFaxDispositions.forEach(function(e){p(e)}),h.selectedFaxAccountFaxDispositions=[]})}var h=this;h.faxAccount={},h.faxAccountFaxDispositions={count:0,rows:[]},h.selectedFaxAccountFaxDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getFaxAccountFaxDispositions=m,h.createOrEditFaxAccountFaxDisposition=u,h.deleteFaxAccountFaxDisposition=p,h.deleteSelectedFaxAccountFaxDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getFaxAccountFaxDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.fax").controller("FaxAccountFaxDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.faxDisposition.save(p.faxDisposition).$promise.then(function(e){p.faxDispositions.unshift(e),i.success({title:"FaxDisposition properly created",msg:p.faxDisposition.name?p.faxDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.faxDisposition.save"}];for(var t=0;t"+(e.name||"faxAccount")+" will be deleted.").ariaLabel("delete faxAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.faxAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.faxAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditFaxAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:t,faxAccounts:A.faxAccounts.rows}})}function v(e){l.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.faxAccounts.rows,{id:e.id}),A.faxAccounts.count-=1,A.faxAccounts.rows.length||A.getFaxAccounts(),c.success({title:"FaxAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedFaxAccounts);return A.selectedFaxAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent(""+A.selectedFaxAccounts.length+" selected will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedFaxAccounts.forEach(function(e){v(e)}),A.selectedFaxAccounts=[]})}function E(){A.selectedFaxAccounts=[]}function y(){A.selectedFaxAccounts=A.faxAccounts.rows}var A=this;A.faxAccounts=r||{count:0,rows:[]},A.table="faxAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedFaxAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,headerinfo,TrunkId,localstationid,ListId,fidelity,timeout,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl",sort:"-updatedAt",limit:10,page:1},A.arrayminrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraymaxrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraytech=_.keyBy([{option:"SIP",value:"'SIP'"},{option:"IAX",value:"'IAX'"},{option:"DADHI",value:"'DADHI'"},{option:"KHOMP",value:"'KHOMP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayacceptMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrejectMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycloseMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getFaxAccounts=g,A.createOrEditFaxAccount=h,A.deleteFaxAccount=v,A.exportSelectedFaxAccounts=b,A.deleteSelectedFaxAccounts=f,A.deselectFaxAccounts=E,A.selectAllFaxAccounts=y,l.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){A.trunks=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})});var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","faxAccounts","api","msUtils","toasty"],angular.module("app.fax").controller("FaxAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.faxQueue.save(p.faxQueue).$promise.then(function(e){p.faxQueues.unshift(e),i.success({title:"FaxQueue properly created",msg:p.faxQueue.name?p.faxQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.save"}];for(var t=0;t"+(e.name||"faxQueue")+" will be deleted.").ariaLabel("delete faxQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.faxQueues=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.faxQueue.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:t,faxQueues:A.faxQueues.rows}})}function v(e){l.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(A.faxQueues.rows,{id:e.id}),A.faxQueues.count-=1,A.faxQueues.rows.length||A.getFaxQueues(),c.success({title:"FaxQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedFaxQueues);return A.selectedFaxQueues=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent(""+A.selectedFaxQueues.length+" selected will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedFaxQueues.forEach(function(e){v(e)}),A.selectedFaxQueues=[]})}function E(){A.selectedFaxQueues=[]}function y(){A.selectedFaxQueues=A.faxQueues.rows}var A=this;A.faxQueues=r||{count:0,rows:[]},A.table="faxQueues",A.listOrder="",A.listOrderAsc=null,A.selectedFaxQueues=[],A.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",limit:10,page:1},A.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getFaxQueues=g,A.createOrEditFaxQueue=h,A.deleteFaxQueue=v,A.exportSelectedFaxQueues=b,A.deleteSelectedFaxQueues=f,A.deselectFaxQueues=E,A.selectAllFaxQueues=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","faxQueues","api","msUtils","toasty"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e){this.info=e}e.$inject=["info"],angular.module("app.help.about").controller("AboutController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intFreshdeskAccount.save(p.freshdeskAccount).$promise.then(function(e){p.freshdeskAccounts.unshift(e),i.success({title:"FreshdeskAccount properly created",msg:p.freshdeskAccount.name?p.freshdeskAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.save"}];for(var t=0;t"+(i.name||"freshdeskConfiguration")+" will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(t).ok("OK").cancel("CANCEL");e.show(o).then(function(){n.intFreshdeskConfiguration.delete({id:i.id}).$promise.then(function(){_.remove(A.configurations,{id:i.id}),a.success({title:"FreshdeskConfiguration deleted!",msg:i.name?i.name+" has been deleted!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){A.getFreshdeskConfiguration(0)})},function(){console.log("CANCEL")})}function d(n,a){e.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"subject",item:a,items:A.subjects,configuration:A.freshdeskConfiguration,account:A.freshdeskAccount}})}function c(e){n.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.subjects,{id:e.id}),a.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(t,n){var a=e.confirm().title("Are you sure want to delete the subject?").htmlContent("Subject will be deleted.").ariaLabel("delete subject").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){c(n)},function(){console.log("CANCEL")})}function u(t){var n=e.confirm().title("Are you sure want to delete the selected subjects?").htmlContent(""+A.selectedSubjects.length+" selected will be deleted.").ariaLabel("delete subjects").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedSubjects.forEach(function(e){c(e)}),A.selectedSubjects=[]})}function p(n,a){e.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"description",item:a,items:A.descriptions,configuration:A.freshdeskConfiguration,account:A.freshdeskAccount}})}function g(e){n.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.descriptions,{id:e.id}),a.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(t,n){var a=e.confirm().title("Are you sure want to delete the description?").htmlContent("Description will be deleted.").ariaLabel("delete description").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){g(n)},function(){console.log("CANCEL")})}function v(t){var n=e.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent(""+A.selectedDescriptions.length+" selected will be deleted.").ariaLabel("delete descriptions").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedDescriptions.forEach(function(e){g(e)}),A.selectedDescriptions=[]})}function b(n,a){e.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"field",item:a,items:A.fields,configuration:A.freshdeskConfiguration,account:A.freshdeskAccount}})}function f(e){n.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.fields,{id:e.id}),a.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function E(t,n){var a=e.confirm().title("Are you sure want to delete the field?").htmlContent("Field will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){f(n)},function(){console.log("CANCEL")})}function y(t){var n=e.confirm().title("Are you sure want to delete the selected fields?").htmlContent(""+A.selectedFields.length+" selected will be deleted.").ariaLabel("delete fields").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedFields.forEach(function(e){f(e)}),A.selectedFields=[]})}var A=this;A.freshdeskAccount={},A.freshdeskConfiguration={},A.configurations=[],A.selectedFreshdeskConfiguration=-1,A.init=o,A.getFreshdeskConfiguration=s,A.createOrEditFreshdeskConfiguration=r,A.deleteFreshdeskConfiguration=l,A.selectedTags=[],A.selectTagsChanged=i,n.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){A.tags=e.rows?e.rows:[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),A.selectedSubjects=[],A.createOrEditSubject=d,A.deleteSubjectConfirm=m,A.deleteSelectedSubjects=u,A.selectedDescriptions=[],A.createOrEditDescription=p,A.deleteDescriptionConfirm=h,A.deleteSelectedDescriptions=v,A.selectedFields=[],A.createOrEditField=b,A.deleteFieldConfirm=E,A.deleteSelectedFields=y}e.$inject=["$mdDialog","$document","api","toasty"],angular.module("app.integrations").controller("FreshdeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intFreshdeskAccount.addConfiguration({id:t.params.id},p.freshdeskConfiguration).$promise.then(function(e){p.configurations.unshift(e),i.success({title:"FreshdeskConfiguration properly created",msg:p.freshdeskConfiguration.name?p.freshdeskConfiguration.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.save"}];for(var t=0;t"+(e.name||"freshdeskAccount")+" will be deleted.").ariaLabel("delete freshdeskAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.freshdeskAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.intFreshdeskAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditFreshdeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskAccount:t,freshdeskAccounts:A.freshdeskAccounts.rows}})}function v(e){l.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.freshdeskAccounts.rows,{id:e.id}),A.freshdeskAccounts.count-=1,A.freshdeskAccounts.rows.length||A.getFreshdeskAccounts(),c.success({title:"FreshdeskAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshdeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedFreshdeskAccounts);return A.selectedFreshdeskAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent(""+A.selectedFreshdeskAccounts.length+" selected will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedFreshdeskAccounts.forEach(function(e){v(e)}),A.selectedFreshdeskAccounts=[]})}function E(){A.selectedFreshdeskAccounts=[]}function y(){A.selectedFreshdeskAccounts=A.freshdeskAccounts.rows}var A=this;A.freshdeskAccounts=r||{count:0,rows:[]},A.table="freshdeskAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedFreshdeskAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getFreshdeskAccounts=g,A.createOrEditFreshdeskAccount=h,A.deleteFreshdeskAccount=v,A.exportSelectedFreshdeskAccounts=b,A.deleteSelectedFreshdeskAccounts=f,A.deselectFreshdeskAccounts=E,A.selectAllFreshdeskAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","freshdeskAccounts","api","msUtils","toasty"],angular.module("app.integrations").controller("FreshdeskAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intSalesforceAccount.save(p.salesforceAccount).$promise.then(function(e){p.salesforceAccounts.unshift(e),i.success({title:"SalesforceAccount properly created",msg:p.salesforceAccount.name?p.salesforceAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.save"}];for(var t=0;t"+(i.name||"salesforceConfiguration")+" will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(t).ok("OK").cancel("CANCEL");e.show(o).then(function(){n.intSalesforceConfiguration.delete({id:i.id}).$promise.then(function(){_.remove(y.configurations,{id:i.id}),a.success({title:"SalesforceConfiguration deleted!",msg:i.name?i.name+" has been deleted!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){y.getSalesforceConfiguration(0)})},function(){console.log("CANCEL")})}function l(n,a){e.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"subject",item:a,items:y.subjects,configuration:y.salesforceConfiguration,account:y.salesforceAccount}})}function d(e){n.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(y.subjects,{id:e.id}),a.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function c(t,n){var a=e.confirm().title("Are you sure want to delete the subject?").htmlContent("Subject will be deleted.").ariaLabel("delete subject").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){d(n)},function(){console.log("CANCEL")})}function m(t){var n=e.confirm().title("Are you sure want to delete the selected subjects?").htmlContent(""+y.selectedSubjects.length+" selected will be deleted.").ariaLabel("delete subjects").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedSubjects.forEach(function(e){d(e)}),y.selectedSubjects=[]})}function u(n,a){e.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"description",item:a,items:y.descriptions,configuration:y.salesforceConfiguration,account:y.salesforceAccount}})}function p(e){n.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(y.descriptions,{id:e.id}),a.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(t,n){var a=e.confirm().title("Are you sure want to delete the description?").htmlContent("Description will be deleted.").ariaLabel("delete description").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){p(n)},function(){console.log("CANCEL")})}function h(t){var n=e.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent(""+y.selectedDescriptions.length+" selected will be deleted.").ariaLabel("delete descriptions").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedDescriptions.forEach(function(e){p(e)}),y.selectedDescriptions=[]})}function v(n,a){e.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"field",item:a,items:y.fields,configuration:y.salesforceConfiguration,account:y.salesforceAccount}})}function b(e){n.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(y.fields,{id:e.id}),a.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(t,n){var a=e.confirm().title("Are you sure want to delete the field?").htmlContent("Field will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){b(n)},function(){console.log("CANCEL")})}function E(t){var n=e.confirm().title("Are you sure want to delete the selected fields?").htmlContent(""+y.selectedFields.length+" selected will be deleted.").ariaLabel("delete fields").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedFields.forEach(function(e){b(e)}),y.selectedFields=[]})}var y=this;y.salesforceAccount={},y.salesforceConfiguration={},y.configurations=[],y.selectedSalesforceConfiguration=-1,y.init=i,y.getSalesforceConfiguration=o,y.createOrEditSalesforceConfiguration=s,y.deleteSalesforceConfiguration=r,y.selectedSubjects=[],y.createOrEditSubject=l,y.deleteSubjectConfirm=c,y.deleteSelectedSubjects=m,y.selectedDescriptions=[],y.createOrEditDescription=u,y.deleteDescriptionConfirm=g,y.deleteSelectedDescriptions=h,y.selectedFields=[],y.createOrEditField=v,y.deleteFieldConfirm=f,y.deleteSelectedFields=E}e.$inject=["$mdDialog","$document","api","toasty"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intSalesforceAccount.addConfiguration({id:t.params.id},p.salesforceConfiguration).$promise.then(function(e){p.configurations.unshift(e),i.success({title:"SalesforceConfiguration properly created",msg:p.salesforceConfiguration.name?p.salesforceConfiguration.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.save"}];for(var t=0;t"+(e.name||"salesforceAccount")+" will be deleted.").ariaLabel("delete salesforceAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.salesforceAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.intSalesforceAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditSalesforceAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceAccount:t,salesforceAccounts:A.salesforceAccounts.rows}})}function v(e){l.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.salesforceAccounts.rows,{id:e.id}),A.salesforceAccounts.count-=1,A.salesforceAccounts.rows.length||A.getSalesforceAccounts(),c.success({title:"SalesforceAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSalesforceAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedSalesforceAccounts);return A.selectedSalesforceAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent(""+A.selectedSalesforceAccounts.length+" selected will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedSalesforceAccounts.forEach(function(e){v(e)}),A.selectedSalesforceAccounts=[]})}function E(){A.selectedSalesforceAccounts=[]}function y(){A.selectedSalesforceAccounts=A.salesforceAccounts.rows}var A=this;A.salesforceAccounts=r||{count:0,rows:[]},A.table="salesforceAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedSalesforceAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getSalesforceAccounts=g,A.createOrEditSalesforceAccount=h,A.deleteSalesforceAccount=v,A.exportSelectedSalesforceAccounts=b,A.deleteSelectedSalesforceAccounts=f,A.deselectSalesforceAccounts=E,A.selectAllSalesforceAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","salesforceAccounts","api","msUtils","toasty"],angular.module("app.integrations").controller("SalesforceAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intSugarcrmAccount.save(p.sugarcrmAccount).$promise.then(function(e){p.sugarcrmAccounts.unshift(e),i.success({title:"SugarcrmAccount properly created",msg:p.sugarcrmAccount.name?p.sugarcrmAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.save"}];for(var t=0;t"+(i.name||"sugarcrmConfiguration")+" will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(t).ok("OK").cancel("CANCEL");e.show(o).then(function(){n.intSugarcrmConfiguration.delete({id:i.id}).$promise.then(function(){_.remove(y.configurations,{id:i.id}),a.success({title:"SugarcrmConfiguration deleted!",msg:i.name?i.name+" has been deleted!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){y.getSugarcrmConfiguration(0)})},function(){console.log("CANCEL")})}function l(n,a){e.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"subject",item:a,items:y.subjects,configuration:y.sugarcrmConfiguration,account:y.sugarcrmAccount}})}function d(e){n.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(y.subjects,{id:e.id}),a.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function c(t,n){var a=e.confirm().title("Are you sure want to delete the subject?").htmlContent("Subject will be deleted.").ariaLabel("delete subject").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){d(n)},function(){console.log("CANCEL")})}function m(t){var n=e.confirm().title("Are you sure want to delete the selected subjects?").htmlContent(""+y.selectedSubjects.length+" selected will be deleted.").ariaLabel("delete subjects").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedSubjects.forEach(function(e){d(e)}),y.selectedSubjects=[]})}function u(n,a){e.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"description",item:a,items:y.descriptions,configuration:y.sugarcrmConfiguration,account:y.sugarcrmAccount}})}function p(e){n.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(y.descriptions,{id:e.id}),a.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(t,n){var a=e.confirm().title("Are you sure want to delete the description?").htmlContent("Description will be deleted.").ariaLabel("delete description").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){p(n)},function(){console.log("CANCEL")})}function h(t){var n=e.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent(""+y.selectedDescriptions.length+" selected will be deleted.").ariaLabel("delete descriptions").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedDescriptions.forEach(function(e){p(e)}),y.selectedDescriptions=[]})}function v(n,a){e.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"field",item:a,items:y.fields,configuration:y.sugarcrmConfiguration,account:y.sugarcrmAccount}})}function b(e){n.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(y.fields,{id:e.id}),a.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(t,n){var a=e.confirm().title("Are you sure want to delete the field?").htmlContent("Field will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){b(n)},function(){console.log("CANCEL")})}function E(t){var n=e.confirm().title("Are you sure want to delete the selected fields?").htmlContent(""+y.selectedFields.length+" selected will be deleted.").ariaLabel("delete fields").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){y.selectedFields.forEach(function(e){b(e)}),y.selectedFields=[]})}var y=this;y.sugarcrmAccount={},y.sugarcrmConfiguration={},y.configurations=[],y.selectedSugarcrmConfiguration=-1,y.init=i,y.getSugarcrmConfiguration=o,y.createOrEditSugarcrmConfiguration=s,y.deleteSugarcrmConfiguration=r,y.selectedSubjects=[],y.createOrEditSubject=l,y.deleteSubjectConfirm=c,y.deleteSelectedSubjects=m,y.selectedDescriptions=[],y.createOrEditDescription=u,y.deleteDescriptionConfirm=g,y.deleteSelectedDescriptions=h,y.selectedFields=[],y.createOrEditField=v,y.deleteFieldConfirm=f,y.deleteSelectedFields=E}e.$inject=["$mdDialog","$document","api","toasty"],angular.module("app.integrations").controller("SugarcrmAccountConfigurationsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intSugarcrmAccount.addConfiguration({id:t.params.id},p.sugarcrmConfiguration).$promise.then(function(e){p.configurations.unshift(e),i.success({title:"SugarcrmConfiguration properly created",msg:p.sugarcrmConfiguration.name?p.sugarcrmConfiguration.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.save"}];for(var t=0;t"+(e.name||"sugarcrmAccount")+" will be deleted.").ariaLabel("delete sugarcrmAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.sugarcrmAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.intSugarcrmAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditSugarcrmAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmAccount:t,sugarcrmAccounts:A.sugarcrmAccounts.rows}})}function v(e){l.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.sugarcrmAccounts.rows,{id:e.id}),A.sugarcrmAccounts.count-=1,A.sugarcrmAccounts.rows.length||A.getSugarcrmAccounts(),c.success({title:"SugarcrmAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSugarcrmAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedSugarcrmAccounts);return A.selectedSugarcrmAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent(""+A.selectedSugarcrmAccounts.length+" selected will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedSugarcrmAccounts.forEach(function(e){v(e)}),A.selectedSugarcrmAccounts=[]})}function E(){A.selectedSugarcrmAccounts=[]}function y(){A.selectedSugarcrmAccounts=A.sugarcrmAccounts.rows}var A=this;A.sugarcrmAccounts=r||{count:0,rows:[]},A.table="sugarcrmAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedSugarcrmAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getSugarcrmAccounts=g,A.createOrEditSugarcrmAccount=h,A.deleteSugarcrmAccount=v,A.exportSelectedSugarcrmAccounts=b,A.deleteSelectedSugarcrmAccounts=f,A.deselectSugarcrmAccounts=E,A.selectAllSugarcrmAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","sugarcrmAccounts","api","msUtils","toasty"],angular.module("app.integrations").controller("SugarcrmAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intZendeskAccount.save(p.zendeskAccount).$promise.then(function(e){p.zendeskAccounts.unshift(e),i.success({title:"ZendeskAccount properly created",msg:p.zendeskAccount.name?p.zendeskAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.save"}];for(var t=0;t"+(i.name||"zendeskConfiguration")+" will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(t).ok("OK").cancel("CANCEL");e.show(o).then(function(){n.intZendeskConfiguration.delete({id:i.id}).$promise.then(function(){_.remove(A.zendeskConfigurations,{id:i.id}),a.success({title:"ZendeskConfiguration deleted!",msg:i.name?i.name+" has been deleted!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){A.getZendeskConfiguration(0)})},function(){console.log("CANCEL")})}function d(n,a){e.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"subject",item:a,items:A.subjects,configuration:A.zendeskConfiguration,account:A.zendeskAccount}})}function c(e){n.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.subjects,{id:e.id}),a.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(t,n){var a=e.confirm().title("Are you sure want to delete the subject?").htmlContent("Subject will be deleted.").ariaLabel("delete subject").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){c(n)},function(){console.log("CANCEL")})}function u(t){var n=e.confirm().title("Are you sure want to delete the selected subjects?").htmlContent(""+A.selectedSubjects.length+" selected will be deleted.").ariaLabel("delete subjects").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedSubjects.forEach(function(e){c(e)}),A.selectedSubjects=[]})}function p(n,a){e.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"description",item:a,items:A.descriptions,configuration:A.zendeskConfiguration,account:A.zendeskAccount}})}function g(e){n.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.descriptions,{id:e.id}),a.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(t,n){var a=e.confirm().title("Are you sure want to delete the description?").htmlContent("Description will be deleted.").ariaLabel("delete description").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){g(n)},function(){console.log("CANCEL")})}function v(t){var n=e.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent(""+A.selectedDescriptions.length+" selected will be deleted.").ariaLabel("delete descriptions").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedDescriptions.forEach(function(e){g(e)}),A.selectedDescriptions=[]})}function b(n,a){e.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{type:"field",item:a,items:A.fields,configuration:A.zendeskConfiguration,account:A.zendeskAccount}})}function f(e){n.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(A.fields,{id:e.id}),a.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function E(t,n){var a=e.confirm().title("Are you sure want to delete the field?").htmlContent("Field will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");e.show(a).then(function(){f(n)},function(){console.log("CANCEL")})}function y(t){var n=e.confirm().title("Are you sure want to delete the selected fields?").htmlContent(""+A.selectedFields.length+" selected will be deleted.").ariaLabel("delete fields").targetEvent(t).ok("OK").cancel("CANCEL");e.show(n).then(function(){A.selectedFields.forEach(function(e){f(e)}),A.selectedFields=[]})}var A=this;A.zendeskAccount={},A.zendeskConfiguration={},A.zendeskConfigurations=[],A.selectedZendeskConfiguration=-1,A.init=o,A.getZendeskConfiguration=s,A.createOrEditZendeskConfiguration=r,A.deleteZendeskConfiguration=l,A.selectedTags=[],A.selectTagsChanged=i,n.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){A.tags=e.rows?e.rows:[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),A.selectedSubjects=[],A.createOrEditSubject=d,A.deleteSubjectConfirm=m,A.deleteSelectedSubjects=u,A.selectedDescriptions=[],A.createOrEditDescription=p,A.deleteDescriptionConfirm=h,A.deleteSelectedDescriptions=v,A.selectedFields=[],A.createOrEditField=b,A.deleteFieldConfirm=E,A.deleteSelectedFields=y}e.$inject=["$mdDialog","$document","api","toasty"],angular.module("app.integrations").controller("ZendeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.intZendeskAccount.addConfiguration({id:t.params.id},p.zendeskConfiguration).$promise.then(function(e){p.zendeskConfigurations.unshift(e),i.success({title:"ZendeskConfiguration properly created",msg:p.zendeskConfiguration.name?p.zendeskConfiguration.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.save"}];for(var t=0;t"+(e.name||"zendeskAccount")+" will be deleted.").ariaLabel("delete zendeskAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.zendeskAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.intZendeskAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditZendeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskAccount:t,zendeskAccounts:A.zendeskAccounts.rows}})}function v(e){l.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.zendeskAccounts.rows,{id:e.id}),A.zendeskAccounts.count-=1,A.zendeskAccounts.rows.length||A.getZendeskAccounts(),c.success({title:"ZendeskAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZendeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedZendeskAccounts);return A.selectedZendeskAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent(""+A.selectedZendeskAccounts.length+" selected will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedZendeskAccounts.forEach(function(e){v(e)}),A.selectedZendeskAccounts=[]})}function E(){A.selectedZendeskAccounts=[]}function y(){A.selectedZendeskAccounts=A.zendeskAccounts.rows}var A=this;A.zendeskAccounts=r||{count:0,rows:[]},A.table="zendeskAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedZendeskAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,authType,password,token,serverUrl,description",limit:10,page:1},A.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getZendeskAccounts=g,A.createOrEditZendeskAccount=h,A.deleteZendeskAccount=v,A.exportSelectedZendeskAccounts=b,A.deleteSelectedZendeskAccounts=f,A.deselectZendeskAccounts=E,A.selectAllZendeskAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","zendeskAccounts","api","msUtils","toasty"],angular.module("app.integrations").controller("ZendeskAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.mailAccount.save(p.mailAccount).$promise.then(function(e){p.mailAccounts.unshift(e),i.success({title:"MailAccount properly created",msg:p.mailAccount.name?p.mailAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete mailDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.mailAccountMailDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.mailAccount.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditMailDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailDisposition:t,mailDispositions:h.mailAccountMailDispositions.rows}})}function p(e){r.mailDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.mailAccountMailDispositions.rows,{id:e.id}),h.mailAccountMailDispositions.count-=1,h.mailAccountMailDispositions.rows.length||h.getMailAccountMailDispositions(),s.success({title:"MailDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected mailDispositions?").htmlContent(""+h.selectedMailAccountMailDispositions.length+" selected will be deleted.").ariaLabel("delete mailDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedMailAccountMailDispositions.forEach(function(e){p(e)}),h.selectedMailAccountMailDispositions=[]})}var h=this;h.mailAccount={},h.mailAccountMailDispositions={count:0,rows:[]},h.selectedMailAccountMailDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getMailAccountMailDispositions=m,h.createOrEditMailAccountMailDisposition=u,h.deleteMailAccountMailDisposition=p,h.deleteSelectedMailAccountMailDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getMailAccountMailDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.mail").controller("MailAccountMailDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.mailDisposition.save(p.mailDisposition).$promise.then(function(e){p.mailDispositions.unshift(e),i.success({title:"MailDisposition properly created",msg:p.mailDisposition.name?p.mailDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mailDisposition.save"}];for(var t=0;t"+(e.name||"mailAccount")+" will be deleted.").ariaLabel("delete mailAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.mailAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.mailAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:t,mailAccounts:A.mailAccounts.rows}})}function v(e){l.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.mailAccounts.rows,{id:e.id}),A.mailAccounts.count-=1,A.mailAccounts.rows.length||A.getMailAccounts(),c.success({title:"MailAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedMailAccounts);return A.selectedMailAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected mailAccounts?").htmlContent(""+A.selectedMailAccounts.length+" selected will be deleted.").ariaLabel("delete MailAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedMailAccounts.forEach(function(e){v(e)}),A.selectedMailAccounts=[]})}function E(){A.selectedMailAccounts=[]}function y(){A.selectedMailAccounts=A.mailAccounts.rows}var A=this;A.mailAccounts=r||{count:0,rows:[]},A.table="mailAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedMailAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,address,ListId,TemplateId,fidelity,timeout,service,description,Imap.host,Imap.username,Imap.password,Imap.port,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Imap.delete,Imap.ssl,Imap.keepalive,Smtp.host,Smtp.username,Smtp.password,Smtp.port,Smtp.ssl,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,whiteLabel",limit:10,page:1},A.arrayacceptMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrejectMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycloseMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getMailAccounts=g,A.createOrEditMailAccount=h,A.deleteMailAccount=v,A.exportSelectedMailAccounts=b,A.deleteSelectedMailAccounts=f,A.deselectMailAccounts=E,A.selectAllMailAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getMailAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","mailAccounts","api","msUtils","toasty"],angular.module("app.mail").controller("MailAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.mailQueue.save(p.mailQueue).$promise.then(function(e){p.mailQueues.unshift(e),i.success({title:"MailQueue properly created",msg:p.mailQueue.name?p.mailQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.save"}];for(var t=0;t"+(e.name||"mailQueue")+" will be deleted.").ariaLabel("delete mailQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.mailQueues=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.mailQueue.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:t,mailQueues:A.mailQueues.rows}})}function v(e){l.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(A.mailQueues.rows,{id:e.id}),A.mailQueues.count-=1,A.mailQueues.rows.length||A.getMailQueues(),c.success({title:"MailQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedMailQueues);return A.selectedMailQueues=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent(""+A.selectedMailQueues.length+" selected will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedMailQueues.forEach(function(e){v(e)}),A.selectedMailQueues=[]})}function E(){A.selectedMailQueues=[]}function y(){A.selectedMailQueues=A.mailQueues.rows}var A=this;A.mailQueues=r||{count:0,rows:[]},A.table="mailQueues",A.listOrder="",A.listOrderAsc=null,A.selectedMailQueues=[],A.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",limit:10,page:1},A.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getMailQueues=g,A.createOrEditMailQueue=h,A.deleteMailQueue=v,A.exportSelectedMailQueues=b,A.deleteSelectedMailQueues=f,A.deselectMailQueues=E,A.selectAllMailQueues=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","mailQueues","api","msUtils","toasty"],angular.module("app.mail").controller("MailQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.campaign.save(p.ivrCampaign).$promise.then(function(e){p.ivrCampaigns.unshift(e),i.success({title:"IvrCampaign properly created",msg:p.ivrCampaign.name?p.ivrCampaign.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.campaign.getHopperBlacks(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperBlack:t,hopperBlacks:h.ivrCampaignHopperBlacks.rows}})}function p(e){r.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(h.ivrCampaignHopperBlacks.rows,{id:e.id}),h.ivrCampaignHopperBlacks.count-=1,h.ivrCampaignHopperBlacks.rows.length||h.getIvrCampaignHopperBlacks(),s.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent(""+h.selectedIvrCampaignHopperBlacks.length+" selected will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedIvrCampaignHopperBlacks.forEach(function(e){p(e)}),h.selectedIvrCampaignHopperBlacks=[]})}var h=this;h.ivrCampaign={},h.ivrCampaignHopperBlacks={count:0,rows:[]},h.selectedIvrCampaignHopperBlacks=[],h.query={fields:"createdAt,updatedAt,ContactId,phone",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getIvrCampaignHopperBlacks=m,h.createOrEditIvrCampaignHopperBlack=u,h.deleteIvrCampaignHopperBlack=p,h.deleteSelectedIvrCampaignHopperBlacks=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getIvrCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.ivrCampaign=e,h.query.id=h.ivrCampaign.id,h.query.CampaignId=h.ivrCampaign.id,h.getIvrCampaignHopperFinals()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.campaign.getHopperFinals(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperFinal:t,hopperFinals:h.ivrCampaignHopperFinals.rows}})}function p(e){r.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(h.ivrCampaignHopperFinals.rows,{id:e.id}),h.ivrCampaignHopperFinals.count-=1,h.ivrCampaignHopperFinals.rows.length||h.getIvrCampaignHopperFinals(),s.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent(""+h.selectedIvrCampaignHopperFinals.length+" selected will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedIvrCampaignHopperFinals.forEach(function(e){p(e)}),h.selectedIvrCampaignHopperFinals=[]})}var h=this;h.ivrCampaign={},h.ivrCampaignHopperFinals={count:0,rows:[]},h.selectedIvrCampaignHopperFinals=[],h.query={fields:"createdAt,updatedAt,uniqueid,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getIvrCampaignHopperFinals=m,h.createOrEditIvrCampaignHopperFinal=u,h.deleteIvrCampaignHopperFinal=p,h.deleteSelectedIvrCampaignHopperFinals=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getIvrCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.ivrCampaign=e,h.query.id=h.ivrCampaign.id,h.query.CampaignId=h.ivrCampaign.id,h.getIvrCampaignHopperHistories()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.campaign.getHopperHistories(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperHistory:t,hopperHistories:h.ivrCampaignHopperHistories.rows}})}function p(e){r.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(h.ivrCampaignHopperHistories.rows,{id:e.id}),h.ivrCampaignHopperHistories.count-=1,h.ivrCampaignHopperHistories.rows.length||h.getIvrCampaignHopperHistories(),s.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent(""+h.selectedIvrCampaignHopperHistories.length+" selected will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedIvrCampaignHopperHistories.forEach(function(e){p(e)}),h.selectedIvrCampaignHopperHistories=[]})}var h=this;h.ivrCampaign={},h.ivrCampaignHopperHistories={count:0,rows:[]},h.selectedIvrCampaignHopperHistories=[],h.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getIvrCampaignHopperHistories=m,h.createOrEditIvrCampaignHopperHistory=u,h.deleteIvrCampaignHopperHistory=p,h.deleteSelectedIvrCampaignHopperHistories=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getIvrCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.ivrCampaign=e,h.query.id=h.ivrCampaign.id,h.query.CampaignId=h.ivrCampaign.id,h.getIvrCampaignHoppers()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopper?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.ivrCampaignHoppers=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.campaign.getHoppers(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:h.ivrCampaignHoppers.rows}})}function p(e){r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(h.ivrCampaignHoppers.rows,{id:e.id}),h.ivrCampaignHoppers.count-=1,h.ivrCampaignHoppers.rows.length||h.getIvrCampaignHoppers(),s.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent(""+h.selectedIvrCampaignHoppers.length+" selected will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedIvrCampaignHoppers.forEach(function(e){p(e)}),h.selectedIvrCampaignHoppers=[]})}var h=this;h.ivrCampaign={},h.ivrCampaignHoppers={count:0,rows:[]},h.selectedIvrCampaignHoppers=[],h.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getIvrCampaignHoppers=m,h.createOrEditIvrCampaignHopper=u,h.deleteIvrCampaignHopper=p,h.deleteSelectedIvrCampaignHoppers=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getIvrCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cmHopper.save(p.hopper).$promise.then(function(e){p.hoppers.unshift(e),i.success({title:"Hopper properly created",msg:p.hopper.name?p.hopper.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var t=0;t"+(e.name||"ivrCampaign")+" will be deleted.").ariaLabel("delete ivrCampaign").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){f(e)},function(){console.log("CANCEL")})}function h(e){x.ivrCampaigns=e||{count:0,rows:[]}}function v(){x.query.offset=(x.query.page-1)*x.query.limit,x.promise=l.campaign.get(x.query,h).$promise}function b(e,t){i.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:t,ivrCampaigns:x.ivrCampaigns.rows}})}function f(e){l.campaign.delete({id:e.id}).$promise.then(function(){_.remove(x.ivrCampaigns.rows,{id:e.id}),x.ivrCampaigns.count-=1,x.ivrCampaigns.rows.length||x.getIvrCampaigns(),c.success({title:"IvrCampaign deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})}function E(){var e=_.clone(x.selectedIvrCampaigns);return x.selectedIvrCampaigns=[],e}function y(e){var t=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent(""+x.selectedIvrCampaigns.length+" selected will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){x.selectedIvrCampaigns.forEach(function(e){f(e)}),x.selectedIvrCampaigns=[]})}function A(){x.selectedIvrCampaigns=[]}function C(){x.selectedIvrCampaigns=x.ivrCampaigns.rows}var x=this;x.ivrCampaigns=r||{count:0,rows:[]},x.table="ivrCampaigns",x.listOrder="",x.listOrderAsc=null,x.selectedIvrCampaigns=[],x.query={fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialGlobalInterval,dialTimezone",type:"ivr",sort:"-updatedAt",limit:10,page:1},x.editstate=m,x.listadddialog=u,x.blacklistadddialog=p,x.deleteconfirm=g,x.success=h,x.getIvrCampaigns=v,x.createOrEditIvrCampaign=b,x.deleteIvrCampaign=f,x.exportSelectedIvrCampaigns=E,x.deleteSelectedIvrCampaigns=y,x.deselectIvrCampaigns=A,x.selectAllIvrCampaigns=C,l.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){x.trunks=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){x.projects=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){x.interval=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var T=!0,S=1;e.$watch("vm.query.filter",function(e,t){T?s(function(){T=!1}):(t||(S=x.query.page),e!==t&&(x.query.page=1),e||(x.query.page=S),x.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","ivrCampaigns","api","msUtils","toasty"],angular.module("app.motiondialer").controller("IvrCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceQueue.save(p.queueCampaign).$promise.then(function(e){p.queueCampaigns.unshift(e),i.success({title:"QueueCampaign properly created",msg:p.queueCampaign.name?p.queueCampaign.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceQueue.getHopperBlacks(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperBlack:t,hopperBlacks:h.queueCampaignHopperBlacks.rows}})}function p(e){r.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(h.queueCampaignHopperBlacks.rows,{id:e.id}),h.queueCampaignHopperBlacks.count-=1,h.queueCampaignHopperBlacks.rows.length||h.getQueueCampaignHopperBlacks(),s.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent(""+h.selectedQueueCampaignHopperBlacks.length+" selected will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedQueueCampaignHopperBlacks.forEach(function(e){p(e)}),h.selectedQueueCampaignHopperBlacks=[]})}var h=this;h.queueCampaign={},h.queueCampaignHopperBlacks={count:0,rows:[]},h.selectedQueueCampaignHopperBlacks=[],h.query={fields:"createdAt,updatedAt,ContactId,phone",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getQueueCampaignHopperBlacks=m,h.createOrEditQueueCampaignHopperBlack=u,h.deleteQueueCampaignHopperBlack=p,h.deleteSelectedQueueCampaignHopperBlacks=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getQueueCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.queueCampaign=e,h.query.id=h.queueCampaign.id,h.query.VoiceQueueId=h.queueCampaign.id,h.getQueueCampaignHopperFinals()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.queueCampaignHopperFinals=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceQueue.getHopperFinals(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperFinal:t,hopperFinals:h.queueCampaignHopperFinals.rows}})}function p(e){r.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(h.queueCampaignHopperFinals.rows,{id:e.id}),h.queueCampaignHopperFinals.count-=1,h.queueCampaignHopperFinals.rows.length||h.getQueueCampaignHopperFinals(),s.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent(""+h.selectedQueueCampaignHopperFinals.length+" selected will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedQueueCampaignHopperFinals.forEach(function(e){p(e)}),h.selectedQueueCampaignHopperFinals=[]})}var h=this;h.queueCampaign={},h.queueCampaignHopperFinals={count:0,rows:[]},h.selectedQueueCampaignHopperFinals=[],h.query={fields:"createdAt,updatedAt,uniqueid,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getQueueCampaignHopperFinals=m,h.createOrEditQueueCampaignHopperFinal=u,h.deleteQueueCampaignHopperFinal=p,h.deleteSelectedQueueCampaignHopperFinals=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getQueueCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.queueCampaign=e,h.query.id=h.queueCampaign.id,h.query.VoiceQueueId=h.queueCampaign.id,h.getQueueCampaignHopperHistories()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.queueCampaignHopperHistories=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceQueue.getHopperHistories(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopperHistory:t,hopperHistories:h.queueCampaignHopperHistories.rows}})}function p(e){r.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(h.queueCampaignHopperHistories.rows,{id:e.id}),h.queueCampaignHopperHistories.count-=1,h.queueCampaignHopperHistories.rows.length||h.getQueueCampaignHopperHistories(),s.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent(""+h.selectedQueueCampaignHopperHistories.length+" selected will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedQueueCampaignHopperHistories.forEach(function(e){p(e)}),h.selectedQueueCampaignHopperHistories=[]})}var h=this;h.queueCampaign={},h.queueCampaignHopperHistories={count:0,rows:[]},h.selectedQueueCampaignHopperHistories=[],h.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getQueueCampaignHopperHistories=m,h.createOrEditQueueCampaignHopperHistory=u,h.deleteQueueCampaignHopperHistory=p,h.deleteSelectedQueueCampaignHopperHistories=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getQueueCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(e){h.queueCampaign=e,h.query.id=h.queueCampaign.id,h.query.VoiceQueueId=h.queueCampaign.id,h.getQueueCampaignHoppers()}function d(e,t){var n=i.confirm().title("Are you sure want to delete the hopper?").htmlContent(""+e.name+" will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.queueCampaignHoppers=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceQueue.getHoppers(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditHopperDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:h.queueCampaignHoppers.rows}})}function p(e){r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(h.queueCampaignHoppers.rows,{id:e.id}),h.queueCampaignHoppers.count-=1,h.queueCampaignHoppers.rows.length||h.getQueueCampaignHoppers(),s.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent(""+h.selectedQueueCampaignHoppers.length+" selected will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedQueueCampaignHoppers.forEach(function(e){p(e)}),h.selectedQueueCampaignHoppers=[]})}var h=this;h.queueCampaign={},h.queueCampaignHoppers={count:0,rows:[]},h.selectedQueueCampaignHoppers=[],h.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getQueueCampaignHoppers=m,h.createOrEditQueueCampaignHopper=u,h.deleteQueueCampaignHopper=p,h.deleteSelectedQueueCampaignHoppers=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getQueueCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cmHopper.save(p.hopper).$promise.then(function(e){p.hoppers.unshift(e),i.success({title:"Hopper properly created",msg:p.hopper.name?p.hopper.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var t=0;t"+(e.name||"queueCampaign")+" will be deleted.").ariaLabel("delete queueCampaign").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){y(e)},function(){console.log("CANCEL")})}function b(e){S.queueCampaigns=e||{count:0,rows:[]}}function f(){S.query.offset=(S.query.page-1)*S.query.limit,S.promise=l.voiceQueue.get(S.query,b).$promise}function E(e,t){i.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:t,queueCampaigns:S.queueCampaigns.rows}})}function y(e){l.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(S.queueCampaigns.rows,{id:e.id}),S.queueCampaigns.count-=1,S.queueCampaigns.rows.length||S.getQueueCampaigns(),c.success({title:"QueueCampaign deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=_.clone(S.selectedQueueCampaigns);return S.selectedQueueCampaigns=[],e}function C(e){var t=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent(""+S.selectedQueueCampaigns.length+" selected will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){S.selectedQueueCampaigns.forEach(function(e){y(e)}),S.selectedQueueCampaigns=[]})}function x(){S.selectedQueueCampaigns=[]}function T(){S.selectedQueueCampaigns=S.queueCampaigns.rows}var S=this;S.queueCampaigns=r||{count:0,rows:[]},S.table="queueCampaigns",S.listOrder="",S.listOrderAsc=null,S.selectedQueueCampaigns=[],S.query={fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialGlobalInterval,dialTimezone,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialOriginateTimeout,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,description",type:"outbound",sort:"-updatedAt",limit:10,page:1},S.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraydialMethod=_.keyBy([{option:"Progressive",value:"'progressive'"},{option:"PowerDialing",value:"'power'"},{option:"Predictive",value:"'predictive'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.arraystrategy=_.keyBy([{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.editstate=m,S.listadddialog=u,S.blacklistadddialog=p,S.teamadddialog=g,S.agentadddialog=h,S.deleteconfirm=v,S.success=b,S.getQueueCampaigns=f,S.createOrEditQueueCampaign=E,S.deleteQueueCampaign=y,S.exportSelectedQueueCampaigns=A,S.deleteSelectedQueueCampaigns=C,S.deselectQueueCampaigns=x,S.selectAllQueueCampaigns=T,l.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){S.trunks=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){S.interval=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var O=!0,w=1;e.$watch("vm.query.filter",function(e,t){O?s(function(){O=!1}):(t||(w=S.query.page),e!==t&&(S.query.page=1),e||(S.query.page=w),S.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","queueCampaigns","api","msUtils","toasty"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(){_.forIn(A.agents,function(e,t){A.rpcAgents[t]&&_.merge(e,_.pick(A.rpcAgents[t],C))})}function u(e,t){return r.user.logout({id:e.id}).$promise.then(function(){d.success({title:"Agent logout",msg:e.fullname+" properly logout"})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function p(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",realtime:!0,direction:"outbound"}})}function g(e,t){return r.user.pause({id:e.id,type:t})}function h(e){return r.user.unpause({id:e.id})}function v(e){return _.includes(A.availableStates,e)}function b(e){A.agents[e.id]&&_.merge(A.agents[e.id],_.pick(e,C))}function f(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("
TODO legend status + state
").ok("Ok").targetEvent(e))}function E(e){A.count=e.count,A.agents=e?_.keyBy(e.rows?e.rows:[],"id"):{},m()}function y(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=r.user.get(A.query,E).$promise}var A=this,C=["userpic","online","voicePause","lastLoginAt","lastPauseAt","pauseType","internal","state","stateTime","status","address"];A.availableStates=["ringing","inuse","busy","onhold","not_inuse"],A.pauses=i||{count:0,rows:[]},A.count=o.count,A.agents=o?_.keyBy(o.rows?o.rows:[],"id"):{},A.rpcAgents=s?_.keyBy(s.rows?s.rows:[],"id"):{},A.query={fields:"id,fullname,userpic,role,internal,online,voicePause,pauseType,lastLoginAt",role:"agent",sort:"-updatedAt",limit:10,page:1},A.statusClass=c.status,A.stateClass=c.state,A.pause=g,A.unPause=h,A.onSave=b,A.$onInit=m,A.success=E,A.showInfo=f,A.queueAdd=p,A.getAgents=y,A.isAvailableState=v,A.logout=u,l.on("user:save",A.onSave),l.on("user:update",A.onSave);var x=!0,T=1;e.$watch("vm.query.filter",function(e,n){x?t(function(){x=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getAgents())}),e.$on("$destroy",function(){l.removeAllListeners("user:save"),l.removeAllListeners("user:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","pauses","agents","rpcAgents","api","socket","toasty","helperClasses"],angular.module("app.motiondialer").controller("AgentsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l){function d(){_.forIn(g.campaigns,function(e,t){g.rpcCampaigns[t]&&_.merge(e,_.pick(g.rpcCampaigns[t],h))})}function c(e){g.campaigns[e.id]&&(_.merge(g.campaigns[e.id],_.pick(e,h)),_.merge(g.rpcCampaigns[e.id],_.pick(e,h)))}function m(e){g.count=e.count,g.campaigns=e?_.keyBy(e.rows?e.rows:[],"id"):{},d()}function u(){g.query.offset=(g.query.page-1)*g.query.limit,g.promise=s.campaign.get(g.query,m).$promise}function p(e,t){n.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:t,ivrCampaigns:_.values(g.campaigns)}})}var g=this,h=["name","active","limitCalls","message","originated","IntervalId","SquareProjectId","Trunk","TrunkId","ivrAnswerCallsDay","dialQueueProject","ivrTotalCallsDays","description"];g.count=o.count,g.campaigns=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcCampaigns=i?_.keyBy(i.rows?i.rows:[],"id"):{},g.query={sort:"-updatedAt",limit:10,page:1},g.success=m,g.getCampaigns=u,g.onSave=c,g.$onInit=d,g.createOrEditIvrCampaign=p,r.on("campaign:save",g.onSave);var v=!0,b=1;e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(b=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=b),g.getCampaigns())}),e.$on("$destroy",function(){r.removeAllListeners("campaign:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","rpcCampaigns","campaigns","api","socket","Auth"],angular.module("app.motiondialer").controller("IvrCampaignsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l){function d(e){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:e}).$promise.then(function(t){l.success({title:"Channel "+e+" properly hangup!",msg:t.message||""})}).catch(function(e){console.error(e)})}function c(e,t){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:e,exten:t}).$promise.then(function(t){l.success({title:"Channel "+e+" properly redirect!",msg:t.message||""})}).catch(function(e){console.error(e)})}function m(e,t){var a=n.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return n.show(a).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise.then(function(e){l.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){console.error(e)})}).catch(function(e){console.error(e)})}function u(e){var t=_.find(g.calls.rows,{channel:e.channel});e.status=e.queuecallerleaveAt?"up":"ring",t?_.merge(t,e):g.calls.rows.push(e)}function p(e){var n=_.findIndex(g.calls.rows,{channel:e.channel});n>=0&&(g.calls.rows[n].status="hangup"),t(function(){g.calls.rows.splice(n,1)},5e3)}var g=this;g.calls=i||{rows:[],count:0},g.agents=a||{count:0,rows:[]},g.query={limit:10,page:1,limitOptions:[10,15,20]},g.channelStatusClass=r.channelStatus,g.onSave=u,g.onRemove=p,g.hangup=d,g.redirectToAgent=c,g.redirectToNumber=m,s.on("voice_queue_channel:save",g.onSave),s.on("voice_queue_channel:remove",g.onRemove),e.$on("$destroy",function(){s.removeAllListeners("voice_queue_channel:save"),s.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","rpcCalls","api","socket","helperClasses","toasty"],angular.module("app.motiondialer").controller("QueueCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s){function r(){_.forIn(m.queues,function(e,t){m.rpcQueues[t]&&_.merge(e,_.pick(m.rpcQueues[t],u))})}function l(e){m.queues[e.id]&&_.merge(m.queues[e.id],_.pick(e,u))}function d(e){m.count=e.count,m.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},r()}function c(){m.query.offset=(m.query.page-1)*m.query.limit,s.hasRole("admin")?m.promise=i.voiceQueue.get(m.query,d).$promise:m.promise=i.user.getQueues(m.query,d).$promise}var m=this,u=["total","answered","sumHoldTime","sumDuration","sumBillable","outboundNoAnswerCallsDay","outboundBusyCallsDay","outboundCongestionCallsDay","outboundNoSuchCallsDay","outboundUnknownCallsDay","outboundDropCallsDayTimeout","outboundDropCallsDayCallersExit","outboundBlacklistCallsDay","outboundOriginateFailureCallsDay","outboundAnswerAgiCallsDay"];m.count=n.count,m.queues=n?_.keyBy(n.rows?n.rows:[],"id"):{},m.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},s.hasRole("admin")?m.query={type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:m.query={id:s.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},m.success=d,m.getQueues=c,m.onSave=l,m.$onInit=r,o.on("voice_queue:save",m.onSave);var p=!0,g=1;e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=g),m.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save")})}e.$inject=["$scope","$timeout","queues","rpcQueues","api","socket","Auth"],angular.module("app.motiondialer").controller("QueueParamsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(){var e=[];return _.forIn(E.queues,function(t,n){t.paused=0,t.loggedInDb=0,e.push(r.voiceQueue.getMembers({id:n}).$promise),E.rpcQueues[n]&&_.merge(t,_.pick(E.rpcQueues[n],y))}),a.all(e).then(function(e){for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete openchannelDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.openchannelAccountOpenchannelDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.openchannelAccount.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditOpenchannelDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelDisposition:t,openchannelDispositions:h.openchannelAccountOpenchannelDispositions.rows}})}function p(e){r.openchannelDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.openchannelAccountOpenchannelDispositions.rows,{id:e.id}),h.openchannelAccountOpenchannelDispositions.count-=1,h.openchannelAccountOpenchannelDispositions.rows.length||h.getOpenchannelAccountOpenchannelDispositions(),s.success({title:"OpenchannelDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelDispositions?").htmlContent(""+h.selectedOpenchannelAccountOpenchannelDispositions.length+" selected will be deleted.").ariaLabel("delete openchannelDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedOpenchannelAccountOpenchannelDispositions.forEach(function(e){p(e)}),h.selectedOpenchannelAccountOpenchannelDispositions=[]})}var h=this;h.openchannelAccount={},h.openchannelAccountOpenchannelDispositions={count:0,rows:[]},h.selectedOpenchannelAccountOpenchannelDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getOpenchannelAccountOpenchannelDispositions=m,h.createOrEditOpenchannelAccountOpenchannelDisposition=u,h.deleteOpenchannelAccountOpenchannelDisposition=p,h.deleteSelectedOpenchannelAccountOpenchannelDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getOpenchannelAccountOpenchannelDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.openchannelDisposition.save(p.openchannelDisposition).$promise.then(function(e){p.openchannelDispositions.unshift(e),i.success({title:"OpenchannelDisposition properly created",msg:p.openchannelDisposition.name?p.openchannelDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelDisposition.save"}];for(var t=0;t"+(e.name||"openchannelAccount")+" will be deleted.").ariaLabel("delete openchannelAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.openchannelAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.openchannelAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditOpenchannelAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:t,openchannelAccounts:A.openchannelAccounts.rows}})}function v(e){l.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.openchannelAccounts.rows,{id:e.id}),A.openchannelAccounts.count-=1,A.openchannelAccounts.rows.length||A.getOpenchannelAccounts(),c.success({title:"OpenchannelAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedOpenchannelAccounts);return A.selectedOpenchannelAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent(""+A.selectedOpenchannelAccounts.length+" selected will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedOpenchannelAccounts.forEach(function(e){v(e)}),A.selectedOpenchannelAccounts=[]})}function E(){A.selectedOpenchannelAccounts=[]}function y(){A.selectedOpenchannelAccounts=A.openchannelAccounts.rows}var A=this;A.openchannelAccounts=r||{count:0,rows:[]},A.table="openchannelAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedOpenchannelAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,ListId,fidelity,timeout,remote,description,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl",sort:"-updatedAt",limit:10,page:1},A.arrayacceptMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrejectMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycloseMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getOpenchannelAccounts=g,A.createOrEditOpenchannelAccount=h,A.deleteOpenchannelAccount=v,A.exportSelectedOpenchannelAccounts=b,A.deleteSelectedOpenchannelAccounts=f,A.deselectOpenchannelAccounts=E,A.selectAllOpenchannelAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","openchannelAccounts","api","msUtils","toasty"],angular.module("app.openchannel").controller("OpenchannelAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.openchannelQueue.save(p.openchannelQueue).$promise.then(function(e){p.openchannelQueues.unshift(e),i.success({title:"OpenchannelQueue properly created",msg:p.openchannelQueue.name?p.openchannelQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.save"}];for(var t=0;t"+(e.name||"openchannelQueue")+" will be deleted.").ariaLabel("delete openchannelQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.openchannelQueues=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.openchannelQueue.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:t,openchannelQueues:A.openchannelQueues.rows}})}function v(e){l.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(A.openchannelQueues.rows,{id:e.id}),A.openchannelQueues.count-=1,A.openchannelQueues.rows.length||A.getOpenchannelQueues(),c.success({title:"OpenchannelQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedOpenchannelQueues);return A.selectedOpenchannelQueues=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent(""+A.selectedOpenchannelQueues.length+" selected will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedOpenchannelQueues.forEach(function(e){v(e)}),A.selectedOpenchannelQueues=[]})}function E(){A.selectedOpenchannelQueues=[]}function y(){A.selectedOpenchannelQueues=A.openchannelQueues.rows}var A=this;A.openchannelQueues=r||{count:0,rows:[]},A.table="openchannelQueues",A.listOrder="",A.listOrderAsc=null,A.selectedOpenchannelQueues=[],A.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",limit:10,page:1},A.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getOpenchannelQueues=g,A.createOrEditOpenchannelQueue=h,A.deleteOpenchannelQueue=v,A.exportSelectedOpenchannelQueues=b,A.deleteSelectedOpenchannelQueues=f,A.deselectOpenchannelQueues=E,A.selectAllOpenchannelQueues=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","openchannelQueues","api","msUtils","toasty"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.setting.save(p.customization).$promise.then(function(e){p.customizations.unshift(e),i.success({title:"Customization properly created",msg:p.customization.name?p.customization.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var t=0;t"+(e.name||"network")+" will be deleted.").ariaLabel("delete network").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.networks=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.network.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{network:t,networks:A.networks.rows}})}function v(e){l.network.delete({id:e.id}).$promise.then(function(){_.remove(A.networks.rows,{id:e.id}),A.networks.count-=1,A.networks.rows.length||A.getNetworks(),c.success({title:"Network deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETnetwork",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedNetworks);return A.selectedNetworks=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent(""+A.selectedNetworks.length+" selected will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedNetworks.forEach(function(e){v(e)}),A.selectedNetworks=[]})}function E(){A.selectedNetworks=[]}function y(){A.selectedNetworks=A.networks.rows}var A=this;A.networks=r||{count:0,rows:[]},A.table="networks",A.listOrder="",A.listOrderAsc=null,A.selectedNetworks=[],A.query={fields:"createdAt,updatedAt,id,type,value,value,createdAt",sort:"-updatedAt",limit:10,page:1},A.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getNetworks=g,A.createOrEditNetwork=h,A.deleteNetwork=v,A.exportSelectedNetworks=b,A.deleteSelectedNetworks=f,A.deselectNetworks=E,A.selectAllNetworks=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","networks","api","msUtils","toasty"],angular.module("app.settings").controller("NetworksController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.mailAccount.save(p.smtp).$promise.then(function(e){p.smtps.unshift(e),i.success({title:"Smtp properly created",msg:p.smtp.name?p.smtp.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var t=0;t
Do you agree the terms of this End User License Agreement?').ariaLabel("").targetEvent(t).clickOutsideToClose(!0).parent(angular.element(n.body)).ok("I agree").cancel("Disagree");e.show(a).then(function(){e.show({controller:"UpdateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/updates/update/dialog.html",parent:angular.element(n.body),targetEvent:t,clickOutsideToClose:!1})})}var s=this;s.version=a||{},s.updateConfirm=o}e.$inject=["$mdDialog","$interval","$document","version","toasty"],angular.module("app.settings").controller("UpdatesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.smsAccount.save(p.smsAccount).$promise.then(function(e){p.smsAccounts.unshift(e),i.success({title:"SmsAccount properly created",msg:p.smsAccount.name?p.smsAccount.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete smsDisposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.smsAccountSmsDispositions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.smsAccount.getDispositions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditSmsDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsDisposition:t,smsDispositions:h.smsAccountSmsDispositions.rows}})}function p(e){r.smsDisposition.delete({id:e.id}).$promise.then(function(){_.remove(h.smsAccountSmsDispositions.rows,{id:e.id}),h.smsAccountSmsDispositions.count-=1,h.smsAccountSmsDispositions.rows.length||h.getSmsAccountSmsDispositions(),s.success({title:"SmsDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected smsDispositions?").htmlContent(""+h.selectedSmsAccountSmsDispositions.length+" selected will be deleted.").ariaLabel("delete smsDispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedSmsAccountSmsDispositions.forEach(function(e){p(e)}),h.selectedSmsAccountSmsDispositions=[]})}var h=this;h.smsAccount={},h.smsAccountSmsDispositions={count:0,rows:[]},h.selectedSmsAccountSmsDispositions=[],h.query={fields:"createdAt,updatedAt,id,name,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getSmsAccountSmsDispositions=m,h.createOrEditSmsAccountSmsDisposition=u,h.deleteSmsAccountSmsDisposition=p,h.deleteSelectedSmsAccountSmsDispositions=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getSmsAccountSmsDispositions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.sms").controller("SmsAccountSmsDispositionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.smsDisposition.save(p.smsDisposition).$promise.then(function(e){p.smsDispositions.unshift(e),i.success({title:"SmsDisposition properly created",msg:p.smsDisposition.name?p.smsDisposition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.smsDisposition.save"}];for(var t=0;t"+(e.name||"smsAccount")+" will be deleted.").ariaLabel("delete smsAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.smsAccounts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.smsAccount.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditSmsAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:t,smsAccounts:A.smsAccounts.rows}})}function v(e){l.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(A.smsAccounts.rows,{id:e.id}),A.smsAccounts.count-=1,A.smsAccounts.rows.length||A.getSmsAccounts(),c.success({title:"SmsAccount deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedSmsAccounts);return A.selectedSmsAccounts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent(""+A.selectedSmsAccounts.length+" selected will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedSmsAccounts.forEach(function(e){v(e)}),A.selectedSmsAccounts=[]})}function E(){A.selectedSmsAccounts=[]}function y(){A.selectedSmsAccounts=A.smsAccounts.rows}var A=this;A.smsAccounts=r||{count:0,rows:[]},A.table="smsAccounts",A.listOrder="",A.listOrderAsc=null,A.selectedSmsAccounts=[],A.query={fields:"createdAt,updatedAt,id,name,ListId,fidelity,timeout,type,smstype,phone,sid,token,username,password,remote,description,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl",sort:"-updatedAt",limit:10,page:1},A.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Skebby",value:"'skebby'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraysmstype=_.keyBy([{option:"Basic",value:"'basic'"},{option:"Classic",value:"'classic'"},{option:"Classic+",value:"'classic+'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayacceptMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrejectMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycloseMethod=_.keyBy([{option:"HTTP GET",value:"'GET'"},{option:"HTTP POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getSmsAccounts=g,A.createOrEditSmsAccount=h,A.deleteSmsAccount=v,A.exportSelectedSmsAccounts=b,A.deleteSelectedSmsAccounts=f,A.deselectSmsAccounts=E,A.selectAllSmsAccounts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","smsAccounts","api","msUtils","toasty"],angular.module("app.sms").controller("SmsAccountsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.smsQueue.save(p.smsQueue).$promise.then(function(e){p.smsQueues.unshift(e),i.success({title:"SmsQueue properly created",msg:p.smsQueue.name?p.smsQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.save"}];for(var t=0;t"+(e.name||"smsQueue")+" will be deleted.").ariaLabel("delete smsQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.smsQueues=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.smsQueue.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:t,smsQueues:A.smsQueues.rows}})}function v(e){l.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(A.smsQueues.rows,{id:e.id}),A.smsQueues.count-=1,A.smsQueues.rows.length||A.getSmsQueues(),c.success({title:"SmsQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedSmsQueues);return A.selectedSmsQueues=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent(""+A.selectedSmsQueues.length+" selected will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedSmsQueues.forEach(function(e){v(e)}),A.selectedSmsQueues=[]})}function E(){A.selectedSmsQueues=[]}function y(){A.selectedSmsQueues=A.smsQueues.rows}var A=this;A.smsQueues=r||{count:0,rows:[]},A.table="smsQueues",A.listOrder="",A.listOrderAsc=null,A.selectedSmsQueues=[],A.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",limit:10,page:1},A.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getSmsQueues=g,A.createOrEditSmsQueue=h,A.deleteSmsQueue=v,A.exportSelectedSmsQueues=b,A.deleteSelectedSmsQueues=f,A.deselectSmsQueues=E,A.selectAllSmsQueues=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","smsQueues","api","msUtils","toasty"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.staff.agents.edit",{id:e.id,agent:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the agent?").htmlContent(""+(e.name||"agent")+" will be deleted.").ariaLabel("delete agent").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.agents=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.user.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:t,agents:A.agents.rows}})}function v(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(A.agents.rows,{id:e.id}),A.agents.count-=1,A.agents.rows.length||A.getAgents(),c.success({title:"Agent deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedAgents);return A.selectedAgents=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected agents?").htmlContent(""+A.selectedAgents.length+" selected will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedAgents.forEach(function(e){v(e)}),A.selectedAgents=[]})}function E(){A.selectedAgents=[]}function y(){A.selectedAgents=A.agents.rows}var A=this;A.agents=r||{count:0,rows:[]},A.table="agents",A.listOrder="",A.listOrderAsc=null,A.selectedAgents=[],A.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,userpic,password,description,autointernal,internal,loginInPause,voicemail,transport,host,nat,type,allow,callerid,callgroup,pickupgroup,chanspy,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarRingInUse,phoneBarEnableRecording,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarNoReply,phoneBarNoReplyNumber,phoneBarBusy,phoneBarBusyNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort",role:"agent",sort:"-updatedAt",limit:10,page:1},A.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayallow=_.keyBy([{option:"alaw",value:"'alaw'"},{option:"ulaw",value:"'ulaw'"},{option:"gsm",value:"'gsm'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getAgents=g,A.createOrEditAgent=h,A.deleteAgent=v,A.exportSelectedAgents=b,A.deleteSelectedAgents=f,A.deselectAgents=E,A.selectAllAgents=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getAgents())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","agents","api","msUtils","toasty"],angular.module("app.staff").controller("AgentsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.user.save(p.agent).$promise.then(function(e){p.agents.unshift(e),i.success({title:"Agent properly created",msg:p.agent.name?p.agent.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var t=0;t"+(e.name||"team")+" will be deleted.").ariaLabel("delete team").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})}function g(e){C.teams=e||{count:0,rows:[]}}function h(){C.query.offset=(C.query.page-1)*C.query.limit,C.promise=l.team.get(C.query,g).$promise}function v(e,t){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{team:t,teams:C.teams.rows}})}function b(e){l.team.delete({id:e.id}).$promise.then(function(){_.remove(C.teams.rows,{id:e.id}),C.teams.count-=1,C.teams.rows.length||C.getTeams(),c.success({title:"Team deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETteam",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(){var e=_.clone(C.selectedTeams);return C.selectedTeams=[],e}function E(e){var t=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent(""+C.selectedTeams.length+" selected will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){C.selectedTeams.forEach(function(e){b(e)}),C.selectedTeams=[]})}function y(){C.selectedTeams=[]}function A(){C.selectedTeams=C.teams.rows}var C=this;C.teams=r||{count:0,rows:[]},C.table="teams",C.listOrder="",C.listOrderAsc=null,C.selectedTeams=[],C.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},C.editdialog=m,C.agentadddialog=u,C.deleteconfirm=p,C.success=g,C.getTeams=h,C.createOrEditTeam=v,C.deleteTeam=b,C.exportSelectedTeams=f,C.deleteSelectedTeams=E,C.deselectTeams=y,C.selectAllTeams=A;var x=!0,T=1;e.$watch("vm.query.filter",function(e,t){x?s(function(){x=!1}):(t||(T=C.query.page),e!==t&&(C.query.page=1),e||(C.query.page=T),C.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","teams","api","msUtils","toasty"],angular.module("app.staff").controller("TeamsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.user.save(p.telephone).$promise.then(function(e){p.telephones.unshift(e),i.success({title:"Telephone properly created",msg:p.telephone.name?p.telephone.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var t=0;t"+(e.name||"telephone")+" will be deleted.").ariaLabel("delete telephone").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.telephones=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.user.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditTelephoneDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{telephone:t,telephones:A.telephones.rows}})}function v(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(A.telephones.rows,{id:e.id}),A.telephones.count-=1,A.telephones.rows.length||A.getTelephones(),c.success({title:"Telephone deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedTelephones);return A.selectedTelephones=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent(""+A.selectedTelephones.length+" selected will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedTelephones.forEach(function(e){v(e)}),A.selectedTelephones=[]})}function E(){A.selectedTelephones=[]}function y(){A.selectedTelephones=A.telephones.rows}var A=this;A.telephones=r||{count:0,rows:[]},A.table="telephones",A.listOrder="",A.listOrderAsc=null,A.selectedTelephones=[],A.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,callgroup,pickupgroup",role:"telephone",sort:"-updatedAt",limit:10,page:1},A.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayallow=_.keyBy([{option:"alaw",value:"'alaw'"},{option:"ulaw",value:"'ulaw'"},{option:"gsm",value:"'gsm'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getTelephones=g,A.createOrEditTelephone=h,A.deleteTelephone=v,A.exportSelectedTelephones=b,A.deleteSelectedTelephones=f,A.deselectTelephones=E,A.selectAllTelephones=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","telephones","api","msUtils","toasty"],angular.module("app.staff").controller("TelephonesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.user.save(p.user).$promise.then(function(e){p.users.unshift(e),i.success({title:"User properly created",msg:p.user.name?p.user.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var t=0;t"+(e.name||"user")+" will be deleted.").ariaLabel("delete user").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.users=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.user.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:t,users:A.users.rows}})}function v(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(A.users.rows,{id:e.id}),A.users.count-=1,A.users.rows.length||A.getUsers(),c.success({title:"User deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedUsers);return A.selectedUsers=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected users?").htmlContent(""+A.selectedUsers.length+" selected will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedUsers.forEach(function(e){v(e)}),A.selectedUsers=[]})}function E(){A.selectedUsers=[]}function y(){A.selectedUsers=A.users.rows}var A=this;A.users=r||{count:0,rows:[]},A.table="users",A.listOrder="",A.listOrderAsc=null,A.selectedUsers=[],A.query={fields:"createdAt,updatedAt,role,id,fullname,name,email,userpic,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,callgroup,pickupgroup,permissions",role:"admin,user",sort:"-updatedAt",limit:10,page:1},A.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayallow=_.keyBy([{option:"alaw",value:"'alaw'"},{option:"ulaw",value:"'ulaw'"},{option:"gsm",value:"'gsm'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getUsers=g,A.createOrEditUser=h,A.deleteUser=v,A.exportSelectedUsers=b,A.deleteSelectedUsers=f,A.deselectUsers=E,A.selectAllUsers=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getUsers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","users","api","msUtils","toasty"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(o.body),targetEvent:t,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:A.cannedAnswers.rows}})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the cannedAnswer?").htmlContent(""+(e.name||"cannedAnswer")+" will be deleted.").ariaLabel("delete cannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.cannedAnswers=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.cannedAnswer.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{cannedAnswer:t,cannedAnswers:A.cannedAnswers.rows}})}function v(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(A.cannedAnswers.rows,{id:e.id}),A.cannedAnswers.count-=1,A.cannedAnswers.rows.length||A.getCannedAnswers(),c.success({title:"CannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcannedAnswer",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedCannedAnswers);return A.selectedCannedAnswers=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent(""+A.selectedCannedAnswers.length+" selected will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedCannedAnswers.forEach(function(e){v(e)}),A.selectedCannedAnswers=[]})}function E(){A.selectedCannedAnswers=[]}function y(){A.selectedCannedAnswers=A.cannedAnswers.rows}var A=this;A.cannedAnswers=r||{count:0,rows:[]},A.table="cannedAnswers",A.listOrder="",A.listOrderAsc=null,A.selectedCannedAnswers=[],A.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getCannedAnswers=g,A.createOrEditCannedAnswer=h,A.deleteCannedAnswer=v,A.exportSelectedCannedAnswers=b,A.deleteSelectedCannedAnswers=f,A.deselectCannedAnswers=E,A.selectAllCannedAnswers=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","cannedAnswers","api","msUtils","toasty"],angular.module("app.tools").controller("CannedAnswersController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.cannedAnswer.save(p.cannedAnswer).$promise.then(function(e){p.cannedAnswers.unshift(e),i.success({title:"CannedAnswer properly created",msg:p.cannedAnswer.name?p.cannedAnswer.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var t=0;t"+(e.name||"customDashboard")+" will be deleted.").ariaLabel("delete customDashboard").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.customDashboards=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.dashboard.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditCustomDashboardDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{customDashboard:t,customDashboards:A.customDashboards.rows}})}function v(e){l.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(A.customDashboards.rows,{id:e.id}),A.customDashboards.count-=1,A.customDashboards.rows.length||A.getCustomDashboards(),c.success({title:"CustomDashboard deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdashboard",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedCustomDashboards);return A.selectedCustomDashboards=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent(""+A.selectedCustomDashboards.length+" selected will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedCustomDashboards.forEach(function(e){v(e)}),A.selectedCustomDashboards=[]})}function E(){A.selectedCustomDashboards=[]}function y(){A.selectedCustomDashboards=A.customDashboards.rows}var A=this;A.customDashboards=r||{count:0,rows:[]},A.table="customDashboards",A.listOrder="",A.listOrderAsc=null,A.selectedCustomDashboards=[],A.query={fields:"createdAt,updatedAt,id,name,interval,description",sort:"-updatedAt",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getCustomDashboards=g,A.createOrEditCustomDashboard=h,A.deleteCustomDashboard=v,A.exportSelectedCustomDashboards=b,A.deleteSelectedCustomDashboards=f,A.deselectCustomDashboards=E,A.selectAllCustomDashboards=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","customDashboards","api","msUtils","toasty"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(e){return console.log(e),i.dashboardItem.delete({id:e}).$promise.then(function(t){_.remove(c.items.rows,{id:e})}).catch(function(e){console.error(e)})}function s(e,t,n){return i.dashboardItem.update(n).$promise.catch(function(e){console.error(e)})}function r(e){t.show({controller:"CreateOrEditDashboardItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{dashboarditem:null,dashboard:c.items.rows}})}function l(e){return c.customDashboard=e,d=a(function(){return i.dashboard.run({id:c.customDashboard.id})},1e3*c.customDashboard.interval),i.dashboard.getItems({id:e.id,fields:"id,type,sizeX,sizeY,row,col,data"}).$promise.then(function(e){c.items=e}).catch(function(e){console.error(e)})}var d,c=this;c.customDashboard={},c.gridOptions={resizable:{enabled:!0,stop:s},draggable:{enabled:!0,stop:s}},c.items={rows:[],count:0},c.init=l,c.addItem=r,c.updateItem=s,c.deleteItem=o,e.$on("$destroy",function(){a.cancel(d)})}e.$inject=["$scope","$mdDialog","$document","$interval","api"],angular.module("app.tools").controller("CustomDashboardCustomDashboardController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.dashboard.addItem({id:t.params.id},p.dashboarditem).$promise.then(function(e){p.dashboard.unshift(e),i.success({title:"DashboardItem properly created",msg:p.dashboarditem.name?p.dashboarditem.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete interval").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.intervalIntervals=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.interval.getIntervals(h.query,c).$promise}function u(e,t){i.show({controller:"EditIntervalAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:t,intervals:h.intervalIntervals.rows}})}function p(e){r.interval.delete({id:e.id}).$promise.then(function(){_.remove(h.intervalIntervals.rows,{id:e.id}),h.intervalIntervals.count-=1,h.intervalIntervals.rows.length||h.getIntervalIntervals(),s.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent(""+h.selectedIntervalIntervals.length+" selected will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedIntervalIntervals.forEach(function(e){p(e)}),h.selectedIntervalIntervals=[]})}var h=this;h.interval={},h.intervalIntervals={count:0,rows:[]},h.selectedIntervalIntervals=[],h.sortableTable={animation:100,onSort:function(e){r.interval.addIntervals({id:h.interval.id},e.models).$promise.then(function(e){h.intervalIntervals.rows=e}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},h.query={fields:"createdAt,updatedAt,id,name,interval,createdAt",nolimit:"true",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getIntervalIntervals=m,h.createOrEditIntervalInterval=u,h.deleteIntervalInterval=p,h.deleteSelectedIntervalIntervals=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getIntervalIntervals())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.tools").controller("IntervalIntervalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.interval.save(p.interval).$promise.then(function(e){p.intervals.unshift(e),i.success({title:"Interval properly created",msg:p.interval.name?p.interval.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var t=0;t"+(e.name||"interval")+" will be deleted.").ariaLabel("delete interval").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.intervals=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.interval.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:t,intervals:A.intervals.rows}})}function v(e){l.interval.delete({id:e.id}).$promise.then(function(){_.remove(A.intervals.rows,{id:e.id}),A.intervals.count-=1,A.intervals.rows.length||A.getIntervals(),c.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedIntervals);return A.selectedIntervals=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent(""+A.selectedIntervals.length+" selected will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedIntervals.forEach(function(e){v(e)}),A.selectedIntervals=[]})}function E(){A.selectedIntervals=[]}function y(){A.selectedIntervals=A.intervals.rows}var A=this;A.intervals=r||{count:0,rows:[]},A.table="intervals",A.listOrder="",A.listOrderAsc=null,A.selectedIntervals=[],A.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getIntervals=g,A.createOrEditInterval=h,A.deleteInterval=v,A.exportSelectedIntervals=b,A.deleteSelectedIntervals=f,A.deselectIntervals=E,A.selectAllIntervals=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","intervals","api","msUtils","toasty"],angular.module("app.tools").controller("IntervalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.pause.save(p.pause).$promise.then(function(e){p.pauses.unshift(e),i.success({title:"Pause properly created",msg:p.pause.name?p.pause.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.pause.save"}];for(var t=0;t"+(e.name||"pause")+" will be deleted.").ariaLabel("delete pause").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.pauses=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.pause.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{pause:t,pauses:A.pauses.rows}})}function v(e){l.pause.delete({id:e.id}).$promise.then(function(){_.remove(A.pauses.rows,{id:e.id}),A.pauses.count-=1,A.pauses.rows.length||A.getPauses(),c.success({title:"Pause deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpause",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedPauses);return A.selectedPauses=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent(""+A.selectedPauses.length+" selected will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedPauses.forEach(function(e){v(e)}),A.selectedPauses=[]})}function E(){A.selectedPauses=[]}function y(){A.selectedPauses=A.pauses.rows}var A=this;A.pauses=r||{count:0,rows:[]},A.table="pauses",A.listOrder="",A.listOrderAsc=null,A.selectedPauses=[],A.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getPauses=g,A.createOrEditPause=h,A.deletePause=v,A.exportSelectedPauses=b,A.deleteSelectedPauses=f,A.deselectPauses=E,A.selectAllPauses=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","pauses","api","msUtils","toasty"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.schedule.save(p.schedule).$promise.then(function(e){p.schedules.unshift(e),i.success({title:"Schedule properly created",msg:p.schedule.name?p.schedule.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.save"}];for(var t=0;t"+(e.name||"schedule")+" will be deleted.").ariaLabel("delete schedule").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.schedules=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.schedule.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{schedule:t,schedules:A.schedules.rows}})}function v(e){l.schedule.delete({id:e.id}).$promise.then(function(){_.remove(A.schedules.rows,{id:e.id}),A.schedules.count-=1,A.schedules.rows.length||A.getScheduler(),c.success({title:"Schedule deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETschedule",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedScheduler);return A.selectedScheduler=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent(""+A.selectedScheduler.length+" selected will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedScheduler.forEach(function(e){v(e)}),A.selectedScheduler=[]})}function E(){A.selectedScheduler=[]}function y(){A.selectedScheduler=A.schedules.rows}var A=this;A.schedules=r||{count:0,rows:[]},A.table="schedules",A.listOrder="",A.listOrderAsc=null,A.selectedScheduler=[],A.query={fields:"createdAt,updatedAt,id,name,type,reportType,reportId,reportId,reportOutput,cronType,validityStart,validityEnd,cron,weekDays,monthDay,hour,reportRange,sendMail,MailServerOutId,email,active,description",sort:"-updatedAt",limit:10,page:1},A.arraytype=_.keyBy([{option:"Report",value:"'report'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayreportType=_.keyBy([{option:"Default",value:"'default'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayreportOutput=_.keyBy([{option:"CSV",value:"'CSV'"},{option:"PDF",value:"'PDF'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycronType=_.keyBy([{option:"CurrentDay",value:"'currentDay'"},{option:"Daily",value:"'daily'"},{option:"Weekly",value:"'weekly'"},{option:"Monthly",value:"'monthly'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycron=_.keyBy([{option:"15min",value:"'*/15 * * * *'"},{option:"30min",value:"'*/30 * * * *'"},{option:"1h",value:"'0 * * * *'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayweekDays=_.keyBy([{option:"MON",value:"'monday'"},{option:"TUE",value:"'tuesday'"},{option:"WED",value:"'wednesday'"},{option:"THU",value:"'thursday'"},{option:"FRI",value:"'friday'"},{option:"SAT",value:"'saturday'"},{option:"SUN",value:"'sunday'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayreportRange=_.keyBy([{option:"PREVIOUS_DAY",value:"'yesterday'"},{option:"LAST_SEVEN_DAYS",value:"'last7'"},{option:"LAST_THIRTY_DAYS",value:"'last30'"},{option:"LAST_MONTH",value:"'lastMonth'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getScheduler=g,A.createOrEditSchedule=h,A.deleteSchedule=v,A.exportSelectedScheduler=b,A.deleteSelectedScheduler=f,A.deselectScheduler=E,A.selectAllScheduler=y,l.analyticCustomReport.get({fields:"id,name",sort:"name"}).$promise.then(function(e){A.customReports=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcustomReports",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.analyticDefaultReport.get({fields:"id,name",sort:"name"}).$promise.then(function(e){A.defaultReports=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdefaultReports",msg:e.data?JSON.stringify(e.data):e.toString()})});var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","schedules","api","msUtils","toasty"],angular.module("app.tools").controller("SchedulesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.sound.save(p.sound).$promise.then(function(e){p.sounds.unshift(e),i.success({title:"Sound properly created",msg:p.sound.name?p.sound.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.sound.save"}];for(var t=0;t"+(e.name||"sound")+" will be deleted.").ariaLabel("delete sound").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})}function g(e){x.sounds=e||{count:0,rows:[]}}function h(){x.query.offset=(x.query.page-1)*x.query.limit,x.promise=l.sound.get(x.query,g).$promise}function v(e,t){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{sound:t,sounds:x.sounds.rows}})}function b(e){l.sound.delete({id:e.id}).$promise.then(function(){_.remove(x.sounds.rows,{id:e.id}),x.sounds.count-=1,x.sounds.rows.length||x.getSounds(),c.success({title:"Sound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsound",msg:e.data?JSON.stringify(e.data):e.toString()})})}function f(){var e=_.clone(x.selectedSounds);return x.selectedSounds=[],e}function E(e){var t=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent(""+x.selectedSounds.length+" selected will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){x.selectedSounds.forEach(function(e){b(e)}),x.selectedSounds=[]})}function y(){x.selectedSounds=[]}function A(){x.selectedSounds=x.sounds.rows}function C(e){i.show({controller:"UploadSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/uploadsound/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{sounds:x.sounds.rows}})}var x=this;x.sounds=r||{count:0,rows:[]},x.table="sounds",x.listOrder="",x.listOrderAsc=null,x.selectedSounds=[],x.query={fields:"createdAt,updatedAt,id,name,audio,description",sort:"-updatedAt",limit:10,page:1},x.editdialog=m,x.downloadfile=u,x.deleteconfirm=p,x.success=g,x.getSounds=h,x.createOrEditSound=v,x.deleteSound=b,x.exportSelectedSounds=f,x.deleteSelectedSounds=E,x.deselectSounds=y,x.selectAllSounds=A,x.uploadSound=C;var T=!0,S=1;e.$watch("vm.query.filter",function(e,t){T?s(function(){T=!1}):(t||(S=x.query.page),e!==t&&(x.query.page=1),e||(x.query.page=S),x.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","sounds","api","msUtils","toasty"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(e){var t=["wav","mp3","gsm"];if(_.includes(t,e.getExtension())){var a={id:e.uniqueIdentifier,file:e,type:"uploading"};return d.uploadSounds.unshift(a),!0}return n.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported only: "+t.join()}),!1}function s(){d.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},d.ngFlow.flow.upload()}function r(e,t){d.sounds.unshift(JSON.parse(t)),angular.forEach(d.uploadSounds,function(t,n){if(t.id===e.uniqueIdentifier){var a=new FileReader;a.readAsDataURL(t.file.file),a.onload=function(e){t.url=e.target.result},t.type="sound"}})}function l(){t.hide()}var d=this;d.errors=[],d.title="TOOLS.UPLOAD_SOUND",d.sounds=a,d.uploadSounds=[],d.sound={},d.ngFlowOptions={chunkSize:15728640,maxChunkRetries:1,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,target:"api/sounds"},d.ngFlow={flow:{}},d.dropping=!1,d.fileAdded=o,d.upload=s,d.fileSuccess=r,d.closeDialog=l}e.$inject=["$cookies","$mdDialog","toasty","sounds","api"],angular.module("app.tools").controller("UploadSoundDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.tag.save(p.tag).$promise.then(function(e){p.tags.unshift(e),i.success({title:"Tag properly created",msg:p.tag.name?p.tag.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.tag.save"}];for(var t=0;t"+(e.name||"tag")+" will be deleted.").ariaLabel("delete tag").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.tags=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.tag.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{tag:t,tags:A.tags.rows}})}function v(e){l.tag.delete({id:e.id}).$promise.then(function(){_.remove(A.tags.rows,{id:e.id}),A.tags.count-=1,A.tags.rows.length||A.getTags(),c.success({title:"Tag deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtag",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedTags);return A.selectedTags=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent(""+A.selectedTags.length+" selected will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedTags.forEach(function(e){v(e)}),A.selectedTags=[]})}function E(){A.selectedTags=[]}function y(){A.selectedTags=A.tags.rows}var A=this;A.tags=r||{count:0,rows:[]},A.table="tags",A.listOrder="",A.listOrderAsc=null,A.selectedTags=[],A.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getTags=g,A.createOrEditTag=h,A.deleteTag=v,A.exportSelectedTags=b,A.deleteSelectedTags=f,A.deselectTags=E,A.selectAllTags=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","tags","api","msUtils","toasty"],angular.module("app.tools").controller("TagsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.template.save(p.template).$promise.then(function(e){p.templates.unshift(e),i.success({title:"Template properly created",msg:p.template.name?p.template.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.template.save"}];for(var t=0;t"+(e.name||"template")+" will be deleted.").ariaLabel("delete template").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.templates=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.template.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{template:t,templates:A.templates.rows}})}function v(e){l.template.delete({id:e.id}).$promise.then(function(){_.remove(A.templates.rows,{id:e.id}),A.templates.count-=1,A.templates.rows.length||A.getTemplates(),c.success({title:"Template deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplate",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedTemplates);return A.selectedTemplates=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent(""+A.selectedTemplates.length+" selected will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedTemplates.forEach(function(e){v(e)}),A.selectedTemplates=[]})}function E(){A.selectedTemplates=[]}function y(){A.selectedTemplates=A.templates.rows}var A=this;A.templates=r||{count:0,rows:[]},A.table="templates",A.listOrder="",A.listOrderAsc=null,A.selectedTemplates=[],A.query={fields:"createdAt,updatedAt,id,name,subject,html,description",sort:"-updatedAt",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getTemplates=g,A.createOrEditTemplate=h,A.deleteTemplate=v,A.exportSelectedTemplates=b,A.deleteSelectedTemplates=f,A.deselectTemplates=E,A.selectAllTemplates=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","templates","api","msUtils","toasty"],angular.module("app.tools").controller("TemplatesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.trigger.save(p.trigger).$promise.then(function(e){p.triggers.unshift(e),i.success({title:"Trigger properly created",msg:p.trigger.name?p.trigger.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete action").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.triggerActions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.trigger.getActions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{action:t,actions:h.triggerActions.rows}})}function p(e){r.action.delete({id:e.id}).$promise.then(function(){_.remove(h.triggerActions.rows,{id:e.id}),h.triggerActions.count-=1,h.triggerActions.rows.length||h.getTriggerActions(),s.success({title:"Action deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected actions?").htmlContent(""+h.selectedTriggerActions.length+" selected will be deleted.").ariaLabel("delete actions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedTriggerActions.forEach(function(e){p(e)}),h.selectedTriggerActions=[]})}var h=this;h.trigger={},h.triggerActions={count:0,rows:[]},h.selectedTriggerActions=[],h.query={fields:"createdAt,updatedAt,id,action,data1,data1,data1,data2,data2,data1,data2,data2,data2,data2,data3,data3,data3,data3,data1,data2,data2,data3,data2,data2,data2,createdAt",limit:10,page:1},h.arrayaction=_.keyBy([{option:"CONTACT_MANAGER",value:"'contactManager'"},{option:"INTEGRATIONS",value:"'integration'"},{option:"MOTION_BAR",value:"'motionbar'"},{option:"JSCRIPTY",value:"'jscripty'"},{option:"URL_FORWARD",value:"'urlForward'"},{option:"BROWSER",value:"'browser'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.browserValues=_.keyBy([{option:"Web Popup",value:"'0'"},{option:"Web Tab",value:"'1'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.urlForwardValues=_.keyBy([{option:"GET",value:"'GET'"},{option:"POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.integrationValues=_.keyBy([{option:"Zendesk",value:"'zendesk'"},{option:"Salesforce",value:"'salesforce'"},{option:"SugarCRM",value:"'sugarcrm'"},{option:"Freshdesk",value:"'freshdesk'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.motionbarValues=_.keyBy([{option:"Popup",value:"'0'"},{option:"URL",value:"'1'"},{option:"Windows App",value:"'2'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.init=l,h.deleteConfirm=d,h.success=c,h.getTriggerActions=m,h.createOrEditTriggerAction=u,h.deleteTriggerAction=p,h.deleteSelectedTriggerActions=g,r.cmList.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.lists=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intZendeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.zendeskAccounts=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETzendeskAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intSalesforceAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.salesforceAccounts=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsalesforceAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intSugarcrmAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.sugarcrmAccounts=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsugarcrmAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intFreshdeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.freshdeskAccounts=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfreshdeskAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intZendeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){h.zendeskConfigurations=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETzendeskConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intSalesforceConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){h.salesforceConfigurations=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsalesforceConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intSugarcrmConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){h.sugarcrmConfigurations=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsugarcrmConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.intFreshdeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){h.freshdeskConfigurations=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfreshdeskConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){h.templates=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplates",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getTriggerActions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.trigger.addAction({id:t.params.id},p.action).$promise.then(function(e){p.actions.unshift(e),i.success({title:"Action properly created",msg:p.action.name?p.action.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.action.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete allCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.triggerAllConditions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.trigger.getAllConditions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{allCondition:t,allconditions:h.triggerAllConditions.rows}})}function p(e){r.condition.delete({id:e.id}).$promise.then(function(){_.remove(h.triggerAllConditions.rows,{id:e.id}),h.triggerAllConditions.count-=1,h.triggerAllConditions.rows.length||h.getTriggerAllConditions(),s.success({title:"AllCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected allconditions?").htmlContent(""+h.selectedTriggerAllConditions.length+" selected will be deleted.").ariaLabel("delete allconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedTriggerAllConditions.forEach(function(e){p(e)}),h.selectedTriggerAllConditions=[]})}var h=this;h.trigger={},h.triggerAllConditions={count:0,rows:[]},h.selectedTriggerAllConditions=[],h.query={fields:"createdAt,updatedAt,id,field,operator,value,value,value,createdAt",limit:10,page:1},h.arrayfield=_.keyBy([{option:"Queue",value:"'queue'"},{option:"Call_Status",value:"'lastevent'"},{option:"OutboundRoute",value:"'routeId'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.arrayvalue=_.keyBy([{option:"Abandoned",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Rejected",value:"'rejected'"},{option:"Ringing",value:"'called'"},{option:"Up",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.init=l,h.deleteConfirm=d,h.success=c,h.getTriggerAllConditions=m,h.createOrEditTriggerAllCondition=u,h.deleteTriggerAllCondition=p,h.deleteSelectedTriggerAllConditions=g,r.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h.queues=_.keyBy(e.rows||[],"name")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){h.outboundRoutes=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getTriggerAllConditions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.trigger.addAllCondition({id:t.params.id},p.allCondition).$promise.then(function(e){p.allconditions.unshift(e),i.success({title:"AllCondition properly created",msg:p.allCondition.name?p.allCondition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete anyCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.triggerAnyConditions=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.trigger.getAnyConditions(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{anyCondition:t,anyconditions:h.triggerAnyConditions.rows}})}function p(e){r.condition.delete({id:e.id}).$promise.then(function(){_.remove(h.triggerAnyConditions.rows,{id:e.id}),h.triggerAnyConditions.count-=1,h.triggerAnyConditions.rows.length||h.getTriggerAnyConditions(),s.success({title:"AnyCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected anyconditions?").htmlContent(""+h.selectedTriggerAnyConditions.length+" selected will be deleted.").ariaLabel("delete anyconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedTriggerAnyConditions.forEach(function(e){p(e)}),h.selectedTriggerAnyConditions=[]})}var h=this;h.trigger={},h.triggerAnyConditions={count:0,rows:[]},h.selectedTriggerAnyConditions=[],h.query={fields:"createdAt,updatedAt,id,field,operator,value,value,value,createdAt",limit:10,page:1},h.arrayfield=_.keyBy([{option:"Queue",value:"'queue'"},{option:"Call_Status",value:"'lastevent'"},{option:"OutboundRoute",value:"'routeId'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.arrayvalue=_.keyBy([{option:"Abandoned",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Rejected",value:"'rejected'"},{option:"Ringing",value:"'called'"},{option:"Up",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.init=l,h.deleteConfirm=d,h.success=c,h.getTriggerAnyConditions=m,h.createOrEditTriggerAnyCondition=u,h.deleteTriggerAnyCondition=p,h.deleteSelectedTriggerAnyConditions=g,r.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h.queues=_.keyBy(e.rows||[],"name")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){h.outboundRoutes=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getTriggerAnyConditions())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.trigger.addAnyCondition({id:t.params.id},p.anyCondition).$promise.then(function(e){p.anyconditions.unshift(e),i.success({title:"AnyCondition properly created",msg:p.anyCondition.name?p.anyCondition.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t"+(e.name||"trigger")+" will be deleted.").ariaLabel("delete trigger").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.triggers=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.trigger.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:t,triggers:A.triggers.rows}})}function v(e){l.trigger.delete({id:e.id}).$promise.then(function(){_.remove(A.triggers.rows,{id:e.id}),A.triggers.count-=1,A.triggers.rows.length||A.getTriggers(),c.success({title:"Trigger deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedTriggers);return A.selectedTriggers=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected triggers?").htmlContent(""+A.selectedTriggers.length+" selected will be deleted.").ariaLabel("delete Triggers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedTriggers.forEach(function(e){v(e)}),A.selectedTriggers=[]})}function E(){A.selectedTriggers=[]}function y(){A.selectedTriggers=A.triggers.rows}var A=this;A.triggers=r||{count:0,rows:[]},A.table="triggers",A.listOrder="",A.listOrderAsc=null,A.selectedTriggers=[],A.query={fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,page:1},A.arraychannel=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getTriggers=g,A.createOrEditTrigger=h,A.deleteTrigger=v,A.exportSelectedTriggers=b,A.deleteSelectedTriggers=f,A.deselectTriggers=E,A.selectAllTriggers=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getTriggers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","triggers","api","msUtils","toasty"],angular.module("app.tools").controller("TriggersController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.trunk.save(p.trunk).$promise.then(function(e){p.trunks.unshift(e),i.success({title:"Trunk properly created",msg:p.trunk.name?p.trunk.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.save"}];for(var t=0;t"+(e.name||"trunk")+" will be deleted.").ariaLabel("delete trunk").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.trunks=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.trunk.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditTrunkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{trunk:t,trunks:A.trunks.rows}})}function v(e){l.trunk.delete({id:e.id}).$promise.then(function(){_.remove(A.trunks.rows,{id:e.id}),A.trunks.count-=1,A.trunks.rows.length||A.getTrunks(),c.success({title:"Trunk deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunk",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedTrunks);return A.selectedTrunks=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent(""+A.selectedTrunks.length+" selected will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedTrunks.forEach(function(e){v(e)}),A.selectedTrunks=[]})}function E(){A.selectedTrunks=[]}function y(){A.selectedTrunks=A.trunks.rows}var A=this;A.trunks=r||{count:0,rows:[]},A.table="trunks",A.listOrder="",A.listOrderAsc=null,A.selectedTrunks=[],A.query={fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,otherFields",sort:"-updatedAt",limit:10,page:1},A.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraydtmfmode=_.keyBy([{option:"rfc2833",value:"'rfc2833'"},{option:"info",value:"'info'"},{option:"shortinfo",value:"'shortinfo'"},{option:"inband",value:"'inband'"},{option:"auto",value:"'auto'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayallow=_.keyBy([{option:"alaw",value:"'alaw'"},{option:"ulaw",value:"'ulaw'"},{option:"gsm",value:"'gsm'"},{option:"g723",value:"'g723'"},{option:"g726",value:"'g726'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraydirectmedia=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"nonat",value:"'nonat'"},{option:"update",value:"'update'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getTrunks=g,A.createOrEditTrunk=h,A.deleteTrunk=v,A.exportSelectedTrunks=b,A.deleteSelectedTrunks=f,A.deselectTrunks=E,A.selectAllTrunks=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","trunks","api","msUtils","toasty"],angular.module("app.tools").controller("TrunksController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.variable.save(p.variable).$promise.then(function(e){p.variables.unshift(e),i.success({title:"Variable properly created",msg:p.variable.name?p.variable.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.variable.save"}];for(var t=0;t"+(e.name||"variable")+" will be deleted.").ariaLabel("delete variable").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.variables=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.variable.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{variable:t,variables:A.variables.rows}})}function v(e){l.variable.delete({id:e.id}).$promise.then(function(){_.remove(A.variables.rows,{id:e.id}),A.variables.count-=1,A.variables.rows.length||A.getVariables(),c.success({title:"Variable deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariable",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedVariables);return A.selectedVariables=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent(""+A.selectedVariables.length+" selected will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedVariables.forEach(function(e){v(e)}),A.selectedVariables=[]})}function E(){A.selectedVariables=[]}function y(){A.selectedVariables=A.variables.rows}var A=this;A.variables=r||{count:0,rows:[]},A.table="variables",A.listOrder="",A.listOrderAsc=null,A.selectedVariables=[],A.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getVariables=g,A.createOrEditVariable=h,A.deleteVariable=v,A.exportSelectedVariables=b,A.deleteSelectedVariables=f,A.deselectVariables=E,A.selectAllVariables=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","variables","api","msUtils","toasty"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.voice.chanSpies.edit",{id:e.id,chanSpy:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the chanSpy?").htmlContent(""+(e.name||"chanSpy")+" will be deleted.").ariaLabel("delete chanSpy").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.chanSpies=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceChanSpy.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chanSpy:t,chanSpies:A.chanSpies.rows}})}function v(e){l.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(A.chanSpies.rows,{id:e.id}),A.chanSpies.count-=1,A.chanSpies.rows.length||A.getChanSpies(),c.success({title:"chanSpy deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceChanSpy",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedChanSpies);return A.selectedChanSpies=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent(""+A.selectedChanSpies.length+" selected will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedChanSpies.forEach(function(e){v(e)}),A.selectedChanSpies=[]})}function E(){A.selectedChanSpies=[]}function y(){A.selectedChanSpies=A.chanSpies.rows}var A=this;A.chanSpies=r||{count:0,rows:[]},A.table="chanSpies",A.listOrder="",A.listOrderAsc=null,A.selectedChanSpies=[],A.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},A.arrayoptions=_.keyBy([{option:"b: Only spy on channels involved in a bridged call.",value:"'b'"},{option:"B: Instead of whispering on a single channel barge in on both channels involved in the call.",value:"'B'"},{option:"E: Exit when the spied-on channel hangs up.",value:"'E'"},{option:"o: Only listen to audio coming from this channel.",value:"'o'"},{option:"q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.",value:"'q'"},{option:"s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.",value:"'s'"},{option:"S: Stop when no more channels are left to spy on.",value:"'S'"},{option:"w: Enable whisper mode, so the spying channel can talk to the spied-on channel.",value:"'w'"},{option:"W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.",value:"'W'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getChanSpies=g,A.createOrEditchanSpy=h,A.deletechanSpy=v,A.exportSelectedChanSpies=b,A.deleteSelectedChanSpies=f,A.deselectChanSpies=E,A.selectAllChanSpies=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","chanSpies","api","msUtils","toasty"],angular.module("app.voice").controller("ChanSpiesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceChanSpy.save(p.chanSpy).$promise.then(function(e){p.chanSpies.unshift(e),i.success({title:"chanSpy properly created",msg:p.chanSpy.name?p.chanSpy.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.save"}];for(var t=0;t"+(e.name||"context")+" will be deleted.").ariaLabel("delete context").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.contexts=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceContext.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{context:t,contexts:A.contexts.rows}})}function v(e){l.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(A.contexts.rows,{id:e.id}),A.contexts.count-=1,A.contexts.rows.length||A.getContexts(),c.success({title:"Context deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceContext",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedContexts);return A.selectedContexts=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent(""+A.selectedContexts.length+" selected will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedContexts.forEach(function(e){v(e)}),A.selectedContexts=[]})}function E(){A.selectedContexts=[]}function y(){A.selectedContexts=A.contexts.rows}var A=this;A.contexts=r||{count:0,rows:[]},A.table="contexts",A.listOrder="",A.listOrderAsc=null,A.selectedContexts=[],A.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},A.editdialog=m,A.deleteconfirm=u,A.success=p,A.getContexts=g,A.createOrEditContext=h,A.deleteContext=v,A.exportSelectedContexts=b,A.deleteSelectedContexts=f,A.deselectContexts=E,A.selectAllContexts=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","contexts","api","msUtils","toasty"],angular.module("app.voice").controller("ContextsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceContext.save(p.context).$promise.then(function(e){p.contexts.unshift(e),i.success({title:"Context properly created",msg:p.context.name?p.context.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.save"}];for(var t=0;t"+e.app+" will be deleted.").ariaLabel("delete application").targetEvent(a).ok("OK").cancel("CANCEL");t.show(i).then(function(){g.inboundrouteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})}function s(e,i){if(g.inboundrouteApps.rows.length){var o=g.inboundrouteApps.rows[i]?g.inboundrouteApps.rows[i]:g.inboundrouteApps.rows[0];t.show({controller:"EditInboundRouteApp"+(o.appType||o.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/"+(o.appType||o.app).toLowerCase()+"/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundrouteApp:o}}).then(function(e){e&&(e.id?g.inboundrouteApps.rows[i]=e:g.inboundrouteApps.rows.splice(i,0,e),l())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function r(e,a){if(g.inboundrouteApps.rows.length){var i=g.inboundrouteApps.rows[a]?g.inboundrouteApps.rows[a]:g.inboundrouteApps.rows[0];t.show({controller:"EditInboundRouteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/interval/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:i.interval,IntervalId:i.IntervalId,application:!0},intervals:[]}}).then(function(e){e&&(i.interval=e.interval||"*,*,*,*",i.IntervalId=e.IntervalId||null,l())})}}function l(){var t=["queue","playback"],n=!1,a=!1,i=2,o=[];o.push({type:"inbound",app:"Set",appdata:"CDR(type)=inbound",context:g.inboundroute.context,exten:g.inboundroute.exten,priority:i++,VoiceExtensionId:g.inboundroute.id});for(var s=0,r=0;s"+g.selectedInboundRouteApps.length+" selected will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");t.show(n).then(function(){g.selectedInboundRouteApps.forEach(function(e){_.remove(g.inboundrouteApps.rows,{id:e.id})}),g.selectedInboundRouteApps=[],l()})}var g=this;g.inboundroute={},g.inboundrouteApps={count:0,rows:[]},g.selectedInboundRouteApps=[],g.query={sort:"priority"},g.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-voip-provider",type:"Inbound",appdata:",xX,,,300,,,,,",icon:"icon-apps",options:"xX",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}},{name:"queues",route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",required:!0,type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",appType:"agi",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",route:"squareProject",filters:{fields:"name",sort:"name"}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",route:"voiceContext",filters:{fields:"name",sort:"name"}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-voip-provider",type:"Inbound",separator:"=",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Variable",name:"name",type:"text",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"custom",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-voip-provider",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",route:"voiceMail",filters:{fields:"mailbox",sort:"mailbox"}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),g.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},g.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){s(e,e.newIndex)},onSort:function(e){l()}},g.init=i,g.deleteConfirm=o,g.getInboundRouteApps=m,g.editInboundRouteApp=s,g.editInterval=r,g.deleteInboundRouteApp=u,g.deleteSelectedInboundRouteApps=p,g.rewriteRouting=l,g.getIntervals=c}e.$inject=["api","$mdDialog","$document","toasty"],angular.module("app.voice").controller("InboundRouteActionsController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.agi.type.toLowerCase()&&"outboundDial"===s.agi.appType&&(s.agi.phone=s.agi.cutdigits?(s.agi.prefix||"")+"${EXTEN:"+s.agi.cutdigits+"}":(s.agi.prefix||"")+"${EXTEN}",s.agi.record="none"!==s.agi.recordingFormat,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:null),s.agi.appType.toLowerCase()){case"set":s.agi.appdata=s.agi.name+"="+s.agi.value;break;case"custom":break;default:e[0]=s.agi.project,s.agi.appdata=e.join(",")}o(s.agi)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.agi=angular.copy(n),s.agi.appdata)switch(s.agi.appType?s.agi.appType.toLowerCase():s.agi.app.toLowerCase()){case"custom":break;case"set":s.agi.name=s.agi.appdata.split("=")[0],s.agi.value=s.agi.appdata.split("=")[1];break;case"agi":s.agi.project=s.agi.appdata;break;default:var r=s.agi.appdata.split(",");s.agi.project=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.agi.type.toLowerCase()&&"outbounddial"===s.agi.appType.toLowerCase()&&(s.agi.prefix=s.agi.phone?s.agi.phone.split("$")[0]:void 0,s.agi.callerId=s.agi.callerID?"CALLERID(all)="+s.agi.callerID:void 0,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.squareProject.get({fields:"name",sort:"name"}).$promise.then(function(e){s.projects=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppagiDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.custom.type.toLowerCase()&&"outboundDial"===s.custom.appType&&(s.custom.phone=s.custom.cutdigits?(s.custom.prefix||"")+"${EXTEN:"+s.custom.cutdigits+"}":(s.custom.prefix||"")+"${EXTEN}",s.custom.record="none"!==s.custom.recordingFormat,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:null),s.custom.appType.toLowerCase()){case"set":s.custom.appdata=s.custom.name+"="+s.custom.value;break;case"custom":break;default:e[0]=s.custom.app,e[1]=s.custom.appdata,s.custom.appdata=e.join(",")}o(s.custom)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.custom=angular.copy(n),s.custom.appdata)switch(s.custom.appType?s.custom.appType.toLowerCase():s.custom.app.toLowerCase()){case"custom":break;case"set":s.custom.name=s.custom.appdata.split("=")[0],s.custom.value=s.custom.appdata.split("=")[1];break;case"agi":s.custom.project=s.custom.appdata;break;default:var r=s.custom.appdata.split(",");s.custom.app=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.custom.appdata=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.custom.type.toLowerCase()&&"outbounddial"===s.custom.appType.toLowerCase()&&(s.custom.prefix=s.custom.phone?s.custom.phone.split("$")[0]:void 0,s.custom.callerId=s.custom.callerID?"CALLERID(all)="+s.custom.callerID:void 0,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppcustomDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.dial.type.toLowerCase()&&"outboundDial"===s.dial.appType&&(s.dial.phone=s.dial.cutdigits?(s.dial.prefix||"")+"${EXTEN:"+s.dial.cutdigits+"}":(s.dial.prefix||"")+"${EXTEN}",s.dial.record="none"!==s.dial.recordingFormat,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:null),s.dial.appType.toLowerCase()){case"set":s.dial.appdata=s.dial.name+"="+s.dial.value;break;case"custom":break;default:e[0]=s.dial.tech,e[1]=s.dial.timeout,e[2]=s.dial.options,e[3]=s.dial.url,s.dial.appdata=e.join(",")}o(s.dial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.dial=angular.copy(n),s.dial.appdata)switch(s.dial.appType?s.dial.appType.toLowerCase():s.dial.app.toLowerCase()){case"custom":break;case"set":s.dial.name=s.dial.appdata.split("=")[0],s.dial.value=s.dial.appdata.split("=")[1];break;case"agi":s.dial.project=s.dial.appdata;break;default:var r=s.dial.appdata.split(",");s.dial.tech=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.dial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.dial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.dial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.dial.type.toLowerCase()&&"outbounddial"===s.dial.appType.toLowerCase()&&(s.dial.prefix=s.dial.phone?s.dial.phone.split("$")[0]:void 0,s.dial.callerId=s.dial.callerID?"CALLERID(all)="+s.dial.callerID:void 0,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppdialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.externaldial.type.toLowerCase()&&"outboundDial"===s.externaldial.appType&&(s.externaldial.phone=s.externaldial.cutdigits?(s.externaldial.prefix||"")+"${EXTEN:"+s.externaldial.cutdigits+"}":(s.externaldial.prefix||"")+"${EXTEN}",s.externaldial.record="none"!==s.externaldial.recordingFormat,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:null),s.externaldial.appType.toLowerCase()){case"set":s.externaldial.appdata=s.externaldial.name+"="+s.externaldial.value;break;case"custom":break;default:e[0]=["SIP",s.externaldial.trunk,s.externaldial.phone].join("/"),e[1]=s.externaldial.timeout,e[2]=s.externaldial.options,e[3]=s.externaldial.url,s.externaldial.appdata=e.join(",")}o(s.externaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.externaldial=angular.copy(n),s.externaldial.appdata)switch(s.externaldial.appType?s.externaldial.appType.toLowerCase():s.externaldial.app.toLowerCase()){case"custom":break;case"set":s.externaldial.name=s.externaldial.appdata.split("=")[0],s.externaldial.value=s.externaldial.appdata.split("=")[1];break;case"agi":s.externaldial.project=s.externaldial.appdata;break;default:var r=s.externaldial.appdata.split(",");s.externaldial.trunk=r[0].split("/")[1],s.externaldial.phone=r[0].split("/")[2],s.externaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.externaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.externaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.externaldial.type.toLowerCase()&&"outbounddial"===s.externaldial.appType.toLowerCase()&&(s.externaldial.prefix=s.externaldial.phone?s.externaldial.phone.split("$")[0]:void 0,s.externaldial.callerId=s.externaldial.callerID?"CALLERID(all)="+s.externaldial.callerID:void 0,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.trunk.get({fields:"name",sort:"name"}).$promise.then(function(e){s.trunks=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppexternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.goto.type.toLowerCase()&&"outboundDial"===s.goto.appType&&(s.goto.phone=s.goto.cutdigits?(s.goto.prefix||"")+"${EXTEN:"+s.goto.cutdigits+"}":(s.goto.prefix||"")+"${EXTEN}",s.goto.record="none"!==s.goto.recordingFormat,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:null),s.goto.appType.toLowerCase()){case"set":s.goto.appdata=s.goto.name+"="+s.goto.value;break;case"custom":break;default:e[0]=s.goto.context,e[1]=s.goto.extension,e[2]=s.goto.priority,s.goto.appdata=e.join(",")}o(s.goto)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.goto=angular.copy(n),s.goto.appdata)switch(s.goto.appType?s.goto.appType.toLowerCase():s.goto.app.toLowerCase()){case"custom":break;case"set":s.goto.name=s.goto.appdata.split("=")[0],s.goto.value=s.goto.appdata.split("=")[1];break;case"agi":s.goto.project=s.goto.appdata;break;default:var r=s.goto.appdata.split(",");s.goto.context=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.goto.extension=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.goto.priority=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10)}"outbound"===s.goto.type.toLowerCase()&&"outbounddial"===s.goto.appType.toLowerCase()&&(s.goto.prefix=s.goto.phone?s.goto.phone.split("$")[0]:void 0,s.goto.callerId=s.goto.callerID?"CALLERID(all)="+s.goto.callerID:void 0,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){s.contexts=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppgotoDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.hangup.type.toLowerCase()&&"outboundDial"===s.hangup.appType&&(s.hangup.phone=s.hangup.cutdigits?(s.hangup.prefix||"")+"${EXTEN:"+s.hangup.cutdigits+"}":(s.hangup.prefix||"")+"${EXTEN}",s.hangup.record="none"!==s.hangup.recordingFormat,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:null),s.hangup.appType.toLowerCase()){case"set":s.hangup.appdata=s.hangup.name+"="+s.hangup.value;break;case"custom":break;default:e[0]=s.hangup.appdata,s.hangup.appdata=e.join(",")}o(s.hangup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.hangup=angular.copy(n),s.hangup.appdata)switch(s.hangup.appType?s.hangup.appType.toLowerCase():s.hangup.app.toLowerCase()){case"custom":break;case"set":s.hangup.name=s.hangup.appdata.split("=")[0],s.hangup.value=s.hangup.appdata.split("=")[1];break;case"agi":s.hangup.project=s.hangup.appdata;break;default:var r=s.hangup.appdata.split(",");s.hangup.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.hangup.type.toLowerCase()&&"outbounddial"===s.hangup.appType.toLowerCase()&&(s.hangup.prefix=s.hangup.phone?s.hangup.phone.split("$")[0]:void 0,s.hangup.callerId=s.hangup.callerID?"CALLERID(all)="+s.hangup.callerID:void 0,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteApphangupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.internaldial.type.toLowerCase()&&"outboundDial"===s.internaldial.appType&&(s.internaldial.phone=s.internaldial.cutdigits?(s.internaldial.prefix||"")+"${EXTEN:"+s.internaldial.cutdigits+"}":(s.internaldial.prefix||"")+"${EXTEN}",s.internaldial.record="none"!==s.internaldial.recordingFormat,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:null),s.internaldial.appType.toLowerCase()){case"set":s.internaldial.appdata=s.internaldial.name+"="+s.internaldial.value;break;case"custom":break;default:e[0]=s.internaldial.user,e[1]=s.internaldial.timeout,e[2]=s.internaldial.options,e[3]=s.internaldial.url,s.internaldial.appdata=e.join(",")}o(s.internaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.internaldial=angular.copy(n),s.internaldial.appdata)switch(s.internaldial.appType?s.internaldial.appType.toLowerCase():s.internaldial.app.toLowerCase()){case"custom":break;case"set":s.internaldial.name=s.internaldial.appdata.split("=")[0],s.internaldial.value=s.internaldial.appdata.split("=")[1];break;case"agi":s.internaldial.project=s.internaldial.appdata;break;default:var r=s.internaldial.appdata.split(",");s.internaldial.user=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.internaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.internaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.internaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.internaldial.type.toLowerCase()&&"outbounddial"===s.internaldial.appType.toLowerCase()&&(s.internaldial.prefix=s.internaldial.phone?s.internaldial.phone.split("$")[0]:void 0,s.internaldial.callerId=s.internaldial.callerID?"CALLERID(all)="+s.internaldial.callerID:void 0,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){switch(u.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==u.timeRangeFrom&&u.timeRangeFrom&&u.timeRangeTo){var t=(u.timeRangeFrom.getHours()<10?"0":"")+u.timeRangeFrom.getHours()+":"+(u.timeRangeFrom.getMinutes()<10?"0":"")+u.timeRangeFrom.getMinutes(),n=(u.timeRangeTo.getHours()<10?"0":"")+u.timeRangeTo.getHours()+":"+(u.timeRangeTo.getMinutes()<10?"0":"")+u.timeRangeTo.getMinutes();e.push(t+"-"+n)}else e.push("*");return u.dayOfWeekFrom&&u.dayOfWeekTo?e.push(u.dayOfWeekFrom+"-"+u.dayOfWeekTo):e.push("*"),u.monthDayFrom&&u.monthDayTo?e.push(u.monthDayFrom+"-"+u.monthDayTo):e.push("*"),u.monthFrom&&u.monthTo?e.push(u.monthFrom+"-"+u.monthTo):e.push("*"),e.join()}}function d(){u.errors=[],u.interval.interval=l(),r.interval.save(u.interval).$promise.then(function(e){u.intervals.push(e),s.success({title:"Interval properly created",msg:u.interval.name?u.interval.name+" has been created!":""}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})}function c(){u.errors=[],u.interval.interval=l(),u.interval.application?("list"!==u.type&&(u.interval.IntervalId=null),m(u.interval)):r.interval.update({id:u.interval.id},u.interval).$promise.then(function(e){var t=_.find(u.intervals,{id:e.id});t&&_.merge(t,e),s.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})}function m(e){t.hide(e)}var u=this;if(u.errors=[],u.title="TOOLS.EDIT_INTERVAL",u.interval=angular.copy(i),u.intervals=o,u.newInterval=!1,u.types=["always","custom","list"],u.daysOfWeek=a.getDaysOfWeek(),u.monthNumber=a.getMonthNumber(),u.monthName=a.getMonthName(),u.daysOfMonth=a.getDaysOfMonth(),u.interval)if("*,*,*,*"!==u.interval.interval){u.type="custom";var p=u.interval.interval.split(","),g=p[0],h=p[1],v=p[2],b=p[3];if("*"!==g){var f,E=g.split("-")[0],y=g.split("-")[1];(f=new Date).setHours(Number(E.split(":")[0])),f.setMinutes(Number(E.split(":")[1])),u.timeRangeFrom=f,(f=new Date).setHours(Number(y.split(":")[0])),f.setMinutes(Number(y.split(":")[1])),u.timeRangeTo=f}"*"!==h&&(u.dayOfWeekFrom=h.split("-")[0],u.dayOfWeekTo=h.split("-")[1]),"*"!==v&&(u.monthDayFrom=v.split("-")[0],u.monthDayTo=v.split("-")[1]),"*"!==b&&(u.monthFrom=b.split("-")[0],u.monthTo=b.split("-")[1])}else u.type="always";else u.interval={interval:"*,*,*,*"},u.type="always",u.title="TOOLS.NEW_INTERVAL",u.newInterval=!0;e.params.id&&!u.interval.application&&(u.interval.IntervalId=e.params.id),u.interval.IntervalId&&u.interval.application&&(u.type="list"),u.addNewInterval=d,u.saveInterval=c,u.closeDialog=m,u.interval.application&&r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api"],angular.module("app.voice").controller("EditInboundRouteAppintervalDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.playback.type.toLowerCase()&&"outboundDial"===s.playback.appType&&(s.playback.phone=s.playback.cutdigits?(s.playback.prefix||"")+"${EXTEN:"+s.playback.cutdigits+"}":(s.playback.prefix||"")+"${EXTEN}",s.playback.record="none"!==s.playback.recordingFormat,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:null),s.playback.appType.toLowerCase()){case"set":s.playback.appdata=s.playback.name+"="+s.playback.value;break;case"custom":break;default:e[0]=s.playback.appdata,e[1]=s.playback.options,s.playback.appdata=e.join(",")}o(s.playback)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.playback=angular.copy(n),s.playback.appdata)switch(s.playback.appType?s.playback.appType.toLowerCase():s.playback.app.toLowerCase()){case"custom":break;case"set":s.playback.name=s.playback.appdata.split("=")[0],s.playback.value=s.playback.appdata.split("=")[1];break;case"agi":s.playback.project=s.playback.appdata;break;default:var r=s.playback.appdata.split(",");s.playback.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.playback.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.playback.type.toLowerCase()&&"outbounddial"===s.playback.appType.toLowerCase()&&(s.playback.prefix=s.playback.phone?s.playback.phone.split("$")[0]:void 0,s.playback.callerId=s.playback.callerID?"CALLERID(all)="+s.playback.callerID:void 0,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppplaybackDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.queue.type.toLowerCase()&&"outboundDial"===s.queue.appType&&(s.queue.phone=s.queue.cutdigits?(s.queue.prefix||"")+"${EXTEN:"+s.queue.cutdigits+"}":(s.queue.prefix||"")+"${EXTEN}",s.queue.record="none"!==s.queue.recordingFormat,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:null),s.queue.appType.toLowerCase()){case"set":s.queue.appdata=s.queue.name+"="+s.queue.value;break;case"custom":break;default:e[0]=s.queue.queue,e[1]=s.queue.options,e[2]=s.queue.URL,e[3]=s.queue.sound,e[4]=s.queue.timeout,e[5]=s.queue.agi,e[6]=s.queue.macro,e[7]=s.queue.gosub,e[8]=s.queue.rule,e[9]=s.queue.position,s.queue.appdata=e.join(",")}o(s.queue)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.queue=angular.copy(n),s.queue.appdata)switch(s.queue.appType?s.queue.appType.toLowerCase():s.queue.app.toLowerCase()){case"custom":break;case"set":s.queue.name=s.queue.appdata.split("=")[0],s.queue.value=s.queue.appdata.split("=")[1];break;case"agi":s.queue.project=s.queue.appdata;break;default:var r=s.queue.appdata.split(",");s.queue.queue=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.queue.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.queue.URL=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.queue.sound=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10),s.queue.timeout=_.isEmpty(r[4])?r[4]:isNaN(r[4])?r[4]:parseInt(r[4],10),s.queue.agi=_.isEmpty(r[5])?r[5]:isNaN(r[5])?r[5]:parseInt(r[5],10),s.queue.macro=_.isEmpty(r[6])?r[6]:isNaN(r[6])?r[6]:parseInt(r[6],10),s.queue.gosub=_.isEmpty(r[7])?r[7]:isNaN(r[7])?r[7]:parseInt(r[7],10),s.queue.rule=_.isEmpty(r[8])?r[8]:isNaN(r[8])?r[8]:parseInt(r[8],10),s.queue.position=_.isEmpty(r[9])?r[9]:isNaN(r[9])?r[9]:parseInt(r[9],10)}"outbound"===s.queue.type.toLowerCase()&&"outbounddial"===s.queue.appType.toLowerCase()&&(s.queue.prefix=s.queue.phone?s.queue.phone.split("$")[0]:void 0,s.queue.callerId=s.queue.callerID?"CALLERID(all)="+s.queue.callerID:void 0,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),a.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){s.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppqueueDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.ringgroup.type.toLowerCase()&&"outboundDial"===s.ringgroup.appType&&(s.ringgroup.phone=s.ringgroup.cutdigits?(s.ringgroup.prefix||"")+"${EXTEN:"+s.ringgroup.cutdigits+"}":(s.ringgroup.prefix||"")+"${EXTEN}",s.ringgroup.record="none"!==s.ringgroup.recordingFormat,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:null),s.ringgroup.appType.toLowerCase()){case"set":s.ringgroup.appdata=s.ringgroup.name+"="+s.ringgroup.value;break;case"custom":break;default:e[0]=s.ringgroup.multipleUsers.join("&"),e[1]=s.ringgroup.timeout,e[2]=s.ringgroup.options,e[3]=s.ringgroup.url,s.ringgroup.appdata=e.join(",")}o(s.ringgroup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.ringgroup=angular.copy(n),s.ringgroup.appdata)switch(s.ringgroup.appType?s.ringgroup.appType.toLowerCase():s.ringgroup.app.toLowerCase()){case"custom":break;case"set":s.ringgroup.name=s.ringgroup.appdata.split("=")[0],s.ringgroup.value=s.ringgroup.appdata.split("=")[1];break;case"agi":s.ringgroup.project=s.ringgroup.appdata;break;default:var r=s.ringgroup.appdata.split(",");s.ringgroup.multipleUsers=r[0].split("&"),s.ringgroup.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.ringgroup.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.ringgroup.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.ringgroup.type.toLowerCase()&&"outbounddial"===s.ringgroup.appType.toLowerCase()&&(s.ringgroup.prefix=s.ringgroup.phone?s.ringgroup.phone.split("$")[0]:void 0,s.ringgroup.callerId=s.ringgroup.callerID?"CALLERID(all)="+s.ringgroup.callerID:void 0,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppringgroupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.set.type.toLowerCase()&&"outboundDial"===s.set.appType&&(s.set.phone=s.set.cutdigits?(s.set.prefix||"")+"${EXTEN:"+s.set.cutdigits+"}":(s.set.prefix||"")+"${EXTEN}",s.set.record="none"!==s.set.recordingFormat,s.set.recordingFormat=s.set.record?s.set.recordingFormat:null),s.set.appType.toLowerCase()){case"set":s.set.appdata=s.set.name+"="+s.set.value;break;case"custom":break;default:e[0]=s.set.name,e[1]=s.set.value,s.set.appdata=e.join("=")}o(s.set)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.set=angular.copy(n),s.set.appdata)switch(s.set.appType?s.set.appType.toLowerCase():s.set.app.toLowerCase()){case"custom":break;case"set":s.set.name=s.set.appdata.split("=")[0],s.set.value=s.set.appdata.split("=")[1];break;case"agi":s.set.project=s.set.appdata;break;default:var r=s.set.appdata.split("=");s.set.name=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.set.value=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.set.type.toLowerCase()&&"outbounddial"===s.set.appType.toLowerCase()&&(s.set.prefix=s.set.phone?s.set.phone.split("$")[0]:void 0,s.set.callerId=s.set.callerID?"CALLERID(all)="+s.set.callerID:void 0,s.set.recordingFormat=s.set.record?s.set.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppsetDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.voicemail.type.toLowerCase()&&"outboundDial"===s.voicemail.appType&&(s.voicemail.phone=s.voicemail.cutdigits?(s.voicemail.prefix||"")+"${EXTEN:"+s.voicemail.cutdigits+"}":(s.voicemail.prefix||"")+"${EXTEN}",s.voicemail.record="none"!==s.voicemail.recordingFormat,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:null),s.voicemail.appType.toLowerCase()){case"set":s.voicemail.appdata=s.voicemail.name+"="+s.voicemail.value;break;case"custom":break;default:e[0]=s.voicemail.voiceMail,e[1]=s.voicemail.options,s.voicemail.appdata=e.join(",")}o(s.voicemail)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.voicemail=angular.copy(n),s.voicemail.appdata)switch(s.voicemail.appType?s.voicemail.appType.toLowerCase():s.voicemail.app.toLowerCase()){case"custom":break;case"set":s.voicemail.name=s.voicemail.appdata.split("=")[0],s.voicemail.value=s.voicemail.appdata.split("=")[1];break;case"agi":s.voicemail.project=s.voicemail.appdata;break;default:var r=s.voicemail.appdata.split(",");s.voicemail.voiceMail=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.voicemail.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.voicemail.type.toLowerCase()&&"outbounddial"===s.voicemail.appType.toLowerCase()&&(s.voicemail.prefix=s.voicemail.phone?s.voicemail.phone.split("$")[0]:void 0,s.voicemail.callerId=s.voicemail.callerID?"CALLERID(all)="+s.voicemail.callerID:void 0,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:"none"),s.saveInboundRouteApp=i,s.closeDialog=o,a.voiceMail.get({fields:"mailbox",sort:"mailbox"}).$promise.then(function(e){s.voiceMails=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","inboundrouteApp","api"],angular.module("app.voice").controller("EditInboundRouteAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){e.go("app.voice.inboundroutes")}function r(){i.voiceExtension.update({id:l.inboundroute.id},l.inboundroute).$promise.then(function(){a.success({title:"InboundRoute updated!",msg:l.inboundroute.name?l.inboundroute.name+" has been updated!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}var l=this;l.inboundroute=e.params.inboundroute||o||{},l.selectedTab=e.params.tab||0,l.gotoInboundRoutes=s,l.saveInboundRoute=r,i.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$document","toasty","api","inboundroute"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.voice.inboundroutes.edit",{id:e.id,inboundroute:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the inboundroute?").htmlContent(""+(e.name||"inboundroute")+" will be deleted.").ariaLabel("delete inboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.inboundroutes=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceExtension.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundroute:t,inboundroutes:A.inboundroutes.rows}})}function v(e){l.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(A.inboundroutes.rows,{id:e.id}),A.inboundroutes.count-=1,A.inboundroutes.rows.length||A.getInboundRoutes(),c.success({title:"InboundRoute deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedInboundRoutes);return A.selectedInboundRoutes=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected inboundroutes?").htmlContent(""+A.selectedInboundRoutes.length+" selected will be deleted.").ariaLabel("delete InboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedInboundRoutes.forEach(function(e){v(e)}),A.selectedInboundRoutes=[]})}function E(){A.selectedInboundRoutes=[]}function y(){A.selectedInboundRoutes=A.inboundroutes.rows}var A=this;A.inboundroutes=r||{count:0,rows:[]},A.table="inboundroutes",A.listOrder="",A.listOrderAsc=null,A.selectedInboundRoutes=[],A.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getInboundRoutes=g,A.createOrEditInboundRoute=h,A.deleteInboundRoute=v,A.exportSelectedInboundRoutes=b,A.deleteSelectedInboundRoutes=f,A.deselectInboundRoutes=E,A.selectAllInboundRoutes=y,l.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){A.contexts=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getInboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","inboundroutes","api","msUtils","toasty"],angular.module("app.voice").controller("InboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceExtension.save(p.internalroute).$promise.then(function(e){p.internalroutes.unshift(e),i.success({title:"InternalRoute properly created",msg:p.internalroute.name?p.internalroute.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var t=0;t"+e.app+" will be deleted.").ariaLabel("delete application").targetEvent(a).ok("OK").cancel("CANCEL");t.show(i).then(function(){g.internalrouteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})}function s(e,i){if(g.internalrouteApps.rows.length){var o=g.internalrouteApps.rows[i]?g.internalrouteApps.rows[i]:g.internalrouteApps.rows[0];t.show({controller:"EditInternalRouteApp"+(o.appType||o.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/"+(o.appType||o.app).toLowerCase()+"/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalrouteApp:o}}).then(function(e){e&&(e.id?g.internalrouteApps.rows[i]=e:g.internalrouteApps.rows.splice(i,0,e),l())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function r(e,a){if(g.internalrouteApps.rows.length){var i=g.internalrouteApps.rows[a]?g.internalrouteApps.rows[a]:g.internalrouteApps.rows[0];t.show({controller:"EditInternalRouteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/interval/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:i.interval,IntervalId:i.IntervalId,application:!0},intervals:[]}}).then(function(e){e&&(i.interval=e.interval||"*,*,*,*",i.IntervalId=e.IntervalId||null,l())})}}function l(){var t=["queue","playback"],n=!1,a=!1,i=2,o=[];o.push({type:"internal",app:"Set",appdata:"CDR(type)=internal",context:g.internalroute.context,exten:g.internalroute.exten,priority:i++,VoiceExtensionId:g.internalroute.id});for(var s=0,r=0;s"+g.selectedInternalRouteApps.length+" selected will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");t.show(n).then(function(){g.selectedInternalRouteApps.forEach(function(e){_.remove(g.internalrouteApps.rows,{id:e.id})}),g.selectedInternalRouteApps=[],l()})}var g=this;g.internalroute={},g.internalrouteApps={count:0,rows:[]},g.selectedInternalRouteApps=[],g.query={sort:"priority"},g.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Internal",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}},{name:"queues",route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",alias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",route:"squareProject",filters:{fields:"name",sort:"name"}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",route:"voiceContext",filters:{fields:"name",sort:"name"}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Variable",name:"name",type:"text",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"Custom",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-sip",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",route:"voiceMail",filters:{fields:"mailbox",sort:"mailbox"}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),g.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},g.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){s(e,e.newIndex)},onSort:function(e){l()}},g.init=i,g.deleteConfirm=o,g.getInternalRouteApps=m,g.editInternalRouteApp=s,g.editInterval=r,g.deleteInternalRouteApp=u,g.deleteSelectedInternalRouteApps=p,g.rewriteRouting=l,g.getIntervals=c}e.$inject=["api","$mdDialog","$document","toasty"],angular.module("app.voice").controller("InternalRouteActionsController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.agi.type.toLowerCase()&&"outboundDial"===s.agi.appType&&(s.agi.phone=s.agi.cutdigits?(s.agi.prefix||"")+"${EXTEN:"+s.agi.cutdigits+"}":(s.agi.prefix||"")+"${EXTEN}",s.agi.record="none"!==s.agi.recordingFormat,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:null),s.agi.appType.toLowerCase()){case"set":s.agi.appdata=s.agi.name+"="+s.agi.value;break;case"custom":break;default:e[0]=s.agi.project,s.agi.appdata=e.join(",")}o(s.agi)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.agi=angular.copy(n),s.agi.appdata)switch(s.agi.appType?s.agi.appType.toLowerCase():s.agi.app.toLowerCase()){case"custom":break;case"set":s.agi.name=s.agi.appdata.split("=")[0],s.agi.value=s.agi.appdata.split("=")[1];break;case"agi":s.agi.project=s.agi.appdata;break;default:var r=s.agi.appdata.split(",");s.agi.project=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.agi.type.toLowerCase()&&"outbounddial"===s.agi.appType.toLowerCase()&&(s.agi.prefix=s.agi.phone?s.agi.phone.split("$")[0]:void 0,s.agi.callerId=s.agi.callerID?"CALLERID(all)="+s.agi.callerID:void 0,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.squareProject.get({fields:"name",sort:"name"}).$promise.then(function(e){s.projects=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppagiDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.custom.type.toLowerCase()&&"outboundDial"===s.custom.appType&&(s.custom.phone=s.custom.cutdigits?(s.custom.prefix||"")+"${EXTEN:"+s.custom.cutdigits+"}":(s.custom.prefix||"")+"${EXTEN}",s.custom.record="none"!==s.custom.recordingFormat,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:null),s.custom.appType.toLowerCase()){case"set":s.custom.appdata=s.custom.name+"="+s.custom.value;break;case"custom":break;default:e[0]=s.custom.app,e[1]=s.custom.appdata,s.custom.appdata=e.join(",")}o(s.custom)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.custom=angular.copy(n),s.custom.appdata)switch(s.custom.appType?s.custom.appType.toLowerCase():s.custom.app.toLowerCase()){case"custom":break;case"set":s.custom.name=s.custom.appdata.split("=")[0],s.custom.value=s.custom.appdata.split("=")[1];break;case"agi":s.custom.project=s.custom.appdata;break;default:var r=s.custom.appdata.split(",");s.custom.app=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.custom.appdata=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.custom.type.toLowerCase()&&"outbounddial"===s.custom.appType.toLowerCase()&&(s.custom.prefix=s.custom.phone?s.custom.phone.split("$")[0]:void 0,s.custom.callerId=s.custom.callerID?"CALLERID(all)="+s.custom.callerID:void 0,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppcustomDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.dial.type.toLowerCase()&&"outboundDial"===s.dial.appType&&(s.dial.phone=s.dial.cutdigits?(s.dial.prefix||"")+"${EXTEN:"+s.dial.cutdigits+"}":(s.dial.prefix||"")+"${EXTEN}",s.dial.record="none"!==s.dial.recordingFormat,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:null),s.dial.appType.toLowerCase()){case"set":s.dial.appdata=s.dial.name+"="+s.dial.value;break;case"custom":break;default:e[0]=s.dial.tech,e[1]=s.dial.timeout,e[2]=s.dial.options,e[3]=s.dial.url,s.dial.appdata=e.join(",")}o(s.dial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.dial=angular.copy(n),s.dial.appdata)switch(s.dial.appType?s.dial.appType.toLowerCase():s.dial.app.toLowerCase()){case"custom":break;case"set":s.dial.name=s.dial.appdata.split("=")[0],s.dial.value=s.dial.appdata.split("=")[1];break;case"agi":s.dial.project=s.dial.appdata;break;default:var r=s.dial.appdata.split(",");s.dial.tech=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.dial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.dial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.dial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.dial.type.toLowerCase()&&"outbounddial"===s.dial.appType.toLowerCase()&&(s.dial.prefix=s.dial.phone?s.dial.phone.split("$")[0]:void 0,s.dial.callerId=s.dial.callerID?"CALLERID(all)="+s.dial.callerID:void 0,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppdialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.externaldial.type.toLowerCase()&&"outboundDial"===s.externaldial.appType&&(s.externaldial.phone=s.externaldial.cutdigits?(s.externaldial.prefix||"")+"${EXTEN:"+s.externaldial.cutdigits+"}":(s.externaldial.prefix||"")+"${EXTEN}",s.externaldial.record="none"!==s.externaldial.recordingFormat,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:null),s.externaldial.appType.toLowerCase()){case"set":s.externaldial.appdata=s.externaldial.name+"="+s.externaldial.value;break;case"custom":break;default:e[0]=["SIP",s.externaldial.trunk,s.externaldial.phone].join("/"),e[1]=s.externaldial.timeout,e[2]=s.externaldial.options,e[3]=s.externaldial.url,s.externaldial.appdata=e.join(",")}o(s.externaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.externaldial=angular.copy(n),s.externaldial.appdata)switch(s.externaldial.appType?s.externaldial.appType.toLowerCase():s.externaldial.app.toLowerCase()){case"custom":break;case"set":s.externaldial.name=s.externaldial.appdata.split("=")[0],s.externaldial.value=s.externaldial.appdata.split("=")[1];break;case"agi":s.externaldial.project=s.externaldial.appdata;break;default:var r=s.externaldial.appdata.split(",");s.externaldial.trunk=r[0].split("/")[1],s.externaldial.phone=r[0].split("/")[2],s.externaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.externaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.externaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.externaldial.type.toLowerCase()&&"outbounddial"===s.externaldial.appType.toLowerCase()&&(s.externaldial.prefix=s.externaldial.phone?s.externaldial.phone.split("$")[0]:void 0,s.externaldial.callerId=s.externaldial.callerID?"CALLERID(all)="+s.externaldial.callerID:void 0,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.trunk.get({fields:"name",sort:"name"}).$promise.then(function(e){s.trunks=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppexternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.goto.type.toLowerCase()&&"outboundDial"===s.goto.appType&&(s.goto.phone=s.goto.cutdigits?(s.goto.prefix||"")+"${EXTEN:"+s.goto.cutdigits+"}":(s.goto.prefix||"")+"${EXTEN}",s.goto.record="none"!==s.goto.recordingFormat,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:null),s.goto.appType.toLowerCase()){case"set":s.goto.appdata=s.goto.name+"="+s.goto.value;break;case"custom":break;default:e[0]=s.goto.context,e[1]=s.goto.extension,e[2]=s.goto.priority,s.goto.appdata=e.join(",")}o(s.goto)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.goto=angular.copy(n),s.goto.appdata)switch(s.goto.appType?s.goto.appType.toLowerCase():s.goto.app.toLowerCase()){case"custom":break;case"set":s.goto.name=s.goto.appdata.split("=")[0],s.goto.value=s.goto.appdata.split("=")[1];break;case"agi":s.goto.project=s.goto.appdata;break;default:var r=s.goto.appdata.split(",");s.goto.context=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.goto.extension=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.goto.priority=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10)}"outbound"===s.goto.type.toLowerCase()&&"outbounddial"===s.goto.appType.toLowerCase()&&(s.goto.prefix=s.goto.phone?s.goto.phone.split("$")[0]:void 0,s.goto.callerId=s.goto.callerID?"CALLERID(all)="+s.goto.callerID:void 0,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){s.contexts=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppgotoDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.hangup.type.toLowerCase()&&"outboundDial"===s.hangup.appType&&(s.hangup.phone=s.hangup.cutdigits?(s.hangup.prefix||"")+"${EXTEN:"+s.hangup.cutdigits+"}":(s.hangup.prefix||"")+"${EXTEN}",s.hangup.record="none"!==s.hangup.recordingFormat,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:null),s.hangup.appType.toLowerCase()){case"set":s.hangup.appdata=s.hangup.name+"="+s.hangup.value;break;case"custom":break;default:e[0]=s.hangup.appdata,s.hangup.appdata=e.join(",")}o(s.hangup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.hangup=angular.copy(n),s.hangup.appdata)switch(s.hangup.appType?s.hangup.appType.toLowerCase():s.hangup.app.toLowerCase()){case"custom":break;case"set":s.hangup.name=s.hangup.appdata.split("=")[0],s.hangup.value=s.hangup.appdata.split("=")[1];break;case"agi":s.hangup.project=s.hangup.appdata;break;default:var r=s.hangup.appdata.split(",");s.hangup.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.hangup.type.toLowerCase()&&"outbounddial"===s.hangup.appType.toLowerCase()&&(s.hangup.prefix=s.hangup.phone?s.hangup.phone.split("$")[0]:void 0,s.hangup.callerId=s.hangup.callerID?"CALLERID(all)="+s.hangup.callerID:void 0,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteApphangupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.internaldial.type.toLowerCase()&&"outboundDial"===s.internaldial.appType&&(s.internaldial.phone=s.internaldial.cutdigits?(s.internaldial.prefix||"")+"${EXTEN:"+s.internaldial.cutdigits+"}":(s.internaldial.prefix||"")+"${EXTEN}",s.internaldial.record="none"!==s.internaldial.recordingFormat,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:null),s.internaldial.appType.toLowerCase()){case"set":s.internaldial.appdata=s.internaldial.name+"="+s.internaldial.value;break;case"custom":break;default:e[0]=s.internaldial.user,e[1]=s.internaldial.timeout,e[2]=s.internaldial.options,e[3]=s.internaldial.url,s.internaldial.appdata=e.join(",")}o(s.internaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.internaldial=angular.copy(n),s.internaldial.appdata)switch(s.internaldial.appType?s.internaldial.appType.toLowerCase():s.internaldial.app.toLowerCase()){case"custom":break;case"set":s.internaldial.name=s.internaldial.appdata.split("=")[0],s.internaldial.value=s.internaldial.appdata.split("=")[1];break;case"agi":s.internaldial.project=s.internaldial.appdata;break;default:var r=s.internaldial.appdata.split(",");s.internaldial.user=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.internaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.internaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.internaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.internaldial.type.toLowerCase()&&"outbounddial"===s.internaldial.appType.toLowerCase()&&(s.internaldial.prefix=s.internaldial.phone?s.internaldial.phone.split("$")[0]:void 0,s.internaldial.callerId=s.internaldial.callerID?"CALLERID(all)="+s.internaldial.callerID:void 0,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){switch(u.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==u.timeRangeFrom&&u.timeRangeFrom&&u.timeRangeTo){var t=(u.timeRangeFrom.getHours()<10?"0":"")+u.timeRangeFrom.getHours()+":"+(u.timeRangeFrom.getMinutes()<10?"0":"")+u.timeRangeFrom.getMinutes(),n=(u.timeRangeTo.getHours()<10?"0":"")+u.timeRangeTo.getHours()+":"+(u.timeRangeTo.getMinutes()<10?"0":"")+u.timeRangeTo.getMinutes();e.push(t+"-"+n)}else e.push("*");return u.dayOfWeekFrom&&u.dayOfWeekTo?e.push(u.dayOfWeekFrom+"-"+u.dayOfWeekTo):e.push("*"),u.monthDayFrom&&u.monthDayTo?e.push(u.monthDayFrom+"-"+u.monthDayTo):e.push("*"),u.monthFrom&&u.monthTo?e.push(u.monthFrom+"-"+u.monthTo):e.push("*"),e.join()}}function d(){u.errors=[],u.interval.interval=l(),r.interval.save(u.interval).$promise.then(function(e){u.intervals.push(e),s.success({title:"Interval properly created",msg:u.interval.name?u.interval.name+" has been created!":""}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})}function c(){u.errors=[],u.interval.interval=l(),u.interval.application?("list"!==u.type&&(u.interval.IntervalId=null),m(u.interval)):r.interval.update({id:u.interval.id},u.interval).$promise.then(function(e){var t=_.find(u.intervals,{id:e.id});t&&_.merge(t,e),s.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})}function m(e){t.hide(e)}var u=this;if(u.errors=[],u.title="TOOLS.EDIT_INTERVAL",u.interval=angular.copy(i),u.intervals=o,u.newInterval=!1,u.types=["always","custom","list"],u.daysOfWeek=a.getDaysOfWeek(),u.monthNumber=a.getMonthNumber(),u.monthName=a.getMonthName(),u.daysOfMonth=a.getDaysOfMonth(),u.interval)if("*,*,*,*"!==u.interval.interval){u.type="custom";var p=u.interval.interval.split(","),g=p[0],h=p[1],v=p[2],b=p[3];if("*"!==g){var f,E=g.split("-")[0],y=g.split("-")[1];(f=new Date).setHours(Number(E.split(":")[0])),f.setMinutes(Number(E.split(":")[1])),u.timeRangeFrom=f,(f=new Date).setHours(Number(y.split(":")[0])),f.setMinutes(Number(y.split(":")[1])),u.timeRangeTo=f}"*"!==h&&(u.dayOfWeekFrom=h.split("-")[0],u.dayOfWeekTo=h.split("-")[1]),"*"!==v&&(u.monthDayFrom=v.split("-")[0],u.monthDayTo=v.split("-")[1]),"*"!==b&&(u.monthFrom=b.split("-")[0],u.monthTo=b.split("-")[1])}else u.type="always";else u.interval={interval:"*,*,*,*"},u.type="always",u.title="TOOLS.NEW_INTERVAL",u.newInterval=!0;e.params.id&&!u.interval.application&&(u.interval.IntervalId=e.params.id),u.interval.IntervalId&&u.interval.application&&(u.type="list"),u.addNewInterval=d,u.saveInterval=c,u.closeDialog=m,u.interval.application&&r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api"],angular.module("app.voice").controller("EditInternalRouteAppintervalDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.playback.type.toLowerCase()&&"outboundDial"===s.playback.appType&&(s.playback.phone=s.playback.cutdigits?(s.playback.prefix||"")+"${EXTEN:"+s.playback.cutdigits+"}":(s.playback.prefix||"")+"${EXTEN}",s.playback.record="none"!==s.playback.recordingFormat,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:null),s.playback.appType.toLowerCase()){case"set":s.playback.appdata=s.playback.name+"="+s.playback.value;break;case"custom":break;default:e[0]=s.playback.appdata,e[1]=s.playback.options,s.playback.appdata=e.join(",")}o(s.playback)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.playback=angular.copy(n),s.playback.appdata)switch(s.playback.appType?s.playback.appType.toLowerCase():s.playback.app.toLowerCase()){case"custom":break;case"set":s.playback.name=s.playback.appdata.split("=")[0],s.playback.value=s.playback.appdata.split("=")[1];break;case"agi":s.playback.project=s.playback.appdata;break;default:var r=s.playback.appdata.split(",");s.playback.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.playback.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.playback.type.toLowerCase()&&"outbounddial"===s.playback.appType.toLowerCase()&&(s.playback.prefix=s.playback.phone?s.playback.phone.split("$")[0]:void 0,s.playback.callerId=s.playback.callerID?"CALLERID(all)="+s.playback.callerID:void 0,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppplaybackDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.queue.type.toLowerCase()&&"outboundDial"===s.queue.appType&&(s.queue.phone=s.queue.cutdigits?(s.queue.prefix||"")+"${EXTEN:"+s.queue.cutdigits+"}":(s.queue.prefix||"")+"${EXTEN}",s.queue.record="none"!==s.queue.recordingFormat,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:null),s.queue.appType.toLowerCase()){case"set":s.queue.appdata=s.queue.name+"="+s.queue.value;break;case"custom":break;default:e[0]=s.queue.queue,e[1]=s.queue.options,e[2]=s.queue.URL,e[3]=s.queue.sound,e[4]=s.queue.timeout,e[5]=s.queue.agi,e[6]=s.queue.macro,e[7]=s.queue.gosub,e[8]=s.queue.rule,e[9]=s.queue.position,s.queue.appdata=e.join(",")}o(s.queue)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.queue=angular.copy(n),s.queue.appdata)switch(s.queue.appType?s.queue.appType.toLowerCase():s.queue.app.toLowerCase()){case"custom":break;case"set":s.queue.name=s.queue.appdata.split("=")[0],s.queue.value=s.queue.appdata.split("=")[1];break;case"agi":s.queue.project=s.queue.appdata;break;default:var r=s.queue.appdata.split(",");s.queue.queue=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.queue.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.queue.URL=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.queue.sound=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10),s.queue.timeout=_.isEmpty(r[4])?r[4]:isNaN(r[4])?r[4]:parseInt(r[4],10),s.queue.agi=_.isEmpty(r[5])?r[5]:isNaN(r[5])?r[5]:parseInt(r[5],10),s.queue.macro=_.isEmpty(r[6])?r[6]:isNaN(r[6])?r[6]:parseInt(r[6],10),s.queue.gosub=_.isEmpty(r[7])?r[7]:isNaN(r[7])?r[7]:parseInt(r[7],10),s.queue.rule=_.isEmpty(r[8])?r[8]:isNaN(r[8])?r[8]:parseInt(r[8],10),s.queue.position=_.isEmpty(r[9])?r[9]:isNaN(r[9])?r[9]:parseInt(r[9],10)}"outbound"===s.queue.type.toLowerCase()&&"outbounddial"===s.queue.appType.toLowerCase()&&(s.queue.prefix=s.queue.phone?s.queue.phone.split("$")[0]:void 0,s.queue.callerId=s.queue.callerID?"CALLERID(all)="+s.queue.callerID:void 0,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),a.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){s.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppqueueDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.ringgroup.type.toLowerCase()&&"outboundDial"===s.ringgroup.appType&&(s.ringgroup.phone=s.ringgroup.cutdigits?(s.ringgroup.prefix||"")+"${EXTEN:"+s.ringgroup.cutdigits+"}":(s.ringgroup.prefix||"")+"${EXTEN}",s.ringgroup.record="none"!==s.ringgroup.recordingFormat,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:null),s.ringgroup.appType.toLowerCase()){case"set":s.ringgroup.appdata=s.ringgroup.name+"="+s.ringgroup.value;break;case"custom":break;default:e[0]=s.ringgroup.multipleUsers.join("&"),e[1]=s.ringgroup.timeout,e[2]=s.ringgroup.options,e[3]=s.ringgroup.url,s.ringgroup.appdata=e.join(",")}o(s.ringgroup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.ringgroup=angular.copy(n),s.ringgroup.appdata)switch(s.ringgroup.appType?s.ringgroup.appType.toLowerCase():s.ringgroup.app.toLowerCase()){case"custom":break;case"set":s.ringgroup.name=s.ringgroup.appdata.split("=")[0],s.ringgroup.value=s.ringgroup.appdata.split("=")[1];break;case"agi":s.ringgroup.project=s.ringgroup.appdata;break;default:var r=s.ringgroup.appdata.split(",");s.ringgroup.multipleUsers=r[0].split("&"),s.ringgroup.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.ringgroup.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.ringgroup.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.ringgroup.type.toLowerCase()&&"outbounddial"===s.ringgroup.appType.toLowerCase()&&(s.ringgroup.prefix=s.ringgroup.phone?s.ringgroup.phone.split("$")[0]:void 0,s.ringgroup.callerId=s.ringgroup.callerID?"CALLERID(all)="+s.ringgroup.callerID:void 0,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppringgroupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.set.type.toLowerCase()&&"outboundDial"===s.set.appType&&(s.set.phone=s.set.cutdigits?(s.set.prefix||"")+"${EXTEN:"+s.set.cutdigits+"}":(s.set.prefix||"")+"${EXTEN}",s.set.record="none"!==s.set.recordingFormat,s.set.recordingFormat=s.set.record?s.set.recordingFormat:null),s.set.appType.toLowerCase()){case"set":s.set.appdata=s.set.name+"="+s.set.value;break;case"custom":break;default:e[0]=s.set.name,e[1]=s.set.value,s.set.appdata=e.join("=")}o(s.set)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.set=angular.copy(n),s.set.appdata)switch(s.set.appType?s.set.appType.toLowerCase():s.set.app.toLowerCase()){case"custom":break;case"set":s.set.name=s.set.appdata.split("=")[0],s.set.value=s.set.appdata.split("=")[1];break;case"agi":s.set.project=s.set.appdata;break;default:var r=s.set.appdata.split("=");s.set.name=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.set.value=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.set.type.toLowerCase()&&"outbounddial"===s.set.appType.toLowerCase()&&(s.set.prefix=s.set.phone?s.set.phone.split("$")[0]:void 0,s.set.callerId=s.set.callerID?"CALLERID(all)="+s.set.callerID:void 0,s.set.recordingFormat=s.set.record?s.set.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppsetDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.voicemail.type.toLowerCase()&&"outboundDial"===s.voicemail.appType&&(s.voicemail.phone=s.voicemail.cutdigits?(s.voicemail.prefix||"")+"${EXTEN:"+s.voicemail.cutdigits+"}":(s.voicemail.prefix||"")+"${EXTEN}",s.voicemail.record="none"!==s.voicemail.recordingFormat,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:null),s.voicemail.appType.toLowerCase()){case"set":s.voicemail.appdata=s.voicemail.name+"="+s.voicemail.value;break;case"custom":break;default:e[0]=s.voicemail.voiceMail,e[1]=s.voicemail.options,s.voicemail.appdata=e.join(",")}o(s.voicemail)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.voicemail=angular.copy(n),s.voicemail.appdata)switch(s.voicemail.appType?s.voicemail.appType.toLowerCase():s.voicemail.app.toLowerCase()){case"custom":break;case"set":s.voicemail.name=s.voicemail.appdata.split("=")[0],s.voicemail.value=s.voicemail.appdata.split("=")[1];break;case"agi":s.voicemail.project=s.voicemail.appdata;break;default:var r=s.voicemail.appdata.split(",");s.voicemail.voiceMail=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.voicemail.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.voicemail.type.toLowerCase()&&"outbounddial"===s.voicemail.appType.toLowerCase()&&(s.voicemail.prefix=s.voicemail.phone?s.voicemail.phone.split("$")[0]:void 0,s.voicemail.callerId=s.voicemail.callerID?"CALLERID(all)="+s.voicemail.callerID:void 0,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:"none"),s.saveInternalRouteApp=i,s.closeDialog=o,a.voiceMail.get({fields:"mailbox",sort:"mailbox"}).$promise.then(function(e){s.voiceMails=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","internalrouteApp","api"],angular.module("app.voice").controller("EditInternalRouteAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){e.go("app.voice.internalroutes")}function r(){i.voiceExtension.update({id:l.internalroute.id},l.internalroute).$promise.then(function(){a.success({title:"InternalRoute updated!",msg:l.internalroute.name?l.internalroute.name+" has been updated!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}var l=this;l.internalroute=e.params.internalroute||o||{},l.selectedTab=e.params.tab||0,l.gotoInternalRoutes=s,l.saveInternalRoute=r,i.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$document","toasty","api","internalroute"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.voice.internalroutes.edit",{id:e.id,internalroute:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the internalroute?").htmlContent(""+(e.name||"internalroute")+" will be deleted.").ariaLabel("delete internalroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.internalroutes=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceExtension.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalroute:t,internalroutes:A.internalroutes.rows}})}function v(e){l.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(A.internalroutes.rows,{id:e.id}),A.internalroutes.count-=1,A.internalroutes.rows.length||A.getInternalRoutes(),c.success({title:"InternalRoute deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedInternalRoutes);return A.selectedInternalRoutes=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected internalroutes?").htmlContent(""+A.selectedInternalRoutes.length+" selected will be deleted.").ariaLabel("delete InternalRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedInternalRoutes.forEach(function(e){v(e)}),A.selectedInternalRoutes=[]})}function E(){A.selectedInternalRoutes=[]}function y(){A.selectedInternalRoutes=A.internalroutes.rows}var A=this;A.internalroutes=r||{count:0,rows:[]},A.table="internalroutes",A.listOrder="",A.listOrderAsc=null,A.selectedInternalRoutes=[],A.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getInternalRoutes=g,A.createOrEditInternalRoute=h,A.deleteInternalRoute=v,A.exportSelectedInternalRoutes=b,A.deleteSelectedInternalRoutes=f,A.deselectInternalRoutes=E,A.selectAllInternalRoutes=y,l.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){A.contexts=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getInternalRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","internalroutes","api","msUtils","toasty"],angular.module("app.voice").controller("InternalRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceMusicOnHold.save(p.musiconhold).$promise.then(function(e){p.musiconholds.unshift(e),i.success({title:"MusicOnHold properly created",msg:p.musiconhold.name?p.musiconhold.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete mohSound").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.musiconholdMohSounds=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceMusicOnHold.getSounds(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mohSound:t,mohSounds:h.musiconholdMohSounds.rows}})}function p(e){r.voiceMusicOnHold.removeSound({id:n.params.id,id2:e.id}).$promise.then(function(){_.remove(h.musiconholdMohSounds.rows,{id:e.id}),h.musiconholdMohSounds.count-=1,h.musiconholdMohSounds.rows.length||h.getMusicOnHoldMohSounds(),s.success({title:"MohSound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent(""+h.selectedMusicOnHoldMohSounds.length+" selected will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedMusicOnHoldMohSounds.forEach(function(e){p(e)}),h.selectedMusicOnHoldMohSounds=[]})}var h=this;h.musiconhold={},h.musiconholdMohSounds={count:0,rows:[]},h.selectedMusicOnHoldMohSounds=[],h.query={fields:"createdAt,updatedAt,id,audio,id,createdAt",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getMusicOnHoldMohSounds=m,h.createOrEditMusicOnHoldMohSound=u,h.deleteMusicOnHoldMohSound=p,h.deleteSelectedMusicOnHoldMohSounds=g,r.sound.get({fields:"name,id",sort:"name"}).$promise.then(function(e){h.sounds=_.keyBy(e.rows||[],"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getMusicOnHoldMohSounds())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceMusicOnHold.addSound({id:t.params.id},p.mohSound).$promise.then(function(e){p.mohSounds.unshift(e),i.success({title:"MohSound properly created",msg:p.mohSound.name?p.mohSound.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var t=0;t"+(e.name||"musiconhold")+" will be deleted.").ariaLabel("delete musiconhold").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.musiconholds=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceMusicOnHold.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditMusicOnHoldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:t,musiconholds:A.musiconholds.rows}})}function v(e){l.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(A.musiconholds.rows,{id:e.id}),A.musiconholds.count-=1,A.musiconholds.rows.length||A.getMusicOnHolds(),c.success({title:"MusicOnHold deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedMusicOnHolds);return A.selectedMusicOnHolds=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent(""+A.selectedMusicOnHolds.length+" selected will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedMusicOnHolds.forEach(function(e){v(e)}),A.selectedMusicOnHolds=[]})}function E(){A.selectedMusicOnHolds=[]}function y(){A.selectedMusicOnHolds=A.musiconholds.rows}var A=this;A.musiconholds=r||{count:0,rows:[]},A.table="musiconholds",A.listOrder="",A.listOrderAsc=null,A.selectedMusicOnHolds=[],A.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},A.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getMusicOnHolds=g,A.createOrEditMusicOnHold=h,A.deleteMusicOnHold=v,A.exportSelectedMusicOnHolds=b,A.deleteSelectedMusicOnHolds=f,A.deselectMusicOnHolds=E,A.selectAllMusicOnHolds=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","musiconholds","api","msUtils","toasty"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceExtension.save(p.outboundroute).$promise.then(function(e){p.outboundroutes.unshift(e),i.success({title:"OutboundRoute properly created",msg:p.outboundroute.name?p.outboundroute.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var t=0;t"+e.app+" will be deleted.").ariaLabel("delete application").targetEvent(a).ok("OK").cancel("CANCEL");t.show(i).then(function(){g.outboundrouteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})}function s(e,i){if(g.outboundrouteApps.rows.length){var o=g.outboundrouteApps.rows[i]?g.outboundrouteApps.rows[i]:g.outboundrouteApps.rows[0];t.show({controller:"EditOutboundRouteApp"+(o.appType||o.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/"+(o.appType||o.app).toLowerCase()+"/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundrouteApp:o}}).then(function(e){e&&(e.id?g.outboundrouteApps.rows[i]=e:g.outboundrouteApps.rows.splice(i,0,e),l())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function r(e,a){if(g.outboundrouteApps.rows.length){var i=g.outboundrouteApps.rows[a]?g.outboundrouteApps.rows[a]:g.outboundrouteApps.rows[0];t.show({controller:"EditOutboundRouteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/interval/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:i.interval,IntervalId:i.IntervalId,application:!0},intervals:[]}}).then(function(e){e&&(i.interval=e.interval||"*,*,*,*",i.IntervalId=e.IntervalId||null,l())})}}function l(){var t=2,n=[];n.push({type:"outbound",app:"Set",appdata:"CDR(type)=outbound",context:g.outboundroute.context,exten:g.outboundroute.exten,priority:t++,VoiceExtensionId:g.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"outboundrouteid="+g.outboundroute.id,context:g.outboundroute.context,exten:g.outboundroute.exten,priority:t++,VoiceExtensionId:g.outboundroute.id});for(var a=0,i=0;a"+g.selectedOutboundRouteApps.length+" selected will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");t.show(n).then(function(){g.selectedOutboundRouteApps.forEach(function(e){_.remove(g.outboundrouteApps.rows,{id:e.id})}),g.selectedOutboundRouteApps=[],l()})}var g=this;g.outboundroute={},g.outboundrouteApps={count:0,rows:[]},g.selectedOutboundRouteApps=[],g.query={sort:"priority"},g.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Outbound",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-sip",type:"Outbound",appdata:",xX,,,300,,,,,",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}},{name:"queues",route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,extraApi:[{name:"sounds",route:"sound",filters:{fields:"name,save_name",sort:"name"}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!1,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!1,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!1,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!1,extraApi:[{name:"users",route:"user",filters:{fields:"name",sort:"name"}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",appType:"agi",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,extraApi:[{name:"projects",route:"squareProject",filters:{fields:"name",sort:"name"}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,extraApi:[{name:"contexts",route:"voiceContext",filters:{fields:"name",sort:"name"}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-sip",type:"Outbound",separator:"=",icon:"icon-apps",interval:"*,*,*,*",isApp:!1,fields:[{title:"Variable",name:"name",type:"text",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-sip",icon:"icon-apps",type:"Outbound",interval:"*,*,*,*",isApp:!1,extraApi:[{name:"voiceMails",route:"voiceMail",filters:{fields:"mailbox",sort:"mailbox"}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]},{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}},{name:"tags",route:"tag",filters:{fields:"name",sort:"name"}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Caller_ID",name:"callerID",type:"text"},{title:"Prefix",name:"prefix",type:"text"},{title:"CutDigits",name:"cutdigits",type:"number",min:0},{title:"Recording",name:"recordingFormat",type:"select",values:[{option:"none",value:"'none'"},{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"}],defaultValue:"none",required:!0,general:!0,help:!0},{title:"Tags",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",defaultValues:[{value:"'--'",option:"None"}]},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:null,type:"Outbound",appType:"Custom",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]}],["app"]),{isApp:!1}),g.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},g.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){s(e,e.newIndex)},onSort:function(e){l()}},g.init=i,g.deleteConfirm=o,g.getOutboundRouteApps=m,g.editOutboundRouteApp=s,g.editInterval=r,g.deleteOutboundRouteApp=u,g.deleteSelectedOutboundRouteApps=p,g.rewriteRouting=l,g.getIntervals=c}e.$inject=["api","$mdDialog","$document","toasty"],angular.module("app.voice").controller("OutboundRouteActionsController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.agi.type.toLowerCase()&&"outboundDial"===s.agi.appType&&(s.agi.phone=s.agi.cutdigits?(s.agi.prefix||"")+"${EXTEN:"+s.agi.cutdigits+"}":(s.agi.prefix||"")+"${EXTEN}",s.agi.record="none"!==s.agi.recordingFormat,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:null),s.agi.appType.toLowerCase()){case"set":s.agi.appdata=s.agi.name+"="+s.agi.value;break;case"custom":break;default:e[0]=s.agi.project,s.agi.appdata=e.join(",")}o(s.agi)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.agi=angular.copy(n),s.agi.appdata)switch(s.agi.appType?s.agi.appType.toLowerCase():s.agi.app.toLowerCase()){case"custom":break;case"set":s.agi.name=s.agi.appdata.split("=")[0],s.agi.value=s.agi.appdata.split("=")[1];break;case"agi":s.agi.project=s.agi.appdata;break;default:var r=s.agi.appdata.split(",");s.agi.project=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.agi.type.toLowerCase()&&"outbounddial"===s.agi.appType.toLowerCase()&&(s.agi.prefix=s.agi.phone?s.agi.phone.split("$")[0]:void 0,s.agi.callerId=s.agi.callerID?"CALLERID(all)="+s.agi.callerID:void 0,s.agi.recordingFormat=s.agi.record?s.agi.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.squareProject.get({fields:"name",sort:"name"}).$promise.then(function(e){s.projects=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppagiDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.custom.type.toLowerCase()&&"outboundDial"===s.custom.appType&&(s.custom.phone=s.custom.cutdigits?(s.custom.prefix||"")+"${EXTEN:"+s.custom.cutdigits+"}":(s.custom.prefix||"")+"${EXTEN}",s.custom.record="none"!==s.custom.recordingFormat,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:null),s.custom.appType.toLowerCase()){case"set":s.custom.appdata=s.custom.name+"="+s.custom.value;break;case"custom":break;default:e[0]=s.custom.app,e[1]=s.custom.appdata,s.custom.appdata=e.join(",")}o(s.custom)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.custom=angular.copy(n),s.custom.appdata)switch(s.custom.appType?s.custom.appType.toLowerCase():s.custom.app.toLowerCase()){case"custom":break;case"set":s.custom.name=s.custom.appdata.split("=")[0],s.custom.value=s.custom.appdata.split("=")[1];break;case"agi":s.custom.project=s.custom.appdata;break;default:var r=s.custom.appdata.split(",");s.custom.app=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.custom.appdata=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.custom.type.toLowerCase()&&"outbounddial"===s.custom.appType.toLowerCase()&&(s.custom.prefix=s.custom.phone?s.custom.phone.split("$")[0]:void 0,s.custom.callerId=s.custom.callerID?"CALLERID(all)="+s.custom.callerID:void 0,s.custom.recordingFormat=s.custom.record?s.custom.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppcustomDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.dial.type.toLowerCase()&&"outboundDial"===s.dial.appType&&(s.dial.phone=s.dial.cutdigits?(s.dial.prefix||"")+"${EXTEN:"+s.dial.cutdigits+"}":(s.dial.prefix||"")+"${EXTEN}",s.dial.record="none"!==s.dial.recordingFormat,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:null),s.dial.appType.toLowerCase()){case"set":s.dial.appdata=s.dial.name+"="+s.dial.value;break;case"custom":break;default:e[0]=s.dial.tech,e[1]=s.dial.timeout,e[2]=s.dial.options,e[3]=s.dial.url,s.dial.appdata=e.join(",")}o(s.dial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.dial=angular.copy(n),s.dial.appdata)switch(s.dial.appType?s.dial.appType.toLowerCase():s.dial.app.toLowerCase()){case"custom":break;case"set":s.dial.name=s.dial.appdata.split("=")[0],s.dial.value=s.dial.appdata.split("=")[1];break;case"agi":s.dial.project=s.dial.appdata;break;default:var r=s.dial.appdata.split(",");s.dial.tech=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.dial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.dial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.dial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.dial.type.toLowerCase()&&"outbounddial"===s.dial.appType.toLowerCase()&&(s.dial.prefix=s.dial.phone?s.dial.phone.split("$")[0]:void 0,s.dial.callerId=s.dial.callerID?"CALLERID(all)="+s.dial.callerID:void 0,s.dial.recordingFormat=s.dial.record?s.dial.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppdialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.externaldial.type.toLowerCase()&&"outboundDial"===s.externaldial.appType&&(s.externaldial.phone=s.externaldial.cutdigits?(s.externaldial.prefix||"")+"${EXTEN:"+s.externaldial.cutdigits+"}":(s.externaldial.prefix||"")+"${EXTEN}",s.externaldial.record="none"!==s.externaldial.recordingFormat,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:null),s.externaldial.appType.toLowerCase()){case"set":s.externaldial.appdata=s.externaldial.name+"="+s.externaldial.value;break;case"custom":break;default:e[0]=["SIP",s.externaldial.trunk,s.externaldial.phone].join("/"),e[1]=s.externaldial.timeout,e[2]=s.externaldial.options,e[3]=s.externaldial.url,s.externaldial.appdata=e.join(",")}o(s.externaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.externaldial=angular.copy(n),s.externaldial.appdata)switch(s.externaldial.appType?s.externaldial.appType.toLowerCase():s.externaldial.app.toLowerCase()){case"custom":break;case"set":s.externaldial.name=s.externaldial.appdata.split("=")[0],s.externaldial.value=s.externaldial.appdata.split("=")[1];break;case"agi":s.externaldial.project=s.externaldial.appdata;break;default:var r=s.externaldial.appdata.split(",");s.externaldial.trunk=r[0].split("/")[1],s.externaldial.phone=r[0].split("/")[2],s.externaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.externaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.externaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.externaldial.type.toLowerCase()&&"outbounddial"===s.externaldial.appType.toLowerCase()&&(s.externaldial.prefix=s.externaldial.phone?s.externaldial.phone.split("$")[0]:void 0,s.externaldial.callerId=s.externaldial.callerID?"CALLERID(all)="+s.externaldial.callerID:void 0,s.externaldial.recordingFormat=s.externaldial.record?s.externaldial.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.trunk.get({fields:"name",sort:"name"}).$promise.then(function(e){s.trunks=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppexternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.goto.type.toLowerCase()&&"outboundDial"===s.goto.appType&&(s.goto.phone=s.goto.cutdigits?(s.goto.prefix||"")+"${EXTEN:"+s.goto.cutdigits+"}":(s.goto.prefix||"")+"${EXTEN}",s.goto.record="none"!==s.goto.recordingFormat,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:null),s.goto.appType.toLowerCase()){case"set":s.goto.appdata=s.goto.name+"="+s.goto.value;break;case"custom":break;default:e[0]=s.goto.context,e[1]=s.goto.extension,e[2]=s.goto.priority,s.goto.appdata=e.join(",")}o(s.goto)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.goto=angular.copy(n),s.goto.appdata)switch(s.goto.appType?s.goto.appType.toLowerCase():s.goto.app.toLowerCase()){case"custom":break;case"set":s.goto.name=s.goto.appdata.split("=")[0],s.goto.value=s.goto.appdata.split("=")[1];break;case"agi":s.goto.project=s.goto.appdata;break;default:var r=s.goto.appdata.split(",");s.goto.context=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.goto.extension=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.goto.priority=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10)}"outbound"===s.goto.type.toLowerCase()&&"outbounddial"===s.goto.appType.toLowerCase()&&(s.goto.prefix=s.goto.phone?s.goto.phone.split("$")[0]:void 0,s.goto.callerId=s.goto.callerID?"CALLERID(all)="+s.goto.callerID:void 0,s.goto.recordingFormat=s.goto.record?s.goto.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){s.contexts=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppgotoDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.hangup.type.toLowerCase()&&"outboundDial"===s.hangup.appType&&(s.hangup.phone=s.hangup.cutdigits?(s.hangup.prefix||"")+"${EXTEN:"+s.hangup.cutdigits+"}":(s.hangup.prefix||"")+"${EXTEN}",s.hangup.record="none"!==s.hangup.recordingFormat,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:null),s.hangup.appType.toLowerCase()){case"set":s.hangup.appdata=s.hangup.name+"="+s.hangup.value;break;case"custom":break;default:e[0]=s.hangup.appdata,s.hangup.appdata=e.join(",")}o(s.hangup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.hangup=angular.copy(n),s.hangup.appdata)switch(s.hangup.appType?s.hangup.appType.toLowerCase():s.hangup.app.toLowerCase()){case"custom":break;case"set":s.hangup.name=s.hangup.appdata.split("=")[0],s.hangup.value=s.hangup.appdata.split("=")[1];break;case"agi":s.hangup.project=s.hangup.appdata;break;default:var r=s.hangup.appdata.split(",");s.hangup.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10)}"outbound"===s.hangup.type.toLowerCase()&&"outbounddial"===s.hangup.appType.toLowerCase()&&(s.hangup.prefix=s.hangup.phone?s.hangup.phone.split("$")[0]:void 0,s.hangup.callerId=s.hangup.callerID?"CALLERID(all)="+s.hangup.callerID:void 0,s.hangup.recordingFormat=s.hangup.record?s.hangup.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteApphangupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.internaldial.type.toLowerCase()&&"outboundDial"===s.internaldial.appType&&(s.internaldial.phone=s.internaldial.cutdigits?(s.internaldial.prefix||"")+"${EXTEN:"+s.internaldial.cutdigits+"}":(s.internaldial.prefix||"")+"${EXTEN}",s.internaldial.record="none"!==s.internaldial.recordingFormat,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:null),s.internaldial.appType.toLowerCase()){case"set":s.internaldial.appdata=s.internaldial.name+"="+s.internaldial.value;break;case"custom":break;default:e[0]=s.internaldial.user,e[1]=s.internaldial.timeout,e[2]=s.internaldial.options,e[3]=s.internaldial.url,s.internaldial.appdata=e.join(",")}o(s.internaldial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.internaldial=angular.copy(n),s.internaldial.appdata)switch(s.internaldial.appType?s.internaldial.appType.toLowerCase():s.internaldial.app.toLowerCase()){case"custom":break;case"set":s.internaldial.name=s.internaldial.appdata.split("=")[0],s.internaldial.value=s.internaldial.appdata.split("=")[1];break;case"agi":s.internaldial.project=s.internaldial.appdata;break;default:var r=s.internaldial.appdata.split(",");s.internaldial.user=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.internaldial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.internaldial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.internaldial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.internaldial.type.toLowerCase()&&"outbounddial"===s.internaldial.appType.toLowerCase()&&(s.internaldial.prefix=s.internaldial.phone?s.internaldial.phone.split("$")[0]:void 0,s.internaldial.callerId=s.internaldial.callerID?"CALLERID(all)="+s.internaldial.callerID:void 0,s.internaldial.recordingFormat=s.internaldial.record?s.internaldial.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){switch(u.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==u.timeRangeFrom&&u.timeRangeFrom&&u.timeRangeTo){var t=(u.timeRangeFrom.getHours()<10?"0":"")+u.timeRangeFrom.getHours()+":"+(u.timeRangeFrom.getMinutes()<10?"0":"")+u.timeRangeFrom.getMinutes(),n=(u.timeRangeTo.getHours()<10?"0":"")+u.timeRangeTo.getHours()+":"+(u.timeRangeTo.getMinutes()<10?"0":"")+u.timeRangeTo.getMinutes();e.push(t+"-"+n)}else e.push("*");return u.dayOfWeekFrom&&u.dayOfWeekTo?e.push(u.dayOfWeekFrom+"-"+u.dayOfWeekTo):e.push("*"),u.monthDayFrom&&u.monthDayTo?e.push(u.monthDayFrom+"-"+u.monthDayTo):e.push("*"),u.monthFrom&&u.monthTo?e.push(u.monthFrom+"-"+u.monthTo):e.push("*"),e.join()}}function d(){u.errors=[],u.interval.interval=l(),r.interval.save(u.interval).$promise.then(function(e){u.intervals.push(e),s.success({title:"Interval properly created",msg:u.interval.name?u.interval.name+" has been created!":""}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})}function c(){u.errors=[],u.interval.interval=l(),u.interval.application?("list"!==u.type&&(u.interval.IntervalId=null),m(u.interval)):r.interval.update({id:u.interval.id},u.interval).$promise.then(function(e){var t=_.find(u.intervals,{id:e.id});t&&_.merge(t,e),s.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),m()}).catch(function(e){console.error(e),u.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})}function m(e){t.hide(e)}var u=this;if(u.errors=[],u.title="TOOLS.EDIT_INTERVAL",u.interval=angular.copy(i),u.intervals=o,u.newInterval=!1,u.types=["always","custom","list"],u.daysOfWeek=a.getDaysOfWeek(),u.monthNumber=a.getMonthNumber(),u.monthName=a.getMonthName(),u.daysOfMonth=a.getDaysOfMonth(),u.interval)if("*,*,*,*"!==u.interval.interval){u.type="custom";var p=u.interval.interval.split(","),g=p[0],h=p[1],v=p[2],b=p[3];if("*"!==g){var f,E=g.split("-")[0],y=g.split("-")[1];(f=new Date).setHours(Number(E.split(":")[0])),f.setMinutes(Number(E.split(":")[1])),u.timeRangeFrom=f,(f=new Date).setHours(Number(y.split(":")[0])),f.setMinutes(Number(y.split(":")[1])),u.timeRangeTo=f}"*"!==h&&(u.dayOfWeekFrom=h.split("-")[0],u.dayOfWeekTo=h.split("-")[1]),"*"!==v&&(u.monthDayFrom=v.split("-")[0],u.monthDayTo=v.split("-")[1]),"*"!==b&&(u.monthFrom=b.split("-")[0],u.monthTo=b.split("-")[1])}else u.type="always";else u.interval={interval:"*,*,*,*"},u.type="always",u.title="TOOLS.NEW_INTERVAL",u.newInterval=!0;e.params.id&&!u.interval.application&&(u.interval.IntervalId=e.params.id),u.interval.IntervalId&&u.interval.application&&(u.type="list"),u.addNewInterval=d,u.saveInterval=c,u.closeDialog=m,u.interval.application&&r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api"],angular.module("app.voice").controller("EditOutboundRouteAppintervalDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.outbounddial.type.toLowerCase()&&"outboundDial"===s.outbounddial.appType&&(s.outbounddial.phone=s.outbounddial.cutdigits?(s.outbounddial.prefix||"")+"${EXTEN:"+s.outbounddial.cutdigits+"}":(s.outbounddial.prefix||"")+"${EXTEN}",s.outbounddial.record="none"!==s.outbounddial.recordingFormat,s.outbounddial.recordingFormat=s.outbounddial.record?s.outbounddial.recordingFormat:null),s.outbounddial.appType.toLowerCase()){case"set":s.outbounddial.appdata=s.outbounddial.name+"="+s.outbounddial.value;break;case"custom":break;default:e[0]=["SIP",s.outbounddial.trunk,s.outbounddial.phone].join("/"),e[1]=s.outbounddial.timeout,e[2]=s.outbounddial.options,e[3]=s.outbounddial.url,s.outbounddial.appdata=e.join(",")}o(s.outbounddial)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.outbounddial=angular.copy(n),s.outbounddial.appdata)switch(s.outbounddial.appType?s.outbounddial.appType.toLowerCase():s.outbounddial.app.toLowerCase()){case"custom":break;case"set":s.outbounddial.name=s.outbounddial.appdata.split("=")[0],s.outbounddial.value=s.outbounddial.appdata.split("=")[1];break;case"agi":s.outbounddial.project=s.outbounddial.appdata;break;default:var r=s.outbounddial.appdata.split(",");s.outbounddial.trunk=r[0].split("/")[1],s.outbounddial.phone=r[0].split("/")[2],s.outbounddial.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.outbounddial.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.outbounddial.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.outbounddial.type.toLowerCase()&&"outbounddial"===s.outbounddial.appType.toLowerCase()&&(s.outbounddial.prefix=s.outbounddial.phone?s.outbounddial.phone.split("$")[0]:void 0,s.outbounddial.callerId=s.outbounddial.callerID?"CALLERID(all)="+s.outbounddial.callerID:void 0,s.outbounddial.recordingFormat=s.outbounddial.record?s.outbounddial.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.trunk.get({fields:"name",sort:"name"}).$promise.then(function(e){s.trunks=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),a.tag.get({fields:"name",sort:"name"}).$promise.then(function(e){s.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppoutbounddialDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.playback.type.toLowerCase()&&"outboundDial"===s.playback.appType&&(s.playback.phone=s.playback.cutdigits?(s.playback.prefix||"")+"${EXTEN:"+s.playback.cutdigits+"}":(s.playback.prefix||"")+"${EXTEN}",s.playback.record="none"!==s.playback.recordingFormat,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:null),s.playback.appType.toLowerCase()){case"set":s.playback.appdata=s.playback.name+"="+s.playback.value;break;case"custom":break;default:e[0]=s.playback.appdata,e[1]=s.playback.options,s.playback.appdata=e.join(",")}o(s.playback)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.playback=angular.copy(n),s.playback.appdata)switch(s.playback.appType?s.playback.appType.toLowerCase():s.playback.app.toLowerCase()){case"custom":break;case"set":s.playback.name=s.playback.appdata.split("=")[0],s.playback.value=s.playback.appdata.split("=")[1];break;case"agi":s.playback.project=s.playback.appdata;break;default:var r=s.playback.appdata.split(",");s.playback.appdata=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.playback.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.playback.type.toLowerCase()&&"outbounddial"===s.playback.appType.toLowerCase()&&(s.playback.prefix=s.playback.phone?s.playback.phone.split("$")[0]:void 0,s.playback.callerId=s.playback.callerID?"CALLERID(all)="+s.playback.callerID:void 0,s.playback.recordingFormat=s.playback.record?s.playback.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppplaybackDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.queue.type.toLowerCase()&&"outboundDial"===s.queue.appType&&(s.queue.phone=s.queue.cutdigits?(s.queue.prefix||"")+"${EXTEN:"+s.queue.cutdigits+"}":(s.queue.prefix||"")+"${EXTEN}",s.queue.record="none"!==s.queue.recordingFormat,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:null),s.queue.appType.toLowerCase()){case"set":s.queue.appdata=s.queue.name+"="+s.queue.value;break;case"custom":break;default:e[0]=s.queue.queue,e[1]=s.queue.options,e[2]=s.queue.URL,e[3]=s.queue.sound,e[4]=s.queue.timeout,e[5]=s.queue.agi,e[6]=s.queue.macro,e[7]=s.queue.gosub,e[8]=s.queue.rule,e[9]=s.queue.position,s.queue.appdata=e.join(",")}o(s.queue)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.queue=angular.copy(n),s.queue.appdata)switch(s.queue.appType?s.queue.appType.toLowerCase():s.queue.app.toLowerCase()){case"custom":break;case"set":s.queue.name=s.queue.appdata.split("=")[0],s.queue.value=s.queue.appdata.split("=")[1];break;case"agi":s.queue.project=s.queue.appdata;break;default:var r=s.queue.appdata.split(",");s.queue.queue=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.queue.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.queue.URL=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.queue.sound=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10),s.queue.timeout=_.isEmpty(r[4])?r[4]:isNaN(r[4])?r[4]:parseInt(r[4],10),s.queue.agi=_.isEmpty(r[5])?r[5]:isNaN(r[5])?r[5]:parseInt(r[5],10),s.queue.macro=_.isEmpty(r[6])?r[6]:isNaN(r[6])?r[6]:parseInt(r[6],10),s.queue.gosub=_.isEmpty(r[7])?r[7]:isNaN(r[7])?r[7]:parseInt(r[7],10),s.queue.rule=_.isEmpty(r[8])?r[8]:isNaN(r[8])?r[8]:parseInt(r[8],10),s.queue.position=_.isEmpty(r[9])?r[9]:isNaN(r[9])?r[9]:parseInt(r[9],10)}"outbound"===s.queue.type.toLowerCase()&&"outbounddial"===s.queue.appType.toLowerCase()&&(s.queue.prefix=s.queue.phone?s.queue.phone.split("$")[0]:void 0,s.queue.callerId=s.queue.callerID?"CALLERID(all)="+s.queue.callerID:void 0,s.queue.recordingFormat=s.queue.record?s.queue.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.sound.get({fields:"name,save_name",sort:"name"}).$promise.then(function(e){s.sounds=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),a.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){s.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppqueueDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.ringgroup.type.toLowerCase()&&"outboundDial"===s.ringgroup.appType&&(s.ringgroup.phone=s.ringgroup.cutdigits?(s.ringgroup.prefix||"")+"${EXTEN:"+s.ringgroup.cutdigits+"}":(s.ringgroup.prefix||"")+"${EXTEN}",s.ringgroup.record="none"!==s.ringgroup.recordingFormat,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:null),s.ringgroup.appType.toLowerCase()){case"set":s.ringgroup.appdata=s.ringgroup.name+"="+s.ringgroup.value;break;case"custom":break;default:e[0]=s.ringgroup.multipleUsers.join("&"),e[1]=s.ringgroup.timeout,e[2]=s.ringgroup.options,e[3]=s.ringgroup.url,s.ringgroup.appdata=e.join(",")}o(s.ringgroup)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.ringgroup=angular.copy(n),s.ringgroup.appdata)switch(s.ringgroup.appType?s.ringgroup.appType.toLowerCase():s.ringgroup.app.toLowerCase()){case"custom":break;case"set":s.ringgroup.name=s.ringgroup.appdata.split("=")[0],s.ringgroup.value=s.ringgroup.appdata.split("=")[1];break;case"agi":s.ringgroup.project=s.ringgroup.appdata;break;default:var r=s.ringgroup.appdata.split(",");s.ringgroup.multipleUsers=r[0].split("&"),s.ringgroup.timeout=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10),s.ringgroup.options=_.isEmpty(r[2])?r[2]:isNaN(r[2])?r[2]:parseInt(r[2],10),s.ringgroup.url=_.isEmpty(r[3])?r[3]:isNaN(r[3])?r[3]:parseInt(r[3],10)}"outbound"===s.ringgroup.type.toLowerCase()&&"outbounddial"===s.ringgroup.appType.toLowerCase()&&(s.ringgroup.prefix=s.ringgroup.phone?s.ringgroup.phone.split("$")[0]:void 0,s.ringgroup.callerId=s.ringgroup.callerID?"CALLERID(all)="+s.ringgroup.callerID:void 0,s.ringgroup.recordingFormat=s.ringgroup.record?s.ringgroup.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.user.get({fields:"name",sort:"name"}).$promise.then(function(e){s.users=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppringgroupDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.set.type.toLowerCase()&&"outboundDial"===s.set.appType&&(s.set.phone=s.set.cutdigits?(s.set.prefix||"")+"${EXTEN:"+s.set.cutdigits+"}":(s.set.prefix||"")+"${EXTEN}",s.set.record="none"!==s.set.recordingFormat,s.set.recordingFormat=s.set.record?s.set.recordingFormat:null),s.set.appType.toLowerCase()){case"set":s.set.appdata=s.set.name+"="+s.set.value;break;case"custom":break;default:e[0]=s.set.name,e[1]=s.set.value,s.set.appdata=e.join("=")}o(s.set)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.set=angular.copy(n),s.set.appdata)switch(s.set.appType?s.set.appType.toLowerCase():s.set.app.toLowerCase()){case"custom":break;case"set":s.set.name=s.set.appdata.split("=")[0],s.set.value=s.set.appdata.split("=")[1];break;case"agi":s.set.project=s.set.appdata;break;default:var r=s.set.appdata.split("=");s.set.name=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.set.value=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.set.type.toLowerCase()&&"outbounddial"===s.set.appType.toLowerCase()&&(s.set.prefix=s.set.phone?s.set.phone.split("$")[0]:void 0,s.set.callerId=s.set.callerID?"CALLERID(all)="+s.set.callerID:void 0,s.set.recordingFormat=s.set.record?s.set.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppsetDialogController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[];var e=[];switch("outbound"===s.voicemail.type.toLowerCase()&&"outboundDial"===s.voicemail.appType&&(s.voicemail.phone=s.voicemail.cutdigits?(s.voicemail.prefix||"")+"${EXTEN:"+s.voicemail.cutdigits+"}":(s.voicemail.prefix||"")+"${EXTEN}",s.voicemail.record="none"!==s.voicemail.recordingFormat,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:null),s.voicemail.appType.toLowerCase()){case"set":s.voicemail.appdata=s.voicemail.name+"="+s.voicemail.value;break;case"custom":break;default:e[0]=s.voicemail.voiceMail,e[1]=s.voicemail.options,s.voicemail.appdata=e.join(",")}o(s.voicemail)}function o(t){e.hide(t)}var s=this;if(s.errors=[],s.title="VOICE.EDIT_"+(n.appType||n.app).toUpperCase(),s.voicemail=angular.copy(n),s.voicemail.appdata)switch(s.voicemail.appType?s.voicemail.appType.toLowerCase():s.voicemail.app.toLowerCase()){case"custom":break;case"set":s.voicemail.name=s.voicemail.appdata.split("=")[0],s.voicemail.value=s.voicemail.appdata.split("=")[1];break;case"agi":s.voicemail.project=s.voicemail.appdata;break;default:var r=s.voicemail.appdata.split(",");s.voicemail.voiceMail=_.isEmpty(r[0])?r[0]:isNaN(r[0])?r[0]:parseInt(r[0],10),s.voicemail.options=_.isEmpty(r[1])?r[1]:isNaN(r[1])?r[1]:parseInt(r[1],10)}"outbound"===s.voicemail.type.toLowerCase()&&"outbounddial"===s.voicemail.appType.toLowerCase()&&(s.voicemail.prefix=s.voicemail.phone?s.voicemail.phone.split("$")[0]:void 0,s.voicemail.callerId=s.voicemail.callerID?"CALLERID(all)="+s.voicemail.callerID:void 0,s.voicemail.recordingFormat=s.voicemail.record?s.voicemail.recordingFormat:"none"),s.saveOutboundRouteApp=i,s.closeDialog=o,a.voiceMail.get({fields:"mailbox",sort:"mailbox"}).$promise.then(function(e){s.voiceMails=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","toasty","outboundrouteApp","api"],angular.module("app.voice").controller("EditOutboundRouteAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){e.go("app.voice.outboundroutes")}function r(){i.voiceExtension.update({id:l.outboundroute.id},l.outboundroute).$promise.then(function(){a.success({title:"OutboundRoute updated!",msg:l.outboundroute.name?l.outboundroute.name+" has been updated!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}var l=this;l.outboundroute=e.params.outboundroute||o||{},l.selectedTab=e.params.tab||0,l.gotoOutboundRoutes=s,l.saveOutboundRoute=r,i.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$document","toasty","api","outboundroute"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.voice.outboundroutes.edit",{id:e.id,outboundroute:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the outboundroute?").htmlContent(""+(e.name||"outboundroute")+" will be deleted.").ariaLabel("delete outboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.outboundroutes=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceExtension.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundroute:t,outboundroutes:A.outboundroutes.rows}})}function v(e){l.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(A.outboundroutes.rows,{id:e.id}),A.outboundroutes.count-=1,A.outboundroutes.rows.length||A.getOutboundRoutes(),c.success({title:"OutboundRoute deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedOutboundRoutes);return A.selectedOutboundRoutes=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected outboundroutes?").htmlContent(""+A.selectedOutboundRoutes.length+" selected will be deleted.").ariaLabel("delete OutboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedOutboundRoutes.forEach(function(e){v(e)}),A.selectedOutboundRoutes=[]})}function E(){A.selectedOutboundRoutes=[]}function y(){A.selectedOutboundRoutes=A.outboundroutes.rows}var A=this;A.outboundroutes=r||{count:0,rows:[]},A.table="outboundroutes",A.listOrder="",A.listOrderAsc=null,A.selectedOutboundRoutes=[],A.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"Outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},A.editstate=m,A.deleteconfirm=u,A.success=p,A.getOutboundRoutes=g,A.createOrEditOutboundRoute=h,A.deleteOutboundRoute=v,A.exportSelectedOutboundRoutes=b,A.deleteSelectedOutboundRoutes=f,A.deselectOutboundRoutes=E,A.selectAllOutboundRoutes=y,l.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){A.contexts=_.keyBy(e.rows||[],"id")}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getOutboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","outboundroutes","api","msUtils","toasty"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(){_.forIn(A.agents,function(e,t){A.rpcAgents[t]&&_.merge(e,_.pick(A.rpcAgents[t],C))})}function u(e,t){return r.user.logout({id:e.id}).$promise.then(function(){d.success({title:"Agent logout",msg:e.fullname+" properly logout"})}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function p(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",realtime:!0,direction:"inbound"}})}function g(e,t){return r.user.pause({id:e.id,type:t})}function h(e){return r.user.unpause({id:e.id})}function v(e){return _.includes(A.availableStates,e)}function b(e){A.agents[e.id]&&_.merge(A.agents[e.id],_.pick(e,C))}function f(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("
TODO legend status + state
").ok("Ok").targetEvent(e))}function E(e){A.count=e.count,A.agents=e?_.keyBy(e.rows?e.rows:[],"id"):{},m()}function y(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=r.user.get(A.query,E).$promise}var A=this,C=["userpic","online","voicePause","lastLoginAt","lastPauseAt","pauseType","internal","state","stateTime","status","address"];A.availableStates=["ringing","inuse","busy","onhold","not_inuse"],A.pauses=i||{count:0,rows:[]},A.count=o.count,A.agents=o?_.keyBy(o.rows?o.rows:[],"id"):{},A.rpcAgents=s?_.keyBy(s.rows?s.rows:[],"id"):{},A.query={fields:"id,fullname,userpic,role,internal,online,voicePause,pauseType,lastLoginAt",role:"agent",sort:"-updatedAt",limit:10,page:1},A.statusClass=c.status,A.stateClass=c.state,A.pause=g,A.unPause=h,A.onSave=b,A.$onInit=m,A.success=E,A.showInfo=f,A.queueAdd=p,A.getAgents=y,A.isAvailableState=v,A.logout=u,l.on("user:save",A.onSave),l.on("user:update",A.onSave);var x=!0,T=1;e.$watch("vm.query.filter",function(e,n){x?t(function(){x=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getAgents())}),e.$on("$destroy",function(){l.removeAllListeners("user:save"),l.removeAllListeners("user:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","pauses","agents","rpcAgents","api","socket","toasty","helperClasses"],angular.module("app.voice").controller("AgentsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(e){var t=_.find(l.calls.rows,{channel:e.channel});e.channelstatedesc=e.answered?"up":"ring",t?_.merge(t,e):l.calls.rows.push(e)}function r(e){var n=_.findIndex(l.calls.rows,{channel:e.channel});n>=0&&(l.calls.rows[n].status="hangup"),t(function(){l.calls.rows.splice(n,1)},5e3)}var l=this;l.calls=i||{rows:[],count:0},l.query={limit:10,page:1,limitOptions:[10,20,30]},l.channelStatus=o.channelStatusOut,l.onSave=s,l.onRemove=r,a.on("voice_outbound_channel:save",l.onSave),a.on("voice_outbound_channel:remove",l.onRemove),e.$on("$destroy",function(){a.removeAllListeners("voice_outbound_channel:save"),a.removeAllListeners("voice_outbound_channel:remove")})}e.$inject=["$scope","$timeout","api","socket","rpcCalls","helperClasses"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l){function d(e){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:e}).$promise.then(function(t){l.success({title:"Channel "+e+" properly hangup!",msg:t.message||""})}).catch(function(e){console.error(e)})}function c(e,t){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:e,exten:t}).$promise.then(function(t){l.success({title:"Channel "+e+" properly redirect!",msg:t.message||""})}).catch(function(e){console.error(e)})}function m(e,t){var a=n.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return n.show(a).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise.then(function(e){l.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){console.error(e)})}).catch(function(e){console.error(e)})}function u(e){var t=_.find(g.calls.rows,{channel:e.channel});e.status=e.queuecallerleaveAt?"up":"ring",t?_.merge(t,e):g.calls.rows.push(e)}function p(e){var n=_.findIndex(g.calls.rows,{channel:e.channel});n>=0&&(g.calls.rows[n].status="hangup"),t(function(){g.calls.rows.splice(n,1)},5e3)}var g=this;g.calls=i||{rows:[],count:0},g.agents=a||{count:0,rows:[]},g.query={limit:10,page:1,limitOptions:[10,15,20]},g.channelStatusClass=r.channelStatus,g.onSave=u,g.onRemove=p,g.hangup=d,g.redirectToAgent=c,g.redirectToNumber=m,s.on("voice_queue_channel:save",g.onSave),s.on("voice_queue_channel:remove",g.onRemove),e.$on("$destroy",function(){s.removeAllListeners("voice_queue_channel:save"),s.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","rpcCalls","api","socket","helperClasses","toasty"],angular.module("app.voice").controller("QueueCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s){function r(){_.forIn(m.queues,function(e,t){m.rpcQueues[t]&&_.merge(e,_.pick(m.rpcQueues[t],u))})}function l(e){m.queues[e.id]&&_.merge(m.queues[e.id],_.pick(e,u))}function d(e){m.count=e.count,m.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},r()}function c(){m.query.offset=(m.query.page-1)*m.query.limit,s.hasRole("admin")?m.promise=i.voiceQueue.get(m.query,d).$promise:m.promise=i.user.getQueues(m.query,d).$promise}var m=this,u=["total","answered","unmanaged","sumHoldTime","sumDuration","sumBillable"];m.count=n.count,m.queues=n?_.keyBy(n.rows?n.rows:[],"id"):{},m.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},s.hasRole("admin")?m.query={type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:m.query={id:s.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},m.success=d,m.getQueues=c,m.onSave=l,m.$onInit=r,o.on("voice_queue:save",m.onSave);var p=!0,g=1;e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=g),m.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save")})}e.$inject=["$scope","$timeout","queues","rpcQueues","api","socket","Auth"],angular.module("app.voice").controller("QueueParamsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(){var e=[];return _.forIn(E.queues,function(t,n){t.paused=0,t.loggedInDb=0,e.push(r.voiceQueue.getMembers({id:n}).$promise),E.rpcQueues[n]&&_.merge(t,_.pick(E.rpcQueues[n],y))}),a.all(e).then(function(e){for(var t=0;tTODO legend status + state").ok("Ok").targetEvent(e))}function c(e){p.telephones[e.id]&&_.merge(p.telephones[e.id],_.pick(e,g))}function m(e){p.telephones=e?_.keyBy(e.rows?e.rows:[],"id"):{},l()}function u(){p.query.offset=(p.query.page-1)*p.query.limit,p.promise=o.user.get(p.query,m).$promise}var p=this,g=["fullname","internal","state","status"];p.count=a.count,p.attributes=["fullname","internal","state","status","address"],p.telephones=a?_.keyBy(a.rows?a.rows:[],"id"):{},p.rpcTelephones=i?_.keyBy(i.rows?i.rows:[],"id"):{},p.query={fields:"id,fullname,internal",role:"telephone",sort:"-updatedAt",limit:10,page:1},p.statusClass=r.status,p.stateClass=r.state,p.success=m,p.$onInit=l,p.showInfo=d,p.getTelephones=u,p.onSave=c,s.on("telephone:save",p.onSave);var h=!0,v=1;e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getTelephones())}),e.$on("$destroy",function(){s.removeAllListeners("telephone:save")})}e.$inject=["$scope","$timeout","$mdDialog","telephones","rpcTelephones","api","socket","helperClasses"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){_.forIn(p.trunks,function(e,t){p.rpcTrunks[t]&&_.merge(e,_.pick(p.rpcTrunks[t],g))})}function d(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("
TODO legend status + state
").ok("Ok").targetEvent(e))}function c(e){p.trunks[e.id]&&_.merge(p.trunks[e.id],_.pick(e,g))}function m(e){p.count=e.count,p.trunks=e?_.keyBy(e.rows?e.rows:[],"id"):{},l()}function u(){p.query.offset=(p.query.page-1)*p.query.limit,p.promise=o.trunk.get(p.query,m).$promise}var p=this,g=["status","stateRegistry","registry","host","port","internal","state","status"];p.count=a.count,p.trunks=a?_.keyBy(a.rows?a.rows:[],"id"):{},p.rpcTrunks=i?_.keyBy(i.rows?i.rows:[],"id"):{},p.query={fields:"id,name",active:!0,sort:"-updatedAt",limit:10,page:1},p.statusClass=r.status,p.stateClass=r.state,p.success=m,p.$onInit=l,p.showInfo=d,p.getTrunks=u,p.onSave=c,s.on("trunk:save",p.onSave);var h=!0,v=1;e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getTrunks())}),e.$on("$destroy",function(){s.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","helperClasses"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceMail.save(p.voicemail).$promise.then(function(e){p.voicemails.unshift(e),i.success({title:"Voicemail properly created",msg:p.voicemail.name?p.voicemail.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.save"}];for(var t=0;t"+e.name+" will be deleted.").ariaLabel("delete message").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){p(e)},function(){console.log("CANCEL")})}function c(e){h.voicemailMessages=e||{count:0,rows:[]}}function m(){h.query.offset=(h.query.page-1)*h.query.limit,h.promise=r.voiceMail.getMessages(h.query,c).$promise}function u(e,t){i.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{message:t,messages:h.voicemailMessages.rows}})}function p(e){r.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(h.voicemailMessages.rows,{id:e.id}),h.voicemailMessages.count-=1,h.voicemailMessages.rows.length||h.getVoicemailMessages(),s.success({title:"Message deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})}function g(e){var t=i.confirm().title("Are you sure want to delete the selected messages?").htmlContent(""+h.selectedVoicemailMessages.length+" selected will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedVoicemailMessages.forEach(function(e){p(e)}),h.selectedVoicemailMessages=[]})}var h=this;h.voicemail={},h.voicemailMessages={count:0,rows:[]},h.selectedVoicemailMessages=[],h.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp",limit:10,page:1},h.init=l,h.deleteConfirm=d,h.success=c,h.getVoicemailMessages=m,h.createOrEditVoicemailMessage=u,h.deleteVoicemailMessage=p,h.deleteSelectedVoicemailMessages=g;var v=!0,b=1;t.$watch("vm_dc.query.filter",function(e,t){v?a(function(){v=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getVoicemailMessages())})}e.$inject=["$cookies","$scope","$state","$timeout","$mdDialog","$document","toasty","api"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o){function s(){e.go("app.voice.voicemails")}function r(){i.voiceMail.update({id:l.voicemail.id},l.voicemail).$promise.then(function(){a.success({title:"Voicemail updated!",msg:l.voicemail.name?l.voicemail.name+" has been updated!":""})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})}var l=this;l.voicemail=e.params.voicemail||o||{},l.selectedTab=e.params.tab||0,l.gotoVoicemails=s,l.saveVoicemail=r,i.voiceContext.get({fields:"name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$document","toasty","api","voicemail"],angular.module("app.voice").controller("VoicemailController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c){function m(e,t){n.go("app.voice.voicemails.edit",{id:e.id,voicemail:e})}function u(e,t){var n=i.confirm().title("Are you sure want to delete the voicemail?").htmlContent(""+(e.name||"voicemail")+" will be deleted.").ariaLabel("delete voicemail").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.voicemails=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceMail.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditVoicemailDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:t,voicemails:A.voicemails.rows}})}function v(e){l.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(A.voicemails.rows,{id:e.id}),A.voicemails.count-=1,A.voicemails.rows.length||A.getVoicemails(),c.success({title:"Voicemail deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedVoicemails);return A.selectedVoicemails=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent(""+A.selectedVoicemails.length+" selected will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedVoicemails.forEach(function(e){v(e)}),A.selectedVoicemails=[]})}function E(){A.selectedVoicemails=[]}function y(){A.selectedVoicemails=A.voicemails.rows}var A=this;A.voicemails=r||{count:0,rows:[]},A.table="voicemails",A.listOrder="",A.listOrderAsc=null,A.selectedVoicemails=[],A.query={fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,page:1},A.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),A.editstate=m,A.deleteconfirm=u,A.success=p,A.getVoicemails=g,A.createOrEditVoicemail=h,A.deleteVoicemail=v,A.exportSelectedVoicemails=b,A.deleteSelectedVoicemails=f,A.deselectVoicemails=E,A.selectAllVoicemails=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","voicemails","api","msUtils","toasty"],angular.module("app.voice").controller("VoicemailsController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceQueue.save(p.voiceQueue).$promise.then(function(e){p.voiceQueues.unshift(e),i.success({title:"VoiceQueue properly created",msg:p.voiceQueue.name?p.voiceQueue.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var t=0;t"+(e.name||"voiceQueue")+" will be deleted.").ariaLabel("delete voiceQueue").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){f(e)},function(){console.log("CANCEL")})}function h(e){x.voiceQueues=e||{count:0,rows:[]}}function v(){x.query.offset=(x.query.page-1)*x.query.limit,x.promise=l.voiceQueue.get(x.query,h).$promise}function b(e,t){i.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:t,voiceQueues:x.voiceQueues.rows}})}function f(e){l.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(x.voiceQueues.rows,{id:e.id}),x.voiceQueues.count-=1,x.voiceQueues.rows.length||x.getVoiceQueues(),c.success({title:"VoiceQueue deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}function E(){var e=_.clone(x.selectedVoiceQueues);return x.selectedVoiceQueues=[],e}function y(e){var t=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent(""+x.selectedVoiceQueues.length+" selected will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){x.selectedVoiceQueues.forEach(function(e){f(e)}),x.selectedVoiceQueues=[]})}function A(){x.selectedVoiceQueues=[]}function C(){x.selectedVoiceQueues=x.voiceQueues.rows}var x=this;x.voiceQueues=r||{count:0,rows:[]},x.table="voiceQueues",x.listOrder="",x.listOrderAsc=null,x.selectedVoiceQueues=[],x.query={fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar",type:"inbound",sort:"-updatedAt",limit:10,page:1},x.arraystrategy=_.keyBy([{option:"Ringall",value:"'ringall'"},{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayjoinempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknoww",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknoww",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayannounce_position=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Limit",value:"'limit'"},{option:"More",value:"'more'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),x.editstate=m,x.teamadddialog=u,x.agentadddialog=p,x.deleteconfirm=g,x.success=h,x.getVoiceQueues=v,x.createOrEditVoiceQueue=b,x.deleteVoiceQueue=f,x.exportSelectedVoiceQueues=E,x.deleteSelectedVoiceQueues=y,x.deselectVoiceQueues=A,x.selectAllVoiceQueues=C;var T=!0,S=1;e.$watch("vm.query.filter",function(e,t){T?s(function(){T=!1}):(t||(S=x.query.page),e!==t&&(x.query.page=1),e||(x.query.page=S),x.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","voiceQueues","api","msUtils","toasty"],angular.module("app.voice").controller("VoiceQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r){function l(){p.errors=[],r.voiceRecording.save(p.voiceRecording).$promise.then(function(e){p.voiceRecordings.unshift(e),i.success({title:"VoiceRecording properly created",msg:p.voiceRecording.name?p.voiceRecording.name+" has been created!":""}),u(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.save"}];for(var t=0;t"+(e.name||"voiceRecording")+" will be deleted.").ariaLabel("delete voiceRecording").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){v(e)},function(){console.log("CANCEL")})}function p(e){A.voiceRecordings=e||{count:0,rows:[]}}function g(){A.query.offset=(A.query.page-1)*A.query.limit,A.promise=l.voiceRecording.get(A.query,p).$promise}function h(e,t){i.show({controller:"CreateOrEditVoiceRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceRecordings/create/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceRecording:t,voiceRecordings:A.voiceRecordings.rows}})}function v(e){l.voiceRecording.delete({id:e.id}).$promise.then(function(){_.remove(A.voiceRecordings.rows,{id:e.id}),A.voiceRecordings.count-=1,A.voiceRecordings.rows.length||A.getVoiceRecordings(),c.success({title:"VoiceRecording deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){var e=_.clone(A.selectedVoiceRecordings);return A.selectedVoiceRecordings=[],e}function f(e){var t=i.confirm().title("Are you sure want to delete the selected voiceRecordings?").htmlContent(""+A.selectedVoiceRecordings.length+" selected will be deleted.").ariaLabel("delete VoiceRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){A.selectedVoiceRecordings.forEach(function(e){v(e)}),A.selectedVoiceRecordings=[]})}function E(){A.selectedVoiceRecordings=[]}function y(){A.selectedVoiceRecordings=A.voiceRecordings.rows}var A=this;A.voiceRecordings=r||{count:0,rows:[]},A.table="voiceRecordings",A.listOrder="",A.listOrderAsc=null,A.selectedVoiceRecordings=[],A.query={fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,createdAt",sort:"-updatedAt",limit:10,page:1},A.downloadfile=m,A.deleteconfirm=u,A.success=p,A.getVoiceRecordings=g,A.createOrEditVoiceRecording=h,A.deleteVoiceRecording=v,A.exportSelectedVoiceRecordings=b,A.deleteSelectedVoiceRecordings=f,A.deselectVoiceRecordings=E,A.selectAllVoiceRecordings=y;var C=!0,x=1;e.$watch("vm.query.filter",function(e,t){C?s(function(){C=!1}):(t||(x=A.query.page),e!==t&&(A.query.page=1),e||(A.query.page=x),A.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","voiceRecordings","api","msUtils","toasty"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i){function o(){return a.getCurrentUser()&&a.hasRole("agent")}this.isAgent=o,n.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return a.hasRole("agent")}}),n.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return a.hasRole("agent")||!a.hasPermission(100)&&!a.hasRole("admin")}}),n.saveItem("apps.dashboards.general",{id:101,title:"General",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(101)&&!a.hasRole("admin")}}),n.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return a.hasRole("agent")||!a.hasPermission(200)&&!a.hasRole("admin")}}),n.saveItem("apps.staff.users",{id:201,title:"Users",translate:"STAFF.USERS",state:"app.staff.users",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(201)&&!a.hasRole("admin")}}),n.saveItem("apps.staff.agents",{id:202,title:"Agents",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(202)&&!a.hasRole("admin")}}),n.saveItem("apps.staff.telephones",{id:203,title:"Telephones",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(203)&&!a.hasRole("admin")}}),n.saveItem("apps.staff.teams",{id:204,title:"Teams",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(204)&&!a.hasRole("admin")}}),n.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",weight:4,hidden:function(){return!i.cm||a.hasRole("agent")||!a.hasPermission(300)&&!a.hasRole("admin")}}),n.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return a.hasRole("agent")||!a.hasPermission(301)&&!a.hasRole("admin")}}),n.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return a.hasRole("agent")||!a.hasPermission(302)&&!a.hasRole("admin")}}),n.saveItem("apps.contactmanager.globalCustomFields",{id:304,title:"GlobalCustomFields",translate:"CONTACTMANAGER.GLOBALCUSTOMFIELDS",state:"app.contactmanager.globalCustomFields",weight:4,hidden:function(){return a.hasRole("agent")||!a.hasPermission(304)&&!a.hasRole("admin")}}),n.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(303)&&!a.hasRole("admin")}}),n.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",weight:5,hidden:function(){return a.hasRole("agent")||!a.hasPermission(400)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(401)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.inboundroutes",{id:402,title:"InboundRoutes",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundroutes",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(402)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.outboundroutes",{id:403,title:"OutboundRoutes",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundroutes",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(403)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.internalroutes",{id:404,title:"InternalRoutes",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalroutes",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(404)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.contexts",{id:405,title:"Contexts",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(405)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(406)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(407)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(408)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(409)&&!a.hasRole("admin")}}),n.saveItem("apps.voice.realtime",{id:410,title:"Realtime",translate:"VOICE.REALTIME",state:"app.voice.realtime",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(410)&&!a.hasRole("admin")}}),n.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",weight:6,hidden:function(){return!i.chat||a.hasRole("agent")||!a.hasPermission(500)&&!a.hasRole("admin")}}),n.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(501)&&!a.hasRole("admin")}}),n.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(502)&&!a.hasRole("admin")}}),n.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",weight:7,hidden:function(){return!i.license||a.hasRole("agent")||!a.hasPermission(600)&&!a.hasRole("admin")}}),n.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(601)&&!a.hasRole("admin")}}),n.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(602)&&!a.hasRole("admin")}}),n.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",weight:8,hidden:function(){return!i.messaging||a.hasRole("agent")||!a.hasPermission(700)&&!a.hasRole("admin")}}),n.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(701)&&!a.hasRole("admin")}}),n.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(702)&&!a.hasRole("admin")}}),n.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",weight:9,hidden:function(){return!i.openchannel||a.hasRole("agent")||!a.hasPermission(800)&&!a.hasRole("admin")}}),n.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(801)&&!a.hasRole("admin")}}),n.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(802)&&!a.hasRole("admin")}}),n.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",weight:10,hidden:function(){return!i.fax||a.hasRole("agent")||!a.hasPermission(900)&&!a.hasRole("admin")}}),n.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(901)&&!a.hasRole("admin")}}),n.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(902)&&!a.hasRole("admin")}}),n.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:11,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1e3)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.cannedAnswers",{id:1002,title:"CannedAnswers",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:2,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1002)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1003)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1004)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1005)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.schedules",{id:42,title:"Scheduler",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return a.hasRole("agent")||!a.hasPermission(42)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.sounds",{id:1006,title:"Sounds",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1006)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.tags",{id:1007,title:"Tags",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1007)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.templates",{id:1008,title:"Templates",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1008)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.triggers",{id:1009,title:"Triggers",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1009)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.trunks",{id:1010,title:"Trunks",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1010)&&!a.hasRole("admin")}}),n.saveItem("apps.tools.variables",{id:1011,title:"Variables",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1011)&&!a.hasRole("admin")}}),n.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",weight:12,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1100)&&!a.hasRole("admin")}}),n.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1101)&&!a.hasRole("admin")}}),n.saveItem("apps.callysquare.squareRecordings",{id:1102,title:"SquareRecordings",translate:"CALLYSQUARE.SQUARERECORDINGS",state:"app.callysquare.squareRecordings",weight:3,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1102)&&!a.hasRole("admin")}}),n.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1103)&&!a.hasRole("admin")}}),n.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:13,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1200)&&!a.hasRole("admin")}}),n.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1201)&&!a.hasRole("admin")}}),n.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",weight:2,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1202)&&!a.hasRole("admin")}}),n.saveItem("apps.analytics.reports",{id:1203,title:"Reports",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1203)&&!a.hasRole("admin")}}),n.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:14,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1300)&&!a.hasRole("admin")}}),n.saveItem("apps.integrations.zendeskAccounts",{id:1301,title:"ZendeskAccounts",translate:"INTEGRATIONS.ZENDESKACCOUNTS",state:"app.integrations.zendeskAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1301)&&!a.hasRole("admin")}}),n.saveItem("apps.integrations.salesforceAccounts",{id:1302,title:"SalesforceAccounts",translate:"INTEGRATIONS.SALESFORCEACCOUNTS",state:"app.integrations.salesforceAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1302)&&!a.hasRole("admin")}}),n.saveItem("apps.integrations.freshdeskAccounts",{id:1303,title:"FreshdeskAccounts",translate:"INTEGRATIONS.FRESHDESKACCOUNTS",state:"app.integrations.freshdeskAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1303)&&!a.hasRole("admin")}}),n.saveItem("apps.integrations.sugarcrmAccounts",{id:1304,title:"SugarcrmAccounts",translate:"INTEGRATIONS.SUGARCRMACCOUNTS",state:"app.integrations.sugarcrmAccounts",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1304)&&!a.hasRole("admin")}}),n.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",weight:15,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1400)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.generals",{id:1401,title:"General",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1401)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1402)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.networks",{id:1403,title:"Networks",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1403)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!i.custom||a.hasRole("agent")||!a.hasPermission(1407)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.updates",{id:1404,title:"Updates",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!i.update||a.hasRole("agent")||!a.hasPermission(1404)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.license",{id:1405,title:"License",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1405)&&!a.hasRole("admin")}}),n.saveItem("apps.settings.system",{id:1406,title:"System",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1406)&&!a.hasRole("admin")}}),n.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",weight:16,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1600)&&!a.hasRole("admin")}}),n.saveItem("apps.help.about",{id:1601,title:"About",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1601)&&!a.hasRole("admin")}}),n.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",weight:5,hidden:function(){return!i.dialer||a.hasRole("agent")||!a.hasPermission(1500)&&!a.hasRole("admin")}}),n.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1501)&&!a.hasRole("admin")}}),n.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1502)&&!a.hasRole("admin")}}),n.saveItem("apps.motiondialer.realtime",{id:1510,title:"Realtime",translate:"MOTIONDIALER.REALTIME",state:"app.motiondialer.realtime",weight:1,hidden:function(){return a.hasRole("agent")||!a.hasPermission(1510)&&!a.hasRole("admin")}}),e.$on("$viewContentAnimationEnded",function(n){n.targetScope.$id===e.$id&&t.$broadcast("msSplashScreen::remove")})}e.$inject=["$scope","$rootScope","msNavigationService","Auth","license"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,t){function n(){i.folded=!i.folded}function a(){return i.setting.defaultHeaderWhiteLabel?"Motion":i.setting.headerWhiteLabel}var i=this;i.bodyEl=angular.element("body"),i.folded=!1,i.msScrollOptions={suppressScrollX:!0},i.setting=t,i.toggleMsNavigationFolded=n,i.getLogo=a,e.$on("$stateChangeSuccess",function(){i.bodyEl.removeClass("ms-navigation-horizontal-mobile-menu-active")})}e.$inject=["$scope","setting"],angular.module("app.navigation").controller("NavigationController",e)}(),function(){"use strict";function e(e,t){var n=this;n.date=new Date,n.license=t,n.license.gray&&(n.license.deadline=moment(n.license.gray).add(7,"days").format("MMMM Do YYYY, HH:MM"))}e.$inject=["msApi","license"],angular.module("app.quick-panel").controller("QuickPanelController",e)}(),function(){"use strict";function e(e,t){function n(e){o.chatActive=!o.chatActive,o.chatActive&&(o.replyMessage="",o.chat.contact=e,i(0))}function a(){""!==o.replyMessage&&(o.chat.contact.dialog||(o.chat.contact.dialog=[]),o.chat.contact.dialog.push({who:"user",message:o.replyMessage,time:"Just now"}),o.replyMessage="",i(400))}function i(e){var n=angular.element("#chat-dialog");t(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}var o=this;o.chat={},o.chatActive=!1,o.replyMessage="",e.request("quickPanel.contacts@get",{},function(e){o.contacts=e.data}),o.toggleChat=n,o.reply=a}e.$inject=["msApi","$timeout"],angular.module("app.quick-panel").controller("ChatTabController",e)}(),function(){"use strict";function e(e,t,n,a){function i(){s.errors=[],n.user.changePassword({id:s.user.id},{oldPassword:s.oldPassword,newPassword:s.password}).$promise.then(function(){t.show(t.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),o()}).catch(function(e){console.error(e),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})}function o(){e.hide()}var s=this;s.errors=[],s.user=a,s.savePassword=i,s.closeDialog=o}e.$inject=["$mdDialog","$mdToast","api","user"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,n,a,i,o,s,r,l,d,c,m,u,p,g,h,v){function b(e){return h.cmHopper.getDialerContacts({limit:1}).$promise.then(function(t){if(t&&t.count){var n=t.rows[0],a=n.Contact,i=a.fullName||a.lastName||a.phone,o=a.phone,s=l.confirm().title("Preview Call").clickOutsideToClose(!0).textContent("Do you want to call the contact "+i+" ("+o+")?").ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");l.show(s).then(function(){return h.cmHopper.callDialerContact({id:n.id}).$promise.then(function(e){console.log("data",e)}).catch(function(e){console.error(e)})}).catch(function(e){return h.cmHopper.update({id:n.id,active:!1}).$promise.then(function(){m.success({title:"Contact rejected",msg:"Contact "+a.phone+" properly rejected"})}).catch(function(e){m.error({title:e.message,msg:e.message})})})}else m.info({title:"No available contacts",msg:"No contacts found"})}).catch(function(e){console.error(e)})}function f(e){i(e).toggle()}function E(e){I.userStatus=e}function y(e){return p.logout(e).then(function(){return g.disconnect(),n.go("app.login")}).catch(function(e){console.error(e)})}function A(e){if(I.languages.hasOwnProperty(e.code))I.selectedLanguage=e,c.put("motion.language",e.code),o.use(e.code),"app.callysquare.projects.edit"===n.current.name&&r.location.reload();else{s.show({template:'
Motion supports multiple translations through angular-translate module, but currently we do not support the selected language. If you want to help us, send us a message.
',hideDelay:7e3,position:"top right",parent:"#content"})}}function C(){I.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")}function x(){u.toggleFolded()}function T(e){for(var n=[],i=u.getFlatNavigation(),o=t.defer(),s=0;s-1)return!0})),a(function(){o.resolve(n)},1e3),o.promise}function S(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))}function O(e){l.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(d.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:I.user}})}function w(){return p.getCurrentUser()&&p.hasRole("agent")}function R(e){if(e.id===I.user.id)if(e.online)_.merge(I.user,e),p.updateCurrentUser(I.user);else{var t=l.confirm().title(o.instant("TOOLBAR.WARNING")+"!").textContent(o.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")).ariaLabel(o.instant("TOOLBAR.WARNING")+"!").ok(o.instant("TOOLBAR.STAY_LOGGED")).cancel("Logout");l.show(t).then(function(){p.queueLogin()}).catch(function(e){y(!0)}).finally(function(){_.merge(I.user,e),p.updateCurrentUser(I.user)})}}var I=this;e.global={search:""},I.license=v,I.bodyEl=angular.element("body"),I.userStatusOptions=[{title:"Online",icon:"icon-checkbox-marked-circle",color:"#4CAF50"},{title:"Away",icon:"icon-clock",color:"#FFC107"},{title:"Do not Disturb",icon:"icon-minus-circle",color:"#F44336"},{title:"Invisible",icon:"icon-checkbox-blank-circle-outline",color:"#BDBDBD"},{title:"Offline",icon:"icon-checkbox-blank-circle-outline",color:"#616161"}],I.languages={en:{title:"English",translation:"TOOLBAR.ENGLISH",code:"en",flag:"us"},it:{title:"Italian",translation:"TOOLBAR.ITALIAN",code:"it",flag:"it"},fr:{title:"French",translation:"TOOLBAR.FRENCH",code:"fr",flag:"fr"},ko:{title:"Korean",translation:"TOOLBAR.KOREAN",code:"ko",flag:"ko"},es:{title:"Spanish",translation:"TOOLBAR.SPANISH",code:"es",flag:"es"},sv:{title:"Swedish",translation:"TOOLBAR.SWEDISH",code:"sv",flag:"sv"},ru:{title:"Russian",translation:"TOOLBAR.RUSSIAN",code:"ru",flag:"ru"},de:{title:"German",translation:"TOOLBAR.GERMAN",code:"de",flag:"de"},ja:{title:"Japanese",translation:"TOOLBAR.JAPANESE",code:"ja",flag:"ja"},"zh-CN":{title:"ChineseSimplified",translation:"TOOLBAR.CHINESESIMPLIFIED",code:"zh-CN",flag:"zh-CN"},"zh-TW":{title:"ChineseTraditional",translation:"TOOLBAR.CHINESETRADITIONAL",code:"zh-TW",flag:"zh-TW"},nl:{title:"Dutch",translation:"TOOLBAR.DUTCH",code:"nl",flag:"nl"},fi:{title:"Finnish",translation:"TOOLBAR.FINNISH",code:"fi",flag:"fi"},da:{title:"Danish",translation:"TOOLBAR.DANISH",code:"da",flag:"da"},"pt-PT":{title:"Portuguese",translation:"TOOLBAR.PORTUGUESE",code:"pt-PT",flag:"pt-PT"},no:{title:"Norwegian",translation:"TOOLBAR.NORWEGIAN",code:"no",flag:"no"},hi:{title:"Hindi",translation:"TOOLBAR.HINDI",code:"hi",flag:"hi"},tr:{title:"Turkish",translation:"TOOLBAR.TURKISH",code:"tr",flag:"tr"},fa:{title:"Persian",translation:"TOOLBAR.PERSIAN",code:"fa",flag:"fa"}},I.toggleSidenav=f,I.logout=y,I.changeLanguage=A,I.setUserStatus=E,I.toggleHorizontalMobileMenu=C,I.toggleMsNavigationFolded=x,I.search=T,I.searchResultClick=S,I.changePassword=O,I.isAgent=w,I.onUserUpdate=R,I.preview=b,g.connect(),g.on("user:update",I.onUserUpdate),function(){I.user=p.getCurrentUser(),I.userStatus=I.userStatusOptions[0];var e=c.get("motion.language");e&&I.languages.hasOwnProperty(e)?I.selectedLanguage=I.languages[e]:I.selectedLanguage=I.languages[o.preferredLanguage()]}()}e.$inject=["$rootScope","$q","$state","$timeout","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license"],angular.module("app.toolbar").controller("ToolbarController",e)}();var urlParams=function(e){var t=new Object,n=e.lastIndexOf("?");if(n>0)for(var a=e.substring(n+1).split("&"),i=0;i0&&(t[a[i].substring(0,n)]=a[i].substring(n+1));return t}(window.location.href),t0=new Date,MAX_REQUEST_SIZE=10485760,MAX_WIDTH=12e3,MAX_HEIGHT=12e3,EXPORT_URL="http://exp.draw.io/ImageExport2/export",SHARE_HOST="http://localhost:3000",SAVE_URL="api/square/projects/",VARIABLE_URL="/api/variables",STENCIL_PATH="/assets/plugins/square/stencils",SHAPES_PATH="/assets/plugins/square/shapes",IMAGE_PATH="/assets/plugins/square/images",STYLE_PATH="/assets/plugins/square/styles",CSS_PATH="/assets/plugins/square/styles",OPEN_FORM="api/square/projects/open",TEMPLATE_PATH="/assets/plugins/square/templates",RESOURCES_PATH="/assets/plugins/square/resources",RESOURCE_BASE=RESOURCES_PATH+"/grapheditor",tapAndHoldStartsConnection=!0,showConnectorImg=!0,mxLoadResources=!1,mxLanguages=["it","fr","ko","es","sv","ru","de","ja","zh-CN","zh-TW","nl","fi","da","pt-PT","no","hi","tr","fa"],mxLanguage="en",match=document.cookie.match(new RegExp("(^| )motion.language=([^;]+)"));match&&mxLanguages.includes(match[2])&&(mxLanguage=match[2]);var mxBasePath="assets/plugins/mxgraph",mxClient={VERSION:"2.0.0.0",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>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:0document.location.href.indexOf("http://")&&0>document.location.href.indexOf("https://"),isBrowserSupported:function(){return mxClient.IS_VML||mxClient.IS_SVG},link:function(e,t,n){if(n=n||document,mxClient.IS_IE6)n.write('');else{var a=n.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",t),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),n.getElementsByTagName("head")[0].appendChild(a)}},include:function(e){document.write('