rushfee/WebContent/www/PhoneBar.min.js

1 line
97 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PhoneBar=t():e.PhoneBar=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=124)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var o,i=n(48),a=(o=i)&&o.__esModule?o:{default:o};t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),(0,a.default)(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}()},function(e,t,n){e.exports={default:n(67),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var o,i=n(49),a=(o=i)&&o.__esModule?o:{default:o};t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,a.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){"use strict";t.__esModule=!0;var o=s(n(91)),i=s(n(95)),a=s(n(49));function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,a.default)(t)));e.prototype=(0,i.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}},function(e,t,n){"use strict";var o=Object.prototype.hasOwnProperty,i="~";function a(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var r=new s(n,o||e,a),u=i?i+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],r]:e._events[u].push(r):(e._events[u]=r,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function l(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(i=!1)),l.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)o.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},l.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,a=n.length,s=new Array(a);o<a;o++)s[o]=n[o].fn;return s},l.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},l.prototype.emit=function(e,t,n,o,a,s){var r=i?i+e:e;if(!this._events[r])return!1;var u,l,c=this._events[r],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,o),!0;case 5:return c.fn.call(c.context,t,n,o,a),!0;case 6:return c.fn.call(c.context,t,n,o,a,s),!0}for(l=1,u=new Array(h-1);l<h;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var d,f=c.length;for(l=0;l<f;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,o);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];c[l].fn.apply(c[l].context,u)}}return!0},l.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,n,o){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return u(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||u(this,a);else{for(var r=0,l=[],c=s.length;r<c;r++)(s[r].fn!==t||o&&!s[r].once||n&&s[r].context!==n)&&l.push(s[r]);l.length?this._events[a]=1===l.length?l[0]:l:u(this,a)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&u(this,t)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,e.exports=l},function(e,t,n){"use strict";t.__esModule=!0;var o,i=n(48),a=(o=i)&&o.__esModule?o:{default:o};t.default=function(e,t,n){return t in e?(0,a.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){var n=e.exports={version:"2.6.9"};"number"==typeof __e&&(__e=n)},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var o=n(34)("wks"),i=n(27),a=n(8).Symbol,s="function"==typeof a;(e.exports=function(e){return o[e]||(o[e]=s&&a[e]||(s?a:i)("Symbol."+e))}).store=o},function(e,t,n){var o=n(8),i=n(7),a=n(22),s=n(18),r=n(17),u=function(e,t,n){var l,c,h,d=e&u.F,f=e&u.G,p=e&u.S,g=e&u.P,v=e&u.B,m=e&u.W,y=f?i:i[t]||(i[t]={}),C=y.prototype,N=f?o:p?o[t]:(o[t]||{}).prototype;for(l in f&&(n=t),n)(c=!d&&N&&void 0!==N[l])&&r(y,l)||(h=c?N[l]:n[l],y[l]=f&&"function"!=typeof N[l]?n[l]:v&&c?a(h,o):m&&N[l]==h?function(e){var t=function(t,n,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(h):g&&"function"==typeof h?a(Function.call,h):h,g&&((y.virtual||(y.virtual={}))[l]=h,e&u.R&&C&&!C[l]&&s(C,l,h)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var o=n(14);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports={default:n(102),__esModule:!0}},function(e,t,n){var o=n(11),i=n(47),a=n(37),s=Object.defineProperty;t.f=n(15)?Object.defineProperty:function(e,t,n){if(o(e),t=a(t,!0),o(n),i)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(23)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,n){"use strict";t.__esModule=!0;var o=a(n(2)),i=a(n(119));function a(e){return e&&e.__esModule?e:{default:e}}t.default=function e(t,n,a){null===t&&(t=Function.prototype);var s=(0,i.default)(t,n);if(void 0===s){var r=(0,o.default)(t);return null===r?void 0:e(r,n,a)}if("value"in s)return s.value;var u=s.get;return void 0!==u?u.call(a):void 0}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var o=n(13),i=n(29);e.exports=n(15)?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(76),i=n(32);e.exports=function(e){return o(i(e))}},function(e,t,n){e.exports={default:n(100),__esModule:!0}},function(e,t){e.exports=!0},function(e,t,n){var o=n(28);e.exports=function(e,t,n){if(o(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,o){return e.call(t,n,o)};case 3:return function(n,o,i){return e.call(t,n,o,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var o=n(32);e.exports=function(e){return Object(o(e))}},function(e,t){var n=0,o=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+o).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var o=n(53),i=n(40);e.exports=Object.keys||function(e){return o(e,i)}},function(e,t,n){var o=n(13).f,i=n(17),a=n(9)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&o(e,a,{configurable:!0,value:t})}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var o=n(34)("keys"),i=n(27);e.exports=function(e){return o[e]||(o[e]=i(e))}},function(e,t,n){var o=n(7),i=n(8),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:o.version,mode:n(21)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var o=n(10),i=n(7),a=n(23);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],s={};s[e]=t(n),o(o.S+o.F*a((function(){n(1)})),"Object",s)}},function(e,t,n){var o=n(14),i=n(8).document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var o=n(14);e.exports=function(e,t){if(!o(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!o(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!o(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!o(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:n)(e)}},function(e,t,n){var o=n(11),i=n(75),a=n(40),s=n(33)("IE_PROTO"),r=function(){},u=function(){var e,t=n(36)("iframe"),o=a.length;for(t.style.display="none",n(55).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;o--;)delete u.prototype[a[o]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(r.prototype=o(e),n=new r,r.prototype=null,n[s]=e):n=u(),void 0===t?n:i(n,t)}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){t.f=n(9)},function(e,t,n){var o=n(8),i=n(7),a=n(21),s=n(41),r=n(13).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=a?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||r(t,e,{value:s.f(e)})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var o=n(43),i=n(29),a=n(19),s=n(37),r=n(17),u=n(47),l=Object.getOwnPropertyDescriptor;t.f=n(15)?l:function(e,t){if(e=a(e),t=s(t,!0),u)try{return l(e,t)}catch(e){}if(r(e,t))return i(!o.f.call(e,t),e[t])}},function(e,t,n){"use strict";var o=n(28);function i(e){var t,n;this.promise=new e((function(e,o){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=o})),this.resolve=o(t),this.reject=o(n)}e.exports.f=function(e){return new i(e)}},function(e,t,n){var o=n(17),i=n(26),a=n(33)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),o(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,n){e.exports=!n(15)&&!n(23)((function(){return 7!=Object.defineProperty(n(36)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){e.exports={default:n(69),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var o=s(n(71)),i=s(n(82)),a="function"==typeof i.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":typeof e};function s(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof i.default&&"symbol"===a(o.default)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":void 0===e?"undefined":a(e)}},function(e,t,n){"use strict";var o=n(73)(!0);n(51)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=o(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){"use strict";var o=n(21),i=n(10),a=n(52),s=n(18),r=n(24),u=n(74),l=n(31),c=n(46),h=n(9)("iterator"),d=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,n,p,g,v,m){u(n,t,p);var y,C,N,b=function(e){if(!d&&e in E)return E[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},_=t+" Iterator",k="values"==g,I=!1,E=e.prototype,D=E[h]||E["@@iterator"]||g&&E[g],w=D||b(g),S=g?k?b("entries"):w:void 0,T="Array"==t&&E.entries||D;if(T&&(N=c(T.call(new e)))!==Object.prototype&&N.next&&(l(N,_,!0),o||"function"==typeof N[h]||s(N,h,f)),k&&D&&"values"!==D.name&&(I=!0,w=function(){return D.call(this)}),o&&!m||!d&&!I&&E[h]||s(E,h,w),r[t]=w,r[_]=f,g)if(y={values:k?w:b("values"),keys:v?w:b("keys"),entries:S},m)for(C in y)C in E||a(E,C,y[C]);else i(i.P+i.F*(d||I),t,y);return y}},function(e,t,n){e.exports=n(18)},function(e,t,n){var o=n(17),i=n(19),a=n(77)(!1),s=n(33)("IE_PROTO");e.exports=function(e,t){var n,r=i(e),u=0,l=[];for(n in r)n!=s&&o(r,n)&&l.push(n);for(;t.length>u;)o(r,n=t[u++])&&(~a(l,n)||l.push(n));return l}},function(e,t,n){var o=n(38),i=Math.min;e.exports=function(e){return e>0?i(o(e),9007199254740991):0}},function(e,t,n){var o=n(8).document;e.exports=o&&o.documentElement},function(e,t,n){n(79);for(var o=n(8),i=n(18),a=n(24),s=n(9)("toStringTag"),r="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<r.length;u++){var l=r[u],c=o[l],h=c&&c.prototype;h&&!h[s]&&i(h,s,l),a[l]=a.Array}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var o=n(53),i=n(40).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return o(e,i)}},function(e,t){},function(e,t,n){var o=n(25),i=n(9)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(s=o(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){var o=n(11),i=n(28),a=n(9)("species");e.exports=function(e,t){var n,s=o(e).constructor;return void 0===s||null==(n=o(s)[a])?t:i(n)}},function(e,t,n){var o,i,a,s=n(22),r=n(110),u=n(55),l=n(36),c=n(8),h=c.process,d=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,g=c.Dispatch,v=0,m={},y=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},C=function(e){y.call(e.data)};d&&f||(d=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return m[++v]=function(){r("function"==typeof e?e:Function(e),t)},o(v),v},f=function(e){delete m[e]},"process"==n(25)(h)?o=function(e){h.nextTick(s(y,e,1))}:g&&g.now?o=function(e){g.now(s(y,e,1))}:p?(a=(i=new p).port2,i.port1.onmessage=C,o=s(a.postMessage,a,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(o=function(e){c.postMessage(e+"","*")},c.addEventListener("message",C,!1)):o="onreadystatechange"in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),y.call(e)}}:function(e){setTimeout(s(y,e,1),0)}),e.exports={set:d,clear:f}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var o=n(11),i=n(14),a=n(45);e.exports=function(e,t){if(o(e),i(t)&&t.constructor===e)return t;var n=a.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){e.exports={default:n(103),__esModule:!0}},function(e,t,n){var o,i,a;i=[],void 0===(a="function"==typeof(o=function(){if("WebSocket"in window)return e.prototype.onopen=function(e){},e.prototype.onclose=function(e){},e.prototype.onconnecting=function(e){},e.prototype.onmessage=function(e){},e.prototype.onerror=function(e){},e.debugAll=!1,e.CONNECTING=WebSocket.CONNECTING,e.OPEN=WebSocket.OPEN,e.CLOSING=WebSocket.CLOSING,e.CLOSED=WebSocket.CLOSED,e;function e(t,n,o){var i={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3,maxReconnectAttempts:null,binaryType:"blob"};for(var a in o||(o={}),i)void 0!==o[a]?this[a]=o[a]:this[a]=i[a];this.url=t,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var s,r=this,u=!1,l=!1,c=document.createElement("div");function h(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}c.addEventListener("open",(function(e){r.onopen(e)})),c.addEventListener("close",(function(e){r.onclose(e)})),c.addEventListener("connecting",(function(e){r.onconnecting(e)})),c.addEventListener("message",(function(e){r.onmessage(e)})),c.addEventListener("error",(function(e){r.onerror(e)})),this.addEventListener=c.addEventListener.bind(c),this.removeEventListener=c.removeEventListener.bind(c),this.dispatchEvent=c.dispatchEvent.bind(c),this.open=function(t){if((s=new WebSocket(r.url,n||[])).binaryType=this.binaryType,t){if(this.maxReconnectAttempts&&this.reconnectAttempts>this.maxReconnectAttempts)return}else c.dispatchEvent(h("connecting")),this.reconnectAttempts=0;(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",r.url);var o=s,i=setTimeout((function(){(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",r.url),l=!0,o.close(),l=!1}),r.timeoutInterval);s.onopen=function(n){clearTimeout(i),(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onopen",r.url),r.protocol=s.protocol,r.readyState=WebSocket.OPEN,r.reconnectAttempts=0;var o=h("open");o.isReconnect=t,t=!1,c.dispatchEvent(o)},s.onclose=function(n){if(clearTimeout(i),s=null,u)r.readyState=WebSocket.CLOSED,c.dispatchEvent(h("close"));else{r.readyState=WebSocket.CONNECTING;var o=h("connecting");o.code=n.code,o.reason=n.reason,o.wasClean=n.wasClean,c.dispatchEvent(o),t||l||((r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onclose",r.url),c.dispatchEvent(h("close")));var i=r.reconnectInterval*Math.pow(r.reconnectDecay,r.reconnectAttempts);setTimeout((function(){r.reconnectAttempts++,r.open(!0)}),i>r.maxReconnectInterval?r.maxReconnectInterval:i)}},s.onmessage=function(t){(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",r.url,t.data);var n=h("message");n.data=t.data,c.dispatchEvent(n)},s.onerror=function(t){(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onerror",r.url,t),c.dispatchEvent(h("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(t){if(s)return(r.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","send",r.url,t),s.send(t);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(e,t){void 0===e&&(e=1e3),u=!0,s&&s.close(e,t)},this.refresh=function(){s&&s.close()}}})?o.apply(t,i):o)||(e.exports=a)},function(e,t,n){n(68),e.exports=n(7).Object.getPrototypeOf},function(e,t,n){var o=n(26),i=n(46);n(35)("getPrototypeOf",(function(){return function(e){return i(o(e))}}))},function(e,t,n){n(70);var o=n(7).Object;e.exports=function(e,t,n){return o.defineProperty(e,t,n)}},function(e,t,n){var o=n(10);o(o.S+o.F*!n(15),"Object",{defineProperty:n(13).f})},function(e,t,n){e.exports={default:n(72),__esModule:!0}},function(e,t,n){n(50),n(56),e.exports=n(41).f("iterator")},function(e,t,n){var o=n(38),i=n(32);e.exports=function(e){return function(t,n){var a,s,r=String(i(t)),u=o(n),l=r.length;return u<0||u>=l?e?"":void 0:(a=r.charCodeAt(u))<55296||a>56319||u+1===l||(s=r.charCodeAt(u+1))<56320||s>57343?e?r.charAt(u):a:e?r.slice(u,u+2):s-56320+(a-55296<<10)+65536}}},function(e,t,n){"use strict";var o=n(39),i=n(29),a=n(31),s={};n(18)(s,n(9)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=o(s,{next:i(1,n)}),a(e,t+" Iterator")}},function(e,t,n){var o=n(13),i=n(11),a=n(30);e.exports=n(15)?Object.defineProperties:function(e,t){i(e);for(var n,s=a(t),r=s.length,u=0;r>u;)o.f(e,n=s[u++],t[n]);return e}},function(e,t,n){var o=n(25);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==o(e)?e.split(""):Object(e)}},function(e,t,n){var o=n(19),i=n(54),a=n(78);e.exports=function(e){return function(t,n,s){var r,u=o(t),l=i(u.length),c=a(s,l);if(e&&n!=n){for(;l>c;)if((r=u[c++])!=r)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var o=n(38),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=o(e))<0?i(e+t,0):a(e,t)}},function(e,t,n){"use strict";var o=n(80),i=n(81),a=n(24),s=n(19);e.exports=n(51)(Array,"Array",(function(e,t){this._t=s(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),a.Arguments=a.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){n(84),n(59),n(89),n(90),e.exports=n(7).Symbol},function(e,t,n){"use strict";var o=n(8),i=n(17),a=n(15),s=n(10),r=n(52),u=n(85).KEY,l=n(23),c=n(34),h=n(31),d=n(27),f=n(9),p=n(41),g=n(42),v=n(86),m=n(87),y=n(11),C=n(14),N=n(26),b=n(19),_=n(37),k=n(29),I=n(39),E=n(88),D=n(44),w=n(57),S=n(13),T=n(30),L=D.f,B=S.f,A=E.f,x=o.Symbol,P=o.JSON,M=P&&P.stringify,O=f("_hidden"),R=f("toPrimitive"),W={}.propertyIsEnumerable,j=c("symbol-registry"),U=c("symbols"),F=c("op-symbols"),G=Object.prototype,H="function"==typeof x&&!!w.f,K=o.QObject,q=!K||!K.prototype||!K.prototype.findChild,Y=a&&l((function(){return 7!=I(B({},"a",{get:function(){return B(this,"a",{value:7}).a}})).a}))?function(e,t,n){var o=L(G,t);o&&delete G[t],B(e,t,n),o&&e!==G&&B(G,t,o)}:B,Q=function(e){var t=U[e]=I(x.prototype);return t._k=e,t},X=H&&"symbol"==typeof x.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof x},V=function(e,t,n){return e===G&&V(F,t,n),y(e),t=_(t,!0),y(n),i(U,t)?(n.enumerable?(i(e,O)&&e[O][t]&&(e[O][t]=!1),n=I(n,{enumerable:k(0,!1)})):(i(e,O)||B(e,O,k(1,{})),e[O][t]=!0),Y(e,t,n)):B(e,t,n)},J=function(e,t){y(e);for(var n,o=v(t=b(t)),i=0,a=o.length;a>i;)V(e,n=o[i++],t[n]);return e},z=function(e){var t=W.call(this,e=_(e,!0));return!(this===G&&i(U,e)&&!i(F,e))&&(!(t||!i(this,e)||!i(U,e)||i(this,O)&&this[O][e])||t)},$=function(e,t){if(e=b(e),t=_(t,!0),e!==G||!i(U,t)||i(F,t)){var n=L(e,t);return!n||!i(U,t)||i(e,O)&&e[O][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=A(b(e)),o=[],a=0;n.length>a;)i(U,t=n[a++])||t==O||t==u||o.push(t);return o},ee=function(e){for(var t,n=e===G,o=A(n?F:b(e)),a=[],s=0;o.length>s;)!i(U,t=o[s++])||n&&!i(G,t)||a.push(U[t]);return a};H||(r((x=function(){if(this instanceof x)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===G&&t.call(F,n),i(this,O)&&i(this[O],e)&&(this[O][e]=!1),Y(this,e,k(1,n))};return a&&q&&Y(G,e,{configurable:!0,set:t}),Q(e)}).prototype,"toString",(function(){return this._k})),D.f=$,S.f=V,n(58).f=E.f=Z,n(43).f=z,w.f=ee,a&&!n(21)&&r(G,"propertyIsEnumerable",z,!0),p.f=function(e){return Q(f(e))}),s(s.G+s.W+s.F*!H,{Symbol:x});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)f(te[ne++]);for(var oe=T(f.store),ie=0;oe.length>ie;)g(oe[ie++]);s(s.S+s.F*!H,"Symbol",{for:function(e){return i(j,e+="")?j[e]:j[e]=x(e)},keyFor:function(e){if(!X(e))throw TypeError(e+" is not a symbol!");for(var t in j)if(j[t]===e)return t},useSetter:function(){q=!0},useSimple:function(){q=!1}}),s(s.S+s.F*!H,"Object",{create:function(e,t){return void 0===t?I(e):J(I(e),t)},defineProperty:V,defineProperties:J,getOwnPropertyDescriptor:$,getOwnPropertyNames:Z,getOwnPropertySymbols:ee});var ae=l((function(){w.f(1)}));s(s.S+s.F*ae,"Object",{getOwnPropertySymbols:function(e){return w.f(N(e))}}),P&&s(s.S+s.F*(!H||l((function(){var e=x();return"[null]"!=M([e])||"{}"!=M({a:e})||"{}"!=M(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(n=t=o[1],(C(t)||void 0!==e)&&!X(e))return m(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!X(t))return t}),o[1]=t,M.apply(P,o)}}),x.prototype[R]||n(18)(x.prototype,R,x.prototype.valueOf),h(x,"Symbol"),h(Math,"Math",!0),h(o.JSON,"JSON",!0)},function(e,t,n){var o=n(27)("meta"),i=n(14),a=n(17),s=n(13).f,r=0,u=Object.isExtensible||function(){return!0},l=!n(23)((function(){return u(Object.preventExtensions({}))})),c=function(e){s(e,o,{value:{i:"O"+ ++r,w:{}}})},h=e.exports={KEY:o,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,o)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[o].i},getWeak:function(e,t){if(!a(e,o)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[o].w},onFreeze:function(e){return l&&h.NEED&&u(e)&&!a(e,o)&&c(e),e}}},function(e,t,n){var o=n(30),i=n(57),a=n(43);e.exports=function(e){var t=o(e),n=i.f;if(n)for(var s,r=n(e),u=a.f,l=0;r.length>l;)u.call(e,s=r[l++])&&t.push(s);return t}},function(e,t,n){var o=n(25);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,n){var o=n(19),i=n(58).f,a={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==a.call(e)?function(e){try{return i(e)}catch(e){return s.slice()}}(e):i(o(e))}},function(e,t,n){n(42)("asyncIterator")},function(e,t,n){n(42)("observable")},function(e,t,n){e.exports={default:n(92),__esModule:!0}},function(e,t,n){n(93),e.exports=n(7).Object.setPrototypeOf},function(e,t,n){var o=n(10);o(o.S,"Object",{setPrototypeOf:n(94).set})},function(e,t,n){var o=n(14),i=n(11),a=function(e,t){if(i(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{(o=n(22)(Function.call,n(44).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:o(e,n),e}}({},!1):void 0),check:a}},function(e,t,n){e.exports={default:n(96),__esModule:!0}},function(e,t,n){n(97);var o=n(7).Object;e.exports=function(e,t){return o.create(e,t)}},function(e,t,n){var o=n(10);o(o.S,"Object",{create:n(39)})},function(e,t,n){},function(e,t){"classList"in document.documentElement||Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){var e=this;function t(t){return function(n){var o=e.className.split(/\s+/g),i=o.indexOf(n);t(o,i,n),e.className=o.join(" ")}}return{add:t((function(e,t,n){~t||e.push(n)})),remove:t((function(e,t){~t&&e.splice(t,1)})),toggle:t((function(e,t,n){~t?e.splice(t,1):e.push(n)})),contains:function(t){return!!~e.className.split(/\s+/g).indexOf(t)},item:function(t){return e.className.split(/\s+/g)[t]||null}}}})},function(e,t,n){n(101),e.exports=n(7).Object.keys},function(e,t,n){var o=n(26),i=n(30);n(35)("keys",(function(){return function(e){return i(o(e))}}))},function(e,t,n){var o=n(7),i=o.JSON||(o.JSON={stringify:JSON.stringify});e.exports=function(e){return i.stringify.apply(i,arguments)}},function(e,t,n){n(59),n(50),n(56),n(104),n(116),n(117),e.exports=n(7).Promise},function(e,t,n){"use strict";var o,i,a,s,r=n(21),u=n(8),l=n(22),c=n(60),h=n(10),d=n(14),f=n(28),p=n(105),g=n(106),v=n(61),m=n(62).set,y=n(111)(),C=n(45),N=n(63),b=n(112),_=n(64),k=u.TypeError,I=u.process,E=I&&I.versions,D=E&&E.v8||"",w=u.Promise,S="process"==c(I),T=function(){},L=i=C.f,B=!!function(){try{var e=w.resolve(1),t=(e.constructor={})[n(9)("species")]=function(e){e(T,T)};return(S||"function"==typeof PromiseRejectionEvent)&&e.then(T)instanceof t&&0!==D.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(e){}}(),A=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},x=function(e,t){if(!e._n){e._n=!0;var n=e._c;y((function(){for(var o=e._v,i=1==e._s,a=0,s=function(t){var n,a,s,r=i?t.ok:t.fail,u=t.resolve,l=t.reject,c=t.domain;try{r?(i||(2==e._h&&O(e),e._h=1),!0===r?n=o:(c&&c.enter(),n=r(o),c&&(c.exit(),s=!0)),n===t.promise?l(k("Promise-chain cycle")):(a=A(n))?a.call(n,u,l):u(n)):l(o)}catch(e){c&&!s&&c.exit(),l(e)}};n.length>a;)s(n[a++]);e._c=[],e._n=!1,t&&!e._h&&P(e)}))}},P=function(e){m.call(u,(function(){var t,n,o,i=e._v,a=M(e);if(a&&(t=N((function(){S?I.emit("unhandledRejection",i,e):(n=u.onunhandledrejection)?n({promise:e,reason:i}):(o=u.console)&&o.error&&o.error("Unhandled promise rejection",i)})),e._h=S||M(e)?2:1),e._a=void 0,a&&t.e)throw t.v}))},M=function(e){return 1!==e._h&&0===(e._a||e._c).length},O=function(e){m.call(u,(function(){var t;S?I.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})}))},R=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),x(t,!0))},W=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw k("Promise can't be resolved itself");(t=A(e))?y((function(){var o={_w:n,_d:!1};try{t.call(e,l(W,o,1),l(R,o,1))}catch(e){R.call(o,e)}})):(n._v=e,n._s=1,x(n,!1))}catch(e){R.call({_w:n,_d:!1},e)}}};B||(w=function(e){p(this,w,"Promise","_h"),f(e),o.call(this);try{e(l(W,this,1),l(R,this,1))}catch(e){R.call(this,e)}},(o=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(113)(w.prototype,{then:function(e,t){var n=L(v(this,w));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=S?I.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&x(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new o;this.promise=e,this.resolve=l(W,e,1),this.reject=l(R,e,1)},C.f=L=function(e){return e===w||e===s?new a(e):i(e)}),h(h.G+h.W+h.F*!B,{Promise:w}),n(31)(w,"Promise"),n(114)("Promise"),s=n(7).Promise,h(h.S+h.F*!B,"Promise",{reject:function(e){var t=L(this);return(0,t.reject)(e),t.promise}}),h(h.S+h.F*(r||!B),"Promise",{resolve:function(e){return _(r&&this===s?w:this,e)}}),h(h.S+h.F*!(B&&n(115)((function(e){w.all(e).catch(T)}))),"Promise",{all:function(e){var t=this,n=L(t),o=n.resolve,i=n.reject,a=N((function(){var n=[],a=0,s=1;g(e,!1,(function(e){var r=a++,u=!1;n.push(void 0),s++,t.resolve(e).then((function(e){u||(u=!0,n[r]=e,--s||o(n))}),i)})),--s||o(n)}));return a.e&&i(a.v),n.promise},race:function(e){var t=this,n=L(t),o=n.reject,i=N((function(){g(e,!1,(function(e){t.resolve(e).then(n.resolve,o)}))}));return i.e&&o(i.v),n.promise}})},function(e,t){e.exports=function(e,t,n,o){if(!(e instanceof t)||void 0!==o&&o in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var o=n(22),i=n(107),a=n(108),s=n(11),r=n(54),u=n(109),l={},c={};(t=e.exports=function(e,t,n,h,d){var f,p,g,v,m=d?function(){return e}:u(e),y=o(n,h,t?2:1),C=0;if("function"!=typeof m)throw TypeError(e+" is not iterable!");if(a(m)){for(f=r(e.length);f>C;C++)if((v=t?y(s(p=e[C])[0],p[1]):y(e[C]))===l||v===c)return v}else for(g=m.call(e);!(p=g.next()).done;)if((v=i(g,y,p.value,t))===l||v===c)return v}).BREAK=l,t.RETURN=c},function(e,t,n){var o=n(11);e.exports=function(e,t,n,i){try{return i?t(o(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&o(a.call(e)),t}}},function(e,t,n){var o=n(24),i=n(9)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var o=n(60),i=n(9)("iterator"),a=n(24);e.exports=n(7).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||a[o(e)]}},function(e,t){e.exports=function(e,t,n){var o=void 0===n;switch(t.length){case 0:return o?e():e.call(n);case 1:return o?e(t[0]):e.call(n,t[0]);case 2:return o?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return o?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return o?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var o=n(8),i=n(62).set,a=o.MutationObserver||o.WebKitMutationObserver,s=o.process,r=o.Promise,u="process"==n(25)(s);e.exports=function(){var e,t,n,l=function(){var o,i;for(u&&(o=s.domain)&&o.exit();e;){i=e.fn,e=e.next;try{i()}catch(o){throw e?n():t=void 0,o}}t=void 0,o&&o.enter()};if(u)n=function(){s.nextTick(l)};else if(!a||o.navigator&&o.navigator.standalone)if(r&&r.resolve){var c=r.resolve(void 0);n=function(){c.then(l)}}else n=function(){i.call(o,l)};else{var h=!0,d=document.createTextNode("");new a(l).observe(d,{characterData:!0}),n=function(){d.data=h=!h}}return function(o){var i={fn:o,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var o=n(8).navigator;e.exports=o&&o.userAgent||""},function(e,t,n){var o=n(18);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:o(e,i,t[i]);return e}},function(e,t,n){"use strict";var o=n(8),i=n(7),a=n(13),s=n(15),r=n(9)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:o[e];s&&t&&!t[r]&&a.f(t,r,{configurable:!0,get:function(){return this}})}},function(e,t,n){var o=n(9)("iterator"),i=!1;try{var a=[7][o]();a.return=function(){i=!0},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],s=a[o]();s.next=function(){return{done:n=!0}},a[o]=function(){return s},e(a)}catch(e){}return n}},function(e,t,n){"use strict";var o=n(10),i=n(7),a=n(8),s=n(61),r=n(64);o(o.P+o.R,"Promise",{finally:function(e){var t=s(this,i.Promise||a.Promise),n="function"==typeof e;return this.then(n?function(n){return r(t,e()).then((function(){return n}))}:e,n?function(n){return r(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){"use strict";var o=n(10),i=n(45),a=n(63);o(o.S,"Promise",{try:function(e){var t=i.f(this),n=a(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){},function(e,t,n){e.exports={default:n(120),__esModule:!0}},function(e,t,n){n(121);var o=n(7).Object;e.exports=function(e,t){return o.getOwnPropertyDescriptor(e,t)}},function(e,t,n){var o=n(19),i=n(44).f;n(35)("getOwnPropertyDescriptor",(function(){return function(e,t){return i(o(e),t)}}))},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o,i=n(2),a=n.n(i),s=n(0),r=n.n(s),u=n(1),l=n.n(u),c=n(3),h=n.n(c),d=n(4),f=n.n(d),p=(n(98),n(99),n(5)),g=n.n(p),v=n(6),m=n.n(v),y=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;r()(this,t);var n=h()(this,(t.__proto__||a()(t)).call(this));return n.seconds=e,n.startTime=(new Date).getTime()-1e3*e,n.unexecutedTimeouts=[],n}return f()(t,e),l()(t,[{key:"start",value:function(){var e=this;this.seconds++,this._clearUnexecutedTimeouts();var t=(new Date).getTime()-(this.startTime+1e3*this.seconds),n=1e3>t?1e3-t:0;return this.unexecutedTimeouts.push(setTimeout((function(){e.start()}),n)),setTimeout((function(){e.emit("change",e.seconds,e.format())})),this}},{key:"stop",value:function(){return this._clearUnexecutedTimeouts(),this.seconds=0,this}},{key:"restart",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.stop(),this.seconds=e,this.startTime=(new Date).getTime()-1e3*e,this.start()}},{key:"_clearUnexecutedTimeouts",value:function(){this.unexecutedTimeouts.forEach((function(e){clearTimeout(e)})),this.unexecutedTimeouts=[]}},{key:"format",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[":",":",""],t=this.seconds,n=0,o=0;t>60&&(n=Math.floor(t/60),t=Math.floor(t%60),n>60&&(o=Math.floor(n/60),n=Math.floor(n%60)));var i="";return o>0&&(i+=(o<10?"0":"")+o+e[0]),i+=(n<10?"0":"")+n+e[1],i+=(t<10?"0":"")+t+e[2]}}]),t}(g.a),C=n(20),N=n.n(C),b={showMessage:function(e){alert(e)},checkPhoneNumber:function(e){if(null==e||0===e.length)return!1;if(0===(e=this.trim(e)).indexOf("ivr_"))return!0;for(var t=0;t<e.length;t++){var n=e.charAt(t);if(-1==="*#0123456789".indexOf(n))return this.showMessage("输入的电话号码不符合规范,请检查是否含有空格或者其他非数字字符."),!1}return!0},parseParam:function(e){var t=[];return e&&N()(e).forEach((function(n){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))})),t.join("&")},isFunction:function(e){return"function"==typeof e},firstUpperCase:function(e){return e.replace(/( |^)[a-z]/g,(function(e){return e.toUpperCase()}))},trim:function(e){return e.replace(/(^\s*)|(\s*$)/g,"")}},_=0,k=1,I=2,E={UNKNOWN:0,INTERNAL:1,INBOUND:2,OUTBOUND:3,CONSULT:4,THREEWAY:5,ORDERCALLBACK:6,MANUALCALLBACK:7,PREDICT:8,PREVIEW:9,WEBCALL:10,MONITOR:11};E.dict=(o={},m()(o,E.UNKNOWN,"未知类型"),m()(o,E.INTERNAL,"内部通话"),m()(o,E.INBOUND,"客户呼入"),m()(o,E.OUTBOUND,"手动呼出"),m()(o,E.CONSULT,"电话转接"),m()(o,E.THREEWAY,"多方通话"),m()(o,E.ORDERCALLBACK,"预约回呼"),m()(o,E.MANUALCALLBACK,"电话回访"),m()(o,E.PREDICT,"预测外呼"),m()(o,E.PREVIEW,"精确预览"),m()(o,E.WEBCALL,"网页电话"),m()(o,E.MONITOR,"电话监听"),o);var D,w={RequestAgentLogin:100,RequestAgentReady:101,RequestAgentNotReady:102,RequestAgentLogout:103,RequestMakeCall:200,RequestAnswerCall:201,RequestReleaseCall:203,RequestHoldCall:204,RequestRedirectCall:212,RequestClearCall:213,RequestSingleStepConference:214,RequestSingleStepTransfer:215,RequestDeleteFromConference:216,RequestRetrieveCall:217,RequestInitiateConference:220,RequestInitiateTransfer:221,RequestCompleteConference:222,RequestCompleteTransfer:223,RequestTransferToIVR:224,RequestSendDtmf:250,RequestAttachUserData:230,RequestDeleteUserData:231,RequestUpdateUserData:232,RequestRegisterAddress:261,RequestUnregisterAddress:263,RequestMonitorCall:265,RequestQueryAgentStatus:266,RequestQueueState:270,RequestSysSettingsUpdate:300,RequestRecordList:3001,RequestMonitorAgentList:3201,EventWelcome:2,EventPong:3,EventAgentLogin:580,EventAgentLogout:581,EventAgentNotReady:582,EventAgentReady:583,EventQueued:501,EventRinging:503,EventAbandoned:504,EventDialing:505,EventEstablished:506,EventAttachedDataChanged:507,EventDtmfSent:508,EventHeld:509,EventPartyAdded:510,EventPartyChanged:511,EventPartyDeleted:512,EventRetrieved:513,EventReleased:515,EventThreeWayEstablished:519,EventThreeWayReleased:518,EventOcbNumberInfo:521,EventPartyInfo:520,EventSysSettingsUpdate:526,EventAgentInfo:588,EventRegistered:572,EventUnregistered:574,EventLinkConnected:590,EventLinkDisconnected:4500,EventReportInfo:2500,EventCampaignLoaded:1500,EventCampaignUnloaded:1501,EventDialingStarted:1502,EventDialingStopped:1503,EventUpdateTenantIP:1504,EventCampaignRatio:1507,EventOutboundInfo:1509,EventCampaignLoadByFileName:1510,EventRetrieveCampaign:1511,EventCallLoss:1512,EventCallLossDownCSV:1513,EventCampaignContactDownCSV:1514,EventCampaignLoadByCId:1515,EventDownRecord:3501,EventRecordList:3502,EventTransferMenuList:3101,EventConferenceMenuList:3102,EventMonitorAgentList:3202,EventError:9999},S=4,T={IDLE:"idle",DIALING:"dialing",RINGING:"ringing",TALKING:"talking",HELD:"held"},L={REGISTERED:1,UNREGISTERED:2},B=-1,A=0,x=1,P=3,M=5,O=6,R=function(e){function t(e){var n=e.tid,o=void 0===n?"":n,i=e.thisDN,s=void 0===i?"":i,u=e.pstnDN,l=void 0===u?null:u,c=e.agentID,d=void 0===c?"":c,f=e.thisQueues,p=void 0===f?[]:f,g=e.defaultQueue,v=void 0===g?"":g;r()(this,t);var m=h()(this,(t.__proto__||a()(t)).call(this));return m._tid=o,m._thisDN=s,m._pstnDN=l,m._agentID=d,m._thisQueues=p,m._defaultQueue=v,m._state=t.OFFLINE,m._deviceState=L.REGISTERED,m.stateTimer=(new y).start(),m}return f()(t,e),l()(t,[{key:"setAgentState",value:function(e){if(this._state!==e){var t=this._state;this._state=e,this.stateTimer.restart(),this.emit("agentStateChange",e,t)}}},{key:"setDeviceState",value:function(e){e===L.UNREGISTERED?b.showMessage("请登陆SIP话机并刷新坐席状态"):this._deviceState!==e&&e===L.REGISTERED&&b.showMessage("SIP话机注册成功"),this._deviceState!==e&&(this._deviceState=e,this.emit("deviceStateChange",e))}},{key:"getCurrentStateName",value:function(){return t.getStateName(this._state)}},{key:"tid",get:function(){return this._tid}},{key:"thisDN",get:function(){return this._thisDN}},{key:"pstnDN",get:function(){return this._pstnDN}},{key:"agentID",get:function(){return this._agentID}},{key:"thisQueues",get:function(){return this._thisQueues}},{key:"defaultQueue",get:function(){return this._defaultQueue}},{key:"state",get:function(){return this._state}},{key:"deviceState",get:function(){return this._deviceState}}],[{key:"getStateName",value:function(e){return t.stateDict[e]?t.stateDict[e].name:""}},{key:"convertToLocalState",value:function(e,n){var o=t.OFFLINE;if(e===I)switch(n){case 0:o=t.NEATENING;break;case 1:o=t.TALKING;break;case 3:o=t.BUSY;break;case 5:o=t.RESTING;break;case 6:o=t.RINGING;break;default:o=t.BUSY}else e===k?o=t.READY:e===_&&(o=t.OFFLINE);return o}},{key:"convertToRawState",value:function(e){return t.stateDict[e]||null}}]),t}(g.a);R.OFFLINE="offline",R.READY="ready",R.BUSY="busy",R.RESTING="resting",R.NEATENING="neatening",R.TALKING="talking",R.RINGING="ringing",R.stateDict=(D={},m()(D,R.OFFLINE,{name:"离线",rawState:_,reason:B}),m()(D,R.READY,{name:"就绪",rawState:k,reason:B}),m()(D,R.BUSY,{name:"示忙",rawState:I,reason:P}),m()(D,R.RESTING,{name:"休息中",rawState:I,reason:M}),m()(D,R.NEATENING,{name:"整理中",rawState:I,reason:A}),m()(D,R.TALKING,{name:"通话中",rawState:I,reason:x}),m()(D,R.RINGING,{name:"振铃中",rawState:I,reason:O}),D);var W=R,j=n(12),U=n.n(j),F=n(65),G=n.n(F);var H={send:function(e){var t=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;for(var e=["Microsoft.XMLHTTP","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],t=0,n=e.length;t<n;t++)try{return new ActiveXObject(e[t])}catch(e){}}(),n={type:e.type||"get",url:e.url||"",async:e.async||!0,dataType:e.dataType||"json",data:b.parseParam(e.data)||""};return new G.a((function(e,o){t.open(n.type,n.url,n.async),t.onreadystatechange=function(){if(4===t.readyState)if(200===t.status){t.getResponseHeader("Content-Type");if("json"===n.dataType){var i=JSON.parse(t.responseText);e(i)}}else o(new Error(t.status||"Server is fail."))},t.onerror=function(){o(new Error(t.status||"Server is fail."))},t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.send(n.data)}))}},K=function(){function e(t){var n=t.agent,o=t.agentConfig,i=t.linePool,a=t.connection;r()(this,e),this.agent=n,this.agentConfig=o,this.linePool=i,this.connection=a}return l()(e,[{key:"unsubscribe",value:function(){var e={messageId:263,thisDN:this.agent.thisDN};this.connection.send(e)}},{key:"agentLogin",value:function(){if(!this.agentConfig.isPhoneTakeAlong){var e={messageId:100,thisDN:this.agent.thisDN,agentID:this.agent.agentID,thisQueues:this.agent.thisQueues};this.connection.send(e)}}},{key:"agentLogout",value:function(){if(!this.agentConfig.isPhoneTakeAlong){var e={messageId:103,thisDN:this.agent.thisDN,agentID:this.agent.agentID};this.connection.send(e)}}},{key:"agentNotReady",value:function(e){if(!this.agentConfig.isPhoneTakeAlong&&1!==e&&6!==e)if(this.agent.state!==W.OFFLINE){var t={messageId:102,thisDN:this.agent.thisDN,agentID:this.agent.agentID,reasonCode:e};this.connection.send(t)}else b.showMessage("未登入,不能切换状态")}},{key:"agentReady",value:function(){if(!this.agentConfig.isPhoneTakeAlong)if(this.agent.state!==W.OFFLINE){var e={messageId:101,thisDN:this.agent.thisDN,agentID:this.agent.agentID};this.connection.send(e)}else b.showMessage("未登入,不能切换状态")}},{key:"makeCall",value:function(e,t,n,o,i,a,s,r,u){if(!e)return b.showMessage("号码不能为空"),!1;if(9===e.length&&"1"===e.charAt(0)&&0!==e.indexOf(this.agent.tid))return b.showMessage("号码不符合规范"),!1;if(this.agent.deviceState===L.UNREGISTERED)return b.showMessage("请登陆SIP话机并刷新坐席状态"),!1;if(this.agentConfig.isPhoneTakeAlong)return b.showMessage("手机随行下,不能在页面拨打电话"),!1;if(this.agent.state===W.OFFLINE)return b.showMessage("当前为登出状态,请先登入"),!1;if(this.agent.state===W.READY&&this.agentNotReady(1),0!==this.linePool.getWorkingLineCount())return b.showMessage("当前已在通话中!"),!1;if(b.checkPhoneNumber(e)){e=b.trim(e);var l={messageId:200,thisDN:this.agent.thisDN,agentID:this.agent.agentID,otherDN:e,attachDatas:{id:t,type:n,"cti-agentID":this.agent.agentID}};return null!=a&&(l.thisQueue=a),null!=o&&(l.attachDatas.module=o),null!=i&&(l.attachDatas.member_uuid=i),null!=a&&(l.attachDatas.ocb_queue=a),null!=s&&(l.attachDatas.trans_para=s),null!=r&&(l.attachDatas.task_id=r),null!=u&&(l.attachDatas.numberId=u),this.connection.send(l)}return!1}},{key:"answerCall",value:function(){var e=this.linePool.getCurrentLine();if(e.lineState!==T.RINGING&&e.lineState!==T.DIALING)return b.showMessage("没有可接听的电话!"),!1;var t={messageId:201,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:e.callId};this.connection.send(t)}},{key:"holdCall",value:function(){var e=this.linePool.getCurrentLine();if(e.lineState!==T.TALKING)b.showMessage("当前不在通话中,无法保持通话");else{var t={messageId:204,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:e.callId};this.connection.send(t)}}},{key:"retrieveCall",value:function(){var e=this,t=this.linePool.getCurrentLine();if(t.lineState!==T.HELD)return b.showMessage("当前线路非保持状态,无需接回"),!1;this.linePool.lines.forEach((function(n){n.id!==t.id&&n.lineState!==T.IDLE&&e.releaseCall(n.id)})),this.connection.send({messageId:217,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId})}},{key:"releaseCall",value:function(e){void 0!==e&&null!=e||(e=this.linePool.getCurrentLineId());var t=this.linePool.getLine(e);if(null==t)b.showMessage("线路ID错误");else{if(t.lineState!==T.IDLE)return this.connection.send({messageId:203,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId});b.showMessage("当前线路没有电话,无需挂断")}}},{key:"consult",value:function(e){var t=this.linePool.getCurrentLine();if(t.lineState!==T.TALKING||t.callType!==E.INBOUND&&t.callType!==E.OUTBOUND&&t.callType!==E.ORDERCALLBACK&&t.callType!==E.MANUALCALLBACK&&t.callType!==E.PREDICT&&t.callType!==E.PREVIEW)t.callType!==E.INBOUND?b.showMessage("当前线路不是呼入,不能转接"):b.showMessage("当前线路未在通话,不能转接");else if(b.checkPhoneNumber(e)){var n={messageId:221,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId,otherDN:e,attachDatas:{"cti-agentID":this.agent.agentID}};this.connection.send(n)}}},{key:"completeTransfer",value:function(){var e=this.linePool.getCurrentLine(),t=this.linePool.getConsultLine();if(e.lineState===T.HELD){var n={messageId:223,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId,consultCallID:e.callId};this.connection.send(n)}}},{key:"singleStepTransfer",value:function(e){var t=this.linePool.getCurrentLine();if(t.lineState!==T.TALKING||t.callType!==E.INBOUND&&t.callType!==E.OUTBOUND&&t.callType!==E.ORDERCALLBACK&&t.callType!==E.MANUALCALLBACK&&t.callType!==E.PREDICT&&t.callType!==E.PREVIEW)t.callType!==E.INBOUND?b.showMessage("当前线路不是呼入,不能转接"):b.showMessage("当前线路未在通话中,不能转接");else{var n=t.phoneNumber;if(b.checkPhoneNumber(e)){var o={messageId:215,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId,otherDN:e,phoneNumber:n};this.connection.send(o)}}}},{key:"threeWayCall",value:function(e){var t=this.linePool.getCurrentLine(),n=this.agent.thisDN.substring(5);if(e.length>12||e.length<4||9===e.length&&"1"===e.charAt(0)&&0!==e.indexOf(this.agent.tid))return b.showMessage("号码不符合规范"),!1;if(4===e.length&&"0"!==this.agent.tid&&(e=this.agent.tid+e),e===t.phoneNumber)b.showMessage(e+"已经处于"+n+"的会议中");else if(e===n)b.showMessage("您已经处于"+n+"的会议中");else if(t.lineState===T.TALKING&&t.callType!==E.THREEWAY){if(b.checkPhoneNumber(e)){var o={messageId:225,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:t.callId,otherDN:e};this.connection.send(o)}}else t.callType===E.THREEWAY?b.showMessage("您已经处于会议"+t.phoneNumber+"中"):b.showMessage("当前线路未在通话中,不能会议")}},{key:"releaseThreeWayCall",value:function(e){var t={messageId:226,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:e};this.connection.send(t)}},{key:"startAgentsMonitoring",value:function(e){var t={messageId:266,thisDN:this.agent.thisDN,agentID:this.agent.agentID,agentDNS:e};this.connection.send(t)}},{key:"stopAgentsMonitoring",value:function(e){var t={messageId:267,thisDN:this.agent.thisDN,agentID:this.agent.agentID,agentDNS:e};this.connection.send(t)}},{key:"agentReadyM",value:function(e){var t={messageId:101,thisDN:this.agent.thisDN,agentID:e};this.connection.send(t)}},{key:"agentNotReadyM",value:function(e,t){var n={messageId:102,thisDN:this.agent.thisDN,agentID:e,reasonCode:t};this.connection.send(n)}},{key:"agentLogoutM",value:function(e){var t={messageId:103,thisDN:this.agent.thisDN,agentID:e};this.connection.send(t)}},{key:"agentLoginM",value:function(e){var t={messageId:100,thisDN:this.agent.thisDN,agentID:e};this.connection.send(t)}},{key:"monitorCall",value:function(e,t){var n={messageId:265,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:e,otherDN:t};this.connection.send(n)}},{key:"doInterruptCall",value:function(e,t){if(this.linePool.getCurrentLine().lineState!==T.IDLE)b.showMessage("当前状态不能强插,请先挂断电话!");else{var n={messageId:265,thisDN:this.agent.thisDN,agentID:this.agent.agentID,callID:e,otherDN:t,whisper:"1"};this.connection.send(n)}}},{key:"substitute",value:function(e,t,n){if(this.linePool.getCurrentLine().lineState!==T.IDLE)b.showMessage("当前状态不能拦截电话,请先挂断电话!");else{var o={messageId:215,thisDN:t,agentID:this.agent.agentID,otherDN:this.agent.thisDN,callID:e,phoneNumber:n};this.connection.send(o)}}},{key:"releaseAgentCall",value:function(e,t){var n={messageId:203,thisDN:t,agentID:this.agent.agentID,callID:e};this.connection.send(n)}},{key:"requestMonitorMembers",value:function(){var e={messageId:w.RequestMonitorAgentList,thisDN:this.agent.thisDN,agentID:this.agent.agentID};this.connection.send(e)}}]),e}(),q=function(){function e(){r()(this,e)}return l()(e,null,[{key:"log",value:function(e){for(var t,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];(t=console).log.apply(t,[e].concat(o))}},{key:"info",value:function(e){for(var t,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];(t=console).info.apply(t,[e].concat(o))}},{key:"error",value:function(e){for(var t,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];(t=console).error.apply(t,[e].concat(o))}}]),e}(),Y=n(66),Q=n.n(Y),X=function(e){function t(e){var n=e.wsUrl,o=void 0===n?"ws://127.0.0.1:8787/websocket":n,i=e.agent,s=e.agentConfig,u=e.linePool;r()(this,t);var l=h()(this,(t.__proto__||a()(t)).call(this,{url:o,automaticOpen:!1}));return l.agent=i,l.linePool=u,l.agentConfig=s,l.agentApi=new K({agent:i,agentConfig:s,linePool:u,connection:l}),l._loginTimeout=null,l.loggedIn=!1,l}return f()(t,e),l()(t,[{key:"login",value:function(){var e=this;this._loginTimeout=window.setTimeout((function(){!1===e.agentConfig.isPhoneTakeAlong&&b.showMessage("网速过慢,软电话加载未成功,请刷新重试")}),2e4);var t=this.loggedIn?{type:"ping",thisDN:this.agent.thisDN,agentID:this.agent.agentID,messageId:""}:{messageId:100,thisDN:this.agent.thisDN,agentID:this.agent.agentID,thisQueues:this.agent.thisQueues,defaultQueue:this.agent.defaultQueue};this.sendMessage({type:"login",thisDN:this.agent.thisDN,agentID:this.agent.agentID,message:U()(t)})}},{key:"doClose",value:function(){this.isOpened()&&(this.stopKeepAlive(),this.close())}},{key:"send",value:function(e){if(this.isOpened()){var t={thisDN:this.agent.thisDN,agentID:this.agent.agentID,type:"request",message:U()(e)};return q.log(U()(t),"input"),this.sendMessage(t),!0}return b.showMessage("没有与CTI服务器建立连接"),!1}},{key:"ping",value:function(){this.isOpened()&&this.sendMessage({type:"ping",thisDN:this.agent.thisDN,agentID:this.agent.agentID,message:""})}},{key:"onClose",value:function(e){this.stopKeepAlive()}},{key:"onOpen",value:function(e){var t=this;this.startKeepAlive(!1),this.agentConfig.autoIdleWhenLogin&&window.setTimeout((function(){t.isOpened()&&t.loggedIn&&L.REGISTERED===t.agent.deviceState&&W.BUSY===t.agent.state&&t.agentApi.agentReady()}),5e3),this.sendMessage({type:"welcome",thisDN:"",agentID:"",message:""})}},{key:"onMessage",value:function(e){var t=this,n=JSON.parse(e.data);if(null!=n){if(n.messageId!==w.EventWelcome&&n.messageId!==w.EventPong&&q.log(U()(n),"output"),n.messageId===w.EventWelcome&&this.login(),n.messageId===w.EventAgentLogin&&(window.clearTimeout(this._loginTimeout),this.loggedIn=!0),!this.loggedIn&&n.messageId===w.EventAgentReady)return this.agentApi.agentLogout(),void b.showMessage("异常就绪,已自动请求登出!");this.emit(n.messageId.toString(),n),n.messageId===w.EventAgentLogin||n.messageId===w.EventAgentNotReady||n.messageId===w.EventAgentReady?(1!==n.reasonCode&&6!==n.reasonCode&&0===this.linePool.getWorkingLineCount()&&this.agent.setAgentState(W.convertToLocalState(n.state,n.reasonCode)),this.agent.setDeviceState(n.deviceState)):n.messageId===w.EventAgentLogout?(this.agent.setAgentState(W.convertToLocalState(n.state,n.reasonCode)),this.agent.setDeviceState(n.deviceState),this.loggedIn=!1,H.send({url:"/application/is_pta/"+n.thisDN,type:"get"})):n.messageId===w.EventDialing||n.messageId===w.EventRinging||n.messageId===w.EventEstablished||n.messageId===w.EventReleased||n.messageId===w.EventHeld||n.messageId===w.EventRetrieved||n.messageId===w.EventAbandoned?this.linePool.updateLineDate(n):n.messageId===w.EventError?b.showMessage(n.errorMessage):n.messageId===w.EventLinkDisconnected&&1===n.reason&&(1===n.reason?(b.showMessage("该坐席已经从其它地方登入,请退出!"),setTimeout((function(){t.emit("linkDisconnected")}),3e3)):b.showMessage("与服务器的连接已断开!"))}}}]),t}(function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url,o=void 0===n?"ws://127.0.0.1:57712":n,i=e.protocols,s=void 0===i?[]:i,u=e.automaticOpen,l=void 0===u||u,c=e.keepAliveInterval,d=void 0===c?2e4:c,f=e.debug,p=void 0!==f&&f;r()(this,t);var g=h()(this,(t.__proto__||a()(t)).call(this));return g.url=o,g.protocols=s,g.automaticOpen=l,g.keepAliveInterval=d,g.ws=null,g.status=g.debug=p,g.automaticOpen&&g.open(),g}return f()(t,e),l()(t,[{key:"open",value:function(){var e=this;this.ws||(this.ws=new Q.a(this.url,this.protocols),this.ws.onopen=function(t){e.onOpen(t)},this.ws.onclose=function(t){e.onClose(t)},this.ws.onmessage=function(t){e.onMessage(t)},this.ws.onerror=function(t){e.onError(t)})}},{key:"onOpen",value:function(e){}},{key:"onClose",value:function(e){}},{key:"onMessage",value:function(e){}},{key:"onError",value:function(e){}},{key:"isOpened",value:function(){return this.ws&&this.ws.readyState===WebSocket.OPEN}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"sendMessage",value:function(e){if(this.ws)return this.ws.send(U()(e));throw"INVALID_STATE_ERR : Pausing to reconnect websocket"}},{key:"ping",value:function(){}},{key:"startKeepAlive",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.keepAliveTimeout&&this.stopKeepAlive(),this.isOpened()&&(t&&this.ping(),this.keepAliveTimeout=setInterval((function(){e.isOpened()?e.ping():e.stopKeepAlive()}),this.keepAliveInterval))}},{key:"stopKeepAlive",value:function(){this.keepAliveTimeout&&(clearInterval(this.keepAliveTimeout),this.keepAliveTimeout=null)}}],[{key:"browserSupportsWebSockets",value:function(){return null!==window.WebSocket&&void 0!==window.WebSocket}}]),t}(g.a)),V=(n(118),n(16)),J=n.n(V),z=0,$=function(e){function t(e){var n=e.title,o=void 0===n?"":n,i=e.className,s=void 0===i?"operation":i,u=e.iconClassName,l=void 0===u?"":u,c=e.textClassName,d=void 0===c?"operation_text":c,f=e.visible,p=void 0===f||f,g=e.enabled,v=void 0!==g&&g,m=e.onClick;r()(this,t);var y=h()(this,(t.__proto__||a()(t)).call(this));return y.id="phoneBarButton-"+z++,y._title=o,y._className=s,y._iconClassName=l,y._textClassName=d,y._visible=p,y._enabled=v,y._disabledClassName="disabled",b.isFunction(m)&&y.on("click",m),y.create(),y}return f()(t,e),l()(t,[{key:"create",value:function(){var e=this;if(!this.rootNode){var t=this.rootNode=document.createElement("li");t.id=this.id,t.className=this._className,t.onclick=function(t){e.emit("click",t)},this._visible||this.hide(),this._enabled||t.classList.add(this._disabledClassName),t.appendChild(this.generateIconNode()),t.appendChild(this.generateTextNode())}return this}},{key:"generateIconNode",value:function(){var e=document.createElement("em");return e.className=this._iconClassName,e}},{key:"generateTextNode",value:function(){var e=document.createElement("span");return e.className=this._textClassName,e.innerText=this._title,e}},{key:"destroy",value:function(){this.rootNode&&this.rootNode.parentNode&&this.rootNode.parentNode.removeChild(this.rootNode)}},{key:"show",value:function(){return this._visible=!0,this.rootNode.style.display="block",this}},{key:"hide",value:function(){return this._visible=!1,this.rootNode.style.display="none",this}},{key:"enable",value:function(){return this._enabled||(this._enabled=!0,this.rootNode.classList.contains(this._disabledClassName)&&this.rootNode.classList.remove(this._disabledClassName)),this}},{key:"disable",value:function(){return this._enabled&&(this._enabled=!1,this.rootNode.classList.add(this._disabledClassName)),this}},{key:"emit",value:function(e){if(this._enabled){for(var n,o=arguments.length,i=Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return(n=J()(t.prototype.__proto__||a()(t.prototype),"emit",this)).call.apply(n,[this,e].concat(i))}return!1}},{key:"setTitle",value:function(e){this._title=e}},{key:"setDisabledClassName",value:function(e){this._disabledClassName=e}}]),t}(g.a),Z=0,ee=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.visible,o=void 0===n||n,i=e.enabled,s=void 0===i||i,u=e.onAgentStateSelected;r()(this,t);var l=h()(this,(t.__proto__||a()(t)).call(this));return l.id="agentState-"+Z++,l._selectedState=W.OFFLINE,l._className="operation call",l._textClassName="operation_text",l._openClassName="open",l.actionList=[{name:"就绪",value:"ready",visible:!0},{name:"示忙",value:"busy",visible:!0},{name:"休息",value:"rest",visible:!0},{name:"离线",value:"logout",visible:!1},{name:"登入",value:"login",visible:!0}],l._visible=o,l._enabled=s,l._disabledClassName="disabled",b.isFunction(u)&&l.on("agentStateSelected",u),l.create(),l}return f()(t,e),l()(t,[{key:"create",value:function(){var e=this;if(!this.rootNode){var t=this.rootNode=document.createElement("li");t.id=this.id,t.className=this._className,t.appendChild(this.generateIconNode()),t.appendChild(this.generateTextNode()),t.appendChild(this._generateDropdownMenuNode()),this._visible||this.hide(),t.onclick=function(t){e._toggleDropdownMenu(t)},document.addEventListener("click",this.onBodyClick=this._hideDropdownMenu.bind(this))}}},{key:"generateIconNode",value:function(){var e=this.agentStateIcon=document.createElement("span");return e.className="agentstate-"+this._selectedState,e}},{key:"generateTextNode",value:function(){var e=document.createElement("div");e.className=this._textClassName;var t=this.agentStateText=document.createElement("span");t.innerText=W.getStateName(this._selectedState);var n=this.agentStateTimer=document.createElement("span");return n.innerText="00:00",e.appendChild(t),e.appendChild(n),e}},{key:"_generateDropdownMenuNode",value:function(){var e=this,t=this._dropdownMenuNode=document.createElement("ul");return t.className="dropdown-menu",t.style.display="none",this._actionElementMap={},this.actionList.forEach((function(n){var o=document.createElement("li");n.visible||(o.style.display="none"),o.onclick=function(){e.emit("agentStateSelected",n.value)};var i=document.createElement("i");i.className=n.value;var a=document.createElement("span");a.innerText=n.name,o.appendChild(i),o.appendChild(a),t.appendChild(o),e._actionElementMap[n.value]=o})),t}},{key:"_hideDropdownMenu",value:function(){"none"!==this._dropdownMenuNode.style.display&&(this._dropdownMenuNode.style.display="none",this.rootNode.classList.contains(this._openClassName)&&this.rootNode.classList.remove(this._openClassName))}},{key:"_toggleDropdownMenu",value:function(e){"none"!==this._dropdownMenuNode.style.display?this._hideDropdownMenu():(this._dropdownMenuNode.style.display="block",this.rootNode.classList.add(this._openClassName)),e.stopPropagation()}},{key:"setAgentStateTimer",value:function(e){this.agentStateTimer.innerText=e}},{key:"changeAgentState",value:function(e){this._selectedState=e,this.agentStateIcon.className="agentstate-"+e,this.agentStateText.innerText=W.getStateName(e),e===W.OFFLINE?(this._actionElementMap.logout.style.display="none",this._actionElementMap.login.style.display="block"):e===W.BUSY&&(this._actionElementMap.login.style.display="none",this._actionElementMap.logout.style.display="block")}},{key:"destroy",value:function(){this.rootNode&&this.rootNode.parentNode&&this.rootNode.parentNode.removeChild(this.rootNode),this.removeAllListeners("agentStateSelected"),document.removeEventListener("click",this.onBodyClick)}},{key:"show",value:function(){return this.rootNode.style.display="block",this}},{key:"hide",value:function(){return this.rootNode.style.display="none",this}}]),t}(g.a),te=function(e){function t(e){var n=e.title,o=void 0===n?"":n,i=e.iconClassName,s=e.visible,u=void 0===s||s,l=e.enabled,c=void 0!==l&&l,d=e.menuData,f=e.onItemClick;r()(this,t);var p=h()(this,(t.__proto__||a()(t)).call(this,{title:o,className:"operation multilevelMenu",iconClassName:i,visible:u,enabled:c}));return p.menuData=d,p._openClassName="open",p.on("click",(function(e){p._toggleMenu(e)})),document.addEventListener("click",p.onBodyClick=p._hideMenu.bind(p)),p.rootNode.onmouseleave=function(){p._hideMenu()},b.isFunction(f)&&p.on("itemClick",f),p.rootNode.appendChild(p.generateMenu()),p}return f()(t,e),l()(t,[{key:"generateMenu",value:function(){var e=this.menuNode=document.createElement("ul");return e.className="menu-list-box",e.style.display="none",e.appendChild(this.generateSubMenu(this.menuData)),e}},{key:"generateSubMenu",value:function(e){var t=this,n=document.createDocumentFragment();return e&&e.forEach((function(e){var o=document.createElement("li");if(e.menu.length>0){var i=document.createElement("h3");i.innerHTML=e.name+'<span class="list"></span>';var a=document.createElement("ul");a.appendChild(t.generateSubMenu(e.menu)),o.onmouseenter=function(){a.style.display="block"},o.onmouseleave=function(){a.style.display="none"},o.appendChild(i),o.appendChild(a)}else{var s=document.createElement("h3");s.onclick=function(){t.emit("itemClick",e)},s.innerText=e.name,o.appendChild(s)}n.appendChild(o)})),n}},{key:"updateMenuData",value:function(e){this.menuData=e,this.menuNode&&this.menuNode.parentNode&&this.menuNode.parentNode.removeChild(this.menuNode),this.rootNode.appendChild(this.generateMenu())}},{key:"_hideMenu",value:function(){"none"!==this.menuNode.style.display&&(this.menuNode.style.display="none",this.rootNode.classList.contains(this._openClassName)&&this.rootNode.classList.remove(this._openClassName))}},{key:"_toggleMenu",value:function(e){"none"!==this.menuNode.style.display?this._hideMenu():(this.menuNode.style.display="block",this.rootNode.classList.add(this._openClassName)),e.stopPropagation()}},{key:"destroy",value:function(){J()(t.prototype.__proto__||a()(t.prototype),"destroy",this).call(this),this.removeAllListeners("itemClick")}}]),t}($),ne=0,oe=function(e){function t(){r()(this,t);var e=h()(this,(t.__proto__||a()(t)).call(this));return e.id="phoneBar-"+ne++,e._rootNodeClassName="phonebar-nav",e.buttonList=[{name:"agentState",component:new ee,sort:"1"},{name:"openDialPad",component:new $({title:"呼出",iconClassName:"opendialpad"}),sort:2},{name:"answer",component:new $({title:"应答",iconClassName:"answer"}),sort:3},{name:"hangup",component:new $({title:"挂断",iconClassName:"hangup"}),sort:4},{name:"hold",component:new $({title:"保持",iconClassName:"hold"}),sort:5},{name:"retrieve",component:new $({title:"接回",iconClassName:"retrieve"}),sort:6},{name:"transfer",component:new te({title:"转接",iconClassName:"transfer"}),sort:7},{name:"rollout",component:new $({title:"转出",iconClassName:"rollout"}),sort:8},{name:"conference",component:new te({title:"会议",iconClassName:"conference"}),sort:9}],e.create(),e}return f()(t,e),l()(t,[{key:"create",value:function(){if(!this.rootNode){var e=this.rootNode=document.createElement("ul");e.id=this.id,e.className=this._rootNodeClassName,this.buttonList.sort((function(e,t){return e.sort-t.sort})).forEach((function(t){e.appendChild(t.component.rootNode)})),this.hide()}}},{key:"getButtonComponent",value:function(e){for(var t=0,n=this.buttonList.length;t<n;t++)if(this.buttonList[t].name===e)return this.buttonList[t].component;return null}},{key:"changeButtonSipNG",value:function(){console.log("changeButtonSipNG"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonSipOK",value:function(){console.log("changeButtonSipOK"),this.getButtonComponent("openDialPad").enable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenNotReady",value:function(){console.log("changeButtonWhenNotReady"),this.getButtonComponent("openDialPad").enable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenReady",value:function(){console.log("changeButtonWhenReady"),this.getButtonComponent("openDialPad").enable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenLogout",value:function(){console.log("changeButtonWhenLogout"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenRinging",value:function(){console.log("changeButtonWhenRinging"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").enable(),this.getButtonComponent("hangup").enable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenDialing",value:function(e){console.log("changeButtonWhenDialing"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("hangup").enable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable(),e===E.PREDICT||e===E.MONITOR?this.getButtonComponent("answer").enable():this.getButtonComponent("answer").disable()}},{key:"changeButtonWhenTalking",value:function(e){console.log("changeButtonWhenTalking"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").enable(),this.getButtonComponent("hold").enable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").enable(),e===E.INTERNAL?this.getButtonComponent("transfer").disable():e===E.CONSULT?(this.getButtonComponent("hold").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("conference").disable()):this.getButtonComponent("transfer").enable()}},{key:"changeButtonWhenHold",value:function(){console.log("changeButtonWhenHold"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").enable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenIdle",value:function(){console.log("changeButtonWhenIdle"),this.getButtonComponent("openDialPad").enable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").disable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").disable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenDouble",value:function(){console.log("changeButtonWhenDouble"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("answer").disable(),this.getButtonComponent("hangup").disable(),this.getButtonComponent("hold").disable(),this.getButtonComponent("retrieve").enable(),this.getButtonComponent("transfer").disable(),this.getButtonComponent("rollout").enable(),this.getButtonComponent("conference").disable()}},{key:"changeButtonWhenDoubleCalled",value:function(){console.log("changeButtonWhenDoubleCalled"),this.getButtonComponent("transfer").disable(),this.getButtonComponent("hold").disable()}},{key:"changeButtonWhenDoubleDiscon",value:function(){console.log("changeButtonWhenDoubleDiscon"),this.getButtonComponent("rollout").disable()}},{key:"changeButtonWhenCustomerDiscon",value:function(){console.log("changeButtonWhenCustomerDiscon"),this.getButtonComponent("openDialPad").disable(),this.getButtonComponent("hangup").enable()}},{key:"destroy",value:function(){this.rootNode&&this.rootNode.parentNode&&this.rootNode.parentNode.removeChild(this.rootNode)}},{key:"show",value:function(){return this.rootNode.style.display="block",this}},{key:"hide",value:function(){return this.rootNode.style.display="none",this}}]),t}(g.a),ie=(n(122),n(123),0),ae=function(e){function t(e){var n=e.title,o=void 0===n?"":n;r()(this,t);var i=h()(this,(t.__proto__||a()(t)).call(this));return i.id="dialog-"+ie++,i._title=o,i.diffX=0,i.diffY=0,i.create(),i}return f()(t,e),l()(t,[{key:"create",value:function(){if(!this.rootNode){var e=this.rootNode=document.createElement("div");e.id=this.id,e.className="cc-dialog";var t=this.contentNode=document.createElement("div");e.appendChild(this._generateTitleNode()),e.appendChild(this._generateWindowControllerNode()),e.appendChild(t),this.hide(),document.body.appendChild(e)}}},{key:"_generateTitleNode",value:function(){var e=this._titleNode=document.createElement("div");return e.className="title",e.innerText=this._title,e.addEventListener("mousedown",this.mouseHandler.bind(this)),e}},{key:"setTitle",value:function(e){return this._title=e,this._titleNode.innerText=e,this}},{key:"_generateWindowControllerNode",value:function(){var e=document.createElement("div");e.className="ctlwin";var t=document.createElement("a");return t.className="close",t.href="javascript:void(0);",t.onclick=this.onClose.bind(this),e.appendChild(t),e}},{key:"mouseHandler",value:function(e){switch(e.type){case"mousedown":this.draggingObj=e.target.offsetParent,null!=this.draggingObj&&(this.diffX=e.clientX-this.draggingObj.offsetLeft,this.diffY=e.clientY-this.draggingObj.offsetTop,document.addEventListener("mousemove",this.titleMouseMoveHandler=this.mouseHandler.bind(this)),document.addEventListener("mouseup",this.titleMouseUpHandler=this.mouseHandler.bind(this)));break;case"mousemove":this.draggingObj&&(this.draggingObj.style.left=e.clientX-this.diffX+"px",this.draggingObj.style.top=e.clientY-this.diffY+"px");break;case"mouseup":document.removeEventListener("mousemove",this.titleMouseMoveHandler),document.removeEventListener("mouseup",this.titleMouseUpHandler),this.draggingObj=null,this.diffX=0,this.diffY=0}}},{key:"onClose",value:function(){this.destroy()}},{key:"setContent",value:function(e){e instanceof String?this.contentNode.innerHTML=e:e instanceof HTMLElement&&(this.contentNode.innerHTML="",this.contentNode.appendChild(e))}},{key:"destroy",value:function(){this.rootNode&&this.rootNode.parentNode&&this.rootNode.parentNode.removeChild(this.rootNode)}},{key:"show",value:function(){return this.rootNode.style.display="block",this}},{key:"hide",value:function(){return this.rootNode.style.display="none",this}}]),t}(g.a),se=function(e){function t(e){var n=e.title,o=void 0===n?"":n,i=e.contacts,s=void 0===i?[]:i,u=e.dynamicButton,l=e.onHangupButtonClick;r()(this,t);var c=h()(this,(t.__proto__||a()(t)).call(this,{title:o}));return c._contacts=s,c.dynamicButton=u,c.setContent(c._generateContentNode()),b.isFunction(l)&&c.on("hangupButtonClick",l),c}return f()(t,e),l()(t,[{key:"_generateContentNode",value:function(){var e=document.createElement("div");return e.className="dialpad clearfloat",e.onselectstart=function(){return!1},this._contacts.length>0&&e.appendChild(this._generateContactSelectNode()),e.appendChild(this._generatePhoneNumberNode()),e.appendChild(this._generateNumberPadNode()),e.appendChild(this._generateCallControllerNode()),e}},{key:"_generateContactSelectNode",value:function(){var e=this,t=document.createElement("select");t.className="single-line select_width";var n='<option value="">--请选择电话号码--</option>';return this._contacts.forEach((function(e){n+='<option value="'+e.agentId+'">'+e.name+"</option>"})),t.innerHTML=n,t.onchange=function(){t.value&&e.setPhoneNumber(t.value)},t}},{key:"_generatePhoneNumberNode",value:function(){var e=document.createElement("div");e.className="input-group";var t=document.createElement("div");t.className="phoneNumber";var n=this._phoneNumberTextField=document.createElement("input");n.type="text",n.className="number",n.name="phoneNumber",t.appendChild(n);var o=document.createElement("button");return o.type="button",o.className="cc-btn btn-white slidedialpad",o.title="数字键盘",o.innerHTML='<i class="icon-slidedialpad"></i>',o.onclick=this.toggleExpandNumberPad.bind(this),e.appendChild(t),e.appendChild(o),e}},{key:"toggleExpandNumberPad",value:function(){var e="none"!==this.numberPadNode.style.display;this.numberPadNode.style.display=e?"none":"block"}},{key:"setPhoneNumber",value:function(e){this._phoneNumberTextField.value=e}},{key:"getPhoneNumber",value:function(){return this._phoneNumberTextField.value||""}},{key:"_generateNumberPadNode",value:function(){var e=this.numberPadNode=document.createElement("ul");e.className="numberpad clearfloat",e.style.display="none";for(var t=1;t<=12;t++){var n=document.createElement("li");switch(t){case 10:n.innerText="*";break;case 11:n.innerText=0;break;case 12:n.innerText="#";break;default:n.innerText=t}n.onclick=this._onKeyClick.bind(this,n.innerText),e.appendChild(n)}return e}},{key:"_onKeyClick",value:function(e){this.setPhoneNumber(this.getPhoneNumber()+e)}},{key:"_generateCallControllerNode",value:function(){var e=this,t=document.createElement("ul");t.className="clearfix";var n=document.createElement("li");n.className="remove",n.title="清除",n.innerText="清除",n.onclick=function(){var t=e.getPhoneNumber();e.setPhoneNumber(t.substr(0,t.length-1))},n.ondblclick=function(){e.setPhoneNumber("")};var o=document.createElement("li");return o.className="hangup",o.title="挂断",o.innerHTML='<i class="icon-hangup"></i>',o.onclick=function(){e.emit("hangupButtonClick")},this.dynamicButton&&t.appendChild(this.dynamicButton),t.appendChild(n),t.appendChild(o),t}},{key:"destroy",value:function(){J()(t.prototype.__proto__||a()(t.prototype),"destroy",this).call(this),this.removeAllListeners("hangupButtonClick")}}],[{key:"createButton",value:function(e){var t=e.id,n=e.tagName,o=void 0===n?"li":n,i=e.btnName,a=e.className,s=e.onClick,r=document.createElement(o);return t&&(r.id=t),a&&(r.className=a),i&&(r.title=i),i&&(r.innerText=i),b.isFunction(s)&&(r.onclick=s),r}}]),t}(ae),re=function(){function e(t){r()(this,e),this._lineState=T.IDLE,this._phoneNumber="",this._callType=-1,this._callId="",this._parties=[],this._id=t}return l()(e,[{key:"reset",value:function(){this._lineState=T.IDLE,this._phoneNumber="",this._callType=-1,this._callId="",this._parties=[]}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"lineState",get:function(){return this._lineState},set:function(e){this._lineState=e}},{key:"phoneNumber",get:function(){return this._phoneNumber},set:function(e){this._phoneNumber=e}},{key:"callType",get:function(){return this._callType},set:function(e){this._callType=e}},{key:"callId",get:function(){return this._callId},set:function(e){this._callId=e}},{key:"parties",get:function(){return this._parties},set:function(e){this._parties=e}}]),e}(),ue=function(e){function t(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).maxLines,n=void 0===e?2:e;r()(this,t);var o=h()(this,(t.__proto__||a()(t)).call(this));return o._maxLines=n,o._lineId=0,o._lines=new Array(o._maxLines),o.init(),o}return f()(t,e),l()(t,[{key:"init",value:function(){for(var e=0;e<this._maxLines;e++)this._lines[e]=new re(e)}},{key:"getLine",value:function(e){if(this.checkLineId(e))for(var t=0;t<this._maxLines;t++)if(this._lines[t].id===e)return this._lines[t];return null}},{key:"getIdleLine",value:function(){return this.getCurrentLine().lineState===T.IDLE?this.getCurrentLine():this.getLineByState(T.IDLE)}},{key:"getTalkingLine",value:function(){return this.getLineByState(T.TALKING)}},{key:"getLineByState",value:function(e){for(var t=0;t<this._maxLines;t++)if(this._lines[t].lineState===e)return this._lines[t];return null}},{key:"getLineByCallId",value:function(e){for(var t=0;t<this._maxLines;t++)if(this._lines[t].callId===e)return this._lines[t];return null}},{key:"getConsultLine",value:function(){for(var e=0;e<this._maxLines;e++)if(this._lines[e].callType===E.CONSULT)return this._lines[e];return null}},{key:"setCurrentLineId",value:function(e){this.checkLineId(e)&&(this._lineId=e)}},{key:"getCurrentLineId",value:function(){return this._lineId}},{key:"getCurrentLine",value:function(){return this.getLine(this._lineId)}},{key:"getWorkingLineCount",value:function(){for(var e=0,t=0;t<this._maxLines;t++)this._lines[t].lineState!==T.IDLE&&e++;return e}},{key:"isExistLineByCallType",value:function(e){for(var t=0;t<this._maxLines;t++)if(this._lines[t].callType===e)return!0;return!1}},{key:"checkLineId",value:function(e){return null!=e&&e>=0&&e<this._maxLines}},{key:"updateLineDate",value:function(e){var t=e.messageId,n=this.parseCallInfo(e),o=this.getLineByCallId(n.callId);switch(o||(o=this.getCurrentLine()),(t===w.EventRinging||t===w.EventDialing&&n.callType===E.CONSULT)&&(o=this.getIdleLine()),t){case w.EventReleased:case w.EventAbandoned:o.reset();break;case w.EventDialing:o.lineState=T.DIALING,o.phoneNumber=n.phoneNumber,o.callType=n.callType,o.callId=n.callId;break;case w.EventRinging:o.lineState=T.RINGING,o.phoneNumber=n.phoneNumber,o.callType=n.callType,o.callId=n.callId;break;case w.EventEstablished:if(null==n.callId||""===n.callId)break;o.lineState=T.TALKING,o.phoneNumber=n.phoneNumber,o.callType=n.callType,o.callId=n.callId,o.parties=[n.phoneNumber];break;case w.EventHeld:o.lineState=T.HELD;break;case w.EventRetrieved:o.lineState=T.TALKING}this.emit("lineDataChange",o,n,e)}},{key:"parseCallInfo",value:function(e){return{callId:e.callID,callType:e.callType,phoneNumber:e.otherDN&&"Unknown"!==e.otherDN?e.otherDN:"",attachDatas:e.attachDatas,creationTime:e.creationTime,queue:e.thisQueue||null,dnis:e.dnis,callSid:e.auuid,cityCode:e.cityCode,talkSec:e.talkSec||0}}},{key:"maxLines",get:function(){return this._maxLines},set:function(e){this._maxLines=e}},{key:"lines",get:function(){return this._lines},set:function(e){this._lines=e}}]),t}(g.a),le=function(e){function t(e){var n=e.title,o=void 0===n?"":n,i=e.onJoinButtonClick,s=e.onRemoveCallButtonClick,u=e.onRemoveAllCallButtonClick;r()(this,t);var l=h()(this,(t.__proto__||a()(t)).call(this,{title:o}));return l.phoneMap={},l.setContent(l._generateContentNode()),b.isFunction(i)&&l.on("joinButtonClick",i),b.isFunction(s)&&l.on("removeCallButtonClick",s),b.isFunction(u)&&l.on("removeAllCallButtonClick",u),l}return f()(t,e),l()(t,[{key:"onClose",value:function(){this.hide()}},{key:"_generateContentNode",value:function(){var e=document.createElement("div");e.className="threewayCallBox",e.appendChild(this._generatePhoneNumberNode());var t=this.thirdPhoneNumberNode=document.createElement("div");return t.className="calloption",e.appendChild(t),e.appendChild(this._generateCallControllerNode()),e}},{key:"_generatePhoneNumberNode",value:function(){var e=this,t=document.createElement("div");t.className="row";var n=document.createElement("label");n.innerText="加入指定电话或分机号";var o=this._phoneNumberTextField=document.createElement("input");o.type="text",o.name="inputThreewayDN";var i=document.createElement("button");return i.type="button",i.innerText="加入",i.title="加入",i.onclick=function(){e.emit("joinButtonClick",o.value)},t.appendChild(n),t.appendChild(o),t.appendChild(i),t}},{key:"join",value:function(e,t){if(!this.phoneMap[e]){var n=document.createElement("label"),o=document.createElement("input");o.type="checkbox",o.value=t,n.appendChild(o),n.appendChild(document.createTextNode(e)),this.phoneMap[e]=n,this.thirdPhoneNumberNode.appendChild(n)}}},{key:"remove",value:function(e){var t=this.phoneMap[e];t&&t.parentNode&&t.parentNode.removeChild(t)}},{key:"_generateCallControllerNode",value:function(){var e=this,t=document.createElement("div");t.className="row";var n=document.createElement("div");n.className="pull-left";var o=document.createElement("label"),i=this._checkAllButton=document.createElement("input");i.type="checkbox",i.className="checkAll",i.onchange=function(){!0===i.checked?N()(e.phoneMap).forEach((function(t){e.phoneMap[t].firstElementChild.checked=!0})):N()(e.phoneMap).forEach((function(t){e.phoneMap[t].firstElementChild.checked=!1}))},o.appendChild(i),o.appendChild(document.createTextNode("全选")),n.appendChild(o);var a=document.createElement("div");a.className="pull-right";var s=document.createElement("button");s.type="button",s.innerText="踢出选中通话",s.onclick=function(){N()(e.phoneMap).forEach((function(t){e.phoneMap[t]&&e.phoneMap[t].firstElementChild.checked&&e.emit("removeCallButtonClick",e.phoneMap[t].firstElementChild.value)}))};var r=document.createElement("button");r.type="button",r.innerText="踢出全部通话",r.onclick=function(){e.emit("removeAllCallButtonClick")};var u=document.createElement("button");return u.type="button",u.innerText="关闭",u.onclick=function(){e.onClose()},a.appendChild(s),a.appendChild(r),a.appendChild(u),t.appendChild(n),t.appendChild(a),t}},{key:"destroy",value:function(){J()(t.prototype.__proto__||a()(t.prototype),"destroy",this).call(this),this.removeAllListeners("joinButtonClick"),this.removeAllListeners("removeCallButtonClick"),this.removeAllListeners("removeAllCallButtonClick")}}]),t}(ae),ce=function(e){function t(e){var n=e.tipTime,o=void 0===n?0:n,i=e.maxAfterWorkTime,s=void 0===i?0:i,u=e.autoIdleWhenLogin,l=void 0!==u&&u,c=e.isPhoneTakeAlong,d=void 0!==c&&c,f=e.workPhone,p=void 0===f?"":f,g=e.autoAnswer,v=void 0!==g&&g;r()(this,t);var m=h()(this,(t.__proto__||a()(t)).call(this));return m._tipTime=o,m._maxAfterWorkTime=s,m._autoIdleWhenLogin=l,m._isPhoneTakeAlong=d,m._workPhone=p,m._autoAnswer=v,m}return f()(t,e),l()(t,[{key:"set",value:function(e,t){this["_"+e]!==t&&(this["_"+e]=t,this.emit("change",this,e,t))}},{key:"tipTime",get:function(){return this._tipTime},set:function(e){this._tipTime!==e&&(this._tipTime=e,this.emit("change",this,"tipTime",e))}},{key:"maxAfterWorkTime",get:function(){return this._maxAfterWorkTime},set:function(e){this._maxAfterWorkTime!==e&&(this._maxAfterWorkTime=e,this.emit("change",this,"maxAfterWorkTime",e))}},{key:"autoIdleWhenLogin",get:function(){return this._autoIdleWhenLogin},set:function(e){this._autoIdleWhenLogin!==e&&(this._autoIdleWhenLogin=e,this.emit("change",this,"autoIdleWhenLogin",e))}},{key:"isPhoneTakeAlong",get:function(){return this._isPhoneTakeAlong},set:function(e){this._isPhoneTakeAlong!==e&&(this._isPhoneTakeAlong=e,this.emit("change",this,"isPhoneTakeAlong",e))}},{key:"workPhone",get:function(){return this._workPhone},set:function(e){this._workPhone!==e&&(this._workPhone=e,this.emit("change",this,"workPhone",e))}},{key:"autoAnswer",get:function(){return this._autoAnswer},set:function(e){this._autoAnswer!==e&&(this._autoAnswer=e,this.emit("change",this,"autoAnswer",e))}}]),t}(g.a),he=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.urls,o=void 0===n?["ws://127.0.0.1:57712","ws://127.0.0.1:58823"]:n,i=e.protocols,s=void 0===i?[]:i,u=e.serverUrl,l=e.username,c=e.password,d=e.automaticOpen,f=void 0!==d&&d,p=e.pingInterval,g=void 0===p?2e4:p;r()(this,t);var v=h()(this,(t.__proto__||a()(t)).call(this));return v.wsInfo=o.map((function(e,t){return{ws:null,url:e,enabled:!0}})),v.protocols=s,v.serverUrl=u,v.username=l,v.password=c,v.automaticOpen=f,v.pingInterval=g,v.currentWS=null,v.sessionid=null,v.pingcount=0,v.pingTimeHandler=null,v.automaticOpen&&v.open(),v}return f()(t,e),l()(t,[{key:"getFirstEnabledWSInfo",value:function(){for(var e=0,t=this.wsInfo.length;e<t;e++)if(this.wsInfo[e].enabled)return this.wsInfo[e];return null}},{key:"getWSInfoByPath",value:function(e){for(var t=0,n=this.wsInfo.length;t<n;t++)if(e.indexOf(this.wsInfo[t].url)>-1)return this.wsInfo[t];return null}},{key:"open",value:function(){var e=this,t=this.getFirstEnabledWSInfo();return null==t?(b.showMessage("内置话机异常,请检查本地服务是否被禁用,或重新安装软电话!"),!1):(this.currentWS=null,this.currentWS=new WebSocket(t.url,this.protocols),this.currentWS.onopen=function(n){e.onOpen(n,t)},this.currentWS.onclose=function(n){e.onDisconnected(n,t)},this.currentWS.onmessage=function(n){e.onMessage(n,t)},this.currentWS.onerror=function(n){e.onError(n,t)},t.ws=this.currentWS,this)}},{key:"onOpen",value:function(e){console.log(e,"sipphone onConnect",this.getFirstEnabledWSInfo()),this.doLogin(this.serverUrl,this.username,this.password)}},{key:"onDisconnected",value:function(e,t){console.log("sipphone closed"),this.stopPing(),t.ws=null}},{key:"onMessage",value:function(e){var t=JSON.parse(e.data);"ping"===t.action?this.pingcount=0:"login"===t.action?this.username===t.data.user&&1===t.data.result?(this.sessionid=t.data.sid,this.startPing(),this.emit("loginSuccess",t)):b.showMessage("软电话注册失败!"):"close"===t.action&&t.data.user===this.username&&(this.stopPing(),b.showMessage("软电话已退出!")),this.emit(t.action,t.data)}},{key:"onError",value:function(e){this.getWSInfoByPath(e.currentTarget.url).enabled=!1,this.open()}},{key:"isOpened",value:function(){return this.currentWS&&this.currentWS.readyState===WebSocket.OPEN}},{key:"doClose",value:function(){this.isOpened()&&(this.send({action:"close",sid:this.sessionid,data:{user:this.username}}),this.currentWS.close())}},{key:"send",value:function(e){if(this.isOpened())return this.sessionid||(e.sid=this.sessionid),this.currentWS.send(U()(e));throw"INVALID_STATE_ERR : Pausing to reconnect websocket"}},{key:"doLogin",value:function(e,t,n){this.isOpened()?this.send({action:"login",data:{addr:e,user:t,password:n}}):this.open()}},{key:"sendPing",value:function(){this.send({action:"ping",sid:this.sessionid}),this.pingcount=this.pingcount+1,this.pingcount>3&&(this.stopPing(),console.log("reLoad"),this.open())}},{key:"startPing",value:function(){var e=this;this.pingTimeHandler=setTimeout((function(){e.startPing()}),this.pingInterval),this.sendPing()}},{key:"stopPing",value:function(){clearTimeout(this.pingTimeHandler),this.pingcount=0}}]),t}(g.a),de=function(e){function t(e){e.renderTo,e.proxyUrl,e.startupSoftPhone;var n=e.sipServerUrl,o=void 0===n?"127.0.0.1:5188":n,i=(e.tid,e.thisDN,e.pstnDN,e.agentID),s=void 0===i?"":i,u=e.password,l=void 0===u?"":u,c=(e.thisQueues,e.defaultQueue,e.tipTime,e.maxAfterWorkTime,e.autoIdleWhenLogin,e.isPhoneTakeAlong,e.workPhone,e.autoAnswer,e.onScreenPopup),d=e.onRinging,f=e.onTalking,p=e.onHangup,g=e.onAgentStatusChange,v=e.onLinkDisconnected;r()(this,t);var m=h()(this,(t.__proto__||a()(t)).call(this)),y=m.options=arguments[0];return m.linePool=new ue,m.agentConfig=new ce(y),m.agent=new W(y),m.connection=new X({wsUrl:y.proxyUrl,agent:m.agent,agentConfig:m.agentConfig,linePool:m.linePool}),m.agentApi=m.connection.agentApi,m.softPhoneConnection=new he({serverUrl:o,username:s,password:l}),m.phoneBarComponent=new oe,m.getComponent("agentState").on("agentStateSelected",m._onAgentStateSelected.bind(m)),m.getComponent("openDialPad").on("click",(function(){m._showDialPad({btnName:"呼叫",onDynamicButtonClick:m.makeCall.bind(m,null)})})),m.getComponent("answer").on("click",(function(){m.agentApi.answerCall()})),m.getComponent("hangup").on("click",(function(){m.agentApi.releaseCall()})),m.getComponent("hold").on("click",(function(){m.agentApi.holdCall()})),m.getComponent("retrieve").on("click",(function(){m.agentApi.retrieveCall()})),m.getComponent("transfer").on("itemClick",m.onTransferItemClick.bind(m)),m.getComponent("rollout").on("click",(function(){m.agentApi.completeTransfer()})),m.getComponent("conference").on("itemClick",m.onConferenceItemClick.bind(m)),m.threewayCallData=[],b.isFunction(c)&&m.on("screenPopup",c),b.isFunction(d)&&m.on("ringing",d),b.isFunction(f)&&m.on("talking",f),b.isFunction(p)&&m.on("hangup",p),b.isFunction(g)&&m.agent.on("agentStateChange",g),b.isFunction(v)&&m.connection.on("linkDisconnected",v),m.eventHandler(),m.initial(),m}return f()(t,e),l()(t,[{key:"eventHandler",value:function(){var e=this;this.connection.on(w.EventThreeWayEstablished.toString(),(function(t){e.threewayCallData.push({phoneNumber:t.otherDN,callID:t.callID}),!e.threewayCallBox||e.threewayCallBox.join(t.otherDN,t.callID)})),this.connection.on(w.EventThreeWayReleased.toString(),(function(t){e.threewayCallData=e.threewayCallData.filter((function(e){return e.phoneNumber!==t.otherDN})),!e.threewayCallBox||e.threewayCallBox.remove(t.otherDN),b.showMessage(t.otherDN+" 已退出会议")})),this.connection.on(w.EventTransferMenuList.toString(),(function(t){e.updateTransferMenu(t.menuList)})),this.connection.on(w.EventConferenceMenuList.toString(),(function(t){e.updateConferenceMenu(t.menuList)})),this.agent.stateTimer.on("change",(function(t,n){e.getComponent("agentState").setAgentStateTimer(n);var o=e.agentConfig.tipTime;if(o>0&&t>0&&t%(60*o)==0&&e.agent.state!==W.BUSY){var i='您已保持"'+e.agent.getCurrentStateName()+'"状态'+e.agent.stateTimer.format(["小时","分钟","秒"]);b.showMessage(i)}var a=e.agentConfig.maxAfterWorkTime;a>0&&t>=a&&(t-a)%3==0&&e.agent.state===W.NEATENING&&0===e.linePool.getWorkingLineCount()&&e.agentApi.agentReady()})),this.agent.on("agentStateChange",(function(t){e.getComponent("agentState").changeAgentState(t),e.agent.deviceState===L.REGISTERED&&(t===W.READY?e.phoneBarComponent.changeButtonWhenReady():t===W.BUSY||t===W.RESTING||t===W.NEATENING?e.phoneBarComponent.changeButtonWhenNotReady():t===W.OFFLINE&&e.phoneBarComponent.changeButtonWhenLogout())})),this.agent.on("deviceStateChange",(function(t){t===L.UNREGISTERED?e.phoneBarComponent.changeButtonSipNG():e.phoneBarComponent.changeButtonSipOK()})),this.linePool.on("lineDataChange",(function(t,n,o){e.linePool.getCurrentLineId()===t.id&&(t.lineState===T.IDLE?(e.agentApi.agentNotReady(0),e.phoneBarComponent.changeButtonWhenIdle(),e.emit("hangup",n,o)):t.lineState===T.DIALING?(e.agent.setAgentState(W.RINGING),e.phoneBarComponent.changeButtonWhenDialing(n.callType),e.emit("ringing",n,o)):t.lineState===T.RINGING?(e.agent.setAgentState(W.RINGING),e.phoneBarComponent.changeButtonWhenRinging(),e.emit("ringing",n,o)):t.lineState===T.HELD?e.phoneBarComponent.changeButtonWhenHold():t.lineState===T.TALKING&&(e.agent.setAgentState(W.TALKING),e.phoneBarComponent.changeButtonWhenTalking(n.callType),e.emit("talking",n,o))),n.callType===E.CONSULT&&(o.partyState===S&&1===o.thisRole&&2===o.otherRole&&(e.linePool.isExistLineByCallType(E.INBOUND)||e.linePool.isExistLineByCallType(E.OUTBOUND))&&e.phoneBarComponent.changeButtonWhenDouble(),o.partyState===S&&2===o.thisRole&&1===o.otherRole&&e.phoneBarComponent.changeButtonWhenDoubleCalled(),t.lineState===T.IDLE&&n.otherDN===o.sendBy&&o.thirdDN===o.sendBy&&(e.phoneBarComponent.changeButtonWhenDoubleDiscon(),9===o.sendBy.length?b.showMessage("坐席 "+o.sendBy+" 已挂断!"):b.showMessage("外线 "+o.sendBy+" 已挂断!"))),t.lineState!==T.IDLE||!e.linePool.isExistLineByCallType(E.CONSULT)||n.callType!==E.INBOUND&&n.callType!==E.OUTBOUND||n.otherDN!==o.sendBy||""===o.thirdDN||(e.phoneBarComponent.changeButtonWhenCustomerDiscon(),e.linePool.setCurrentLineId(e.linePool.getConsultLine().id)),5!==o.thisRole&&n.callType!==E.INTERNAL&&null==o.attachDatas.variable_thirdPartyRole&&e.emit("screenPopup",t.lineState,n)}))}},{key:"initial",value:function(){var e=this;!0===this.options.startupSoftPhone?(this.softPhoneConnection.open(),this.softPhoneConnection.on("loginSuccess",(function(){return e.connection.open()}))):this.connection.open(),this._rootNode=this.phoneBarComponent.rootNode,this.options.renderTo?document.getElementById(this.options.renderTo).appendChild(this._rootNode):document.body.appendChild(this._rootNode),this.phoneBarComponent.show()}},{key:"getComponent",value:function(e){return e?this.phoneBarComponent.getButtonComponent(e):null}},{key:"_onAgentStateSelected",value:function(e){return"logout"!==e&&"login"!==e&&this.agent.state===W.OFFLINE?(b.showMessage("未登入,不能切换状态"),!1):this.linePool.getWorkingLineCount()>0?(b.showMessage("正在通话,禁止切换状态"),!1):void("ready"===e?this.agentApi.agentReady():"login"===e?this.agentApi.agentLogin():"logout"===e?this.agentApi.agentLogout():"busy"===e?this.agentApi.agentNotReady(3):"rest"===e&&this.agentApi.agentNotReady(5))}},{key:"makeCall",value:function(e){4===(e=e||this.dialPad.getPhoneNumber()).length&&"0"!==this.agent.tid&&(e=this.agent.tid+e);var t=9===e.length&&"1"===e.charAt(0)?1:3;this.agentApi.makeCall(e,-1,t)}},{key:"updateTransferMenu",value:function(e){var t=this.getComponent("transfer");e&&e.forEach((function(e){"transferOutLine"===e.type&&(e.contacts=e.menu,e.menu=[])})),t.updateMenuData(e)}},{key:"onTransferItemClick",value:function(e){"transferOutLine"===e.type?this._showDialPad({title:"转外线号码",contacts:e.contacts,btnName:"咨询",onDynamicButtonClick:this._transferThis.bind(this)}):"doublestep"===e.type?this.agentApi.consult(e.agentId):e.ivrId?this.agentApi.singleStepTransfer("ivr_"+e.ivrId):"singlestep"===e.type&&this.agentApi.singleStepTransfer(e.agentId)}},{key:"updateConferenceMenu",value:function(e){var t=this.getComponent("conference");e&&e.forEach((function(e){"only"===e.type&&(e.contacts=e.menu,e.menu=[])})),t.updateMenuData(e)}},{key:"onConferenceItemClick",value:function(e){var t=this;"only"===e.type?"user_defined"===e.id?this._showDialPad({title:"加入自定义电话",contacts:e.contacts,btnName:"会议",onDynamicButtonClick:function(){t.agentApi.threeWayCall(t.dialPad.getPhoneNumber())}}):"conversation"===e.id&&this._showThreewayCallBox():this.agentApi.threeWayCall(e.agentId)}},{key:"_transferThis",value:function(){var e=this.dialPad.getPhoneNumber(),t=this.linePool.getCurrentLine();if(t.lineState===T.HELD)this.agentApi.completeTransfer(),this.dynamicButton.title="咨询",this.dynamicButton.innerText="咨询";else{var n=this.agent.thisDN;t.phoneNumber===e?b.showMessage("不能转接当前正在接通的号码"):e===n?b.showMessage("不能转接自己"):t.lineState===T.TALKING?(this.agentApi.consult(e),this.dialPad.setPhoneNumber(e),this.dynamicButton.title="转出",this.dynamicButton.innerText="转出"):b.showMessage("当前线路未在通话中,不能转接")}}},{key:"_showThreewayCallBox",value:function(){var e=this;this.threewayCallBox?this.threewayCallBox.show():(this.threewayCallBox=new le({title:"多方通话管理",onJoinButtonClick:function(t){e.agentApi.threeWayCall(t)},onRemoveCallButtonClick:function(t){e.agentApi.releaseThreeWayCall(t)},onRemoveAllCallButtonClick:function(){e.agentApi.releaseThreeWayCall("non_moderator")}}),this.threewayCallData.forEach((function(t){e.threewayCallBox.join(t.phoneNumber,t.callID)})),this.threewayCallBox.show())}},{key:"_showDialPad",value:function(e){var t=this,n=e.title,o=void 0===n?"拨号":n,i=e.contacts,a=void 0===i?[]:i,s=e.btnName,r=e.onDynamicButtonClick,u=void 0===r?function(){}:r;this.dialPad&&this.dialPad.destroy(),this.dynamicButton=se.createButton({btnName:s,className:"text-navy dialbtn",onClick:u}),this.dialPad=new se({title:o,contacts:a,dynamicButton:this.dynamicButton,onHangupButtonClick:function(){t.agentApi.releaseCall()}}),this.dialPad.show()}},{key:"destroy",value:function(){this._rootNode&&this._rootNode.parentNode&&this._rootNode.parentNode.removeChild(this._rootNode),this.dialPad&&this.dialPad.destroy(),this.threewayCallBox&&this.threewayCallBox.destroy(),this.agentApi.agentLogout(),this.connection.doClose(),!this.softPhoneConnection||this.softPhoneConnection.doClose()}}]),t}(g.a);de.utils=b,de.Log=q;t.default=de}]).default}));